summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-03-27 01:12:38 -0700
committerAndre Arko <andre@arko.net>2015-03-27 01:41:08 -0700
commit36314e92ac502674ed2ffc201b2343c8856fa990 (patch)
treeb6c226862a3538a4780f4a2ac7cdd7c8dcf3968b
parentbfbec4ef29d323c8079cb5ec946ccd51cd5b3876 (diff)
downloadbundler-36314e92ac502674ed2ffc201b2343c8856fa990.tar.gz
make executables executable, and test them
closes #3517, #3511
-rw-r--r--lib/bundler/cli/gem.rb9
-rw-r--r--spec/commands/newgem_spec.rb5
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 9ce8de4a05..add19ff3d7 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -54,6 +54,11 @@ module Bundler
"bin/setup.tt" => "bin/setup"
}
+ executables = %w[
+ bin/console
+ bin/setup
+ ]
+
if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
"Codes of conduct can increase contributions to your project by contributors who " \
"prefer collaborative, safe spaces. You can read more about the code of conduct at " \
@@ -105,6 +110,10 @@ module Bundler
thor.template("newgem/#{src}", target.join(dst), config)
end
+ executables.each do |path|
+ FileUtils.chmod "+x", target.join(path).to_s
+ end
+
Bundler.ui.info "Initializing git repo in #{target}"
Dir.chdir(target) { `git init`; `git add .` }
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index c8c5bf5917..fd2dc8714f 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -125,6 +125,11 @@ describe "bundle gem" do
expect(bundled_app("test_gem/lib/test_gem.rb")).to exist
expect(bundled_app("test_gem/lib/test_gem/version.rb")).to exist
expect(bundled_app("test_gem/.gitignore")).to exist
+
+ expect(bundled_app("test_gem/bin/setup")).to exist
+ expect(bundled_app("test_gem/bin/console")).to exist
+ expect(bundled_app("test_gem/bin/setup")).to be_executable
+ expect(bundled_app("test_gem/bin/console")).to be_executable
end
it "starts with version 0.1.0" do