Sha256: 79d6b4575abab11cf4b72fe590ac991dcfd7ee0438da0a989383a8c8a50500f6
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
require 'yaml' module AppRb class Cli def initialize(args) @args = args Thread.abort_on_exception = true end def run if @args.count < 2 usage exit end config = Config.new(YAML.load(File.read(@args[0]))) command = @args[1] if AppRb::Util.compare_versions(config.tool_version, AppRb::VERSION) > 0 puts "FATAL: need at least '#{config.tool_version}' tool version but current version is '#{AppRb::VERSION}'" exit -1 end if command == "deploy" || command == "d" Command.new(config).deploy(@args[2]) elsif command == "status" || command == "s" Command.new(config).status elsif command == "redeploy" Command.new(config).redeploy elsif command == "clean" Command.new(config).clean elsif command == "stop" Command.new(config).stop elsif command == "run" || command == "r" Command.new(config).run(@args[2..-1].join(" ")) elsif command == "cd" Command.new(config).cd else puts "FATAL: unknown command '#{command}'" exit -1 end end private def usage puts "Just deploy your apps with docker and consul. Nothing else." puts "Version: #{AppRb::VERSION}" puts "" puts " app-rb <yml> <command>" puts "" puts "Usage:" puts " deploy [hash] - deploy new version of app" puts " status - status of app" puts " stop - stop app" puts " run <cmd> [args] - one time command" puts " cd - go to run node" puts "" puts "Advanced:" puts " redeploy - redeploy app" puts " clean - stop and remove not current containers" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
app-rb-0.6.0 | lib/app-rb/cli.rb |
app-rb-0.5.0 | lib/app-rb/cli.rb |