Sha256: b53762f2bcb32af04fa316901ac61494773206c9de336fb94483daa467736952

Contents?: true

Size: 990 Bytes

Versions: 29

Compression:

Stored size: 990 Bytes

Contents

class Lono::Importer
  class Dsl < Base
    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

      final_message
    end

    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) # Thor::Action
    end

    def final_message
      puts <<~EOL
        #{"="*64}
        Congrats 🎉 You have successfully imported a lono blueprint.

        More info: https://lono.cloud/docs/core/blueprints
      EOL
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/importer/dsl.rb
lono-7.5.1 lib/lono/importer/dsl.rb
lono-7.5.0 lib/lono/importer/dsl.rb
lono-7.4.11 lib/lono/importer/dsl.rb
lono-7.4.10 lib/lono/importer/dsl.rb
lono-7.4.9 lib/lono/importer/dsl.rb
lono-7.4.8 lib/lono/importer/dsl.rb
lono-7.4.7 lib/lono/importer/dsl.rb
lono-7.4.6 lib/lono/importer/dsl.rb
lono-7.4.5 lib/lono/importer/dsl.rb
lono-7.4.4 lib/lono/importer/dsl.rb
lono-7.4.3 lib/lono/importer/dsl.rb
lono-7.4.2 lib/lono/importer/dsl.rb
lono-7.4.1 lib/lono/importer/dsl.rb
lono-7.4.0 lib/lono/importer/dsl.rb
lono-7.3.2 lib/lono/importer/dsl.rb
lono-7.3.1 lib/lono/importer/dsl.rb
lono-7.3.0 lib/lono/importer/dsl.rb
lono-7.2.3 lib/lono/importer/dsl.rb
lono-7.2.2 lib/lono/importer/dsl.rb