Module: Lono::Blueprint::Root

Instance Method Summary collapse

Instance Method Details

#bundler_groupsObject



32
33
34
# File 'lib/lono/blueprint/root.rb', line 32

def bundler_groups
  [:default, Lono.env.to_sym]
end

#find_blueprint_root(blueprint) ⇒ Object



26
27
28
29
30
# File 'lib/lono/blueprint/root.rb', line 26

def find_blueprint_root(blueprint)
  require_bundle_gems # ensures that gem will be found so we can switch to it

  Find.find(blueprint) # blueprint_root
end

#require_bundle_gemsObject



36
37
38
39
40
41
42
43
# File 'lib/lono/blueprint/root.rb', line 36

def require_bundle_gems
  # NOTE: Dont think ENV['BUNDLE_GEMFILE'] is quite working right.  We still need
  # to be in the project directory.  Leaving logic in here for when it gets fix.
  if ENV['BUNDLE_GEMFILE'] || File.exist?("Gemfile")
    require "bundler/setup"
    Bundler.require(*bundler_groups)
  end
end

#set_blueprint_root(blueprint) ⇒ Object

Switch the lono root TODO: account multimode or only have multimode? TODO: switch to gem path



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lono/blueprint/root.rb', line 8

def set_blueprint_root(blueprint)
  # puts "blueprint #{blueprint}"
  # puts caller[0..2]

  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}.
      Are you sure its in your Gemfile or in the blueprints folder
      with the correct blueprint_name in .meta/config.yml?
    EOL
    List.available
    exit 1
  end
end