class VpsCli::Cli

The CLI component of this library Integrates Thor @see whatisthor.com/

Public Instance Methods

copy() click to toggle source
# File lib/vps_cli/cli.rb, line 56
def copy
  VpsCli.load_configuration(options[:config])
  Copy.all
end
fresh_install() click to toggle source
# File lib/vps_cli/cli.rb, line 21
def fresh_install
  VpsCli.load_configuration(options[:config])
  Copy.all
  Install.all_install

  Access.provide_credentials

  VpsCli.print_errors
end
git_pull() click to toggle source
# File lib/vps_cli/cli.rb, line 91
def git_pull
  swap_dir { Rake.sh('git pull') }
end
git_push(message = nil) click to toggle source
# File lib/vps_cli/cli.rb, line 96
def git_push(message = nil)
  message ||= 'auto push files'

  swap_dir do
    begin
      Rake.sh('git add -A')
      Rake.sh("git commit -m \"#{message}\"")
      Rake.sh('git push')
    rescue


    end
  end
end
git_status() click to toggle source
# File lib/vps_cli/cli.rb, line 112
def git_status
  swap_dir { Rake.sh('git status') }
end
init(file = options[:config]) click to toggle source
# File lib/vps_cli/cli.rb, line 32
def init(file = options[: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() click to toggle source
# 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() click to toggle source
# File lib/vps_cli/cli.rb, line 49
def install_gems
  Packages::GEMS.each do |g|
    Rake.sh("gem install #{g}")
  end
end
login() click to toggle source
# File lib/vps_cli/cli.rb, line 85
def login
  VpsCli.load_configuration(options[:config])
  VpsCli.provide_credentials
end
pull() click to toggle source
# File lib/vps_cli/cli.rb, line 63
def pull
  VpsCli.load_configuration(options[:config])
  Pull.all
end
swap_dir() { || ... } click to toggle source
# File lib/vps_cli/cli.rb, line 117
def swap_dir
  VpsCli.load_configuration(options[:config])
  Rake.cd(VpsCli.configuration.config_files)
  yield
end
update_all() click to toggle source
# File lib/vps_cli/cli.rb, line 69
def update_all
  VpsCli.load_configuration(options[:config])
  Install.prep
  Install.install_non_apt_packages
end
version() click to toggle source
# File lib/vps_cli/cli.rb, line 15
def version
  puts "vps-cli version #{VpsCli::VERSION}"
end