miniexec 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/util.rb +19 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d8470c6289646978702f3c917e7a8d6e98df6aef7b2a6d8c810eecbaf9e797
|
4
|
+
data.tar.gz: bb5725ff2ff691bce7c0a2aa55860889efcd8300bb39add2347415ef4dff516c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc22648aa2042168eab09e192e89ad140ae188f20da8250e5817da3218019a580d5b7140320720bd212fbc44d2323c6f41aa1e722d7eb8973be877b6a5727c10
|
7
|
+
data.tar.gz: 6a4365689aa47b7be9272d8f6297c939159df7de03862965aa39e2b10c6fa07860d951b208c10b938cfa9b6c2d9b7a5b0660ff46859e732e565cfaa179b9cfea
|
data/lib/util.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MiniExec
|
4
|
+
module Util
|
5
|
+
# Given a string and an env, replace any instance of shell-style variables
|
6
|
+
# with their value in the env. NOT POSIX COMPLIANT, just mostly hacky so
|
7
|
+
# I can get gitlab-ci.yml parsing to work properly. Required in MiniExec
|
8
|
+
# because of https://docs.gitlab.com/ee/ci/variables/where_variables_can_be_used.html#gitlab-internal-variable-expansion-mechanism
|
9
|
+
def self.expand_var(string, env)
|
10
|
+
# Match group 1 = the text to replace
|
11
|
+
# Match group 2 = the key from env we want to replace it with
|
12
|
+
regex = /(\${?(\w+)}?)/
|
13
|
+
string.scan(regex).uniq.each do |match|
|
14
|
+
string.gsub! match[0], env[match[1]].to_s
|
15
|
+
end
|
16
|
+
string
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miniexec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Pugh
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- bin/miniexec
|
21
21
|
- lib/miniexec.rb
|
22
|
+
- lib/util.rb
|
22
23
|
homepage: https://github.com/s3krit/miniexec
|
23
24
|
licenses:
|
24
25
|
- AGPL-3.0-or-later
|