lib/tapioca/cli.rb in tapioca-0.9.4 vs lib/tapioca/cli.rb in tapioca-0.10.0

- old
+ new

@@ -103,48 +103,48 @@ desc: "Suppresses file creation output", default: false option :workers, aliases: ["-w"], type: :numeric, - desc: "EXPERIMENTAL: Number of parallel workers to use when generating RBIs", - default: 1 + desc: "Number of parallel workers to use when generating RBIs (default: auto)" option :rbi_max_line_length, type: :numeric, desc: "Set the max line length of generated RBIs. Signatures longer than the max line length will be wrapped", default: DEFAULT_RBI_MAX_LINE_LENGTH option :environment, aliases: ["-e"], type: :string, desc: "The Rack/Rails environment to use when generating RBIs", default: DEFAULT_ENVIRONMENT + option :list_compilers, + aliases: ["-l"], + type: :boolean, + desc: "List all loaded compilers", + default: false def dsl(*constants) set_environment(options) command = Commands::Dsl.new( requested_constants: constants, outpath: Pathname.new(options[:outdir]), only: options[:only], exclude: options[:exclude], file_header: options[:file_header], - compiler_path: Tapioca::Dsl::Compilers::DIRECTORY, tapioca_path: TAPIOCA_DIR, should_verify: options[:verify], quiet: options[:quiet], verbose: options[:verbose], number_of_workers: options[:workers], rbi_formatter: rbi_formatter(options) ) - if options[:workers] != 1 - say( - "Using more than one worker is experimental and might produce results that are not deterministic", - :red - ) - end - Tapioca.silence_warnings do - command.execute + if options[:list_compilers] + command.list_compilers + else + command.execute + end end end desc "gem [gem...]", "generate RBIs from gems" option :outdir, @@ -199,12 +199,11 @@ desc: "Include RBIs found in the `rbi/` directory of the gem", default: true option :workers, aliases: ["-w"], type: :numeric, - desc: "EXPERIMENTAL: Number of parallel workers to use when generating RBIs", - default: 1 + desc: "Number of parallel workers to use when generating RBIs (default: auto)" option :auto_strictness, type: :boolean, desc: "Autocorrect strictness in gem RBIs in case of conflict with the DSL RBIs", default: true option :dsl_dir, @@ -250,17 +249,10 @@ unless gems.empty? raise MalformattedArgumentError, "Option '--all' must be provided without any other arguments" if all raise MalformattedArgumentError, "Option '--verify' must be provided without any other arguments" if verify end - if options[:workers] != 1 - say( - "Using more than one worker is experimental and might produce results that are not deterministic", - :red - ) - end - if gems.empty? && !all command.sync(should_verify: verify, exclude: options[:exclude]) else command.execute end @@ -273,11 +265,11 @@ option :dsl_rbi_dir, type: :string, desc: "Path to DSL RBIs", default: DEFAULT_DSL_DIR option :shim_rbi_dir, type: :string, desc: "Path to shim RBIs", default: DEFAULT_SHIM_DIR option :annotations_rbi_dir, type: :string, desc: "Path to annotations RBIs", default: DEFAULT_ANNOTATIONS_DIR option :todo_rbi_file, type: :string, desc: "Path to the generated todo RBI file", default: DEFAULT_TODO_FILE option :payload, type: :boolean, desc: "Check shims against Sorbet's payload", default: true - option :workers, aliases: ["-w"], type: :numeric, desc: "EXPERIMENTAL: Number of parallel workers", default: 1 + option :workers, aliases: ["-w"], type: :numeric, desc: "Number of parallel workers (default: auto)" def check_shims Tapioca.disable_traces command = Commands::CheckShims.new( gem_rbi_dir: options[:gem_rbi_dir], @@ -323,11 +315,13 @@ def __print_version puts "Tapioca v#{Tapioca::VERSION}" end no_commands do - def self.exit_on_failure? - true + class << self + def exit_on_failure? + true + end end end private