Methods
Attributes
[R] | name | |
[R] | uri |
Class Public methods
Source: show
# File rails/railties/lib/commands/plugin.rb, line 153 def self.find(name) name =~ %r\// ? new(name) : Repositories.instance.find_plugin(name) end
Source: show
# File rails/railties/lib/commands/plugin.rb, line 148 def initialize(uri, name=nil) @uri = uri guess_name(uri) end
Instance Public methods
Source: show
# File rails/railties/lib/commands/plugin.rb, line 199 def info tmp = "#{rails_env.root}/_tmp_about.yml" if svn_url? cmd = "svn export #{@uri} \"#{rails_env.root}/#{tmp}\"" puts cmd if $verbose system(cmd) end open(svn_url? ? tmp : File.join(@uri, 'about.yml')) do |stream| stream.read end rescue "No about.yml found in #{uri}" ensure FileUtils.rm_rf tmp if svn_url? end
Source: show
# File rails/railties/lib/commands/plugin.rb, line 170 def install(method=nil, 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
Source: show
# File rails/railties/lib/commands/plugin.rb, line 165 def installed? File.directory?("#{rails_env.root}/vendor/plugins/#{name}") or rails_env.externals.detect{ |name, repo| self.uri == repo } end
Source: show
# File rails/railties/lib/commands/plugin.rb, line 161 def svn_url? @uri =~ %rsvn(?:\+ssh)?:\/\/*/ end
Source: show
# File rails/railties/lib/commands/plugin.rb, line 157 def to_s "#{@name.ljust(30)}#{@uri}" end
Source: show
# File rails/railties/lib/commands/plugin.rb, line 184 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