class RSGem::Tasks::SetBundledFiles
When the gem is bundled into final users' projects, it only needs to contain the production code. Meaning that specs, docs, configuration files should not be present. This task updates the default `spec.files` configuration in the gemspec to just contain the files:
- LICENSE.txt - README.md - lib/**/* (everything inside lib)
Constants
- OUTPUT
Public Instance Methods
perform()
click to toggle source
# File lib/rsgem/tasks/set_bundled_files.rb, line 17 def perform # Explaining the regular expression: # [spec.files][one or more white spaces][=][one or more white spaces][anything until "do"] # [new line][anything until new line] # [one or more white spaces][end] gemspec.gsub!( /spec.files\s+=\s+.+do\n.+\n\s+end/, "spec.files = Dir['LICENSE.txt', 'README.md', 'lib/**/*']" ) write end
Private Instance Methods
gemspec()
click to toggle source
# File lib/rsgem/tasks/set_bundled_files.rb, line 31 def gemspec @gemspec ||= File.read(context.gemspec_path) end
write()
click to toggle source
# File lib/rsgem/tasks/set_bundled_files.rb, line 35 def write File.open(context.gemspec_path, 'w') do |file| file.puts gemspec end end