Class: Source::Gem::Factory
- Inherits:
-
Base::Factory
- Object
- Base::Factory
- Source::Gem::Factory
- Defined in:
- lib/gpm/source/gem.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Base::Factory
Instance Attribute Summary collapse
-
#gem_file ⇒ Object
readonly
Returns the value of attribute gem_file.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Base::Factory
Instance Method Summary collapse
- #create ⇒ Object
- #files_providers ⇒ Object
- #gemspec ⇒ Object
-
#initialize(gem_file, options = {}) ⇒ Factory
constructor
A new instance of Factory.
- #metadata ⇒ Object
Methods inherited from Base::Factory
Methods included from HasOptionMethods
Constructor Details
#initialize(gem_file, options = {}) ⇒ Factory
Returns a new instance of Factory.
57 58 59 60 |
# File 'lib/gpm/source/gem.rb', line 57 def initialize(gem_file, = {}) super(File.(File.dirname(gem_file)), ) @gem_file = gem_file end |
Instance Attribute Details
#gem_file ⇒ Object (readonly)
Returns the value of attribute gem_file.
56 57 58 |
# File 'lib/gpm/source/gem.rb', line 56 def gem_file @gem_file end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
56 57 58 |
# File 'lib/gpm/source/gem.rb', line 56 def @options end |
Instance Method Details
#create ⇒ Object
67 68 69 |
# File 'lib/gpm/source/gem.rb', line 67 def create Source::Gem.new(, files_provider, ) end |
#files_providers ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gpm/source/gem.rb', line 71 def files_providers fp = nil Dir.chdir(File.dirname(gem_file)) do if gemspec.end_with?('.gem') File.open(gem_file, 'r') do |f| fp = FilesFromGemProvider.new(f.read) end elsif gemspec.end_with?('.gemspec') fp = FilesFromDirectoryProvider.new(directory, .files+[File.basename(gem_file)]) end end super + [fp] end |
#gemspec ⇒ Object
61 62 63 |
# File 'lib/gpm/source/gem.rb', line 61 def gemspec @gem_file end |