Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4923 - bundler:seg-apple-git-support, r=indirect
Browse files Browse the repository at this point in the history
[Env] Support running `bundle env` when not inside a bundle
  • Loading branch information
homu committed Aug 28, 2016
2 parents a4a5f1c + adff938 commit f29ec8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/bundler/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def report(options = {})
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"
Expand Down
8 changes: 8 additions & 0 deletions spec/bundler/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
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+/, "")
Expand Down

0 comments on commit f29ec8b

Please sign in to comment.