diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-09-07 07:40:03 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-09-07 07:40:03 +0900 |
commit | 0cbbe515d33d29085aefba9f04e5dd4171348a1b (patch) | |
tree | e0e10cf3e52cb00e89a6b09180af1b6f34e72437 /railties | |
parent | b31ae3131a488aca3aac556f8f3ba26499c564e6 (diff) | |
download | rails-0cbbe515d33d29085aefba9f04e5dd4171348a1b.tar.gz rails-0cbbe515d33d29085aefba9f04e5dd4171348a1b.tar.bz2 rails-0cbbe515d33d29085aefba9f04e5dd4171348a1b.zip |
Use canonical name for block local
`spec` is the same variable name as gemspec generated by bundler, and its
intention is easier to understand than a one-letter variable.
https://github.com/bundler/bundler/blob/00fd58eaa69015092ee272c4cb5aa92a5e7ee45c/lib/bundler/templates/newgem/newgem.gemspec.tt#L11
This is follow up on 1c59b4840c58097186022f68427c46e0046c5d0d. `spec` is already in use there.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt | 24 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 6 |
2 files changed, 15 insertions, 15 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 a2b2891b51..405642c850 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt @@ -4,15 +4,15 @@ $:.push File.expand_path("lib", __dir__) require "<%= namespaced_name %>/version" # Describe your gem and declare its dependencies: -Gem::Specification.new do |s| - s.name = "<%= name %>" - s.version = <%= camelized_modules %>::VERSION - s.authors = ["<%= author %>"] - s.email = ["<%= email %>"] - s.homepage = "TODO" - s.summary = "TODO: Summary of <%= camelized_modules %>." - s.description = "TODO: Description of <%= camelized_modules %>." - s.license = "MIT" +Gem::Specification.new do |spec| + spec.name = "<%= name %>" + spec.version = <%= camelized_modules %>::VERSION + spec.authors = ["<%= author %>"] + spec.email = ["<%= email %>"] + spec.homepage = "TODO" + spec.summary = "TODO: Summary of <%= camelized_modules %>." + spec.description = "TODO: Description of <%= camelized_modules %>." + spec.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. @@ -23,11 +23,11 @@ Gem::Specification.new do |s| "public gem pushes." end - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] + spec.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('", "') %>" + <%= '# ' if options.dev? || options.edge? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>" <% unless options[:skip_active_record] -%> - s.add_development_dependency "<%= gem_for_database[0] %>" + spec.add_development_dependency "<%= gem_for_database[0] %>" <% end -%> end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 28ac3611b7..20acd23329 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -414,9 +414,9 @@ class PluginGeneratorTest < Rails::Generators::TestCase def test_creating_gemspec run_generator - assert_file "bukkits.gemspec", /s\.name\s+= "bukkits"/ - assert_file "bukkits.gemspec", /s\.files = Dir\["\{app,config,db,lib\}\/\*\*\/\*", "MIT-LICENSE", "Rakefile", "README\.md"\]/ - assert_file "bukkits.gemspec", /s\.version\s+ = Bukkits::VERSION/ + assert_file "bukkits.gemspec", /spec\.name\s+= "bukkits"/ + assert_file "bukkits.gemspec", /spec\.files = Dir\["\{app,config,db,lib\}\/\*\*\/\*", "MIT-LICENSE", "Rakefile", "README\.md"\]/ + assert_file "bukkits.gemspec", /spec\.version\s+ = Bukkits::VERSION/ end def test_usage_of_engine_commands |