DannyBen/rigit

View on GitHub
Runfile

Summary

Maintainability
Test Coverage
require "byebug"

title   "Rigit Developer Toolbelt"
summary "Runfile tasks for building the Rigit gem"

import_gem 'runfile-tasks/gem'
import_gem 'runfile-tasks/yard'

help   "Generate changelog and append old changelog"
action :changelog do
  system "git changelog --save"
  # append older changelog (prior to switching to git-changelog)
  system "cat .changelog.old.md >> CHANGELOG.md"
end

help   'Test the JSON schema'
action :schema do
  files = Dir['examples/**/config.yml'] + Dir['spec/rigs/**/config.yml']
  blacklist = %w[spec/rigs/broken/config.yml]
  files.each do |file|
    next if blacklist.include? file
    command = "check-jsonschema --schemafile schemas/config.json #{file}"
    say "\n$ check-jsonschema bb`#{file}`"
    success = system command
    exit 1 unless success
  end

  # Check failure
  file = 'spec/rigs/broken/config.yml'
  command = "check-jsonschema --schemafile schemas/config.json #{file}"
  say "\n$ check-jsonschema bb`#{file}`"
  say 'gb`Expecting failure`'
  success = system command
  exit 1 if success  

  say 'gb`All Pass`'
end