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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6c25005946f4906333f98699391a281e3b183b862149261dc904e8edc4ca1ea
4
- data.tar.gz: a65eba6ce8350861b28269fab10be83951f03c568339dc303123caa809198260
3
+ metadata.gz: 311a36bbbef8a863eae884262dd63a7b79c68180d6a821c48cb4e3b8bed99dc4
4
+ data.tar.gz: 87e7183bac5438aa5abbfd1bbbde7dc746ee9db768b51e267d4a4bc0b5d0c033
5
5
  SHA512:
6
- metadata.gz: d2cfe192adc690bcb79782dc9b6e1fb784cffaa3958017e578106fb30b31ebd6dbdeaa04123e74b4f3ad36bee5cb2b883f0ee5be23831138896212b71e5b7e04
7
- data.tar.gz: 305121b087a7c79ff89e048c60451b7573608f84c2df6508ea12368a5022c075771b3b7e4b1dc8be638f6a00e78a41a282eba5a9cff27bf25872e854b2c0e2cb
6
+ metadata.gz: d3f54b86369790c15741868f482a93d64cc93ba72ee580a9ed0c7d665f15e4ba3d6eb4431595830674f398385429ed591c1204227dacddc751e8c36b8bd1ed2e
7
+ data.tar.gz: 2090cecc2116f9446653b0f7af73b496cb64427c5f956d1a4a8697f06c3bc3d5fdfce2a99d660040b39776186b9f0bcbfbcfca657e7e44537a6c81909e862583
data/.standard.yml CHANGED
@@ -1,3 +1,6 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
3
  ruby_version: 2.6
4
+ ignore:
5
+ - '**/*':
6
+ - Style/StringLiterals
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hashipack (0.1.1)
4
+ hashipack (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 = File.read('myimage.pkr.hcl')
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
@@ -2,11 +2,8 @@ require 'tempfile'
2
2
 
3
3
  module Hashipack
4
4
  class Client
5
- def build(content, on_output: lambda{}, on_progress: lambda{}, estimated_duration: 300)
6
- template = Tempfile.new(["template", ".pkr.hcl"])
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
- return artifacts
36
+ artifacts
41
37
  end
42
38
  end
43
39
  end
@@ -3,12 +3,12 @@ module Hashipack
3
3
  def self.parse(line)
4
4
  msg = Message.new(line)
5
5
  if msg.ui?
6
- return UiMessage.new(line)
6
+ UiMessage.new(line)
7
7
  elsif msg.artifact?
8
- return ArtifactMessage.new(line)
8
+ ArtifactMessage.new(line)
9
9
  else
10
10
  puts "Ignoring unknown message type #{msg.type}"
11
- return Message.new(line)
11
+ Message.new(line)
12
12
  end
13
13
  end
14
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hashipack
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
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.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-17 00:00:00.000000000 Z
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.ch
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.ch
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: