hashipack 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +14 -2
- data/lib/hashipack/client.rb +3 -7
- data/lib/hashipack/message.rb +3 -3
- data/lib/hashipack/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 311a36bbbef8a863eae884262dd63a7b79c68180d6a821c48cb4e3b8bed99dc4
|
4
|
+
data.tar.gz: 87e7183bac5438aa5abbfd1bbbde7dc746ee9db768b51e267d4a4bc0b5d0c033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3f54b86369790c15741868f482a93d64cc93ba72ee580a9ed0c7d665f15e4ba3d6eb4431595830674f398385429ed591c1204227dacddc751e8c36b8bd1ed2e
|
7
|
+
data.tar.gz: 2090cecc2116f9446653b0f7af73b496cb64427c5f956d1a4a8697f06c3bc3d5fdfce2a99d660040b39776186b9f0bcbfbcfca657e7e44537a6c81909e862583
|
data/.standard.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Hashipack
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/hashipack.svg)](https://badge.fury.io/rb/hashipack)
|
4
|
+
[![Ruby Code Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
5
|
+
|
3
6
|
Hashipack is a Ruby client for Hashicorp's Packer.
|
4
7
|
|
5
8
|
It allows building images and provides live status updates about the progress, as well as the resulting artifacts.
|
@@ -32,13 +35,22 @@ Create a client:
|
|
32
35
|
client = Hashipack::Client.new
|
33
36
|
```
|
34
37
|
|
35
|
-
Build an image by providing the template:
|
38
|
+
Build an image by providing the filename of the template:
|
36
39
|
|
37
40
|
```ruby
|
38
|
-
template =
|
41
|
+
template = 'myimage.pkr.hcl'
|
39
42
|
result = client.build(template)
|
40
43
|
```
|
41
44
|
|
45
|
+
If the template and the assets are in a different folder:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
Dir.chdir('./app/templates') do
|
49
|
+
template = 'myimage.pkr.hcl'
|
50
|
+
result = client.build(template)
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
42
54
|
Subscribe to log messages and print them as they arrive:
|
43
55
|
|
44
56
|
```ruby
|
data/lib/hashipack/client.rb
CHANGED
@@ -2,11 +2,8 @@ require 'tempfile'
|
|
2
2
|
|
3
3
|
module Hashipack
|
4
4
|
class Client
|
5
|
-
def build(
|
6
|
-
|
7
|
-
template.write(content)
|
8
|
-
template.close
|
9
|
-
command = "packer -machine-readable build #{template.path}"
|
5
|
+
def build(filename, on_output: lambda {}, on_progress: lambda {}, estimated_duration: 300)
|
6
|
+
command = "packer -machine-readable build #{filename}"
|
10
7
|
|
11
8
|
initial_timestamp = 99999999999
|
12
9
|
last_timestamp = 0
|
@@ -14,7 +11,6 @@ module Hashipack
|
|
14
11
|
artifacts = []
|
15
12
|
|
16
13
|
IO.popen(command).each do |line|
|
17
|
-
|
18
14
|
message = Message.parse(line)
|
19
15
|
|
20
16
|
if message.type == :ui
|
@@ -37,7 +33,7 @@ module Hashipack
|
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
40
|
-
|
36
|
+
artifacts
|
41
37
|
end
|
42
38
|
end
|
43
39
|
end
|
data/lib/hashipack/message.rb
CHANGED
@@ -3,12 +3,12 @@ module Hashipack
|
|
3
3
|
def self.parse(line)
|
4
4
|
msg = Message.new(line)
|
5
5
|
if msg.ui?
|
6
|
-
|
6
|
+
UiMessage.new(line)
|
7
7
|
elsif msg.artifact?
|
8
|
-
|
8
|
+
ArtifactMessage.new(line)
|
9
9
|
else
|
10
10
|
puts "Ignoring unknown message type #{msg.type}"
|
11
|
-
|
11
|
+
Message.new(line)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
data/lib/hashipack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashipack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas_Skywalker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: None.
|
14
14
|
email:
|
@@ -30,11 +30,11 @@ files:
|
|
30
30
|
- lib/hashipack/message.rb
|
31
31
|
- lib/hashipack/version.rb
|
32
32
|
- sig/hashipack.rbs
|
33
|
-
homepage: https://code-fabrik
|
33
|
+
homepage: https://github.com/code-fabrik/hashipack
|
34
34
|
licenses: []
|
35
35
|
metadata:
|
36
36
|
allowed_push_host: https://rubygems.org
|
37
|
-
homepage_uri: https://code-fabrik
|
37
|
+
homepage_uri: https://github.com/code-fabrik/hashipack
|
38
38
|
source_code_uri: https://github.com/code-fabrik/hashipack-ruby
|
39
39
|
changelog_uri: https://github.com/code-fabrik/hashipack-ruby/blob/master/CHANGELOG.md
|
40
40
|
post_install_message:
|