Sha256: 38b52a45232928ec47de6040231987fd2ef4ee687a84846e760eeacf71fc5d89
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'shellwords' require 'yaml' module Travis class Cli class Config include Helper attr_reader :shell, :remote, :options def initialize(shell, remote, options) @remote = remote @options = options @shell = shell end def invoke store push end protected def app @app ||= begin app = File.basename(Dir.pwd).gsub('travis-', '') app = 'web' if app == 'ci' app end end def config @config ||= keychain.fetch end def keychain @keychain ||= Keychain.new(app, shell) end def store backup if backup? File.open(filename, 'w+') { |f| f.write(config) } end def push say 'Configuring the app ...' config = Shellwords.escape(YAML.dump(YAML.load(self.config)[remote])) run "heroku config:add travis_config=#{config} -r #{remote}", :echo => "heroku config:add travis_config=... -r #{app}" 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-cli-0.0.2 | lib/travis/cli/config.rb |