json_checker 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjY3NDJiYTdkZmQ4MTUxMDRkZjVlNDU2OTg4ZWJmNTM2OTZhNDVhYQ==
4
+ NmU2YjE3NTcxMTE3Y2U1Y2ViYWE1MGM0ZmZhMGE0MTZjZGRlYWI3Nw==
5
5
  data.tar.gz: !binary |-
6
- NGNhMzQ2OWQxM2ZjMzRhOTJmYzUyODcxY2ZmOWJkYTNkMGRjODQxZg==
6
+ NTA0ZTdmY2JkODI0OWRkYzkwYzc2NDU4NjMxOGZlNDZiMWZhMmEwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmViYmVjYTIzMWU1NjQ4YTg5NDEyM2FmMDM3MmI0MzBkM2Q3NThkNTNlMzZh
10
- Zjg4M2E0ZjlkOGY1OTk4MTg0NzQ2MTk0YjFlYTViNGEwNjQ4MDNhOGQ2NWVl
11
- Nzg4Mjg1MTMxYTk0Mjk0OGU4MjA4NGI5YjhkZmY0MDExNWYwNDI=
9
+ ZGVlZWQwOTAxMzg4ZTY3ZmEzNjk1NDM2NDdmOTcwMjhhODgwMmYwMjBlZGI5
10
+ NTA3ZjdkNTc5Y2FjYjViZjEzNDYzMGI2YzQ4YmU0MmVhNjRiMWQ0MmZiZjBi
11
+ ZjJlNWVmZjI4ODJlMTdmYjUxZTAyMmIzMjA2ZTYwN2JjZjRlMWI=
12
12
  data.tar.gz: !binary |-
13
- MmM4ZGFjNDEwZjMxYzA4ZGQ5NzRjNDlhZTI3N2UzYWExZDNkM2ZkYWRjN2Zl
14
- MWU3ODI4Y2YwOTJkZTU2NTM0ODJmNmE0MzdiZmJlODM2YTM0NTQ5Njg2N2Y2
15
- ZDJkMzhhNWVlY2NiNjkxNTdjMzI3ZTAyOTNhZjQ0YmI0Njk1MWQ=
13
+ MGFlOWQwNmYwNGExOGEzMzE0NWUwMWNlOGQ3YjY4MjQ0MWQ0OWIzMmVlMjg5
14
+ MzI1Y2IxNDk1ZjVjZWJlMzlmNTZjMDMwOGNjOTJkMGYwMWQwMGQ2MzRjN2Y0
15
+ NDYxNzVlOTkwOWZkNGNjNTNjMzAwYTU5MjU5YzVlMzhmNGRjMzY=
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # JsonChecker
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/json_checker`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/hyperium/hyper/master/LICENSE)
4
+ [![Build Status](https://travis-ci.org/ciceroduarte/json_checker.svg?branch=master)](https://travis-ci.org/ciceroduarte/json_checker)
5
+ [![Coverage Status](https://coveralls.io/repos/github/ciceroduarte/json_checker/badge.svg?branch=master)](https://coveralls.io/github/ciceroduarte/json_checker?branch=master)
6
6
 
7
7
  ## Installation
8
8
 
@@ -37,5 +37,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/cicero
37
37
 
38
38
  ## License
39
39
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/bin/json_checker ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "json_checker"
5
+
6
+ checker = JsonChecker::Checker.new
7
+ checker.run()
data/json_checker.gemspec CHANGED
@@ -16,12 +16,13 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
17
  f.match(%r{^(test|spec|features)/})
18
18
  end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.executables = ["json_checker"]
21
20
  spec.require_paths = ["lib"]
22
21
 
23
22
  spec.add_development_dependency "bundler", "~> 1.14"
24
23
  spec.add_development_dependency "rake", "~> 10.0"
25
24
  spec.add_development_dependency "rspec", "~> 3.0"
26
25
  spec.add_development_dependency "diffy", "3.1.0"
26
+ spec.add_development_dependency "coveralls"
27
+
27
28
  end
@@ -2,6 +2,11 @@ module JsonChecker
2
2
  class HTMLOutput
3
3
 
4
4
  def self.add_validation_item(title, values)
5
+
6
+ if title.nil? || values.nil? || !values.is_a?(Array)
7
+ return
8
+ end
9
+
5
10
  item = "<h2>#{title}</h2>"
6
11
  item << "<div class=\"validation\" style=\"overflow-x:auto;\">
7
12
  <table><tr><th>Status</th><th>Key</th><th>Expected</th><th>Value</th></tr>"
@@ -20,6 +25,11 @@ module JsonChecker
20
25
  end
21
26
 
22
27
  def self.add_comparation_item(title, json)
28
+
29
+ if title.nil? || json.nil?
30
+ return
31
+ end
32
+
23
33
  item = "<h2>#{title}</h2>" + "<div class=\"diff\">" + json + "</div>"
24
34
  if @reportItems.nil?
25
35
  @reportItems = Array.new()
@@ -27,10 +37,6 @@ module JsonChecker
27
37
  @reportItems << item
28
38
  end
29
39
 
30
- def self.testandoHTML()
31
- puts @reportItems
32
- end
33
-
34
40
  def self.generate_output()
35
41
  htmlOutput = HTMLOutput.new()
36
42
  output = "<html>" + htmlOutput.add_style() + "<body>"
@@ -28,7 +28,6 @@ module JsonChecker
28
28
 
29
29
  unless temp_json.nil? && temp_jsonToCompare.nil?
30
30
  diff = Diffy::Diff.new(temp_json.path, temp_jsonToCompare.path, :source => 'files', :context => 3)
31
- puts diff
32
31
  html_report_from_diff(title, diff)
33
32
 
34
33
  temp_jsonToCompare.delete
@@ -1,3 +1,3 @@
1
1
  module JsonChecker
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/json_checker.rb CHANGED
@@ -3,10 +3,13 @@ require 'json_checker/json_fetcher'
3
3
  require 'json_checker/json_validator'
4
4
 
5
5
  module JsonChecker
6
+ class Checker
7
+ def run()
8
+ jsonConfig = JSONFetcher.json_from_path('json-config.json')
6
9
 
7
- jsonConfig = JSONFetcher.json_from_path('json-config.json')
8
-
9
- unless jsonConfig.nil?
10
- JSONValidator.validate_with_config(jsonConfig)
11
- end
10
+ unless jsonConfig.nil?
11
+ JSONValidator.validate_with_config(jsonConfig)
12
+ end
13
+ end
14
+ end
12
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cícero Duarte
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-12 00:00:00.000000000 Z
11
+ date: 2017-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,13 +66,29 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email:
71
85
  - ciceroduarte1@gmail.com
72
- executables: []
86
+ executables:
87
+ - json_checker
73
88
  extensions: []
74
89
  extra_rdoc_files: []
75
90
  files:
91
+ - .coveralls.yml
76
92
  - .gitignore
77
93
  - .rspec
78
94
  - .travis.yml
@@ -83,6 +99,7 @@ files:
83
99
  - README.md
84
100
  - Rakefile
85
101
  - bin/console
102
+ - bin/json_checker
86
103
  - bin/setup
87
104
  - json-config.json
88
105
  - json_checker.gemspec