Class | Commands::Install |
In: |
vendor/rails/railties/lib/commands/plugin.rb
|
Parent: | Object |
# File vendor/rails/railties/lib/commands/plugin.rb, line 734 734: def initialize(base_command) 735: @base_command = base_command 736: @method = :http 737: @options = { :quiet => false, :revision => nil, :force => false } 738: end
# File vendor/rails/railties/lib/commands/plugin.rb, line 770 770: def determine_install_method 771: best = @base_command.environment.best_install_method 772: @method = :http if best == :http and @method == :export 773: case 774: when (best == :http and @method != :http) 775: msg = "Cannot install using subversion because `svn' cannot be found in your PATH" 776: when (best == :export and (@method != :export and @method != :http)) 777: msg = "Cannot install using #{@method} because this project is not under subversion." 778: when (best != :externals and @method == :externals) 779: msg = "Cannot install using externals because vendor/plugins is not under subversion." 780: end 781: if msg 782: puts msg 783: exit 1 784: end 785: @method 786: end
# File vendor/rails/railties/lib/commands/plugin.rb, line 740 740: def options 741: OptionParser.new do |o| 742: o.set_summary_indent(' ') 743: o.banner = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]" 744: o.define_head "Install one or more plugins." 745: o.separator "" 746: o.separator "Options:" 747: o.on( "-x", "--externals", 748: "Use svn:externals to grab the plugin.", 749: "Enables plugin updates and plugin versioning.") { |v| @method = :externals } 750: o.on( "-o", "--checkout", 751: "Use svn checkout to grab the plugin.", 752: "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout } 753: o.on( "-e", "--export", 754: "Use svn export to grab the plugin.", 755: "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 } 756: o.on( "-q", "--quiet", 757: "Suppresses the output from installation.", 758: "Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true } 759: o.on( "-r REVISION", "--revision REVISION", 760: "Checks out the given revision from subversion.", 761: "Ignored if subversion is not used.") { |v| @options[:revision] = v } 762: o.on( "-f", "--force", 763: "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true } 764: o.separator "" 765: o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to " 766: o.separator "a plugin repository." 767: end 768: end
# File vendor/rails/railties/lib/commands/plugin.rb, line 788 788: def parse!(args) 789: options.parse!(args) 790: environment = @base_command.environment 791: install_method = determine_install_method 792: puts "Plugins will be installed using #{install_method}" if $verbose 793: args.each do |name| 794: ::Plugin.find(name).install(install_method, @options) 795: end 796: rescue StandardError => e 797: puts "Plugin not found: #{args.inspect}" 798: puts e.inspect if $verbose 799: exit 1 800: end