Class: Piston::Commands::Lock

Inherits:
Piston::Command show all
Defined in:
lib/piston/commands/lock.rb

Instance Attribute Summary

Attributes inherited from Piston::Command

#args, #dry_run, #force, #lock, #logging_stream, #quiet, #recursive, #revision, #show_updates, #verbose

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Piston::Command

#find_targets, #initialize, #skip, #svn

Constructor Details

This class inherits a constructor from Piston::Command

Class Method Details

.detailed_helpObject



21
22
23
24
25
26
27
# File 'lib/piston/commands/lock.rb', line 21

def self.detailed_help
  <<EOF
usage: lock DIR [DIR [...]]

  Locked folders will not be updated to the latest revision when updating.
EOF
end

.helpObject



17
18
19
# File 'lib/piston/commands/lock.rb', line 17

def self.help
  "Lock one or more folders to their current revision"
end

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
# File 'lib/piston/commands/lock.rb', line 7

def run
  raise Piston::CommandError, "No targets to run against" if args.empty?

  args.each do |dir|
    remote_rev = svn(:propget, Piston::REMOTE_REV, dir).chomp.to_i
    svn :propset, Piston::LOCKED, remote_rev, dir
    logging_stream.puts "'#{dir}' locked at revision #{remote_rev}"
  end
end