Skip to content

Commit decf748

Browse files
committed
Expand gemspec files within gem directory
1 parent 9aed3dc commit decf748

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
@@ -535,7 +535,7 @@ def test_creating_mountable_engine_mode_adds_keeps
535535
def test_creating_gemspec
536536
run_generator
537537
assert_file "bukkits.gemspec", /spec\.name\s+= "bukkits"/
538-
assert_file "bukkits.gemspec", /spec\.files = Dir\["\{app,config,db,lib\}\/\*\*\/\*", "MIT-LICENSE", "Rakefile", "README\.md"\]/
538+
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/
539539
assert_file "bukkits.gemspec", /spec\.version\s+ = Bukkits::VERSION/
540540
end
541541

0 commit comments

Comments
 (0)