diff options
author | Chris Keele <dev@chriskeele.com> | 2016-01-22 20:09:31 -0600 |
---|---|---|
committer | Chris Keele <dev@chriskeele.com> | 2016-01-22 20:09:31 -0600 |
commit | 95d65d5870da321d78505612a325d81f19b23d9a (patch) | |
tree | c2bf643314eb7532e1d2e8ee95fb1baff61837b4 | |
parent | a2d40cdde33186ab3bdd42c5080321ae89218a7b (diff) | |
download | bundler-95d65d5870da321d78505612a325d81f19b23d9a.tar.gz |
Use '--exe' option name in addition to '--bin' as primary option name.
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 4 | ||||
-rw-r--r-- | man/bundle-gem.ronn | 10 | ||||
-rw-r--r-- | spec/commands/newgem_spec.rb | 18 |
4 files changed, 25 insertions, 9 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index d97503435d..477224e4e9 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -358,7 +358,7 @@ module Bundler end desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem" - method_option :bin, :type => :boolean, :default => false, :aliases => "-b", :desc => "Generate a binary for your library." + method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library." method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index ca90f274c5..96d5a6849a 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -42,7 +42,7 @@ module Bundler :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email, :test => options[:test], :ext => options[:ext], - :bin => options[:bin], + :exe => options[:exe], :bundler_version => bundler_dependency_version } ensure_safe_gem_name(name, constant_array) @@ -109,7 +109,7 @@ module Bundler templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md") end - templates.merge!("exe/newgem.tt" => "exe/#{name}") if options[:bin] + templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe] if options[:ext] templates.merge!( diff --git a/man/bundle-gem.ronn b/man/bundle-gem.ronn index 769e5263f5..8e57189f83 100644 --- a/man/bundle-gem.ronn +++ b/man/bundle-gem.ronn @@ -24,13 +24,13 @@ configuration file using the following names: ## OPTIONS -* `-b` or `--bin`: - Specify that Bundler should create a binary (as `exe/GEM_NAME`) in the - generated rubygem project. This binary will also be added to the +* `--exe` or `-b` or `--bin`: + Specify that Bundler should create a binary executable (as `exe/GEM_NAME`) + in the generated rubygem project. This binary will also be added to the `GEM_NAME.gemspec` manifest. This behavior is disabled by default. -* `--no-bin`: - Do not create a binary (overrides `--bin` specified in the global config). +* `--no-exe`: + Do not create a binary (overrides `--exe` specified in the global config). * `--coc`: Add a `CODE_OF_CONDUCT.md` file to the root of the generated project. If diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 6cd8f86dd8..732097dacc 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -253,6 +253,22 @@ describe "bundle gem" do end end + context "--exe parameter set" do + before do + reset! + in_app_root + bundle "gem #{gem_name} --exe" + end + + it "builds exe skeleton" do + expect(bundled_app("test_gem/exe/test_gem")).to exist + end + + it "requires 'test-gem'" do + expect(bundled_app("test_gem/exe/test_gem").read).to match(/require "test_gem"/) + end + end + context "--bin parameter set" do before do reset! @@ -260,7 +276,7 @@ describe "bundle gem" do bundle "gem #{gem_name} --bin" end - it "builds bin skeleton" do + it "builds exe skeleton" do expect(bundled_app("test_gem/exe/test_gem")).to exist end |