Class: Commands::Install
Instance Method Summary collapse
- #determine_install_method ⇒ Object
-
#initialize(base_command) ⇒ Install
constructor
A new instance of Install.
- #options ⇒ Object
- #parse!(args) ⇒ Object
Constructor Details
#initialize(base_command) ⇒ Install
Returns a new instance of Install.
676 677 678 679 680 |
# File 'lib/commands/plugin.rb', line 676 def initialize(base_command) @base_command = base_command @method = :http @options = { :quiet => false, :revision => nil, :force => false } end |
Instance Method Details
#determine_install_method ⇒ Object
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
# File 'lib/commands/plugin.rb', line 709 def determine_install_method best = @base_command.environment.best_install_method @method = :http if best == :http and @method == :export case when (best == :http and @method != :http) msg = "Cannot install using subversion because `svn' cannot be found in your PATH" when (best == :export and (@method != :export and @method != :http)) msg = "Cannot install using #{@method} because this project is not under subversion." when (best != :externals and @method == :externals) msg = "Cannot install using externals because vendor/plugins is not under subversion." end if msg puts msg exit 1 end @method end |
#options ⇒ Object
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/commands/plugin.rb', line 682 def OptionParser.new do |o| o.set_summary_indent(' ') o. = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]" o.define_head "Install one or more plugins." o.separator "" o.separator "Options:" o.on( "-x", "--externals", "Use svn:externals to grab the plugin.", "Enables plugin updates and plugin versioning.") { |v| @method = :externals } o.on( "-o", "--checkout", "Use svn checkout to grab the plugin.", "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout } o.on( "-q", "--quiet", "Suppresses the output from installation.", "Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true } o.on( "-r REVISION", "--revision REVISION", "Checks out the given revision from subversion.", "Ignored if subversion is not used.") { |v| @options[:revision] = v } o.on( "-f", "--force", "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true } o.separator "" o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to " o.separator "a plugin repository." end end |
#parse!(args) ⇒ Object
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
# File 'lib/commands/plugin.rb', line 727 def parse!(args) .parse!(args) environment = @base_command.environment install_method = determine_install_method puts "Plugins will be installed using #{install_method}" if $verbose args.each do |name| if name =~ /\// then ::Plugin.new(name).install(install_method, @options) else plugin = Repositories.instance.find_plugin(name) unless plugin.nil? plugin.install(install_method, @options) else puts "Plugin not found: #{name}" exit 1 end end end end |