Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: "ci"
on:
push:
branches:
- "main"
- "master"
pull_request:
branches:
- "main"
- "master"
workflow_dispatch:

env:
Expand All @@ -32,7 +32,7 @@ jobs:
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
secrets: "inherit"
with:
rake_task: "spec:coverage"
rake_task: "spec"
ruby_version: ${{ matrix.ruby_version }}
puppet_gem_version: ${{ matrix.puppet_gem_version }}
runs_on: ${{ matrix.runs_on }}
2 changes: 1 addition & 1 deletion .github/workflows/mend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "mend"
on:
pull_request:
branches:
- "main"
- "master"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
Expand Down
58 changes: 41 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Find a location or specific version for a gem. place_or_version can be a
# version, which is most often used. It can also be git, which is specified as
# `git://somewhere.git#branch`. You can also use a file source location, which
# is specified as `file://some/location/on/disk`.
def location_for(place_or_version, fake_version = nil)
if place_or_version =~ /^(https[:@][^#]*)#(.*)/
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
elsif place_or_version =~ %r{^file://(.*)}
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com'
gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org'
gemsource_puppetcore = if ENV['GEM_SOURCE']
gemsource_default
elsif ENV['PUPPET_FORGE_TOKEN']
'https://rubygems-puppetcore.puppet.com'
else
ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default
end
source gemsource_default

gemspec

def location_for(place_or_version, fake_version = nil, opts = {})
git_url_regex = /\A(?<url>(?:https?|git)[:@][^#]*)(?:#(?<branch>.*))?/
file_url_regex = %r{\Afile://(?<path>.*)}

if place_or_version && (git_url = place_or_version.match(git_url_regex))
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
else
[place_or_version, { require: false }]
[place_or_version, { require: false }.merge(opts)]
end
end

# Specify your gem's dependencies in puppet-syntax.gemspec
gemspec

# Override gemspec for CI matrix builds.
# But only if the environment variable is set
gem 'openvox', *location_for(ENV['PUPPET_VERSION']) if ENV['PUPPET_VERSION']
# But only if the environment variable is set.
# Route through gemsource_puppetcore so CI can resolve puppet ~> 9.0 from the
# private Puppetcore registry (public rubygems.org tops out at puppet 8.10.0).
# When PUPPET_FORGE_TOKEN is unset (e.g. fork PRs, local dev without a token),
# gemsource_puppetcore falls through to gemsource_default (public rubygems.org)
# and no auth is attempted against Puppetcore.
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'], nil, { source: gemsource_puppetcore }) if ENV['PUPPET_GEM_VERSION']
# Puppet on Ruby 3.3 / 3.4 has some missing dependencies
gem 'syslog', '~> 0.3' if RUBY_VERSION >= '3.4'

# Windows platform runtime deps. The published puppet/openvox rubygems.org
# artefacts are built on Linux and guard `ffi` / `win32ole` with build-host
# platform checks, so those deps never make it into the Linux-published
# artefact. Ruby 3.4+ removed win32ole from default gems, making the missing
# declaration fatal at require-time on Windows. Declaring them here in the
# Gemfile is evaluated on the install host at bundle time, so bundler pulls
# them on Windows only.
platforms :mingw, :x64_mingw, :mswin do
gem 'ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2'
gem 'win32ole', '>= 1.8', '< 2.0'
end

group :test do
gem 'rspec'
end
Expand Down
13 changes: 7 additions & 6 deletions puppet-syntax.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ require 'puppet-syntax/version'
Gem::Specification.new do |spec|
spec.name = 'puppet-syntax'
spec.version = PuppetSyntax::VERSION
spec.authors = ['Vox Pupuli']
spec.email = ['voxpupuli@groups.io']
spec.description = 'Syntax checks for Puppet manifests and templates'
spec.email = ['modules-team@puppet.com']
spec.authors = ['Puppet, Inc.']
spec.summary = 'Syntax checks for Puppet manifests, templates, and Hiera YAML'
spec.homepage = 'https://github.com/voxpupuli/puppet-syntax'
spec.homepage = 'https://github.com/puppetlabs/puppetlabs-syntax/'
spec.license = 'MIT'

spec.description = <<-DESC
Syntax checks for Puppet manifests and templates.
DESC
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 3.2'

spec.add_dependency 'openvox', '>= 8', '< 9'
spec.add_dependency 'puppet', '>= 8', '< 10'
spec.add_dependency 'rake', '~> 13.1'

spec.add_development_dependency 'voxpupuli-rubocop', '~> 5.2.0'
Expand Down
Loading