yaml_structure_checker 0.1.0 → 0.1.2

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
  SHA256:
3
- metadata.gz: c5b1ce6fcb49b5f7a073c2f0192e764bd31cd2548913fc142417f2177201049e
4
- data.tar.gz: a21da4ba0ac21d7739ddaa274f7aad1a8fcf2a55dcf79376b64f4971e75a5bec
3
+ metadata.gz: 1c38cb26e3b2a6f824f9389805104bcddd59bc303d9293d687a9263eebf5f7ff
4
+ data.tar.gz: c0d8317b0de539c992d4e7a2819fff410ee490576002451285f59e5adcbc8e52
5
5
  SHA512:
6
- metadata.gz: 3253e65b6567752fec9a7bd2bfeb014a89f81c52e2790bfa9f0bafa50e3f3bca3dbcf4bc6eaae6bb1ec9b0a1a6cdfccbed01ea3c74a91f3510bb34a1968b906d
7
- data.tar.gz: 0e945ec8fc8b7bd4a308355b8873a46ee751fa954363ca51b8d8bc51b4cf62e7718721986b11576fb9c6608e6f808215edd6521e2788ed0f403b90a905e0d4d0
6
+ metadata.gz: 7af40b7d4a6bb86a6323e56afc2bd1f2b1d7c8fafd02c919de3764f761687ce6fc1b6368b7c6381ec2af31f9bb91fd0a949994acd2d771bd461d2ff91fc343f7
7
+ data.tar.gz: 2e5d869036f22461cc4367f7b676768823d0d65209e8d6d47ef52f47c907e48bcede840a3112ff307b2a277c0c77ba23964e3276e311e37c792242d6be19f4c2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yaml_structure_checker (0.1.0)
4
+ yaml_structure_checker (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -23,6 +23,7 @@ GEM
23
23
  rspec-support (3.12.0)
24
24
 
25
25
  PLATFORMS
26
+ ruby
26
27
  x86_64-linux
27
28
 
28
29
  DEPENDENCIES
data/README.md CHANGED
@@ -1,18 +1,74 @@
1
- # Yaml structure checker
1
+ ![thumbnail](yaml_structure_checker.png)
2
+
3
+ # YAML structure checker
2
4
 
3
5
  This Gem can detect that the keys in the yaml file do not match for each environment.
4
6
 
7
+ This prevents cases where errors occur only in the production environment.
8
+
9
+ It works powerfully in Rails, but of course it can be used in other applications as well.
10
+
11
+ The following is an example
12
+
13
+ ```yaml
14
+ # This file is OK.
15
+ development: &default
16
+ db:
17
+ username: username
18
+ password: password
19
+
20
+ test:
21
+ <<: *default
22
+
23
+ integration:
24
+ <<: *default
25
+
26
+ production:
27
+ <<: *default
28
+ db:
29
+ username: <%= ENV['DATABASE_UERNAME'] %>
30
+ password: <%= ENV['DATABASE_PASSWORD'] %>
31
+ ```
32
+
33
+ ```yaml
34
+ # This file is NG. Raises an exception.
35
+ development: &default
36
+ db:
37
+ username: username
38
+ password: password
39
+
40
+ test:
41
+ <<: *default
42
+
43
+ integration:
44
+ <<: *default
45
+
46
+ production:
47
+ <<: *default
48
+ db:
49
+ username: <%= ENV['DATABASE_UERNAME'] %>
50
+ password: <%= ENV['DATABASE_PASSWORD'] %>
51
+ ```
52
+
5
53
  ## Installation
6
54
 
7
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
55
+ Add this line to your application's Gemfile:
8
56
 
9
- Install the gem and add to the application's Gemfile by executing:
57
+ ```ruby
58
+ gem 'yaml_structure_checker'
59
+ ```
10
60
 
11
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
61
+ And then execute:
12
62
 
13
- If bundler is not being used to manage dependencies, install the gem by executing:
63
+ ```bash
64
+ $ bundle
65
+ ```
14
66
 
15
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
67
+ Or install it yourself as:
68
+
69
+ ```bash
70
+ $ gem install yaml_structure_checker
71
+ ```
16
72
 
17
73
  ## Usage
18
74
 
@@ -20,7 +76,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
20
76
 
21
77
  Add the configuration file `config/yaml_structure_checker.yml`.
22
78
 
23
- Yaml structure checker loads `config/yaml_structure_checker.yml` by default.
79
+ YAML structure checker loads `config/yaml_structure_checker.yml` by default.
24
80
 
25
81
  An example follows
26
82
 
@@ -49,13 +105,13 @@ skip_paths:
49
105
 
50
106
  ### Check yaml files
51
107
 
52
- Run the `yaml_structure_checker` command to check your Yaml files.
108
+ Run the `yaml_structure_checker` command to check your YAML files.
53
109
 
54
110
  ```bash
55
111
  $ bundle exec yaml_structure_checker
56
112
 
57
113
  #################################
58
- # Yaml Structure Check #
114
+ # YAML Structure Check #
59
115
  #################################
60
116
 
61
117
  Exclude paths:
@@ -75,7 +131,7 @@ Result: OK
75
131
  Result: OK
76
132
 
77
133
  #################################
78
- # Yaml Structure Check Result #
134
+ # YAML Structure Check Result #
79
135
  #################################
80
136
 
81
137
  NG paths:
@@ -115,7 +171,7 @@ jobs:
115
171
  - uses: actions/checkout@v2
116
172
  - name: Bundle install
117
173
  run: bundle install --path=vendor/bundle --jobs 4 --retry 3
118
- - name: Yaml structure checker
174
+ - name: YAML structure checker
119
175
  run: bundle exec yaml_structure_checker
120
176
  ```
121
177
 
@@ -125,9 +181,15 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
125
181
 
126
182
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
127
183
 
184
+ Also, you can use Docker.
185
+
186
+ ```bash
187
+ docker-compose run --rm app /bin/bash
188
+ ```
189
+
128
190
  ## Contributing
129
191
 
130
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yaml_structure_checker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/yaml_structure_checker/blob/master/CODE_OF_CONDUCT.md).
192
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yosipy/yaml_structure_checker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/yosipy/yaml_structure_checker/blob/master/CODE_OF_CONDUCT.md).
131
193
 
