Class: Piston::Commands::Convert
- Defined in:
- lib/piston/commands/convert.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
Methods inherited from Base
#force, #guess_wc, #initialize, logger, #logger, #quiet, #verbose, #working_copy!
Constructor Details
This class inherits a constructor from Piston::Commands::Base
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/piston/commands/convert.rb', line 6 def @options end |
Instance Method Details
#run(targets) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/piston/commands/convert.rb', line 8 def run(targets) targets = Array.new unless targets wc = Piston::Svn::WorkingCopy.new(Dir.pwd) importer = Piston::Commands::Import.new() returning(Array.new) do |conversions| wc.externals.each_pair do |dir, args| next unless targets.empty? || targets.detect {|target| dir.to_s.include?(target.to_s) } conversions << dir logger.info "Importing #{dir.relative_path_from(wc.path)} from #{args[:url]}" importer.run(args[:url], args[:revision], dir) end wc.remove_external_references(*targets) end end |
#start(*args) ⇒ Object
25 26 27 28 29 |
# File 'lib/piston/commands/convert.rb', line 25 def start(*args) targets = args.flatten.map {|d| Pathname.new(d).} run(targets) puts "#{targets.length} directories converted" end |