Sha256: a15968376838081f8bc76da78785c451a3188dfa003797deb378563dbb1b6d51

Contents?: true

Size: 1.53 KB

Versions: 171

Compression:

Stored size: 1.53 KB

Contents

module Snapshot
  class Setup
    # This method will take care of creating a Snapfile and other necessary files
    def self.create(path)
      snapfile_path = File.join(path, 'Snapfile')

      if File.exist?(snapfile_path)
        UI.user_error!("Snapfile already exists at path '#{snapfile_path}'. Run 'snapshot' to use snapshot.")
      end

      File.write(snapfile_path, File.read("#{Snapshot::ROOT}/lib/assets/SnapfileTemplate"))
      File.write(File.join(path, 'SnapshotHelper.swift'), File.read("#{Snapshot::ROOT}/lib/assets/SnapshotHelper.swift"))

      puts "✅  Successfully created SnapshotHelper.swift '#{File.join(path, 'SnapshotHelper.swift')}'".green
      puts "✅  Successfully created new Snapfile at '#{snapfile_path}'".green

      puts "-------------------------------------------------------".yellow
      puts "Open your Xcode project and make sure to do the following:".yellow
      puts "1) Add a new UI Test target to your project".yellow
      puts "2) Add the ./fastlane/SnapshotHelper.swift to your UI Test target".yellow
      puts "   You can move the file anywhere you want".yellow
      puts "3) Call `setupSnapshot(app)` when launching your app".yellow
      puts ""
      puts "  let app = XCUIApplication()"
      puts "  setupSnapshot(app)"
      puts "  app.launch()"
      puts ""
      puts "4) Add `snapshot(\"0Launch\")` to wherever you want to create the screenshots".yellow
      puts ""
      puts "More information on GitHub: https://github.com/fastlane/fastlane/tree/master/snapshot".green
    end
  end
end

Version data entries

171 entries across 171 versions & 1 rubygems

Version Path
fastlane-2.46.0.beta.20170706133602 snapshot/lib/snapshot/setup.rb
fastlane-2.46.0.beta.20170706133502 snapshot/lib/snapshot/setup.rb
fastlane-2.46.0.beta.20170706133402 snapshot/lib/snapshot/setup.rb
fastlane-2.45.0 snapshot/lib/snapshot/setup.rb
fastlane-2.45.0.beta.20170706010014 snapshot/lib/snapshot/setup.rb
fastlane-2.44.1 snapshot/lib/snapshot/setup.rb
fastlane-2.44.0 snapshot/lib/snapshot/setup.rb
fastlane-2.44.0.beta.20170630010021 snapshot/lib/snapshot/setup.rb
fastlane-2.43.0 snapshot/lib/snapshot/setup.rb
fastlane-2.43.0.beta.20170629010015 snapshot/lib/snapshot/setup.rb
fastlane-2.42.0 snapshot/lib/snapshot/setup.rb
fastlane-2.42.0.beta.20170628010031 snapshot/lib/snapshot/setup.rb
fastlane-2.42.0.beta.20170627010007 snapshot/lib/snapshot/setup.rb
fastlane-2.42.0.beta.20170626010017 snapshot/lib/snapshot/setup.rb
fastlane-2.42.0.beta.20170625010032 snapshot/lib/snapshot/setup.rb
fastlane-2.42.0.beta.20170624010047 snapshot/lib/snapshot/setup.rb
fastlane-2.41.0 snapshot/lib/snapshot/setup.rb
fastlane-2.41.0.beta.20170623010027 snapshot/lib/snapshot/setup.rb
fastlane-2.40.0 snapshot/lib/snapshot/setup.rb
fastlane-2.40.0.beta.20170622010014 snapshot/lib/snapshot/setup.rb