refinerycms-settings-initializer 0.9 → 0.9.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.
@@ -8,12 +8,12 @@ module Refinery
8
8
  end
9
9
 
10
10
  def load
11
- @settings.map do |scope, settings|
12
- settings.map do |name, value|
11
+ settings.map do |scope, children|
12
+ children.map do |name, value|
13
13
  [name, transform_value(value, scope)]
14
14
  end
15
- end.flatten(1).each do |setting|
16
- RefinerySetting.set(setting.first, setting.last)
15
+ end.flatten(1).each do |name, options|
16
+ RefinerySetting.set(name, options)
17
17
  end
18
18
  end
19
19
 
@@ -26,7 +26,6 @@ module Refinery
26
26
  def symbolize_keys(value)
27
27
  Hash[value.map{|k, v| [k.to_sym, v]}]
28
28
  end
29
-
30
29
  end
31
30
  end
32
31
  end
@@ -1,6 +1,6 @@
1
1
  module Refinery
2
2
  module SettingsInitializer
3
- VERSION = "0.9"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
6
6
 
data/readme.md CHANGED
@@ -0,0 +1,73 @@
1
+ # Refinery CMS Settings Initializer
2
+
3
+ An initializer for RefinerySettings that updates settings from a configuration
4
+ file on Rails start. This can be useful to maintain identical configuration
5
+ across staging and production environments. This gem is probably more useful
6
+ for existing apps that integrate with Refinery CMS than for apps that are
7
+ solely Refinery CMS.
8
+
9
+ ## Warning
10
+
11
+ If a setting is managed by the settings initializer, the initializer will
12
+ overwrite any changes made to the setting from within the Refinery admin
13
+ console on server restart / re-deploy.
14
+
15
+ ## Requirements
16
+
17
+ Refinery CMS version 1.0.0. This has not been tested with versions greater
18
+ than that.
19
+
20
+ ## Install
21
+
22
+ Open up your ``Gemfile`` and add at the bottom this line:
23
+
24
+ gem 'refinerycms-settings-initialzer', '~> 0.9'
25
+
26
+ Now, run ``bundle install``
27
+
28
+ Next, to install the initializer and stubbed out configuration file, run this
29
+ generator:
30
+
31
+ bundle exec rails g refinery:settings_initializer
32
+
33
+ Finally, update settings in ``config/refinery/settings.yml`` that you wish to
34
+ maintain.
35
+
36
+ ## Configuration File
37
+
38
+ The settings configuration file lives at ``config/refinery/settings.yml``. The
39
+ configuration follows this format:
40
+
41
+ scoping:
42
+ setting_name:
43
+ value: *setting_value*
44
+ destroyable: *(optional)*
45
+ ... (additional setting options)
46
+ setting_name_2:
47
+ value: *setting_2_value*
48
+
49
+ unscoped:
50
+ unscoped_setting_name:
51
+ value: *unscoped_setting_value*
52
+
53
+ At the top level of the configuration file are scopings (e.g., pages, blog,
54
+ etc.). For settings that do not have a scoping, place them under ``unscoped``.
55
+
56
+ ## Example Configuration File
57
+
58
+ Here is an example configuration file. Note that ``user_image_sizes``'s value
59
+ pre-fixes the hash keys with a colon in order to create symbols.
60
+
61
+ pages:
62
+ use_marketable_urls:
63
+ value: false
64
+
65
+ unscoped:
66
+ user_image_sizes:
67
+ destroyable: false
68
+ value:
69
+ :large: "580x580>"
70
+ :medium: "280x280>"
71
+ :small: "120x120>"
72
+
73
+
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-settings-initializer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- version: "0.9"
9
+ - 1
10
+ version: 0.9.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Kyle Wilkinson