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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea374f175907fc179f8047bbde6507baa1582271
4
- data.tar.gz: 4fc453d1d3e7c59d09f7afeecc4fd5e81643e899
3
+ metadata.gz: 1e8456ef2611d6bf089a626ad29353e035ec5064
4
+ data.tar.gz: da9122a2e4a22c9f88db778b5c0e3736fe8b9165
5
5
  SHA512:
6
- metadata.gz: 7c3a0da0b03ac064bd93d936e863306c97b9d5da378714563c5a23b9440fa11330786910bafcc76a9a164b34a9f4d7638fb4e4705e1b4e4216e4cfbc864f6c70
7
- data.tar.gz: f78211466246b174bc998ad8c313f6592c53be2fe28b1e2b76e9fb33c44b93aca4cd2007530506483e6d29f55a43e6020f4006411a9771d813331e579a71fe0a
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.4)
28
- nokogiri (~> 1.6.0)
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
- require_relative '../lib/yaml-validator'
3
+ require 'thor'
4
4
  require 'colorize'
5
+ require_relative '../lib/yaml-validator'
6
+
7
+ class YamlValidatorApp < Thor
5
8
 
6
- def main
7
- show_missing = true
8
- if ARGV.include? '--no-missing'
9
- show_missing = false
10
- ARGV.delete '--no-missing'
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
- root_path = '.'
14
- root_path = ARGV[0] if ARGV.length > 0
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
- main()
34
+ YamlValidatorApp.start
@@ -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[:show_missing]
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
 
@@ -1,3 +1,3 @@
1
1
  class YamlValidator
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |gem|
21
21
  gem.add_dependency('rspec')
22
22
  gem.add_dependency('colorize')
23
23
  gem.add_dependency('sanitize')
24
+ gem.add_dependency('thor')
24
25
  end
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.5
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-01 00:00:00.000000000 Z
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.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