Sha256: c86101965076917c14bea692fd4452c31ee3184e1af5704549c5212aa6bbf6bb

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require "fileutils"

module Lono
  class Seed
    include Blueprint::Root

    def initialize(blueprint, options)
      @blueprint, @options = blueprint, options
      @args = options[:args] # hash
    end

    def run
      blueprint_root = find_blueprint_root(@blueprint)
      unless blueprint_root
        puts "ERROR: Did not find blueprint: #{@blueprint}".color(:red)
        puts "Are you sure you specified the right blueprint?"
        Blueprint::List.available
        exit 1
      end

      configs_path = "#{blueprint_root}/seed/configs.rb"
      unless File.exist?(configs_path)
        puts "No #{configs_path} file found.  Nothing to configure."
        exit
      end

      require configs_path
      unless defined?(Configs)
        puts "Configs class not found.\nAre you sure #{configs_path} contains a Configs class?"
        exit 1
      end
      configs = Configs.new(@blueprint, @options)
      # The Configs class implements: seed, params, and variables
      configs.run # setup the instance variables
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lono-5.1.1 lib/lono/seed.rb
lono-5.1.0 lib/lono/seed.rb