Class: Lono::Importer::Dsl
- Inherits:
-
Base
- Object
- AbstractBase
- Base
- Lono::Importer::Dsl
- Defined in:
- lib/lono/importer/dsl.rb
Instance Method Summary collapse
Methods inherited from Base
Methods included from Download
#download_template, #json?, #read_source
Methods inherited from AbstractBase
#initialize, #reinitialize, #template_path
Methods included from Blueprint::Root
#find_blueprint_root, #set_blueprint_root
Constructor Details
This class inherits a constructor from Lono::Importer::Base
Instance Method Details
#final_message ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/lono/importer/dsl.rb', line 27 def puts " \#{\"=\"*64}\n Congrats \u{1F389} You have successfully imported a lono blueprint.\n\n More info: https://lono.cloud/docs/core/blueprints\n EOL\nend\n" |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lono/importer/dsl.rb', line 3 def run tmp_template_path = download_template(@source, @tmp_path) template = IO.read(tmp_template_path) Lono::Blueprint::New.start([@blueprint, "--import", "--type", "dsl"]) translate_to_dsl(template) create_params(tmp_template_path) # Let's not summarize the template in case the Ruby syntax is invalid with the import coder. # Add summarize back in later # summarize end |
#translate_to_dsl(template) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/lono/importer/dsl.rb', line 18 def translate_to_dsl(template) coder = Service::Coder.new(template, ) result = coder.translate path = "#{Lono.config.templates_path}/#{@template}.rb" FileUtils.mkdir_p(File.dirname(path)) create_file(path, result) # Thor::Action end |