Class: Nvvm::Cli
- Inherits:
-
Thor
show all
- Includes:
- Validator, Thor::Actions
- Defined in:
- lib/nvvm/cli.rb
Constant Summary
Constants included
from Validator
Validator::METHOD_MAP
Instance Method Summary
collapse
Methods included from Validator
git?, installed_version?, new_version?, validate_before_invoke, version?
Instance Method Details
#install(version, *conf) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/nvvm/cli.rb', line 10
def install(version, *conf)
installer = Installer.new(Version.format(version), conf)
installer.checkout
installer.make_install
Installer.cp_etc
invoke :use, [version], {} if options[:use]
installer.message
end
|
#list ⇒ Object
52
53
54
55
|
# File 'lib/nvvm/cli.rb', line 52
def list
Installer.pull
puts Version.list.join("\n")
end
|
#rebuild(version, *conf) ⇒ Object
40
41
42
43
44
|
# File 'lib/nvvm/cli.rb', line 40
def rebuild(version, *conf)
installer = Installer.new(Version.format(version), conf)
installer.make_clean
installer.make_install
end
|
#reinstall(version, *conf) ⇒ Object
34
35
36
37
|
# File 'lib/nvvm/cli.rb', line 34
def reinstall(version, *conf)
invoke :uninstall, [version]
invoke :install, [version, *conf]
end
|
#uninstall(version) ⇒ Object
63
64
65
|
# File 'lib/nvvm/cli.rb', line 63
def uninstall(version)
Uninstaller.new(Version.format(version)).uninstall
end
|
#update ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/nvvm/cli.rb', line 20
def update
Installer.pull
if (current = Version.current) == 'system'
run 'nvvm install --use latest'
run 'nvvm use system' unless $?.success?
else
run 'nvvm use system'
run 'nvvm install --use latest'
action = $?.success? ? 'uninstall' : 'use'
run "nvvm #{action} #{current}"
end
end
|
#use(version) ⇒ Object
47
48
49
|
# File 'lib/nvvm/cli.rb', line 47
def use(version)
Switcher.new(Version.format(version)).use
end
|
#versions ⇒ Object
58
59
60
|
# File 'lib/nvvm/cli.rb', line 58
def versions
puts Version.versions.join("\n")
end
|