class Fanforce::AppFactory::CLI::Scripts include Fanforce::AppFactory::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(app_id) app_id || error('You must supply a valid APP_ID', :create) app_dir = "#{Fanforce::CLI::DIR}/#{app_id}" if File.exists?("#{app_dir}/config.ru") error "#{app_id} already exists. You should run: " + "fanforce update #{app_id}".format(:green) end log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING FILES...' Dir.mkdir(app_dir) if !File.directory?(app_dir) Dir.chdir(app_dir) log "#{'Created'.format(:bold, :green)} #{app_dir}/" app = Fanforce::CLI::App.new(app_dir) Fanforce::AppFactory::CLI::Scaffolding.new(app).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'INSTALLING BUNDLER...' Fanforce::AppFactory::CLI::Bundler.new(app).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING POW DOMAINS...' Fanforce::AppFactory::CLI::Pow.new(app).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING LOCAL GIT REPOSITORY...' Fanforce::AppFactory::CLI::Git.new(app).setup log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING BITBUCKET REPOSITORY...' Fanforce::AppFactory::CLI::Bitbucket.new(app).create log divider '+-----------------------------------------------------------------------------------------------------' log 'CREATING ENV VARIABLES...' Fanforce::AppFactory::CLI::Env.new(app).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::AppFactory::CLI::Uranium.new(app).create log divider '+-----------------------------------------------------------------------------------------------------' log 'SUCCESS!'.format(:bold,:green) log divider '----------------------------------------------------------------------------------------------------++' end end