Browse files

Massively merge all commits from master into one and prepare regular …

…plain branch

Added nice 404 and 500 error pages

Added temporary splash page

Fixed Thin configuration and Rake tasks

Added Restafari stylesheets

Added Restafari JavaScripts

Fixed library names for Akismet's `require` (Debian on the server didn't like those)

Added Restafari images; Added Restafari template for index; Fixed `human_date`

Skip testing of HTML in response for now

Added Restafari template for the post page + comment submission logic

Debug spam status in HTML

Added some instructions and todos to Readme

Deleted development.db, must kick it out of the repo

Fixed task rake app:install:create_db

Added that articles are listed from newer ones to older ones (which we decidedly want :)

Fixed Rake task rake server:start (bad path to log); Added, that Sinatra logs into log/production.log; Readme additions

Actually fixed the post sorting now .)

Packing for today probably, added notice about alpha into README

Deleted test files from data directory

Kick out data, stupid me

Ignore anything in data AND the directory itself

More clear doc in marley.rb

New & updated Rake tasks

Fixed syntax error in Rake task

Fixing Rake tasks

Fixing Rake tasks for cap deploy:cold

Fixing Rake tasks for cap deploy:cold

Fixed link to comments from index page

Fixed Rake and Capistrano tasks

Rake task fix

Installation description in Readme

Fixed Readme typo

Fixed Readme typo again :)

Even better Readme :)

Do not ignore "log" and "tmp" directories itself

Started playing with the sync feature

Added rendering of Google Analytics HTML code in production env (set your UA code in config.yml)

Temporary ignore index.html

Ignore temporary file app/public/index.html

Proper name for comments database file

Get rid of symbolic link for 'data' directory, can has refaktorink

Get rid of 'Blog' namespace and use 'Marley' one

Refactored blog engine into proper files from the mess

Refactored configuration of DATA_DIRECTORY into config.yml

Refactored Rake tasks (DATA_DIRECTORY config, messaging in app:install)

Added Atom feed for articles

Added test coverage for Atom feed

Added Atom feed for comments on article

Added auto-discovery for Atom feeds links to HTML layout

Added helper method "hostname"

Fixed "hostname" helper method

Added Capistrano to README dependencies

Updated README

Implement new Akismet interface, Akismetor from

Got rid of Akismet.rb library, use Ryan Bates' Akismetor instead; Got rid of Marley::Akismet interface; Added spam comments styling to HTML

Added in-code TODOs

Better about box


More TODOs


Added code highlighter for Ruby

Updated README

Needless README tuning

Fix Akismetor refactoring (wasnt being loaded)

Add author credentials to config (primary use: feed)

Added "fix_url" before create hook for Comment to fix to

Added displaying of comment author's URLs in HTML

First pass on Atom feed validation

Second pass on Atom feed validation

Another pass on Atom feed validation

Added link to comments RSS feed on article page

Fixed line break

Fix line break

Fix loading Akismetor for tests

Kick out request env debug from HTML

Remove temporary page and launch

Restructure code in marley.rb

Added ultra-minimal interface to Github API

Show revision number and commit message in footer (from Github)

Fix loading REVISION number from file (\n)

Updated README: How to synchronize Marley content
  • Loading branch information...
