Sha256: 6774744ca6e8a03c35d82a5c5a8f38750f5abdad9c6d9f0d94f387cedfd640a9

Contents?: true

Size: 1.89 KB

Versions: 14

Compression:

Stored size: 1.89 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
      FastlaneCore::UpdateChecker.start_looking_for_update("scan")
      new.run
    ensure
      FastlaneCore::UpdateChecker.show_update_status("scan", Scan::VERSION)
    end

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

    def run
      program :version, Scan::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/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)
          raise "Scanfile already exists".yellow if File.exist?(path)
          template = File.read("#{Helper.gem_path('scan')}/lib/assets/ScanfileTemplate")
          File.write(path, template)
          Helper.log.info "Successfully created '#{path}'. Open the file using a code editor.".green
        end
      end

      default_command :tests

      run!
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
scan-0.5.2 lib/scan/commands_generator.rb
scan-0.5.1 lib/scan/commands_generator.rb
scan-0.5.0 lib/scan/commands_generator.rb
scan-0.4.2 lib/scan/commands_generator.rb
scan-0.4.1 lib/scan/commands_generator.rb
scan-0.3.3 lib/scan/commands_generator.rb
scan-0.3.2 lib/scan/commands_generator.rb
scan-0.3.1 lib/scan/commands_generator.rb
scan-0.3.0 lib/scan/commands_generator.rb
scan-0.2.1 lib/scan/commands_generator.rb
scan-0.2.0 lib/scan/commands_generator.rb
scan-0.1.2 lib/scan/commands_generator.rb
scan-0.1.1 lib/scan/commands_generator.rb
scan-0.1.0 lib/scan/commands_generator.rb