Class: Kybus::CLI::Deployer
- Inherits:
-
Object
- Object
- Kybus::CLI::Deployer
- Defined in:
- lib/kybus/cli/bot/deployer.rb
Constant Summary collapse
- DEFAULT_CONFIGS =
{ 'repo_path' => '.', 'output_path' => './.kybusbotcode.zip' }.freeze
Instance Method Summary collapse
- #compress_repo! ⇒ Object
- #config_with_options ⇒ Object
- #deploy_lambda! ⇒ Object
- #destroy ⇒ Object
-
#initialize(options) ⇒ Deployer
constructor
A new instance of Deployer.
- #load_kybusdeploy_file! ⇒ Object
- #run ⇒ Object
- #run_migrations! ⇒ Object
Constructor Details
#initialize(options) ⇒ Deployer
Returns a new instance of Deployer.
28 29 30 31 32 33 34 |
# File 'lib/kybus/cli/bot/deployer.rb', line 28 def initialize() @params = load_kybusdeploy_file! @telegram = ::Kybus::CLI::BotDeployerTelegramConfigurator.new(nil, ) @lambda = ::Kybus::CLI::AWSBotDeployer.new() @job_executor = ::Kybus::CLI::AWSBotJobRunnerDeployer.new() end |
Instance Method Details
#compress_repo! ⇒ Object
50 51 52 53 |
# File 'lib/kybus/cli/bot/deployer.rb', line 50 def compress_repo! code = ::Kybus::AWS::CodePackager.new() code.create_or_update! end |
#config_with_options ⇒ Object
46 47 48 |
# File 'lib/kybus/cli/bot/deployer.rb', line 46 def ||= DEFAULT_CONFIGS.merge(@config.merge(@params)) end |
#deploy_lambda! ⇒ Object
55 56 57 58 59 |
# File 'lib/kybus/cli/bot/deployer.rb', line 55 def deploy_lambda! @lambda.create_or_update! @job_executor.create_or_update! @telegram.url = @lambda.url end |
#destroy ⇒ Object
67 68 69 70 |
# File 'lib/kybus/cli/bot/deployer.rb', line 67 def destroy @lambda.destroy! @telegram.destroy! end |
#load_kybusdeploy_file! ⇒ Object
42 43 44 |
# File 'lib/kybus/cli/bot/deployer.rb', line 42 def load_kybusdeploy_file! @config = YAML.load_file('./kybusbot.yaml') end |
#run ⇒ Object
61 62 63 64 65 |
# File 'lib/kybus/cli/bot/deployer.rb', line 61 def run compress_repo! deploy_lambda! @telegram.create_or_update! end |
#run_migrations! ⇒ Object
36 37 38 39 40 |
# File 'lib/kybus/cli/bot/deployer.rb', line 36 def run_migrations! Rake::Task.clear load 'Rakefile' Rake::Task['db:migrate'].invoke end |