guard-bundler 0.1.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.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Yann Lugrin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,51 @@
1
+ = Guard::Bundler
2
+
3
+ Bundler guard allows to automatically & intelligently install/update bundle when needed.
4
+
5
+ - Compatible with Bundler 1.0.x
6
+ - Tested on Ruby 1.8.6, 1.8.7 & 1.9.2.
7
+
8
+ == Install
9
+
10
+ Please be sure to have {guard}[http://github.com/guard/guard] installed before continue.
11
+
12
+ Install the gem:
13
+
14
+ gem install guard-bundler
15
+
16
+ Add it to your Gemfile (inside test group):
17
+
18
+ gem 'guard-bundler'
19
+
20
+ Add guard definition to your Guardfile by running this command:
21
+
22
+ guard init bundler
23
+
24
+ == Usage
25
+
26
+ Please read {guard usage doc}[http://github.com/guard/guard#readme]
27
+
28
+ == Guardfile
29
+
30
+ Bundler guard can be really be adapated to all kind of projects.
31
+ Please read {guard doc}[http://github.com/guard/guard#readme] for more info about Guardfile DSL.
32
+
33
+ === Standard ruby gems
34
+
35
+ guard 'bundler' do
36
+ watch('^Gemfile')
37
+ # Uncomment next line if Gemfile contain `gemspec' command
38
+ # watch('^.+\.gemspec')
39
+ end
40
+
41
+ == Development
42
+
43
+ - Source hosted at {GitHub}[http://github.com/guard/guard-bundler]
44
+ - Report issues/Questions/Feature requests on {GitHub Issues}[http://github.com/guard/guard-bundler/issues]
45
+
46
+ Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
47
+ you make.
48
+
49
+ == Authors
50
+
51
+ {Yann Lugrin}[http://github.com/yannlugrin]
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+ require 'guard'
3
+ require 'guard/guard'
4
+
5
+ module Guard
6
+ class Bundler < Guard
7
+
8
+ autoload :Notifier, 'guard/bundler/notifier'
9
+
10
+ def start
11
+ return refresh_bundle if bundle_need_refresh?
12
+ true
13
+ end
14
+
15
+ def reload
16
+ refresh_bundle
17
+ end
18
+
19
+ def run_on_change(paths = [])
20
+ return refresh_bundle if bundle_need_refresh?
21
+ true
22
+ end
23
+
24
+ private
25
+
26
+ def bundle_need_refresh?
27
+ `bundle check`
28
+ $? == 0 ? false : true
29
+ end
30
+
31
+ def refresh_bundle
32
+ UI.info 'Refresh bundle', :reset => true
33
+ system('bundle install')
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ module Guard
3
+ class Bundler
4
+ class Notifier
5
+
6
+ def self.guard_message(result, duration)
7
+ message = ''
8
+ if result
9
+ message << "Bundle has been updated\nin %.1f seconds." % [duration]
10
+ else
11
+ message << 'Bundle can\t be updated,\nplease check manually.'
12
+ end
13
+ message
14
+ end
15
+
16
+ # failed | success
17
+ def self.guard_image(result)
18
+ icon = if result
19
+ :success
20
+ else
21
+ :failed
22
+ end
23
+ end
24
+
25
+ def self.notify(result, duration)
26
+ message = guard_message(result, duration)
27
+ image = guard_image(result)
28
+
29
+ ::Guard::Notifier.notify(message, :title => 'Bundle update', :image => image)
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ guard 'bundler' do
2
+ watch('^Gemfile')
3
+ # Uncomment next line if Gemfile contain `gemspec' command
4
+ # watch('^.+\.gemspec')
5
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ module Guard
3
+ module BundlerVersion
4
+ VERSION = '0.1.0'
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-bundler
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Yann Lugrin
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-24 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: guard
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 0
32
+ - 2
33
+ - 1
34
+ version: 0.2.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 2
50
+ version: 1.0.2
51
+ type: :development
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 13
62
+ segments:
63
+ - 2
64
+ - 0
65
+ - 1
66
+ version: 2.0.1
67
+ type: :development
68
+ version_requirements: *id003
69
+ description: Guard::Bundler automatically install/update your gem bundle when needed
70
+ email:
71
+ - yann.lugrin@sans-savoir.net
72
+ executables: []
73
+
74
+ extensions: []
75
+
76
+ extra_rdoc_files: []
77
+
78
+ files:
79
+ - lib/guard/bundler.rb
80
+ - lib/guard/bundler/templates/Guardfile
81
+ - lib/guard/bundler/notifier.rb
82
+ - lib/guard/bundler/version.rb
83
+ - LICENSE
84
+ - README.rdoc
85
+ has_rdoc: true
86
+ homepage: http://rubygems.org/gems/guard-bundler
87
+ licenses: []
88
+
89
+ post_install_message:
90
+ rdoc_options: []
91
+
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 23
109
+ segments:
110
+ - 1
111
+ - 3
112
+ - 6
113
+ version: 1.3.6
114
+ requirements: []
115
+
116
+ rubyforge_project: guard-bundler
117
+ rubygems_version: 1.3.7
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: Guard gem for Bundler
121
+ test_files: []
122
+