Sha256: 2ed8b1ed7b0c3a7b9552b21f406389b1e0744da59810a856cdd0ced55b570736

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

module Hanzo
  module Installers
    module Remotes
      def install_remotes
        Hanzo.title 'Creating git remotes'

        Hanzo::Installers::Remotes.environments.each_pair do |env, app|
          Hanzo::Installers::Remotes.add_remote(app, env)
        end
      end

      def self.add_remote(app, env)
        Hanzo.print "Adding #{env}"
        Hanzo.run "git remote rm #{env} 2>&1 > /dev/null"
        Hanzo.run "git remote add #{env} git@heroku.com:#{app}.git"
      end

      def self.environments
        return YAML.load_file('.heroku-remotes') if File.exist?('.heroku-remotes')

        Hanzo.print 'Cannot locate .heroku-remotes'
        Hanzo.print 'For more information, please read https://github.com/mirego/hanzo'
        exit
      end

      def self.installed_environments
        `git remote`.split("\n")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hanzo-0.4.5 lib/hanzo/modules/installers/remotes.rb
hanzo-0.4.4 lib/hanzo/modules/installers/remotes.rb
hanzo-0.4.3 lib/hanzo/modules/installers/remotes.rb