Sha256: f44865984761153d97163db16db671dfe20b772667b35650f81afe9488bb94f2

Contents?: true

Size: 1.99 KB

Versions: 14

Compression:

Stored size: 1.99 KB

Contents

require 'commander'
require 'fastlane/version'

HighLine.track_eof = false

module Screengrab
  class CommandsGenerator
    include Commander::Methods

    def self.start
      self.new.run
    end

    def run
      program :name, 'screengrab'
      program :version, Fastlane::VERSION
      program :description, 'CLI for \'screengrab\' - Automate taking localized screenshots of your Android app on emulators or real devices'
      program :help, 'Authors', 'Andrea Falcone <afalcone@twitter.com>, Michael Furtak <mfurtak@twitter.com>'
      program :help, 'Website', 'https://fastlane.tools'
      program :help, 'GitHub', 'https://github.com/fastlane/screengrab'
      program :help_formatter, :compact

      global_option('--verbose', 'Shows a more verbose output') { $verbose = true }

      always_trace!

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

      command :run do |c|
        c.syntax = 'screengrab'
        c.description = 'Take new screenshots based on the screengrabfile.'

        c.action do |args, options|
          o = options.__hash__.dup
          o.delete(:verbose)
          Screengrab.config = FastlaneCore::Configuration.create(Screengrab::Options.available_options, o)
          Screengrab.android_environment = Screengrab::AndroidEnvironment.new(Screengrab.config[:android_home],
                                                                              Screengrab.config[:build_tools_version])

          Screengrab::DependencyChecker.check(Screengrab.android_environment)
          Screengrab::Runner.new.run
        end
      end

      command :init do |c|
        c.syntax = 'screengrab init'
        c.description = "Creates a new Screengrabfile in the current directory"

        c.action do |args, options|
          require 'screengrab/setup'
          path = (Screengrab::Helper.fastlane_enabled? ? './fastlane' : '.')
          Screengrab::Setup.create(path)
        end
      end

      default_command :run

      run!
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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