Class: Source::Gem::Factory
Constant Summary
Base::Factory::GLOB_REGEXP
Instance Attribute Summary collapse
#directory
Instance Method Summary
collapse
#files_provider
included
Constructor Details
#initialize(gem_file, options = {}) ⇒ Factory
57
58
59
60
|
# File 'lib/gpm/source/gem.rb', line 57
def initialize(gem_file, options = {})
super(File.expand_path(File.dirname(gem_file)), options)
@gem_file = gem_file
end
|
Instance Attribute Details
Returns the value of attribute gem_file.
56
57
58
|
# File 'lib/gpm/source/gem.rb', line 56
def gem_file
@gem_file
end
|
Returns the value of attribute options.
56
57
58
|
# File 'lib/gpm/source/gem.rb', line 56
def options
@options
end
|
Instance Method Details
67
68
69
|
# File 'lib/gpm/source/gem.rb', line 67
def create
Source::Gem.new(metadata, files_provider, options)
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, metadata.files+[File.basename(gem_file)])
end
end
super + [fp]
end
|
61
62
63
|
# File 'lib/gpm/source/gem.rb', line 61
def gemspec
@gem_file
end
|