Class Commands::Install
In: vendor/rails/railties/lib/commands/plugin.rb
Parent: Object

Methods

Public Class methods

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 710
710:     def initialize(base_command)
711:       @base_command = base_command
712:       @method = :http
713:       @options = { :quiet => false, :revision => nil, :force => false }
714:     end

Public Instance methods

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 743
743:     def determine_install_method
744:       best = @base_command.environment.best_install_method
745:       @method = :http if best == :http and @method == :export
746:       case
747:       when (best == :http and @method != :http)
748:         msg = "Cannot install using subversion because `svn' cannot be found in your PATH"
749:       when (best == :export and (@method != :export and @method != :http))
750:         msg = "Cannot install using #{@method} because this project is not under subversion."
751:       when (best != :externals and @method == :externals)
752:         msg = "Cannot install using externals because vendor/plugins is not under subversion."
753:       end
754:       if msg
755:         puts msg
756:         exit 1
757:       end
758:       @method
759:     end

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 716
716:     def options
717:       OptionParser.new do |o|
718:         o.set_summary_indent('  ')
719:         o.banner =    "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]"
720:         o.define_head "Install one or more plugins."
721:         o.separator   ""
722:         o.separator   "Options:"
723:         o.on(         "-x", "--externals", 
724:                       "Use svn:externals to grab the plugin.", 
725:                       "Enables plugin updates and plugin versioning.") { |v| @method = :externals }
726:         o.on(         "-o", "--checkout",
727:                       "Use svn checkout to grab the plugin.",
728:                       "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
729:         o.on(         "-q", "--quiet",
730:                       "Suppresses the output from installation.",
731:                       "Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
732:         o.on(         "-r REVISION", "--revision REVISION",
733:                       "Checks out the given revision from subversion.",
734:                       "Ignored if subversion is not used.") { |v| @options[:revision] = v }
735:         o.on(         "-f", "--force",
736:                       "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
737:         o.separator   ""
738:         o.separator   "You can specify plugin names as given in 'plugin list' output or absolute URLs to "
739:         o.separator   "a plugin repository."
740:       end
741:     end

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 761
761:     def parse!(args)
762:       options.parse!(args)
763:       environment = @base_command.environment
764:       install_method = determine_install_method
765:       puts "Plugins will be installed using #{install_method}" if $verbose
766:       args.each do |name|
767:         ::Plugin.find(name).install(install_method, @options)
768:       end
769:     rescue StandardError => e
770:       puts "Plugin not found: #{args.inspect}"
771:       puts e.inspect if $verbose
772:       exit 1
773:     end

[Validate]