Methods
Attributes
[R] | name | |
[R] | uri |
Public Class methods
[ show source ]
# File railties/lib/commands/plugin.rb, line 164 164: def self.find(name) 165: name =~ /\// ? new(name) : Repositories.instance.find_plugin(name) 166: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 159 159: def initialize(uri, name=nil) 160: @uri = uri 161: guess_name(uri) 162: end
Public Instance methods
[ show source ]
# File railties/lib/commands/plugin.rb, line 176 176: def git_url? 177: @uri =~ /^git:\/\// || @uri =~ /\.git$/ 178: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 217 217: def info 218: tmp = "#{rails_env.root}/_tmp_about.yml" 219: if svn_url? 220: cmd = "svn export #{@uri} \"#{rails_env.root}/#{tmp}\"" 221: puts cmd if $verbose 222: system(cmd) 223: end 224: open(svn_url? ? tmp : File.join(@uri, 'about.yml')) do |stream| 225: stream.read 226: end rescue "No about.yml found in #{uri}" 227: ensure 228: FileUtils.rm_rf tmp if svn_url? 229: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 185 185: def install(method=nil, options = {}) 186: method ||= rails_env.best_install_method? 187: if :http == method 188: method = :export if svn_url? 189: method = :git if git_url? 190: end 191: 192: uninstall if installed? and options[:force] 193: 194: unless installed? 195: send("install_using_#{method}", options) 196: run_install_hook 197: else 198: puts "already installed: #{name} (#{uri}). pass --force to reinstall" 199: end 200: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 180 180: def installed? 181: File.directory?("#{rails_env.root}/vendor/plugins/#{name}") \ 182: or rails_env.externals.detect{ |name, repo| self.uri == repo } 183: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 172 172: def svn_url? 173: @uri =~ /svn(?:\+ssh)?:\/\/*/ 174: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 168 168: def to_s 169: "#{@name.ljust(30)}#{@uri}" 170: end
[ show source ]
# File railties/lib/commands/plugin.rb, line 202 202: def uninstall 203: path = "#{rails_env.root}/vendor/plugins/#{name}" 204: if File.directory?(path) 205: puts "Removing 'vendor/plugins/#{name}'" if $verbose 206: run_uninstall_hook 207: rm_r path 208: else 209: puts "Plugin doesn't exist: #{path}" 210: end 211: # clean up svn:externals 212: externals = rails_env.externals 213: externals.reject!{|n,u| name == n or name == u} 214: rails_env.externals = externals 215: end