refinerycms-settings 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c63b128a70282fdcf67dad43bfa02430bfe74012
4
+ data.tar.gz: 66490d66e0fd27b668260e55a79dc497952bc5de
5
+ SHA512:
6
+ metadata.gz: 37b3ce800230ef6ce6528036d9ea8eeb13529260bcc1fe08495ae823b17e1844edadcdd3e8892ab0b86613ce2030b860eee28db75ffc87325b8a695c64b702a4
7
+ data.tar.gz: 1ac20bb6ed79030cfd20a7b27bdadaf17eeafd7447c2967d421ec186cf18acc212e80dc4ee1559ca1b8dbce07d922a9f3f3706b391acf028ddbebc9e8fc24a19
@@ -1,16 +1,36 @@
1
+ language: ruby
2
+ before_install:
3
+ - 'if [[ "$TRAVIS_RUBY_VERSION" =~ "jruby" ]] ; then gem update --system ; fi'
1
4
  before_script:
5
+ - "sh -e /etc/init.d/xvfb start"
2
6
  - "bundle exec rake refinery:testing:dummy_app > /dev/null"
3
- script: "bundle exec rspec ./spec"
7
+ script:
8
+ - "DISPLAY=:99.0 bundle exec rspec spec"
4
9
  notifications:
5
- email:
6
- - parndt@gmail.com
7
- - ugis.ozolss@gmail.com
10
+ email: true
11
+ irc:
12
+ use_notice: true
13
+ skip_join: true
14
+ channels:
15
+ - "irc.freenode.org#refinerycms"
16
+ campfire:
17
+ on_success: always
18
+ on_failure: always
19
+ rooms:
20
+ - secure: "JaX+Ckvdd2wqL2bD6t8PHvMDBHxWBlCrkBKPcDKxV0t0DOwzzzwxMryVqcRi\nPsmM/zvmWFATDyRmivhNOpu4lRg9RytSroxZ9nkmbLDqjCyEAZ6tv4yZXME/\nPaxPwmfwgS9g8TKjj3lSWS7rEpqqg0D5S0XIfIHrj6KB6LUmFHc="
8
21
  env:
9
22
  - DB=postgresql
10
23
  - DB=mysql
24
+ matrix:
25
+ allow_failures:
26
+ - rvm: rbx-18mode
27
+ - rvm: rbx-19mode
28
+ - rvm: jruby-19mode
29
+ - rvm: jruby-18mode
11
30
  rvm:
12
- - 1.8.7
13
- - 1.9.2
14
31
  - 1.9.3
15
- - rbx
16
- - jruby
32
+ - 1.8.7
33
+ - rbx-19mode
34
+ - jruby-19mode
35
+ - rbx-18mode
36
+ - jruby-18mode
@@ -20,15 +20,12 @@ module Refinery
20
20
 
21
21
  before_save do |setting|
22
22
  setting.restricted = false if setting.restricted.nil?
23
- if setting.value.present? && setting.value.is_a?(String)
24
- setting.value = YAML.parse(setting.value).to_ruby
25
- end
26
23
  end
27
24
 
28
25
  after_save do |setting|
29
26
  setting.class.rewrite_cache
30
27
  end
31
-
28
+
32
29
  after_destroy do |setting|
33
30
  setting.class.rewrite_cache
34
31
  end
@@ -1,5 +1,7 @@
1
1
  Refinery::Core::Engine.routes.draw do
2
- namespace :admin, :path => 'refinery' do
3
- resources :settings, :except => :show
2
+ if Refinery::Settings.enable_interface
3
+ namespace :admin, :path => 'refinery' do
4
+ resources :settings, :except => :show
5
+ end
4
6
  end
5
7
  end
@@ -1,5 +1,10 @@
1
1
  module Refinery
2
2
  class SettingsGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../templates", __FILE__)
4
+
5
+ def generate_settings_initializer
6
+ template "config/initializers/refinery/settings.rb.erb", File.join(destination_root, "config", "initializers", "refinery", "settings.rb")
7
+ end
3
8
 
4
9
  def rake_db
5
10
  rake("refinery_settings:install:migrations")
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ Refinery::Settings.configure do |config|
3
+ # Configure whether to show settings in the admin menu, and enable admin users to change these settings
4
+ # config.enable_interface = <%= Refinery::Settings.enable_interface.inspect %>
5
+ end
@@ -1,4 +1,5 @@
1
1
  require 'refinerycms-core'
2
+ require 'acts_as_indexed'
2
3
 
3
4
  module Refinery
4
5
  autoload :SettingsGenerator, 'generators/refinery/settings_generator'
