guard-bundler 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86c9c5fc2381cc2a3b980bc0b5418e2f1da50d60
4
+ data.tar.gz: f0cefc476c0549a53f303e98aff50911a375a05d
5
+ SHA512:
6
+ metadata.gz: aa20ac664ef4d9b9c282c43275b3e4ca41ab513ed6ce196c93b6ea0323e1542e13d7d0c81507a11a88ceb4c89cce237116b6008cee33a461ae26d0448c003ea1
7
+ data.tar.gz: 09b3dcbf73326a7841c238ac8199b793dcc8069feda7f2b14386156127e3a873444180847352df033acb506897feccb66028640def0a705978e9f9b054bab483
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Guard::Bundler
2
2
 
3
+ [![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)
4
+
3
5
  Bundler guard allows to automatically & intelligently install/update bundle when needed.
4
6
 
5
7
  * Compatible with Bundler 1.0.x
6
- * Tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of Rubinius.
8
+ * Tested against Ruby 1.9.3, 2.0.0, Rubinius & JRuby (1.9 mode only).
7
9
 
8
10
  ## Install
9
11
 
@@ -11,13 +13,13 @@ Please be sure to have [Guard](https://github.com/guard/guard) installed before
11
13
 
12
14
  Install the gem:
13
15
 
14
- ```
16
+ ```bash
15
17
  $ gem install guard-bundler
16
18
  ```
17
19
 
18
- Add it to your Gemfile (inside development group):
20
+ Add it to your `Gemfile`:
19
21
 
20
- ``` ruby
22
+ ```ruby
21
23
  group :development do
22
24
  gem 'guard-bundler'
23
25
  end
@@ -25,7 +27,7 @@ end
25
27
 
26
28
  Add guard definition to your Guardfile by running this command:
27
29
 
28
- ```
30
+ ```bash
29
31
  $ guard init bundler
30
32
  ```
31
33
 
@@ -40,7 +42,7 @@ Bundler guard can be really adapted to all kind of projects.
40
42
  ### Standard RubyGem project
41
43
 
42
44
  ```ruby
43
- guard 'bundler' do
45
+ guard :bundler do
44
46
  watch('Gemfile')
45
47
  # Uncomment next line if Gemfile contain `gemspec' command
46
48
  # watch(/^.+\.gemspec/)
@@ -49,7 +51,7 @@ end
49
51
 
50
52
  Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
51
53
 
52
- == Development
54
+ ## Development
53
55
 
54
56
  * Source hosted at [GitHub](https://github.com/guard/guard-bundler)
55
57
  * Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-bundler/issues)
@@ -57,6 +59,10 @@ Please read [Guard doc](https://github.com/guard/guard#readme) for more informat
57
59
  Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
58
60
  you make.
59
61
 
60
- == Authors
62
+ ## Author
63
+
64
+ [Yann Lugrin](https://github.com/yannlugrin)
65
+
66
+ ## Contributors
61
67
 
62
- {Yann Lugrin}[https://github.com/yannlugrin]
68
+ [https://github.com/guard/guard-bundler/graphs/contributors](https://github.com/guard/guard-bundler/graphs/contributors)
data/lib/guard/bundler.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # encoding: utf-8
2
2
  require 'guard'
3
- require 'guard/guard'
3
+ require 'guard/plugin'
4
4
  require 'bundler'
5
5
 
6
6
  module Guard
7
- class Bundler < Guard
7
+ class Bundler < Plugin
8
8
  autoload :Notifier, 'guard/bundler/notifier'
9
9
 
10
10
  def start
@@ -34,27 +34,43 @@ module Guard
34
34
  private
35
35
 
36
36
  def refresh_bundle
37
- if bundle_need_refresh?
38
- ::Guard::UI.info 'Refresh bundle', :reset => true
39
- start_at = Time.now
40
- ::Bundler.with_clean_env do
41
- @result = system("bundle install#{" #{options[:cli]}" if options[:cli]}")
42
- end
43
- Notifier.notify(@result, Time.now - start_at)
44
- @result
37
+ start_at = Time.now
38
+ result = bundle_check || bundle_install
39
+ duration = Time.now - start_at
40
+ case result
41
+ when :bundle_already_up_to_date
42
+ ::Guard::UI.info 'Bundle already up-to-date', reset: true
43
+ when :bundle_installed_using_local_gems
44
+ ::Guard::UI.info 'Bundle installed using local gems', reset: true
45
+ Notifier.notify 'bundle_check_install', nil
46
+ when :bundle_installed
47
+ ::Guard::UI.info 'Bundle installed', reset: true
48
+ Notifier.notify true, duration
45
49
  else
46
- UI.info 'Bundle already up-to-date', :reset => true
47
- Notifier.notify('up-to-date', nil)
48
- true
50
+ ::Guard::UI.info "Bundle can't be installed -- Please check manually", reset: true
51
+ Notifier.notify false, nil
49
52
  end
53
+ result
50
54
  end
51
55
 
52
- def bundle_need_refresh?
56
+ def bundle_check
57
+ gemfile_lock_mtime = File.exists?('Gemfile.lock') ? File.mtime('Gemfile.lock') : nil
53
58
  ::Bundler.with_clean_env do
54
59
  `bundle check`
55
60
  end
56
- $? == 0 ? false : true
61
+ return false unless $? == 0
62
+ if gemfile_lock_mtime && gemfile_lock_mtime == File.mtime('Gemfile.lock')
63
+ :bundle_already_up_to_date
64
+ else
65
+ :bundle_installed_using_local_gems
66
+ end
57
67
  end
58
68
 
69
+ def bundle_install
70
+ ::Bundler.with_clean_env do
71
+ system("bundle install#{" #{options[:cli]}" if options[:cli]}")
72
+ end
73
+ $? == 0 ? :bundle_installed : false
74
+ end
59
75
  end
60
76
  end
@@ -7,10 +7,12 @@ module Guard
7
7
  case result
8
8
  when 'up-to-date'
9
9
  "Bundle already up-to-date"
10
+ when 'bundle_check_install'
11
+ "Bundle installed using local gems"
10
12
  when true
11
- "Bundle has been updated\nin %.1f seconds." % [duration]
13
+ "Bundle has been installed\nin %.1f seconds." % [duration]
12
14
  else
13
- "Bundle can't be updated,\nplease check manually."
15
+ "Bundle can't be installed,\nplease check manually."
14
16
  end
15
17
  end
16
18
 
@@ -27,7 +29,7 @@ module Guard
27
29
  message = guard_message(result, duration)
28
30
  image = guard_image(result)
29
31
 
30
- ::Guard::Notifier.notify(message, :title => 'Bundle update', :image => image)
32
+ ::Guard::Notifier.notify(message, title: 'bundle install', image: image)
31
33
  end
32
34
 
33
35
  end
@@ -1,5 +1,5 @@
1
- guard 'bundler' do
1
+ guard :bundler do
2
2
  watch('Gemfile')
3
- # Uncomment next line if Gemfile contain `gemspec' command
3
+ # Uncomment next line if your Gemfile contains the `gemspec' command.
4
4
  # watch(/^.+\.gemspec/)
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Guard
3
3
  module BundlerVersion
4
- VERSION = '1.0.0'
4
+ VERSION = '2.0.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Yann Lugrin
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-15 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: guard
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '1.1'
19
+ version: '2.2'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: '1.1'
26
+ version: '2.2'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,35 +41,17 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
- version: '2.6'
47
+ version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
- version: '2.6'
62
- - !ruby/object:Gem::Dependency
63
- name: guard-rspec
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '1.0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '1.0'
54
+ version: '0'
78
55
  description: Guard::Bundler automatically install/update your gem bundle when needed
79
56
  email:
80
57
  - yann.lugrin@sans-savoir.net
@@ -88,32 +65,28 @@ files:
88
65
  - lib/guard/bundler.rb
89
66
  - LICENSE
90
67
  - README.md
91
- homepage: http://rubygems.org/gems/guard-bundler
92
- licenses: []
68
+ homepage: https://rubygems.org/gems/guard-bundler
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
93
72
  post_install_message:
94
- rdoc_options:
95
- - --charset=UTF-8
96
- - --main=README.md
97
- - --exclude='(lib|test|spec)|(Gem|Guard|Rake)file'
73
+ rdoc_options: []
98
74
  require_paths:
99
75
  - lib
100
76
  required_ruby_version: !ruby/object:Gem::Requirement
101
- none: false
102
77
  requirements:
103
- - - ! '>='
78
+ - - '>='
104
79
  - !ruby/object:Gem::Version
105
- version: '0'
80
+ version: 1.9.2
106
81
  required_rubygems_version: !ruby/object:Gem::Requirement
107
- none: false
108
82
  requirements:
109
- - - ! '>='
83
+ - - '>='
110
84
  - !ruby/object:Gem::Version
111
- version: 1.3.6
85
+ version: '0'
112
86
  requirements: []
113
- rubyforge_project: guard-bundler
114
- rubygems_version: 1.8.24
87
+ rubyforge_project:
88
+ rubygems_version: 2.1.10
115
89
  signing_key:
116
- specification_version: 3
90
+ specification_version: 4
117
91
  summary: Guard gem for Bundler
118
92
  test_files: []
119
- has_rdoc: