Class: GcloudHosts::Runner
- Inherits:
-
Object
- Object
- GcloudHosts::Runner
- Defined in:
- lib/gcloud_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.
6 7 8 |
# File 'lib/gcloud_hosts/runner.rb', line 6 def initialize(args) = Options.new(args). end |
Instance Method Details
#run! ⇒ Object
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 |
# File 'lib/gcloud_hosts/runner.rb', line 10 def run! project = [:project] if project.to_s.strip == "" project = env["core"]["project"] end if project.to_s.strip == "" raise AuthError.new("No gcloud project specified.") end if [:domain] domain = [:domain].to_s.strip else domain = "c.#{project}.internal" end backup = [:backup] || [:file] + '.bak' if [:delete] new_hosts_list = [] else new_hosts_list = Hosts.hosts([:gcloud], project, [:network], domain, [:public], [:exclude_public]) end Updater.update(new_hosts_list.join("\n"), project, [:file], backup, [:dry_run], [:delete]) end |