@@ -6,6 +7,7 @@ module Refinery
6
7
  module Settings
7
8
 
8
9
  require 'refinery/settings/engine'
10
+ require 'refinery/settings/configuration'
9
11
 
10
12
  class << self
11
13
  attr_writer :root
@@ -0,0 +1,9 @@
1
+ module Refinery
2
+ module Settings
3
+ include ActiveSupport::Configurable
4
+
5
+ config_accessor :enable_interface
6
+
7
+ self.enable_interface = true
8
+ end
9
+ end
@@ -14,6 +14,7 @@ module Refinery
14
14
  plugin.name = 'refinery_settings'
15
15
  plugin.version = %q{2.0.0}
16
16
  plugin.menu_match = %r{refinery/settings$}
17
+ plugin.hide_from_menu = !Refinery::Settings.enable_interface
17
18
  plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.admin_settings_path }
18
19
  end
19
20
  end
data/readme.md CHANGED
@@ -7,6 +7,17 @@
7
7
  Refinery Settings was extracted from Refinery CMS just before 2.0.0 was released
8
8
  and can now be used separately.
9
9
 
10
+ ## Installation
11
+ Add the gem to you Gemfile:
12
+
13
+ gem 'refinerycms-settings'
14
+
15
+ Generate and install the necessary migrations:
16
+
17
+ rails generate refinery:settings
18
+ rake db:migrate
19
+
20
+
10
21
  ## How do I Make my Own Settings?
11
22
 
12
23
  ### In view
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = %q{refinerycms-settings}
6
- s.version = %q{2.0.2}
6
+ s.version = %q{2.0.3}
7
7
  s.summary = %q{Settings engine for Refinery CMS}
8
8
  s.description = %q{Adds programmer creatable, user editable settings.}
9
9
  s.email = %q{info@refinerycms.com}
