class Fanforce::AppFactory::CLI::Scripts include Fanforce::AppFactory::CLI::Utils 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 setup(type=:all) app = Fanforce::CLI::App.new(Fanforce::CLI::DIR) type = type.to_s.downcase.to_sym error 'Unknown setup type', :setup if ![:all,:bundler,:pow,:git,:bitbucket,:env,:uranium].include?(type) if !File.exists?("#{app.dir}/config.ru") error "This does not seem to be a valid app directory since it's missing config.ru" end if [:all,:bundler].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP BUNDLER...' Fanforce::AppFactory::CLI::Bundler.new(app).setup end if [:all,:pow].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP POW DOMAINS...' Fanforce::AppFactory::CLI::Pow.new(app).setup end if [:all,:git].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP GIT...' Fanforce::AppFactory::CLI::Git.new(app).setup end if [:all,:bitbucket].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP BITBUCKET...' Fanforce::AppFactory::CLI::Bitbucket.new(app).setup end if [:all,:env].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP ENV...' Fanforce::AppFactory::CLI::Env.new(app).setup(:development) end if [:all,:uranium].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'RUNNING TOUCH TMP/RESTART.TXT...' `touch tmp/restart.txt` log 'Finished'.format(:green,:bold) + ' restarting' end if [:all,:uranium].include?(type) log divider '+---------------------------------------------------------------------------------------------------' log 'SETTING UP URANIUM...' Fanforce::AppFactory::CLI::Uranium.new(app).setup end log divider '+-----------------------------------------------------------------------------------------------------' log 'SUCCESS!'.format(:bold,:green) log divider '----------------------------------------------------------------------------------------------------++' end end