Class: Docman::CLI
- Inherits:
-
Thor
- Object
- Thor
- Docman::CLI
- Defined in:
- lib/docman/cli.rb
Instance Method Summary collapse
- #build(deploy_target, state) ⇒ Object
- #deploy(deploy_target, name, type, version) ⇒ Object
- #init(name, repo) ⇒ Object
- #state(name, type, version) ⇒ Object
Instance Method Details
#build(deploy_target, state) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/docman/cli.rb', line 42 def build(deploy_target, state) config_dir? if [:force] FileUtils.rm_r('master') if File.directory? 'master' end Application.instance.build(deploy_target, state, ) say('Complete!', :green) end |
#deploy(deploy_target, name, type, version) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/docman/cli.rb', line 53 def deploy(deploy_target, name, type, version) if version.start_with?('state_') state = version.partition('_').last build(deploy_target, state) else config_dir? Application.instance.deploy(deploy_target, name, type, version, ) say('Complete!', :green) end end |
#init(name, repo) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/docman/cli.rb', line 13 def init(name, repo) if File.directory? name say("Directory #{name} already exists") if [:force] FileUtils.rm_r(name) elsif [:skip] if File.directory? File.join(name, 'config') and GitUtil.repo? File.join(name, 'config') return else FileUtils.rm_r(name) end else 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 |
#state(name, type, version) ⇒ Object
65 66 67 68 69 |
# File 'lib/docman/cli.rb', line 65 def state(name, type, version) config_dir? Application.instance.state(name, type, version) say('Complete!', :green) end |