Class: HW::Runner

Inherits:
Thor
  • Object
show all
Includes:
Base
Defined in:
lib/hw/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

included

Class Method Details

.start(given_args = ARGV, config = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/hw/runner.rb', line 5

def self.start(given_args = ARGV, config = {})
  unless self.is_a_reserved_task?(given_args)
    name = ARGV.first

    if Packages.reserved?(name)
      Packages.register(name, "hw/packages/#{name}")
    else
      Packages.add(name)
    end
  end

  super(given_args, config)
end

Instance Method Details

#add_source(name, source) ⇒ Object



25
26
27
# File 'lib/hw/runner.rb', line 25

def add_source name, source
  Sources.add(name, source)
end

#listObject



20
21
22
# File 'lib/hw/runner.rb', line 20

def list
  Packages.formatted_list
end

#updateObject Also known as: install



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/hw/runner.rb', line 31

def update
  header "Updating hw"
  Sources.ensure_defaults 

  if options["pull"]
    Sources.fetch
  else
    warn "Sources not updated"
    info "Remove `-p false` to update your sources"
  end
end