Returns a hash representing this plugin's metadata
# File lib/commands/plugin/plugin.rb, line 61 def about(force_refresh=false) # Look in cache first unless force_refresh if Repositories.instance.source_cache['plugins'].has_key?(name) return Repositories.instance.source_cache['plugins'][name] end end # Get from original source tmp = "#{rails_env.root}/_tmp_about.yml" if svn_url? cmd = %(svn export #{@uri}/about.yml "#{tmp}") puts cmd if $verbose system(cmd) end about_uri = svn_url? ? tmp : File.join(@uri, 'about.yml') open(about_uri) do |stream| about_hash = YAML.load(stream.read) unless about_hash.is_a?(Hash) && !about_hash['plugin'].nil? raise("#{name}'s about.yml wasn't valid YAML") end return about_hash end rescue # Make yaml on the fly for this plugin. # The 'plugin' field (uri to the resource) is the only required field. { 'plugin' => uri } ensure FileUtils.rm_rf tmp if svn_url? end
# File lib/commands/plugin/plugin.rb, line 29 def install(method=nil, options = {}) options = {:version => "bleeding_edge"}.merge(options) method ||= rails_env.best_install_method? method = :export if method == :http and svn_url? uninstall if installed? and options[:force] unless installed? send("install_using_#{method}", options) run_install_hook else puts "already installed: #{name} (#{uri}). pass --force to reinstall" end end
# File lib/commands/plugin/plugin.rb, line 24 def installed? File.directory?("#{rails_env.root}/vendor/plugins/#{name}") or rails_env.externals.detect{ |name, repo| self.uri == repo } end
# File lib/commands/plugin/plugin.rb, line 20 def svn_url? @uri =~ /svn(?:\+ssh)?:\/\/*/ end
# File lib/commands/plugin/plugin.rb, line 16 def to_s "#{@name.ljust(30)}#{@uri}" end
# File lib/commands/plugin/plugin.rb, line 45 def uninstall path = "#{rails_env.root}/vendor/plugins/#{name}" if File.directory?(path) puts "Removing 'vendor/plugins/#{name}'" if $verbose run_uninstall_hook rm_r path else puts "Plugin doesn't exist: #{path}" end # clean up svn:externals externals = rails_env.externals externals.reject!{|n,u| name == n or name == u} rails_env.externals = externals end
Generated with the Darkfish Rdoc Generator 2.