class Fanforce::PluginFactory::CLI::Scripts include Fanforce::PluginFactory::CLI::Utils require_relative '../lib/scaffolding' require_relative '../lib/bundler' require_relative '../lib/pow' require_relative '../lib/git' require_relative '../lib/bitbucket' require_relative '../lib/env' require_relative '../lib/uranium' ###################################################################################################################### def create(plugin_id) plugin_id || error('You must supply a valid PLUGIN_ID', :create) plugin_dir = "#{Fanforce::CLI::DIR}/#{plugin_id}" if File.exists?("#{plugin_dir}/config.ru") error "#{plugin_id} already exists. You should run: " + "fanforce update #{plugin_id}".format(:green) end log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING FILES...' Dir.mkdir(plugin_dir) if !File.directory?(plugin_dir) Dir.chdir(plugin_dir) log "#{'Created'.format(:bold, :green)} #{plugin_id}/" plugin = Fanforce::CLI::Plugin.new(plugin_dir) Fanforce::PluginFactory::CLI::Scaffolding.new(plugin).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'INSTALLING BUNDLER...' Fanforce::PluginFactory::CLI::Bundler.new(plugin).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING POW DOMAINS...' Fanforce::PluginFactory::CLI::Pow.new(plugin).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING LOCAL GIT REPOSITORY...' Fanforce::PluginFactory::CLI::Git.new(plugin).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING BITBUCKET REPOSITORY...' Fanforce::PluginFactory::CLI::Bitbucket.new(plugin).create log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING ENV VARIABLES...' Fanforce::PluginFactory::CLI::Env.new(plugin).setup(:development) log divider '+-----------------------------------------------------------------------------------------------------' log 'RUNNING TOUCH TMP/RESTART.TXT...' `touch tmp/restart.txt` log 'Finished'.format(:green,:bold) + ' restarting' log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP URANIUM...' Fanforce::PluginFactory::CLI::Uranium.new(plugin).create log divider '+-----------------------------------------------------------------------------------------------------' log 'SUCCESS!'.format(:bold,:green) log divider '----------------------------------------------------------------------------------------------------++' end end