git-up 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +11 -3
  2. data/lib/git-up.rb +36 -2
  3. data/lib/git-up/version.rb +1 -1
  4. metadata +4 -4
data/README.md CHANGED
@@ -15,8 +15,16 @@ although
15
15
  configuration
16
16
  -------------
17
17
 
18
- `git-up` now has some configuration. Yay.
18
+ `git-up` can check your app for any new bundled gems and suggest a `bundle install` if necessary.
19
19
 
20
- As of `v0.4.1`, `git-up` can check your app for any new bundled gems and suggest a `bundle install` if necessary.
20
+ It slows the process down slightly, and is therefore enabled by setting `git-up.bundler.check` to `true` in your git config, either globally or per-project. To set it globally, run this command anywhere:
21
21
 
22
- It slows the process down slightly, and is therefore enabled by setting `GIT_UP_BUNDLER_CHECK='true'` in your `.bashrc`, `.profile`, or whatever.
22
+ git config --global git-up.bundler.check true
23
+
24
+ To set it within a project, run this command inside that project's directory:
25
+
26
+ git config git-up.bundler.check true
27
+
28
+ Replace 'true' with 'false' to disable checking.
29
+
30
+ If you're even lazier, you can tell `git-up` to run `bundle install` for you if it finds missing gems. Simply set `git-up.bundler.autoinstall` to `true`, in the same manner. As above, it works globally or per-project, but make sure `git-up.bundler.check` is also set to `true` or it won't do anything.
data/lib/git-up.rb CHANGED
@@ -147,7 +147,15 @@ class GitUp
147
147
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile')
148
148
  Bundler.setup
149
149
  rescue Bundler::GemNotFound, Bundler::GitError
150
- puts 'Gems are missing. You should `bundle install`.'.yellow
150
+ puts
151
+ print 'Gems are missing. '.yellow
152
+
153
+ if config("bundler.autoinstall") == 'true'
154
+ puts "Running `bundle install`.".yellow
155
+ system "bundle", "install"
156
+ else
157
+ puts "You should `bundle install`.".yellow
158
+ end
151
159
  end
152
160
  end
153
161
 
@@ -183,7 +191,33 @@ class GitUp
183
191
  private
184
192
 
185
193
  def use_bundler?
186
- ENV['GIT_UP_BUNDLER_CHECK'] == 'true' and File.exists? 'Gemfile'
194
+ use_bundler_config? and File.exists? 'Gemfile'
195
+ end
196
+
197
+ def use_bundler_config?
198
+ if ENV.has_key?('GIT_UP_BUNDLER_CHECK')
199
+ puts <<-EOS.yellow
200
+ The GIT_UP_BUNDLER_CHECK environment variable is deprecated.
201
+ You can now tell git-up to check (or not check) for missing
202
+ gems on a per-project basis using git's config system. To
203
+ set it globally, run this command anywhere:
204
+
205
+ git config --global git-up.bundler.check true
206
+
207
+ To set it within a project, run this command inside that
208
+ project's directory:
209
+
210
+ git config git-up.bundler.check true
211
+
212
+ Replace 'true' with 'false' to disable checking.
213
+ EOS
214
+ end
215
+
216
+ config("bundler.check") == 'true' || ENV['GIT_UP_BUNDLER_CHECK'] == 'true'
217
+ end
218
+
219
+ def config(key)
220
+ repo.config["git-up.#{key}"]
187
221
  end
188
222
  end
189
223
 
@@ -1,3 +1,3 @@
1
1
  class GitUp
2
- VERSION = "0.4.4"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- - 4
9
- version: 0.4.4
7
+ - 5
8
+ - 0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aanand Prasad
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-02-10 00:00:00 +00:00
20
+ date: 2011-03-01 00:00:00 +00:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency