summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-03-19 17:52:03 +1100
committerColby Swandale <colby@taplaboratories.com>2017-03-19 17:52:03 +1100
commitd553b1802c12f78245a0929835e9f003c13050e7 (patch)
tree3af9a0695d4661223edc47df162a237888d93320
parent81d53b52444572cf1454da4c741242e2dd47de5c (diff)
downloadbundler-d553b1802c12f78245a0929835e9f003c13050e7.tar.gz
dont init new git repo unless git is installed on gem command
-rw-r--r--lib/bundler/cli/gem.rb10
-rw-r--r--spec/commands/newgem_spec.rb17
2 files changed, 6 insertions, 21 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 3d746f50d6..5371c6d82f 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -137,10 +137,12 @@ module Bundler
path.chmod(executable)
end
- Bundler.ui.info "Initializing git repo in #{target}"
- Dir.chdir(target) do
- `git init`
- `git add .`
+ if Bundler.git_present?
+ Bundler.ui.info "Initializing git repo in #{target}"
+ Dir.chdir(target) do
+ `git init`
+ `git add .`
+ end
end
# Open gemspec in editor
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 43063b734d..b1db78c494 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -158,23 +158,6 @@ RSpec.describe "bundle gem" do
expect(bundled_app("test_gem/README.md").read).not_to include("github.com/bundleuser")
end
end
-
- context "git is not installed in the system" do
- before do
- FileUtils.rm ENV["GIT_CONFIG"].to_s if File.exist?(ENV["GIT_CONFIG"])
- reset!
- in_app_root
- bundle "gem #{gem_name}"
- remove_push_guard(gem_name)
- end
-
- it "contribute URL set to [USERNAME]" do
- expect(bundled_app("test_gem/README.md").read).to include("[USERNAME]")
- expect(bundled_app("test_gem/README.md").read).not_to include("github.com/bundleuser")
- end
-
- it_should_behave_like "git config is absent"
- end
end
it "generates a valid gemspec" do