comfortable_mexican_sofa 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.5
1
+ 1.4.6
@@ -1,5 +1,9 @@
1
1
  class Cms::Block < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_blocks
4
8
 
5
9
  # -- Relationships --------------------------------------------------------
@@ -1,5 +1,9 @@
1
1
  class Cms::Categorization < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_categorizations
4
8
 
5
9
  # -- Relationships --------------------------------------------------------
@@ -1,5 +1,9 @@
1
1
  class Cms::Category < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_categories
4
8
 
5
9
  # -- Relationships --------------------------------------------------------
@@ -1,5 +1,9 @@
1
1
  class Cms::File < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_files
4
8
 
5
9
  cms_is_categorized
@@ -1,5 +1,9 @@
1
1
  class Cms::Layout < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_layouts
4
8
 
5
9
  cms_acts_as_tree
@@ -1,5 +1,9 @@
1
1
  class Cms::Page < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_pages
4
8
 
5
9
  cms_acts_as_tree :counter_cache => :children_count
@@ -1,5 +1,9 @@
1
1
  class Cms::Revision < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_revisions
4
8
 
5
9
  serialize :data
@@ -1,5 +1,9 @@
1
1
  class Cms::Site < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_sites
4
8
 
5
9
  # -- Relationships --------------------------------------------------------
@@ -1,5 +1,9 @@
1
1
  class Cms::Snippet < ActiveRecord::Base
2
2
 
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
6
+
3
7
  set_table_name :cms_snippets
4
8
 
5
9
  cms_is_categorized
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{comfortable_mexican_sofa}
8
- s.version = "1.4.5"
8
+ s.version = "1.4.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc"]
12
- s.date = %q{2011-08-30}
12
+ s.date = %q{2011-08-31}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
data/config/database.yml CHANGED
@@ -5,6 +5,13 @@ development:
5
5
  database: db/development.sqlite3
6
6
  pool: 5
7
7
  timeout: 10000
8
+
9
+ # config.database_config = 'cms_'
10
+ cms_development:
11
+ adapter: sqlite3
12
+ database: db/cms_development.sqlite3
13
+ pool: 5
14
+ timeout: 10000
8
15
 
9
16
  # Warning: The database defined as "test" will be erased and
10
17
  # re-generated from your development database when you run "rake".
@@ -54,6 +54,12 @@ ComfortableMexicanSofa.configure do |config|
54
54
  # force it to English by setting this to `:en`
55
55
  # config.admin_locale = nil
56
56
 
57
+ # Database prefix. If you want to keep your comfortable mexican sofa tables
58
+ # in a location other than the default databases add a database_config.
59
+ # Using a prefix of `cms_` will look for a cms_#{Rails.env} definition
60
+ # in your database.yml file
61
+ # config.database_config = nil
62
+
57
63
  end
58
64
 
59
65
  # Default credentials for ComfortableMexicanSofa::HttpAuth
@@ -1,6 +1,11 @@
1
1
  class CreateCms < ActiveRecord::Migration
2
2
 
3
3
  def self.up
4
+
5
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
6
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
7
+ end
8
+
4
9
  # -- Sites --------------------------------------------------------------
5
10
  create_table :cms_sites do |t|
6
11
  t.string :label
@@ -107,6 +112,11 @@ class CreateCms < ActiveRecord::Migration
107
112
  end
108
113
 
109
114
  def self.down
115
+
116
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
117
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
118
+ end
119
+
110
120
  drop_table :cms_sites
111
121
  drop_table :cms_layouts
112
122
  drop_table :cms_pages
@@ -1,5 +1,8 @@
1
1
  class UpgradeTo110 < ActiveRecord::Migration
2
2
  def self.up
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
3
6
  rename_column :cms_layouts, :cms_site_id, :site_id
4
7
  rename_column :cms_pages, :cms_site_id, :site_id
5
8
  rename_column :cms_pages, :cms_layout_id, :layout_id
@@ -9,6 +12,9 @@ class UpgradeTo110 < ActiveRecord::Migration
9
12
  end
10
13
 
11
14
  def self.down
15
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
16
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
17
+ end
12
18
  rename_column :cms_uploads, :site_id, :cms_site_id
13
19
  rename_column :cms_snippets, :site_id, :cms_site_id
14
20
  rename_column :cms_blocks, :page_id, :cms_page_id
@@ -1,5 +1,8 @@
1
1
  class UpgradeTo120 < ActiveRecord::Migration
2
2
  def self.up
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
3
6
  create_table :cms_revisions, :force => true do |t|
