Sha256: 7064d898fc216b8cf5f0595eeab7bc7bfcb8f441ecd0c1ed9fab1f13d480300b

Contents?: true

Size: 1.34 KB

Versions: 466

Compression:

Stored size: 1.34 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/") }
    end

    def update
      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")

      return 1 unless UI.confirm("Overwrite configuration files?")

      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

466 entries across 466 versions & 2 rubygems

Version Path
fastlane-2.130.0.beta.20190822200101 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190821200034 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190820200024 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190819200109 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190818200034 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190817200018 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190816200015 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190815200057 snapshot/lib/snapshot/update.rb
fastlane-2.130.0.beta.20190814200010 snapshot/lib/snapshot/update.rb
fastlane-2.129.0 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190813200016 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190811200106 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190810200059 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190809200051 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190808200013 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190807200122 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190806200055 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190805200019 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190804200053 snapshot/lib/snapshot/update.rb
fastlane-2.129.0.beta.20190803200103 snapshot/lib/snapshot/update.rb