yaml-validator 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -2
- data/bin/yaml-validator +25 -19
- data/lib/yaml-validator.rb +4 -2
- data/lib/yaml-validator/version.rb +1 -1
- data/yaml-validator.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e8456ef2611d6bf089a626ad29353e035ec5064
|
4
|
+
data.tar.gz: da9122a2e4a22c9f88db778b5c0e3736fe8b9165
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f40e01f2e5edbb98aedeba67008c5cb549cf558b102789ad664d8149e6f8d27524578b2969f968c1b1791edfdfea0d9e95650d5d14c916e5bf3aea126a510c8
|
7
|
+
data.tar.gz: 5f5f42e97a15a02487227322986559d2096b9b1ba7ec73d3c91e76885bfb1b727a41e4501e00e0b1316ac91a38bfb7610e4aaa0724a057aea4e38b4378323776
|
data/Gemfile.lock
CHANGED
@@ -6,6 +6,7 @@ PATH
|
|
6
6
|
rake
|
7
7
|
rspec
|
8
8
|
sanitize
|
9
|
+
thor
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
@@ -24,8 +25,9 @@ GEM
|
|
24
25
|
rspec-expectations (2.13.0)
|
25
26
|
diff-lcs (>= 1.1.3, < 2.0)
|
26
27
|
rspec-mocks (2.13.1)
|
27
|
-
sanitize (2.0.
|
28
|
-
nokogiri (
|
28
|
+
sanitize (2.0.6)
|
29
|
+
nokogiri (>= 1.4.4)
|
30
|
+
thor (0.18.1)
|
29
31
|
|
30
32
|
PLATFORMS
|
31
33
|
ruby
|
data/bin/yaml-validator
CHANGED
@@ -1,28 +1,34 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'thor'
|
4
4
|
require 'colorize'
|
5
|
+
require_relative '../lib/yaml-validator'
|
6
|
+
|
7
|
+
class YamlValidatorApp < Thor
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
desc "validate [ROOT_PATH]", "validates the files in the current directory"
|
10
|
+
option :missing, :type => :boolean, :default => true, :aliases => '-m', :desc => 'show missing translations'
|
11
|
+
option :sanitize, :type => :boolean, :default => false, :aliases => '-s', :desc => 'check for sanitized html'
|
12
|
+
def validate(root_path = '.')
|
13
|
+
puts "Validating #{root_path}...\n\n".colorize(:blue).underline
|
14
|
+
validator = YamlValidator.new(root_path, options)
|
15
|
+
errors = validator.validate()
|
16
|
+
puts errors
|
17
|
+
|
18
|
+
if errors.length > 0
|
19
|
+
puts "\nfound #{errors.length} error(s)".colorize(:red).underline
|
20
|
+
else
|
21
|
+
puts "no errors".colorize(:green).underline
|
22
|
+
end
|
11
23
|
end
|
12
24
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
puts "Validating #{root_path}...\n\n".colorize(:blue).underline
|
17
|
-
validator = YamlValidator.new(root_path, :show_missing => show_missing)
|
18
|
-
errors = validator.validate()
|
19
|
-
puts errors
|
20
|
-
|
21
|
-
if errors.length > 0
|
22
|
-
puts "\nfound #{errors.length} error(s)".colorize(:red).underline
|
23
|
-
else
|
24
|
-
puts "no errors".colorize(:green).underline
|
25
|
+
desc "version", "shows the version of Yaml Validator"
|
26
|
+
def version
|
27
|
+
puts YamlValidator::VERSION
|
25
28
|
end
|
29
|
+
|
30
|
+
default_task :validate
|
31
|
+
|
26
32
|
end
|
27
33
|
|
28
|
-
|
34
|
+
YamlValidatorApp.start
|
data/lib/yaml-validator.rb
CHANGED
@@ -8,7 +8,6 @@ class YamlValidator
|
|
8
8
|
|
9
9
|
def initialize(root_path, options = {})
|
10
10
|
@options = options
|
11
|
-
@options[:show_missing] ||= true
|
12
11
|
@root_path = root_path
|
13
12
|
end
|
14
13
|
|
@@ -54,9 +53,12 @@ class YamlValidator
|
|
54
53
|
yaml_object = yaml_object[yaml_object.keys[0]]
|
55
54
|
yaml_object = Helpers.normalize_yaml(yaml_object)
|
56
55
|
errors += validate_yaml_object('', yaml_object)
|
57
|
-
if @options
|
56
|
+
if @options.missing?
|
58
57
|
errors.concat find_missing_translations(yaml_object)
|
59
58
|
errors.concat find_missing_pluralizations(filename, yaml_object)
|
59
|
+
end
|
60
|
+
|
61
|
+
if @options.sanitize?
|
60
62
|
errors.concat find_unsanitized_html(filename, yaml_object)
|
61
63
|
end
|
62
64
|
|
data/yaml-validator.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Elentok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: YAML locales validator
|
70
84
|
email:
|
71
85
|
- 3david@gmail.com
|
@@ -125,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
139
|
version: '0'
|
126
140
|
requirements: []
|
127
141
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.0.
|
142
|
+
rubygems_version: 2.0.3
|
129
143
|
signing_key:
|
130
144
|
specification_version: 4
|
131
145
|
summary: Validates .yml locale files for Ruby on Rails projects
|