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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57f70ce184afbeb3debbef49fa829a7d518b7fb6
4
- data.tar.gz: 8c4ea13a8f7b2e512233a5c701d993710ea89154
3
+ metadata.gz: ab417e94470f8f933b2d90b7010d3050cbdf608d
4
+ data.tar.gz: c2748ee3e263683c0b7aadf00d4a2da2e5b5883d
5
5
  SHA512:
6
- metadata.gz: 4c38ab5f589bfe0284bea6add6458f8f87471bad41617a15285ea094ca160df9e0a5fded154496c3a95c5a91970b21197876e15b02778f74e6996b940c9c20ba
7
- data.tar.gz: 96286dd77ccf7b90014ae6f706800380ecdc2f5bd0ea1e54a4fc2b99f834a991c9910f32f91fe359bfe7402b63faed891d312af039e1efb5d3a9e1a5b671c2d4
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)
@@ -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'
@@ -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
- # TODO: maybe we need a more robust way to determine whether is given
15
- # convert path from us or someone else
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda_convert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fang-Pen Lin