licensed 2.14.0 → 2.14.1

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
  SHA256:
3
- metadata.gz: b246cf67fe29bfe3612770c81b44006cdc185e2875deba36aa339b7f8be6d654
4
- data.tar.gz: 47e90e173cd914d214c270db673c1ffdff61f155853fec18da41837cebe7740b
3
+ metadata.gz: 8e51a39bfeaf0f48ca7a05b08047b8a64236b276097a0ee7f301dc1ca4e1ad1f
4
+ data.tar.gz: ee8de1cdebb66fa213f25b4b4bcd38957a4746b86bed6375a057cdd372603cc7
5
5
  SHA512:
6
- metadata.gz: 8e651c1ce72c6802b7f13e813ea4227c8dbeb53058deb8f68f1c8eabbcf4b9c4b9bd4a130b2d00b4238e14577f0a341d55fabac5aa72d0c3d0195a4b75bd1c86
7
- data.tar.gz: b07832f775f62da3fef628bf3ca9769e6f33e9d32338ffe468dad212f27d65d2be455e57ac73786930017d55308cd5222f2280f2944c832a1f32fa5c8a3557bb
6
+ metadata.gz: 583a36dbc2a4e2cb6c9ae76a8976f01e61c2ec3f855d36aac3ce68f303170c7ddd2f0a5ed1e7acc5e67ae26eedd05ee05c1b884cf73a5a6836b2e81879b12078
7
+ data.tar.gz: ca025576af3f1a385f6517d2534a39e83ae2bc6a575933559f0457cab3afd28037ab16aef79e068958c225bdacec293b21afa3e4d2f5238bde473a3a3a924daa
@@ -6,10 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 2.14.1
10
+ 2020-10-09
11
+
12
+ ### Fixed
13
+ - Shell command output is encoded to UTF8 (https://github.com/github/licensed/pull/319)
14
+
9
15
  ## 2.14.0
10
16
  2020-10-04
11
17
 
12
- ### Addded
18
+ ### Added
13
19
  - `reviewed` dependencies can use glob pattern matching (https://github.com/github/licensed/pull/313)
14
20
 
15
21
  ### Fixed
@@ -360,4 +366,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
360
366
 
361
367
  Initial release :tada:
362
368
 
363
- [Unreleased]: https://github.com/github/licensed/compare/2.14.0...HEAD
369
+ [Unreleased]: https://github.com/github/licensed/compare/2.14.1...HEAD
@@ -9,11 +9,12 @@ module Licensed
9
9
  def self.execute(cmd, *args, allow_failure: false, env: {})
10
10
  stdout, stderr, status = Open3.capture3(env, cmd, *args)
11
11
 
12
- if status.success? || allow_failure
13
- stdout.strip
14
- else
15
- raise Error.new([cmd, *args], status.exitstatus, stderr)
12
+ if !status.success? && !allow_failure
13
+ raise Error.new([cmd, *args], status.exitstatus, encode_content(stderr))
16
14
  end
15
+
16
+ # ensure that returned data is properly encoded
17
+ encode_content(stdout.strip)
17
18
  end
18
19
 
19
20
  # Executes a command and returns a boolean value indicating if the command
@@ -55,5 +56,21 @@ module Licensed
55
56
  end.join(" ")
56
57
  end
57
58
  end
59
+
60
+ private
61
+
62
+ ENCODING = Encoding::UTF_8
63
+ ENCODING_OPTIONS = {
64
+ invalid: :replace,
65
+ undef: :replace,
66
+ replace: "",
67
+ univeral_newline: true
68
+ }.freeze
69
+
70
+ # Ensure that content that is returned from shell commands is in a usable
71
+ # encoding for the rest of the application
72
+ def self.encode_content(content)
73
+ content.encode(ENCODING, **ENCODING_OPTIONS)
74
+ end
58
75
  end
59
76
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "2.14.0".freeze
3
+ VERSION = "2.14.1".freeze
4
4
 
5
5
  def self.previous_major_versions
6
6
  major_version = Gem::Version.new(Licensed::VERSION).segments.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.0
4
+ version: 2.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2020-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee