Class: FPM::Fry::Source::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/fpm/fry/source/dir.rb

Defined Under Namespace

Classes: Cache

Constant Summary collapse

REGEX =
%r!\A(?:file:|/|\.)!

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Dir

Returns a new instance of Dir.



50
51
52
53
54
55
56
57
58
# File 'lib/fpm/fry/source/dir.rb', line 50

def initialize( url, options = {} )
  @url = URI(url)
  if @url.relative?
    @url.path = File.expand_path(@url.path)
  end
  @logger = options.fetch(:logger){ Cabin::Channel.get }
  @file_map = options[:file_map]
  @to = options[:to]
end

Instance Attribute Details

#file_mapObject (readonly)

Returns the value of attribute file_map.



48
49
50
# File 'lib/fpm/fry/source/dir.rb', line 48

def file_map
  @file_map
end

#loggerObject (readonly)

Returns the value of attribute logger.



48
49
50
# File 'lib/fpm/fry/source/dir.rb', line 48

def logger
  @logger
end

#toObject (readonly)

Returns the value of attribute to.



48
49
50
# File 'lib/fpm/fry/source/dir.rb', line 48

def to
  @to
end

#urlObject (readonly)

Returns the value of attribute url.



48
49
50
# File 'lib/fpm/fry/source/dir.rb', line 48

def url
  @url
end

Class Method Details

.guess(url) ⇒ Object



17
18
19
# File 'lib/fpm/fry/source/dir.rb', line 17

def self.guess( url )
  Source::guess_regex(REGEX, url)
end

.nameObject



13
14
15
# File 'lib/fpm/fry/source/dir.rb', line 13

def self.name
  :dir
end

Instance Method Details

#build_cache(_) ⇒ Object



60
61
62
# File 'lib/fpm/fry/source/dir.rb', line 60

def build_cache(_)
  Cache.new(self, url.path)
end