Sha256: 7640f4102ec028ae01d3ac92c2b1f0056116329ece9e19a5d99276a31b8f9d66

Contents?: true

Size: 1.83 KB

Versions: 157

Compression:

Stored size: 1.83 KB

Contents

require "commander"
require "fastlane_core"

HighLine.track_eof = false

module Scan
  class CommandsGenerator
    include Commander::Methods

    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") { FastlaneCore::Globals.verbose = true }

      command :tests do |c|
        c.syntax = "fastlane scan"
        c.description = Scan::DESCRIPTION

        FastlaneCore::CommanderGenerator.new.generate(Scan::Options.available_options, command: c)

        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 = "fastlane 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

157 entries across 157 versions & 1 rubygems

Version Path
fastlane-2.39.0.beta.20170614010012 scan/lib/scan/commands_generator.rb
fastlane-2.39.0.beta.20170613010056 scan/lib/scan/commands_generator.rb
fastlane-2.38.1 scan/lib/scan/commands_generator.rb
fastlane-2.38.0 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170612010035 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170611010050 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170610010032 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170609010035 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170608010030 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170607010024 scan/lib/scan/commands_generator.rb
fastlane-2.38.0.beta.20170606010029 scan/lib/scan/commands_generator.rb
fastlane-2.37.0 scan/lib/scan/commands_generator.rb
fastlane-2.37.0.beta.20170605010054 scan/lib/scan/commands_generator.rb
fastlane-2.37.0.beta.20170604010021 scan/lib/scan/commands_generator.rb
fastlane-2.37.0.beta.20170603010102 scan/lib/scan/commands_generator.rb
fastlane-2.37.0.beta.20170602010027 scan/lib/scan/commands_generator.rb
fastlane-2.37.0.beta.20170601010043 scan/lib/scan/commands_generator.rb
fastlane-2.36.0 scan/lib/scan/commands_generator.rb
fastlane-2.36.0.beta.20170531010050 scan/lib/scan/commands_generator.rb
fastlane-2.36.0.beta.20170530010040 scan/lib/scan/commands_generator.rb