Class: Lono::Pro::Importer::Dsl
- Inherits:
-
Base
- Object
- Base
- Lono::Pro::Importer::Dsl
show all
- Defined in:
- lib/lono/pro/importer/dsl.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Methods included from Download
#download_template, #json?, #read_source
Instance Method Details
#final_message ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/lono/pro/importer/dsl.rb', line 27
def final_message
puts <<~EOL
#{"="*64}
Congrats 🎉 You have successfully imported a lono blueprint.
More info: https://lono.cloud/docs/core/blueprints
EOL
end
|
#run ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/lono/pro/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)
final_message
end
|
#translate_to_dsl(template) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/lono/pro/importer/dsl.rb', line 18
def translate_to_dsl(template)
coder = Service::Coder.new(template, @options)
result = coder.translate
path = "#{Lono.config.templates_path}/#{@template}.rb"
FileUtils.mkdir_p(File.dirname(path))
create_file(path, result) end
|