beef-articles 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +7 -0
  5. data/Rakefile +58 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/admin/articles_controller.rb +89 -0
  8. data/app/controllers/admin/categories_controller.rb +83 -0
  9. data/app/controllers/admin/comments_controller.rb +30 -0
  10. data/app/controllers/articles_controller.rb +55 -0
  11. data/app/controllers/comments_controller.rb +50 -0
  12. data/app/helpers/articles_helper.rb +92 -0
  13. data/app/helpers/comments_helper.rb +7 -0
  14. data/app/models/article.rb +37 -0
  15. data/app/models/category.rb +17 -0
  16. data/app/models/comment.rb +16 -0
  17. data/app/views/admin/articles/index.html.erb +45 -0
  18. data/app/views/admin/articles/preview.js.rjs +1 -0
  19. data/app/views/admin/articles/show.html.erb +58 -0
  20. data/app/views/admin/categories/index.html.erb +31 -0
  21. data/app/views/admin/categories/show.html.erb +18 -0
  22. data/app/views/admin/comments/index.html.erb +33 -0
  23. data/app/views/articles/_article.html.erb +12 -0
  24. data/app/views/articles/index.html.erb +40 -0
  25. data/app/views/articles/index.rss.builder +18 -0
  26. data/app/views/articles/show.html.erb +55 -0
  27. data/app/views/comments/_comment.html.erb +4 -0
  28. data/app/views/comments/_form.html.erb +25 -0
  29. data/app/views/comments/new.html.erb +4 -0
  30. data/articles.gemspec +79 -0
  31. data/config/routes.rb +32 -0
  32. data/generators/articles_migration/articles_migration_generator.rb +11 -0
  33. data/generators/articles_migration/templates/migration.rb +45 -0
  34. data/lib/articles.rb +7 -0
  35. data/rails/init.rb +9 -0
  36. data/test/articles_test.rb +7 -0
  37. data/test/test_helper.rb +10 -0
  38. metadata +110 -0
@@ -0,0 +1,4 @@
1
+ <div id="comment-wrapper">
2
+ <h1 id="location">Leave a Comment</h1>
3
+ <%= render :partial => 'comments/form', :locals => { :commentable => @commentable } %>
4
+ </div>
data/articles.gemspec ADDED
@@ -0,0 +1,79 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{articles}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Steve England"]
9
+ s.date = %q{2009-06-24}
10
+ s.email = %q{steve@wearebeef.co.uk}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "app/controllers/admin/articles_controller.rb",
23
+ "app/controllers/admin/categories_controller.rb",
24
+ "app/controllers/admin/comments_controller.rb",
25
+ "app/controllers/articles_controller.rb",
26
+ "app/controllers/comments_controller.rb",
27
+ "app/helpers/articles_helper.rb",
28
+ "app/helpers/comments_helper.rb",
29
+ "app/models/article.rb",
30
+ "app/models/category.rb",
31
+ "app/models/comment.rb",
32
+ "app/views/admin/articles/index.html.erb",
33
+ "app/views/admin/articles/preview.js.rjs",
34
+ "app/views/admin/articles/show.html.erb",
35
+ "app/views/admin/categories/index.html.erb",
36
+ "app/views/admin/categories/show.html.erb",
37
+ "app/views/admin/comments/index.html.erb",
38
+ "app/views/articles/_article.html.erb",
39
+ "app/views/articles/index.html.erb",
40
+ "app/views/articles/index.rss.builder",
41
+ "app/views/articles/show.html.erb",
42
+ "app/views/comments/_comment.html.erb",
43
+ "app/views/comments/_form.html.erb",
44
+ "app/views/comments/new.html.erb",
45
+ "articles.gemspec",
46
+ "config/routes.rb",
47
+ "generators/articles_migration/articles_migration_generator.rb",
48
+ "generators/articles_migration/templates/migration.rb",
49
+ "lib/articles.rb",
50
+ "rails/init.rb",
51
+ "test/articles_test.rb",
52
+ "test/test_helper.rb"
53
+ ]
54
+ s.homepage = %q{http://github.com/beef/articles}
55
+ s.rdoc_options = ["--charset=UTF-8"]
56
+ s.require_paths = ["lib"]
57
+ s.rubygems_version = %q{1.3.3}
58
+ s.summary = %q{Article/Blogging engine}
59
+ s.test_files = [
60
+ "test/articles_test.rb",
61
+ "test/test_helper.rb"
62
+ ]
63
+
64
+ if s.respond_to? :specification_version then
65
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
+ s.specification_version = 3
67
+
68
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
+ s.add_runtime_dependency(%q<mbleigh-acts-as-taggable-on>, [">= 0"])
70
+ s.add_runtime_dependency(%q<jackdempsey-acts_as_commentable>, [">= 0"])
71
+ else
72
+ s.add_dependency(%q<mbleigh-acts-as-taggable-on>, [">= 0"])
73
+ s.add_dependency(%q<jackdempsey-acts_as_commentable>, [">= 0"])
74
+ end
75
+ else
76
+ s.add_dependency(%q<mbleigh-acts-as-taggable-on>, [">= 0"])
77
+ s.add_dependency(%q<jackdempsey-acts_as_commentable>, [">= 0"])
78
+ end
79
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,32 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.resources :comments
3
+
4
+ map.resources :categories, :has_many => :articles
5
+
6
+ map.with_options :controller => 'articles', :action => 'index' do |articles|
7
+ articles.articles_tagged 'articles/tagged/:tag'
8
+ articles.articles_tagged_format 'articles/tagged/:tag.:format'
9
+ articles.articles_authored 'articles/author/:user_id'
10
+ articles.articles_authored_format 'articles/author/:user_id.:format'
11
+ articles.articles_day 'articles/:year/:month/:day',
12
+ :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/
13
+ articles.articles_month 'articles/:year/:month',
14
+ :year => /\d{4}/, :month => /\d{1,2}/
15
+ articles.articles_day 'articles/:year',
16
+ :year => /\d{4}/
17
+ end
18
+ map.article_permalink 'articles/:year/:month/:day/:permalink',
19
+ :controller => 'articles', :action => 'show',
20
+ :year => /\d{4}/, :day => /\d{1,2}/, :month => /\d{1,2}/,
21
+ :path_prefix => nil
22
+ map.resources :articles, :only => [:index], :collection => { :preview => :get }, :has_many => [:comments, { :only => :create } ]
23
+
24
+ map.resources :tweets
25
+ map.namespace(:admin) do |admin|
26
+ admin.resources :categories
27
+ admin.resources :articles, :member => { :preview => :put }, :collection => { :preview => :post }
28
+ admin.resources :comments, :only => [:index, :destroy]
29
+ admin.resources :things
30
+ admin.resources :blokes
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ class ArticlesMigrationGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+ record do |m|
5
+ m.migration_template "migration.rb",
6
+ 'db/migrate',
7
+ :migration_file_name => "create_articles_categories_and_comments"
8
+ end
9
+ end
10
+
11
+ end
@@ -0,0 +1,45 @@
1
+ class CreateArticlesCategoriesAndComments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :articles do |t|
4
+ t.string :title
5
+ t.string :permalink
6
+ t.datetime :published_at
7
+ t.datetime :published_to
8
+ t.text :body
9
+ t.string :description
10
+ t.boolean :allow_comments, :default => false
11
+ t.string :cached_tag_list
12
+ t.references :created_by, :updated_by, :category
13
+
14
+ t.timestamps
15
+ end
16
+
17
+ create_table :categories do |t|
18
+ t.string :title
19
+ t.string :description, :permalink
20
+
21
+ t.timestamps
22
+ end
23
+
24
+ add_index :categories, :permalink
25
+
26
+ create_table :comments do |t|
27
+ t.text :comment, :default => ""
28
+ t.references :commentable, :polymorphic => true
29
+
30
+ t.string :website, :default => ""
31
+ t.string :name, :default => ""
32
+ t.string :email, :default => ""
33
+ t.timestamps
34
+ end
35
+
36
+ add_index :comments, :commentable_type
37
+ add_index :comments, :commentable_id
38
+ end
39
+
40
+ def self.down
41
+ drop_table :categories
42
+ drop_table :comments
43
+ drop_table :articles
44
+ end
45
+ end
data/lib/articles.rb ADDED
@@ -0,0 +1,7 @@
1
+ module Beef
2
+ module Articles
3
+ def article_permalink(article, options = {})
4
+ article_permalink_path(article.published_at.year,article.published_at.month,article.published_at.day,article.permalink,options)
5
+ end
6
+ end
7
+ end
data/rails/init.rb ADDED
@@ -0,0 +1,9 @@
1
+ require "acts-as-taggable-on"
2
+ require "acts_as_commentable"
3
+ require "articles"
4
+
5
+ config.to_prepare do
6
+ ApplicationController.helper(Beef::Articles)
7
+ end
8
+
9
+ ActionController::Base.send :include, Beef::Articles
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ArticlesTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'articles'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beef-articles
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Steve England
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-24 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mbleigh-acts-as-taggable-on
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: jackdempsey-acts_as_commentable
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description:
36
+ email: steve@wearebeef.co.uk
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - VERSION
51
+ - app/controllers/admin/articles_controller.rb
52
+ - app/controllers/admin/categories_controller.rb
53
+ - app/controllers/admin/comments_controller.rb
54
+ - app/controllers/articles_controller.rb
55
+ - app/controllers/comments_controller.rb
56
+ - app/helpers/articles_helper.rb
57
+ - app/helpers/comments_helper.rb
58
+ - app/models/article.rb
59
+ - app/models/category.rb
60
+ - app/models/comment.rb
61
+ - app/views/admin/articles/index.html.erb
62
+ - app/views/admin/articles/preview.js.rjs
63
+ - app/views/admin/articles/show.html.erb
64
+ - app/views/admin/categories/index.html.erb
65
+ - app/views/admin/categories/show.html.erb
66
+ - app/views/admin/comments/index.html.erb
67
+ - app/views/articles/_article.html.erb
68
+ - app/views/articles/index.html.erb
69
+ - app/views/articles/index.rss.builder
70
+ - app/views/articles/show.html.erb
71
+ - app/views/comments/_comment.html.erb
72
+ - app/views/comments/_form.html.erb
73
+ - app/views/comments/new.html.erb
74
+ - articles.gemspec
75
+ - config/routes.rb
76
+ - generators/articles_migration/articles_migration_generator.rb
77
+ - generators/articles_migration/templates/migration.rb
78
+ - lib/articles.rb
79
+ - rails/init.rb
80
+ - test/articles_test.rb
81
+ - test/test_helper.rb
82
+ has_rdoc: false
83
+ homepage: http://github.com/beef/articles
84
+ post_install_message:
85
+ rdoc_options:
86
+ - --charset=UTF-8
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: "0"
100
+ version:
101
+ requirements: []
102
+
103
+ rubyforge_project:
104
+ rubygems_version: 1.2.0
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: Article/Blogging engine
108
+ test_files:
109
+ - test/articles_test.rb
110
+ - test/test_helper.rb