Sha256: 0a51381941490f6ff070a87951584b2645b041c04eb53f230b7db976ded348c0

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

config_ssh = <<-RUBY

Host heroku.com
    StrictHostKeyChecking no
    CheckHostIP no
    UserKnownHostsFile=/dev/null
Host github.com
    StrictHostKeyChecking no
RUBY

namespace :hatchet do
  task :setup_travis do
    puts "== Setting Up Travis =="
    netrc = "#{ENV['HOME']}/.netrc"
    unless File.exists?(netrc)
      File.open(netrc, 'w') do |file|
        file.write <<EOF
machine git.heroku.com
  login #{ENV['HEROKU_API_USER']}
  password #{ENV['HEROKU_API_KEY']}
EOF
      end
    end
    [
     "bundle exec hatchet install",
     "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email '#{ENV['HEROKU_API_USER']}'`; fi",
     "if [ `git config --get user.name` ];  then echo 'already set'; else `git config --global user.name  'BuildpackTester'`      ; fi",
     "echo '#{config_ssh}' >> ~/.ssh/config",
     "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''",
     "yes | heroku keys:add"
    ].each do |command|
      puts "== Running: #{command}"
      Bundler.with_clean_env do
        result = `#{command}`
        raise "Command failed: #{command.inspect}\nResult: #{result}" unless $?.success?
      end
    end
    puts "== Done =="
  end

  task :teardown_travis do
    ['heroku keys:remove'].each do |command|
      puts "== Running: #{command}"
      `#{command}`
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heroku_hatchet-2.0.3 lib/hatchet/tasks.rb
heroku_hatchet-2.0.2 lib/hatchet/tasks.rb