Sha256: 078391907d5733f53b20b98b203e815a881b318e9eb29988a040f72be564e049

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

class Fanforce::AppFactory::CLI::Scripts
  include Fanforce::AppFactory::CLI::Utils

  ######################################################################################################################

  def restart(environment=:development)
    environment = environment.to_sym

    if Fanforce::CLI::TYPE == :directory_of_apps
      Fanforce::CLI::Apps.each do |app, current_count, total|
        restart_app(app, environment)
      end
    else
      restart_app(Fanforce::CLI::App.load(Fanforce::CLI::DIR), environment)
    end
    log divider '----------------------------------------------------------------------------------------------------++'
  end

  def restart_app(app, environment)
    log divider '------------------------------------------------------------------------------------------------------'
    environments = environment==:all ? [:development,:staging,:production] : [environment]
    Dir.chdir(app.dir) do
      environments.each do |environment|
        if environment == :development
          FileUtils.mkdir("#{app.dir}/tmp") if !File.directory?("#{app.dir}/tmp")
          FileUtils.touch("#{app.dir}/tmp/restart.txt")
        elsif [:production, :staging].include?(environment)
          Fanforce::AppFactory::CLI::Heroku.new(app, environment).restart
        end
        log "#{"Restarted #{environment}".format(:bold,:green)} #{app.dir_name}"
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fanforce-app-factory-2.0.0.rc38 lib/fanforce/app_factory/cli/scripts/restart.rb
fanforce-app-factory-2.0.0.rc37 lib/fanforce/app_factory/cli/scripts/restart.rb