Class: LLenv::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(args = [], options = {}, config = {}) ⇒ CLI

Returns a new instance of CLI.



7
8
9
10
11
12
13
# File 'lib/llenv/cli.rb', line 7

def initialize(args = [], options = {}, config = {})
  @root_dir     = ENV["LLENV_ROOT"] || File.expand_path("~/.llenv")
  @declare_repo = ENV["LLENV_DECLARE_URL"] || "https://github.com/riywo/llenv-declare.git"
  @env          = ENV["LLENV_ENV"] || ""
  @declare      = LLenv::Declare.new(@root_dir, @env)
  super
end

Instance Method Details

#exec(*argv) ⇒ Object



34
35
36
37
# File 'lib/llenv/cli.rb', line 34

def exec(*argv)
  check_root_dir!
  @declare.run(llenv, "exec", argv)
end

#installObject



28
29
30
31
# File 'lib/llenv/cli.rb', line 28

def install
  check_root_dir!
  @declare.run(llenv, "install")
end

#listObject



16
17
18
19
# File 'lib/llenv/cli.rb', line 16

def list
  check_root_dir!
  @declare.list
end

#updateObject



22
23
24
25
# File 'lib/llenv/cli.rb', line 22

def update
  check_root_dir!
  system("cd #{@root_dir}; git pull")
end

#vendorpathObject



40
41
42
43
# File 'lib/llenv/cli.rb', line 40

def vendorpath
  check_root_dir!
  @declare.run(llenv, "vendorpath")
end

#versionObject



47
48
49
# File 'lib/llenv/cli.rb', line 47

def version
  puts LLenv::VERSION
end