yaml-ostruct 0.5.0 → 0.5.1

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: 59c3e433860d99b053d5a297e14aae64e2c7d974
4
- data.tar.gz: 45e4fa08cfaa323085f18fe37e10d4542438fea5
3
+ metadata.gz: eb627152d7f4fda0ae36fd7eab92d2362f88c267
4
+ data.tar.gz: aaa013d458dbfd79bf342fb48f0933f4ca97fd79
5
5
  SHA512:
6
- metadata.gz: 28590ac5beb1476c87f6ed7f4a7207199ead19610b53af5593599e267031aa1ff2f9934631a2c3cb94deddc8b7fb12cba46a6ac8f369922ae5dc0bcfe6836198
7
- data.tar.gz: 9d6c3ed7004d72e1f96968bdc3a59f3fcebe90ef8551f134645d5dc6655d21b238270015c96676d0fb244b5959983f791c8837d4ada9a87503389a715ce27f3f
6
+ metadata.gz: 7c72cd1b55b26d84b2d798bb4e8ba90933a3b20d71b3a7938c0ce2fca3913f4c201469a4614b7cd2396393a72287222f3d9de62144ee3eb2919ec74ce24f7954
7
+ data.tar.gz: 5e53a92f489b31860e5f3cbe5e884f777a70d8cc0314f144df1ca3f14036534ef036b1fc905990ea04b9e69f81b6d4eb90f18a2da2ef0a76ae33cf584667e5b9
@@ -1,4 +1,4 @@
1
1
  # yaml-ostruct gem version
2
2
  module YamlOstruct
3
- VERSION = '0.5.0'
3
+ VERSION = '0.5.1'
4
4
  end
@@ -51,15 +51,7 @@ module YamlOstruct
51
51
  Find.find(dir) do |yaml_file|
52
52
  next unless yaml_file =~ /.*\.yml$/ or yaml_file =~ /.*\.yaml$/
53
53
 
54
- new_config = begin
55
- YAML.load_file(yaml_file)
56
- rescue StandardError => e
57
- if @skip_error
58
- nil
59
- else
60
- raise e
61
- end
62
- end
54
+ new_config = load_yaml(yaml_file)
63
55
 
64
56
  attr_name = File.basename(yaml_file, File.extname(yaml_file)).to_sym
65
57
  if config.respond_to?(attr_name)
@@ -76,6 +68,7 @@ module YamlOstruct
76
68
 
77
69
  def load_recursively_with_path(dir, config)
78
70
  files = Dir.entries(dir)
71
+
79
72
  files.each do |file_name|
80
73
  next if file_name.start_with?('.')
81
74
  if File.directory?("#{dir}/#{file_name}")
@@ -86,18 +79,19 @@ module YamlOstruct
86
79
  extension = File.extname(file_name)
87
80
  next unless extension == '.yml' or extension == '.yaml'
88
81
 
89
- new_config = begin
90
- YAML.load_file("#{dir}/#{file_name}")
91
- rescue StandardError => e
92
- if @skip_error
93
- nil
94
- else
95
- raise e
96
- end
97
- end
82
+ new_config = load_yaml("#{dir}/#{file_name}")
83
+
98
84
  config.send("#{File.basename(file_name, extension)}=", new_config.to_hashugar)
99
85
  end
86
+
100
87
  config
101
88
  end
89
+
90
+ def load_yaml(file_name)
91
+ YAML.load_file(file_name)
92
+ rescue StandardError => e
93
+ raise e unless @skip_error
94
+ nil
95
+ end
102
96
  end
103
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-ostruct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Han
@@ -14,28 +14,28 @@ dependencies:
14
14
  name: hashugar
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: deep_merge
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  description: Read yaml files recursively from a given directory and return an OpenStruct
@@ -45,9 +45,9 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - lib/yaml/ostruct.rb
49
- - lib/yaml/version.rb
50
48
  - lib/yaml/yaml_ostruct_impl.rb
49
+ - lib/yaml/ostruct.rb
50
+ - lib/version.rb
51
51
  homepage: https://github.com/hex0cter/yaml-ostruct
52
52
  licenses:
53
53
  - MIT
@@ -58,17 +58,17 @@ require_paths:
58
58
  - lib
59
59
  required_ruby_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
61
+ - - '>='
62
62
  - !ruby/object:Gem::Version
63
63
  version: 2.0.0
64
64
  required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 2.5.1
71
+ rubygems_version: 2.0.14.1
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: Read yaml files with path into an OpenStruct