Module: Dependabot::Pub::Helpers

Extended by:
T::Helpers, T::Sig
Includes:
Kernel
Included in:
FileParser, FileUpdater, UpdateChecker
Defined in:
lib/dependabot/pub/helpers.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



26
27
28
# File 'lib/dependabot/pub/helpers.rb', line 26

def credentials
  @credentials
end

#dependency_filesObject (readonly)

Returns the value of attribute dependency_files.



29
30
31
# File 'lib/dependabot/pub/helpers.rb', line 29

def dependency_files
  @dependency_files
end

#optionsObject (readonly)

Returns the value of attribute options.



32
33
34
# File 'lib/dependabot/pub/helpers.rb', line 32

def options
  @options
end

Class Method Details

.pub_helpers_pathObject



34
35
36
# File 'lib/dependabot/pub/helpers.rb', line 34

def self.pub_helpers_path
  File.join(ENV.fetch("DEPENDABOT_NATIVE_HELPERS_PATH", nil), "pub")
end

.run_infer_sdk_versions(dir, url: nil) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/dependabot/pub/helpers.rb', line 38

def self.run_infer_sdk_versions(dir, url: nil)
  env = {}
  cmd = File.join(pub_helpers_path, "infer_sdk_versions")
  opts = url ? "--flutter-releases-url=#{url}" : ""
  stdout, _, status = Open3.capture3(env, cmd, opts, chdir: dir)
  return nil unless status.success?

  JSON.parse(stdout)
end