Methods
Attributes
[R] environment
[R] script_name
[R] sources
Public Class methods
new()
     # File railties/lib/commands/plugin.rb, line 443
443:     def initialize
444:       @environment = RailsEnvironment.default
445:       @rails_root = RailsEnvironment.default.root
446:       @script_name = File.basename($0) 
447:       @sources = []
448:     end
parse!(args=ARGV)
     # File railties/lib/commands/plugin.rb, line 534
534:     def self.parse!(args=ARGV)
535:       Plugin.new.parse!(args)
536:     end
Public Instance methods
environment=(value)
     # File railties/lib/commands/plugin.rb, line 450
450:     def environment=(value)
451:       @environment = value
452:       RailsEnvironment.default = value
453:     end
options()
     # File railties/lib/commands/plugin.rb, line 455
455:     def options
456:       OptionParser.new do |o|
457:         o.set_summary_indent('  ')
458:         o.banner =    "Usage: #{@script_name} [OPTIONS] command"
459:         o.define_head "Rails plugin manager."
460:         
461:         o.separator ""        
462:         o.separator "GENERAL OPTIONS"
463:         
464:         o.on("-r", "--root=DIR", String,
465:              "Set an explicit rails app directory.",
466:              "Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) }
467:         o.on("-s", "--source=URL1,URL2", Array,
468:              "Use the specified plugin repositories instead of the defaults.") { |sources| @sources = sources}
469:         
470:         o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose }
471:         o.on("-h", "--help", "Show this help message.") { puts o; exit }
472:         
473:         o.separator ""
474:         o.separator "COMMANDS"
475:         
476:         o.separator "  discover   Discover plugin repositories."
477:         o.separator "  list       List available plugins."
478:         o.separator "  install    Install plugin(s) from known repositories or URLs."
479:         o.separator "  update     Update installed plugins."
480:         o.separator "  remove     Uninstall plugins."
481:         o.separator "  source     Add a plugin source repository."
482:         o.separator "  unsource   Remove a plugin repository."
483:         o.separator "  sources    List currently configured plugin repositories."
484:         
485:         o.separator ""
486:         o.separator "EXAMPLES"
487:         o.separator "  Install a plugin:"
488:         o.separator "    #{@script_name} install continuous_builder\n"
489:         o.separator "  Install a plugin from a subversion URL:"
490:         o.separator "    #{@script_name} install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder\n"
491:         o.separator "  Install a plugin from a git URL:"
492:         o.separator "    #{@script_name} install git://github.com/SomeGuy/my_awesome_plugin.git\n"
493:         o.separator "  Install a plugin and add a svn:externals entry to vendor/plugins"
494:         o.separator "    #{@script_name} install -x continuous_builder\n"
495:         o.separator "  List all available plugins:"
496:         o.separator "    #{@script_name} list\n"
497:         o.separator "  List plugins in the specified repository:"
498:         o.separator "    #{@script_name} list --source=http://dev.rubyonrails.com/svn/rails/plugins/\n"
499:         o.separator "  Discover and prompt to add new repositories:"
500:         o.separator "    #{@script_name} discover\n"
501:         o.separator "  Discover new repositories but just list them, don't add anything:"
502:         o.separator "    #{@script_name} discover -l\n"
503:         o.separator "  Add a new repository to the source list:"
504:         o.separator "    #{@script_name} source http://dev.rubyonrails.com/svn/rails/plugins/\n"
505:         o.separator "  Remove a repository from the source list:"
506:         o.separator "    #{@script_name} unsource http://dev.rubyonrails.com/svn/rails/plugins/\n"
507:         o.separator "  Show currently configured repositories:"
508:         o.separator "    #{@script_name} sources\n"        
509:       end
510:     end
parse!(args=ARGV)
     # File railties/lib/commands/plugin.rb, line 512
512:     def parse!(args=ARGV)
513:       general, sub = split_args(args)
514:       options.parse!(general)
515:       
516:       command = general.shift
517:       if command =~ /^(list|discover|install|source|unsource|sources|remove|update|info)$/
518:         command = Commands.const_get(command.capitalize).new(self)
519:         command.parse!(sub)
520:       else
521:         puts "Unknown command: #{command}"
522:         puts options
523:         exit 1
524:       end
525:     end
split_args(args)
     # File railties/lib/commands/plugin.rb, line 527
527:     def split_args(args)
528:       left = []
529:       left << args.shift while args[0] and args[0] =~ /^-/
530:       left << args.shift if args[0]
531:       return [left, args]
532:     end