class Lono::Importer::Base

Public Class Methods

new(options) click to toggle source
# File lib/lono/importer/base.rb, line 7
def initialize(options)
  reinitialize(options)
  @source = options[:source]
  @tmp_path = "/tmp/lono/import/template.yml"
  self.destination_root = Dir.pwd # Thor::Actions require destination_root to be set
end

Private Instance Methods

blueprint_name() click to toggle source
# File lib/lono/importer/base.rb, line 41
def blueprint_name
  return @options[:name] if @options[:name]
  # Else infer name from the original source.
  name = File.basename(@source, ".*")
  @options[:casing] == "camelcase" ? name.camelize : name.underscore.dasherize
end
create_params(template_path) click to toggle source
# File lib/lono/importer/base.rb, line 21
def create_params(template_path)
  create_params_file(template_path, "development")
  create_params_file(template_path, "production")
end
create_params_file(template_path, env) click to toggle source
# File lib/lono/importer/base.rb, line 26
def create_params_file(template_path, env)
  params_path = if @blueprint != @template
                  "configs/#{@blueprint}/params/#{env}/#{@template}.txt"
                else
                  "configs/#{@blueprint}/params/#{env}.txt"
                end
  params = Params.new(template_path, params_path)
  params.create
end
pretty_path(path) click to toggle source

removes the ./ at the beginning if it's there in the path

# File lib/lono/importer/base.rb, line 37
def pretty_path(path)
  path.sub("#{Lono.root}/",'')
end
summarize() click to toggle source
# File lib/lono/importer/base.rb, line 15
def summarize
  return unless @options[:summary]
  puts "Template Summary:"
  Lono::Inspector::Summary.new(@options).run
end