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

#file_utils, #rake, #tasks_include?

Constructor Details

#initialize(extension) ⇒ Download

Returns a new instance of Download.



126
127
128
# File 'lib/radiant/extension/script.rb', line 126

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

Instance Method Details

#downloadObject



144
145
146
147
# File 'lib/radiant/extension/script.rb', line 144

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

#filenameObject



140
141
142
# File 'lib/radiant/extension/script.rb', line 140

def filename
  File.basename(self.url)
end

#installObject



130
131
132
133
134
# File 'lib/radiant/extension/script.rb', line 130

def install
  download
  unpack
  super
end

#unpackObject



136
137
138
# File 'lib/radiant/extension/script.rb', line 136

def unpack
  raise "Not Implemented!"
end