This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
class ShopifyCli::Heroku
Tim Anema edited this page May 14, 2020
·
7 revisions
DOWNLOAD_URLS
new(ctx)
see source
# File lib/shopify-cli/heroku.rb, line 9
def initialize(ctx)
@ctx = ctx
end
app()
see source
# File lib/shopify-cli/heroku.rb, line 13
def app
return nil unless (app = git_remote)
app = app.split('/').last
app = app.split('.').first
app
end
authenticate()
see source
# File lib/shopify-cli/heroku.rb, line 20
def authenticate
result = @ctx.system(heroku_command, 'login')
@ctx.abort(@ctx.message('core.heroku.error.authentication')) unless result.success?
end
create_new_app()
see source
# File lib/shopify-cli/heroku.rb, line 25
def create_new_app
output, status = @ctx.capture2e(heroku_command, 'create')
@ctx.abort(@ctx.message('core.heroku.error.creation')) unless status.success?
@ctx.puts(output)
end
deploy(branch_to_deploy)
see source
# File lib/shopify-cli/heroku.rb, line 31
def deploy(branch_to_deploy)
result = @ctx.system('git', 'push', '-u', 'heroku', "#{branch_to_deploy}:master")
@ctx.abort(@ctx.message('core.heroku.error.deploy')) unless result.success?
end
download()
see source
# File lib/shopify-cli/heroku.rb, line 36
def download
return if installed?
result = @ctx.system('curl', '-o', download_path, DOWNLOAD_URLS[@ctx.os], chdir: ShopifyCli::ROOT)
@ctx.abort(@ctx.message('core.heroku.error.download')) unless result.success?
@ctx.abort(@ctx.message('core.heroku.error.download')) unless File.exist?(download_path)
end
install()
see source
# File lib/shopify-cli/heroku.rb, line 44
def install
return if installed?
result = @ctx.system('tar', '-xf', download_path, chdir: ShopifyCli::ROOT)
@ctx.abort(@ctx.message('core.heroku.error.install')) unless result.success?
@ctx.rm(download_path)
end
select_existing_app(app_name)
see source
# File lib/shopify-cli/heroku.rb, line 53
def select_existing_app(app_name)
result = @ctx.system(heroku_command, 'git:remote', '-a', app_name)
msg = @ctx.message('core.heroku.error.could_not_select_app', app_name)
@ctx.abort(msg) unless result.success?
end
whoami()
see source
# File lib/shopify-cli/heroku.rb, line 60
def whoami
output, status = @ctx.capture2e(heroku_command, 'whoami')
return output.strip if status.success?
nil
end