Sha256: eb2c7ee47d75360f938e8a3ce20f9ccc5ee00a6386d57cd6dc8ca92dde791248

Contents?: true

Size: 1.4 KB

Versions: 83

Compression:

Stored size: 1.4 KB

Contents

require_relative 'module'
require_relative 'runner'

module Snapshot
  # Migrate helper files
  class Update
    # @return [Array] A list of helper files (usually just one)
    def self.find_helper
      paths = Dir["./**/SnapshotHelper.swift"] + Dir["./**/SnapshotHelperXcode8.swift"]
      # exclude assets in gym
      paths.reject { |p| p.include?("snapshot/lib/assets/") || p.include?("DerivedData") }
    end

    def update(force: false)
      paths = self.class.find_helper
      UI.user_error!("Couldn't find any SnapshotHelper files in current directory") if paths.count == 0

      UI.message("Found the following SnapshotHelper:")
      paths.each { |p| UI.message("\t#{p}") }
      UI.important("Are you sure you want to automatically update the helpers listed above?")
      UI.message("This will overwrite all its content with the latest code.")
      UI.message("The underlying API will not change. You can always migrate manually by looking at")
      UI.message("https://github.com/fastlane/fastlane/blob/master/snapshot/lib/assets/SnapshotHelper.swift")

      if !force && !UI.confirm("Overwrite configuration files?")
        return 1
      end

      paths.each do |path|
        UI.message("Updating '#{path}'...")
        input_path = Snapshot::Runner.path_to_helper_file_from_gem
        File.write(path, File.read(input_path))
      end

      UI.success("Successfully updated helper files")
    end
  end
end

Version data entries

83 entries across 83 versions & 4 rubygems

Version Path
fastlane-2.225.0 snapshot/lib/snapshot/update.rb
fastlane-2.224.0 snapshot/lib/snapshot/update.rb
fastlane-2.223.1 snapshot/lib/snapshot/update.rb
fastlane-2.223.0 snapshot/lib/snapshot/update.rb
fastlane-2.222.0 snapshot/lib/snapshot/update.rb
fastlane-2.221.1 snapshot/lib/snapshot/update.rb
fastlane-2.221.0 snapshot/lib/snapshot/update.rb
fastlane-2.220.0 snapshot/lib/snapshot/update.rb
fastlane-2.219.0 snapshot/lib/snapshot/update.rb
fastlane-2.218.0 snapshot/lib/snapshot/update.rb
fastlane-security-patched-2.216.0 snapshot/lib/snapshot/update.rb
fastlane-2.217.0 snapshot/lib/snapshot/update.rb
fastlane-2.216.0 snapshot/lib/snapshot/update.rb
fastlane-2.215.1 snapshot/lib/snapshot/update.rb
fastlane-2.215.0 snapshot/lib/snapshot/update.rb
fastlane-mercafacil-2.214.0 snapshot/lib/snapshot/update.rb
fastlane-2.214.0 snapshot/lib/snapshot/update.rb
fastlane-2.213.0 snapshot/lib/snapshot/update.rb
fastlane-2.212.2 snapshot/lib/snapshot/update.rb
fastlane_pricing_fix-2.212.1 snapshot/lib/snapshot/update.rb