dependabot-common 0.135.0 → 0.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb9241efa54ea5f5abb737f0f9834a5f4c75827d8150f9ad9277015e5be30fef
4
- data.tar.gz: fbbacbc6ff52a4824cde4f5b8088c3532c1745c4dcf5af8b93f73f2ccbf25c6c
3
+ metadata.gz: bc3edda385ad9712adee28a2e6ce158255538bc08ebb97254d21c12c93eb6b77
4
+ data.tar.gz: e80fc751689e19297e517af77f33f2cbbabc9a1c2d6a42ee2cc22e093100c5ab
5
5
  SHA512:
6
- metadata.gz: 4dad05be71eec18d9edbed5ae5d7537167c679412b6295e80aa4dcac6e559aef9ce25632e9a71c11d1b978e087afc846110e3dcb5d3006ea6dbfbd2caee71002
7
- data.tar.gz: 4f4721d909bd2da3563779409432c34d9787f68209852bef348e54081f91aac3e93fc87656cd8731772144db7e9c8ede20dc6fc508acff072fe11af89bfffbda
6
+ metadata.gz: c2f0551c77fcbd34fd26551b30dba175cddfac71a7dbdc17965647a2f0e71b8019be4be0055c3c75c2cad24f37653116e97c9760afbe8b94fdb01bccc9ca83ac
7
+ data.tar.gz: b1a8902b9a7d11ac6c8524f95ab0b223a745e42268e39060dea75440399d314d6b38145911fc3856701f9983d1068a84132f964b1a8d15e31ddeb04a5e4fd509
@@ -75,13 +75,17 @@ module Dependabot
75
75
  start = Time.now
76
76
  stdin_data = JSON.dump(function: function, args: args)
77
77
  cmd = allow_unsafe_shell_command ? command : escape_command(command)
78
- env_cmd = [env, cmd].compact
78
+
79
+ # NOTE: For debugging native helpers in specs and dry-run: outputs the
80
+ # bash command to run in the tmp directory created by
81
+ # in_a_temporary_directory
79
82
  if ENV["DEBUG_FUNCTION"] == function
80
- escaped_stdin_data = stdin_data.gsub("\"", "\\\"")
81
- puts "$ cd #{Dir.pwd} && echo \"#{escaped_stdin_data}\" | #{env_cmd.join(' ')}"
83
+ puts helper_subprocess_bash_command(stdin_data: stdin_data, command: cmd, env: env)
82
84
  # Pause execution so we can run helpers inside the temporary directory
83
85
  byebug # rubocop:disable Lint/Debugger
84
86
  end
87
+
88
+ env_cmd = [env, cmd].compact
85
89
  stdout, stderr, process = Open3.capture3(*env_cmd, stdin_data: stdin_data)
86
90
  time_taken = Time.now - start
87
91
 
@@ -286,5 +290,12 @@ module Dependabot
286
290
  error_context: error_context
287
291
  )
288
292
  end
293
+
294
+ def self.helper_subprocess_bash_command(command:, stdin_data:, env:)
295
+ escaped_stdin_data = stdin_data.gsub("\"", "\\\"")
296
+ env_keys = env ? env.compact.map { |k, v| "#{k}=#{v}" }.join(" ") + " " : ""
297
+ "$ cd #{Dir.pwd} && echo \"#{escaped_stdin_data}\" | #{env_keys}#{command}"
298
+ end
299
+ private_class_method :helper_subprocess_bash_command
289
300
  end
290
301
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.135.0"
4
+ VERSION = "0.136.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.135.0
4
+ version: 0.136.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-05 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit