class Aspen::CLI::Commands::BuildSteps::CompileMainAspen
Public Instance Methods
call(main_aspen_file, options)
click to toggle source
Calls superclass method
Aspen::CLI::Commands::BuildSteps::BuildStep#call
# File lib/aspen/cli/commands/build_steps.rb, line 175 def call(main_aspen_file, options) super puts "----> Compiling main Aspen file (#{main_aspen_file.path})" # Compile the main Aspen file, according to manifest.yml unless manifest["output"] puts " Defaulting to Cypher output. To customize, set up a manifest.yml." end outputs = manifest["output"] ? Array(manifest["output"]) : ["Cypher"] outputs.each do |format| adapter = Aspen::Adapters::Registry.get(format.downcase.to_sym) out_path = main_aspen_file.path.gsub(/\.aspen$/, '') + adapter.ext File.open(out_path, 'w') do |file| file << Aspen.compile_text( File.read(main_aspen_file), adapter: adapter.id, batch: options[:batch] ) end puts "----> Compiled main #{adapter.name} file" end end