karmi authored and kubicek committed Oct 26, 2008
1 parent c4d9acc commit 4a3bc297699d37eeb79ef512411d12def9d01eac
Showing with 8,883 additions and 555 deletions.
  1. +5 −0 .gitignore
  2. +58 −9 README.rdoc
  3. +39 −16 Rakefile
  4. +59 −168 app/marley.rb
  5. +43 −0 app/marley/comment.rb
  6. +110 −0 app/marley/post.rb
  7. +2 −1 app/public/404.html
  8. +2 −1 app/public/500.html
  9. BIN app/public/favicon.ico
  10. BIN app/public/images/bg/about.h.png
  11. BIN app/public/images/bg/comment-header-line.png
  12. BIN app/public/images/bg/divider-floral.png
  13. BIN app/public/images/bg/header-comment-form.png
  14. BIN app/public/images/bg/
  15. BIN app/public/images/comment-added-tick.png
  16. BIN app/public/images/floral.karmi.png
  17. BIN app/public/images/footer-linka.png
  18. BIN app/public/images/marley.bubble.png
  19. BIN app/public/images/rss.icon.12x12.png
  20. +95 −0 app/public/javascripts/application.js
  21. +188 −0 app/public/javascripts/code_highlighter/code_highlighter.js
  22. +28 −0 app/public/javascripts/code_highlighter/ruby.js
  23. +963 −0 app/public/javascripts/controls.js
  24. +972 −0 app/public/javascripts/dragdrop.js
  25. +1,120 −0 app/public/javascripts/effects.js
  26. +4,221 −0 app/public/javascripts/prototype.js
  27. BIN app/public/restafari.splash.png
  28. +76 −0 app/public/stylesheets/code.css
  29. +47 −0 app/public/stylesheets/common.css
  30. +23 −0 app/public/stylesheets/error_pages.css
  31. +3 −0 app/public/stylesheets/handheld.css
  32. +22 −0 app/public/stylesheets/image-replacement.css
  33. +33 −0 app/public/stylesheets/layout.css
  34. +336 −0 app/public/stylesheets/master.css
  35. +39 −0 app/public/stylesheets/msie6.css
  36. +16 −0 app/public/stylesheets/msie7.css
  37. +31 −0 app/public/stylesheets/print.css
  38. +11 −0 app/public/stylesheets/safari.css
  39. +5 −1 app/
  40. +17 −5 app/test/marley_test.rb
  41. +24 −0 app/views/index.builder
  42. +10 −12 app/views/index.erb
  43. +83 −12 app/views/layout.erb
  44. +24 −0 app/views/post.builder
  45. +70 −46 app/views/post.erb
  46. +7 −0 config/config.example.yml
  47. +11 −6 config/deploy.example.rb
  48. +0 −11 data/001-this-is-the-first-post/this-is-first-post-and-the-filename-doesnt-matter-actually.txt
  49. +0 −5 data/002-this-is-the-second-post-and-it-is-a-draft.draft/this-is-a-second-still-unpublished-post.txt
  50. +0 −117 data/003-this-is-the-third-article/third.txt
  51. +0 −5 data/004-fourth-article/004.txt
  52. BIN data/development.db
  53. 0 log/.gitignore
  54. 0 tmp/.gitignore
  55. +0 −140 vendor/akismet.rb
  56. +51 −0 vendor/akismetor.rb
  57. +39 −0 vendor/githubber.rb
