Class: Scalemail
- Inherits:
-
Object
- Object
- Scalemail
- Defined in:
- lib/scalemail.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #configure(config_file) ⇒ Object
- #get_config ⇒ Object
-
#initialize(args) ⇒ Scalemail
constructor
A new instance of Scalemail.
- #provision(config_tree) ⇒ Object
Constructor Details
#initialize(args) ⇒ Scalemail
Returns a new instance of Scalemail.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/scalemail.rb', line 9 def initialize(args) @options = OpenStruct.new opt_parser = OptionParser.new do |opts| opts. = 'Usage: scalemail -m DOCKER_MACHINE_CONFIG_PATH [options]' opts.separator '' opts.separator 'Specific options:' if args.empty? args << '-h' end opts.on('-m', '--docker-machine-config FILE', 'Docker Machine config file to load') { |cfile| @options.docker_machine_config_file = cfile } # opts.on('-c FILE', 'Docker Compose config file to load') { |cfile| @options.docker_compose_config_file = cfile } opts.on_tail('-h', '--help', 'Show this message') do puts opts exit end end opt_parser.parse!(args) config = get_config provision config end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/scalemail.rb', line 7 def configuration @configuration end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/scalemail.rb', line 7 def @options end |
Instance Method Details
#configure(config_file) ⇒ Object
43 44 45 46 |
# File 'lib/scalemail.rb', line 43 def configure(config_file) configuration = Configurator::Config.new(config_file) configuration end |
#get_config ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/scalemail.rb', line 34 def get_config if @configuration.nil? config = configure @options.docker_machine_config_file return config else return @configuration end end |
#provision(config_tree) ⇒ Object
48 49 50 51 |
# File 'lib/scalemail.rb', line 48 def provision(config_tree) provisioner = Provisioner.new(config_tree) provisioner.provision_hosts end |