Class: Commands::Update
- Inherits:
-
Object
- Object
- Commands::Update
- Defined in:
- lib/commands/plugin/commands.rb
Instance Method Summary collapse
-
#initialize(base_command) ⇒ Update
constructor
A new instance of Update.
- #options ⇒ Object
- #parse!(args) ⇒ Object
Constructor Details
#initialize(base_command) ⇒ Update
Returns a new instance of Update.
461 462 463 |
# File 'lib/commands/plugin/commands.rb', line 461 def initialize(base_command) @base_command = base_command end |
Instance Method Details
#options ⇒ Object
465 466 467 468 469 470 471 472 473 474 |
# File 'lib/commands/plugin/commands.rb', line 465 def OptionParser.new do |o| o.set_summary_indent(' ') o. = "Usage: #{@base_command.script_name} update [name [name]...]" o.on( "-r REVISION", "--revision REVISION", "Checks out the given revision from subversion.", "Ignored if subversion is not used.") { |v| @revision = v } o.define_head "Update plugins." end end |
#parse!(args) ⇒ Object
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/commands/plugin/commands.rb', line 476 def parse!(args) .parse!(args) root = @base_command.environment.root cd root args = Dir["vendor/plugins/*"].map do |f| File.directory?("#{f}/.svn") ? File.basename(f) : nil end.compact if args.empty? cd "vendor/plugins" args.each do |name| if File.directory?(name) puts "Updating plugin: #{name}" system("svn #{$verbose ? '' : '-q'} up \"#{name}\" #{@revision ? "-r #{@revision}" : ''}") else puts "Plugin doesn't exist: #{name}" end end end |