Permalink
Browse files

Copying over blogcast

  • Loading branch information...
0 parents commit 1760b25aa2a41e6516cfc59167c0c1987195946f @blatyo committed Dec 5, 2010
Showing with 16,835 additions and 0 deletions.
  1. +10 −0 Gemfile
  2. +80 −0 Gemfile.lock
  3. +21 −0 MIT_LICENSE
  4. +243 −0 README
  5. +7 −0 Rakefile
  6. +70 −0 app/controllers/application_controller.rb
  7. +6 −0 app/controllers/archives_controller.rb
  8. +101 −0 app/controllers/comments_controller.rb
  9. +57 −0 app/controllers/drafts_controller.rb
  10. +5 −0 app/controllers/errors_controller.rb
  11. +92 −0 app/controllers/posts_controller.rb
  12. +9 −0 app/controllers/sitemap_controller.rb
  13. +58 −0 app/controllers/spams_controller.rb
  14. +26 −0 app/controllers/user_sessions_controller.rb
  15. +50 −0 app/controllers/users_controller.rb
  16. +2 −0 app/helpers/akismet_helper.rb
  17. +2 −0 app/helpers/application_helper.rb
  18. +2 −0 app/helpers/archives_helper.rb
  19. +2 −0 app/helpers/authors_helper.rb
  20. +2 −0 app/helpers/comments_helper.rb
  21. +2 −0 app/helpers/drafts_helper.rb
  22. +2 −0 app/helpers/logins_helper.rb
  23. +5 −0 app/helpers/posts_helper.rb
  24. +2 −0 app/helpers/settings_helper.rb
  25. +2 −0 app/helpers/sitemap_helper.rb
  26. +52 −0 app/models/comment.rb
  27. +12 −0 app/models/draft.rb
  28. +15 −0 app/models/post.rb
  29. +23 −0 app/models/spam.rb
  30. +10 −0 app/models/user.rb
  31. +4 −0 app/models/user_session.rb
  32. +58 −0 app/views/archives/index.html.erb
  33. +32 −0 app/views/comments/_comment.html.erb
  34. +10 −0 app/views/comments/create.js.erb
  35. +7 −0 app/views/comments/preview.js.erb
  36. +59 −0 app/views/drafts/edit.html.erb
  37. +39 −0 app/views/drafts/index.html.erb
  38. +21 −0 app/views/layouts/_sidebar.html.erb
  39. +81 −0 app/views/layouts/application.html.erb
  40. +6 −0 app/views/posts/_meta.html.erb
  41. +62 −0 app/views/posts/edit.html.erb
  42. +51 −0 app/views/posts/index.html.erb
  43. +18 −0 app/views/posts/index.rss.builder
  44. +55 −0 app/views/posts/new.html.erb
  45. +165 −0 app/views/posts/show.html.erb
  46. +11 −0 app/views/sitemap/index.xml.builder
  47. +108 −0 app/views/spams/index.html.erb
  48. +53 −0 app/views/user_sessions/new.html.erb
  49. +69 −0 app/views/users/edit.html.erb
  50. +36 −0 app/views/users/index.html.erb
  51. +69 −0 app/views/users/new.html.erb
  52. +4 −0 config.ru
  53. +60 −0 config/application.rb
  54. +13 −0 config/boot.rb
  55. +22 −0 config/database.yml
  56. +5 −0 config/environment.rb
  57. +26 −0 config/environments/development.rb
  58. +50 −0 config/environments/production.rb
  59. +35 −0 config/environments/test.rb
  60. +11 −0 config/initializers/mail.rb
  61. +8 −0 config/initializers/session_store.rb
  62. +5 −0 config/locales/en.yml
  63. +37 −0 config/routes.rb
  64. BIN db/blogcast_development.sqlite3
  65. +16 −0 db/migrate/20100531203308_create_posts.rb
  66. +17 −0 db/migrate/20100531205806_create_authors.rb
  67. +9 −0 db/migrate/20100606140851_add_posted_at_to_posts.rb
  68. +9 −0 db/migrate/20100606215234_add_author_to_posts.rb
  69. +9 −0 db/migrate/20100606220232_remove_post_id_from_authors.rb
  70. +9 −0 db/migrate/20100609014944_remove_draft_from_posts.rb
  71. +15 −0 db/migrate/20100609015218_create_drafts.rb
  72. +9 −0 db/migrate/20100614223327_add_markdown_to_posts.rb
  73. +9 −0 db/migrate/20100614230146_add_markdown_to_drafts.rb
  74. +25 −0 db/migrate/20100620232035_add_details_to_authors.rb
  75. +9 −0 db/migrate/20100620233032_remove_password_from_author.rb
  76. +9 −0 db/migrate/20100620235341_rename_authors_to_users.rb
  77. +9 −0 db/migrate/20100621221421_add_login_to_user.rb
  78. +17 −0 db/migrate/20100703160422_add_details_to_comments.rb
  79. +9 −0 db/migrate/20100704175752_add_reference_to_comment.rb
  80. +22 −0 db/migrate/20100704180607_create_spams.rb
  81. +83 −0 db/schema.rb
  82. +7 −0 db/seeds.rb
  83. +6 −0 doc/README_FOR_APP
  84. 0 lib/tasks/.gitkeep
  85. 0 log/.gitignore
  86. +8,123 −0 log/development.log
  87. 0 log/production.log
  88. 0 log/server.log
  89. 0 log/test.log
  90. +24 −0 public/404.html
  91. +28 −0 public/422.html
  92. +27 −0 public/500.html
  93. 0 public/favicon.ico
  94. BIN public/images/adminbar.png
  95. BIN public/images/adminhover.png
  96. BIN public/images/button_left.gif
  97. BIN public/images/button_right.gif
  98. BIN public/images/comment.gif
  99. BIN public/images/delete.png
  100. BIN public/images/doc_plus.png
  101. BIN public/images/filter.png
  102. BIN public/images/fire_big.png
  103. BIN public/images/grill.png
  104. BIN public/images/grippie.png
  105. BIN public/images/lightbulb-off.png
  106. BIN public/images/lightbulb-on.png
  107. BIN public/images/rss6.png
  108. BIN public/images/search.png
  109. BIN public/images/stock_spam.png
  110. BIN public/images/wireless.png
  111. BIN public/images/wmd-buttons.png
  112. +92 −0 public/javascripts/blog.js
  113. +6 −0 public/javascripts/elastic.js
  114. +1 −0 public/javascripts/highlight.js
  115. +166 −0 public/javascripts/jquery.js
  116. +153 −0 public/javascripts/rails.js
  117. +1,306 −0 public/javascripts/showdown.js
  118. +1 −0 public/javascripts/textarearesizer.js
  119. +2,378 −0 public/javascripts/wmd.js
  120. +6 −0 public/robots.txt
  121. 0 public/stylesheets/.gitkeep
  122. +3 −0 public/stylesheets/archives.css
  123. +1,331 −0 public/stylesheets/blog.css
  124. +147 −0 public/stylesheets/error.css
  125. +151 −0 public/stylesheets/login.css
  126. +36 −0 public/stylesheets/modstyles.css
  127. +6 −0 script/rails
  128. +4 −0 session
  129. +15 −0 test/fixtures/authors.yml
  130. +17 −0 test/fixtures/comments.yml
  131. +11 −0 test/fixtures/drafts.yml
  132. +13 −0 test/fixtures/posts.yml
  133. +25 −0 test/fixtures/spams.yml
  134. +8 −0 test/functional/akismet_controller_test.rb
  135. +8 −0 test/functional/archives_controller_test.rb
  136. +8 −0 test/functional/authors_controller_test.rb
  137. +8 −0 test/functional/comments_controller_test.rb
  138. +8 −0 test/functional/drafts_controller_test.rb
  139. +8 −0 test/functional/logins_controller_test.rb
  140. +45 −0 test/functional/posts_controller_test.rb
  141. +8 −0 test/functional/settings_controller_test.rb
  142. +8 −0 test/functional/sitemap_controller_test.rb
  143. +9 −0 test/performance/browsing_test.rb
  144. +13 −0 test/test_helper.rb
  145. +8 −0 test/unit/author_test.rb
  146. +8 −0 test/unit/comment_test.rb
  147. +8 −0 test/unit/draft_test.rb
  148. +4 −0 test/unit/helpers/akismet_helper_test.rb
  149. +4 −0 test/unit/helpers/archives_helper_test.rb
  150. +4 −0 test/unit/helpers/authors_helper_test.rb
  151. +4 −0 test/unit/helpers/comments_helper_test.rb
  152. +4 −0 test/unit/helpers/drafts_helper_test.rb
  153. +4 −0 test/unit/helpers/logins_helper_test.rb
  154. +4 −0 test/unit/helpers/posts_helper_test.rb
  155. +4 −0 test/unit/helpers/settings_helper_test.rb
  156. +4 −0 test/unit/helpers/sitemap_helper_test.rb
  157. +8 −0 test/unit/post_test.rb
  158. +8 −0 test/unit/spam_test.rb
  159. 0 tmp/.gitignore
  160. 0 tmp/restart.txt
