Sha256: d4bafb5cd0220210d4feab59bc1b4762edbef04bbf52fd3df58be5bb72fcf139

Contents?: true

Size: 1.43 KB

Versions: 7

Compression:

Stored size: 1.43 KB

Contents

class Fanforce::PluginFactory::CLI::Scripts
  include Fanforce::PluginFactory::CLI::Utils

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

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

    if Fanforce::CLI::TYPE == :directory_of_plugins
      Fanforce::CLI::Plugins.each do |plugin, current_count, total|
        restart_plugin(plugin, environment)
      end
    else
      restart_plugin(Fanforce::CLI::Plugin.load(Fanforce::CLI::DIR), environment)
    end
    log divider '----------------------------------------------------------------------------------------------------++'
  end

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

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fanforce-plugin-factory-2.0.0.rc8 lib/fanforce/plugin_factory/cli/scripts/restart.rb
fanforce-plugin-factory-2.0.0.rc7 lib/fanforce/plugin_factory/cli/scripts/restart.rb
fanforce-plugin-factory-2.0.0.rc6 lib/fanforce/plugin_factory/cli/scripts/restart.rb
fanforce-plugin-factory-2.0.0.rc5 lib/fanforce/plugin_factory/cli/scripts/restart.rb
fanforce-plugin-factory-2.0.0.rc3 lib/fanforce/plugin_factory/cli/scripts/restart.rb
fanforce-plugin-factory-2.0.0.rc2 lib/fanforce/plugin_factory/cli/scripts/restart.rb
fanforce-plugin-factory-2.0.0.rc1 lib/fanforce/plugin_factory/cli/scripts/restart.rb