Class: Elevage::Build
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Elevage::Build
- Includes:
- Thor::Actions
- Defined in:
- lib/elevage/build.rb
Overview
Create new platform definition files and environments folder structure, used by the command line ‘build` option
Class Method Summary collapse
-
.source_root ⇒ Object
rubocop:enable LineLength.
Instance Method Summary collapse
-
#build ⇒ Object
Process and execute the ‘build` command.
Class Method Details
.source_root ⇒ Object
rubocop:enable LineLength
34 35 36 |
# File 'lib/elevage/build.rb', line 34 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#build ⇒ Object
Process and execute the ‘build` command
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/elevage/build.rb', line 41 def build # Make the logfile directory if it doesn't exist Dir.mkdir([:logfiles]) unless Dir.exist?([:logfiles]) # Fetch the environment and make sure it passes basic health checks @environment = Elevage::Environment.new(env) fail(IOError) unless @environment.healthy? # ============================================================= # Option sanity checking. # # What are we going to reject as invalid options? # if [:all] && [:tier] || [:all] && [:component] || [:tier] && [:component] warn 'The --all, --tier and --component options may not be specified together.' exit false end if [:node] && ![:component] warn 'When requesting a --node you must specify which --component.' exit false end unless [:all] || [:tier] || [:component] warn 'You must specify one of --all, --tier=<tier>, or --component=<component>' exit false end # Determine what, exactly, we're supposed to build if [:all] # ============================================================= # Build ALL THE THINGS! # @environment.provision(type: :all, options: ) elsif [:tier] # ============================================================= # Build most of the things... # if [:tier].eql?('tier') warn 'Was asked to build a tier, but was not told which one!' exit false end @environment.provision(type: :tier, tier: [:tier], options: ) elsif [:component] # ============================================================= # Build a few things... # if [:component].eql?('component') warn 'Was asked to build a component, but was not told which one!' exit false end # See if we're actually only supposed to build just one thing... if [:node] @environment.provision(type: :node, component: [:component], instance: [:node], options: ) else @environment.provision(type: :component, component: [:component], options: ) end end end |