@@ -16,5 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- spec/*`.split("\n")
18
18
 
19
- s.add_dependency 'refinerycms-core', '~> 2.0.1'
19
+ s.add_dependency 'refinerycms-core', '~> 2.0.10'
20
+ s.add_dependency 'acts_as_indexed', '~> 0.7.7'
20
21
  end
@@ -5,53 +5,84 @@ module Refinery
5
5
  describe "Settings" do
6
6
  login_refinery_user
7
7
 
8
- context "when no settings" do
9
- before(:each) { Refinery::Setting.destroy_all }
8
+ context "when interface config is enabled" do
9
+ before do
10
+ Refinery::Settings.stub(:enable_interface).and_return(true)
11
+ end
10
12
 
11
- it "invites to create one" do
12
- visit refinery.admin_settings_path
13
- page.should have_content("There are no settings yet. Click 'Add new setting' to add your first setting.")
13
+ it "shows up in menu" do
14
+ visit refinery.admin_root_path
15
+
16
+ within('nav') do
17
+ page.should have_content "Settings"
18
+ end
14
19
  end
15
- end
16
20
 
17
- it "shows add new setting link" do
18
- visit refinery.admin_settings_path
19
- page.should have_content("Add new setting")
20
- page.should have_selector("a[href*='/refinery/settings/new']")
21
- end
21
+ context "when no settings" do
22
+ before(:each) { Refinery::Setting.destroy_all }
22
23
 
23
- context "new/create" do
24
- it "adds setting", :js => true do
24
+ it "invites to create one" do
25
+ visit refinery.admin_settings_path
26
+ page.should have_content("There are no settings yet. Click 'Add new setting' to add your first setting.")
27
+ end
28
+ end
29
+
30
+ it "shows add new setting link" do
25
31
  visit refinery.admin_settings_path
26
- click_link "Add new setting"
32
+ page.should have_content("Add new setting")
33
+ page.should have_selector("a[href*='/refinery/settings/new']")
34
+ end
35
+
36
+ context "new/create" do
37
+ it "adds setting", :js => true do
38
+ visit refinery.admin_settings_path
39
+ click_link "Add new setting"
27
40
 
28
- page.should have_selector('iframe#dialog_iframe')
41
+ page.should have_selector('iframe#dialog_iframe')
29
42
 
30
- page.within_frame('dialog_iframe') do
31
- fill_in "Name", :with => "test setting"
32
- fill_in "Value", :with => "true"
43
+ page.within_frame('dialog_iframe') do
44
+ fill_in "Name", :with => "test setting"
45
+ fill_in "Value", :with => "true"
33
46
 
34
- click_button "Save"
47
+ click_button "Save"
48
+ end
49
+
50
+ page.should have_content("'Test Setting' was successfully added.")
51
+ page.should have_content("Test Setting - true")
52
+ end
53
+ end
54
+
55
+ context "pagination" do
56
+ before(:each) do
57
+ (Refinery::Setting.per_page + 1).times do
58
+ FactoryGirl.create(:setting)
59
+ end
35
60
  end
36
61
 
37
- page.should have_content("'Test Setting' was successfully added.")
38
- page.should have_content("Test Setting - true")
62
+ specify "page links" do
63
+ visit refinery.admin_settings_path
64
+
65
+ page.should have_selector("a[href*='settings?page=2']")
66
+ end
39
67
  end
40
68
  end
41
69
 
42
- context "pagination" do
43
- before(:each) do
44
- (Refinery::Setting.per_page + 1).times do
45
- FactoryGirl.create(:setting)
46
- end
70
+ context "when interface config is disabled" do
71
+ before do
72
+ Refinery::Settings.stub(:enable_interface).and_return(false)
73
+ Refinery::Plugins.registered.find_by_name("refinery_settings").hide_from_menu = true
47
74
  end
48
75
 
49
- specify "page links" do
50
- visit refinery.admin_settings_path
76
+ it "does not show up in menu" do
77
+ visit refinery.admin_root_path
51
78
 
52
- page.should have_selector("a[href*='settings?page=2']")
79
+ within('nav') do
80
+ page.should_not have_content "Settings"
81
+ end
53
82
  end
54
83
  end
84
+
85
+
55
86
  end
56
87
  end
57
88
  end
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+
3
+
4
+ describe "routes for refinery settings", :focus do
5
+
6
+ context "when interface config is disabled", :focus do
7
+ before do
8
+ Refinery::Settings.stub(:enable_interface).and_return(false)
9
+ Refinery::Plugins.registered.find_by_name("refinery_settings").hide_from_menu = true
10
+ end
11
+
12
+ it "should not be accesible" do
13
+ expect(:get => "/refinery/settings").to_not be_routable
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
4
+ version: 2.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Philip Arndt
@@ -10,24 +9,36 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-07-18 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: refinerycms-core
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
22
- version: 2.0.1
20
+ version: 2.0.10
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ~>
29
26
  - !ruby/object:Gem::Version
30
- version: 2.0.1
27
+ version: 2.0.10
28
+ - !ruby/object:Gem::Dependency
29
+ name: acts_as_indexed
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.7.7
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: 0.7.7
31
42
  description: Adds programmer creatable, user editable settings.
32
43
  email: info@refinerycms.com
33
44
  executables: []
@@ -83,7 +94,9 @@ files:
83
94
  - config/routes.rb
84
95
  - db/migrate/20100913234710_create_refinerycms_settings_schema.rb
85
96
  - lib/generators/refinery/settings_generator.rb
97
+ - lib/generators/refinery/templates/config/initializers/refinery/settings.rb.erb
86
98
  - lib/refinery/settings.rb
99
+ - lib/refinery/settings/configuration.rb
87
100
  - lib/refinery/settings/engine.rb
88
101
  - lib/refinerycms-settings.rb
89
102
  - license.md
@@ -93,36 +106,37 @@ files:
93
106
  - spec/factories/settings.rb
94
107
  - spec/models/refinery/setting_spec.rb
95
108
  - spec/requests/refinery/admin/settings_spec.rb
109
+ - spec/routing/settings_routing_spec.rb
96
110
  - spec/spec_helper.rb
97
111
  - tasks/rspec.rake
98
112
  homepage: http://refinerycms.com
99
113
  licenses:
100
114
  - MIT
115
+ metadata: {}
101
116
  post_install_message:
102
117
  rdoc_options: []
103
118
  require_paths:
104
119
  - lib
105
120
  required_ruby_version: !ruby/object:Gem::Requirement
106
- none: false
107
121
  requirements:
108
- - - ! '>='
122
+ - - '>='
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
126
  requirements:
114
- - - ! '>='
127
+ - - '>='
115
128
  - !ruby/object:Gem::Version
116
129
  version: '0'
117
130
  requirements: []
118
131
  rubyforge_project: refinerycms
119
- rubygems_version: 1.8.22
132
+ rubygems_version: 2.0.3
120
133
  signing_key:
121
- specification_version: 3
134
+ specification_version: 4
122
135
  summary: Settings engine for Refinery CMS
123
136
  test_files:
124
137
  - spec/factories/settings.rb
125
138
  - spec/models/refinery/setting_spec.rb
126
139
  - spec/requests/refinery/admin/settings_spec.rb
140
+ - spec/routing/settings_routing_spec.rb
127
141
  - spec/spec_helper.rb
128
142
  has_rdoc: