mixlib-install 3.6.0 → 3.7.0
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/CHANGELOG.md +7 -2
- data/README.md +13 -0
- data/VERSION +1 -1
- data/lib/mixlib/install.rb +28 -0
- data/lib/mixlib/install/cli.rb +5 -16
- data/lib/mixlib/install/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 373dc90718fbd78d00902fe30c1415c4a59ae76b
|
4
|
+
data.tar.gz: 56f37d0469c613a23f56ae5e1db61164e96cd40d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8842abbba3208fb5899501b39007d6d18b436733426dd95b69047eabb971cec167a47ec03aeddeae45d8655a7e0ec8ed5c96edae6b9a5dffcac0dd38cd038394
|
7
|
+
data.tar.gz: 56edf364a53a8fc6f89eb716a971d94860e5bd0f06df6741a85b40ee57847e28511faf3617f8cf9d640a063bc17328406e8d8d50f5d20a3d7ad86fc73093ceef
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# Mixlib::Install Changes
|
2
2
|
|
3
|
-
<!-- latest_release 3.
|
3
|
+
<!-- latest_release 3.7.0 -->
|
4
|
+
## [v3.7.0](https://github.com/chef/mixlib-install/tree/v3.7.0) (2017-10-11)
|
5
|
+
|
6
|
+
#### Merged Pull Requests
|
7
|
+
- add #download_artifact method to Mixlib::Install API [#243](https://github.com/chef/mixlib-install/pull/243) ([wrightp](https://github.com/wrightp))
|
8
|
+
<!-- latest_release -->
|
9
|
+
|
4
10
|
## [v3.6.0](https://github.com/chef/mixlib-install/tree/v3.6.0) (2017-09-15)
|
5
11
|
|
6
12
|
#### Merged Pull Requests
|
7
13
|
- add install.sh proxy support [#242](https://github.com/chef/mixlib-install/pull/242) ([wrightp](https://github.com/wrightp))
|
8
|
-
<!-- latest_release -->
|
9
14
|
|
10
15
|
## [v3.5.1](https://github.com/chef/mixlib-install/tree/v3.5.1) (2017-09-08)
|
11
16
|
|
data/README.md
CHANGED
@@ -159,6 +159,19 @@ Mixlib::Install.available_versions("chef", "stable")
|
|
159
159
|
# => ["12.13.3", "12.13.7"]
|
160
160
|
```
|
161
161
|
|
162
|
+
### Download an artifact
|
163
|
+
Download a specific artifact to a configurable location. All platform options (platform, platform_version, architecture) are required in order to filter a single artifact.
|
164
|
+
```ruby
|
165
|
+
# detect platform and download to the operating system’s temporary file path
|
166
|
+
Mixlib::Install.new(product_name: "chefdk", channel: :stable).detect_platform.download_artifact(Dir.tmpdir)
|
167
|
+
# => "/tmp/chefdk-2.3.4-1.deb"
|
168
|
+
|
169
|
+
# specify platform options and download to current directory
|
170
|
+
Mixlib::Install.new(product_name: "chefdk", channel: :stable, platform: "ubuntu", platform_version: "14.04", architecture: "x86_64").download_artifact
|
171
|
+
# => "~/chefdk-2.3.4-1.deb"
|
172
|
+
|
173
|
+
```
|
174
|
+
|
162
175
|
### User-Agent Request Headers
|
163
176
|
By default, all requests made by `mixlib-install` will include a `User-Agent` request header as `mixlib-install/<version>`.
|
164
177
|
Additional `User-Agent` request headers can be added by setting the `user_agent_headers` option.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.7.0
|
data/lib/mixlib/install.rb
CHANGED
@@ -82,6 +82,34 @@ module Mixlib
|
|
82
82
|
Generator.install_command(options)
|
83
83
|
end
|
84
84
|
|
85
|
+
#
|
86
|
+
# Download a single artifact
|
87
|
+
#
|
88
|
+
# @param [String] download directory. Default: Dir.pwd
|
89
|
+
#
|
90
|
+
# @return [String] file path of downloaded artifact
|
91
|
+
#
|
92
|
+
def download_artifact(directory = Dir.pwd)
|
93
|
+
if options.platform.nil? || options.platform_version.nil? || options.architecture.nil?
|
94
|
+
raise "Must provide platform options to download a specific artifact"
|
95
|
+
end
|
96
|
+
|
97
|
+
artifact = artifact_info
|
98
|
+
|
99
|
+
FileUtils.mkdir_p directory
|
100
|
+
file = File.join(directory, File.basename(artifact.url))
|
101
|
+
|
102
|
+
uri = URI.parse(artifact.url)
|
103
|
+
Net::HTTP.start(uri.host) do |http|
|
104
|
+
resp = http.get(uri.path)
|
105
|
+
open(file, "wb") do |io|
|
106
|
+
io.write(resp.body)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
file
|
111
|
+
end
|
112
|
+
|
85
113
|
#
|
86
114
|
# Returns the base installation directory for the given options
|
87
115
|
#
|
data/lib/mixlib/install/cli.rb
CHANGED
@@ -66,8 +66,10 @@ If no earlier version is found the earliest version available will be set.",
|
|
66
66
|
mixlib_install_options.merge!(Mixlib::Install.detect_platform)
|
67
67
|
end
|
68
68
|
|
69
|
+
installer = Mixlib::Install.new(mixlib_install_options)
|
70
|
+
|
69
71
|
begin
|
70
|
-
artifact =
|
72
|
+
artifact = installer.artifact_info
|
71
73
|
rescue Mixlib::Install::Backend::ArtifactsNotFound => e
|
72
74
|
abort e.message
|
73
75
|
end
|
@@ -75,21 +77,8 @@ If no earlier version is found the earliest version available will be set.",
|
|
75
77
|
if options[:url]
|
76
78
|
say artifact.url
|
77
79
|
else
|
78
|
-
|
79
|
-
file =
|
80
|
-
|
81
|
-
require "json"
|
82
|
-
require "net/http"
|
83
|
-
|
84
|
-
say "Starting download #{artifact.url} to #{file}"
|
85
|
-
uri = URI.parse(artifact.url)
|
86
|
-
Net::HTTP.start(uri.host) do |http|
|
87
|
-
resp = http.get(uri.path)
|
88
|
-
open(file, "wb") do |io|
|
89
|
-
io.write(resp.body)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
80
|
+
say "Starting download #{artifact.url}"
|
81
|
+
file = installer.download_artifact(options[:directory])
|
93
82
|
say "Download saved to #{file}"
|
94
83
|
end
|
95
84
|
|
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.7.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-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-shellout
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.
|
230
|
+
rubygems_version: 2.6.13
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: A library for interacting with Chef Software Inc's software distribution
|