class DeployNanny::Deployer
Attributes
app[R]
deploy_instructions[R]
env[R]
environments[R]
nannyrc[R]
Public Class Methods
new(env:, app:, environments:, deploy_instructions:, nannyrc:)
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 6 def initialize(env:, app:, environments:, deploy_instructions:, nannyrc:) @env = env @app = app @nannyrc = nannyrc @environments = environments @deploy_instructions = deploy_instructions end
Public Instance Methods
command()
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 23 def command cmd = command_template.dup deploy_instructions.fetch("deploy_variables").each do |var| cmd.sub!(":#{var}:", deploy_info(var)) end cmd end
deploy()
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 14 def deploy Bundler.with_clean_env { Dir.chdir("#{dir}/") { cmd = "bundle install && #{command}" output, status = Open3.capture2(cmd) } } end
Private Instance Methods
apps_config()
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 58 def apps_config @apps_config ||= deploy_instructions.fetch("apps").fetch(app) end
command_template()
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 35 def command_template deploy_instructions.fetch("deploy_template") end
deploy_info(var)
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 47 def deploy_info(var) case var when "revision" revision when "user" env when "cap_env" environments.fetch(env).fetch("cap_env") end end
dir()
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 39 def dir nannyrc.fetch("apps_directory") + "/#{app}" end
revision()
click to toggle source
# File lib/deploy_nanny/deployer.rb, line 43 def revision deploy_instructions.fetch("apps").fetch(app) end