gluttonberg-blog 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +3 -0
  4. data/Rakefile +38 -0
  5. data/app/assets/javascripts/blog/application.js +15 -0
  6. data/app/assets/stylesheets/blog/application.css +13 -0
  7. data/app/controllers/gluttonberg/admin/blog/application_controller.rb +6 -0
  8. data/app/controllers/gluttonberg/admin/blog/articles_controller.rb +168 -0
  9. data/app/controllers/gluttonberg/admin/blog/blogs_controller.rb +95 -0
  10. data/app/controllers/gluttonberg/admin/blog/comments_controller.rb +117 -0
  11. data/app/controllers/gluttonberg/public/blog/articles_controller.rb +88 -0
  12. data/app/controllers/gluttonberg/public/blog/blogs_controller.rb +47 -0
  13. data/app/controllers/gluttonberg/public/blog/comments_controller.rb +54 -0
  14. data/app/helpers/gluttonberg/blog/application_helper.rb +6 -0
  15. data/app/mailers/blog_notifier.rb +26 -0
  16. data/app/models/gluttonberg/blog/article.rb +120 -0
  17. data/app/models/gluttonberg/blog/comment.rb +152 -0
  18. data/app/models/gluttonberg/blog/comment_subscription.rb +31 -0
  19. data/app/models/gluttonberg/blog/weblog.rb +25 -0
  20. data/app/views/blog_notifier/comment_notification.html.haml +17 -0
  21. data/app/views/blog_notifier/comment_notification_for_admin.html.haml +19 -0
  22. data/app/views/gluttonberg/admin/blog/articles/_form.html.haml +106 -0
  23. data/app/views/gluttonberg/admin/blog/articles/edit.html.haml +12 -0
  24. data/app/views/gluttonberg/admin/blog/articles/import.html.haml +36 -0
  25. data/app/views/gluttonberg/admin/blog/articles/index.html.haml +82 -0
  26. data/app/views/gluttonberg/admin/blog/articles/new.html.haml +11 -0
  27. data/app/views/gluttonberg/admin/blog/blogs/_form.html.haml +53 -0
  28. data/app/views/gluttonberg/admin/blog/blogs/edit.html.haml +10 -0
  29. data/app/views/gluttonberg/admin/blog/blogs/index.html.haml +35 -0
  30. data/app/views/gluttonberg/admin/blog/blogs/new.html.haml +10 -0
  31. data/app/views/gluttonberg/admin/blog/comments/index.html.haml +66 -0
  32. data/app/views/gluttonberg/public/blog/articles/index.rss.builder +21 -0
  33. data/app/views/gluttonberg/public/blog/blogs/show.rss.builder +21 -0
  34. data/app/views/layouts/blog/application.html.erb +14 -0
  35. data/config/routes.rb +53 -0
  36. data/lib/generators/gluttonberg/blog/blog_generator.rb +42 -0
  37. data/lib/generators/gluttonberg/blog/templates/articles_index.html.haml +18 -0
  38. data/lib/generators/gluttonberg/blog/templates/articles_show.html.haml +63 -0
  39. data/lib/generators/gluttonberg/blog/templates/articles_tag.html.haml +25 -0
  40. data/lib/generators/gluttonberg/blog/templates/blog_migration.rb +94 -0
  41. data/lib/generators/gluttonberg/blog/templates/blogs_index.html.haml +15 -0
  42. data/lib/generators/gluttonberg/blog/templates/blogs_show.html.haml +26 -0
  43. data/lib/gluttonberg/blog.rb +9 -0
  44. data/lib/gluttonberg/blog/engine.rb +22 -0
  45. data/lib/gluttonberg/blog/tasks/blog_tasks.rake +12 -0
  46. data/lib/gluttonberg/blog/version.rb +5 -0
  47. data/spec/dummy/README.rdoc +261 -0
  48. data/spec/dummy/Rakefile +7 -0
  49. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  50. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  51. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  52. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  53. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  54. data/spec/dummy/config.ru +4 -0
  55. data/spec/dummy/config/application.rb +59 -0
  56. data/spec/dummy/config/boot.rb +10 -0
  57. data/spec/dummy/config/database.yml +8 -0
  58. data/spec/dummy/config/environment.rb +5 -0
  59. data/spec/dummy/config/environments/development.rb +37 -0
  60. data/spec/dummy/config/environments/production.rb +67 -0
  61. data/spec/dummy/config/environments/test.rb +37 -0
  62. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  63. data/spec/dummy/config/initializers/inflections.rb +15 -0
  64. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  65. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  66. data/spec/dummy/config/initializers/session_store.rb +8 -0
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  68. data/spec/dummy/config/locales/en.yml +5 -0
  69. data/spec/dummy/config/routes.rb +3 -0
  70. data/spec/dummy/db/schema.rb +476 -0
  71. data/spec/dummy/public/404.html +26 -0
  72. data/spec/dummy/public/422.html +26 -0
  73. data/spec/dummy/public/500.html +25 -0
  74. data/spec/dummy/public/favicon.ico +0 -0
  75. data/spec/dummy/script/rails +6 -0
  76. data/spec/fixtures/assets/gb_banner.jpg +0 -0
  77. data/spec/fixtures/assets/gb_logo.png +0 -0
  78. data/spec/fixtures/assets/high_res_photo.jpg +0 -0
  79. data/spec/fixtures/assets/untitled +0 -0
  80. data/spec/fixtures/members.csv +5 -0
  81. data/spec/fixtures/staff_profiles.csv +4 -0
  82. data/spec/helpers/page_info_spec.rb +213 -0
  83. data/spec/mailers/blog_notifier_spec.rb +127 -0
  84. data/spec/models/article_spec.rb +213 -0
  85. data/spec/spec_helper.rb +67 -0
  86. metadata +203 -0
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,8 @@
1
+ test:
2
+ adapter: postgresql
3
+ database: gluttonberg_blog_test
4
+ username: postgres
5
+ password: ""
6
+ encoding: unicode
7
+ min_messages: warning
8
+ host: 127.0.0.1
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+ end
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '47544670e106df2b25751eca8b884a0a8a359ae79eef1574bd233314d42702d0b3220e9564ca2597f7fcc9a7ed81671e160d6a94e714be530572b9d666b76665'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ #mount Blog::Engine => "/blog"
3
+ end
@@ -0,0 +1,476 @@
1
+ # encoding: UTF-8
2
+
3
+ ActiveRecord::Schema.define(:version => 2014011610106) do
4
+ #core migration
5
+ ##########Replace following lines (gluttonberg core) with latest gluttonberg migrations############
6
+ create_table :gb_plain_text_content_localizations do |t|
7
+ t.integer :page_localization_id
8
+ t.string :text, :limit => 255
9
+ t.integer :plain_text_content_id
10
+ t.integer :version
11
+ t.timestamps
12
+ end
13
+
14
+ create_table :gb_html_contents do |t|
15
+ t.boolean :orphaned, :default => false
16
+ t.string :section_name, :limit => 50
17
+ t.integer :page_id
18
+ t.timestamps
19
+ end
20
+
21
+ create_table :gb_html_content_localizations do |t|
22
+ t.text :text
23
+ t.integer :html_content_id
24
+ t.integer :page_localization_id
25
+ t.integer :version
26
+ t.timestamps
27
+ end
28
+
29
+ create_table :gb_textarea_contents do |t|
30
+ t.boolean :orphaned, :default => false
31
+ t.string :section_name, :limit => 50
32
+ t.integer :page_id
33
+ t.timestamps
34
+ end
35
+
36
+ create_table :gb_textarea_content_localizations do |t|
37
+ t.text :text
38
+ t.integer :textarea_content_id
39
+ t.integer :page_localization_id
40
+ t.integer :version
41
+ t.timestamps
42
+ end
43
+
44
+ create_table :gb_image_contents do |t|
45
+ t.boolean :orphaned, :default => false
46
+ t.string :section_name, :limit => 50
47
+ t.integer :asset_id
48
+ t.integer :page_id
49
+ t.integer :version
50
+ t.timestamps
51
+ end
52
+
53
+ create_table :gb_select_contents do |t|
54
+ t.boolean :orphaned, :default => false
55
+ t.string :section_name, :limit => 50
56
+ t.string :text
57
+ t.integer :page_id
58
+ t.integer :version
59
+ t.timestamps
60
+ end
61
+
62
+ create_table :gb_locales do |t|
63
+ t.string :name, :limit => 70, :null => false
64
+ t.string :slug, :limit => 70, :null => false
65
+ t.string :slug_type, :limit => 70, :null => false # prefix , subdomain
66
+ t.boolean :default, :default => false
67
+ t.timestamps
68
+ end
69
+
70
+ create_table :gb_settings do |t|
71
+ t.string :name, :limit => 50, :null => false
72
+ t.text :value
73
+ t.integer :category, :default => 1
74
+ t.integer :row
75
+ t.boolean :delete_able, :default => true
76
+ t.boolean :enabled, :default => true
77
+ t.string :site
78
+ t.text :help
79
+ t.text :values_list
80
+ t.timestamps
81
+ end
82
+
83
+ create_table :gb_page_localizations do |t|
84
+ t.string :name, :limit => 150
85
+ t.string :navigation_label, :limit => 100
86
+ t.string :slug, :limit => 50
87
+ t.string :path, :limit => 255
88
+ t.integer :locale_id
89
+ t.integer :page_id
90
+ t.string :seo_title , :limit => 255
91
+ t.text :seo_keywords
92
+ t.text :seo_description
93
+ t.integer :fb_icon_id
94
+ t.string :previous_path
95
+ t.timestamps
96
+ end
97
+
98
+ create_table :gb_pages do |t|
99
+ t.integer :parent_id
100
+ t.string :name, :limit => 100
101
+ t.string :navigation_label, :limit => 100
102
+ t.string :slug, :limit => 100
103
+ t.string :description_name, :limit => 100
104
+ t.boolean :home, :default => false
105
+ t.integer :position
106
+ t.integer :user_id
107
+ t.string :state
108
+ t.boolean :hide_in_nav
109
+ t.datetime :published_at
110
+ t.integer :children_count, :default => 0
111
+ t.timestamps
112
+ end
113
+
114
+ create_table :gb_plain_text_contents do |t|
115
+ t.boolean :orphaned, :default => false
116
+ t.string :section_name, :limit => 50
117
+ t.integer :page_id
118
+ t.timestamps
119
+ end
120
+
121
+ create_table :gb_asset_categories do |t|
122
+ t.string :name, :null => false
123
+ t.boolean :unknown
124
+ end
125
+
126
+ create_table :gb_asset_types do |t|
127
+ t.string :name, :null => false
128
+ t.integer :asset_category_id, :default => 0
129
+ end
130
+
131
+ create_table :gb_asset_mime_types do |t|
132
+ t.string :mime_type, :null => false
133
+ t.integer :asset_type_id, :default => 0
134
+ end
135
+
136
+ create_table :gb_asset_collections do |t|
137
+ t.string :name, :null => false
138
+ t.integer :user_id
139
+ t.timestamps
140
+ end
141
+
142
+ create_table :gb_assets do |t|
143
+ t.string :mime_type
144
+ t.integer :asset_type_id
145
+ t.string :name, :null => false
146
+ t.text :description
147
+ t.string :file_name
148
+ t.string :asset_hash
149
+ t.integer :size
150
+ t.boolean :custom_thumbnail
151
+ t.text :synopsis
152
+ t.text :copyrights
153
+ t.integer :year_of_production
154
+ t.string :duration
155
+ t.integer :user_id
156
+ t.integer :width
157
+ t.integer :height
158
+ t.string :alt
159
+ t.boolean :processed
160
+ t.boolean :copied_to_s3
161
+ t.integer :poster_image_id
162
+ t.timestamps
163
+ end
164
+
165
+ create_table :gb_audio_asset_attributes do |t|
166
+ t.integer :asset_id , :null => false
167
+ t.float :length
168
+ t.string :title
169
+ t.string :artist
170
+ t.string :album
171
+ t.string :tracknum
172
+ t.string :genre
173
+ t.timestamps
174
+ end
175
+
176
+ create_table :gb_asset_collections_assets , :id => false do |t|
177
+ t.column :asset_collection_id, :integer, :null => false
178
+ t.column :asset_id, :integer, :null => false
179
+ end
180
+
181
+ create_table :gb_users do |t|
182
+ t.string :first_name, :null => false
183
+ t.string :last_name
184
+ t.string :email, :null => false
185
+ t.string :crypted_password, :null => false
186
+ t.string :password_salt, :null => false
187
+ t.string :persistence_token, :null => false
188
+ t.string :single_access_token, :null => false
189
+ t.string :perishable_token, :null => false
190
+ t.integer :login_count, :null => false, :default => 0
191
+ t.string :role, :null => false
192
+ t.text :bio
193
+ t.integer :image_id
194
+ t.integer :position
195
+ t.timestamps
196
+ end
197
+
198
+
199
+
200
+
201
+ create_table :tags do |t|
202
+ t.string :name
203
+ t.string :slug
204
+ end
205
+
206
+ create_table :taggings do |t|
207
+ t.references :tag
208
+
209
+ # You should make sure that the column created is
210
+ # long enough to store the required class names.
211
+ t.references :taggable, :polymorphic => true
212
+ t.references :tagger, :polymorphic => true
213
+
214
+ t.string :context
215
+
216
+ t.timestamps
217
+ end
218
+
219
+ add_index :taggings, :tag_id
220
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
221
+
222
+ create_table :flags, :force => true do |t|
223
+ t.integer :user_id
224
+ t.integer :flaggable_id
225
+ t.string :flaggable_type
226
+ t.integer :flaggable_user_id
227
+ t.string :reason
228
+ t.string :url
229
+ t.text :description
230
+ t.boolean :approved
231
+ t.boolean :moderation_required
232
+ t.timestamps
233
+ end
234
+
235
+ create_table :gb_asset_thumbnails do |t|
236
+ t.column :asset_id, :integer
237
+ t.column :thumbnail_type, :string, :limit => 100
238
+ t.column :user_generated , :boolean
239
+ t.timestamps
240
+ end
241
+
242
+ create_table :gb_stylesheets do |t|
243
+ t.column :name , :string , :limit => 255
244
+ t.column :slug , :string , :limit => 255
245
+ t.column :value, :text
246
+ t.column :css_prefix , :string , :limit => 255
247
+ t.column :css_postfix , :string , :limit => 255
248
+ t.column :position , :integer
249
+ t.timestamps
250
+ end
251
+
252
+ create_table :gb_members do |t|
253
+ t.string :first_name, :null => false
254
+ t.string :last_name
255
+ t.string :email, :null => false
256
+ t.string :crypted_password, :null => false
257
+ t.string :password_salt, :null => false
258
+ t.string :persistence_token, :null => false
259
+ t.string :single_access_token, :null => false
260
+ t.string :perishable_token, :null => false
261
+ t.integer :login_count, :null => false, :default => 0
262
+ t.text :bio
263
+ t.string :image_file_name
264
+ t.string :image_content_type
265
+ t.integer :image_file_size
266
+ t.boolean :profile_confirmed, :default => false
267
+ t.boolean :welcome_email_sent, :default => false
268
+ t.string :confirmation_key
269
+ t.boolean :can_login , :default => true
270
+ t.timestamps
271
+ end
272
+
273
+ create_table :gb_groups do |t|
274
+ t.string :name, :null => false
275
+ t.string :description
276
+ t.integer :position
277
+ t.boolean :default, :default => false
278
+ t.timestamps
279
+ end
280
+
281
+ create_table :gb_groups_members , :id => false do |t|
282
+ t.integer :member_id, :null => false
283
+ t.integer :group_id , :null => false
284
+ end
285
+
286
+ create_table :gb_groups_pages , :id => false do |t|
287
+ t.integer :page_id, :null => false
288
+ t.integer :group_id , :null => false
289
+ end
290
+
291
+ create_table :gb_galleries do |t|
292
+ t.column :title , :string , :limit => 255
293
+ t.column :description, :text
294
+ t.integer :user_id
295
+ t.column :slug , :string
296
+ t.column :state , :string
297
+ t.datetime :published_at
298
+ t.boolean :collection_imported , :default => false
299
+ t.string :seo_title , :limit => 255
300
+ t.text :seo_keywords
301
+ t.text :seo_description
302
+ t.integer :fb_icon_id
303
+ t.string :previous_path
304
+ t.timestamps
305
+ end
306
+
307
+ create_table :gb_gallery_images do |t|
308
+ t.integer :gallery_id, :null => false
309
+ t.integer :asset_id, :null => false
310
+ t.integer :position, :null => false
311
+ t.text :caption
312
+ t.text :credits
313
+ t.string :artist_name
314
+ t.string :link
315
+ t.timestamps
316
+ end
317
+
318
+ create_table :gb_feeds do |t|
319
+ t.integer :feedable_id
320
+ t.string :feedable_type
321
+ t.string :title
322
+ t.string :action_type
323
+ t.integer :user_id
324
+ t.timestamps
325
+ end
326
+
327
+ create_table :gb_collapsed_pages do |t|
328
+ t.integer :page_id
329
+ t.integer :user_id
330
+ end
331
+
332
+ create_table :gb_auto_save_versions do |t|
333
+ t.integer :auto_save_able_id
334
+ t.string :auto_save_able_type
335
+ t.text :data
336
+ t.timestamps
337
+ end
338
+
339
+ create_table :gb_authorizations do |t|
340
+ t.string :authorizable_type
341
+ t.integer :authorizable_id
342
+ t.integer :user_id
343
+ t.boolean :allow
344
+ t.timestamps
345
+ end
346
+
347
+ create_table :gb_embeds do |t|
348
+ t.string :title
349
+ t.string :shortcode
350
+ t.text :body
351
+ t.timestamps
352
+ end
353
+
354
+ create_table :gb_versions do |t|
355
+ t.float :version_number, :null => false
356
+ end
357
+
358
+ begin
359
+ Gluttonberg::PlainTextContentLocalization.create_versioned_table
360
+ rescue => e
361
+ puts e
362
+ end
363
+
364
+ begin
365
+ Gluttonberg::HtmlContentLocalization.create_versioned_table
366
+ rescue => e
367
+ puts e
368
+ end
369
+
370
+ begin
371
+ Gluttonberg::TextareaContentLocalization.create_versioned_table
372
+ rescue => e
373
+ puts e
374
+ end
375
+
376
+ begin
377
+ Gluttonberg::ImageContent.create_versioned_table
378
+ rescue => e
379
+ puts e
380
+ end
381
+
382
+ begin
383
+ Gluttonberg::SelectContent.create_versioned_table
384
+ rescue => e
385
+ puts e
386
+ end
387
+
388
+ begin
389
+ Gluttonberg::Stylesheet.create_versioned_table
390
+ rescue => e
391
+ puts e
392
+ end
393
+
394
+ # blog migrations
395
+
396
+ create_table :gb_weblogs, :force => true do |t|
397
+ t.string :name, :null => false
398
+ t.string :slug, :null => false
399
+ t.text :description
400
+ t.integer :user_id, :null => false
401
+ t.column :state , :string
402
+ t.boolean :moderation_required, :default => true
403
+ t.string :seo_title
404
+ t.text :seo_keywords
405
+ t.text :seo_description
406
+ t.integer :fb_icon_id
407
+ t.string :previous_slug
408
+ t.datetime :published_at
409
+ t.timestamps
410
+ end
411
+
412
+ create_table :gb_articles, :force => true do |t|
413
+ t.string :slug, :null => false
414
+ t.integer :blog_id, :null => false
415
+ t.integer :user_id, :null => false
416
+ t.integer :author_id, :null => false
417
+ t.column :state , :string #use for publishing
418
+ t.column :disable_comments , :boolean , :default => false
419
+ t.datetime :published_at
420
+ t.string :previous_slug
421
+ t.integer :comments_count, :default => 0
422
+ t.timestamps
423
+ end
424
+
425
+ create_table :gb_comments, :force => true do |t|
426
+ t.text :body
427
+ t.string :author_name
428
+ t.string :author_email
429
+ t.string :author_website
430
+ t.references :commentable, :polymorphic => true
431
+ t.integer :author_id
432
+ t.boolean :moderation_required, :default => true
433
+ t.boolean :approved, :default => false
434
+ t.datetime :notification_sent_at
435
+ t.boolean :spam , :default => false
436
+ t.float :spam_score
437
+ t.timestamps
438
+ end
439
+
440
+ create_table :gb_comment_subscriptions, :force => true do |t|
441
+ t.integer :article_id
442
+ t.string :author_name
443
+ t.string :author_email
444
+ t.string :reference_hash
445
+ t.timestamps
446
+ end
447
+
448
+ create_table :gb_article_localizations, :force => true do |t|
449
+ t.string :title, :null => false
450
+ t.text :excerpt
451
+ t.text :body
452
+ t.integer :featured_image_id
453
+ t.column :article_id, :integer
454
+ t.column :locale_id, :integer
455
+ t.column :version, :integer
456
+ t.string :seo_title
457
+ t.text :seo_keywords
458
+ t.text :seo_description
459
+ t.integer :fb_icon_id
460
+ t.timestamps
461
+ end
462
+
463
+ begin
464
+ Gluttonberg::Blog::Weblog.create_versioned_table
465
+ rescue => e
466
+ puts e
467
+ end
468
+
469
+ begin
470
+ Gluttonberg::Blog::Article # make sure article model is loaded.
471
+ Gluttonberg::Blog::ArticleLocalization.create_versioned_table
472
+ rescue => e
473
+ puts e
474
+ end
475
+
476
+ end