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.



270
271
272
# File 'lib/radiant/extension/script.rb', line 270

def extension
  @extension
end

#extension_nameObject

Returns the value of attribute extension_name.



270
271
272
# File 'lib/radiant/extension/script.rb', line 270

def extension_name
  @extension_name
end

Instance Method Details

#extension_pathsObject



285
286
287
# File 'lib/radiant/extension/script.rb', line 285

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

#find_extensionObject



293
294
295
# File 'lib/radiant/extension/script.rb', line 293

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

#installed?Boolean

Returns:

  • (Boolean)


276
277
278
279
# File 'lib/radiant/extension/script.rb', line 276

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

#load_extensionsObject



289
290
291
# File 'lib/radiant/extension/script.rb', line 289

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

#registered?Boolean

Returns:

  • (Boolean)


281
282
283
# File 'lib/radiant/extension/script.rb', line 281

def registered?
  self.extension
end

#to_extension_name(string) ⇒ Object



272
273
274
# File 'lib/radiant/extension/script.rb', line 272

def to_extension_name(string)
  string.to_s.underscore
end