Class: HW::Runner

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

Constant Summary

Constants inherited from HW

CONFIG_PATH, DEFAULT_SOURCE, DIRECTORY, MAJOR, MINOR, PRE, RESERVED_WORDS, SOURCES_PATH, TINY, VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

included

Class Method Details

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



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

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



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

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

#listObject



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

def list
  Packages.formatted_list
end

#updateObject Also known as: install



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

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