@@ -4,3 +4,8 @@ log/*.log
@@ -1,27 +1,76 @@
= Marley
-**Marley** is minimal blog engine written in Sinatra. It uses plain-text files for storing articles and SQLite database for storing comments. It comes with Rake and Capistrano tasks for deploying the application and syncing articles from your local machine to the server.
+*Marley* is minimal blog engine without admin interface written in Sinatra framework (
-+master+ branch is what runs, +plain+ branch is bare application suited for your own styling.
+It has no admin interface for writing posts. Use your favorite text editor to edit plain-text files and synchronize them to server.
+Marley uses plain-text files for storing articles and SQLite database for storing comments (set data location in <tt>config.yml</tt>).
+It comes with Rake and Capistrano tasks for deploying the application and syncing articles from your local machine to the server.
++master+ branch is what will run, +plain+ branch is bare application suited for your own styling (<i>currently out of sync</i>).
+It is currently alpha software.
== Ingredients
-* Sinatra and Rack
+* Sinatra, Rack and Thin
* ActiveRecord and SQLite
-* Akismet spam filtering (see <tt>./vendor</tt> directory)
+* Akismet spam filtering (see <tt>./vendor/akismetor.rb</tt>)
* YAML configuration
-* Rake and Capistrano
* RDiscount for Markdown --> HTML conversion
+* Builder for Atom feed generation
+* Rake and Capistrano tasks
+== Installation and dependencies
+You have to install or update following Rubygems:
+ sudo gem install sinatra rack thin activerecord sqlite3-ruby rdiscount builder capistrano
+Edit this configuration file:
+ config/config.example.yml
+and rename it to <i>config.yml</i>.
+Install the application with this Rake task:
-== Installation
+ rake app:install
+Load this URL in your browser:
+ http://localhost:4567
+== Deployment
+* copy <tt>config.yml</tt> to server
+* <tt>cap deploy:setup</tt>
+* <tt>cap deploy:cold</tt>
+* <tt>cap deploy</tt>
+== Synchronizing content
+Marley has no administrative interface for writing articles inside some silly <tt><textarea></tt>. It assumes you like to write in your favorite text editor, using Markdown, previewing on the fly, and just synchronize when you're ready to publish.
+There are several ways how to do that:
+* You can be hardcore and write articles over SSH in Vim directly on the server for "just-in-time-publication" when you hit <tt>:w</tt>
+* You can be less glorious, of course, and save your articles to some folder on your disk and <tt>scp</tt>-ing said folder to the server. Or use SFTP? Cyberduck drag & drop? Aaargh, not reccommended unless you _really_ like to see what you're doing, in real time.
+* You can implement some sane practice and start versioning your writing with Git. (What else?) This way, you can setup remote repository on your server, just <tt>push</tt>-ing changes whenever you feel like you want to say something in public. A <i>post-commit hook</i> is completely neccessary in this case, of course. (It isn't paramount of convenience having to SSH on your server to run <tt>git pull origin master</tt> in some folder.) There will be a Marley Capistrano task for doing that in the future?
+* When you already use Git, you can push to Github (where else?), and have Github call Marley by it's Post-Receive Hooks ( See the <tt>get "/sync"</tt> route dangling towards the end of the marley.rb? You get the picture.
+Of course, put other ideas in the Marley Wiki (
== Todo
-* Atom/RSS export of articles and comments
+* Implement data syncing logic (upload, Github, etc)
+* Implement admin interface for filtering spam comments
+* Do not show spam comments in HTML and feed
+* Optionally mail new comments to self
+* Cap task for uploading config.yml to server
== Licence
Copyright (c) 2008 Karel Minarik (
-Code released under the MIT license, do not reuse graphical assets and styles in the _master_ branch
+Code released under the MIT license, do not reuse graphical assets and styles in the _master_ branch, please
@@ -1,26 +1,54 @@
+require 'rubygems'
+require 'activerecord'
require 'rake'
+require 'ftools'
+CONFIG = YAML.load_file( File.join(File.dirname(__FILE__), 'config', 'config.yml') ) unless defined? CONFIG
+module Marley
+ DATA_DIRECTORY = File.join(File.dirname(__FILE__), CONFIG['data_directory']) unless defined? DATA_DIRECTORY
+%w{post comment}.each { |f| require File.join(File.dirname(__FILE__), 'app', 'marley', f) }
task :default => 'app:start'
namespace :app do
desc "Install the fresh application"
task :install do
- # TODO : Copy fixtures into <tt>./data/</tt>, open in Safari on a Mac, etc
- Rake::Task['app:install:create_db'].invoke
+ Rake::Task['app:install:create_data_directory'].invoke
+ Rake::Task['app:install:create_database'].invoke
+ Rake::Task['app:install:create_sample_article'].invoke
+ Rake::Task['app:install:create_sample_comment'].invoke
+ puts "* Starting application in development mode"
+ Rake::Task['app:start'].invoke
- namespace :install do
- task :create_db do
- require 'rubygems'
- require 'activerecord'
- ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => './data/development.db')
- load File.join( File.dirname(__FILE__), 'config', 'db_create_comments' )
+ namespace :install do
+ task :create_data_directory do
+ puts "* Creating data directory in " + Marley::DATA_DIRECTORY
+ FileUtils.mkdir_p( Marley::DATA_DIRECTORY )
+ end
+ task :create_database do
+ puts "* Creating comments SQLite database in #{Marley::DATA_DIRECTORY}/comments.db"
+ ActiveRecord::Base.establish_connection( :adapter => 'sqlite3',
+ :database => File.join(Marley::DATA_DIRECTORY, 'comments.db')
+ )
+ load( File.join( File.dirname(__FILE__), 'config', 'db_create_comments.rb' ) )
task :create_sample_article do
+ puts "* Creating sample article"
+ FileUtils.cp_r( File.join(File.dirname(__FILE__), 'app', 'test', 'fixtures', '001-test-article'), Marley::DATA_DIRECTORY )
task :create_sample_comment do
+ puts "* Creating sample comment"
+ Marley::Comment.create( :author => 'John Doe',
+ :email => '',
+ :body => 'Lorem ipsum dolor sit amet',
+ :post_id => 'test-article' )
task :open_in_browser do
+ `open http://localhost:4567` if RUBY_PLATFORM =~ /darwin/
@@ -29,31 +57,26 @@ namespace :app do
exec "ruby app/marley.rb"
- desc "Deploy application on the server [shortcut for Cap]"
- task :deploy do
- exec "cap deploy"
- end
desc "Run tests for the application"
task :test do
exec "cd app/test; ruby marley_test.rb"
-namespace :blog do
+namespace :data do
task :sync do
# TODO : use Git
- exec "cap blog:sync"
+ exec "cap data:sync"
namespace :server do
task :start do
- exec "thin -R -d -l log/production.log -e production -p 4500 start"
+ exec "cd app; thin -R -d -P ../tmp/pids/ -l ../log/production.log -e production -p 4500 start"
task :stop do
Oops, something went wrong.

0 comments on commit 4a3bc29

Please sign in to comment.