Sha256: d0f633e42cf1b2107b9f4c4a3c851327bc7cd963212a8a8973678433e69a7875
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
require 'shellwords' require 'yaml' module Travis class Deploy class Config autoload :Builder, 'travis/deploy/config/builder' include Helper attr_reader :shell, :remote, :env, :options def initialize(shell, remote, options) @remote = remote @options = options @shell = shell @env = options['env'] || remote end def invoke store unless options['source'] push unless @env == 'development' end def pretend say 'Config to upload:' say YAML.dump(config) end protected def app @app ||= options[:app] || File.basename(Dir.pwd).gsub('travis-', '') end def config @config ||= source ? YAML.load(source) : Builder.new(keychain, env).build end def yaml_config @yaml_config ||= source || keychain.source end def source File.read(options['source']) if options['source'] end def keychain @keychain ||= Keychain.new(app, shell) end def development_config { development: Builder.new(keychain, 'development').build } end def store backup if backup? File.open(filename, 'w+') { |f| f.write(YAML.dump(development_config)) } end def push say 'Configuring the app ...' yaml = Shellwords.escape(YAML.dump(config)) run "heroku config:add travis_config=#{yaml} -r #{remote}", :echo => "heroku config:add travis_config=... -r #{remote}" end def backup say 'Backing up the old config file ...' run "cp #{filename} #{filename}.backup" end def backup? !!options['backup'] end def filename "config/travis.yml" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
travis-deploy-0.2.1 | lib/travis/deploy/config.rb |