Class: RSGem::Tasks::SetBundledFiles
- Defined in:
- lib/rsgem/tasks/set_bundled_files.rb
Overview
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)
Constant Summary collapse
- OUTPUT =
OutputStruct.new(name: 'Set bundled files')
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods included from Output
Constructor Details
This class inherits a constructor from RSGem::Tasks::Base
Instance Method Details
#perform ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# 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 |