Sha256: e7f880abc5a887db3d4e549eeeb260e1b2c67ffbd94b4db7045163c06cb944a7
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
require 'slop' require 'minarai/loaders/recipe_loader' require 'minarai/errors/missing_recipe_path_error.rb' require 'minarai/logger' module Minarai class Command def initialize(args) @args = args end def call Minarai::Logger.info 'Minarai starting...' abort_with_error_message unless recipe.valid? recipe.runner.run Minarai::Logger.info 'Minarai finish' end private def abort_with_error_message Minarai::Logger.error(recipe.errors) and abort end def recipe @recipe ||= Minarai::Loaders::RecipeLoader.new(recipe_path, variable_path: variable_path).load end def recipe_path slop_options.arguments[0] || (Minarai::Logger.error(recipe_missing_error) and abort) end def recipe_missing_error Minarai::Errors::MissingRecipePathError.new end def variable_path slop_options[:variables] end def slop_options @slop_options ||= Slop.parse(@args, suppress_errors: true) do |option| option.string '-v', '--variables', 'variable file for erb recipe file' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
minarai-0.0.3 | lib/minarai/command.rb |
minarai-0.0.2 | lib/minarai/command.rb |
minarai-0.0.1 | lib/minarai/command.rb |