blogelator 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +86 -0
  4. data/Rakefile +29 -0
  5. data/app/assets/images/blogelator/blogelator-logo.svg +15 -0
  6. data/app/assets/javascripts/blogelator/admin.js +19 -0
  7. data/app/assets/javascripts/blogelator/application.js +2 -0
  8. data/app/assets/javascripts/blogelator/components/markdown_editor_component.js +187 -0
  9. data/app/assets/javascripts/blogelator/components/save_button_component.js +76 -0
  10. data/app/assets/javascripts/blogelator/config/marked.js +10 -0
  11. data/app/assets/javascripts/blogelator/config/router.js +9 -0
  12. data/app/assets/javascripts/blogelator/config/routes.js +13 -0
  13. data/app/assets/javascripts/blogelator/config/serializer.js +10 -0
  14. data/app/assets/javascripts/blogelator/config/store.js +10 -0
  15. data/app/assets/javascripts/blogelator/controllers/application_controller.js +11 -0
  16. data/app/assets/javascripts/blogelator/controllers/posts/posts_edit_controller.js +97 -0
  17. data/app/assets/javascripts/blogelator/controllers/posts/posts_index_controller.js +9 -0
  18. data/app/assets/javascripts/blogelator/controllers/posts/posts_new_controller.js +6 -0
  19. data/app/assets/javascripts/blogelator/controllers/posts/posts_show_controller.js +37 -0
  20. data/app/assets/javascripts/blogelator/models/post.js +34 -0
  21. data/app/assets/javascripts/blogelator/routes/index_route.js +10 -0
  22. data/app/assets/javascripts/blogelator/routes/posts_edit_route.js +36 -0
  23. data/app/assets/javascripts/blogelator/routes/posts_index_route.js +20 -0
  24. data/app/assets/javascripts/blogelator/routes/posts_new_route.js +53 -0
  25. data/app/assets/javascripts/blogelator/routes/posts_route.js +10 -0
  26. data/app/assets/javascripts/blogelator/routes/posts_show_route.js +14 -0
  27. data/app/assets/javascripts/blogelator/templates/application.handlebars +23 -0
  28. data/app/assets/javascripts/blogelator/templates/components/markdown-editor.handlebars +8 -0
  29. data/app/assets/javascripts/blogelator/templates/components/save-button.handlebars +8 -0
  30. data/app/assets/javascripts/blogelator/templates/posts/_footer.handlebars +0 -0
  31. data/app/assets/javascripts/blogelator/templates/posts/_form.handlebars +6 -0
  32. data/app/assets/javascripts/blogelator/templates/posts/_form_action_bar.handlebars +22 -0
  33. data/app/assets/javascripts/blogelator/templates/posts/_show_action_bar.handlebars +20 -0
  34. data/app/assets/javascripts/blogelator/templates/posts/edit.handlebars +1 -0
  35. data/app/assets/javascripts/blogelator/templates/posts/index.handlebars +30 -0
  36. data/app/assets/javascripts/blogelator/templates/posts/new.handlebars +1 -0
  37. data/app/assets/javascripts/blogelator/templates/posts/show.handlebars +22 -0
  38. data/app/assets/stylesheets/blogelator/admin/all.scss +7 -0
  39. data/app/assets/stylesheets/blogelator/admin/components/markdown_editor.scss +142 -0
  40. data/app/assets/stylesheets/blogelator/admin/components/save_button.scss +121 -0
  41. data/app/assets/stylesheets/blogelator/admin/layout.scss +94 -0
  42. data/app/assets/stylesheets/blogelator/admin/posts/_form.scss +12 -0
  43. data/app/assets/stylesheets/blogelator/admin/posts/_form_action_bar.scss +84 -0
  44. data/app/assets/stylesheets/blogelator/admin/posts/_posts_list.scss +43 -0
  45. data/app/assets/stylesheets/blogelator/admin/posts/edit.scss +7 -0
  46. data/app/assets/stylesheets/blogelator/admin/posts/index.scss +14 -0
  47. data/app/assets/stylesheets/blogelator/admin/posts/new.scss +16 -0
  48. data/app/assets/stylesheets/blogelator/admin/posts/show.scss +17 -0
  49. data/app/assets/stylesheets/blogelator/application/all.scss +19 -0
  50. data/app/assets/stylesheets/blogelator/application/layout.scss +49 -0
  51. data/app/assets/stylesheets/blogelator/application/posts/index.scss +50 -0
  52. data/app/assets/stylesheets/blogelator/application/posts/show.scss +64 -0
  53. data/app/assets/stylesheets/blogelator/mixins/blogelator_button.scss +57 -0
  54. data/app/assets/stylesheets/blogelator/mixins/blogelator_logo.scss +12 -0
  55. data/app/assets/stylesheets/blogelator/shared/post.scss +161 -0
  56. data/app/assets/stylesheets/blogelator/shared/typography/code_highlighting.scss +111 -0
  57. data/app/assets/stylesheets/blogelator/shared/typography/forms.scss +94 -0
  58. data/app/assets/stylesheets/blogelator/shared/typography/headings.scss +22 -0
  59. data/app/assets/stylesheets/blogelator/shared/typography/lists.scss +25 -0
  60. data/app/controllers/blogelator/admin/application_controller.rb +15 -0
  61. data/app/controllers/blogelator/admin/images_controller.rb +40 -0
  62. data/app/controllers/blogelator/admin/posts_controller.rb +67 -0
  63. data/app/controllers/blogelator/application_controller.rb +5 -0
  64. data/app/controllers/blogelator/posts_controller.rb +37 -0
  65. data/app/controllers/concerns/blogelator/admin/auth.rb +23 -0
  66. data/app/helpers/blogelator/admin/posts_helper.rb +7 -0
  67. data/app/helpers/blogelator/posts_helper.rb +28 -0
  68. data/app/models/blogelator/ability.rb +11 -0
  69. data/app/models/blogelator/html_renderer.rb +10 -0
  70. data/app/models/blogelator/post.rb +63 -0
  71. data/app/models/blogelator/tag.rb +5 -0
  72. data/app/serializers/blogelator/post_serializer.rb +6 -0
  73. data/app/views/blogelator/admin/posts/index.html.erb +0 -0
  74. data/app/views/blogelator/posts/_post.html.erb +14 -0
  75. data/app/views/blogelator/posts/index.html.erb +39 -0
  76. data/app/views/blogelator/posts/show.html.erb +27 -0
  77. data/app/views/layouts/blogelator/_footer.html.erb +3 -0
  78. data/app/views/layouts/blogelator/_head.html.erb +7 -0
  79. data/app/views/layouts/blogelator/_header.html.erb +7 -0
  80. data/app/views/layouts/blogelator/admin.html.erb +14 -0
  81. data/app/views/layouts/blogelator/application.html.erb +14 -0
  82. data/config/jshint.json +43 -0
  83. data/config/routes.rb +15 -0
  84. data/db/migrate/20140221192000_create_blogelator_posts.rb +12 -0
  85. data/db/migrate/20140221204230_add_slug_and_change_user_to_author.rb +6 -0
  86. data/db/migrate/20140221212026_create_blogelator_tags.rb +10 -0
  87. data/db/migrate/20140224024607_change_posts_properties_to_have_defaults.rb +14 -0
  88. data/db/migrate/20140224175024_add_slugs_to_existing_posts.rb +16 -0
  89. data/db/migrate/20140224192058_add_published_at_to_posts.rb +13 -0
  90. data/db/migrate/20140303015004_add_summary_to_posts.rb +9 -0
  91. data/lib/assets/stylesheets/blogelator/_variables_sample.scss +38 -0
  92. data/lib/blogelator.rb +27 -0
  93. data/lib/blogelator/engine.rb +35 -0
  94. data/lib/blogelator/version.rb +3 -0
  95. data/lib/generators/blogelator/install_generator.rb +94 -0
  96. data/spec/dummy/README.rdoc +28 -0
  97. data/spec/dummy/Rakefile +6 -0
  98. data/spec/dummy/app/assets/javascripts/application.js +1 -0
  99. data/spec/dummy/app/assets/javascripts/features/user_visits_admin_page_spec.js +12 -0
  100. data/spec/dummy/app/assets/javascripts/features/user_visits_post_page_spec.js +12 -0
  101. data/spec/dummy/app/assets/javascripts/fixtures/post.js +17 -0
  102. data/spec/dummy/app/assets/javascripts/test_helper.js +12 -0
  103. data/spec/dummy/app/assets/stylesheets/application.css +12 -0
  104. data/spec/dummy/app/assets/stylesheets/blogelator/_variables.scss +38 -0
  105. data/spec/dummy/app/assets/stylesheets/blogelator/admin.css.scss +4 -0
  106. data/spec/dummy/app/assets/stylesheets/blogelator/application.css.scss +4 -0
  107. data/spec/dummy/app/assets/stylesheets/test_helper.css +21 -0
  108. data/spec/dummy/app/controllers/application_controller.rb +9 -0
  109. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  110. data/spec/dummy/app/models/blogelator/ability.rb +9 -0
  111. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  112. data/spec/dummy/app/views/q_unit/rails/test/index.html.erb +17 -0
  113. data/spec/dummy/app/views/qunit/rails/test/index.html.erb +17 -0
  114. data/spec/dummy/bin/bundle +3 -0
  115. data/spec/dummy/bin/rails +4 -0
  116. data/spec/dummy/bin/rake +4 -0
  117. data/spec/dummy/config.ru +4 -0
  118. data/spec/dummy/config/application.rb +24 -0
  119. data/spec/dummy/config/boot.rb +5 -0
  120. data/spec/dummy/config/database.yml +25 -0
  121. data/spec/dummy/config/environment.rb +5 -0
  122. data/spec/dummy/config/environments/development.rb +32 -0
  123. data/spec/dummy/config/environments/production.rb +80 -0
  124. data/spec/dummy/config/environments/test.rb +36 -0
  125. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  126. data/spec/dummy/config/initializers/blogelator.rb +6 -0
  127. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  128. data/spec/dummy/config/initializers/inflections.rb +16 -0
  129. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  130. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  131. data/spec/dummy/config/initializers/session_store.rb +3 -0
  132. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  133. data/spec/dummy/config/locales/en.yml +23 -0
  134. data/spec/dummy/config/routes.rb +3 -0
  135. data/spec/dummy/db/development.sqlite3 +0 -0
  136. data/spec/dummy/db/migrate/20140221215439_create_blogelator_posts.blogelator.rb +13 -0
  137. data/spec/dummy/db/migrate/20140221215440_add_slug_and_change_user_to_author.blogelator.rb +7 -0
  138. data/spec/dummy/db/migrate/20140224024931_create_blogelator_tags.blogelator.rb +11 -0
  139. data/spec/dummy/db/migrate/20140224025218_change_posts_properties_to_have_defaults.blogelator.rb +15 -0
  140. data/spec/dummy/db/migrate/20140224205646_add_slugs_to_existing_posts.blogelator.rb +17 -0
  141. data/spec/dummy/db/migrate/20140224205647_add_published_at_to_posts.blogelator.rb +14 -0
  142. data/spec/dummy/db/migrate/20140303015133_add_summary_to_posts.blogelator.rb +6 -0
  143. data/spec/dummy/db/production.sqlite3 +0 -0
  144. data/spec/dummy/db/schema.rb +37 -0
  145. data/spec/dummy/db/test.sqlite3 +0 -0
  146. data/spec/dummy/log/development.log +50393 -0
  147. data/spec/dummy/log/production.log +76 -0
  148. data/spec/dummy/log/test.log +11750 -0
  149. data/spec/dummy/public/404.html +58 -0
  150. data/spec/dummy/public/422.html +58 -0
  151. data/spec/dummy/public/500.html +57 -0
  152. data/spec/dummy/public/favicon.ico +0 -0
  153. data/spec/dummy/public/index.html.erb +14 -0
  154. data/spec/dummy/tmp/ember-rails/ember-data.js +11132 -0
  155. data/spec/dummy/tmp/ember-rails/ember.js +42882 -0
  156. data/spec/factories/post.rb +11 -0
  157. data/spec/features/user_visits_blog_post_spec.rb +44 -0
  158. data/spec/features/user_visits_blog_spec.rb +85 -0
  159. data/spec/models/blogelator/post_spec.rb +95 -0
  160. data/spec/qunit_runner.js +148 -0
  161. data/spec/spec_helper.rb +34 -0
  162. metadata +764 -0
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <%= render partial: "layouts/blogelator/head" %>
5
+
6
+ <body class="<%= body_class %>">
7
+ <%= render partial: "layouts/blogelator/header" %>
8
+ <main>
9
+ <%= yield %>
10
+ </main>
11
+ <%= render partial: "layouts/blogelator/footer" %>
12
+ </body>
13
+
14
+ </html>
@@ -0,0 +1,43 @@
1
+ {
2
+ "camelcase": true,
3
+ "indent": 2,
4
+ "white": false,
5
+ "curly": true,
6
+ "eqeqeq": true,
7
+ "immed": true,
8
+ "latedef": true,
9
+ "newcap": true,
10
+ "noarg": true,
11
+ "sub": true,
12
+ "undef": true,
13
+ "boss": true,
14
+ "eqnull": true,
15
+ "browser": true,
16
+ "predef": {
17
+ "alert": true,
18
+ "confirm": true,
19
+ "console": true,
20
+ "test": true,
21
+ "equal": true,
22
+ "ok": true,
23
+ "sinon": true,
24
+ "require": true,
25
+ "$": true,
26
+ "jQuery": true,
27
+ "Ember": true,
28
+ "Handlebars": true,
29
+ "App": true,
30
+ "DS": true,
31
+ "marked": true,
32
+ "prettyPrintOne": true,
33
+ "CodeMirror": true,
34
+ "inlineAttach": true,
35
+ "moment": true,
36
+ "module": true,
37
+ "test": true,
38
+ "visit": true,
39
+ "find": true,
40
+ "andThen": true
41
+ }
42
+ }
43
+
data/config/routes.rb ADDED
@@ -0,0 +1,15 @@
1
+ Blogelator::Engine.routes.draw do
2
+ # Admin Routes with Ember.Router location: 'history' support
3
+ get "/admin", to: "admin/posts#index"
4
+ get "/admin/*path", to: "admin/posts#index"
5
+ namespace :admin, path: "api" do
6
+ resources :images
7
+ resources :posts
8
+ end
9
+
10
+ # Public Routes
11
+ resources :posts, path: "/" do
12
+ get "/page/:page", action: "index", on: :collection
13
+ end
14
+ root to: "posts#index"
15
+ end
@@ -0,0 +1,12 @@
1
+ class CreateBlogelatorPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :blogelator_posts do |t|
4
+ t.string :title
5
+ t.integer :user_id
6
+ t.text :body_html
7
+ t.text :body_markdown
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class AddSlugAndChangeUserToAuthor < ActiveRecord::Migration
2
+ def change
3
+ add_column :blogelator_posts, :slug, :string
4
+ rename_column :blogelator_posts, :user_id, :author_id
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ class CreateBlogelatorTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :blogelator_tags do |t|
4
+ t.string :name
5
+ t.belongs_to :post, index: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ class ChangePostsPropertiesToHaveDefaults < ActiveRecord::Migration
2
+ def change
3
+ Blogelator::Post.all.each do |post|
4
+ post.title = post.title.to_s
5
+ post.body_html = post.body_html.to_s
6
+ post.body_markdown = post.body_markdown.to_s
7
+ post.save
8
+ end
9
+
10
+ change_column :blogelator_posts, :title, :string, default: "", null: false
11
+ change_column :blogelator_posts, :body_html, :text, default: "", null: false
12
+ change_column :blogelator_posts, :body_markdown, :text, default: "", null: false
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ class AddSlugsToExistingPosts < ActiveRecord::Migration
2
+ def up
3
+ Blogelator::Post.all.each do |post|
4
+ post.slug = post.title.parameterize
5
+ existing_slug_count = post.class.where(slug: post.slug).count
6
+ if existing_slug_count > 0
7
+ post.slug = post.slug + "-#{existing_slug_count}"
8
+ end
9
+ post.save
10
+ end
11
+ end
12
+
13
+ def down
14
+ # Do nothing
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ class AddPublishedAtToPosts < ActiveRecord::Migration
2
+ def up
3
+ add_column :blogelator_posts, :published_at, :datetime
4
+ Blogelator::Post.all.each do |post|
5
+ post.published_at = post.created_at
6
+ post.save
7
+ end
8
+ end
9
+
10
+ def down
11
+ remove_column :blogelator_posts, :published_at
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class AddSummaryToPosts < ActiveRecord::Migration
2
+ def change
3
+ add_column :blogelator_posts, :summary, :text, default: "", null: false
4
+
5
+ Blogelator::Post.all.each do |post|
6
+ post.save!
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ @import "bourbon";
2
+
3
+ // Typography
4
+ $sans-serif: $helvetica;
5
+ $serif: $georgia;
6
+
7
+ $base-font-family: $sans-serif;
8
+ $header-font-family: $base-font-family;
9
+
10
+ // Sizes
11
+ $base-font-size: 16px;
12
+ $base-line-height: 1.5em;
13
+ $base-border-radius: em(3);
14
+
15
+ // Body Color
16
+ $base-body-color: #fff;
17
+
18
+ // Font Colors
19
+ $base-font-color: #3e3e3e;
20
+ $base-accent-color: #df0061;
21
+
22
+ // Text Link Colors
23
+ $base-link-color: $base-accent-color;
24
+ $hover-link-color: darken($base-accent-color, 8%);
25
+
26
+ // Border color
27
+ $base-border-color: #ddd;
28
+
29
+ // Flash Colors
30
+ $error-color: #fbe3e4;
31
+ $notice-color: #fff6bf;
32
+ $success-color: #e6efc2;
33
+
34
+ // Admin Colors
35
+ $admin-header-color: #444;
36
+ $admin-header-accent-color: $base-accent-color;
37
+ $admin-header-active-color: #fff;
38
+ $admin-header-highlight-color: lighten($base-accent-color, 20%);
data/lib/blogelator.rb ADDED
@@ -0,0 +1,27 @@
1
+ require "aws-sdk"
2
+ require "bourbon"
3
+ require "cancan"
4
+ require "deface"
5
+ require "ember-rails"
6
+ require "font-awesome-sass"
7
+ require "jquery-rails"
8
+ require "kaminari"
9
+ require "local_time"
10
+ require "neat"
11
+ require "pygments.rb"
12
+ require "redcarpet"
13
+ require "blogelator/engine"
14
+ require "blogelator/version"
15
+
16
+ module Blogelator
17
+ mattr_accessor :posts_per_page, :site_name, :s3_access_key_id,
18
+ :s3_bucket, :s3_secret_access_key, :user_class
19
+
20
+ def self.posts_per_page
21
+ @@posts_per_page ||= 5
22
+ end
23
+
24
+ def self.site_name
25
+ @@site_name ||= "Blogelator"
26
+ end
27
+ end
@@ -0,0 +1,35 @@
1
+ module Blogelator
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Blogelator
4
+
5
+ # Precompile Blogelator Assets
6
+ initializer "blogelator.assets.precompile" do |app|
7
+ app.config.assets.precompile += %w(blogelator/application.css blogelator/admin.css blogelator/admin.js)
8
+ end
9
+
10
+ # Add Blogelator Handlebars Templates Path
11
+ initializer "blogelator.handlebars.config" do |app|
12
+ unless app.config.handlebars.templates_root.is_a?(Array)
13
+ app.config.handlebars.templates_root = [app.config.handlebars.templates_root]
14
+ end
15
+ if app.config.handlebars.templates_root.include?("templates")
16
+ app.config.handlebars.templates_root << "blogelator"
17
+ else
18
+ app.config.handlebars.templates_root << "blogelator/templates"
19
+ end
20
+ end
21
+
22
+ # Load Rails Generators
23
+ generators do
24
+ require File.join(File.expand_path("../..", __FILE__), "generators", "blogelator", "install_generator.rb")
25
+ end
26
+
27
+ # RSpec Configuration
28
+ config.generators do |g|
29
+ g.test_framework :rspec, fixture: false
30
+ g.fixture_replacement :factory_girl, dir: "spec/factories"
31
+ g.assets false
32
+ g.helper false
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module Blogelator
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,94 @@
1
+ module Blogelator
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../../../..", __FILE__)
4
+
5
+ def ask_questions
6
+ @site_name = ask("What is the name of your blog? [Blogelator]")
7
+ if @site_name.blank?
8
+ @site_name = "Blogelator"
9
+ end
10
+
11
+ @blogelator_route = ask("What route should be used to access the blog? [/blog]")
12
+ if @blogelator_route.blank?
13
+ @blogelator_route = "/blog"
14
+ end
15
+
16
+ @user_class = ask("What class is used for user authentication? [User]")
17
+ if @user_class.blank?
18
+ @user_class = "User"
19
+ end
20
+ end
21
+
22
+ def create_initializer_file
23
+ create_file "config/initializers/blogelator.rb", <<-INITIALIZER
24
+ Blogelator.posts_per_page = 5
25
+ Blogelator.site_name = "#{@site_name}"
26
+ Blogelator.user_class = "#{@user_class}"
27
+ Blogelator.s3_access_key_id = ENV["BLOGELATOR_S3_KEY"]
28
+ Blogelator.s3_secret_access_key = ENV["BLOGELATOR_S3_SECRET"]
29
+ Blogelator.s3_bucket = ENV["BLOGELATOR_S3_BUCKET"]
30
+ INITIALIZER
31
+ end
32
+
33
+ def create_stylesheets
34
+ create_file "app/assets/stylesheets/blogelator/application.css.scss", <<-APPLICATIONCSS
35
+ /*
36
+ *= require blogelator/application/all
37
+ *= require_self
38
+ */
39
+ APPLICATIONCSS
40
+
41
+ create_file "app/assets/stylesheets/blogelator/admin.css.scss", <<-ADMINCSS
42
+ /*
43
+ *= require blogelator/admin/all
44
+ *= require_self
45
+ */
46
+ ADMINCSS
47
+ end
48
+
49
+ def copy_variables_file
50
+ puts File.expand_path("../../../..", __FILE__)
51
+ source = "lib/assets/stylesheets/blogelator/_variables_sample.scss"
52
+ destination = "app/assets/stylesheets/blogelator/_variables.scss"
53
+ copy_file source, destination
54
+ end
55
+
56
+ def create_overrides_directory
57
+ empty_directory "app/overrides"
58
+ end
59
+
60
+ def configure_application
61
+ application <<-APP
62
+
63
+ config.to_prepare do
64
+ # Load application's model / class decorators
65
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
66
+ Rails.configuration.cache_classes ? require(c) : load(c)
67
+ end
68
+
69
+ # Load application's view overrides
70
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
71
+ Rails.configuration.cache_classes ? require(c) : load(c)
72
+ end
73
+ end
74
+ APP
75
+ end
76
+
77
+ def install_migrations
78
+ rake "blogelator:install:migrations"
79
+ end
80
+
81
+ def mount_engine
82
+ insert_into_file(File.join("config", "routes.rb"), :after => "Application.routes.draw do\n") do <<-MOUNTENGINE
83
+ # This line mounts Blogelator's routes to the path '#{@blogelator_route}'.
84
+ # This means, any requests to '#{@blogelator_route}', will go to Blogelator::PostsController.
85
+ # If you would like to change where this engine is mounted, simply change the :at option to something different.
86
+ #
87
+ # We ask that you don't use the :as option here, as Blogelator relies on it being the default of "blogelator"
88
+ mount Blogelator::Engine, at: "#{@blogelator_route}"
89
+ MOUNTENGINE
90
+ end
91
+ end
92
+
93
+ end
94
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1 @@
1
+ //= require_self
@@ -0,0 +1,12 @@
1
+ test('User visits the admin page.', function() {
2
+ visit('/');
3
+ andThen(function() {
4
+ // List of posts
5
+ equal(find('.posts-list .post').length, 2, 'The index page should have 2 posts.');
6
+ equal(find('.posts-list .post:first .date').text().trim(), 'January 12, 2014', 'The date should be displayed for each post');
7
+ equal(find('.posts-list .post:first .summary').text().trim(), 'Hello world.', 'The summary should be displayed for each post');
8
+
9
+ // Main content area
10
+ equal(find('article.post h1').text().trim(), 'Ember Is Fun!', 'The first post title should be displayed');
11
+ });
12
+ });
@@ -0,0 +1,12 @@
1
+ test('User visits the the page for a post.', function() {
2
+ visit('/posts/1');
3
+ andThen(function() {
4
+ // List of posts
5
+ equal(find('.posts-list .post.active').length, 1, 'The post should be selected in the side bar');
6
+
7
+ // Main content area
8
+ equal(find('article.post h1').text().trim(), 'Ember Is Fun!', 'The selected post title should be displayed');
9
+ equal(find('article.post .date').text().trim(), 'January 12, 2014', 'The selected post date should be displayed');
10
+ ok(find('article.post .body').html().indexOf('<p>Hello world.</p>' > 0), 'The selected post body should be displayed');
11
+ });
12
+ });