bedouin 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9b732f736f968c8b5224eaf5ec37fa40fa9bd468
4
- data.tar.gz: eb16b4224fb4d08e8bc69474008c5ed347581936
2
+ SHA256:
3
+ metadata.gz: 3a57b2357a08cba2ed3c5741aa78ba9aa98aeb702f7d1c110d9dc994236f13c8
4
+ data.tar.gz: 482b529169f583ee8ccc29e79783d2fb39ca6da988ca33a452f97c3a4a4c7819
5
5
  SHA512:
6
- metadata.gz: 37f647dc61bb830eb35f30686dad9f51841cef097f32cdaec06ef7840207928d0dc8a6d7ab4a7c501243e5bb3321b3356986d6ccfce758ec377fc2b993460348
7
- data.tar.gz: bba9697666dd65306dd6c0824163deb497763b9f31a0508a2bd461b16261fef98937dcc7bc5fc137ae9cf356419de11add563da6a91bc3899019a445635ac209
6
+ metadata.gz: 5504c086ad43e5e18bb88360773c603a41735b0fe13f09c234b65320fb091a1c1ea483febaba8905c3f55467ebfc6ab5f48074cc7c5f698578ff680cf43dd399
7
+ data.tar.gz: 8d657809efa4439c603d47f866edf5c068cdb3dc36e7f1d02cbd19862e0050d092083c7fc6dacc6ee721d8854b7ce73d1d71741990c2bafba51f085cbe0eace6
data/README.md CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  Create one or more environment files and one or more ERB job templates, and then execute:
24
24
 
25
- $ bedouin <environment file> <template1> <template2> ...
25
+ $ bedouin [nomad option ...] [--] <environment file> <template1> <template2> ...
26
26
 
27
27
  Bedouin will evaluate each template with any attributes from the environment file available as instance variables. Bedouin will then run the results of each with "nomad run".
28
28
 
@@ -61,6 +61,15 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
61
61
 
62
62
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
63
63
 
64
+ ## Docker
65
+ The Dockerfile in `docker/` is used to build an image that is capable of building Nomad for alpine. When run, that image produces a tarball which can be fed back into `docker build` to produce the final image.
66
+
67
+ The `docker/build.sh` script will do this for you.
68
+
69
+ `docker/build.sh <NOMAD VERSION>`
70
+
71
+ `docker/build.sh 0.5.5`
72
+
64
73
  ## Contributing
65
74
 
66
75
  Bug reports and pull requests are welcome on GitHub at https://github.com/compellon/bedouin.
@@ -13,14 +13,14 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/compellon/bedouin"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|docker)/}) }
17
17
  spec.bindir = "bin"
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "erubis", "~> 2.7"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "bundler", "~> 2.0"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
26
  end
@@ -1,12 +1,14 @@
1
+ require 'bedouin/cli/params'
1
2
  module Bedouin
2
3
  class CLI
3
- def execute(env_path, *template_paths)
4
- e = Bedouin.environment_for(env_path)
4
+ def execute(*params)
5
+ p = Params.new(params)
6
+ e = Bedouin.environment_for(p.env_path)
5
7
 
6
- template_paths.lazy.map do |path|
8
+ p.template_paths.lazy.map do |path|
7
9
  t = Bedouin.template_for(path)
8
10
  j = Bedouin::Job.new(e, t)
9
- Bedouin::Runner.new.run(j)
11
+ Bedouin::Runner.new.run(job: j, opts: p.opts)
10
12
  end.reduce(0) do |m,j|
11
13
  puts j.to_s
12
14
  j.status == 0 ? m : 1
@@ -0,0 +1,21 @@
1
+ module Bedouin
2
+ class CLI
3
+ class Params
4
+ attr_reader :opts, :env_path, :template_paths
5
+ def initialize(params)
6
+ index_of_opt_terminator = params.find_index('--')
7
+ unchecked_params = params.slice!((index_of_opt_terminator)..-1) if index_of_opt_terminator
8
+
9
+ if args_count = params.reverse_each.find_index {|p| p.start_with? '-' }
10
+ args, @opts = params.pop(args_count), params
11
+ else
12
+ args, @opts = params, []
13
+ end
14
+
15
+ args.concat(unchecked_params.drop(1)) if unchecked_params
16
+
17
+ @env_path, *@template_paths = *args
18
+ end
19
+ end
20
+ end
21
+ end
@@ -5,8 +5,8 @@ module Bedouin
5
5
  @cfg = cfg
6
6
  end
7
7
 
8
- def run(job)
9
- Open3.popen3(@cfg[:nomad], "run", job.file_path) do |stdin, stdout, stderr, wait_thr|
8
+ def run(job:, opts: [])
9
+ Open3.popen3(@cfg[:nomad], "run", *opts, '--', job.file_path) do |stdin, stdout, stderr, wait_thr|
10
10
  job.status = wait_thr.value
11
11
  job.stdout = stdout.read
12
12
  job.stderr = stderr.read
@@ -1,3 +1,3 @@
1
1
  module Bedouin
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bedouin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Bresson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.12'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.12'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +92,7 @@ files:
92
92
  - examples/templates/echo.erb
93
93
  - lib/bedouin.rb
94
94
  - lib/bedouin/cli.rb
95
+ - lib/bedouin/cli/params.rb
95
96
  - lib/bedouin/environment.rb
96
97
  - lib/bedouin/job.rb
97
98
  - lib/bedouin/runner.rb
@@ -116,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.5.1
120
+ rubygems_version: 3.1.4
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Bedouin provides a templating system for Hashicorp Nomad.