Class: Rails::Diff::CLI
- Inherits:
-
Thor
- Object
- Thor
- Rails::Diff::CLI
- Defined in:
- lib/rails/diff/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #__version ⇒ Object
- #dotfiles ⇒ Object
- #file(*files) ⇒ Object
- #generated(generator_name, *args) ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
12 |
# File 'lib/rails/diff/cli.rb', line 12 def self.exit_on_failure? = true |
Instance Method Details
#__version ⇒ Object
58 59 60 |
# File 'lib/rails/diff/cli.rb', line 58 def __version puts VERSION end |
#dotfiles ⇒ Object
31 32 33 34 35 |
# File 'lib/rails/diff/cli.rb', line 31 def dotfiles dotfiles = `git ls-files --cached --others --exclude-standard -- '.*'`.split("\n") file(*dotfiles) end |
#file(*files) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rails/diff/cli.rb', line 15 def file(*files) abort "Please provide at least one file to compare" if files.empty? ENV["DEBUG"] = "true" if [:debug] diff = Rails::Diff.file( *files, no_cache: [:no_cache], commit: [:commit], new_app_options: [:new_app_options] ) return if diff.empty? [:fail_on_diff] ? abort(diff) : puts(diff) end |
#generated(generator_name, *args) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rails/diff/cli.rb', line 40 def generated(generator_name, *args) ENV["DEBUG"] = "true" if [:debug] diff = Rails::Diff.generated( generator_name, *args, no_cache: [:no_cache], skip: [:skip], only: [:only], commit: [:commit], new_app_options: [:new_app_options] ) return if diff.empty? [:fail_on_diff] ? abort(diff) : puts(diff) end |