Skip to content

Commit

Permalink
Allow injecting options for metadata-json-lint
Browse files Browse the repository at this point in the history
This allows running `metadata-json-lint` with `--no-strict-license` or `--no-fail-on-warnings`.
  • Loading branch information
felixb authored and FelixBechstein0000 committed Jan 21, 2016
1 parent eb2a236 commit 40546a4
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lib/puppetlabs_spec_helper/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
require 'rspec/core/rake_task'
require 'yaml'

# optional gems
begin
require 'metadata-json-lint/rake_task'
rescue LoadError
# ignore
end

task :default => [:help]

desc "Run spec tests on an existing fixtures directory"
Expand Down Expand Up @@ -248,23 +255,19 @@ def revision(scm, target, ref)
PuppetSyntax.exclude_paths << "vendor/**/*"
PuppetSyntax.future_parser = true if ENV['FUTURE_PARSER'] == 'yes'

desc "Check syntax of Ruby files and call :syntax and :metadata"
desc "Check syntax of Ruby files and call :syntax and :metadata_lint"
task :validate do
Dir['lib/**/*.rb'].each do |lib_file|
sh "ruby -c #{lib_file}"
end

Rake::Task[:syntax].invoke
Rake::Task[:metadata].invoke if File.exist?('metadata.json')
end

desc "Validate metadata.json file"
task :metadata do
begin
require 'metadata_json_lint'
sh "metadata-json-lint metadata.json"
rescue LoadError => e
warn "Skipping metadata validation; the metadata-json-lint gem was not found"
if File.exist?('metadata.json')
if Rake::Task.task_defined?(:metadata_lint)

This comment has been minimized.

Copy link
@cyberious

cyberious Mar 1, 2016

Contributor

Renaming this from metadata has affectively broken those that were already clearing this out and doing just what you are saying we could do

desc "Validate metadata.json file"
task :metadata do
  begin
    require 'metadata_json_lint'
    sh "metadata-json-lint metadata.json --no-strict-license"
  rescue LoadError => e
    warn "Skipping metadata validation; the metadata-json-lint gem was not found"
  end
end

This comment has been minimized.

Copy link
@DavidS

DavidS Mar 2, 2016

Contributor

There'll be a 1.1.1 release as soon as #131 is merged.

Rake::Task[:metadata_lint].invoke
else
warn "Skipping metadata validation; the metadata-json-lint gem was not found"
end
end
end

Expand Down

0 comments on commit 40546a4

Please sign in to comment.