132
194
  ## License
133
195
 
@@ -135,4 +197,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
135
197
 
136
198
  ## Code of Conduct
137
199
 
138
- Everyone interacting in the YamlStructureChecker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/yaml_structure_checker/blob/master/CODE_OF_CONDUCT.md).
200
+ Everyone interacting in the YAMLStructureChecker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yosipy/yaml_structure_checker/blob/master/CODE_OF_CONDUCT.md).
@@ -7,4 +7,4 @@ if !ARGV.empty?
7
7
  settings_path = ARGV.first
8
8
  end
9
9
 
10
- YamlStructureChecker::Runner.invoke(settings_path)
10
+ YAMLStructureChecker::Runner.invoke(settings_path)
@@ -1,4 +1,4 @@
1
- module YamlStructureChecker
1
+ module YAMLStructureChecker
2
2
  class Checker
3
3
  attr_accessor :ok_count,
4
4
  :ng_count,
@@ -110,14 +110,14 @@ module YamlStructureChecker
110
110
 
111
111
  def print_start_title
112
112
  puts "#################################"
113
- puts "# Yaml Structure Check #"
113
+ puts "# YAML Structure Check #"
114
114
  puts "#################################"
115
115
  puts "\n"
116
116
  end
117
117
 
118
118
  def print_result_title
119
119
  puts "#################################"
120
- puts "# Yaml Structure Check Result #"
120
+ puts "# YAML Structure Check Result #"
121
121
  puts "#################################"
122
122
  puts "\n"
123
123
  end
@@ -1,4 +1,4 @@
1
- module YamlStructureChecker
1
+ module YAMLStructureChecker
2
2
  class Converter
3
3
  # [example]
4
4
  # args:
@@ -1,4 +1,4 @@
1
- module YamlStructureChecker
1
+ module YAMLStructureChecker
2
2
  module Errors
3
3
  class LoaderError < StandardError;end
4
4
  class StructureError < StandardError;end
@@ -1,6 +1,6 @@
1
1
  require 'yaml'
2
2
 
3
- module YamlStructureChecker
3
+ module YAMLStructureChecker
4
4
  class Loader
5
5
  attr_accessor :include_patterns,
6
6
  :exclude_patterns,
@@ -12,7 +12,7 @@ module YamlStructureChecker
12
12
  begin
13
13
  Loader.yaml_safe_load_file(settings_path)
14
14
  rescue => e
15
- puts "Not found YamlStructureChecker's settings file."
15
+ puts "Not found YAMLStructureChecker's settings file."
16
16
  raise e
17
17
  end
18
18
 
@@ -25,7 +25,7 @@ module YamlStructureChecker
25
25
  end
26
26
 
27
27
  def self.yaml_load_file(path)
