Class: Ghdeploy::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ghdeploy/cli.rb

Instance Method Summary collapse

Instance Method Details

#deploy(environment, ref) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/ghdeploy/cli.rb', line 12

def deploy(environment, ref)
  remote_name = options[:remote] || 'origin'
  facts = RepoFactFinder.new(remote_name)
  Octokit.configure { |c| c.api_endpoint = facts.api_endpoint }
  client = Octokit::Client.new(access_token: facts.token)
  deployment = client.create_deployment(facts.repo, ref, environment: environment)
  puts "Deployment created: #{deployment.url}" if deployment.url
end