lambda_convert 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/convert +8 -0
- data/lib/lambda_convert/cli.rb +3 -0
- data/lib/lambda_convert/utils.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab417e94470f8f933b2d90b7010d3050cbdf608d
|
4
|
+
data.tar.gz: c2748ee3e263683c0b7aadf00d4a2da2e5b5883d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30120d3f06649b62c0bdf9b3bcf44ca68fbf4a4d6efcc7a14b198187f054ff86d2a101a7eb1fec24a4ec84726812ca26b2425649344a6a587681ec3ffda0b6b3
|
7
|
+
data.tar.gz: 68052dd61c6afdc2da6d303105169eb302376b0d871d2ffcda3bdf2fdd8ccec4ad872578cb85fbcfb2651893b8b595c4a5047bf90e8ab53b145eaf77bfc5c403
|
data/bin/convert
CHANGED
@@ -4,6 +4,14 @@ $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
|
4
4
|
require 'logger'
|
5
5
|
require 'lambda_convert'
|
6
6
|
|
7
|
+
# we want to print 'yes' if CONVERT_CHECK_SCRIPT is set to 1, in this way
|
8
|
+
# LambdaConvert::Utils.original_convert can determine whether is given
|
9
|
+
# executable file ours
|
10
|
+
if ENV['CONVERT_CHECK_SCRIPT'] == '1'
|
11
|
+
puts('yes')
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
7
15
|
debug_log = ENV['CONVERT_DEBUG_LOG']
|
8
16
|
if debug_log.nil?
|
9
17
|
LambdaConvert::CLI.logger = Logger.new(STDERR)
|
data/lib/lambda_convert/cli.rb
CHANGED
@@ -31,6 +31,8 @@ module LambdaConvert
|
|
31
31
|
credentials: aws_credentials
|
32
32
|
)
|
33
33
|
|
34
|
+
abort('Invalid arguments') if ARGV.count < 2
|
35
|
+
|
34
36
|
input_file, input_selecting = LambdaConvert::Utils.parse_input_path(
|
35
37
|
ARGV[0]
|
36
38
|
)
|
@@ -103,6 +105,7 @@ module LambdaConvert
|
|
103
105
|
env = ENV.to_h
|
104
106
|
# find the original convert bin path
|
105
107
|
original_convert = LambdaConvert::Utils.original_convert
|
108
|
+
abort('No local convert found') if original_convert.nil?
|
106
109
|
# we also put a CONVERT_RECURSIVE_FLAG to avoid somehow calling ourself
|
107
110
|
# again by mistake
|
108
111
|
env['CONVERT_RECURSIVE_FLAG'] = '1'
|
data/lib/lambda_convert/utils.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
1
3
|
module LambdaConvert
|
2
4
|
# Utils functions
|
3
5
|
module Utils
|
@@ -11,9 +13,8 @@ module LambdaConvert
|
|
11
13
|
|
12
14
|
def self.original_convert
|
13
15
|
find_cmd('convert').find do |path|
|
14
|
-
|
15
|
-
|
16
|
-
File.dirname(path) != Gem.bindir && !path.include?('.rbenv/shims')
|
16
|
+
output, = Open3.capture3({ 'CONVERT_CHECK_SCRIPT' => '1' }, path)
|
17
|
+
output.strip != 'yes'
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|