28
- if RUBY_VERSION > '3.1.0'
28
+ if Psych::VERSION > '4.0.0'
29
29
  YAML.load_file(path, aliases: true)
30
30
  else
31
31
  YAML.load_file(path)
@@ -33,7 +33,7 @@ module YamlStructureChecker
33
33
  end
34
34
 
35
35
  def self.yaml_safe_load_file(path)
36
- if RUBY_VERSION > '3.1.0'
36
+ if Psych::VERSION > '4.0.0'
37
37
  YAML.safe_load_file(path)
38
38
  else
39
39
  YAML.load_file(path)
@@ -69,7 +69,7 @@ module YamlStructureChecker
69
69
  def exist_files?(paths)
70
70
  paths.each do |path|
71
71
  unless File.exist?(path)
72
- raise YamlStructureChecker::Errors::LoaderError, "Not found '#{path}'"
72
+ raise YAMLStructureChecker::Errors::LoaderError, "Not found '#{path}'"
73
73
  end
74
74
  end
75
75
 
@@ -1,6 +1,10 @@
1
- module YamlStructureChecker
1
+ module YAMLStructureChecker
2
2
  class Runner
3
- def self.invoke(settings_path='config/yaml_structure_checker.yml')
3
+ def self.invoke(settings_path)
4
+ if settings_path.nil?
5
+ settings_path='config/yaml_structure_checker.yml'
6
+ end
7
+
4
8
  Checker.new.test_yamls(settings_path)
5
9
  end
6
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module YamlStructureChecker
4
- VERSION = "0.1.0"
3
+ module YAMLStructureChecker
4
+ VERSION = "0.1.2"
5
5
  end
@@ -1,4 +1,4 @@
1
- module YamlStructureChecker
1
+ module YAMLStructureChecker
2
2
  VERSION: String
3
3
  # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
4
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/yaml_structure_checker/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "yaml_structure_checker"
7
+ spec.version = YAMLStructureChecker::VERSION
8
+ spec.authors = ["yosipy"]
9
+ spec.email = ["yosi.contact@gmail.com"]
10
+
11
+ spec.summary = "YAML structure checker in ruby"
12
+ spec.description = "This Gem can detect that the keys in the yaml file do not match for each environment. This prevents cases where errors occur only in the production environment."
13
+ spec.homepage = "https://github.com/yosipy/yaml_structure_checker"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = ""
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/yosipy/yaml_structure_checker"
21
+ spec.metadata["changelog_uri"] = "https://github.com/yosipy/yaml_structure_checker/blob/main/CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
28
+ end
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = %w[yaml_structure_checker]
32
+ spec.require_paths = ["lib"]
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
Binary file
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml_structure_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yosipy
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-09 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description: This Gem can detect that the keys in the yaml file do not match for each
14
+ environment. This prevents cases where errors occur only in the production environment.
14
15
  email:
15
16
  - yosi.contact@gmail.com
16
17
  executables:
@@ -25,7 +26,6 @@ files:
25
26
  - Gemfile
26
27
  - Gemfile.lock
27
28
  - LICENSE
28
- - LICENSE.txt
29
29
  - README.md
30
30
  - Rakefile
31
31
  - docker-compose.yml
@@ -38,6 +38,8 @@ files:
38
38
  - lib/yaml_structure_checker/runner.rb
39
39
  - lib/yaml_structure_checker/version.rb
40
40
  - sig/yaml_structure_checker.rbs
41
+ - yaml_structure_checker.gemspec
42
+ - yaml_structure_checker.png
41
43
  homepage: https://github.com/yosipy/yaml_structure_checker
42
44
  licenses:
43
45
  - MIT
@@ -45,7 +47,7 @@ metadata:
45
47
  homepage_uri: https://github.com/yosipy/yaml_structure_checker
46
48
  source_code_uri: https://github.com/yosipy/yaml_structure_checker
47
49
  changelog_uri: https://github.com/yosipy/yaml_structure_checker/blob/main/CHANGELOG.md
48
- post_install_message:
50
+ post_install_message:
49
51
  rdoc_options: []
50
52
  require_paths:
51
53
  - lib
@@ -60,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
62
  - !ruby/object:Gem::Version
61
63
  version: '0'
62
64
  requirements: []
63
- rubygems_version: 3.2.32
64
- signing_key:
65
+ rubygems_version: 3.1.4
66
+ signing_key:
65
67
  specification_version: 4
66
- summary: This Gem verifies that the structure of the Yaml file is consistent for each
67
- environment.
68
+ summary: YAML structure checker in ruby
68
69
  test_files: []
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2023 TODO: Write your name
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.