sting 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -14
- data/lib/sting/sting_operations.rb +2 -2
- data/lib/sting/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77ebd9865493f7bf5e730887e21d3135890e83e3821c4a535b5f297f8a8f1b0e
|
4
|
+
data.tar.gz: f7861560d35d602af3ff191dc5cb34982ef93f5d2b9d78106fc540342fd7a91b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16ac444021d76374bb8b4740d7d3df4409e3429f78f5a75452b495a45a9ecb1b5d49db22109b89186173694a1abb7abc7bad8be39204c57ba59759cbaa50c305
|
7
|
+
data.tar.gz: c507c79bc80508587479c33e0e8df719ad1b19488c4916885ea3f4aeefdfae3361702893c4d2d73be80cc6b7c4d43d88e01927aa2f5731d6761debfabe8470f9
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
Sting - Minimal Settings Library
|
2
|
-
==================================================
|
1
|
+
# Sting - Minimal Settings Library
|
3
2
|
|
4
3
|
[](https://badge.fury.io/rb/sting)
|
5
4
|
[](https://github.com/DannyBen/sting/actions?query=workflow%3ATest)
|
@@ -11,16 +10,14 @@ Sting is a minimal, lightweight, multi-YAML settings library.
|
|
11
10
|
|
12
11
|
---
|
13
12
|
|
14
|
-
Installation
|
15
|
-
--------------------------------------------------
|
13
|
+
## Installation
|
16
14
|
|
17
15
|
```shell
|
18
16
|
$ gem install sting
|
19
17
|
```
|
20
18
|
|
21
19
|
|
22
|
-
Features
|
23
|
-
--------------------------------------------------
|
20
|
+
## Features
|
24
21
|
|
25
22
|
- [Aggressively minimalistic][1].
|
26
23
|
- Settings are accessible through a globally available class.
|
@@ -32,17 +29,14 @@ Features
|
|
32
29
|
- ERB code in the YAML files will be evaluated.
|
33
30
|
|
34
31
|
|
35
|
-
Nonfeatures
|
36
|
-
--------------------------------------------------
|
32
|
+
## Nonfeatures
|
37
33
|
|
38
|
-
- No dot notation access to nested values - Use `Settings.server['host']`
|
39
|
-
instead of `Settings.server.host`.
|
34
|
+
- No dot notation access to nested values - Use `Settings.server['host']` instead of `Settings.server.host`.
|
40
35
|
- No special generators for Rails.
|
41
36
|
[Usage with rails is still trivial](#using-with-rails).
|
42
37
|
|
43
38
|
|
44
|
-
Usage
|
45
|
-
--------------------------------------------------
|
39
|
+
## Usage
|
46
40
|
|
47
41
|
### Using as a singleton class
|
48
42
|
|
@@ -65,6 +59,12 @@ Settings.push 'one'
|
|
65
59
|
# Merge with another options hash
|
66
60
|
Settings << { port: 3000, host: 'localhost' }
|
67
61
|
|
62
|
+
# Load all files from a directory
|
63
|
+
Settings << "dir/that-contains/yamls"
|
64
|
+
|
65
|
+
# Load all files from a directory, recursively
|
66
|
+
Settings << "dir/that-contains/yamls/**/*.yml"
|
67
|
+
|
68
68
|
# Access values
|
69
69
|
p Settings.host
|
70
70
|
p Settings['host']
|
@@ -130,8 +130,7 @@ extends:
|
|
130
130
|
```
|
131
131
|
|
132
132
|
|
133
|
-
Using with Rails
|
134
|
-
--------------------------------------------------
|
133
|
+
## Using with Rails
|
135
134
|
|
136
135
|
You can use this however you wish in Rails. This is the recommended
|
137
136
|
implementation:
|
@@ -11,10 +11,10 @@ class Sting
|
|
11
11
|
content = source.collect{ |k,v| [k.to_s, v] }.to_h
|
12
12
|
|
13
13
|
elsif source.include? '*'
|
14
|
-
Dir["#{source}"].each { |file| push file }
|
14
|
+
Dir["#{source}"].sort.each { |file| push file }
|
15
15
|
|
16
16
|
elsif File.directory? source
|
17
|
-
Dir["#{source}/*.yml"].each { |file| push file }
|
17
|
+
Dir["#{source}/*.yml"].sort.each { |file| push file }
|
18
18
|
|
19
19
|
else
|
20
20
|
source = "#{source}.yml" unless source =~ /\.ya?ml$/
|
data/lib/sting/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: extended_yaml
|