Module: Radiant::Extension::Script::Util

Included in:
Info, Install, Uninstall
Defined in:
lib/radiant/extension/script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#extensionObject

Returns the value of attribute extension.



233
234
235
# File 'lib/radiant/extension/script.rb', line 233

def extension
  @extension
end

#extension_nameObject

Returns the value of attribute extension_name.



233
234
235
# File 'lib/radiant/extension/script.rb', line 233

def extension_name
  @extension_name
end

Instance Method Details

#extension_pathsObject



244
245
246
# File 'lib/radiant/extension/script.rb', line 244

def extension_paths
  [RAILS_ROOT, RADIANT_ROOT].uniq.map { |p| Dir["#{p}/vendor/extensions/*"] }.flatten
end

#find_extensionObject



252
253
254
# File 'lib/radiant/extension/script.rb', line 252

def find_extension
  self.extension = load_extensions.find{|e| e.name == self.extension_name }
end

#installed?Boolean

Returns:

  • (Boolean)


239
240
241
242
# File 'lib/radiant/extension/script.rb', line 239

def installed?
  path_match = Regexp.compile("#{extension_name}$")
  extension_paths.any? {|p| p =~ path_match }
end

#load_extensionsObject



248
249
250
# File 'lib/radiant/extension/script.rb', line 248

def load_extensions
  Registry::Extension.find(:all)
end

#to_extension_name(string) ⇒ Object



235
236
237
# File 'lib/radiant/extension/script.rb', line 235

def to_extension_name(string)
  string.to_s.underscore
end