Sha256: 79e1b4fdb8decf8c9007e88d3b6e35a55c402a4f5dbbbd23ea31d00312cc3893

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

namespace :projectlocker_errata do
  desc "Notify ProjectlockerErrata of a new deploy."
  task :deploy do
    require 'projectlocker_errata_tasks'

    if defined?(Rails.root)
      initializer_file = Rails.root.join('config', 'initializers','projectlocker_errata.rb')

      if initializer_file.exist?
        load initializer_file
      else
        Rake::Task[:environment].invoke
      end
    end

    ProjectlockerErrataTasks.deploy(:rails_env      => ENV['TO'],
                        :scm_revision   => ENV['REVISION'],
                        :scm_repository => ENV['REPO'],
                        :local_username => ENV['USER'],
                        :api_key        => ENV['API_KEY'],
                        :dry_run        => ENV['DRY_RUN'])
  end

  task :log_stdout do
    require 'logger'
    RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
  end

  namespace :heroku do
    desc "Install Heroku deploy notifications addon"
    task :add_deploy_notification => [:environment] do

      def heroku_var(var)
        `heroku config | grep -E "#{var.upcase}" | awk '{ print $3; }'`.strip
      end

      heroku_rails_env = heroku_var("rails_env")
      heroku_api_key = heroku_var("(hoptoad|projectlocker_errata)_api_key").split.find {|x| x unless x.blank?} ||
        ProjectlockerErrata.configuration.api_key

      command = %Q(heroku addons:add deployhooks:http --url="http://errors.projectlocker.com/deploys.txt?deploy[rails_env]=#{heroku_rails_env}&api_key=#{heroku_api_key}")

      puts "\nRunning:\n#{command}\n"
      puts `#{command}`
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
projectlocker_errata-0.1.1 lib/projectlocker_errata/shared_tasks.rb
projectlocker_errata-0.1.0 lib/projectlocker_errata/shared_tasks.rb
projectlocker_errata-0.0.2 lib/projectlocker_errata/shared_tasks.rb
projectlocker_errata-0.0.1 lib/projectlocker_errata/shared_tasks.rb