Class: KubsCLI::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/kubs_cli/cli.rb

Instance Method Summary collapse

Instance Method Details

#copyObject



25
26
27
# File 'lib/kubs_cli/cli.rb', line 25

def copy
  run_command { KubsCLI::Copy.new.copy_all }
end

#git_pullObject



62
63
64
65
66
# File 'lib/kubs_cli/cli.rb', line 62

def git_pull
  swap_dir { Rake.sh('git pull') }
rescue RuntimeError => e
  KubsCLI.add_error(e: e, msg: 'Ran into an error pulling down your repo')
end

#git_push(message = nil) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/kubs_cli/cli.rb', line 48

def git_push(message = nil)
  message ||= 'auto push files'

  swap_dir do
    Rake.sh('git add -A')
    Rake.sh("git commit -m \"#{message}\"")
    Rake.sh('git push')
  rescue RuntimeError => e
    KubsCLI.add_error(e: e, msg: 'Something went wrong pushing your repo')
  end
end

#git_statusObject



69
70
71
# File 'lib/kubs_cli/cli.rb', line 69

def git_status
  swap_dir { Rake.sh('git status') }
end

#initObject



18
19
20
21
# File 'lib/kubs_cli/cli.rb', line 18

def init
  puts "Adding .kubs to #{Dir.home}..."
  KubsCLI.create_config_dir
end

#install_dependenciesObject



36
37
38
39
# File 'lib/kubs_cli/cli.rb', line 36

def install_dependencies
  run_command { KubsCLI::Install.new.install_dependencies }
  Rake.sh('echo "Restart your shell"')
end

#install_packagesObject



42
43
44
# File 'lib/kubs_cli/cli.rb', line 42

def install_packages
  run_command { KubsCLI::Install.new.install_packages }
end

#pullObject



31
32
33
# File 'lib/kubs_cli/cli.rb', line 31

def pull
  run_command { KubsCLI::Pull.new.pull_all }
end

#versionObject



11
12
13
# File 'lib/kubs_cli/cli.rb', line 11

def version
  puts "kubs-cli version #{KubsCLI::VERSION}"
end