Class: VpsCli::Cli
- Inherits:
-
Thor
- Object
- Thor
- VpsCli::Cli
- Defined in:
- lib/vps_cli/cli.rb
Overview
The CLI component of this library Integrates Thor
Instance Method Summary collapse
- #copy ⇒ Object
- #fresh_install ⇒ Object
- #git_pull ⇒ Object
- #git_push(message = nil) ⇒ Object
- #git_status ⇒ Object
- #init(file = options[:config]) ⇒ Object
- #install_all ⇒ Object
- #install_gems ⇒ Object
- #login ⇒ Object
- #pull ⇒ Object
- #update_all ⇒ Object
- #version ⇒ Object
Instance Method Details
#copy ⇒ Object
56 57 58 59 |
# File 'lib/vps_cli/cli.rb', line 56 def copy VpsCli.load_configuration([:config]) Copy.all end |
#fresh_install ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/vps_cli/cli.rb', line 21 def fresh_install VpsCli.load_configuration([:config]) Copy.all Install.all_install Access.provide_credentials VpsCli.print_errors end |
#git_pull ⇒ Object
91 92 93 |
# File 'lib/vps_cli/cli.rb', line 91 def git_pull swap_dir { Rake.sh('git pull') } end |
#git_push(message = nil) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/vps_cli/cli.rb', line 96 def git_push( = nil) ||= 'auto push files' swap_dir do begin Rake.sh('git add -A') Rake.sh("git commit -m \"#{}\"") Rake.sh('git push') rescue end end end |
#git_status ⇒ Object
112 113 114 |
# File 'lib/vps_cli/cli.rb', line 112 def git_status swap_dir { Rake.sh('git status') } end |
#init(file = options[:config]) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/vps_cli/cli.rb', line 32 def init(file = [:config]) if File.exist?(file) loop do puts "#{file} already exists. Would you like to overwrite it? (Y/N)" input = $stdin.gets.chomp # breaks and creates the config break if input.to_sym == :y return if input.to_sym == :n # continue the loop otherwise end end VpsCli.create_configuration(file) end |
#install_all ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/vps_cli/cli.rb', line 76 def install_all Install.all_install return if VpsCli.errors.empty? VpsCli.print_errors end |
#install_gems ⇒ Object
49 50 51 52 53 |
# File 'lib/vps_cli/cli.rb', line 49 def install_gems Packages::GEMS.each do |g| Rake.sh("gem install #{g}") end end |
#login ⇒ Object
85 86 87 88 |
# File 'lib/vps_cli/cli.rb', line 85 def login VpsCli.load_configuration([:config]) VpsCli.provide_credentials end |
#pull ⇒ Object
63 64 65 66 |
# File 'lib/vps_cli/cli.rb', line 63 def pull VpsCli.load_configuration([:config]) Pull.all end |
#update_all ⇒ Object
69 70 71 72 73 |
# File 'lib/vps_cli/cli.rb', line 69 def update_all VpsCli.load_configuration([:config]) Install.prep Install.install_non_apt_packages end |