Class: Travis::Deploy

Inherits:
Thor
  • Object
show all
Defined in:
lib/travis/deploy.rb,
lib/travis/deploy/config.rb,
lib/travis/deploy/deploy.rb,
lib/travis/deploy/helper.rb,
lib/travis/deploy/secure_key.rb

Defined Under Namespace

Modules: Helper Classes: Config, Deploy, SecureKey

Instance Method Summary collapse

Instance Method Details

#config(remote) ⇒ Object



23
24
25
26
# File 'lib/travis/deploy.rb', line 23

def config(remote)
  config = Config.new(shell, remote, options)
  options[:pretend] ? config.pretend : config.invoke
end

#deploy(remote) ⇒ Object



32
33
34
# File 'lib/travis/deploy.rb', line 32

def deploy(remote)
  Deploy.new(shell, remote, options).invoke
end

#encrypt(slug, secret) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/travis/deploy.rb', line 39

def encrypt(slug, secret)
  puts "\nAbout to encrypt '#{secret}' for '#{slug}'\n\n"

  encrypted = nil
  begin
    encrypted = SecureKey.new(slug, options[:host]).encrypt(secret)
  rescue SecureKey::FetchKeyError
    abort 'There was an error while fetching public key, please check if you entered correct slug'
  end

  puts "Please add the following to your .travis.yml file:"
  puts ""
  puts "  secure: \"#{Base64.encode64(encrypted).strip.gsub("\n", "\\n")}\""
  puts ""
end