Class: Dotum::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



9
10
11
12
13
14
15
# File 'lib/dotum/cli.rb', line 9

def initialize(args)
  @args = args

  @state_dir  = Dotum::Util::Path.new("~/.dotum")
  @target_dir = Dotum::Util::Path.new("~")
  @package_dir = Dotum::Util::Path.new("~/.dotum/local")
end

Class Method Details

.exec(args) ⇒ Object



5
6
7
# File 'lib/dotum/cli.rb', line 5

def self.exec(args)
  new(args).exec!
end

Instance Method Details

#exec!Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dotum/cli.rb', line 17

def exec!
  context = Dotum::Context.new(
    # :no_remote  => true,
    :state_dir  => @state_dir,
    :target_dir => @target_dir,
    :logger     => Dotum::Logger.new
  )

  unless @package_dir.directory?
    puts
    puts "#{@package_dir.pretty} doesn't exist!  Creating for now..."
    @package_dir.mkpath!
  end

  Dotum::Rules::UseRepo.exec(context, @package_dir)
  print "\n\n"
end