Sha256: c2af58a95585aa0fe6d687afb218b49110f0925a455b10af6d2fde08c7a2d01c

Contents?: true

Size: 1.83 KB

Versions: 227

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 = FastlaneCore::Helper.fastlane_enabled_folder_path
          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

227 entries across 227 versions & 1 rubygems

Version Path
fastlane-2.69.0.beta.20171212010004 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171211010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171210010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171209010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171208010004 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171207010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171206010003 scan/lib/scan/commands_generator.rb
fastlane-2.68.2 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171205010003 scan/lib/scan/commands_generator.rb
fastlane-2.68.1 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171204010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171203010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171202010003 scan/lib/scan/commands_generator.rb
fastlane-2.69.0.beta.20171201010003 scan/lib/scan/commands_generator.rb
fastlane-2.68.0 scan/lib/scan/commands_generator.rb
fastlane-2.68.0.beta.20171130010004 scan/lib/scan/commands_generator.rb
fastlane-2.68.0.beta.20171129010003 scan/lib/scan/commands_generator.rb
fastlane-2.67.0 scan/lib/scan/commands_generator.rb
fastlane-2.67.0.beta.20171128010003 scan/lib/scan/commands_generator.rb
fastlane-2.67.0.beta.20171127010003 scan/lib/scan/commands_generator.rb