Permalink
Browse files

Use git config, deprecate environment variable

  • Loading branch information...
1 parent 1bbb51c commit 9cc6d3fcd9daa220bdac100528a66acebdcf2579 @aanand committed Mar 1, 2011
Showing with 36 additions and 4 deletions.
  1. +9 −3 README.md
  2. +27 −1 lib/git-up.rb
View
@@ -15,8 +15,14 @@ although
configuration
-------------
-`git-up` now has some configuration. Yay.
+`git-up` can check your app for any new bundled gems and suggest a `bundle install` if necessary.
-As of `v0.4.1`, `git-up` can check your app for any new bundled gems and suggest a `bundle install` if necessary.
+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:
-It slows the process down slightly, and is therefore enabled by setting `GIT_UP_BUNDLER_CHECK='true'` in your `.bashrc`, `.profile`, or whatever.
+ git config --global git-up.bundler.check true
+
+To set it within a project, run this command inside that project's directory:
+
+ git config git-up.bundler.check true
+
+Replace 'true' with 'false' to disable checking.
View
@@ -183,7 +183,33 @@ def message
private
def use_bundler?
- ENV['GIT_UP_BUNDLER_CHECK'] == 'true' and File.exists? 'Gemfile'
+ use_bundler_config? and File.exists? 'Gemfile'
+ end
+
+ def use_bundler_config?
+ if ENV.has_key?('GIT_UP_BUNDLER_CHECK')
+ puts <<-EOS.yellow
+The GIT_UP_BUNDLER_CHECK environment variable is deprecated.
+You can now tell git-up to check (or not check) for missing
+gems on a per-project basis using git's config system. To
+set it globally, run this command anywhere:
+
+ git config --global git-up.bundler.check true
+
+To set it within a project, run this command inside that
+project's directory:
+
+ git config git-up.bundler.check true
+
+Replace 'true' with 'false' to disable checking.
+EOS
+ end
+
+ config("bundler.check") == 'true' || ENV['GIT_UP_BUNDLER_CHECK'] == 'true'
+ end
+
+ def config(key)
+ repo.config["git-up.#{key}"]
end
end

0 comments on commit 9cc6d3f

Please sign in to comment.