mixlib-install 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/README.md +37 -1
- data/acceptance/windows-server-2012r2/inspec/verify.rb +1 -1
- data/lib/mixlib/install/backend/base.rb +0 -19
- data/lib/mixlib/install/backend/package_router.rb +19 -5
- data/lib/mixlib/install/generator/bourne.rb +6 -0
- data/lib/mixlib/install/generator/powershell.rb +5 -0
- data/lib/mixlib/install/generator/powershell/scripts/install_project.ps1 +6 -1
- data/lib/mixlib/install/options.rb +6 -1
- data/lib/mixlib/install/util.rb +19 -0
- data/lib/mixlib/install/version.rb +1 -1
- data/mixlib-install.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e766479dca9a2bb0dbdfc558b76d0e291580ed9e
|
4
|
+
data.tar.gz: bf3a9b004e84d76307c1bcfb7826b9166eecab47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d97cf66c06b5f551ce3ea799a49544ff311b9f2aac37914926dc79761dc0aa9f9a0bdb9ec6b76a18ddabcd9b8f6ba743a17c4e04958486f2f668e9077204b09
|
7
|
+
data.tar.gz: a34a4378b3083182b156b1489abd5964cad41b5566f56219fa151136ea34385c9aa12e9200ea24181f7de63e681dcc4bb91a9aeb171ad0d993ec51f8dee0b79c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -16,10 +16,13 @@ Run `$ mixlib-install help` for additional commands and options.
|
|
16
16
|
|
17
17
|
## API Usage
|
18
18
|
|
19
|
-
###
|
19
|
+
### Load mixlib-install
|
20
20
|
```ruby
|
21
21
|
require 'mixlib/install'
|
22
|
+
```
|
22
23
|
|
24
|
+
### Get URL for specific platform and package version
|
25
|
+
```ruby
|
23
26
|
options = {
|
24
27
|
channel: :current,
|
25
28
|
product_name: 'chef',
|
@@ -51,6 +54,39 @@ artifacts.first.url
|
|
51
54
|
# => => "https://packages.chef.io/files/current/chef/12.14.90/mac_os_x/10.11/chef-12.14.90-1.dmg"
|
52
55
|
```
|
53
56
|
|
57
|
+
### Get latest artifacts for a partial version
|
58
|
+
```ruby
|
59
|
+
options = {
|
60
|
+
channel: :current,
|
61
|
+
product_name: 'chef',
|
62
|
+
product_version: '12.14'
|
63
|
+
}
|
64
|
+
|
65
|
+
artifacts = Mixlib::Install.new(options).artifact_info
|
66
|
+
# => [#<Mixlib::Install::ArtifactInfo>]
|
67
|
+
|
68
|
+
artifacts.first.version
|
69
|
+
# => "12.14.89"
|
70
|
+
```
|
71
|
+
|
72
|
+
### Get latest artifact for a partial version
|
73
|
+
```ruby
|
74
|
+
options = {
|
75
|
+
channel: :current,
|
76
|
+
product_name: 'chef',
|
77
|
+
product_version: '12',
|
78
|
+
platform: 'mac_os_x',
|
79
|
+
platform_version: '10.9',
|
80
|
+
architecture: 'x86_64'
|
81
|
+
}
|
82
|
+
|
83
|
+
artifact = Mixlib::Install.new(options).artifact_info
|
84
|
+
# => #<Mixlib::Install::ArtifactInfo>
|
85
|
+
|
86
|
+
artifact.version
|
87
|
+
# => "12.19.36"
|
88
|
+
```
|
89
|
+
|
54
90
|
### Detect platform information
|
55
91
|
```ruby
|
56
92
|
options = {
|
@@ -222,25 +222,6 @@ EOF
|
|
222
222
|
[platform, platform_version]
|
223
223
|
end
|
224
224
|
|
225
|
-
#
|
226
|
-
# Normalizes architecture information that we receive from omnibus.architecture
|
227
|
-
#
|
228
|
-
# @param [String] architecture
|
229
|
-
#
|
230
|
-
# @return String [architecture]
|
231
|
-
def normalize_architecture(architecture)
|
232
|
-
case architecture
|
233
|
-
when "amd64"
|
234
|
-
"x86_64"
|
235
|
-
when "i86pc", "i686"
|
236
|
-
"i386"
|
237
|
-
when "sun4u", "sun4v"
|
238
|
-
"sparc"
|
239
|
-
else
|
240
|
-
architecture
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
225
|
private
|
245
226
|
|
246
227
|
#
|
@@ -21,6 +21,7 @@ require "mixlib/install/artifact_info"
|
|
21
21
|
require "mixlib/install/backend/base"
|
22
22
|
require "mixlib/install/product"
|
23
23
|
require "mixlib/install/util"
|
24
|
+
require "mixlib/versioning"
|
24
25
|
require "net/http"
|
25
26
|
|
26
27
|
module Mixlib
|
@@ -36,7 +37,7 @@ module Mixlib
|
|
36
37
|
# @return [Array<ArtifactInfo>] list of artifacts for the configured
|
37
38
|
# channel, product name, and product version.
|
38
39
|
def available_artifacts
|
39
|
-
artifacts = if options.latest_version?
|
40
|
+
artifacts = if options.latest_version? || options.partial_version?
|
40
41
|
latest_version
|
41
42
|
else
|
42
43
|
artifacts_for_version(options.product_version)
|
@@ -89,12 +90,25 @@ EOF
|
|
89
90
|
|
90
91
|
#
|
91
92
|
# Get artifacts for the latest version, channel and product_name
|
93
|
+
# When a partial version is set the results will be filtered
|
94
|
+
# before return latest version.
|
92
95
|
#
|
93
96
|
# @return [Array<ArtifactInfo>] Array of info about found artifacts
|
94
97
|
def latest_version
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
+
product_versions = if options.partial_version?
|
99
|
+
v = options.product_version
|
100
|
+
partial_version = v.end_with?(".") ? v : v + "."
|
101
|
+
versions.find_all { |ver| extract_version_from_response(ver).start_with?(partial_version) }
|
102
|
+
else
|
103
|
+
versions
|
104
|
+
end
|
105
|
+
|
106
|
+
# Use mixlib versioning to parse and sort versions
|
107
|
+
ordered_versions = product_versions.sort_by do |v|
|
108
|
+
Mixlib::Versioning.parse(extract_version_from_response(v))
|
109
|
+
end.reverse
|
110
|
+
|
111
|
+
version = extract_version_from_response(ordered_versions.first)
|
98
112
|
artifacts_for_version(version)
|
99
113
|
end
|
100
114
|
|
@@ -193,7 +207,7 @@ EOF
|
|
193
207
|
end
|
194
208
|
|
195
209
|
ArtifactInfo.new(
|
196
|
-
architecture: normalize_architecture(artifact_map["omnibus.architecture"]),
|
210
|
+
architecture: Util.normalize_architecture(artifact_map["omnibus.architecture"]),
|
197
211
|
license: artifact_map["omnibus.license"],
|
198
212
|
license_content: license_content,
|
199
213
|
md5: artifact_map["omnibus.md5"],
|
@@ -57,8 +57,14 @@ module Mixlib
|
|
57
57
|
project=#{options.product_name}
|
58
58
|
version=#{options.product_version}
|
59
59
|
channel=#{options.channel}
|
60
|
+
#{install_command_vars}
|
60
61
|
EOS
|
61
62
|
end
|
63
|
+
|
64
|
+
def install_command_vars
|
65
|
+
return if options.install_command_options.nil?
|
66
|
+
options.install_command_options.map { |key, value| "#{key}='#{value}'" }.join("\n")
|
67
|
+
end
|
62
68
|
end
|
63
69
|
end
|
64
70
|
end
|
@@ -71,8 +71,13 @@ module Mixlib
|
|
71
71
|
cmd << " -version #{options.product_version}"
|
72
72
|
cmd << " -channel #{options.channel}"
|
73
73
|
cmd << " -architecture #{options.architecture}" if options.architecture
|
74
|
+
cmd << install_command_params if options.install_command_options
|
74
75
|
cmd << "\n"
|
75
76
|
end
|
77
|
+
|
78
|
+
def install_command_params
|
79
|
+
options.install_command_options.map { |key, value| " -#{key} '#{value}'" }.join
|
80
|
+
end
|
76
81
|
end
|
77
82
|
end
|
78
83
|
end
|
@@ -45,9 +45,14 @@ function Install-Project {
|
|
45
45
|
$architecture = 'auto',
|
46
46
|
[validateset('auto', 'service', 'task')]
|
47
47
|
[string]
|
48
|
-
$daemon = 'auto'
|
48
|
+
$daemon = 'auto',
|
49
|
+
[string]
|
50
|
+
$http_proxy
|
49
51
|
)
|
50
52
|
|
53
|
+
# Set http_proxy as env var
|
54
|
+
$env:http_proxy = $http_proxy
|
55
|
+
|
51
56
|
$package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies -architecture $architecture
|
52
57
|
|
53
58
|
if (-not [string]::IsNullOrEmpty($filename)) {
|
@@ -60,6 +60,7 @@ module Mixlib
|
|
60
60
|
:platform_version_compatibility_mode,
|
61
61
|
:include_metadata,
|
62
62
|
:user_agent_headers,
|
63
|
+
:install_command_options,
|
63
64
|
]
|
64
65
|
|
65
66
|
SUPPORTED_WINDOWS_DESKTOP_VERSIONS = %w{7 8 8.1 10}
|
@@ -70,7 +71,7 @@ module Mixlib
|
|
70
71
|
@options = options
|
71
72
|
@errors = []
|
72
73
|
|
73
|
-
# Store original
|
74
|
+
# Store original options in cases where we must remap
|
74
75
|
@original_platform_version = options[:platform_version]
|
75
76
|
|
76
77
|
resolve_platform_version_compatibility_mode!
|
@@ -110,6 +111,10 @@ module Mixlib
|
|
110
111
|
product_version.to_sym == :latest
|
111
112
|
end
|
112
113
|
|
114
|
+
def partial_version?
|
115
|
+
!latest_version? && !Mixlib::Versioning.parse(product_version)
|
116
|
+
end
|
117
|
+
|
113
118
|
def include_metadata?
|
114
119
|
include_metadata.to_s == "true"
|
115
120
|
end
|
data/lib/mixlib/install/util.rb
CHANGED
@@ -148,6 +148,25 @@ module Mixlib
|
|
148
148
|
version
|
149
149
|
end
|
150
150
|
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Normalizes architecture information
|
154
|
+
#
|
155
|
+
# @param [String] architecture
|
156
|
+
#
|
157
|
+
# @return String [architecture]
|
158
|
+
def normalize_architecture(architecture)
|
159
|
+
case architecture
|
160
|
+
when "amd64"
|
161
|
+
"x86_64"
|
162
|
+
when "i86pc", "i686"
|
163
|
+
"i386"
|
164
|
+
when "sun4u", "sun4v"
|
165
|
+
"sparc"
|
166
|
+
else
|
167
|
+
architecture
|
168
|
+
end
|
169
|
+
end
|
151
170
|
end
|
152
171
|
end
|
153
172
|
end
|
data/mixlib-install.gemspec
CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "rspec"
|
31
31
|
spec.add_development_dependency "simplecov"
|
32
32
|
spec.add_development_dependency "vcr"
|
33
|
-
spec.add_development_dependency "webmock"
|
33
|
+
spec.add_development_dependency "webmock"
|
34
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-install
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-shellout
|
@@ -183,16 +183,16 @@ dependencies:
|
|
183
183
|
name: webmock
|
184
184
|
requirement: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
|
-
- - "
|
186
|
+
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version: '
|
188
|
+
version: '0'
|
189
189
|
type: :development
|
190
190
|
prerelease: false
|
191
191
|
version_requirements: !ruby/object:Gem::Requirement
|
192
192
|
requirements:
|
193
|
-
- - "
|
193
|
+
- - ">="
|
194
194
|
- !ruby/object:Gem::Version
|
195
|
-
version: '
|
195
|
+
version: '0'
|
196
196
|
description:
|
197
197
|
email:
|
198
198
|
- thom@chef.io
|
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
version: '0'
|
306
306
|
requirements: []
|
307
307
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.
|
308
|
+
rubygems_version: 2.5.1
|
309
309
|
signing_key:
|
310
310
|
specification_version: 4
|
311
311
|
summary: A library for interacting with Chef Software Inc's software distribution
|