10 Gemfile
@@ -0,0 +1,10 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.3'
+
+gem 'sqlite3-ruby', :require => 'sqlite3'
+#gem 'mysql2'
+
+gem 'bluecloth'
+gem 'authlogic'
+gem 'rakismet'
@@ -0,0 +1,80 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ arel (2.0.4)
+ authlogic (2.1.6)
+ activesupport
+ bluecloth (2.0.9)
+ builder (2.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.4.2)
+ mail (2.2.10)
+ activesupport (>= 2.3.6)
+ i18n (~> 0.4.1)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rakismet (1.0.1)
+ sqlite3-ruby (1.3.2)
+ thor (0.14.4)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ authlogic
+ bluecloth
+ rails (= 3.0.3)
+ rakismet
+ sqlite3-ruby
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2010 Tian Valdemar Davis
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
243 README
@@ -0,0 +1,243 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb" templates
+that are primarily responsible for inserting pre-built data in between HTML tags.
+The model contains the "smart" domain objects (such as Account, Product, Person,
+Post) that holds all the business logic and knows how to persist themselves to
+a database. The controller handles the incoming requests (such as Save New Account,
+Update Product, Show Post) by manipulating the model and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
+ and your application name. Ex: rails myapp
+2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
+3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
+4. Follow the guidelines to start developing your application
+
+
+== Web Servers
+
+By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
+with a variety of other web servers.
+
+Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
+suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
+getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
+More info at: http://mongrel.rubyforge.org
+
+Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
+Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
+FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
+
+== Apache .htaccess example for FCGI/CGI
+
+# General Apache options
+AddHandler fastcgi-script .fcgi
+AddHandler cgi-script .cgi
+Options +FollowSymLinks +ExecCGI
+
+# If you don't want Rails to look in certain directories,
+# use the following rewrite rules so that Apache won't rewrite certain requests
+#
+# Example:
+# RewriteCond %{REQUEST_URI} ^/notrails.*
+# RewriteRule .* - [L]
+
+# Redirect all requests not available on the filesystem to Rails
+# By default the cgi dispatcher is used which is very slow
+#
+# For better performance replace the dispatcher with the fastcgi one
+#
+# Example:
+# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
+RewriteEngine On
+
+# If your Rails application is accessed via an Alias directive,
+# then you MUST also set the RewriteBase in this htaccess file.
+#
+# Example:
+# Alias /myrailsapp /path/to/myrailsapp/public
+# RewriteBase /myrailsapp
+
+RewriteRule ^$ index.html [QSA]
+RewriteRule ^([^.]+)$ $1.html [QSA]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
+
+# In case Rails experiences terminal errors
+# Instead of displaying this message you can supply a file here which will be rendered instead
+#
+# Example:
+# ErrorDocument 500 /500.html
+
+ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands running
+on the server.log and development.log. Rails will automatically display debugging
+and runtime information to these files. Debugging info will also be shown in the
+browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code using
+the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
+
+* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two online (and free) books will bring you up to speed on the Ruby language
+and also on programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your Mongrel or
+Webrick server with --debugger. This means that you can break out of execution at any point
+in the code, investigate and change the model, AND then resume execution!
+You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
+Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find(:all)
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better is that you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you enter "cont"
+
+
+== Console
+
+You can interact with the domain model by starting the console through <tt>script/console</tt>.
+Here you'll have all parts of the application configured, just like it is when the
+application is running. You can inspect domain models, change values, and save to the
+database. Starting the script without arguments will launch it in the development environment.
+Passing an argument will specify a different environment, like <tt>script/console production</tt>.
+
+To reload your controllers and models after launching the console run <tt>reload!</tt>
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
+You would be connected to the database with the credentials defined in database.yml.
+Starting the script without arguments will connect you to the development database. Passing an
+argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
+Currently works for mysql, postgresql and sqlite.
+
+== Description of Contents
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from ApplicationController
+ which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb.
+ Most models will descend from ActiveRecord::Base.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
+ syntax.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the common
+ header/footer method of wrapping views. In your views, define a layout using the
+ <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
+ call <% yield %> to render the view using this layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are generated
+ for you automatically when using script/generate for controllers. Helpers can be used to
+ wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all
+ the sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when generated
+ using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that doesn't
+ belong under controllers, models, or helpers. This directory is in the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for images, stylesheets,
+ and javascripts. Also contains the dispatchers and the default HTML files. This should be
+ set as the DOCUMENT_ROOT of your web server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the script/generate scripts, template
+ test files will be generated for you and placed in this directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins subdirectory.
+ If the app has frozen rails, those gems also go here, under vendor/rails/.
+ This directory is in the load path.
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Blogcast::Application.load_tasks
Oops, something went wrong.

0 comments on commit 1760b25

Please sign in to comment.