module DeployNanny

Constants

VERSION

Public Class Methods

babysit(github_account:, nannyrc:, environments:, deploy_instructions:) click to toggle source
# File lib/deploy_nanny.rb, line 14
def babysit(github_account:,
            nannyrc:,
            environments:,
            deploy_instructions:)

  options = {}
  OptionParser.new do |opts|
    opts.banner = "\nUsage: bin/your_exec [options]\n".yellow

    opts.on("-n", "--no-deploy", "Do not auto-deploy out-of-date apps") do
      options[:no_deploy] = true
    end

    opts.on_tail("-h", "--help", "Here are all the options Deploy Nanny takes") do
      puts opts
      exit
    end
  end.parse!
  options = OpenStruct.new(options)

  babysitter = Base.new(
    github_account: github_account,
    nannyrc: nannyrc,
    environments: environments,
    deploy_instructions: deploy_instructions,
    options: options
  )

  loop do
    babysitter.babysit

    bar = TTY::ProgressBar.new(":time", total: sweep_rest) do |config|
      config.hide_cursor = true
    end
    bar.use TimeFormatter

    sweep_rest.times do
      sleep(1)
      bar.advance(1)
    end
  end
end
sweep_rest() click to toggle source
# File lib/deploy_nanny.rb, line 57
def sweep_rest
  60 * 5
end