setting_accessors 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5556d06d931218cf2828932793eec26f482bcbf1
4
- data.tar.gz: 8b6a4a5541cf10d19544331c988498540c92d16d
3
+ metadata.gz: 3114ad72cb4a99f7e984b750a81bb1ea4acff3d3
4
+ data.tar.gz: 04bd6c11d031bca8467190cd32fa47010aa1af27
5
5
  SHA512:
6
- metadata.gz: 70cd7230d3b760a246697282b44d0f132aa9fe5cb92e2a26eaae37c24dfb28bbdc29d647a36e85190e9287d3ff90bf0bd9aad6d9ec860bfe8f43b194a69f5a47
7
- data.tar.gz: 89cc704ede8fc29558a4443be76ab2b80d74f7b9c5419003c2fe2d800036b92e78302e40b02a5b830e72eca63a7b84da88929e5dc11128ff0dbe88fafa397f8c
6
+ metadata.gz: 3bbfb279bb02f9e4ac1235a5200c56100607ca2b27797974635732999399bd832e190ea3fd4c70ae9616ae9dd34c77b1a2450d204b657c3cca39b2c9686a54e9
7
+ data.tar.gz: 0fd5e574b4687d9054c8e0983c9b8d455eebd441be70d43a7dacc50bb4f3bc556532b3d10d22024199e3d8fd10dd465326def7d245c9f914ab44ab7ac8295cd0
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ cache: bundler
3
+
4
+ rvm:
5
+ - 2.0.0
6
+ - 2.1
7
+ - 2.2
8
+
9
+ script: 'bundle exec rake'
10
+
11
+ notifications:
12
+ email:
13
+ recipients:
14
+ - stex@sterex.de
15
+ on_failure: change
16
+ on_success: never
17
+
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  SettingAccessors
2
2
  ================
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/setting_accessors.svg)](http://badge.fury.io/rb/setting_accessors)
5
+ [![Build Status](https://travis-ci.org/Stex/setting_accessors.svg?branch=master)](https://travis-ci.org/Stex/setting_accessors)
6
+
4
7
  Sometimes it's handy to keep track of various settings or attributes in ActiveRecord instances and persist them through various requests (and sessions). An example would be to store a items-per-page value for multiple tables in the application per user or probably also set default sorting directions.
5
8
 
6
9
  The only problem is, that it would be necessary to either keep hundreds of columns in the corresponding table or create a serialized attribute which would grow over time and generally be hard to manage.
data/Rakefile CHANGED
@@ -1,2 +1,30 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rdoc/task'
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = 'ArMailerRevised'
14
+ rdoc.options << '--line-numbers'
15
+ rdoc.rdoc_files.include('README.rdoc')
16
+ rdoc.rdoc_files.include('lib/**/*.rb')
17
+ end
18
+
19
+ Bundler::GemHelper.install_tasks
20
+
21
+ require 'rake/testtask'
22
+
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'lib'
25
+ t.libs << 'test'
26
+ t.pattern = 'test/**/*_test.rb'
27
+ t.verbose = false
28
+ end
29
+
30
+ task default: :test
@@ -23,14 +23,10 @@ module SettingAccessors
23
23
  migration_template 'migration.rb.erb', "db/migrate/create_#{model_name.classify.underscore.pluralize}.rb"
24
24
 
25
25
  initializer 'setting_accessors.rb', <<INIT
26
- SettingAccessors.configuration do |config|
27
-
28
- #The model your application is using for settings.
29
- #If you created it using the SettingAccessors generator, the
30
- #model name below should already be correct.
31
- config.setting_class = #{model_name}
32
-
33
- end
26
+ #The model your application is using for settings.
27
+ #If you created it using the SettingAccessors generator, the
28
+ #model name below should already be correct.
29
+ SettingAccessors.setting_class = #{model_name}
34
30
  INIT
35
31
  end
36
32
  end
@@ -1,6 +1,5 @@
1
1
  #
2
- # This file specifies all settings used in the application
3
- # (be it record specific or global).
2
+ # This file specifies all globally defined settings used in the application.
4
3
  #
5
4
  # The keys are the setting names, the values are a hash
6
5
  # containing validation options, type and default value
@@ -21,4 +20,5 @@
21
20
  # type: boolean
22
21
  # default: true
23
22
  # validations:
24
- # boolean: true
23
+ # boolean: true
24
+
@@ -32,9 +32,9 @@ module SettingAccessors
32
32
  #
33
33
  def self.global_config
34
34
  if Rails.env.test? || Rails.env.development?
35
- YAML.load(File.open(Rails.root.join('config/settings.yml'))).deep_stringify_keys
35
+ (YAML.load(File.open(Rails.root.join('config/settings.yml'))) || {}).deep_stringify_keys
36
36
  else
37
- @@config ||= YAML.load(File.open(Rails.root.join('config/settings.yml'))).deep_stringify_keys
37
+ @@config ||= (YAML.load(File.open(Rails.root.join('config/settings.yml'))) || {}).deep_stringify_keys
38
38
  end
39
39
  end
40
40
 
@@ -1,3 +1,3 @@
1
1
  module SettingAccessors
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -13,7 +13,7 @@ Rails.application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
16
+ config.serve_static_files = true
17
17
  config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setting_accessors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Exner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,6 +120,7 @@ files:
120
120
  - ".gitignore"
121
121
  - ".ruby-gemset"
122
122
  - ".ruby-version"
123
+ - ".travis.yml"
123
124
  - Gemfile
124
125
  - LICENSE.txt
125
126
  - README.md