Methods
- D
- N
- O
- P
Class Public methods
Instance Public methods
# File railties/lib/rails/commands/plugin.rb, line 389 389: def determine_install_method 390: best = @base_command.environment.best_install_method 391: @method = :http if best == :http and @method == :export 392: case 393: when (best == :http and @method != :http) 394: msg = "Cannot install using subversion because `svn' cannot be found in your PATH" 395: when (best == :export and (@method != :export and @method != :http)) 396: msg = "Cannot install using #{@method} because this project is not under subversion." 397: when (best != :externals and @method == :externals) 398: msg = "Cannot install using externals because vendor/plugins is not under subversion." 399: end 400: if msg 401: puts msg 402: exit 1 403: end 404: @method 405: end
# File railties/lib/rails/commands/plugin.rb, line 359 359: def options 360: OptionParser.new do |o| 361: o.set_summary_indent(' ') 362: o.banner = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]" 363: o.define_head "Install one or more plugins." 364: o.separator "" 365: o.separator "Options:" 366: o.on( "-x", "--externals", 367: "Use svn:externals to grab the plugin.", 368: "Enables plugin updates and plugin versioning.") { |v| @method = :externals } 369: o.on( "-o", "--checkout", 370: "Use svn checkout to grab the plugin.", 371: "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout } 372: o.on( "-e", "--export", 373: "Use svn export to grab the plugin.", 374: "Exports the plugin, allowing you to check it into your local repository. Does not enable updates or add an svn:externals entry.") { |v| @method = :export } 375: o.on( "-q", "--quiet", 376: "Suppresses the output from installation.", 377: "Ignored if -v is passed (rails plugin -v install ...)") { |v| @options[:quiet] = true } 378: o.on( "-r REVISION", "--revision REVISION", 379: "Checks out the given revision from subversion or git.", 380: "Ignored if subversion/git is not used.") { |v| @options[:revision] = v } 381: o.on( "-f", "--force", 382: "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true } 383: o.separator "" 384: o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to " 385: o.separator "a plugin repository." 386: end 387: end
# File railties/lib/rails/commands/plugin.rb, line 407 407: def parse!(args) 408: options.parse!(args) 409: if args.blank? 410: puts options 411: exit 1 412: end 413: environment = @base_command.environment 414: install_method = determine_install_method 415: puts "Plugins will be installed using #{install_method}" if $verbose 416: args.each do |name| 417: ::Plugin.find(name).install(install_method, @options) 418: end 419: rescue StandardError => e 420: puts "Plugin not found: #{args.inspect}" 421: puts e.inspect if $verbose 422: exit 1 423: end