Class: RailsLens::CLI
- Inherits:
-
Thor
- Object
- Thor
- RailsLens::CLI
- Includes:
- CLIErrorHandler
- Defined in:
- lib/rails_lens/cli.rb
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Thor configuration: exit with proper status codes on failure (modern behavior).
Instance Method Summary collapse
- #annotate ⇒ Object
- #check ⇒ Object
- #config(subcommand = 'show') ⇒ Object
- #erd ⇒ Object
- #install ⇒ Object
- #lint ⇒ Object
- #remove ⇒ Object
- #version ⇒ Object
Methods included from CLIErrorHandler
Class Method Details
.exit_on_failure? ⇒ Boolean
Thor configuration: exit with proper status codes on failure (modern behavior)
12 13 14 |
# File 'lib/rails_lens/cli.rb', line 12 def self.exit_on_failure? true end |
Instance Method Details
#annotate ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rails_lens/cli.rb', line 29 def annotate with_error_handling do setup_environment results = {} commands = Commands.new(self) # Annotate models (default behavior or when --all is specified) results[:models] = commands.annotate_models() if target_models? # Annotate routes results[:routes] = commands.annotate_routes() if target_routes? # Annotate mailers results[:mailers] = commands.annotate_mailers() if target_mailers? results end end |
#check ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/rails_lens/cli.rb', line 107 def check with_error_handling do setup_environment commands = Commands.new(self) commands.check() end end |
#config(subcommand = 'show') ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/rails_lens/cli.rb', line 119 def config(subcommand = 'show') with_error_handling do setup_environment commands = Commands.new(self) commands.config(subcommand, ) end end |
#erd ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/rails_lens/cli.rb', line 77 def erd with_error_handling do setup_environment # Transform CLI options to visualizer options = .dup [:output_dir] = [:output] if [:output] commands = Commands.new(self) commands.generate_erd() end end |
#install ⇒ Object
130 131 132 133 134 135 |
# File 'lib/rails_lens/cli.rb', line 130 def install with_error_handling do commands = Commands.new(self) commands.install() end end |
#lint ⇒ Object
97 98 99 100 101 102 103 104 |
# File 'lib/rails_lens/cli.rb', line 97 def lint with_error_handling do setup_environment commands = Commands.new(self) commands.lint() end end |
#remove ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rails_lens/cli.rb', line 53 def remove with_error_handling do setup_environment results = {} commands = Commands.new(self) # Remove model annotations (default behavior or when --all is specified) results[:models] = commands.remove_models() if target_models? # Remove route annotations results[:routes] = commands.remove_routes() if target_routes? # Remove mailer annotations results[:mailers] = commands.remove_mailers() if target_mailers? results end end |