Class: Convergence::CLI
- Inherits:
-
Thor
- Object
- Thor
- Convergence::CLI
- Defined in:
- lib/convergence/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
17 18 19 |
# File 'lib/convergence/cli.rb', line 17 def self.exit_on_failure? true end |
Instance Method Details
#apply(file) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/convergence/cli.rb', line 21 def apply(file) opts = { input: file, ignore_auto_increment: [:ignore_auto_increment], safe_migration: [:safe_migration] } if [:dry_run] require 'convergence/command/dryrun' Convergence::Command::Dryrun.new(opts, config: config).execute elsif [:rollback_dry_run] require 'convergence/command/rollback_dryrun' Convergence::Command::RollbackDryrun.new(opts, config: config).execute else require 'convergence/command/apply' Convergence::Command::Apply.new(opts, config: config).execute end end |
#diff(file1, file2) ⇒ Object
40 41 42 43 44 |
# File 'lib/convergence/cli.rb', line 40 def diff(file1, file2) require 'convergence/command/diff' opts = { diff: [file1, file2] } Convergence::Command::Diff.new(opts, config: config).execute end |
#export ⇒ Object
50 51 52 53 54 |
# File 'lib/convergence/cli.rb', line 50 def export require 'convergence/command/export' opts = { dump_rails_migration: [:dump_rails_migration], filename: [:filename] } Convergence::Command::Export.new(opts, config: config).execute end |
#version ⇒ Object
57 58 59 60 |
# File 'lib/convergence/cli.rb', line 57 def version require 'convergence/version' puts "version #{Convergence::VERSION}" end |