Class: Ossy::CLI::Templates::Compile
- Inherits:
-
Commands::Core
- Object
- Dry::CLI::Command
- Commands::Core
- Ossy::CLI::Templates::Compile
- Defined in:
- lib/ossy/cli/templates/compile.rb
Defined Under Namespace
Classes: Context
Instance Method Summary collapse
Instance Method Details
#call(source_path:, target_path:, data_file:) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/ossy/cli/templates/compile.rb', line 34 def call(source_path:, target_path:, data_file:) puts "Compiling #{source_path} => #{target_path}" data = YAML.load_file(data_file, permitted_classes: [Date]) template = Tilt.new(source_path) output = template.render(Context.new(data)) File.write(target_path, output) end |