almanac 0.4.4

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.
Files changed (127) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +76 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/images/almanac/background.jpg +0 -0
  5. data/app/assets/images/almanac/icons/compose.png +0 -0
  6. data/app/assets/images/almanac/icons/feed.png +0 -0
  7. data/app/assets/images/almanac/icons/gear.png +0 -0
  8. data/app/assets/images/almanac/icons/glyphicons-halflings-white.png +0 -0
  9. data/app/assets/images/almanac/icons/glyphicons-halflings.png +0 -0
  10. data/app/assets/images/almanac/icons/upload.png +0 -0
  11. data/app/assets/images/almanac/logo.jpg +0 -0
  12. data/app/assets/javascripts/almanac/2-jquery.backstretch.js +357 -0
  13. data/app/assets/javascripts/almanac/3-pixastic.js +637 -0
  14. data/app/assets/javascripts/almanac/4-bootstrap-datepicker.js +454 -0
  15. data/app/assets/javascripts/almanac/5-main.coffee.erb +46 -0
  16. data/app/assets/javascripts/almanac/application.js +16 -0
  17. data/app/assets/stylesheets/almanac/1-datepicker.css +7 -0
  18. data/app/assets/stylesheets/almanac/2-main.css.scss +279 -0
  19. data/app/assets/stylesheets/almanac/application.css +15 -0
  20. data/app/controllers/almanac/application_controller.rb +24 -0
  21. data/app/controllers/almanac/blogs_controller.rb +64 -0
  22. data/app/controllers/almanac/comments_controller.rb +41 -0
  23. data/app/controllers/almanac/images_controller.rb +29 -0
  24. data/app/controllers/almanac/posts_controller.rb +109 -0
  25. data/app/helpers/almanac/application_helper.rb +4 -0
  26. data/app/models/almanac/blog.rb +32 -0
  27. data/app/models/almanac/comment.rb +20 -0
  28. data/app/models/almanac/image.rb +10 -0
  29. data/app/models/almanac/post.rb +55 -0
  30. data/app/views/almanac/blogs/_form.html.haml +76 -0
  31. data/app/views/almanac/blogs/_topbar.html.haml +5 -0
  32. data/app/views/almanac/blogs/edit.html.haml +4 -0
  33. data/app/views/almanac/blogs/new.html.haml +3 -0
  34. data/app/views/almanac/blogs/spam.html.haml +15 -0
  35. data/app/views/almanac/posts/_form.html.haml +52 -0
  36. data/app/views/almanac/posts/_post.html.haml +59 -0
  37. data/app/views/almanac/posts/edit.html.haml +1 -0
  38. data/app/views/almanac/posts/index.html.haml +30 -0
  39. data/app/views/almanac/posts/index.rss.builder +18 -0
  40. data/app/views/almanac/posts/new.html.haml +1 -0
  41. data/app/views/almanac/posts/show.html.haml +4 -0
  42. data/app/views/almanac/posts/tag.html.haml +22 -0
  43. data/app/views/layouts/almanac/_ga.html.haml +10 -0
  44. data/app/views/layouts/almanac/_twitter_follow.html.haml +2 -0
  45. data/app/views/layouts/almanac/application.html.haml +52 -0
  46. data/config/routes.rb +22 -0
  47. data/db/migrate/20121009222451_create_almanac_posts.rb +17 -0
  48. data/db/migrate/20121010033555_create_almanac_blogs.rb +14 -0
  49. data/db/migrate/20121017032059_add_excerpt_to_almanac_posts.rb +11 -0
  50. data/db/migrate/20121017210007_create_almanac_files.rb +15 -0
  51. data/db/migrate/20121017221819_rename_file_to_image.rb +9 -0
  52. data/db/migrate/20121025223403_add_image_fields_to_almanac_blogs.rb +13 -0
  53. data/db/migrate/20121029211221_add_new_fields_to_blogs.rb +15 -0
  54. data/db/migrate/20121029221815_acts_as_taggable_on_migration.rb +30 -0
  55. data/db/migrate/20121101030836_create_almanac_comments.rb +16 -0
  56. data/db/migrate/20121102181941_add_rakismet_fields_to_blogs.rb +13 -0
  57. data/db/migrate/20121102185130_add_spam_to_comments.rb +11 -0
  58. data/db/migrate/20121110000024_add_written_at_to_posts.rb +11 -0
  59. data/db/migrate/20121112205256_add_background_fields_to_blogs.rb +13 -0
  60. data/db/migrate/20121113010557_add_footer_to_almanac_blogs.rb +11 -0
  61. data/db/migrate/20121114043648_change_default_value_for_background_tiles_in_almanac_blogs.rb +9 -0
  62. data/lib/almanac.rb +16 -0
  63. data/lib/almanac/MarkdownParser.rb +18 -0
  64. data/lib/almanac/engine.rb +9 -0
  65. data/lib/almanac/version.rb +3 -0
  66. data/lib/tasks/almanac_tasks.rake +4 -0
  67. data/spec/controllers/blogs_controller_spec.rb +80 -0
  68. data/spec/controllers/comments_controller_spec.rb +51 -0
  69. data/spec/controllers/posts_controller_spec.rb +120 -0
  70. data/spec/dummy/README.rdoc +261 -0
  71. data/spec/dummy/Rakefile +7 -0
  72. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  73. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  74. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  75. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  76. data/spec/dummy/app/models/ability.rb +13 -0
  77. data/spec/dummy/app/models/user.rb +11 -0
  78. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  79. data/spec/dummy/config.ru +4 -0
  80. data/spec/dummy/config/application.rb +59 -0
  81. data/spec/dummy/config/boot.rb +10 -0
  82. data/spec/dummy/config/database.yml +25 -0
  83. data/spec/dummy/config/environment.rb +5 -0
  84. data/spec/dummy/config/environments/development.rb +37 -0
  85. data/spec/dummy/config/environments/production.rb +67 -0
  86. data/spec/dummy/config/environments/test.rb +37 -0
  87. data/spec/dummy/config/initializers/almanac.rb +1 -0
  88. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  89. data/spec/dummy/config/initializers/devise.rb +233 -0
  90. data/spec/dummy/config/initializers/dragonfly.rb +7 -0
  91. data/spec/dummy/config/initializers/inflections.rb +15 -0
  92. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  93. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  94. data/spec/dummy/config/initializers/session_store.rb +8 -0
  95. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  96. data/spec/dummy/config/locales/en.yml +5 -0
  97. data/spec/dummy/config/routes.rb +14 -0
  98. data/spec/dummy/db/migrate/20121009230705_create_almanac_posts.rb +18 -0
  99. data/spec/dummy/db/migrate/20121010033827_create_almanac_blogs.rb +15 -0
  100. data/spec/dummy/db/migrate/20121102224650_add_excerpt_to_almanac_posts.rb +12 -0
  101. data/spec/dummy/db/migrate/20121102224651_create_almanac_files..rb +16 -0
  102. data/spec/dummy/db/migrate/20121102224652_rename_file_to_image.rb +10 -0
  103. data/spec/dummy/db/migrate/20121102224653_add_image_fields_to_almanac_blogs.rb +14 -0
  104. data/spec/dummy/db/migrate/20121102224654_add_new_fields_to_almanac_blogs.rb +16 -0
  105. data/spec/dummy/db/migrate/20121102224655_acts_as_taggable_on_migration.rb +31 -0
  106. data/spec/dummy/db/migrate/20121102224656_create_almanac_comments.rb +17 -0
  107. data/spec/dummy/db/migrate/20121102224657_add_rakismet_fields_to_almanac_blogs.rb +14 -0
  108. data/spec/dummy/db/migrate/20121102224658_add_spam_to_almanac_comments.rb +12 -0
  109. data/spec/dummy/db/migrate/20121106220325_devise_create_users.rb +46 -0
  110. data/spec/dummy/db/migrate/20121114032144_add_written_at_to_almanac_posts.rb +12 -0
  111. data/spec/dummy/db/migrate/20121114032145_add_background_fields_to_almanac_blogs.rb +14 -0
  112. data/spec/dummy/db/migrate/20121114032146_add_footer_to_almanac_blogs.rb +12 -0
  113. data/spec/dummy/db/schema.rb +98 -0
  114. data/spec/dummy/db/test.sqlite3 +0 -0
  115. data/spec/dummy/log/production.log +1 -0
  116. data/spec/dummy/log/test.log +2930 -0
  117. data/spec/dummy/public/404.html +26 -0
  118. data/spec/dummy/public/422.html +26 -0
  119. data/spec/dummy/public/500.html +25 -0
  120. data/spec/dummy/public/favicon.ico +0 -0
  121. data/spec/dummy/script/rails +6 -0
  122. data/spec/factories.rb +72 -0
  123. data/spec/models/blog_spec.rb +16 -0
  124. data/spec/models/comment_spec.rb +35 -0
  125. data/spec/models/post_spec.rb +79 -0
  126. data/spec/spec_helper.rb +37 -0
  127. metadata +485 -0
