summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-08-26 16:02:32 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-08-26 16:02:32 -0500
commitadff9383833e51ba0bcaca34bb611e00367b2062 (patch)
treed2098b19aa6658d30ec66677ea32610b53be625d
parenta4a5f1c53156e85c597e9938f08e874930199957 (diff)
downloadbundler-seg-apple-git-support.tar.gz
[Env] Support running `bundle env` when not inside a bundleseg-apple-git-support
-rw-r--r--lib/bundler/env.rb2
-rw-r--r--spec/bundler/env_spec.rb8
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb
index 8baf698dff..74541681ef 100644
--- a/lib/bundler/env.rb
+++ b/lib/bundler/env.rb
@@ -34,6 +34,8 @@ module Bundler
end
end
+ return out unless SharedHelpers.in_bundle?
+
if print_gemfile
out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n"
out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n"
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb
index 1be6cf46bc..245073d9b8 100644
--- a/spec/bundler/env_spec.rb
+++ b/spec/bundler/env_spec.rb
@@ -49,6 +49,14 @@ describe Bundler::Env do
end
end
+ context "when there no Gemfile and print_gemfile is true" do
+ let(:output) { env.report(:print_gemfile => true) }
+
+ it "prints the environment" do
+ expect(output).to start_with("Environment")
+ end
+ end
+
context "when Gemfile contains a gemspec and print_gemspecs is true" do
let(:gemspec) do
<<-GEMSPEC.gsub(/^\s+/, "")