Skip to content

Commit

Permalink
Merge pull request #6 from GannettDigital/DEVOPS-9441-ruby3x
Browse files Browse the repository at this point in the history
DEVOPS-9441 ruby3x upgrade
  • Loading branch information
becomingwisest authored Jan 4, 2024
2 parents 2411b50 + 390be07 commit 9aabaec
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 46 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "Ruby",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "ruby --version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "bundler" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
23 changes: 23 additions & 0 deletions .github/workflows/test-ruby.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test Ruby

on:
push:
pull_request:


jobs:
erb-hiera-example:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', 'head']
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Build Example
working-directory: example
run: bundle exec erb-hiera --config=config.yaml --hiera-config=hiera.yaml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pkg
.DS_Store
78 changes: 37 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,71 +1,67 @@
PATH
remote: .
specs:
erb-hiera (0.4.4)
erb-hiera (0.6.0)
hiera
optimist

GEM
remote: https://rubygems.org/
specs:
coderay (1.1.1)
diff-lcs (1.3)
ffi (1.9.18)
formatador (0.2.5)
guard (2.14.1)
coderay (1.1.3)
diff-lcs (1.5.0)
ffi (1.16.3)
formatador (1.1.0)
guard (2.18.1)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
hiera (3.7.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
lumberjack (1.0.12)
method_source (0.8.2)
hiera (3.12.0)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.10)
method_source (1.0.0)
nenv (0.3.0)
notiffany (0.1.1)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
optimist (3.0.1)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rake (12.0.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
optimist (3.1.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
ruby_dep (1.5.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
shellany (0.0.1)
slop (3.6.0)
thor (0.19.4)
thor (1.3.0)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
erb-hiera!
Expand All @@ -75,4 +71,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.2.29
2.4.10
4 changes: 2 additions & 2 deletions lib/erb-hiera.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ def self.run_mapping(mapping)
def self.generate(out_file, manifest, scope, erb_hiera)
Manifest.info(manifest, out_file, scope) if options[:verbose]

erb = ERB.new(File.read(manifest), nil, "-")
erb = ERB.new(File.read(manifest), trim_mode: "-")
erb.location= [manifest,1]
erb_result = erb.result(erb_hiera.get_binding())

puts erb_result if options[:verbose]

unless options[:dry_run]
FileUtils.mkdir_p File.dirname(out_file) unless Dir.exists?(File.dirname(out_file))
FileUtils.mkdir_p File.dirname(out_file) unless Dir.exist?(File.dirname(out_file))
File.write(out_file, erb_result)
end
rescue => error
Expand Down
3 changes: 1 addition & 2 deletions lib/erb-hiera/hiera.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def hiera(key)
end

unless value
puts "\nerror: cannot find value for key: #{key}"
exit 1
raise KeyError.new("Hiera lookup failed", receiver: Object.new, key: key)
end

puts "# #{key}: #{value}" if @verbose
Expand Down
2 changes: 1 addition & 1 deletion lib/erb-hiera/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby

module ErbHiera
VERSION = "0.5.0"
VERSION = "0.6.0"
end

0 comments on commit 9aabaec

Please sign in to comment.