Class: RailsExportRoutes::CLI
- Inherits:
-
Thor
- Object
- Thor
- RailsExportRoutes::CLI
- Defined in:
- lib/rails_export_routes/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
7 8 9 |
# File 'lib/rails_export_routes/cli.rb', line 7 def self.exit_on_failure? true # Thor must exit with status 1 on errors end |
Instance Method Details
#export(file) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rails_export_routes/cli.rb', line 15 def export(file) load_rails_app(Dir.pwd) formatter = case .fetch(:format) when 'csv' then Formatters::CSV when 'json' then Formatters::JSON when 'json-pretty' then Formatters::JSONPretty end formatter.new(wrapped_rails_routes).export_to_file(file) end |