Class: Registry::Action

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

Direct Known Subclasses

Installer, Uninstaller

Instance Method Summary collapse

Instance Method Details

#file_utilsObject



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

def file_utils
  FileUtils
end

#rake(command) ⇒ Object



33
34
35
# File 'lib/radiant/extension/script.rb', line 33

def rake(command)
  `rake #{command} RAILS_ENV=#{RAILS_ENV}` if tasks_include? command
end

#tasks_include?(command) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/radiant/extension/script.rb', line 37

def tasks_include?(command)
  extension = command.split('radiant:extensions:')
  if extension.length > 1
    extension = extension.reject{|e| e.blank? }[0]
  else
    extension = extension.to_s
  end
  rake_file = File.join(RAILS_ROOT, 'vendor', 'extensions', extension) + '/lib/tasks/' + extension + '_extension_tasks.rake'
  if File.exist? rake_file
    load rake_file
  end
  tasks = Rake.application.tasks.map(&:name)
  tasks.include? "#{command}"
end