Module: Lono::Blueprint::Root

Included in:
AbstractBase
Defined in:
lib/lono/blueprint/root.rb

Instance Method Summary collapse

Instance Method Details

#find_blueprint_root(blueprint) ⇒ Object



20
21
22
23
# File 'lib/lono/blueprint/root.rb', line 20

def find_blueprint_root(blueprint)
  config = Lono::Finder::Blueprint.find(blueprint) # blueprint_root
  config.root if config
end

#set_blueprint_root(blueprint) ⇒ Object

Switch the lono root



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/lono/blueprint/root.rb', line 6

def set_blueprint_root(blueprint)
  blueprint_root = find_blueprint_root(blueprint)
  if blueprint_root
    Lono.blueprint_root = blueprint_root
  else
    puts <<~EOL.color(:red)
      ERROR: Unable to find the blueprint #{blueprint.inspect}.
      Are you sure its in your Gemfile or in the blueprints folder with the correct name?
    EOL
    Lono::Finder::Blueprint.list
    ENV['LONO_TEST'] ? raise("Unable to find blueprint: #{blueprint.inspect}") : exit(1)
  end
end