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 751
751:     def initialize(base_command)
752:       @base_command = base_command
753:       @method = :http
754:       @options = { :quiet => false, :revision => nil, :force => false }
755:     end

Public Instance methods

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 787
787:     def determine_install_method
788:       best = @base_command.environment.best_install_method
789:       @method = :http if best == :http and @method == :export
790:       case
791:       when (best == :http and @method != :http)
792:         msg = "Cannot install using subversion because `svn' cannot be found in your PATH"
793:       when (best == :export and (@method != :export and @method != :http))
794:         msg = "Cannot install using #{@method} because this project is not under subversion."
795:       when (best != :externals and @method == :externals)
796:         msg = "Cannot install using externals because vendor/plugins is not under subversion."
797:       end
798:       if msg
799:         puts msg
800:         exit 1
801:       end
802:       @method
803:     end

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 757
757:     def options
758:       OptionParser.new do |o|
759:         o.set_summary_indent('  ')
760:         o.banner =    "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]"
761:         o.define_head "Install one or more plugins."
762:         o.separator   ""
763:         o.separator   "Options:"
764:         o.on(         "-x", "--externals", 
765:                       "Use svn:externals to grab the plugin.", 
766:                       "Enables plugin updates and plugin versioning.") { |v| @method = :externals }
767:         o.on(         "-o", "--checkout",
768:                       "Use svn checkout to grab the plugin.",
769:                       "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
770:         o.on(         "-e", "--export",
771:                       "Use svn export to grab the plugin.",
772:                       "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 }
773:         o.on(         "-q", "--quiet",
774:                       "Suppresses the output from installation.",
775:                       "Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
776:         o.on(         "-r REVISION", "--revision REVISION",
777:                       "Checks out the given revision from subversion or git.",
778:                       "Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
779:         o.on(         "-f", "--force",
780:                       "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
781:         o.separator   ""
782:         o.separator   "You can specify plugin names as given in 'plugin list' output or absolute URLs to "
783:         o.separator   "a plugin repository."
784:       end
785:     end

[Source]

     # File vendor/rails/railties/lib/commands/plugin.rb, line 805
805:     def parse!(args)
806:       options.parse!(args)
807:       environment = @base_command.environment
808:       install_method = determine_install_method
809:       puts "Plugins will be installed using #{install_method}" if $verbose
810:       args.each do |name|
811:         ::Plugin.find(name).install(install_method, @options)
812:       end
813:     rescue StandardError => e
814:       puts "Plugin not found: #{args.inspect}"
815:       puts e.inspect if $verbose
816:       exit 1
817:     end

[Validate]