Class: Source::Base::Factory
- Includes:
- HasOptionMethods
- Defined in:
- lib/gpm/source.rb
Direct Known Subclasses
Constant Summary collapse
- GLOB_REGEXP =
/(?:\(([^)]+)\))?(.*)/
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
Attributes included from HasOptionMethods
Instance Method Summary collapse
- #create ⇒ Object
- #files_provider ⇒ Object
- #files_providers ⇒ Object
-
#initialize(directory, options = {}) ⇒ Factory
constructor
A new instance of Factory.
Methods included from HasOptionMethods
Constructor Details
#initialize(directory, options = {}) ⇒ Factory
Returns a new instance of Factory.
12 13 14 15 |
# File 'lib/gpm/source.rb', line 12 def initialize(directory, = {}) @directory = directory @options = end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
10 11 12 |
# File 'lib/gpm/source.rb', line 10 def directory @directory end |
Instance Method Details
#create ⇒ Object
16 17 18 |
# File 'lib/gpm/source.rb', line 16 def create raise "Cannot instantiate source type base." end |
#files_provider ⇒ Object
19 20 21 |
# File 'lib/gpm/source.rb', line 19 def files_provider Source::CompositeFilesProvider.new(*files_providers) end |
#files_providers ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/gpm/source.rb', line 23 def files_providers base_providers = [Source::FilesFromDirectoryProvider.create_from_directory(File.join(directory, '_package_'), directory)] include_files.each do |include_files_entry| directory, glob = include_files_entry.match(GLOB_REGEXP).to_a[1..-1] directory = File.(directory || "", self.directory) base_providers << Source::FilesFromDirectoryProvider.create_from_glob(directory ,glob) end base_providers end |