Class: Registry::Installer

Inherits:
Action
  • Object
show all
Defined in:
lib/trusty_cms/extension/script.rb

Direct Known Subclasses

Checkout, Download

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Action

#file_utils, #rake, #tasks_include?

Constructor Details

#initialize(url, name) ⇒ Installer

Returns a new instance of Installer.



61
62
63
# File 'lib/trusty_cms/extension/script.rb', line 61

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



60
61
62
# File 'lib/trusty_cms/extension/script.rb', line 60

def name
  @name
end

#pathObject

Returns the value of attribute path.



60
61
62
# File 'lib/trusty_cms/extension/script.rb', line 60

def path
  @path
end

#urlObject

Returns the value of attribute url.



60
61
62
# File 'lib/trusty_cms/extension/script.rb', line 60

def url
  @url
end

Instance Method Details

#copy_to_vendor_extensionsObject



71
72
73
74
# File 'lib/trusty_cms/extension/script.rb', line 71

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

#installObject



65
66
67
68
69
# File 'lib/trusty_cms/extension/script.rb', line 65

def install
  copy_to_vendor_extensions
  migrate
  update
end

#migrateObject



76
77
78
# File 'lib/trusty_cms/extension/script.rb', line 76

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

#updateObject



80
81
82
# File 'lib/trusty_cms/extension/script.rb', line 80

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