Method: Snapshot::Runner#version_of_bundled_helper

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

#version_of_bundled_helperObject



107
108
109
110
111
112
113
114
115
116
# File 'snapshot/lib/snapshot/runner.rb', line 107

def version_of_bundled_helper
  asset_path = self.class.path_to_helper_file_from_gem
  regex_to_use = Helper.xcode_at_least?("9.0") ? /\n.*SnapshotHelperVersion \[.+\]/ : /\n.*SnapshotHelperXcode8Version \[.+\]/

  bundled_helper = File.read(asset_path)
  current_version = bundled_helper.match(regex_to_use)[0]

  # Something like "// SnapshotHelperVersion [1.2]", but be relaxed about whitespace
  return current_version.gsub(%r{^//\w*}, '').strip
end