class Robut::Plugin::Shipr::Deploy
Attributes
branch[R]
name[R]
options[R]
Public Class Methods
new(name, options = {})
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 5 def initialize(name, options = {}) @name, @branch = name.split(configuration.branch_delimiter) @options = options end
Public Instance Methods
environment()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 23 def environment options[:environment] || 'production' end
force()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 27 def force options[:force] || false end
perform()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 10 def perform body = { repo: repo, config: config, branch: branch } HTTParty.post endpoint, body: body.to_json, headers: { 'Content-Type' => 'application/json' }, basic_auth: configuration.credentials end
Private Instance Methods
config()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 37 def config config = { 'ENVIRONMENT' => environment } config.merge!('FORCE' => '1') if force config end
configuration()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 55 def configuration Robut::Plugin::Shipr.configuration end
endpoint()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 43 def endpoint "#{configuration.api_base}/api/deploys" end
nwo()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 47 def nwo name =~ /\// ? name : "#{configuration.github_organization}/#{name}" end
repo()
click to toggle source
# File lib/robut/plugin/shipr/deploy.rb, line 51 def repo "git@github.com:#{nwo}.git" end