class CmdDeploy

Public Instance Methods

run(argv) click to toggle source
# File lib/punt/cmd/cmd_deploy.rb, line 9
def run(argv)
    opts = parse_opts(argv)
    env = argv.shift
    repo_ref = argv.shift

    Deploy.new.deploy(env: env, repo_ref: repo_ref, dry_run: opts[:dry_run], verbose: opts[:verbose], force_local: opts[:force_local])
end

Private Instance Methods

parse_opts(argv) click to toggle source
# File lib/punt/cmd/cmd_deploy.rb, line 19
def parse_opts(argv)
    options = {}

    opt_parser = OptionParser.new do |opts|
        opts.banner = "Usage: punt deploy [options] [environment [git-ref]]"

        opts.on("-d", "--dry-run", "Show the commands that punt would execute, but don't actually do anything.") do |d|
            options[:dry_run] = d
        end

        opts.on("-v", "--verbose", "Run in verbose mode") do |v|
            options[:verbose] = v
        end

        opts.on("-l", "--force-local", "Try and push commits even if there are local changes") do |f|
            options[:force_local] = f
        end
    end

    opt_parser.parse!(argv)

    return options
end