Class: Registry::Download

Inherits:
Installer show all
Defined in:
lib/radiant/extension/script.rb

Direct Known Subclasses

Gem, Tarball, Zip

Instance Attribute Summary

Attributes inherited from Installer

#name, #path, #url

Instance Method Summary collapse

Methods inherited from Installer

#copy_to_vendor_extensions, #migrate, #update

Methods inherited from Action

#rake

Constructor Details

#initialize(extension) ⇒ Download

Returns a new instance of Download.



103
104
105
# File 'lib/radiant/extension/script.rb', line 103

def initialize(extension)
  super(extension.download_url, extension.name)
end

Instance Method Details

#downloadObject



121
122
123
124
# File 'lib/radiant/extension/script.rb', line 121

def download
  require 'open-uri'
  File.open(File.join(Dir.tmpdir, self.filename), 'w') {|f| f.write open(self.url).read }
end

#filenameObject



117
118
119
# File 'lib/radiant/extension/script.rb', line 117

def filename
  File.basename(self.url)
end

#installObject



107
108
109
110
111
# File 'lib/radiant/extension/script.rb', line 107

def install
  download
  unpack
  super
end

#unpackObject



113
114
115
# File 'lib/radiant/extension/script.rb', line 113

def unpack
  raise "Not Implemented!"
end