Class: Pakman::Fetch

Inherits:
Object
  • Object
show all
Includes:
LogUtils::Logging
Defined in:
lib/pakman/cli/commands/fetch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Fetch

Returns a new instance of Fetch.



9
10
11
# File 'lib/pakman/cli/commands/fetch.rb', line 9

def initialize( opts )
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



13
14
15
# File 'lib/pakman/cli/commands/fetch.rb', line 13

def opts
  @opts
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pakman/cli/commands/fetch.rb', line 15

def run
  logger.debug "fetch_uri: >#{opts.fetch_uri}<"
  src = opts.fetch_uri

  uri = URI.parse( src )
  logger.debug "scheme: >#{uri.scheme}<, host: >#{uri.host}<, port: >#{uri.port}<, path: >#{uri.path}<"

  pakname = Pakman.pakname_from_file( uri.path )
  logger.debug "pakname: >#{pakname}<"

  pakpath = File.expand_path( pakname, opts.config_path )
  logger.debug "pakpath: >#{pakpath}<"

  Fetcher.new.fetch_pak( src, pakpath )
end