Class: Lono::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/lono/importer.rb,
lib/lono/importer/dsl.rb,
lib/lono/importer/erb.rb,
lib/lono/importer/base.rb,
lib/lono/importer/params.rb,
lib/lono/importer/download.rb,
lib/lono/importer/converter.rb

Defined Under Namespace

Modules: Download Classes: Base, Converter, Dsl, Erb, Params

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Importer

Returns a new instance of Importer.



3
4
5
6
7
8
9
10
# File 'lib/lono/importer.rb', line 3

def initialize(options)
  @options = options

  Lono::ProjectChecker.check
  @blueprint = Lono::Conventions.new(options).blueprint
  # Dont use set_blueprint_root because it doesnt exist yet. The import creates it
  Lono.blueprint_root = "#{Lono.root}/app/blueprints/#{@blueprint}"
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/lono/importer.rb', line 12

def run
  # Examples:
  #   Lono::Importer::Erb.new(source, options.clone).run
  #   Lono::Importer::Dsl.new(source, options.clone).run
  type = @options[:type] || 'dsl'
  importer_class = "Lono::Importer::#{type.classify}"
  importer_class = Object.const_get(importer_class)
  importer_class.new(@options).run
end