diff options
author | André Arko <mail@arko.net> | 2015-02-17 17:28:32 -0800 |
---|---|---|
committer | André Arko <mail@arko.net> | 2015-02-17 17:28:32 -0800 |
commit | 47fe559667ffd8e11169189c1c65c1d86d9e6a72 (patch) | |
tree | c9fdbf72573076d5b592219fb1d3a01fb7f92ae5 | |
parent | 28791072377019b89e561ccf8b034c4380e99a14 (diff) | |
parent | 29e5cd22b6ad50bbb65ed0a80015a4a31ebf398a (diff) | |
download | bundler-47fe559667ffd8e11169189c1c65c1d86d9e6a72.tar.gz |
Merge pull request #3415 from TimMoore/new-gem-dev-version
Allow dev versions when creating a new gem
-rw-r--r-- | lib/bundler/cli/gem.rb | 10 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 4694a013..e00994a4 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -37,7 +37,8 @@ module Bundler :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email, :test => options[:test], :ext => options[:ext], - :bin => options[:bin] + :bin => options[:bin], + :bundler_version => bundler_dependency_version } templates = { @@ -162,5 +163,12 @@ module Bundler test_framework end + def bundler_dependency_version + v = Gem::Version.new(Bundler::VERSION) + req = v.segments[0..1] + req << v.segments.last if v.prerelease? + req.join(".") + end + end end diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index bc52852b..a982e661 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.extensions = ["ext/<%=config[:underscored_name]%>/extconf.rb"] <%- end -%> - spec.add_development_dependency "bundler", "~> <%= Bundler::VERSION.split(".")[0..1].join(".") %>" + spec.add_development_dependency "bundler", "~> <%= config[:bundler_version] %>" spec.add_development_dependency "rake", "~> 10.0" <%- if config[:ext] -%> spec.add_development_dependency "rake-compiler" |