settingson 1.3.3 → 1.3.4
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/.gitignore +1 -2
- data/.travis.yml +7 -0
- data/README.md +10 -0
- data/app/models/concerns/settingson/base.rb +15 -0
- data/lib/settingson/version.rb +1 -1
- data/spec/models/settings_spec.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bc944517c38509cc56dc881c8e0516b019f4a98
|
4
|
+
data.tar.gz: cc3effd4a6a30541a13c3eae25beec238571ceee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1874fc31728b47857277247b9c99edce5403a4222cbe38e8ae7ff70de7acb4b38cb3ef77ee88ba39e5818f7ad4488e41bd638b7189f3ec2c7410011628484454
|
7
|
+
data.tar.gz: 3e27762c7bba87480c3c9adc8bcd50140845d6d55f0d2dd97756b5188ad182080b8e0af9701110ff52b0c74c67f418b7de948644f3a4823e69a4156c8cad3ace
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[](http://badge.fury.io/rb/settingson)
|
2
|
+
[](https://travis-ci.org/daanforever/settingson)
|
2
3
|
|
3
4
|
# Settingson
|
4
5
|
|
@@ -65,6 +66,15 @@ end
|
|
65
66
|
|
66
67
|
## The initial values
|
67
68
|
in config/initializers/settingson.rb
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
Settings.defaults do
|
72
|
+
Settings.server.smtp.host? || Settings.server.smtp.host = 'host'
|
73
|
+
Settings.server.smtp.port? || Settings.server.smtp.port = 25
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
Old way:
|
68
78
|
```ruby
|
69
79
|
Rails.application.config.after_initialize do
|
70
80
|
begin
|
@@ -71,6 +71,21 @@ module Settingson::Base
|
|
71
71
|
|
72
72
|
module ClassMethods
|
73
73
|
|
74
|
+
# Settings.defaults do
|
75
|
+
# Settings.server.host? || Settings.server.host = 'host'
|
76
|
+
# Settings.server.port? || Settings.server.port = 80
|
77
|
+
# end
|
78
|
+
|
79
|
+
def defaults(&block)
|
80
|
+
Rails.application.config.after_initialize do
|
81
|
+
begin
|
82
|
+
yield
|
83
|
+
rescue
|
84
|
+
Rails.logger.warn('Settingson::defaults failed')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
74
89
|
def from_hash(attributes)
|
75
90
|
case attributes
|
76
91
|
when Hash
|
data/lib/settingson/version.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Settings do
|
4
|
+
|
5
|
+
describe 'Settings.defaults' do
|
6
|
+
# very bad spec. TODO: rewrite me
|
7
|
+
it 'not raises errors' do
|
8
|
+
expect{ Settings.default {} }.to_not raise_error
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
it 'not raises error on create new instance of Settings' do
|
5
13
|
expect{ Settings.new }.to_not raise_error
|
6
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: settingson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".rspec"
|
134
|
+
- ".travis.yml"
|
134
135
|
- Gemfile
|
135
136
|
- LICENSE.txt
|
136
137
|
- README.md
|