Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Run validations via a Rakefile.

  • Loading branch information...
commit 1b7a6a662a846cc34514015fa79cded947410cc1 1 parent 5dfe2b1
@georgebrock georgebrock authored
Showing with 31 additions and 16 deletions.
  1. +31 −0 Rakefile
  2. +0 −8 lib/validate_json.rb
  3. +0 −8 lib/validate_uris.rb
View
31 Rakefile
@@ -0,0 +1,31 @@
+require 'rake'
+require 'bundler/setup'
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec)
+
+task :environment do
+ script_directory = File.dirname(__FILE__)
+ helper_files = script_directory + '/lib/helpers/*.rb'
+ Dir[helper_files].each { |file| require File.expand_path(file) }
+end
+
+desc 'Run RSpec code examples and validations'
+task :test => [:spec, :validate]
+
+desc 'Run validations'
+task :validate => %w(validate:json validate:uris)
+
+namespace :validate do
+ desc 'Run JSON validations'
+ task :json => :environment do
+ TrailRunner.new.run('JSON validation') { |file| JSONValidator.new(file).run }
+ end
+
+ desc 'Run URI validations'
+ task :uris => :environment do
+ TrailRunner.new.run('URI validation') { |file| URIValidator.new(file).run }
+ end
+end
+
+task :default => :test
View
8 lib/validate_json.rb
@@ -1,8 +0,0 @@
-#!/usr/bin/env ruby
-
-script_directory = File.dirname(__FILE__)
-helper_files = script_directory + '/helpers/*.rb'
-
-Dir[helper_files].each { |file| require File.expand_path(file) }
-
-TrailRunner.new.run('JSON validation') { |file| JSONValidator.new(file).run }
View
8 lib/validate_uris.rb
@@ -1,8 +0,0 @@
-#!/usr/bin/env ruby
-
-script_directory = File.dirname(__FILE__)
-helper_files = script_directory + '/helpers/*.rb'
-
-Dir[helper_files].each { |file| require File.expand_path(file) }
-
-TrailRunner.new.run('URI validation') { |file| URIValidator.new(file).run }
Please sign in to comment.
Something went wrong with that request. Please try again.