Sha256: 7c4e8c1b21d457ef8386f82e4547e7eaf447597d184ffb42ba557930c3c73254

Contents?: true

Size: 1.27 KB

Versions: 28

Compression:

Stored size: 1.27 KB

Contents

require "bundler"

class Lono::Blueprint
  module Root
    # Switch the lono root
    # TODO: account multimode or only have multimode?
    # TODO: switch to gem path
    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

    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

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

    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
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
lono-6.1.11 lib/lono/blueprint/root.rb
lono-6.1.10 lib/lono/blueprint/root.rb
lono-6.1.9 lib/lono/blueprint/root.rb
lono-6.1.8 lib/lono/blueprint/root.rb
lono-6.1.7 lib/lono/blueprint/root.rb
lono-6.1.6 lib/lono/blueprint/root.rb
lono-6.1.5 lib/lono/blueprint/root.rb
lono-6.1.4 lib/lono/blueprint/root.rb
lono-6.1.3 lib/lono/blueprint/root.rb
lono-6.1.2 lib/lono/blueprint/root.rb
lono-6.1.1 lib/lono/blueprint/root.rb
lono-6.1.0 lib/lono/blueprint/root.rb
lono-6.0.1 lib/lono/blueprint/root.rb
lono-6.0.0 lib/lono/blueprint/root.rb
lono-5.3.4 lib/lono/blueprint/root.rb
lono-5.3.3 lib/lono/blueprint/root.rb
lono-5.3.2 lib/lono/blueprint/root.rb
lono-5.3.1 lib/lono/blueprint/root.rb
lono-5.3.0 lib/lono/blueprint/root.rb
lono-5.2.8 lib/lono/blueprint/root.rb