Sha256: 1afd82560909f190dc53ada9a57b4dc62c405e05f349a4e3707ef9c65f0e5eb8

Contents?: true

Size: 1.73 KB

Versions: 8

Compression:

Stored size: 1.73 KB

Contents

#!/usr/bin/env ruby

$:.push File.expand_path("../../lib", __FILE__)

require 'snapshot'
require 'commander'
require 'snapshot/snapfile_creator'
require 'snapshot/snapshot_config'

HighLine.track_eof = false


class SnapshotApplication
  include Commander::Methods

  def run
    program :version, Snapshot::VERSION
    program :description, 'CLI for \'Snapshot\' - Automate taking localized screenshots of your iOS app on every device'
    program :help, 'Author', 'Felix Krause <snapshot@krausefx.com>'
    program :help, 'Website', 'http://fastlane.tools'
    program :help, 'GitHub', 'https://github.com/krausefx/snapshot'
    program :help_formatter, :compact

    global_option '--snapfile PATH', String, 'Custom path for your Snapfile.'
    global_option '--noclean', 'Skips the clean process of the build command when running snapshot.'
    global_option('--verbose', 'Shows all output printed by Instruments.') { $verbose = true }

    always_trace!

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

      c.action do |args, options|
        path = (Snapshot::Helper.fastlane_enabled?? './fastlane' : '.')
        Dir.chdir(path) do # switch the context
          Snapshot::SnapshotConfig.shared_instance(options.snapfile)
          Snapshot::Runner.new.work(clean: !options.noclean)
        end
      end
    end

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

      c.action do |args, options|
        path = (Snapshot::Helper.fastlane_enabled?? './fastlane' : '.')
        Snapshot::SnapfileCreator.create(path)
      end
    end

    default_command :run

    run!
  end
end

SnapshotApplication.new.run

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
snapshot-0.4.11 bin/snapshot
snapshot-0.4.10 bin/snapshot
snapshot-0.4.9 bin/snapshot
snapshot-0.4.8 bin/snapshot
snapshot-0.4.7 bin/snapshot
snapshot-0.4.6 bin/snapshot
snapshot-0.4.5 bin/snapshot
snapshot-0.4.4 bin/snapshot