Class: Gem::Micro::BareSpecification
- Inherits:
-
Object
- Object
- Gem::Micro::BareSpecification
- Includes:
- Utils
- Defined in:
- lib/microgem/bare_specification.rb
Instance Method Summary collapse
-
#gem_spec ⇒ Object
Retrieves the gem spec from gem_spec_url and loads the marshalled data.
-
#gem_spec_url ⇒ Object
Returns the url from where the gemspec should be downloaded.
-
#gem_spec_work_archive_file ⇒ Object
Returns the full path to the archive containing the gemspec file in the temporary work directory.
-
#gem_spec_work_file ⇒ Object
Returns the full path to the gemspec file in the temporary work directory.
-
#initialize(source, name, version) ⇒ BareSpecification
constructor
A new instance of BareSpecification.
Methods included from Utils
#config, #ensure_dir, #log, #replace, #tmpdir
Constructor Details
#initialize(source, name, version) ⇒ BareSpecification
Returns a new instance of BareSpecification.
6 7 8 |
# File 'lib/microgem/bare_specification.rb', line 6 def initialize(source, name, version) @source, @name, @version = source, name, version end |
Instance Method Details
#gem_spec ⇒ Object
Retrieves the gem spec from gem_spec_url and loads the marshalled data.
The returned Gem::Specification instance knows to which Gem::Micro::Source it belongs.
31 32 33 34 35 36 37 |
# File 'lib/microgem/bare_specification.rb', line 31 def gem_spec Downloader.get(gem_spec_url, gem_spec_work_archive_file) Unpacker.inflate(gem_spec_work_archive_file, gem_spec_work_file) gem_spec = Marshal.load(File.read(gem_spec_work_file)) gem_spec.source = @source gem_spec end |
#gem_spec_url ⇒ Object
Returns the url from where the gemspec should be downloaded.
11 12 13 |
# File 'lib/microgem/bare_specification.rb', line 11 def gem_spec_url "http://#{@source.host}/quick/Marshal.4.8/#{@name}-#{@version}.gemspec.rz" end |
#gem_spec_work_archive_file ⇒ Object
Returns the full path to the archive containing the gemspec file in the temporary work directory.
23 24 25 |
# File 'lib/microgem/bare_specification.rb', line 23 def gem_spec_work_archive_file "#{gem_spec_work_file}.rz" end |
#gem_spec_work_file ⇒ Object
Returns the full path to the gemspec file in the temporary work directory.
17 18 19 |
# File 'lib/microgem/bare_specification.rb', line 17 def gem_spec_work_file File.join(tmpdir, "#{@name}-#{@version}.gemspec") end |