Sha256: 7dd09b444514c9c4ab69f5be4ca4caf377b35eab4d6008db8e8b63b1ed5d602f

Contents?: true

Size: 1.78 KB

Versions: 15

Compression:

Stored size: 1.78 KB

Contents

require "commander"
require "fastlane_core"

HighLine.track_eof = false

module Scan
  class CommandsGenerator
    include Commander::Methods

    FastlaneCore::CommanderGenerator.new.generate(Scan::Options.available_options)

    def self.start
      new.run
    end

    def convert_options(options)
      o = options.__hash__.dup
      o.delete(:verbose)
      o
    end

    def run
      program :name, 'scan'
      program :version, Fastlane::VERSION
      program :description, Scan::DESCRIPTION
      program :help, "Author", "Felix Krause <scan@krausefx.com>"
      program :help, "Website", "https://fastlane.tools"
      program :help, "GitHub", "https://github.com/fastlane/fastlane/tree/master/scan"
      program :help_formatter, :compact

      global_option("--verbose") { $verbose = true }

      command :tests do |c|
        c.syntax = "scan"
        c.description = Scan::DESCRIPTION
        c.action do |_args, options|
          config = FastlaneCore::Configuration.create(Scan::Options.available_options,
                                                      convert_options(options))
          Scan::Manager.new.work(config)
        end
      end

      command :init do |c|
        c.syntax = "scan init"
        c.description = "Creates a new Scanfile for you"
        c.action do |_args, options|
          containing = (Helper.fastlane_enabled? ? 'fastlane' : '.')
          path = File.join(containing, Scan.scanfile_name)
          UI.user_error!("Scanfile already exists").yellow if File.exist?(path)
          template = File.read("#{Scan::ROOT}/lib/assets/ScanfileTemplate")
          File.write(path, template)
          UI.success("Successfully created '#{path}'. Open the file using a code editor.")
        end
      end

      default_command :tests

      run!
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fastlane-2.6.0 scan/lib/scan/commands_generator.rb
fastlane-2.5.0 scan/lib/scan/commands_generator.rb
fastlane-2.4.0 scan/lib/scan/commands_generator.rb
fastlane-2.3.1 scan/lib/scan/commands_generator.rb
fastlane-2.3.0 scan/lib/scan/commands_generator.rb
fastlane-2.2.0 scan/lib/scan/commands_generator.rb
fastlane-2.1.3 scan/lib/scan/commands_generator.rb
fastlane-2.1.2 scan/lib/scan/commands_generator.rb
fastlane-2.1.1 scan/lib/scan/commands_generator.rb
fastlane-2.1.0 scan/lib/scan/commands_generator.rb
fastlane-2.0.5 scan/lib/scan/commands_generator.rb
fastlane-2.0.4 scan/lib/scan/commands_generator.rb
fastlane-2.0.3 scan/lib/scan/commands_generator.rb
fastlane-2.0.2 scan/lib/scan/commands_generator.rb
fastlane-2.0.1 scan/lib/scan/commands_generator.rb