Sha256: 4cc40d7c83f75affd79f5a4ca0aa0c4f510e93a17045a4bff03a49265547bdde

Contents?: true

Size: 1.18 KB

Versions: 26

Compression:

Stored size: 1.18 KB

Contents

module Snapshot
  # Migrate helper files
  class Update
    # @return [Array] A list of helper files (usually just one)
    def self.find_helper
      Dir["./**/SnapshotHelper.swift"] + Dir["./**/SnapshotHelperXcode8.swift"]
    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

26 entries across 26 versions & 1 rubygems

Version Path
fastlane-2.56.0 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170912010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170911010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170910010002 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170909010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170908010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170907010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170906010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170905010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170904010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170903010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170902010003 snapshot/lib/snapshot/update.rb
fastlane-2.56.0.beta.20170901010002 snapshot/lib/snapshot/update.rb
fastlane-2.55.0 snapshot/lib/snapshot/update.rb
fastlane-2.55.0.beta.20170831010002 snapshot/lib/snapshot/update.rb
fastlane-2.54.4 snapshot/lib/snapshot/update.rb
fastlane-2.55.0.beta.20170830010003 snapshot/lib/snapshot/update.rb
fastlane-2.55.0.beta.20170829010003 snapshot/lib/snapshot/update.rb
fastlane-2.54.3 snapshot/lib/snapshot/update.rb
fastlane-2.55.0.beta.20170826010003 snapshot/lib/snapshot/update.rb