lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt in gemsmith-2.4.0 vs lib/gemsmith/templates/%gem_name%/%gem_name%.gemspec.tt in gemsmith-3.0.0
- old
+ new
@@ -1,62 +1,82 @@
$:.push File.expand_path("../lib", __FILE__)
require "<%=config[:gem_name]%>/version"
+def add_security_key specification, method, files
+ file = files.is_a?(Array) ? files.first : files
+ if File.exists? file
+ specification.send "#{method}=", files
+ else
+ puts "WARNING: Security key not found for #{specification.name} gem specification: #{file}"
+ end
+end
+
Gem::Specification.new do |s|
- s.name = "<%= config[:gem_name] %>"
- s.version = <%= config[:gem_class] %>::VERSION
- s.platform = <%= config[:gem_platform] %>
- s.author = "<%= config[:author_name] %>"
- s.email = "<%= config[:author_email] %>"
- s.homepage = "<%= config[:gem_url] %>"
- s.summary = "TODO: Add gem summary here."
- s.description = "TODO: Add gem description here."
- s.license = "MIT"
+ s.name = "<%= config[:gem_name] %>"
+ s.version = <%= config[:gem_class] %>::VERSION
+ s.platform = <%= config[:gem_platform] %>
+ s.author = "<%= config[:author_name] %>"
+ s.email = "<%= config[:author_email] %>"
+ s.homepage = "<%= config[:gem_url] %>"
+ s.summary = "TODO: Add gem summary here."
+ s.description = "TODO: Add gem description here."
+ s.license = "MIT"
<%- if config[:post_install_message] -%>
- s.post_install_message = "<%= config[:post_install_message] %>"
- <%- end -%>
+ s.post_install_message = "<%= config[:post_install_message] %>"
+ <%- end -%>
- unless ENV["TRAVIS"]
- s.signing_key = File.expand_path("~/.ssh/gem-private.pem")
- s.cert_chain = [File.expand_path("~/.ssh/gem-public.pem")]
+ add_security_key s, "signing_key", File.expand_path("<%= config[:gem_private_key] %>")
+ add_security_key s, "cert_chain", [File.expand_path("<%= config[:gem_public_key] %>")]
+
+ <%- if config[:pry] -%>
+ case Gem.ruby_engine
+ when "ruby"
+ s.add_development_dependency "pry-byebug"
+ s.add_development_dependency "pry-stack_explorer"
+ when "jruby"
+ s.add_development_dependency "pry-nav"
+ when "rbx"
+ s.add_development_dependency "pry-nav"
+ s.add_development_dependency "pry-stack_explorer"
+ else
+ raise RuntimeError.new("Unsupported Ruby Engine!")
end
+ <%- end -%>
- s.required_ruby_version = "~> <%= config[:ruby_version] %>"
+ s.required_ruby_version = "~> <%= config[:ruby_version] %>"
<%- if config[:bin] -%>
- s.add_dependency "thor"
- s.add_dependency "thor_plus"
- <%- end -%>
+ s.add_dependency "thor"
+ s.add_dependency "thor_plus"
+ <%- end -%>
<%- if config[:rails] -%>
- s.add_dependency "rails", "~> <%= config[:rails_version] %>"
- <%- end -%>
+ s.add_dependency "rails", "~> <%= config[:rails_version] %>"
+ <%- end -%>
<%- if config[:travis] -%>
s.add_development_dependency "rake"
- <%- end -%>
+ <%- end -%>
<%- if config[:pry] -%>
s.add_development_dependency "pry"
- s.add_development_dependency "pry-byebug"
s.add_development_dependency "pry-remote"
s.add_development_dependency "pry-rescue"
- s.add_development_dependency "pry-stack_explorer"
- s.add_development_dependency "pry-vterm_aliases"
- s.add_development_dependency "pry-git"
- s.add_development_dependency "pry-doc"
<%- end -%>
<%- if config[:rspec] -%>
<%- rspec_gem = config[:rails] ? "rspec-rails" : "rspec" -%>
s.add_development_dependency "<%= rspec_gem %>"
- <%- end -%>
+ <%- end -%>
<%- if config[:bin] -%>
s.add_development_dependency "aruba"
<%- end -%>
<%- if config[:guard] -%>
s.add_development_dependency "rb-fsevent" # Guard file events for OSX.
s.add_development_dependency "guard-rspec"
- <%- end -%>
+ <%- end -%>
+ <%- if config[:coveralls] -%>
+ s.add_development_dependency "coveralls"
+ <%- end -%>
- s.files = Dir["lib/**/*", "vendor/**/*"]
+ s.files = Dir["lib/**/*", "vendor/**/*"]
s.extra_rdoc_files = Dir["README*", "LICENSE*"]
<%- if config[:bin] -%>
- s.executables << "<%= config[:gem_name] %>"
- <%- end -%>
- s.require_paths = ["lib"]
+ s.executables << "<%= config[:gem_name] %>"
+ <%- end -%>
+ s.require_paths = ["lib"]
end