Skip to content

Commit

Permalink
Merge pull request #20 from guard/v2.0
Browse files Browse the repository at this point in the history
v2.0
  • Loading branch information
rymai committed Oct 30, 2013
2 parents 1f86329 + 4ed9393 commit d6bf367
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 104 deletions.
11 changes: 1 addition & 10 deletions .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
Expand Down
23 changes: 3 additions & 20 deletions Gemfile
Expand Up @@ -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
8 changes: 4 additions & 4 deletions 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
19 changes: 12 additions & 7 deletions README.md
@@ -1,32 +1,33 @@
# 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

Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.

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
```

Add guard definition to your Guardfile by running this command:

```
```bash
$ guard init bundler
```

Expand All @@ -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/)
Expand All @@ -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)
47 changes: 2 additions & 45 deletions 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
task default: :spec
9 changes: 4 additions & 5 deletions guard-bundler.gemspec
Expand Up @@ -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'
Expand Down
12 changes: 6 additions & 6 deletions 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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/guard/bundler/notifier.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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/)
Expand Down
2 changes: 1 addition & 1 deletion 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
4 changes: 2 additions & 2 deletions spec/guard/bundler/notifier_spec.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/guard/bundler_spec.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -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
Expand Down

0 comments on commit d6bf367

Please sign in to comment.