class Shred::CLI
Attributes
config[R]
Public Class Methods
load_config()
click to toggle source
# File lib/shred.rb, line 26 def self.load_config @config = YAML.load(File.new('shred.yml')) end
set_up_commands()
click to toggle source
# File lib/shred.rb, line 30 def self.set_up_commands if config.key?('commands') commands = config['commands'] if commands.key?('platform_deps') desc 'platform_deps SUBCOMMAND ...ARGS', 'Manage platform dependencies' subcommand 'platform_deps', Commands::PlatformDeps end if commands.key?('services') desc 'services SUBCOMMAND ...ARGS', 'Control platform services' subcommand 'services', Commands::Services end if commands.key?('ruby_deps') desc 'ruby_deps SUBCOMMAND ...ARGS', 'Manage Ruby dependencies' subcommand 'ruby_deps', Commands::RubyDeps end if commands.key?('js_deps') desc 'js_deps SUBCOMMAND ...ARGS', 'Manage JavaScript dependencies' subcommand 'js_deps', Commands::JsDeps end if commands.key?('db') desc 'db SUBCOMMAND ...ARGS', 'Manage the relational database system' subcommand 'db', Commands::Db end if commands.key?('dotenv') desc 'dotenv SUBCOMMAND ...ARGS', 'Manage the environmental configuration' subcommand 'dotenv', Commands::Dotenv end if commands.key?('s3') desc 's3 SUBCOMMAND ...ARGS', 'Manage Amazon S3 buckets' subcommand 's3', Commands::S3 end if commands.key?('dynamo_db') desc 'dynamo_db SUBCOMMAND ...ARGS', 'Manage Amazon Dynamo DB tables' subcommand 'dynamo_db', Commands::DynamoDb end if commands.key?('elasticsearch') desc 'elasticsearch subcommand ...ARGS', 'Manage Elasticsearch indexes' subcommand 'elasticsearch', Commands::Elasticsearch end if commands.key?('test') desc 'test SUBCOMMAND ...ARGS', 'Run tests' subcommand 'test', Commands::Test end if commands.key?('app') desc 'app SUBCOMMAND ...ARGS', 'Control the application' subcommand 'app', Commands::App end if commands.key?('deploy') desc 'deploy SUBCOMMAND ...ARGS', 'Deploy the application' subcommand 'deploy', Commands::Deploy end if commands.key?('heroku') desc 'heroku SUBCOMMAND ...ARGS', 'Manage the deployed application in Heroku' subcommand 'heroku', Commands::Heroku end if commands.key?('setup') desc 'setup', 'First-time application setup' def setup self.class.config['commands']['setup'].each do |(cmd, subcmd)| invoke(cmd.to_sym, [subcmd.to_sym]) end say_status(:OK, 'Setup complete!', :blue) end end end end
start(*)
click to toggle source
Calls superclass method
# File lib/shred.rb, line 20 def self.start(*) load_config set_up_commands super end
Public Instance Methods
setup()
click to toggle source
# File lib/shred.rb, line 87 def setup self.class.config['commands']['setup'].each do |(cmd, subcmd)| invoke(cmd.to_sym, [subcmd.to_sym]) end say_status(:OK, 'Setup complete!', :blue) end