@@ -0,0 +1,59 @@
1
+ .well.post
2
+ %h4
3
+ = link_to (@post.title.nil? or @post.title.empty?) ? "No Title" : @post.title, @post
4
+ - if (action_name == "index" or action_name == "tag") and !(@post.excerpt.nil? or @post.excerpt.empty?)
5
+ .content
6
+ = @markdown_parser.markdown_to_html(@post.excerpt).html_safe
7
+ %p
8
+ = link_to "Continue reading...", @post
9
+ - else
10
+ .content
11
+ = @markdown_parser.markdown_to_html(@post.body).html_safe if !(@post.body.nil? or @post.body.empty?)
12
+ - unless @post.tag_list.empty?
13
+ %div.tags
14
+ - @post.tag_list.each_with_index do |tag, index|
15
+ = succeed (index < @post.tag_list.count - 1) ? " " : "" do
16
+ %a{:href => tag_path(tag), :class => "label"}>= tag
17
+ %hr.gradient-black
18
+ .actions
19
+ - if @post.published
20
+ = link_to "#{post_path(@post)}#comments" do
21
+ %i.icon-comment.icon
22
+ = link_to "http://twitter.com/share?url=#{post_url(@post)}#{"&via="+@blog.twitter unless @blog.twitter.empty?}&text=#{@post.title}", :target => "_blank", :class => "popup" do
23
+ %i.icon-retweet.icon
24
+ = link_to "http://www.facebook.com/share.php?u=#{post_url(@post)}", :target => "_blank", :class => "popup" do
25
+ %i.icon-thumbs-up.icon
26
+
27
+ - if can? :edit, @post
28
+ = link_to edit_post_path(@post), :class => "" do
29
+ %i.icon-edit.icon
30
+ - if can? :delete, @post
31
+ = link_to post_path(@post), :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "delete-post" do
32
+ %i.icon-trash.icon
33
+ - if @post.published and action_name == "show"
34
+ %hr.gradient-black
35
+ #comments
36
+ - unless @comments.empty?
37
+ %h4 Comments
38
+ - @comments.each do |comment|
39
+ .well
40
+ %h5
41
+ = "#{comment.author_name} said #{time_ago_in_words comment.created_at} ago:"
42
+ = comment.body
43
+ .actions
44
+ - if can? :delete, comment
45
+ = link_to post_comment_path(@post, comment), :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "delete-comment" do
46
+ %i.icon-trash.icon
47
+ %hr.gradient-black
48
+ %h4 Leave a Comment
49
+ = form_for([@post, @post.comments.build]) do |f|
50
+ .field
51
+ = f.label :author_name, "Name"
52
+ = f.text_field :author_name, :placeholder => "This field is required."
53
+ .field
54
+ = f.label :author_email, "Email"
55
+ = f.text_field :author_email, :placeholder => "This field is required."
56
+ .field
57
+ = f.label :body, "Comment"
58
+ = f.text_area :body, :placeholder => "Type your comment here.", :rows => 3
59
+ = f.submit :class => "btn btn-small", :value => "Post Your Comment"
@@ -0,0 +1 @@
1
+ = render "form"
@@ -0,0 +1,30 @@
1
+ - if @blog.nil?
2
+ .well
3
+ -if !current_user.nil?
4
+ Create your first blog
5
+ - else
6
+ %em current_user
7
+ is not defined. You have to be logged in with Devise in order to configure your first blog.
8
+ - else
9
+ - if @posts.empty? and @drafts.empty?
10
+ .well
11
+ = link_to "Create Your First Post", new_post_path, :class => "btn"
12
+ - else
13
+ - unless @drafts.empty?
14
+ %h3.head Your #{pluralize(@drafts.count, "draft")}:
15
+ - @drafts.each do |draft|
16
+ - @post = draft
17
+ - unless @post.nil?
18
+ = render "post"
19
+ - unless @posts.empty?
20
+ %hr.gradient-white
21
+ - old_date = DateTime.now + 1.day
22
+ - @posts.each do |post|
23
+ - @post = post
24
+ - unless @post.nil?
25
+ - unless old_date.day == @post.written_at.day and old_date.month == @post.written_at.month and old_date.year == @post.written_at.year
26
+ %h3.head
27
+ = @post.written_at.strftime("%B %d, %Y")
28
+ = render "post"
29
+ - old_date = @post.written_at
30
+ = will_paginate(@posts, :renderer => BootstrapPagination::Rails)
@@ -0,0 +1,18 @@
1
+ xml.instruct! :xml, :version => "1.0"
2
+ xml.rss :version => "2.0" do
3
+ xml.channel do
4
+ xml.title (@blog.title) ? @blog.title : "Unnamed Blog"
5
+ xml.description (@blog.description) ? @blog.description : ""
6
+ xml.link posts_url
7
+
8
+ for post in @posts
9
+ xml.item do
10
+ xml.title post.title
11
+ xml.description @markdown_parser.markdown_to_html(post.body).html_safe
12
+ xml.pubDate post.created_at.to_s(:rfc822)
13
+ xml.link post_url(post)
14
+ xml.guid post_url(post)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ = render "form"
@@ -0,0 +1,4 @@
1
+ - unless @post.nil?
2
+ %h3.head
3
+ = @post.created_at.strftime("%B %d, %Y")
4
+ = render "post"
@@ -0,0 +1,22 @@
1
+ - if @blog.nil?
2
+ .well
3
+ -if current_user.nil?
4
+ current_user is not defined. You have to be logged in with Devise in order to configure your first blog.
5
+ - else
6
+ Create your first blog
7
+ - else
8
+ - if @posts.empty?
9
+ .well.centered
10
+ = link_to "Create Your First Post Tagged with “#{@tag}”", new_post_path, :class => "btn"
11
+ - else
12
+ %h3.head Posts Tagged with “#{@tag}”
13
+ - old_date = DateTime.now + 1.day
14
+ - @posts.each do |post|
15
+ - @post = post
16
+ - unless @post.nil?
17
+ - unless old_date.day == @post.written_at.day and old_date.month == @post.written_at.month and old_date.year == @post.written_at.year
18
+ %h3.head
19
+ = @post.written_at.strftime("%B %d, %Y")
20
+ = render "post"
21
+ - old_date = @post.written_at
22
+ = will_paginate(@posts, :renderer => BootstrapPagination::Rails)
@@ -0,0 +1,10 @@
1
+ :javascript
2
+ var _gaq = _gaq || [];
3
+ _gaq.push(['_setAccount', #{@blog.google_anaytics}]);
4
+ _gaq.push(['_trackPageview']);
5
+
6
+ (function() {
7
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
8
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
9
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
10
+ })();
@@ -0,0 +1,2 @@
1
+ :javascript
2
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
@@ -0,0 +1,52 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title
5
+ = (@blog) ? ((@blog.title) ? @blog.title : "Almanac Blog") : "Almanac Blog"
6
+ = auto_discovery_link_tag(:rss, "#{root_path}posts.rss")
7
+ = stylesheet_link_tag "almanac/application", :media => "all"
8
+ = javascript_include_tag "almanac/application"
9
+ = csrf_meta_tags
10
+ %body.almanac{ "data-logo-image" => (@blog) ? ((@blog.logo) ? @blog.logo.url : nil) : nil,
11
+ "data-background-image" => (@blog) ? ((@blog.background) ? @blog.background.url : nil) : nil,
12
+ "data-background-tile" => (@blog) ? ((@blog.background_tile) ? "true" : "false") : "true",
13
+ "data-background-blur" => (@blog) ? ((@blog.background_blur) ? @blog.background_blur : 0) : 0 }
14
+ .container
15
+ .page-header#header
16
+ %h2
17
+ - if @blog.nil?
18
+ = "Your Blog Doesn't Exist Yet"
19
+ - else
20
+ = link_to(:root, :class => "logo") do
21
+ .img-circle
22
+ = link_to(:root, :class => "title") do
23
+ = @blog.title
24
+ - unless @blog.nil? or @blog.id.nil?
25
+ #top-controls
26
+ - unless cannot? :create, Almanac::Post
27
+ = link_to(new_post_path) do
28
+ %img{ :src => asset_path('almanac/icons/compose.png') }
29
+ - unless cannot? :manage, @blog
30
+ = link_to(edit_blog_path(@blog)) do
31
+ %img{ :src => asset_path('almanac/icons/gear.png') }
32
+ = link_to("#{root_path}posts.rss") do
33
+ %img{ :src => asset_path('almanac/icons/feed.png') }
34
+ - unless @blog.twitter.empty?
35
+ %a.twitter-follow-button{"data-show-count" => "false", :href => "https://twitter.com/#{@blog.twitter}"}
36
+ = "Follow @#{@blog.twitter}"
37
+ = render :template => 'layouts/almanac/_twitter_follow'
38
+ %hr.gradient-white
39
+ - if alert
40
+ .alert.alert-error.alert-block
41
+ %a.close{"data-dismiss" => "alert"} ×
42
+ = alert
43
+ - if notice
44
+ .alert.alert-info.alert-block
45
+ %a.close{"data-dismiss" => "alert"} ×
46
+ = notice
47
+ = yield
48
+ %hr.gradient-white
49
+ .footer
50
+ = (@blog) ? ((@blog.footer) ? @markdown_parser.markdown_to_html(@blog.footer).html_safe : "&copy; #{Date.today.year}".html_safe) : nil
51
+ - unless @blog.nil? or @blog.google_analytics.nil? or @blog.google_analytics.empty?
52
+ = render :template => 'layouts/almanac/_ga'
@@ -0,0 +1,22 @@
1
+ Almanac::Engine.routes.draw do
2
+ root :to => "posts#index"
3
+
4
+ match "new_blog" => "blogs#new", :as => "new_blog"
5
+ resources :blogs do
6
+ member do
7
+ get "spam" => "blogs#spam"
8
+ end
9
+ end
10
+
11
+ match ":id/edit" => "posts#edit", :as => "edit_post"
12
+ match "new" => "posts#new", :as => "new_post"
13
+ match ":id" => "posts#show", :as => "post", :via => :get
14
+ match ":id" => "posts#create", :as => "post", :via => :post
15
+ match ":id" => "posts#update", :as => "post", :via => :put
16
+ match ":id" => "posts#destroy", :as => "post", :via => :delete
17
+ resources :posts do
18
+ resources :images
19
+ resources :comments
20
+ end
21
+ get 'tags/:tag_name', :to => "posts#tag", :as => "tag"
22
+ end
@@ -0,0 +1,17 @@
1
+ class CreateAlmanacPosts < ActiveRecord::Migration
2
+ def up
3
+ create_table :almanac_posts do |t|
4
+ t.string :title
5
+ t.text :body
6
+ t.boolean :published, :default => false
7
+ t.references :blog
8
+ t.references :author
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+
14
+ def down
15
+ drop_table :almanac_posts
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ class CreateAlmanacBlogs < ActiveRecord::Migration
2
+ def up
3
+ create_table :almanac_blogs do |t|
4
+ t.string :title
5
+ t.references :author
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def down
12
+ drop_table :almanac_blogs
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ class AddExcerptToAlmanacPosts < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_posts do |t|
4
+ t.text :excerpt
5
+ end
6
+ end
7
+
8
+ def down
9
+ remove_column :almanac_posts, :excerpt
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ class CreateAlmanacFiles < ActiveRecord::Migration
2
+ def up
3
+ create_table :almanac_files do |t|
4
+ t.string :image_uid
5
+ t.string :thumb_uid
6
+ t.references :post
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def down
13
+ drop_table :almanac_files
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ class RenameFileToImage < ActiveRecord::Migration
2
+ def up
3
+ rename_table :almanac_files, :almanac_images
4
+ end
5
+
6
+ def down
7
+ rename_table :almanac_images, :almanac_files
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ class AddImageFieldsToAlmanacBlogs < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_blogs do |t|
4
+ t.string :background_uid
5
+ t.string :logo_uid
6
+ end
7
+ end
8
+
9
+ def down
10
+ remove_column :almanac_blogs, :background_uid
11
+ remove_column :almanac_blogs, :logo_uid
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ class AddNewFieldsToBlogs < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_blogs do |t|
4
+ t.text :description
5
+ t.string :twitter
6
+ t.string :google_analytics
7
+ end
8
+ end
9
+
10
+ def down
11
+ remove_column :almanac_blogs, :description
12
+ remove_column :almanac_blogs, :twitter
13
+ remove_column :almanac_blogs, :google_analytics
14
+ end
15
+ end
@@ -0,0 +1,30 @@
1
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tags do |t|
4
+ t.string :name
5
+ end
6
+
7
+ create_table :taggings do |t|
8
+ t.references :tag
9
+
10
+ # You should make sure that the column created is
11
+ # long enough to store the required class names.
12
+ t.references :taggable, :polymorphic => true
13
+ t.references :tagger, :polymorphic => true
14
+
15
+ # Limit is created to prevent MySQL error on index
16
+ # length for MyISAM table type: http://bit.ly/vgW2Ql
17
+ t.string :context, :limit => 128
18
+
19
+ t.datetime :created_at
20
+ end
21
+
22
+ add_index :taggings, :tag_id
23
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
24
+ end
25
+
26
+ def self.down
27
+ drop_table :taggings
28
+ drop_table :tags
29
+ end
30
+ end
@@ -0,0 +1,16 @@
1
+ class CreateAlmanacComments < ActiveRecord::Migration
2
+ def up
3
+ create_table :almanac_comments do |t|
4
+ t.text :body
5
+ t.string :author_email
6
+ t.string :author_name
7
+ t.references :post
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def down
14
+ drop_table :almanac_comments
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ class AddRakismetFieldsToBlogs < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_blogs do |t|
4
+ t.string :rakismet_key
5
+ t.string :rakismet_url
6
+ end
7
+ end
8
+
9
+ def down
10
+ remove_column :almanac_blogs, :rakismet_key
11
+ remove_column :almanac_blogs, :rakismet_url
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ class AddSpamToComments < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_comments do |t|
4
+ t.boolean :spam, :default => false
5
+ end
6
+ end
7
+
8
+ def down
9
+ remove_column :almanac_comments, :spam
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class AddWrittenAtToPosts < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_posts do |t|
4
+ t.date :written_at
5
+ end
6
+ end
7
+
8
+ def down
9
+ remove_column :almanac_posts, :written_at
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class AddBackgroundFieldsToBlogs < ActiveRecord::Migration
2
+ def up
3
+ change_table :almanac_blogs do |t|
4
+ t.boolean :background_tile, :default => false
5
+ t.integer :background_blur, :default => 0
6
+ end
7
+ end
8
+
9
+ def down
10
+ remove_column :almanac_blogs, :background_tile
11
+ remove_column :almanac_blogs, :background_blur
12
+ end
13
+ end