dir_validator 0.12.15 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/bin/validate-dir +6 -0
- data/lib/dir_validator.rb +33 -0
- metadata +7 -6
data/CHANGELOG.rdoc
CHANGED
data/bin/validate-dir
ADDED
data/lib/dir_validator.rb
CHANGED
@@ -8,6 +8,39 @@ module DirValidator
|
|
8
8
|
return DirValidator::Validator.new(*args, &block)
|
9
9
|
end
|
10
10
|
|
11
|
+
# Takes the file name of a Ruby script as a command-line argument.
|
12
|
+
# The script should define the following methods:
|
13
|
+
#
|
14
|
+
# module DirValidator
|
15
|
+
# def initialize_validator
|
16
|
+
# # Should return the arguments to DirValidator.new().
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# def run_validator(dv)
|
20
|
+
# # Receives the DirValidator::Validator object.
|
21
|
+
# # Should execute the desired validation code.
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# Requires the script, runs its code, and returns the validator.
|
26
|
+
#
|
27
|
+
# Used by the validate-dir executable. Also useful for applications
|
28
|
+
# wanting to offer the functionality of the dir_validator gem and
|
29
|
+
# to receive the validation code as an input.
|
30
|
+
def self.run_script(args)
|
31
|
+
# Require the script, and add its functions to the module.
|
32
|
+
script = args.first
|
33
|
+
abort "Usage: #{$PROGRAM_NAME} SCRIPT" unless File.file?(script.to_s)
|
34
|
+
require script
|
35
|
+
module_function(:initialize_validator, :run_validator)
|
36
|
+
# Create validator, run the validation code supplied by user.
|
37
|
+
dv = DirValidator.new(initialize_validator)
|
38
|
+
run_validator(dv)
|
39
|
+
dv.validate()
|
40
|
+
# Return the validator.
|
41
|
+
return dv
|
42
|
+
end
|
43
|
+
|
11
44
|
end
|
12
45
|
|
13
46
|
require 'dir_validator/catalog'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dir_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 13
|
9
|
+
- 0
|
10
|
+
version: 0.13.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Monty Hindman
|
@@ -77,8 +77,8 @@ dependencies:
|
|
77
77
|
description: This gem provides a convenient syntax for checking whether the contents of a directory structure match your expectations.
|
78
78
|
email:
|
79
79
|
- hindman@stanford.edu
|
80
|
-
executables:
|
81
|
-
|
80
|
+
executables:
|
81
|
+
- validate-dir
|
82
82
|
extensions: []
|
83
83
|
|
84
84
|
extra_rdoc_files: []
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- CHANGELOG.rdoc
|
96
96
|
- tutorial/tutorial.rb
|
97
97
|
- .yardopts
|
98
|
+
- bin/validate-dir
|
98
99
|
homepage: https://github.com/sul-dlss
|
99
100
|
licenses: []
|
100
101
|
|