summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-03-11 00:34:47 -0700
committerAndre Arko <andre@arko.net>2015-03-11 00:34:47 -0700
commitc7f151bddd814cd26730e436867442227777385e (patch)
tree77d99c458da06856973720c9407b28c97c94375b
parentedb4b50e74dcd5dec877027218cfc5970a60bcc7 (diff)
downloadbundler-c7f151bddd814cd26730e436867442227777385e.tar.gz
remove MIT license from gemspec if not configured
-rw-r--r--lib/bundler/cli/gem.rb5
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt10
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 308846f2d3..39ce7b7c93 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -26,7 +26,7 @@ module Bundler
git_user_name = `git config user.name`.chomp
git_user_email = `git config user.email`.chomp
- opts = {
+ config = {
:name => name,
:underscored_name => underscored_name,
:namespaced_path => namespaced_path,
@@ -67,6 +67,7 @@ module Bundler
"for free as long as they admit you created it. You can read more about the MIT license " \
"at choosealicense.com/licenses/mit."
)
+ config[:mit] = true
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
end
@@ -99,7 +100,7 @@ module Bundler
end
templates.each do |src, dst|
- thor.template("newgem/#{src}", target.join(dst), opts)
+ thor.template("newgem/#{src}", target.join(dst), config)
end
Bundler.ui.info "Initializing git repo in #{target}"
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index bc52852b73..f20698bf94 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -9,14 +9,12 @@ Gem::Specification.new do |spec|
spec.authors = [<%=config[:author].inspect%>]
spec.email = [<%=config[:email].inspect%>]
- if spec.respond_to?(:metadata)
- spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
- end
-
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
+<%- if config[:mit] -%>
spec.license = "MIT"
+<%- end -%>
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
@@ -26,6 +24,10 @@ Gem::Specification.new do |spec|
spec.extensions = ["ext/<%=config[:underscored_name]%>/extconf.rb"]
<%- end -%>
+ if spec.respond_to?(:metadata)
+ spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
+ end
+
spec.add_development_dependency "bundler", "~> <%= Bundler::VERSION.split(".")[0..1].join(".") %>"
spec.add_development_dependency "rake", "~> 10.0"
<%- if config[:ext] -%>