summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-04-03 22:16:16 +1000
committerColby Swandale <colby@taplaboratories.com>2017-04-03 22:16:16 +1000
commitde494369df4e7370fd477f5ff246f5133d319a73 (patch)
treeccd65ddffb224abac11f1544c6aea9c746144bfc
parentfe3046b0b422d0ff453149f4445026072648d6d6 (diff)
downloadbundler-de494369df4e7370fd477f5ff246f5133d319a73.tar.gz
print minimal report of configuration with bundler config --parseable
-rw-r--r--lib/bundler/cli/config.rb20
-rw-r--r--spec/commands/config_spec.rb19
2 files changed, 33 insertions, 6 deletions
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index fb34801a48..2b9bf0fd59 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -32,7 +32,6 @@ module Bundler
return
end
-
if args.empty?
return Bundler.ui.info(Bundler.settings[name]) if options[:parseable]
@@ -47,11 +46,20 @@ module Bundler
private
def confirm_all
- Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
- Bundler.settings.all.each do |setting|
- Bundler.ui.confirm "#{setting}"
- show_pretty_values_for(setting)
- Bundler.ui.confirm ""
+ if @options[:parseable]
+ thor.with_padding do
+ Bundler.settings.all.each do |setting|
+ value = Bundler.settings[setting]
+ Bundler.ui.info "#{setting}=#{value}"
+ end
+ end
+ else
+ Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
+ Bundler.settings.all.each do |setting|
+ Bundler.ui.confirm "#{setting}"
+ show_pretty_values_for(setting)
+ Bundler.ui.confirm ""
+ end
end
end
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index 640ec06e17..f677c1fc36 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -9,6 +9,25 @@ RSpec.describe ".bundle/config" do
G
end
+ describe "config" do
+ before { bundle "config foo bar" }
+
+ it "prints a detailed report of local and user configuration" do
+ bundle "config"
+
+ expect(out).to include("Settings are listed in order of priority. The top value will be used")
+ expect(out).to include("foo\nSet for the current user")
+ expect(out).to include(": \"bar\"")
+ end
+
+ context "given --parseable flag" do
+ it "prints a minimal report of local and user configuration" do
+ bundle "config --parseable"
+ expect(out).to include("foo=bar")
+ end
+ end
+ end
+
describe "BUNDLE_APP_CONFIG" do
it "can be moved with an environment variable" do
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s