Class: Relocator::CLI::Move

Inherits:
Object
  • Object
show all
Defined in:
lib/relocator/cli/move.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_class_name, dest_class_name) ⇒ Move

Returns a new instance of Move.



8
9
10
11
# File 'lib/relocator/cli/move.rb', line 8

def initialize(source_class_name, dest_class_name)
  self.source_class_name = source_class_name
  self.dest_class_name = dest_class_name
end

Class Method Details

.call(*args) ⇒ Object



4
5
6
# File 'lib/relocator/cli/move.rb', line 4

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
# File 'lib/relocator/cli/move.rb', line 13

def call
  return unless Relocator::CLI::Success.call(files)

  STDOUT.puts "mkdir -p %s".format(code_dest)
  STDOUT.puts "mkdir -p %s".format(spec_dest)
  STDOUT.puts "mv %s %s".format(code_source, code_dest)
  STDOUT.puts "mv %s %s".format(spec_source, spec_dest)
  STDOUT.puts replace_command
end