sengiri_yaml 0.0.1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +88 -0
- data/CHANGELOG.md +34 -0
- data/README.md +21 -2
- data/lib/sengiri_yaml/loader.rb +4 -3
- data/lib/sengiri_yaml/version.rb +1 -1
- data/lib/sengiri_yaml.rb +2 -2
- data/sengiri_yaml.gemspec +8 -1
- data/spec/bin/sengitri_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +20 -18
- data/.hound.yml +0 -25
- data/.travis.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7bd8b9cce07c06c68b1afe9572d7ed0e37679dfb172a2cf7e673107d43d3e1e8
|
4
|
+
data.tar.gz: 5fe177fcc8b1d4aa661e83bd4b8754828c10d7a598f046877f36acd3bdf01cf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0e10879374694eb46a7013a2fb43756b950935e14985531d2a4e74650bee7bae5aad5dfc5f35aaef75d927908fc6e7cf242b9d09e42c95391ef988a71782fb5
|
7
|
+
data.tar.gz: f171330249493e1aec31d6a1a4bc13f2e6a6f30344f5b6ee89e68fbd677b238dfed7bec7000f8a8d70b0c7b5290327c114edf311b912984bc75d3d895f96dc04
|
@@ -0,0 +1,88 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
- synchronize
|
11
|
+
- reopened
|
12
|
+
schedule:
|
13
|
+
- cron: "0 10 * * 5" # JST 19:00 (Fri)
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
test:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
|
19
|
+
container: ${{ matrix.ruby }}
|
20
|
+
|
21
|
+
strategy:
|
22
|
+
fail-fast: false
|
23
|
+
|
24
|
+
matrix:
|
25
|
+
ruby:
|
26
|
+
- ruby:2.6
|
27
|
+
- ruby:2.7
|
28
|
+
- ruby:3.0
|
29
|
+
- ruby:3.1
|
30
|
+
- rubylang/ruby:master-nightly-bionic
|
31
|
+
include:
|
32
|
+
- ruby: rubylang/ruby:master-nightly-bionic
|
33
|
+
allow_failures: "true"
|
34
|
+
|
35
|
+
steps:
|
36
|
+
- uses: actions/checkout@v2
|
37
|
+
|
38
|
+
- name: Cache vendor/bundle
|
39
|
+
uses: actions/cache@v1
|
40
|
+
id: cache_gem
|
41
|
+
with:
|
42
|
+
path: vendor/bundle
|
43
|
+
key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
|
44
|
+
restore-keys: |
|
45
|
+
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
|
46
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
47
|
+
|
48
|
+
- name: bundle update
|
49
|
+
run: |
|
50
|
+
set -xe
|
51
|
+
bundle config path vendor/bundle
|
52
|
+
bundle update --jobs $(nproc) --retry 3
|
53
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
54
|
+
|
55
|
+
- name: Run test
|
56
|
+
run: |
|
57
|
+
set -xe
|
58
|
+
bundle exec rspec
|
59
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
60
|
+
|
61
|
+
- name: Slack Notification (not success)
|
62
|
+
uses: lazy-actions/slatify@master
|
63
|
+
if: "! success()"
|
64
|
+
continue-on-error: true
|
65
|
+
with:
|
66
|
+
job_name: ${{ format('*build* ({0})', matrix.ruby) }}
|
67
|
+
type: ${{ job.status }}
|
68
|
+
icon_emoji: ":octocat:"
|
69
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
70
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
71
|
+
|
72
|
+
notify:
|
73
|
+
needs:
|
74
|
+
- test
|
75
|
+
|
76
|
+
runs-on: ubuntu-latest
|
77
|
+
|
78
|
+
steps:
|
79
|
+
- name: Slack Notification (success)
|
80
|
+
uses: lazy-actions/slatify@master
|
81
|
+
if: always()
|
82
|
+
continue-on-error: true
|
83
|
+
with:
|
84
|
+
job_name: '*build*'
|
85
|
+
type: ${{ job.status }}
|
86
|
+
icon_emoji: ":octocat:"
|
87
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
88
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v0.0.4](https://github.com/sue445/sengiri_yaml/tree/v0.0.4) (2021-11-20)
|
4
|
+
[Full Changelog](https://github.com/sue445/sengiri_yaml/compare/v0.0.3...v0.0.4)
|
5
|
+
|
6
|
+
* Enable MFA requirement for gem releasing
|
7
|
+
* https://github.com/sue445/sengiri_yaml/pull/24
|
8
|
+
|
9
|
+
## [v0.0.3](https://github.com/sue445/sengiri_yaml/tree/v0.0.3) (2016-04-26)
|
10
|
+
[Full Changelog](https://github.com/sue445/sengiri_yaml/compare/v0.0.2...v0.0.3)
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Load yaml file with order by filename [\#5](https://github.com/sue445/sengiri_yaml/pull/5) ([sue445](https://github.com/sue445))
|
15
|
+
|
16
|
+
## [v0.0.2](https://github.com/sue445/sengiri_yaml/tree/v0.0.2) (2015-01-26)
|
17
|
+
[Full Changelog](https://github.com/sue445/sengiri_yaml/compare/v0.0.1...v0.0.2)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Bugfix: NameError in irb [\#3](https://github.com/sue445/sengiri_yaml/pull/3) ([sue445](https://github.com/sue445))
|
22
|
+
|
23
|
+
## [v0.0.1](https://github.com/sue445/sengiri_yaml/tree/v0.0.1) (2014-12-31)
|
24
|
+
[Full Changelog](https://github.com/sue445/sengiri_yaml/compare/v0.0.1.beta1...v0.0.1)
|
25
|
+
|
26
|
+
## [v0.0.1.beta1](https://github.com/sue445/sengiri_yaml/tree/v0.0.1.beta1) (2014-12-31)
|
27
|
+
**Merged pull requests:**
|
28
|
+
|
29
|
+
- Feature/loader [\#2](https://github.com/sue445/sengiri_yaml/pull/2) ([sue445](https://github.com/sue445))
|
30
|
+
- Impl executable file [\#1](https://github.com/sue445/sengiri_yaml/pull/1) ([sue445](https://github.com/sue445))
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# SengiriYaml
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/sengiri_yaml.svg)](http://badge.fury.io/rb/sengiri_yaml)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/sue445/sengiri_yaml/workflows/test/badge.svg?branch=master)](https://github.com/sue445/sengiri_yaml/actions?query=workflow%3Atest)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/sue445/sengiri_yaml/badges/gpa.svg)](https://codeclimate.com/github/sue445/sengiri_yaml)
|
6
6
|
[![Coverage Status](https://img.shields.io/coveralls/sue445/sengiri_yaml.svg)](https://coveralls.io/r/sue445/sengiri_yaml)
|
7
|
-
[![Dependency Status](https://gemnasium.com/sue445/sengiri_yaml.svg)](https://gemnasium.com/sue445/sengiri_yaml)
|
8
7
|
|
9
8
|
divide yaml file
|
10
9
|
|
@@ -28,12 +27,32 @@ Or install it yourself as:
|
|
28
27
|
|
29
28
|
### divide yaml
|
30
29
|
```bash
|
30
|
+
$ cat "/path/to/fat.yml"
|
31
|
+
- data1: data1
|
32
|
+
value: 1
|
33
|
+
- data2: data2
|
34
|
+
value: 2
|
35
|
+
|
31
36
|
$ sengiri_yaml "/path/to/fat.yml" "/path/to/fat_dir"
|
37
|
+
|
38
|
+
$ ls "/path/to/fat_dir"
|
39
|
+
data1.yml data2.yml
|
40
|
+
|
41
|
+
$ cat data1.yml
|
42
|
+
---
|
43
|
+
- data1: data1
|
44
|
+
value: 1
|
45
|
+
|
46
|
+
$ cat data2.yml
|
47
|
+
---
|
48
|
+
- data2: data2
|
49
|
+
value: 2
|
32
50
|
```
|
33
51
|
|
34
52
|
### load divided yaml
|
35
53
|
```ruby
|
36
54
|
merged_data = SengiriYaml.load_dir("/path/to/fat_dir")
|
55
|
+
# => [{"data1" => "data1", "value" => 1}, {"data2" => "data2", "value" => 2}]
|
37
56
|
```
|
38
57
|
|
39
58
|
## Contributing
|
data/lib/sengiri_yaml/loader.rb
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
module SengiriYaml
|
2
2
|
require "yaml"
|
3
|
+
require "pathname"
|
3
4
|
|
4
5
|
class Loader
|
5
6
|
# load divided yaml files
|
6
7
|
# @param src_dir [String] divided yaml dir
|
7
8
|
# @return [Hash] merged yaml hash
|
8
|
-
def load_dir(src_dir)
|
9
|
+
def load_dir(src_dir, permitted_classes: [], aliases: false)
|
9
10
|
merged_content = ""
|
10
11
|
|
11
|
-
Pathname.glob("#{src_dir}/*.yml") do |yaml_path|
|
12
|
+
Pathname.glob("#{src_dir}/*.yml").sort.each do |yaml_path|
|
12
13
|
content = yaml_path.read.gsub(/^---$/, "")
|
13
14
|
merged_content << content
|
14
15
|
end
|
15
16
|
|
16
|
-
YAML.
|
17
|
+
YAML.safe_load(merged_content, permitted_classes: permitted_classes, aliases: aliases)
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
data/lib/sengiri_yaml/version.rb
CHANGED
data/lib/sengiri_yaml.rb
CHANGED
@@ -7,7 +7,7 @@ module SengiriYaml
|
|
7
7
|
|
8
8
|
# load divided yaml files
|
9
9
|
# @see SengiriYaml::Loader#load_dir
|
10
|
-
def load_dir(src_dir)
|
11
|
-
SengiriYaml::Loader.new.load_dir(src_dir)
|
10
|
+
def load_dir(src_dir, permitted_classes: [], aliases: false)
|
11
|
+
SengiriYaml::Loader.new.load_dir(src_dir, permitted_classes: permitted_classes, aliases: aliases)
|
12
12
|
end
|
13
13
|
end
|
data/sengiri_yaml.gemspec
CHANGED
@@ -13,6 +13,13 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/sue445/sengiri_yaml"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
+
spec.required_ruby_version = ">= 2.6"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
20
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
21
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
22
|
+
|
16
23
|
spec.files = `git ls-files -z`.split("\x0")
|
17
24
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
@@ -20,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
20
27
|
|
21
28
|
spec.add_development_dependency "bundler"
|
22
29
|
spec.add_development_dependency "coveralls"
|
23
|
-
spec.add_development_dependency "rake"
|
30
|
+
spec.add_development_dependency "rake"
|
24
31
|
spec.add_development_dependency "rspec"
|
25
32
|
spec.add_development_dependency "rspec-power_assert"
|
26
33
|
spec.add_development_dependency "rspec-temp_dir"
|
data/spec/bin/sengitri_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
describe SengiriYaml do
|
2
2
|
describe "sengiri_yaml" do
|
3
|
-
subject {
|
3
|
+
subject { `./bin/sengiri_yaml #{option}` }
|
4
4
|
|
5
5
|
context "without 2 args" do
|
6
6
|
let(:option){ "--help" }
|
@@ -11,7 +11,7 @@ sengiri_yaml <source_yaml> <destination_dir>
|
|
11
11
|
EOS
|
12
12
|
end
|
13
13
|
|
14
|
-
it{ should
|
14
|
+
it{ should start_with help }
|
15
15
|
end
|
16
16
|
|
17
17
|
context "with 2 args" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sengiri_yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 1.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,11 +117,11 @@ extensions: []
|
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
119
|
- ".coveralls.yml"
|
120
|
+
- ".github/workflows/test.yml"
|
120
121
|
- ".gitignore"
|
121
|
-
- ".hound.yml"
|
122
122
|
- ".rspec"
|
123
|
-
- ".travis.yml"
|
124
123
|
- ".yardopts"
|
124
|
+
- CHANGELOG.md
|
125
125
|
- Gemfile
|
126
126
|
- LICENSE.txt
|
127
127
|
- README.md
|
@@ -143,8 +143,12 @@ files:
|
|
143
143
|
homepage: https://github.com/sue445/sengiri_yaml
|
144
144
|
licenses:
|
145
145
|
- MIT
|
146
|
-
metadata:
|
147
|
-
|
146
|
+
metadata:
|
147
|
+
homepage_uri: https://github.com/sue445/sengiri_yaml
|
148
|
+
source_code_uri: https://github.com/sue445/sengiri_yaml
|
149
|
+
changelog_uri: https://github.com/sue445/sengiri_yaml/blob/master/CHANGELOG.md
|
150
|
+
rubygems_mfa_required: 'true'
|
151
|
+
post_install_message:
|
148
152
|
rdoc_options: []
|
149
153
|
require_paths:
|
150
154
|
- lib
|
@@ -152,16 +156,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
156
|
requirements:
|
153
157
|
- - ">="
|
154
158
|
- !ruby/object:Gem::Version
|
155
|
-
version: '
|
159
|
+
version: '2.6'
|
156
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
161
|
requirements:
|
158
|
-
- - "
|
162
|
+
- - ">"
|
159
163
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
164
|
+
version: 1.3.1
|
161
165
|
requirements: []
|
162
|
-
|
163
|
-
|
164
|
-
signing_key:
|
166
|
+
rubygems_version: 3.3.3
|
167
|
+
signing_key:
|
165
168
|
specification_version: 4
|
166
169
|
summary: divide yaml file
|
167
170
|
test_files:
|
@@ -173,4 +176,3 @@ test_files:
|
|
173
176
|
- spec/sengiri_yaml/loader_spec.rb
|
174
177
|
- spec/sengiri_yaml/writer_spec.rb
|
175
178
|
- spec/spec_helper.rb
|
176
|
-
has_rdoc:
|
data/.hound.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Style/LineLength:
|
2
|
-
Description: 'Limit lines to 130 characters.'
|
3
|
-
Max: 130
|
4
|
-
Style/SpaceInsideParens:
|
5
|
-
Enabled: false
|
6
|
-
Style/SpaceBeforeBlockBraces:
|
7
|
-
Enabled: false
|
8
|
-
StringLiterals:
|
9
|
-
Enabled: false
|
10
|
-
Style/TrailingComma:
|
11
|
-
Enabled: false
|
12
|
-
Style/BlockComments:
|
13
|
-
Enabled: false
|
14
|
-
Style/NilComparison:
|
15
|
-
Enabled: false
|
16
|
-
Style/Documentation:
|
17
|
-
Enabled: false
|
18
|
-
Style/RegexpLiteral:
|
19
|
-
Enabled: false
|
20
|
-
Style/SignalException:
|
21
|
-
Enabled: false
|
22
|
-
Style/CaseEquality:
|
23
|
-
Enabled: false
|
24
|
-
Style/SpaceBeforeComma:
|
25
|
-
Enabled: false
|
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.1
|
4
|
-
- 2.2
|
5
|
-
- ruby-head
|
6
|
-
bundler_args: "--jobs=2"
|
7
|
-
before_script:
|
8
|
-
- export COVERAGE=true
|
9
|
-
script:
|
10
|
-
- bundle exec rspec
|
11
|
-
branches:
|
12
|
-
only:
|
13
|
-
- master
|
14
|
-
notifications:
|
15
|
-
email: false
|
16
|
-
slack:
|
17
|
-
secure: Wz6kbQXUl1J+XVLR/yt0XeI+FEiwcSNsGTsRdKBYSN1CEWnws0BwbWSN1tyRGmMXODiCAHchdGKEqgkm2Nk1/wEhBpCoF/clEeUq8fKyAIdKkEg3laBFI5dSdBm+eYcqQAdUnWeDHnQgdGT1lQBAe6tIAaN6Oqaw1v9bexvQgv8=
|
18
|
-
matrix:
|
19
|
-
allow_failures:
|
20
|
-
- rvm: ruby-head
|