class CF::App::Push
Public Instance Methods
push()
click to toggle source
# File lib/cf/cli/app/push.rb, line 40 def push name = input[:name] path = File.expand_path(input[:path]) app = client.app_by_name(name) if app sync_app(app, path) else setup_new_app(path) end end
setup_new_app(path)
click to toggle source
# File lib/cf/cli/app/push.rb, line 52 def setup_new_app(path) self.path = path app = create_app(get_inputs) map_route(app) create_services(app) bind_services(app) upload_app(app, path) start_app(app) end
Private Instance Methods
sync_app(app, path)
click to toggle source
# File lib/cf/cli/app/push.rb, line 64 def sync_app(app, path) upload_app(app, path) apply_changes(app) input[:path] display_changes(app) commit_changes(app) warn "\n#{c(app.name, :name)} is currently stopped, start it with 'truck start'" unless app.started? end
upload_app(app, path)
click to toggle source
# File lib/cf/cli/app/push.rb, line 81 def upload_app(app, path) app = filter(:push_app, app) with_progress("Uploading #{c(app.name, :name)}") do app.upload(path) end rescue err "Upload failed. Try again with 'truck push'." raise end
url_choices(name)
click to toggle source
# File lib/cf/cli/app/push.rb, line 74 def url_choices(name) client.current_space.domains.sort_by(&:name).collect do |d| # TODO: check availability "#{name}.#{d.name}" end end
wrap_message_format_errors() { || ... }
click to toggle source
# File lib/cf/cli/app/push.rb, line 92 def wrap_message_format_errors yield rescue CFoundry::MessageParseError => e md = e.description.match /Field: ([^,]+)/ field = md[1] case field when "buildpack" fail "Buildpack must be a public git repository URI." end end