content_engine 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/README +1 -0
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/content_engine.gemspec +3 -118
  5. metadata +6 -117
  6. data/Gemfile +0 -40
  7. data/README.md +0 -43
  8. data/app/controllers/content_engine/articles_controller.rb +0 -54
  9. data/app/controllers/content_engine/pages_controller.rb +0 -76
  10. data/app/controllers/content_engine_controller.rb +0 -14
  11. data/app/helpers/application_helper.rb +0 -2
  12. data/app/models/article.rb +0 -29
  13. data/app/models/content.rb +0 -64
  14. data/app/models/page.rb +0 -40
  15. data/app/models/site.rb +0 -26
  16. data/app/models/tag.rb +0 -53
  17. data/app/models/user.rb +0 -5
  18. data/app/views/content_engine/articles/_form.erb +0 -8
  19. data/app/views/content_engine/articles/edit.html.erb +0 -7
  20. data/app/views/content_engine/articles/index.html.erb +0 -10
  21. data/app/views/content_engine/articles/new.html.erb +0 -6
  22. data/app/views/content_engine/articles/show.html.erb +0 -9
  23. data/app/views/content_engine/pages/_form.erb +0 -8
  24. data/app/views/content_engine/pages/edit.html.erb +0 -7
  25. data/app/views/content_engine/pages/index.html.erb +0 -10
  26. data/app/views/content_engine/pages/new.html.erb +0 -6
  27. data/app/views/content_engine/pages/show.html.erb +0 -9
  28. data/app/views/layouts/application.html.erb +0 -16
  29. data/config/application.rb +0 -1
  30. data/config/locales/en.yml +0 -5
  31. data/config/routes.rb +0 -25
  32. data/db/migrate/20100225105011_create_contents.rb +0 -22
  33. data/db/migrate/20100225105903_create_users.rb +0 -8
  34. data/db/migrate/20100225110024_create_sites.rb +0 -15
  35. data/db/migrate/20100225110037_create_memberships.rb +0 -12
  36. data/db/migrate/20100225112236_acts_as_taggable_on.rb +0 -26
  37. data/db/schema.rb +0 -58
  38. data/lib/content_engine.rb +0 -24
  39. data/lib/tasks/content_engine.rake +0 -24
  40. data/spec/blueprint.rb +0 -41
  41. data/spec/models/article_spec.rb +0 -56
  42. data/spec/models/page_spec.rb +0 -158
  43. data/spec/models/site_spec.rb +0 -32
  44. data/spec/rails_app/.gitignore +0 -4
  45. data/spec/rails_app/Rakefile +0 -10
  46. data/spec/rails_app/app/controllers/admins_controller.rb +0 -6
  47. data/spec/rails_app/app/controllers/application_controller.rb +0 -6
  48. data/spec/rails_app/app/controllers/home_controller.rb +0 -4
  49. data/spec/rails_app/app/controllers/sessions_controller.rb +0 -6
  50. data/spec/rails_app/app/controllers/users_controller.rb +0 -12
  51. data/spec/rails_app/app/helpers/application_helper.rb +0 -3
  52. data/spec/rails_app/app/views/home/index.html.erb +0 -1
  53. data/spec/rails_app/app/views/layouts/application.html.erb +0 -19
  54. data/spec/rails_app/config.ru +0 -4
  55. data/spec/rails_app/config/application.rb +0 -30
  56. data/spec/rails_app/config/boot.rb +0 -9
  57. data/spec/rails_app/config/database.yml +0 -16
  58. data/spec/rails_app/config/environment.rb +0 -5
  59. data/spec/rails_app/config/environments/development.rb +0 -19
  60. data/spec/rails_app/config/environments/production.rb +0 -33
  61. data/spec/rails_app/config/environments/test.rb +0 -29
  62. data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  63. data/spec/rails_app/config/initializers/cookie_verification_secret.rb +0 -7
  64. data/spec/rails_app/config/initializers/inflections.rb +0 -2
  65. data/spec/rails_app/config/initializers/session_store.rb +0 -15
  66. data/spec/rails_app/config/routes.rb +0 -21
  67. data/spec/rails_app/db/migrate/20100225105011_create_contents.rb +0 -22
  68. data/spec/rails_app/db/migrate/20100225105903_create_users.rb +0 -8
  69. data/spec/rails_app/db/migrate/20100225110024_create_sites.rb +0 -15
  70. data/spec/rails_app/db/migrate/20100225110037_create_memberships.rb +0 -12
  71. data/spec/rails_app/db/migrate/20100225112236_acts_as_taggable_on.rb +0 -26
  72. data/spec/rails_app/db/schema.rb +0 -59
  73. data/spec/rails_app/public/404.html +0 -26
  74. data/spec/rails_app/public/422.html +0 -26
  75. data/spec/rails_app/public/500.html +0 -26
  76. data/spec/rails_app/public/favicon.ico +0 -0
  77. data/spec/rails_app/public/images/rails.png +0 -0
  78. data/spec/rails_app/public/javascripts/application.js +0 -2
  79. data/spec/rails_app/public/javascripts/controls.js +0 -963
  80. data/spec/rails_app/public/javascripts/dragdrop.js +0 -973
  81. data/spec/rails_app/public/javascripts/effects.js +0 -1128
  82. data/spec/rails_app/public/javascripts/prototype.js +0 -4320
  83. data/spec/rails_app/public/javascripts/rails.js +0 -110
  84. data/spec/rails_app/public/robots.txt +0 -5
  85. data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
  86. data/spec/rails_app/script/rails +0 -10
  87. data/spec/requests/user_manage_articles_spec.rb +0 -85
  88. data/spec/requests/user_manage_pages_spec.rb +0 -92
  89. data/spec/requests/webrat.log +0 -17
  90. data/spec/spec.opts +0 -2
  91. data/spec/spec_helper.rb +0 -36
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
data/config/routes.rb DELETED
@@ -1,25 +0,0 @@
1
- Rails::Application.routes.draw do
2
- # resources :users, :only => [:index] do
3
- # get :expire, :on => :member
4
- # end
5
- #
6
- # resources :admins, :only => [:index]
7
- #
8
- # devise_for :users
9
- # devise_for :admin, :as => "admin_area", :controllers => { :sessions => "sessions" }
10
- # devise_for :accounts, :scope => "manager", :path_prefix => ":locale",
11
- # :class_name => "User", :path_names => {
12
- # :sign_in => "login", :sign_out => "logout",
13
- # :password => "secret", :confirmation => "verification",
14
- # :unlock => "unblock", :sign_up => "register"
15
- # }
16
- #
17
- # match "/admin_area/home", :to => "admins#index", :as => :admin_root
18
- # match "/sign_in", :to => "devise/sessions#new"
19
-
20
- resources :pages, :controller => 'content_engine/pages'
21
- resources :articles, :controller => 'content_engine/articles'
22
-
23
- match "/:year/:month/:id", :to => "content_engine/articles#show", :requirements => {:year => /\d{4}/, :month => /\d{2}/}
24
- match "/*url", :to => 'content_engine/pages#lookup'
25
- end
@@ -1,22 +0,0 @@
1
- class CreateContents < ActiveRecord::Migration
2
- def self.up
3
- create_table :contents do |t|
4
- t.string :title
5
- t.string :permalink
6
- t.text :description
7
- t.text :body
8
- t.string :type, :default => 'Page'
9
- t.integer :parent_id
10
- t.integer :site_id
11
- t.integer :user_id
12
- t.integer :lft
13
- t.integer :rgt
14
- t.datetime :published_at
15
- t.timestamps
16
- end
17
- end
18
-
19
- def self.down
20
- drop_table :contents
21
- end
22
- end
@@ -1,8 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def self.up
3
-
4
- end
5
-
6
- def self.down
7
- end
8
- end
@@ -1,15 +0,0 @@
1
- class CreateSites < ActiveRecord::Migration
2
- def self.up
3
- create_table :sites do |t|
4
- t.string :title
5
- t.text :description
6
- t.string :time_zone
7
- t.integer :owner_id
8
- t.string :host
9
- end
10
- end
11
-
12
- def self.down
13
- drop_table :sites
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- class CreateMemberships < ActiveRecord::Migration
2
- def self.up
3
- create_table :memberships do |t|
4
- t.integer :site_id
5
- t.integer :user_id
6
- end
7
- end
8
-
9
- def self.down
10
- drop_table :memberships
11
- end
12
- end
@@ -1,26 +0,0 @@
1
- class ActsAsTaggableOn < ActiveRecord::Migration
2
- def self.up
3
- create_table :tags do |t|
4
- t.column :name, :string
5
- end
6
-
7
- create_table :taggings do |t|
8
- t.column :tag_id, :integer
9
- t.column :taggable_id, :integer
10
- t.column :tagger_id, :integer
11
- t.column :tagger_type, :string
12
-
13
- # You should make sure that the column created is
14
- # long enough to store the required class names.
15
- t.column :taggable_type, :string
16
- t.column :context, :string
17
-
18
- t.column :created_at, :datetime
19
- end
20
-
21
- add_index :taggings, :tag_id
22
- end
23
-
24
- def self.down
25
- end
26
- end
data/db/schema.rb DELETED
@@ -1,58 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead of editing this file,
2
- # please use the migrations feature of Active Record to incrementally modify your database, and
3
- # then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
- # to create the application database on another system, you should be using db:schema:load, not running
7
- # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
- # you'll amass, the slower it'll run and the greater likelihood for issues).
9
- #
10
- # It's strongly recommended to check this file into your version control system.
11
- ActiveRecord::Schema.define(:version => 20100225112236) do
12
-
13
- create_table "contents", :force => true do |t|
14
- t.string "title"
15
- t.string "permalink"
16
- t.text "description"
17
- t.text "body"
18
- t.string "type", :default => "Page"
19
- t.integer "parent_id"
20
- t.integer "site_id"
21
- t.integer "user_id"
22
- t.integer "lft"
23
- t.integer "rgt"
24
- t.datetime "published_at"
25
- t.datetime "created_at"
26
- t.datetime "updated_at"
27
- end
28
-
29
- create_table "memberships", :force => true do |t|
30
- t.integer "site_id"
31
- t.integer "user_id"
32
- end
33
-
34
- create_table "sites", :force => true do |t|
35
- t.string "title"
36
- t.text "description"
37
- t.string "time_zone"
38
- t.integer "owner_id"
39
- t.string "host"
40
- end
41
-
42
- create_table "taggings", :force => true do |t|
43
- t.integer "tag_id"
44
- t.integer "taggable_id"
45
- t.integer "tagger_id"
46
- t.string "tagger_type"
47
- t.string "taggable_type"
48
- t.string "context"
49
- t.datetime "created_at"
50
- end
51
-
52
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
53
-
54
- create_table "tags", :force => true do |t|
55
- t.string "name"
56
- end
57
-
58
- end
@@ -1,24 +0,0 @@
1
- require 'rdiscount'
2
- require 'will_paginate'
3
- require 'formtastic'
4
-
5
- module ContentEngine
6
- class Engine < ::Rails::Engine
7
- engine_name :content_engine
8
- end
9
- end
10
-
11
-
12
- # Mixing in plugin methods
13
-
14
- # Permalink Fu
15
- ActiveRecord::Base.send(:extend, PermalinkFu::PluginMethods)
16
-
17
- # ActsAsTaggableOn
18
- ActiveRecord::Base.send :include, ActiveRecord::Acts::TaggableOn
19
- ActiveRecord::Base.send :include, ActiveRecord::Acts::Tagger
20
- ActionView::Base.send :include, TagsHelper if defined?(ActionView::Base)
21
-
22
- # require 'formtastic/layout_helper'
23
- ActionView::Base.send :include, Formtastic::SemanticFormHelper
24
- # ActionView::Base.send :include, Formtastic::LayoutHelper
@@ -1,24 +0,0 @@
1
- namespace :content_engine do
2
-
3
- desc "Generate content engine migration files"
4
- task :migrate do
5
- puts "Generating migration files"
6
-
7
- system "rsync -ruv #{File.expand_path('../../../db/migrate', __FILE__)} db"
8
-
9
- puts "========================="
10
- puts " Please run db:migrate"
11
- puts "========================="
12
- end
13
-
14
- desc "Execute pending migration and create default site"
15
- task :install => :environment do
16
- unless ENV.include?("site")
17
- raise 'usage: rake content_engine:install site="My site name"'
18
- end
19
-
20
- Rake::Task["db:migrate"].invoke
21
-
22
- Site.create(:name => ENV["site"])
23
- end
24
- end
data/spec/blueprint.rb DELETED
@@ -1,41 +0,0 @@
1
- require 'machinist/active_record'
2
- require 'sham'
3
- require 'faker'
4
-
5
- Sham.name { Faker::Name.name }
6
- Sham.email { Faker::Internet.email }
7
- Sham.login { Faker::Internet.user_name }
8
- Sham.title { Faker::Lorem.sentence }
9
- Sham.host{|n| "something-else-#{n}"}
10
- Sham.body { Faker::Company.bs }
11
-
12
-
13
- Site.blueprint do
14
- title "Article title"
15
- host
16
- end
17
- #
18
- Article.blueprint do
19
- title
20
- body
21
- # site { Site.current }
22
- end
23
-
24
- Page.blueprint do
25
- title
26
- body
27
- published_at {Time.now.utc}
28
- # site { Site.current }
29
- end
30
-
31
- User.blueprint do
32
- login
33
- email
34
- # password "test password"
35
- # password_confirmation "test password"
36
- end
37
- #
38
- # Tag.blueprint do
39
- # title { Sham.title }
40
- # body "Page body <br />......</br/> The end"
41
- # end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Article do
4
- # context "Validation" do
5
- # should_validate_presence_of :title, :body
6
- # should_belong_to :site
7
- # should_belong_to :user
8
- # end
9
-
10
- before do
11
- @site = Site.make
12
- @post_1 = @site.articles.make(:title => "first post")
13
- @post_2 = @site.articles.make(:title => "second post")
14
- end
15
-
16
- it "should set published_at when publish" do
17
- article = @site.articles.make
18
- article.published?.should == false
19
-
20
- article.publish!
21
-
22
- article.published?.should == true
23
- article.published_at.should be_a(Time)
24
- end
25
-
26
- it "has link to prev article" do
27
- @post_1.publish!
28
- @post_2.publish!
29
-
30
- @post_1.prev.should == nil
31
- @post_2.prev.should == @post_1
32
- end
33
-
34
- it "has link to next article" do
35
- @post_1.publish!
36
- @post_2.publish!
37
-
38
- @post_1.next.should == @post_2
39
- @post_2.next.should == nil
40
- end
41
-
42
- it "has a article style url (/:year/:month/:permalink)" do
43
- pattern = /^\/articles\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/([a-z0-9-]+)$/
44
- Article.make.url.should =~ pattern
45
- end
46
-
47
- context "Tagging" do
48
- it "tag list for multiple tagging" do
49
- @post_1.tag_list = 'ruby, rails'
50
-
51
- @post_1.save
52
-
53
- @post_1.should have(2).tags
54
- end
55
- end
56
- end
@@ -1,158 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Page do
4
- before do
5
- @site = Site.make
6
- end
7
- #
8
- # context "Validations" do
9
- # it { should validate_presence_of :title, :body, :site_id }
10
- # it { should belong_to :site }
11
- # it { should belong_to :user }
12
- # end
13
-
14
- context "Page content" do
15
- before do
16
- @page = @site.pages.make(:body => '# hello world')
17
- end
18
-
19
- it "should make markdown into html" do
20
- @page.body.should =~ /<h1>hello world<\/h1>/
21
-
22
- p2 = @site.pages.make(:body => "testing content body")
23
- p2.body.should =~ /<p>testing content body<\/p>/
24
- end
25
-
26
- it "should have access of original source" do
27
- @page.body_source.should == '# hello world'
28
- end
29
- end
30
-
31
- context "Page hierachy" do
32
- before do
33
- @site.pages.count.should == 0
34
-
35
- @page = @site.pages.make(:body => 'home page content')
36
- end
37
-
38
- it "should mark the first page of a site as homepage" do
39
- @page.root?.should == true
40
-
41
- @page.children.make(:body => 'second page').root?.should == false
42
- end
43
-
44
- it "all pages without a parent becomes direct children of home page" do
45
- page = @site.pages.make(:title => 'standard page')
46
- page2 = @site.pages.make(:title => 'standard page 2')
47
-
48
- @page.children.first.should == page
49
- @page.children.second.should == page2
50
-
51
- page.root?.should == false
52
- page2.root?.should == false
53
- end
54
-
55
- it "should have child pages" do
56
- 3.times { @page.children.make }
57
- @page.children.count.should == 3
58
- end
59
- end
60
-
61
- context "Page url" do
62
- before do
63
- @site.pages.count.should == 0
64
- @page = @site.pages.make(:title => 'home page content')
65
- end
66
-
67
- it "should permalink should be valid" do
68
- page = @site.pages.make(:title => 'Some of the most complecated page title !@#!123123')
69
- page.permalink.should =~ /[a-z0-9-]+/
70
- end
71
-
72
- it "should make / as root url" do
73
- @page.url.should == '/'
74
- end
75
-
76
- it "should make subpage url" do
77
- @page.children.make(:title => 'sub page').url.should == '/sub-page'
78
- end
79
-
80
- it "should make url based on all ancestors" do
81
- page2 = @page.children.make(:title => 'sub page 2')
82
- page2.url.should == '/sub-page-2'
83
-
84
- page3 = page2.children.make(:title => 'sub sub page')
85
- page3.url.should == '/sub-page-2/sub-sub-page'
86
- end
87
-
88
- it "should be able to find by page url" do
89
- @site.pages.destroy_all
90
-
91
- p1 = @site.pages.make(:title => 'home page yo')
92
- p2 = p1.children.make(:title => 'about')
93
- p3 = p2.children.make(:title => 'about taylor')
94
-
95
- @site.pages.root.should == p1
96
- @site.pages.find_by_url('/about').should == p2
97
- @site.pages.find_by_url('/about/about-taylor').should == p3
98
- @site.pages.find_by_url('/about/about-taylor/not-exists').should == nil
99
-
100
- p4 = @site.pages.make(:title => 'sections')
101
- p5 = @site.pages.make(:title => 'customer support', :parent => p4)
102
- p6 = @site.pages.make(:title => 'Return and Refund', :parent => p5)
103
-
104
- @site.pages.find_by_url('/sections/customer-support/return-and-refund').should == p6
105
- end
106
- end
107
-
108
- context "Permalink scoping" do
109
- it "should be unique permalink within a site" do
110
- # Site one
111
- @site.pages.make(:title => 'home')
112
- @site.pages.make(:title => 'about')
113
- @site.pages.make(:title => 'profile')
114
-
115
- # Site two
116
- @site2 = Site.make(:title => 'different site')
117
- @site2.pages.make :title => 'home' do |page|
118
- page.children.make(:title => 'about', :site => @site2)
119
- page.children.make(:title => 'profile', :site => @site2)
120
- end
121
-
122
- @site.pages.find_by_url('about').site.should == @site
123
- @site2.pages.find_by_url('about').site.should == @site2
124
- end
125
-
126
- it "should scoped to a parent_id" do
127
- p1 = @site.pages.make(:title => 'home')
128
- p2 = @site.pages.make(:title => 'about')
129
-
130
- p3 = @site.pages.make(:title => 'company')
131
- p4 = p3.children.make(:title => 'about')
132
-
133
-
134
- p2.permalink.should == 'about'
135
- p4.permalink.should == 'about'
136
-
137
- @site.pages.find_by_url('about').should == p2
138
- @site.pages.find_by_url('company/about').should == p4
139
- end
140
- end
141
-
142
- context "Tagging" do
143
- it "tag list for multiple tagging" do
144
- @page = @site.pages.make(:body => 'home page content')
145
-
146
- @page.tag_list = 'ruby, rails'
147
-
148
- @page.save
149
-
150
- @page.should have(2).tags
151
- end
152
- end
153
-
154
- #
155
- # after do
156
- # @site.destroy
157
- # end
158
- end