yamln8tor 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+ .DS_Store
15
+
16
+ # YARD artifacts
17
+ .yardoc
18
+ _yardoc
19
+ doc/
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.2-p290
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ yamln8tor (0.0.1)
5
+ psych
6
+ thor
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ psych (1.3.4)
12
+ thor (0.18.1)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ yamln8tor!
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ yamln8tor
2
+ =========
3
+
4
+ The yamln8tor is a Rails i18n framework YAML syntax validator.
5
+
6
+ ## Install
7
+
8
+ Since we don't have this hosted on a gem server yet, you'll need to build and install manually.
9
+
10
+ $ gem build yamln8tor.gemspec
11
+ $ gem install yamln8tor-0.0.1.gem
12
+
13
+ Note that when you run `gem install` you're installing yamln8tor for the ruby build you're currently on (this project includes a `.rbenv-version` file that defaults to 1.9.2)
14
+
15
+ ## Usage
16
+
17
+ ```shell
18
+ Commands:
19
+ yamln8tor help [COMMAND] # Describe available commands or one specific command
20
+ yamln8tor validate DIRECTORY # Validate syntax for all YAML files in the given base directory
21
+ ```
22
+
23
+ ## Run
24
+
25
+ $ yamln8tor validate <PATH_TO_I18N_DIR>
26
+
27
+ Validating YAML files in ../app/content.
28
+ (text/en/mailer/email/share_book.yml): found unexpected end of stream while scanning a quoted scalar at line 10 column 22
29
+ (text/es/mailer/email/shipped_confirmation.yml): did not find expected key while parsing a block mapping at line 5 column 9
30
+ Finished validating YAML files. Found 2 errors.
31
+
32
+ ## Todo
33
+
34
+ * Verify key parity between locales and do a diff between locale structures.
35
+ * Colorized output.
36
+ * On error, print out the file blob so we can visually inspect the error inline.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/yamln8tor ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "yamln8tor/cli"
3
+ Yamln8tor::Cli.start
@@ -0,0 +1,26 @@
1
+ require "thor"
2
+ require "psych"
3
+
4
+ module Yamln8tor
5
+ class Cli < Thor
6
+ desc "validate DIRECTORY", "Validate syntax for all YAML files in the given base directory"
7
+ def validate(directory=".")
8
+ errors = []
9
+
10
+ puts "Validating YAML files in #{directory}."
11
+
12
+ Dir.chdir(directory)
13
+ files = Dir.glob "**/*.yml"
14
+ files.each do |f|
15
+ begin
16
+ Psych.load_file(f)
17
+ rescue Psych::SyntaxError => e
18
+ errors << e
19
+ puts e.message
20
+ end
21
+ end
22
+
23
+ puts "Finished validating YAML files. Found #{errors.count} errors."
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Yamln8tor
2
+ VERSION = "0.0.3"
3
+ end
data/lib/yamln8tor.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "yamln8tor/version"
2
+ require "yamln8tor/cli"
3
+
data/yamln8tor.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/yamln8tor/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Andrew Hao"]
6
+ gem.email = ["ahao@blurb.com"]
7
+ gem.description = "Provides syntax checking on YAML files over Rails' i18n framework file structure"
8
+ gem.summary = "A Rails i18n yml validation framework."
9
+ gem.homepage = "http://github.com/blurb/yamln8tor"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "yamln8tor"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Yamln8tor::VERSION
17
+ gem.add_dependency "thor"
18
+ gem.add_dependency "psych"
19
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yamln8tor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andrew Hao
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: psych
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Provides syntax checking on YAML files over Rails' i18n framework file
47
+ structure
48
+ email:
49
+ - ahao@blurb.com
50
+ executables:
51
+ - yamln8tor
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gitignore
56
+ - .rbenv-version
57
+ - Gemfile
58
+ - Gemfile.lock
59
+ - README.md
60
+ - Rakefile
61
+ - bin/yamln8tor
62
+ - lib/yamln8tor.rb
63
+ - lib/yamln8tor/cli.rb
64
+ - lib/yamln8tor/version.rb
65
+ - yamln8tor.gemspec
66
+ homepage: http://github.com/blurb/yamln8tor
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.23
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: A Rails i18n yml validation framework.
90
+ test_files: []