Skip to content

Commit 6acaebd

Browse files
authored
Merge pull request rails#41934 from chriscz/bugfix/plugin-gemspec-template
Expand gemspec files within gem directory
2 parents 21c6c22 + decf748 commit 6acaebd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
2020
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
2121
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
2222

23-
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
23+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
24+
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
25+
end
2426

2527
<%= "# " if options.dev? || options.edge? || options.main? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
2628
end

railties/test/generators/plugin_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def test_creating_mountable_engine_mode_adds_keeps
534534
def test_creating_gemspec
535535
run_generator
536536
assert_file "bukkits.gemspec", /spec\.name\s+= "bukkits"/
537-
assert_file "bukkits.gemspec", /spec\.files = Dir\["\{app,config,db,lib\}\/\*\*\/\*", "MIT-LICENSE", "Rakefile", "README\.md"\]/
537+
assert_file "bukkits.gemspec", /spec\.files = Dir.chdir\(File\.expand_path\(__dir__\)\)\s+do\s+Dir\["\{app,config,db,lib\}\/\*\*\/\*", "MIT-LICENSE", "Rakefile", "README\.md"\]\s+end/
538538
assert_file "bukkits.gemspec", /spec\.version\s+ = Bukkits::VERSION/
539539
end
540540

0 commit comments

Comments
 (0)