caboose-cms 0.2.91 → 0.2.92

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2I0OGM3MDkwYjJjMzZhN2FjOGQzYzUxNmRlNmRkMmFmN2FhZGY4Zg==
4
+ ZDg5OTM1Yzk0MjAxZGU5MDViZjIzZDc2ODFhZTg2ZDcxZWRmYjlmMg==
5
5
  data.tar.gz: !binary |-
6
- NWFhMTZiZTE3OTM1ZTI5NmI1OGY5NjM5ZGUxOWY5OWRmM2I4NDlmYQ==
6
+ NDdmZjlkYmIzYzI2NjExMWRjZGY2NmFmMWY0OTcxNDM0NWVmNjc5Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MGQwM2E0ZTE4Y2IwYTZhOGJmYWE2N2Q3MmFhN2FiYWQ5YmZiZDJmYTYzZTBm
10
- NTc2NWQ0NzljMThlMjAzNDRhYzBjY2FhNTU1Y2RhNTBhNGNlMGZmYjYxOTI1
11
- OWQ0YTUzMzkzMTk5OWY0ZjljMDc0M2EwM2FiY2ViOWM2YzMyZWE=
9
+ YmNiNjFhNzg4ZWFlMjlhM2M0YTY1ZDJmYzc4MzNiOTkyMGE2OGI3YmY1Yjdl
10
+ NWFjY2VjYjYyYzcxNWNjOGFlZDIwOWVkMWViMDM1NTVhMjcwMDQzNzNkOTZm
11
+ M2FhZDVkN2M0OTc1NDliYmViZGRjY2YwMmIzZjg2Yzk4OWVkOGU=
12
12
  data.tar.gz: !binary |-
13
- ZjhjOTA3NTA3NmI5OTZmZTIxOGExYTc0NDhkMzFhODkzN2ZmNDIzZTRkMzBi
14
- NDk5NGE5NGM5NWJlNDMyODEyZjE0Y2QwNmQ0ZDI5NjJjZGRjYjZjMDdlYWE2
15
- MzJkOTc5N2E2NzliYWM1ZmFlZjI3MjJkZGU3YzY0OTljOWMxZTc=
13
+ MzE1M2Y0OTZmY2M1ZWVkYmY5ZjhiMmU5NmU3YjVkOGFkNDQzOTAwOTczMTZm
14
+ MjZiNmYwN2IxZjIwMjAyMDNhN2UyNmRkZDMxYmQwYTY0OGFiZGE2OTAxODhk
15
+ MTkwZTA2MDAwNWJjM2QwM2Y4ZjU0YzM4YjBmY2JjYzc0ODFmZTE=
@@ -49,6 +49,34 @@ module Caboose
49
49
  return obj.to_json
50
50
  end
51
51
 
52
+ def Caboose.create_schema(schema_file)
53
+ c = ActiveRecord::Base.connection
54
+ require schema_file
55
+ @schema.each do |table, columns|
56
+ c.create_table table if !c.table_exists?(table)
57
+ columns.each do |col|
58
+
59
+ # Skip if the column exists with the proper data type
60
+ next if c.column_exists?(table, col[0], col[1])
61
+
62
+ # If the column exists, but not with the correct data type, try to change it
63
+ if c.column_exists?(table, col[0])
64
+ if col.count > 2
65
+ c.change_column table, col[0], col[1], col[2]
66
+ else
67
+ c.change_column table, col[0], col[1]
68
+ end
69
+ else
70
+ if col.count > 2
71
+ c.add_column table, col[0], col[1], col[2]
72
+ else
73
+ c.add_column table, col[0], col[1]
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+
52
80
  class Engine < ::Rails::Engine
53
81
  isolate_namespace Caboose
54
82
  end
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.2.91'
2
+ VERSION = '0.2.92'
3
3
  end
@@ -127,7 +127,7 @@ namespace :caboose do
127
127
 
128
128
  # Post categories
129
129
  c.create_table :post_categories if !c.table_exists?(:post_categories)
130
- c.add_column :posts, :name , :string if !c.column_exists?(:post_categories, :name)
130
+ c.add_column :post_categories, :name , :string if !c.column_exists?(:post_categories, :name)
131
131
 
132
132
  # Post category membership
133
133
  c.create_table :post_category_memberships if !c.table_exists?(:post_category_memberships)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.91
4
+ version: 0.2.92
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2013-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails