diff --git a/.travis.yml b/.travis.yml index 1c22407..d9af5f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,10 @@ language: ruby bundler_args: --without development rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - - ruby-head - - ree - - jruby-18mode + - 2.0.0 - jruby-19mode - - jruby-head - - rbx-18mode - rbx-19mode -matrix: - allow_failures: - - rvm: ruby-head notifications: recipients: - yann.lugrin@sans-savoir.net diff --git a/Gemfile b/Gemfile index 5d97176..6c071a9 100644 --- a/Gemfile +++ b/Gemfile @@ -5,31 +5,14 @@ gemspec gem 'rake' group :development do + gem 'ruby_gntp' gem 'guard-rspec' - - # optional development dependencies - require 'rbconfig' - - if RbConfig::CONFIG['target_os'] =~ /darwin/i - if `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8' - gem 'terminal-notifier-guard', '~> 1.5.3', :require => false - else - gem 'growl', :require => false - end rescue Errno::ENOENT - - elsif RbConfig::CONFIG['target_os'] =~ /linux/i - gem 'libnotify', '~> 0.8.0', :require => false - - elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i - gem 'win32console', :require => false - gem 'rb-notifu', '>= 0.0.4', :require => false - end end # The test group will be # installed on Travis CI # group :test do - gem 'rspec', '>= 2.14.1' - gem 'coveralls', :require => false + gem 'rspec' + gem 'coveralls', require: false end diff --git a/Guardfile b/Guardfile index aa9ca37..19e969a 100644 --- a/Guardfile +++ b/Guardfile @@ -1,10 +1,10 @@ -guard 'bundler' do +guard :bundler do watch('Gemfile') watch(%r{^.+\.gemspec$}) end -guard 'rspec', :version => 2 do +guard :rspec do watch(%r{^spec/.+_spec\.rb$}) - watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } - watch('spec/spec_helper.rb') { 'spec' } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { 'spec' } end diff --git a/README.md b/README.md index 1e17152..0910269 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Guard::Bundler + [![Gem Version](https://badge.fury.io/rb/guard-bundler.png)](http://badge.fury.io/rb/guard-bundler) [![Build Status](https://travis-ci.org/guard/guard-bundler.png?branch=master)](https://travis-ci.org/guard/guard-bundler) [![Dependency Status](https://gemnasium.com/guard/guard-bundler.png)](https://gemnasium.com/guard/guard-bundler) [![Code Climate](https://codeclimate.com/github/guard/guard-bundler.png)](https://codeclimate.com/github/guard/guard-bundler) [![Coverage Status](https://coveralls.io/repos/guard/guard-bundler/badge.png?branch=master)](https://coveralls.io/r/guard/guard-bundler) Bundler guard allows to automatically & intelligently install/update bundle when needed. * Compatible with Bundler 1.0.x -* Tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of Rubinius. +* Tested against Ruby 1.9.3, 2.0.0, Rubinius & JRuby (1.9 mode only). ## Install @@ -12,13 +13,13 @@ Please be sure to have [Guard](https://github.com/guard/guard) installed before Install the gem: -``` +```bash $ gem install guard-bundler ``` -Add it to your Gemfile (inside development group): +Add it to your `Gemfile`: -``` ruby +```ruby group :development do gem 'guard-bundler' end @@ -26,7 +27,7 @@ end Add guard definition to your Guardfile by running this command: -``` +```bash $ guard init bundler ``` @@ -41,7 +42,7 @@ Bundler guard can be really adapted to all kind of projects. ### Standard RubyGem project ```ruby -guard 'bundler' do +guard :bundler do watch('Gemfile') # Uncomment next line if Gemfile contain `gemspec' command # watch(/^.+\.gemspec/) @@ -58,6 +59,10 @@ Please read [Guard doc](https://github.com/guard/guard#readme) for more informat Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make. -## Authors +## Author [Yann Lugrin](https://github.com/yannlugrin) + +## Contributors + +[https://github.com/guard/guard-bundler/graphs/contributors](https://github.com/guard/guard-bundler/graphs/contributors) diff --git a/Rakefile b/Rakefile index 13fa60f..58cef28 100644 --- a/Rakefile +++ b/Rakefile @@ -1,48 +1,5 @@ -require 'bundler' -Bundler::GemHelper.install_tasks +require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) -task :default => :spec - -require 'rbconfig' -namespace(:spec) do - if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/i - desc "Run all specs on multiple ruby versions (requires pik)" - task(:portability) do - %w[187 192 161].each do |version| - system "cmd /c echo -----------#{version}------------ & " + - "pik use #{version} & " + - "bundle install & " + - "bundle exec rspec spec" - end - end - else - desc "Run all specs on multiple ruby versions (requires rvm)" - task(:portability) do - travis_config_file = File.expand_path("../.travis.yml", __FILE__) - begin - travis_options ||= YAML::load_file(travis_config_file) - rescue => ex - puts "Travis config file '#{travis_config_file}' could not be found: #{ex.message}" - return - end - - travis_options['rvm'].each do |version| - system <<-BASH - bash -c 'source ~/.rvm/scripts/rvm; - rvm #{version}; - ruby_version_string_size=`ruby -v | wc -m` - echo; - for ((c=1; c<$ruby_version_string_size; c++)); do echo -n "="; done - echo; - echo "`ruby -v`"; - for ((c=1; c<$ruby_version_string_size; c++)); do echo -n "="; done - echo; - bundle install; - bundle exec rspec spec -f doc 2>&1;' - BASH - end - end - end -end \ No newline at end of file +task default: :spec diff --git a/guard-bundler.gemspec b/guard-bundler.gemspec index 41b833c..a87acf5 100644 --- a/guard-bundler.gemspec +++ b/guard-bundler.gemspec @@ -9,17 +9,16 @@ Gem::Specification.new do |s| s.license = 'MIT' s.authors = ['Yann Lugrin'] s.email = ['yann.lugrin@sans-savoir.net'] - s.homepage = 'http://rubygems.org/gems/guard-bundler' + s.homepage = 'https://rubygems.org/gems/guard-bundler' s.summary = 'Guard gem for Bundler' s.description = 'Guard::Bundler automatically install/update your gem bundle when needed' - s.required_rubygems_version = '>= 1.3.6' - s.rubyforge_project = 'guard-bundler' + s.required_ruby_version = '>= 1.9.2' - s.add_dependency 'guard', '~> 1.1' + s.add_dependency 'guard', '~> 2.2' s.add_dependency 'bundler', '~> 1.0' - s.add_development_dependency 'rspec', '>= 2.14.1' + s.add_development_dependency 'rspec' s.files = Dir.glob('{lib}/**/*') + %w[LICENSE README.md] s.require_path = 'lib' diff --git a/lib/guard/bundler.rb b/lib/guard/bundler.rb index cf4ef9f..75ed91d 100644 --- a/lib/guard/bundler.rb +++ b/lib/guard/bundler.rb @@ -1,10 +1,10 @@ # encoding: utf-8 require 'guard' -require 'guard/guard' +require 'guard/plugin' require 'bundler' module Guard - class Bundler < Guard + class Bundler < Plugin autoload :Notifier, 'guard/bundler/notifier' def start @@ -39,15 +39,15 @@ def refresh_bundle duration = Time.now - start_at case result when :bundle_already_up_to_date - ::Guard::UI.info 'Bundle already up-to-date', :reset => true + ::Guard::UI.info 'Bundle already up-to-date', reset: true when :bundle_installed_using_local_gems - ::Guard::UI.info 'Bundle installed using local gems', :reset => true + ::Guard::UI.info 'Bundle installed using local gems', reset: true Notifier.notify 'bundle_check_install', nil when :bundle_installed - ::Guard::UI.info 'Bundle installed', :reset => true + ::Guard::UI.info 'Bundle installed', reset: true Notifier.notify true, duration else - ::Guard::UI.info "Bundle can't be installed -- Please check manually", :reset => true + ::Guard::UI.info "Bundle can't be installed -- Please check manually", reset: true Notifier.notify false, nil end result diff --git a/lib/guard/bundler/notifier.rb b/lib/guard/bundler/notifier.rb index 433d343..48cb001 100644 --- a/lib/guard/bundler/notifier.rb +++ b/lib/guard/bundler/notifier.rb @@ -29,7 +29,7 @@ def self.notify(result, duration) message = guard_message(result, duration) image = guard_image(result) - ::Guard::Notifier.notify(message, :title => 'bundle install', :image => image) + ::Guard::Notifier.notify(message, title: 'bundle install', image: image) end end diff --git a/lib/guard/bundler/templates/Guardfile b/lib/guard/bundler/templates/Guardfile index 11cbd6b..80158fe 100644 --- a/lib/guard/bundler/templates/Guardfile +++ b/lib/guard/bundler/templates/Guardfile @@ -1,4 +1,4 @@ -guard 'bundler' do +guard :bundler do watch('Gemfile') # Uncomment next line if your Gemfile contains the `gemspec' command. # watch(/^.+\.gemspec/) diff --git a/lib/guard/bundler/version.rb b/lib/guard/bundler/version.rb index 6ddeed0..6ee44ab 100644 --- a/lib/guard/bundler/version.rb +++ b/lib/guard/bundler/version.rb @@ -1,6 +1,6 @@ # encoding: utf-8 module Guard module BundlerVersion - VERSION = '1.0.0' + VERSION = '2.0.0' end end diff --git a/spec/guard/bundler/notifier_spec.rb b/spec/guard/bundler/notifier_spec.rb index d4b3037..72cd26e 100644 --- a/spec/guard/bundler/notifier_spec.rb +++ b/spec/guard/bundler/notifier_spec.rb @@ -25,8 +25,8 @@ it 'should call Guard::Notifier' do ::Guard::Notifier.should_receive(:notify).with( "Bundle has been installed\nin 10.1 seconds.", - :title => 'bundle install', - :image => :success + title: 'bundle install', + image: :success ) subject.notify(true, 10.1) end diff --git a/spec/guard/bundler_spec.rb b/spec/guard/bundler_spec.rb index ab3a66d..f353ab5 100644 --- a/spec/guard/bundler_spec.rb +++ b/spec/guard/bundler_spec.rb @@ -18,7 +18,7 @@ end it 'should be set to true' do - subject = Guard::Bundler.new([], {:cli => '--binstubs'}) + subject = Guard::Bundler.new(cli: '--binstubs') subject.options[:cli].should be_true end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8295ac2..d5543b2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,7 +13,7 @@ RSpec.configure do |config| config.color_enabled = true - config.filter_run :focus => true + config.filter_run focus: true config.run_all_when_everything_filtered = true config.before(:each) do