Class: Registry::Installer

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

Direct Known Subclasses

Checkout, Download

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Action

#rake

Constructor Details

#initialize(url, name) ⇒ Installer

Returns a new instance of Installer.



38
39
40
# File 'lib/radiant/extension/script.rb', line 38

def initialize(url, name)
  self.url, self.name = url, name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



37
38
39
# File 'lib/radiant/extension/script.rb', line 37

def name
  @name
end

#pathObject

Returns the value of attribute path.



37
38
39
# File 'lib/radiant/extension/script.rb', line 37

def path
  @path
end

#urlObject

Returns the value of attribute url.



37
38
39
# File 'lib/radiant/extension/script.rb', line 37

def url
  @url
end

Instance Method Details

#copy_to_vendor_extensionsObject



48
49
50
51
# File 'lib/radiant/extension/script.rb', line 48

def copy_to_vendor_extensions
  FileUtils.cp_r(self.path, File.expand_path(File.join(RAILS_ROOT, 'vendor', 'extensions', name)))
  FileUtils.rm_r(self.path)
end

#installObject



42
43
44
45
46
# File 'lib/radiant/extension/script.rb', line 42

def install
  copy_to_vendor_extensions
  migrate
  update
end

#migrateObject



53
54
55
# File 'lib/radiant/extension/script.rb', line 53

def migrate
  rake "radiant:extensions:#{name}:migrate"
end

#updateObject



57
58
59
# File 'lib/radiant/extension/script.rb', line 57

def update
  rake "radiant:extensions:#{name}:update"
end