diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-06 14:45:47 -0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-09-06 14:45:47 -0400 |
commit | 1c59b4840c58097186022f68427c46e0046c5d0d (patch) | |
tree | 4f2537f1b59d97cc0967e004f54d399ff8a49a6b /railties/lib | |
parent | 62a0c307545d6caa27b7e102bc193c6c117351c6 (diff) | |
download | rails-1c59b4840c58097186022f68427c46e0046c5d0d.tar.gz rails-1c59b4840c58097186022f68427c46e0046c5d0d.tar.bz2 rails-1c59b4840c58097186022f68427c46e0046c5d0d.zip |
Generate a gem that can't be pushed to Rubygems.org by default
This will avoid gems that are made to be private to be pushed to public
repositories.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt b/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt index 9a8c4bf098..a2b2891b51 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt @@ -14,6 +14,15 @@ Gem::Specification.new do |s| s.description = "TODO: Description of <%= camelized_modules %>." s.license = "MIT" + # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' + # to allow pushing to a single host or delete this section to allow pushing to any host. + if spec.respond_to?(:metadata) + spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" + else + raise "RubyGems 2.0 or newer is required to protect against " \ + "public gem pushes." + end + s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] <%= '# ' if options.dev? || options.edge? -%>s.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>" |