guard-bundler 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -11
- data/lib/guard/bundler.rb +36 -6
- data/lib/guard/bundler/templates/Guardfile +2 -2
- data/lib/guard/bundler/version.rb +1 -1
- metadata +4 -32
data/README.rdoc
CHANGED
@@ -7,7 +7,7 @@ Bundler guard allows to automatically & intelligently install/update bundle when
|
|
7
7
|
|
8
8
|
== Install
|
9
9
|
|
10
|
-
Please be sure to have {
|
10
|
+
Please be sure to have {Guard}[https://github.com/guard/guard] installed before continue.
|
11
11
|
|
12
12
|
Install the gem:
|
13
13
|
|
@@ -23,21 +23,19 @@ Add guard definition to your Guardfile by running this command:
|
|
23
23
|
|
24
24
|
== Usage
|
25
25
|
|
26
|
-
Please read {
|
26
|
+
Please read {Guard usage doc}[https://github.com/guard/guard#readme]
|
27
27
|
|
28
28
|
== Guardfile
|
29
29
|
|
30
|
-
Bundler guard can be really be
|
31
|
-
|
32
|
-
|
33
|
-
Attention place bundler guard before other is recommended.
|
30
|
+
Bundler guard can be really be adapted to all kind of projects.
|
31
|
+
Advice: place Bundler guard before other is recommended.
|
34
32
|
|
35
33
|
=== Standard ruby gems
|
36
34
|
|
37
35
|
guard 'bundler' do
|
38
|
-
watch('
|
36
|
+
watch('Gemfile')
|
39
37
|
# Uncomment next line if Gemfile contain `gemspec' command
|
40
|
-
# watch(
|
38
|
+
# watch(/^.+\.gemspec/)
|
41
39
|
end
|
42
40
|
|
43
41
|
== Options
|
@@ -48,14 +46,16 @@ You can disable desktop notification with:
|
|
48
46
|
...
|
49
47
|
end
|
50
48
|
|
49
|
+
Please read {Guard doc}[https://github.com/guard/guard#readme] for more info about Guardfile DSL.
|
50
|
+
|
51
51
|
== Development
|
52
52
|
|
53
|
-
- Source hosted at {GitHub}[
|
54
|
-
- Report issues/Questions/Feature requests on {GitHub Issues}[
|
53
|
+
- Source hosted at {GitHub}[https://github.com/guard/guard-bundler]
|
54
|
+
- Report issues/Questions/Feature requests on {GitHub Issues}[https://github.com/guard/guard-bundler/issues]
|
55
55
|
|
56
56
|
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
57
57
|
you make.
|
58
58
|
|
59
59
|
== Authors
|
60
60
|
|
61
|
-
{Yann Lugrin}[
|
61
|
+
{Yann Lugrin}[https://github.com/yannlugrin]
|
data/lib/guard/bundler.rb
CHANGED
@@ -4,13 +4,15 @@ require 'guard/guard'
|
|
4
4
|
|
5
5
|
module Guard
|
6
6
|
class Bundler < Guard
|
7
|
+
BUNDLER_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).freeze
|
7
8
|
|
8
9
|
autoload :Notifier, 'guard/bundler/notifier'
|
9
10
|
|
10
11
|
def initialize(watchers = [], options = {})
|
11
12
|
super
|
12
13
|
|
13
|
-
@
|
14
|
+
@original_env = {}
|
15
|
+
options[:notify] = true if options[:notify].nil?
|
14
16
|
end
|
15
17
|
|
16
18
|
def start
|
@@ -18,6 +20,10 @@ module Guard
|
|
18
20
|
true
|
19
21
|
end
|
20
22
|
|
23
|
+
def stop
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
21
27
|
def reload
|
22
28
|
refresh_bundle
|
23
29
|
end
|
@@ -27,21 +33,45 @@ module Guard
|
|
27
33
|
true
|
28
34
|
end
|
29
35
|
|
36
|
+
private
|
37
|
+
|
30
38
|
def notify?
|
31
|
-
|
39
|
+
!!options[:notify]
|
32
40
|
end
|
33
41
|
|
34
|
-
private
|
35
|
-
|
36
42
|
def bundle_need_refresh?
|
37
|
-
|
43
|
+
with_clean_env do
|
44
|
+
`bundle check`
|
45
|
+
end
|
38
46
|
$? == 0 ? false : true
|
39
47
|
end
|
40
48
|
|
49
|
+
def with_clean_env
|
50
|
+
unset_bundler_env_vars
|
51
|
+
ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, "Gemfile")
|
52
|
+
yield
|
53
|
+
ensure
|
54
|
+
restore_env
|
55
|
+
end
|
56
|
+
|
57
|
+
def unset_bundler_env_vars
|
58
|
+
BUNDLER_ENV_VARS.each do |key|
|
59
|
+
@original_env[key] = ENV[key]
|
60
|
+
ENV[key] = nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def restore_env
|
65
|
+
@original_env.each { |key, value| ENV[key] = value }
|
66
|
+
end
|
67
|
+
|
41
68
|
def refresh_bundle
|
42
69
|
UI.info 'Refresh bundle', :reset => true
|
43
70
|
start_at = Time.now
|
44
|
-
result =
|
71
|
+
result = ''
|
72
|
+
with_clean_env do
|
73
|
+
result = system('bundle install')
|
74
|
+
end
|
45
75
|
Notifier::notify(true, Time.now - start_at) if notify?
|
46
76
|
result
|
47
77
|
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.2
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Yann Lugrin
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-02-18 00:00:00 +01:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ">="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 19
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 2
|
33
|
-
- 2
|
34
24
|
version: 0.2.2
|
35
25
|
type: :runtime
|
36
26
|
version_requirements: *id001
|
@@ -42,11 +32,6 @@ dependencies:
|
|
42
32
|
requirements:
|
43
33
|
- - ~>
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 19
|
46
|
-
segments:
|
47
|
-
- 1
|
48
|
-
- 0
|
49
|
-
- 2
|
50
35
|
version: 1.0.2
|
51
36
|
type: :development
|
52
37
|
version_requirements: *id002
|
@@ -58,11 +43,6 @@ dependencies:
|
|
58
43
|
requirements:
|
59
44
|
- - ~>
|
60
45
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 13
|
62
|
-
segments:
|
63
|
-
- 2
|
64
|
-
- 0
|
65
|
-
- 1
|
66
46
|
version: 2.0.1
|
67
47
|
type: :development
|
68
48
|
version_requirements: *id003
|
@@ -98,25 +78,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
78
|
requirements:
|
99
79
|
- - ">="
|
100
80
|
- !ruby/object:Gem::Version
|
101
|
-
hash: 3
|
102
|
-
segments:
|
103
|
-
- 0
|
104
81
|
version: "0"
|
105
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
83
|
none: false
|
107
84
|
requirements:
|
108
85
|
- - ">="
|
109
86
|
- !ruby/object:Gem::Version
|
110
|
-
hash: 23
|
111
|
-
segments:
|
112
|
-
- 1
|
113
|
-
- 3
|
114
|
-
- 6
|
115
87
|
version: 1.3.6
|
116
88
|
requirements: []
|
117
89
|
|
118
90
|
rubyforge_project: guard-bundler
|
119
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.5.2
|
120
92
|
signing_key:
|
121
93
|
specification_version: 3
|
122
94
|
summary: Guard gem for Bundler
|