summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuanitoFatas <katehuang0320@gmail.com>2016-08-26 17:15:35 +0800
committerJuanitoFatas <katehuang0320@gmail.com>2016-08-26 23:27:01 +0800
commit73fc9058bd2ee78e707e34cdc6f9ea62cbadcb14 (patch)
tree42de44ad66429ffdc46ba9a5a6a22d40505e3811
parenta4a5f1c53156e85c597e9938f08e874930199957 (diff)
downloadbundler-73fc9058bd2ee78e707e34cdc6f9ea62cbadcb14.tar.gz
Add parseable option to bundle config
-rw-r--r--lib/bundler/cli.rb1
-rw-r--r--lib/bundler/cli/config.rb2
-rw-r--r--spec/commands/config_spec.rb10
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index e729cd3bb2..36e472f0ec 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -344,6 +344,7 @@ module Bundler
will show the current value, as well as any superceded values and
where they were specified.
D
+ method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner => "Use minimal formatting for more parseable output"
def config(*args)
require "bundler/cli/config"
Config.new(options, args, self).run
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 32724f687d..cf50f12fb3 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -21,6 +21,8 @@ module Bundler
return
end
+ return Bundler.ui.info(Bundler.settings[name]) if options[:parseable]
+
unless valid_scope?(scope)
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
exit 1
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index fce6102c29..040b04e57b 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -187,6 +187,16 @@ describe ".bundle/config" do
end
end
+ context "with --parseable option" do
+ it "returns value associated with the config" do
+ global_config "BUNDLE_GEM__COC" => "true"
+
+ bundle "config gem.coc", :parseable => true
+
+ expect(out).to eq "true"
+ end
+ end
+
describe "gem mirrors" do
before(:each) { bundle :install }