Module: VMC::App::Sync

Included in:
Push
Defined in:
lib/vmc/cli/app/push/sync.rb

Instance Method Summary collapse

Instance Method Details

#apply_changes(app) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/vmc/cli/app/push/sync.rb', line 3

def apply_changes(app)
  app.memory = megabytes(input[:memory]) if input.has?(:memory)
  app.total_instances = input[:instances] if input.has?(:instances)
  app.command = input[:command] if input.has?(:command)
  app.production = input[:plan].upcase.start_with?("P") if input.has?(:plan)
  app.framework = input[:framework] if input.has?(:framework)
  app.runtime = input[:runtime] if input.has?(:runtime)
  app.buildpack = input[:buildpack] if input.has?(:buildpack)
end

#commit_changes(app) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vmc/cli/app/push/sync.rb', line 25

def commit_changes(app)
  if app.changed?
    with_progress("Updating #{c(app.name, :name)}") do
      wrap_message_format_errors do
        app.update!
      end
    end
  end

  if input[:restart] && app.started?
    invoke :restart, :app => app
  end
end

#display_changes(app) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vmc/cli/app/push/sync.rb', line 13

def display_changes(app)
  return unless app.changed?

  line "Changes:"

  indented do
    app.changes.each do |attr, (old, new)|
      line "#{c(attr, :name)}: #{diff_str(attr, old)} -> #{diff_str(attr, new)}"
    end
  end
end