Sha256: 5560e60ecf0e0931120f55bda8cab898ee79c09cabb17406cb2a097f1274e99d

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Jets
  module Command
    class ApplicationCommand < Base # :nodoc:
      hide_command!

      self.bin = "jets" if respond_to?(:bin=) # Rails 7.1

      def help
        perform # Punt help output to the generator.
      end

      # This is:
      #
      #   bundle exec jets application:help => jets new --help
      #   bundle exec jets application      => jets new --help
      #
      def perform(*args)
        # require lazily so that Rails constant is only defined within generators
        require "jets/generators/overrides/app/app_generator"
        override_exit_on_failure?
        argv = Rails::Generators::ARGVScrubber.new(args).prepare!
        Jets::Generators::AppGenerator.start argv
      end

    private
      # We override this way because Jets require generators lazily
      def override_exit_on_failure?
        Jets::Generators::AppGenerator.class_eval do
          # We want to exit on failure to be kind to other libraries
          # This is only when accessing via CLI
          def self.exit_on_failure?
            true
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jets-5.0.8 lib/jets/commands/application/application_command.rb
jets-5.0.7 lib/jets/commands/application/application_command.rb
jets-5.0.6 lib/jets/commands/application/application_command.rb
jets-5.0.5 lib/jets/commands/application/application_command.rb
jets-5.0.4 lib/jets/commands/application/application_command.rb
jets-5.0.3 lib/jets/commands/application/application_command.rb
jets-5.0.2 lib/jets/commands/application/application_command.rb
jets-5.0.1 lib/jets/commands/application/application_command.rb
jets-5.0.0 lib/jets/commands/application/application_command.rb
jets-5.0.0.beta1 lib/jets/commands/application/application_command.rb