summaryrefslogtreecommitdiff
path: root/lib/license/management/shell.rb
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-11-10 01:30:35 +0000
committermo khan <mo.khan@gmail.com>2020-11-10 01:30:35 +0000
commit82338d974f42149e70f9163567940453f8f18b79 (patch)
tree8f61c9dccbd468de456e516113e9d6f289a7a157 /lib/license/management/shell.rb
parentf8200b265f63173c9b8d0b26470b449f512dbd17 (diff)
fix: detect maven wrapper in sub directory
* chore: fix bin scripts
Diffstat (limited to 'lib/license/management/shell.rb')
-rw-r--r--lib/license/management/shell.rb25
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/license/management/shell.rb b/lib/license/management/shell.rb
index e4fd35a..6a6f0b6 100644
--- a/lib/license/management/shell.rb
+++ b/lib/license/management/shell.rb
@@ -17,7 +17,9 @@ module License
mono: '/opt/asdf/installs/mono/6.8.0.123/bin/mono',
mvn: '/opt/asdf/bin/asdf exec mvn',
nuget: '/opt/asdf/installs/mono/6.8.0.123/bin/nuget.exe',
+ pip: '/opt/asdf/bin/asdf exec pip',
ruby: '/opt/asdf/bin/asdf exec ruby',
+ virtualenv: '/opt/asdf/bin/asdf exec virtualenv',
yarn: '/opt/asdf/bin/asdf exec yarn'
}.freeze
@@ -31,14 +33,15 @@ module License
trust!(certificate) if present?(certificate)
end
- def execute(command, env: {})
+ def execute(command, env: {}, capture: true)
expanded_command = expand(command)
- collapsible_section(expanded_command) do
- logger.debug(expanded_command)
- stdout, stderr, status = Open3.capture3(default_env.merge(env), expanded_command)
- record(stdout, stderr, status)
- [stdout, stderr, status]
- end
+ expanded_env = default_env.merge(env)
+ return system(expanded_env, expanded_command) unless capture
+
+ logger.debug(expanded_command)
+ stdout, stderr, status = Open3.capture3(expanded_env, expanded_command)
+ record(stdout, stderr, status)
+ [stdout, stderr, status]
end
def sh(command, env: {})
@@ -85,14 +88,6 @@ module License
def flush(message, severity)
logger.add(severity, message) if present?(message)
end
-
- def collapsible_section(header)
- id = header.downcase.gsub(/[[:space:]]/, '_').gsub(/[^0-9a-z ]/i, '_')
- logger.debug("\nsection_start:#{Time.now.to_i}:#{id}\r\e[0K#{header}")
- yield
- ensure
- logger.debug("\nsection_end:#{Time.now.to_i}:#{id}\r\e[0K")
- end
end
end
end