Class: R2M::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/r2m/command.rb

Overview

Adds CLI commands convert and migrate

bin/r2m convert

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/r2m/command.rb', line 17

def self.exit_on_failure?
  true
end

Instance Method Details

#convert(*paths) ⇒ Object



22
23
24
# File 'lib/r2m/command.rb', line 22

def convert(*paths)
  files(paths.flatten).each { |path| run_convert path }
end

#migrate(*paths) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/r2m/command.rb', line 34

def migrate(*paths)
  setup_rails_to_run_minitest

  files(paths.flatten).each do |path|
    say "Processing #{path}"
    migrated_path = run_migrate(path)
    run_convert(migrated_path)
  end
end