Method: Snapshot::Runner#verify_helper_is_current

Defined in:
snapshot/lib/snapshot/runner.rb

#verify_helper_is_currentObject

rubocop:disable Style/Next



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'snapshot/lib/snapshot/runner.rb', line 119

def verify_helper_is_current
  return if Snapshot.config[:skip_helper_version_check]
  current_version = version_of_bundled_helper
  UI.verbose("Checking that helper files contain #{current_version}")

  helper_files = Update.find_helper
  if helper_files.empty?
    UI.error("Your Snapshot Helper file is missing, please place a copy")
    UI.error("in your project directory")
    UI.message("More information about Snapshot setup can be found here:")
    UI.message("https://docs.fastlane.tools/actions/snapshot/#quick-start")
    UI.user_error!("Please add a Snapshot Helper file to your project")
    return
  end

  helper_files.each do |path|
    content = File.read(path)

    unless content.include?(current_version)
      UI.error("Your '#{path}' is outdated, please run `fastlane snapshot update`")
      UI.error("to update your Helper file")
      UI.user_error!("Please update your Snapshot Helper file using `fastlane snapshot update`")
    end
  end
end