4
7
  t.string :record_type
5
8
  t.integer :record_id
@@ -10,6 +13,9 @@ class UpgradeTo120 < ActiveRecord::Migration
10
13
  end
11
14
 
12
15
  def self.down
16
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
17
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
18
+ end
13
19
  drop_table :cms_revisions
14
20
  end
15
21
  end
@@ -1,5 +1,8 @@
1
1
  class UpgradeTo130 < ActiveRecord::Migration
2
2
  def self.up
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
3
6
  add_column :cms_sites, :is_mirrored, :boolean, :null => false, :default => false
4
7
  add_column :cms_sites, :path, :string
5
8
  add_column :cms_sites, :locale, :string, :null => false, :default => 'en'
@@ -11,6 +14,9 @@ class UpgradeTo130 < ActiveRecord::Migration
11
14
  end
12
15
 
13
16
  def self.down
17
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
18
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
19
+ end
14
20
  remove_index :cms_sites, :is_mirrored
15
21
  remove_column :cms_sites, :path
16
22
  remove_column :cms_sites, :is_mirrored
@@ -1,5 +1,8 @@
1
1
  class UpgradeTo140 < ActiveRecord::Migration
2
2
  def self.up
3
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
4
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
5
+ end
3
6
  rename_table :cms_uploads, :cms_files
4
7
  add_column :cms_files, :label, :string
5
8
  add_column :cms_files, :description, :string, :limit => 2048
@@ -22,6 +25,9 @@ class UpgradeTo140 < ActiveRecord::Migration
22
25
  end
23
26
 
24
27
  def self.down
28
+ if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
29
+ establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
30
+ end
25
31
  remove_index :cms_files, [:site_id, :label]
26
32
  remove_column :cms_files, :description
27
33
  remove_column :cms_files, :label
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '3.1.0.rc8'
3
+ gem 'rails', '3.1.0'
4
4
  gem 'active_link_to', '>=1.0.0'
5
5
  gem 'paperclip', '>=2.3.14'
6
6
 
@@ -43,6 +43,12 @@ class ComfortableMexicanSofa::Configuration
43
43
  # force it to English by setting this to `:en`
44
44
  attr_accessor :admin_locale
45
45
 
46
+ # Database prefix. If you want to keep your comfortable mexican sofa tables
47
+ # in a location other than the default databases add a database_config.
48
+ # Setting this to `cms` will look for a cms_#{Rails.env} database definition
49
+ # in your database.yml file
50
+ attr_accessor :database_config
51
+
46
52
  # Configuration defaults
47
53
  def initialize
48
54
  @cms_title = 'ComfortableMexicanSofa MicroCMS'
@@ -59,6 +65,7 @@ class ComfortableMexicanSofa::Configuration
59
65
  @revisions_limit = 25
60
66
  @locales = { :en => 'English', :es => 'Español' }
61
67
  @admin_locale = nil
68
+ @database_config = nil
62
69
  end
63
70
 
64
71
  end
@@ -17,6 +17,7 @@ class ConfigurationTest < ActiveSupport::TestCase
17
17
  assert_equal 25, config.revisions_limit
18
18
  assert_equal ({:en => 'English', :es => 'Español'}), config.locales
19
19
  assert_equal nil, config.admin_locale
20
+ assert_equal nil, config.database_config
20
21
  end
21
22
 
22
23
  def test_initialization_overrides
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_mexican_sofa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-30 00:00:00.000000000 -04:00
13
+ date: 2011-08-31 00:00:00.000000000 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
- requirement: &70196080386120 !ruby/object:Gem::Requirement
18
+ requirement: &70324287482620 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 3.0.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70196080386120
26
+ version_requirements: *70324287482620
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_link_to
29
- requirement: &70196080385640 !ruby/object:Gem::Requirement
29
+ requirement: &70324287481220 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 1.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70196080385640
37
+ version_requirements: *70324287481220
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: paperclip
40
- requirement: &70196080385160 !ruby/object:Gem::Requirement
40
+ requirement: &70324287479860 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,7 +45,7 @@ dependencies:
45
45
  version: 2.3.14
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70196080385160
48
+ version_requirements: *70324287479860
49
49
  description: ''
50
50
  email: oleg@theworkinggroup.ca
51
51
  executables: []
@@ -347,7 +347,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
347
347
  version: '0'
348
348
  segments:
349
349
  - 0
350
- hash: 1153917626965436207
350
+ hash: 512581774874572248
351
351
  required_rubygems_version: !ruby/object:Gem::Requirement
352
352
  none: false
353
353
  requirements: