Sha256: e254c94dede808827be5e106db99b3ddd81e2401a37a38d7d55fb4dd8d7b7bd2

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 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)
        raise "Snapfile already exists at path '#{snapfile_path}'. Run 'snapshot' to use snapshot.".red
      end

      gem_path = Helper.gem_path("snapshot")
      File.write(snapfile_path, File.read("#{gem_path}/lib/assets/SnapfileTemplate"))
      File.write(File.join(path, 'SnapshotHelper.swift'), File.read("#{gem_path}/lib/assets/SnapshotHelper.swift"))

      puts "Successfully created SnapshotHelper.js '#{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 the ./SnapshotHelper.swift to your UI Test target".yellow
      puts "   You can move the file anywhere you want".yellow
      puts "2) Call `setLanguage(app)` when launching your app".yellow
      puts ""
      puts "  let app = XCUIApplication()"
      puts "  setLanguage(app)"
      puts "  app.launch()"
      puts ""
      puts "3) Add `snapshot(\"0Launch\")` to wherever you want to create the screenshots".yellow
      puts ""
      puts "More information on GitHub: https://github.com/krausefx/snapshot".green
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
snapshot-1.1.1 lib/snapshot/setup.rb
snapshot-1.1.0 lib/snapshot/setup.rb
snapshot-1.0.5 lib/snapshot/setup.rb
snapshot-1.0.4 lib/snapshot/setup.rb
snapshot-1.0.3 lib/snapshot/setup.rb