Class: Ec2Hosts::Runner
- Inherits:
-
Object
- Object
- Ec2Hosts::Runner
- Defined in:
- lib/ec2_hosts/runner.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Runner
constructor
A new instance of Runner.
- #run! ⇒ Object
Constructor Details
#initialize(args) ⇒ Runner
Returns a new instance of Runner.
4 5 6 |
# File 'lib/ec2_hosts/runner.rb', line 4 def initialize(args) = Options.new(args). end |
Instance Method Details
#run! ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ec2_hosts/runner.rb', line 8 def run! if [:vpc] && [:clear] raise ArgumentError.new("Cannot specify 'clear' and 'vpc' at the same time.") end if [:tags] && [:template] raise ArgumentError.new("Cannot specify 'tags' and 'template' at the same time.") end updater = Updater.new() if [:clear] updater.clear else if [:vpc].nil? raise ArgumentError.new("No ec2 vpc specified.") end if [:delete] new_hosts_list = [] else hosts = Hosts.new() new_hosts_list = hosts.to_a end updater.update(new_hosts_list) end end |