license-acceptance 0.2.1 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -22
- data/config/product_info.toml +27 -0
- data/lib/license_acceptance/config.rb +5 -6
- data/lib/license_acceptance/prompt_acceptance.rb +9 -7
- data/lib/license_acceptance/version.rb +1 -1
- data/spec/license_acceptance/config_spec.rb +2 -4
- metadata +3 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f86114ca5b22ab56cb28a423f3c60cd092241b8541bbf569002a5003e08da1f7
|
4
|
+
data.tar.gz: 1347d3b7392ecbb2730b8fb4b5a7039efede80f8518443bd816b307af0c986e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8bbb8bae60146e0736abdc9b7492b69c0b822936f13411b9159b7267d341910f2a6d6a76dd9f2e5120b7e7bb7568c88c0a8b0a9ed61d1e99b7c11f0ca0757fd
|
7
|
+
data.tar.gz: b829ddf04523ec275a961449befde2f0b978e313e0264c799a77659a13fa95ff6d3b17bf00a3a5dc768867d8b1bb652fa9dbfc94746a49c5aa8834b1fce5be89
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
license-acceptance (0.
|
5
|
-
pastel (
|
4
|
+
license-acceptance (0.2.5)
|
5
|
+
pastel (~> 0.7)
|
6
6
|
tomlrb (~> 1.2)
|
7
|
-
tty-box (
|
8
|
-
tty-
|
9
|
-
tty-prompt (>= 0.18)
|
7
|
+
tty-box (~> 0.3)
|
8
|
+
tty-prompt (~> 0.18)
|
10
9
|
|
11
10
|
GEM
|
12
11
|
remote: https://rubygems.org/
|
@@ -20,7 +19,7 @@ GEM
|
|
20
19
|
diff-lcs (1.3)
|
21
20
|
equatable (0.5.0)
|
22
21
|
method_source (0.9.2)
|
23
|
-
mixlib-cli (
|
22
|
+
mixlib-cli (1.7.0)
|
24
23
|
necromancer (0.4.0)
|
25
24
|
pastel (0.7.2)
|
26
25
|
equatable (~> 0.5.0)
|
@@ -34,7 +33,7 @@ GEM
|
|
34
33
|
pry-stack_explorer (0.4.9.3)
|
35
34
|
binding_of_caller (>= 0.7)
|
36
35
|
pry (>= 0.9.11)
|
37
|
-
rake (
|
36
|
+
rake (10.5.0)
|
38
37
|
rspec (3.8.0)
|
39
38
|
rspec-core (~> 3.8.0)
|
40
39
|
rspec-expectations (~> 3.8.0)
|
@@ -48,10 +47,10 @@ GEM
|
|
48
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
48
|
rspec-support (~> 3.8.0)
|
50
49
|
rspec-support (3.8.0)
|
51
|
-
strings (0.1.
|
52
|
-
strings-ansi (~> 0.1
|
53
|
-
unicode-display_width (~> 1.
|
54
|
-
unicode_utils (~> 1.4
|
50
|
+
strings (0.1.5)
|
51
|
+
strings-ansi (~> 0.1)
|
52
|
+
unicode-display_width (~> 1.5)
|
53
|
+
unicode_utils (~> 1.4)
|
55
54
|
strings-ansi (0.1.0)
|
56
55
|
thor (0.20.3)
|
57
56
|
timers (4.3.0)
|
@@ -62,7 +61,6 @@ GEM
|
|
62
61
|
tty-cursor (~> 0.6.0)
|
63
62
|
tty-color (0.4.3)
|
64
63
|
tty-cursor (0.6.1)
|
65
|
-
tty-platform (0.2.0)
|
66
64
|
tty-prompt (0.18.1)
|
67
65
|
necromancer (~> 0.4.0)
|
68
66
|
pastel (~> 0.7.0)
|
@@ -74,7 +72,7 @@ GEM
|
|
74
72
|
tty-screen (~> 0.6.4)
|
75
73
|
wisper (~> 2.0.0)
|
76
74
|
tty-screen (0.6.5)
|
77
|
-
unicode-display_width (1.
|
75
|
+
unicode-display_width (1.5.0)
|
78
76
|
unicode_utils (1.4.0)
|
79
77
|
wisper (2.0.0)
|
80
78
|
|
@@ -82,16 +80,15 @@ PLATFORMS
|
|
82
80
|
ruby
|
83
81
|
|
84
82
|
DEPENDENCIES
|
85
|
-
|
86
|
-
climate_control (>= 0.2)
|
83
|
+
climate_control (~> 0.2)
|
87
84
|
license-acceptance!
|
88
|
-
mixlib-cli (
|
89
|
-
pry (
|
90
|
-
pry-byebug (
|
91
|
-
pry-stack_explorer (
|
92
|
-
rake (
|
93
|
-
rspec (
|
94
|
-
thor (
|
85
|
+
mixlib-cli (~> 1.7)
|
86
|
+
pry (~> 0.12)
|
87
|
+
pry-byebug (~> 3.6)
|
88
|
+
pry-stack_explorer (~> 0.4)
|
89
|
+
rake (~> 10.0)
|
90
|
+
rspec (~> 3.0)
|
91
|
+
thor (~> 0.20)
|
95
92
|
|
96
93
|
BUNDLED WITH
|
97
94
|
1.17.3
|
data/config/product_info.toml
CHANGED
@@ -1 +1,28 @@
|
|
1
1
|
# DO NOT CHANGE - overwritten by expeditor at build time
|
2
|
+
title = "All known products that require license acceptance, and the mapping of parent to child relationships"
|
3
|
+
|
4
|
+
[[products]]
|
5
|
+
name = "chef-client"
|
6
|
+
pretty_name = "Chef Client"
|
7
|
+
hab_pkg_id = "chef/chef-client"
|
8
|
+
filename = "chef_client"
|
9
|
+
|
10
|
+
[[products]]
|
11
|
+
name = "inspec"
|
12
|
+
pretty_name = "InSpec"
|
13
|
+
hab_pkg_id = "chef/inspec"
|
14
|
+
filename = "inspec"
|
15
|
+
|
16
|
+
[[products]]
|
17
|
+
name = "supermarket"
|
18
|
+
pretty_name = "Supermarket"
|
19
|
+
filename = "supermarket"
|
20
|
+
|
21
|
+
[[products]]
|
22
|
+
name = "chef-server"
|
23
|
+
pretty_name = "Chef Server"
|
24
|
+
hab_pkg_id = "chef/oc_erchef"
|
25
|
+
filename = "chef_server"
|
26
|
+
|
27
|
+
[relationships]
|
28
|
+
"chef-client" = ["inspec"]
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'logger'
|
2
|
-
require 'tty-platform'
|
3
2
|
|
4
3
|
module LicenseAcceptance
|
5
4
|
class Config
|
@@ -16,16 +15,12 @@ module LicenseAcceptance
|
|
16
15
|
|
17
16
|
private
|
18
17
|
|
19
|
-
def platform
|
20
|
-
@platform ||= TTY::Platform.new
|
21
|
-
end
|
22
|
-
|
23
18
|
def is_root?
|
24
19
|
Process.uid == 0
|
25
20
|
end
|
26
21
|
|
27
22
|
def default_license_locations
|
28
|
-
if
|
23
|
+
if windows?
|
29
24
|
l = [ File.join(ENV["HOMEDRIVE"], "chef/accepted_licenses/") ]
|
30
25
|
unless is_root?
|
31
26
|
# Look through a list of possible user locations and pick the first one that exists
|
@@ -55,6 +50,10 @@ module LicenseAcceptance
|
|
55
50
|
license_locations[-1]
|
56
51
|
end
|
57
52
|
|
53
|
+
def windows?
|
54
|
+
!!(RUBY_PLATFORM =~ /(cygwin|mswin|mingw|bccwin|wince|emx)/i)
|
55
|
+
end
|
56
|
+
|
58
57
|
end
|
59
58
|
|
60
59
|
class NoValidEnvironmentVar < StandardError
|
@@ -68,13 +68,15 @@ module LicenseAcceptance
|
|
68
68
|
prompt = TTY::Prompt.new(track_history: false, active_color: :bold, interrupt: :exit, output: output)
|
69
69
|
|
70
70
|
answer = "no"
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
begin
|
72
|
+
Timeout::timeout(60, PromptTimeout) do
|
73
|
+
answer = prompt.ask(">") do |q|
|
74
|
+
q.modify :down, :trim
|
75
|
+
q.required true
|
76
|
+
q.messages[:required?] = "You must enter 'yes' or 'no'"
|
77
|
+
q.validate /^\s*(yes|no)\s*$/i
|
78
|
+
q.messages[:valid?] = "You must enter 'yes' or 'no'"
|
79
|
+
end
|
78
80
|
end
|
79
81
|
rescue PromptTimeout
|
80
82
|
prompt.unsubscribe(prompt.reader)
|
@@ -6,7 +6,6 @@ require "license_acceptance/product_relationship"
|
|
6
6
|
RSpec.describe LicenseAcceptance::Config do
|
7
7
|
let(:opts) { {} }
|
8
8
|
let(:config) { LicenseAcceptance::Config.new(opts) }
|
9
|
-
let(:platform) { instance_double(TTY::Platform) }
|
10
9
|
|
11
10
|
it "loads correctly with default values" do
|
12
11
|
config
|
@@ -31,13 +30,12 @@ RSpec.describe LicenseAcceptance::Config do
|
|
31
30
|
|
32
31
|
describe "#default_license_locations and #default_persist_location" do
|
33
32
|
before do
|
34
|
-
expect(TTY::Platform).to receive(:new).and_return(platform)
|
35
33
|
expect(Process).to receive(:uid).and_return(uid)
|
36
34
|
end
|
37
35
|
|
38
36
|
describe "when platform is Windows" do
|
39
37
|
before do
|
40
|
-
|
38
|
+
stub_const("RUBY_PLATFORM", "mingw")
|
41
39
|
end
|
42
40
|
|
43
41
|
describe "when user is Administrator" do
|
@@ -81,7 +79,7 @@ RSpec.describe LicenseAcceptance::Config do
|
|
81
79
|
|
82
80
|
describe "when platform is non-Windows" do
|
83
81
|
before do
|
84
|
-
|
82
|
+
stub_const("RUBY_PLATFORM", "darwin")
|
85
83
|
end
|
86
84
|
|
87
85
|
describe "when user is root" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license-acceptance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tyler-ball
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.3'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: tty-platform
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.2'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.2'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: tty-prompt
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,11 +216,7 @@ files:
|
|
230
216
|
homepage: https://chef.io
|
231
217
|
licenses:
|
232
218
|
- Apache-2.0
|
233
|
-
metadata:
|
234
|
-
allowed_push_host: https://rubygems.org
|
235
|
-
homepage_uri: https://chef.io
|
236
|
-
source_code_uri: https://github.com/chef/license-acceptance
|
237
|
-
changelog_uri: https://github.com/chef/license-acceptance/blob/master/CHANGELOG.md
|
219
|
+
metadata: {}
|
238
220
|
post_install_message:
|
239
221
|
rdoc_options: []
|
240
222
|
require_paths:
|