Class: Coppy::Steps::InFiles
- Inherits:
-
Object
- Object
- Coppy::Steps::InFiles
- Extended by:
- DSL::Module
- Defined in:
- lib/coppy/steps/in_files.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(*file_patterns, &block) ⇒ InFiles
constructor
A new instance of InFiles.
Methods included from DSL::Module
Constructor Details
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/coppy/steps/in_files.rb', line 20 def call(env) files = @patterns.flat_map { |pattern| Dir.glob(File.join env.target, pattern) } files.each do |file_path| file = File.read(file_path) local_env = env.subenv( file: file ) @manifesto.execute!(local_env) File.open(file_path, 'w') { |f| f.write local_env.file } end end |