Sha256: f004cf85a4f5bb632c0240ec670b912df6ef614d33b79201e2f4d73d0d0f6c1b
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
require 'thor' require 'application' module Docman class CLI < Thor # TODO: add proper descriptions. desc 'init NAME', 'init to NAME' method_option :force, :aliases => '-f', :desc => 'Force init' def init(name, repo) if File.directory? "#{name}" say("Directory #{name} already exists") if options[:force] FileUtils.rm_r(name) elsif choice = ask('Are you sure you want do delete existing docroot? Type "yes" if you agree.') if choice == 'yes' FileUtils.rm_r(name) elsif Kernel::abort 'Exit' end end end puts "Init docroot directory #{name} and retrieve config from provided repo." Application.instance.init(name, repo) say('Complete!', :green) end desc 'build NAME', 'init to NAME' method_option :force, :aliases => '-f', :desc => 'Force full rebuild' def build(deploy_target, state) config_dir? if options[:force] FileUtils.rm_r('master') if File.directory? 'master' end Application.instance.build(deploy_target, state, options) say('Complete!', :green) end desc 'deploy NAME', 'init to NAME' method_option :force, :aliases => '-f', :desc => 'Force full deploy' def deploy(deploy_target, name, type, version) config_dir? Application.instance.deploy(deploy_target, name, type, version, options) say('Complete!', :green) end desc 'state NAME', 'init to NAME' def state(name, type, version) config_dir? Application.instance.state(name, type, version) say('Complete!', :green) end no_commands { def config_dir? unless File.directory?('config') $stderr.puts 'ERROR: No config directory in docroot' exit 1 end end } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
docman-0.0.6 | lib/docman/cli.rb |