settingson 1.3.3 → 1.3.4

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: 6a77885b41ca726f823a234d80a0c44050fb73e9
4
- data.tar.gz: e1a4139d33964310e1a3e25bd4944f4376919f6f
3
+ metadata.gz: 8bc944517c38509cc56dc881c8e0516b019f4a98
4
+ data.tar.gz: cc3effd4a6a30541a13c3eae25beec238571ceee
5
5
  SHA512:
6
- metadata.gz: bb589bb44a7d0c460d0c23024ee465c7477aa843ec39dbd9f774a0eb8f1c308ffd41cfe327cf7a3eb4233b6f19616b6694a074f90dae8f1d746ef56919de9ec6
7
- data.tar.gz: 9d569fefd9845fea7d5ae67bbf21b4695cfe17c2414ffb696343fe8d0a28057479a8e89b7b1cc42539bb24197fcbb48ed40e7b19d92154e73e9db9cc7e9898c2
6
+ metadata.gz: 1874fc31728b47857277247b9c99edce5403a4222cbe38e8ae7ff70de7acb4b38cb3ef77ee88ba39e5818f7ad4488e41bd638b7189f3ec2c7410011628484454
7
+ data.tar.gz: 3e27762c7bba87480c3c9adc8bcd50140845d6d55f0d2dd97756b5188ad182080b8e0af9701110ff52b0c74c67f418b7de948644f3a4823e69a4156c8cad3ace
data/.gitignore CHANGED
@@ -22,5 +22,4 @@ tmp
22
22
  mkmf.log
23
23
  spec/dummy/db/development.sqlite3
24
24
  spec/dummy/db/test.sqlite3
25
- spec/dummy/log/development.log
26
- spec/dummy/log/test.log
25
+ spec/dummy/log/*
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
+ script: rspec
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/settingson.svg)](http://badge.fury.io/rb/settingson)
2
+ [![Build Status](https://travis-ci.org/daanforever/settingson.svg?branch=master)](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
@@ -1,3 +1,3 @@
1
1
  module Settingson
2
- VERSION = "1.3.3"
2
+ VERSION = "1.3.4"
3
3
  end
@@ -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.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-09-24 00:00:00.000000000 Z
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