toto-bongo 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -78
- data/VERSION +1 -1
- data/lib/toto-bongo.rb +18 -13
- data/toto-bongo.gemspec +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
|
1
|
+
Toto bongo
|
2
2
|
====
|
3
3
|
|
4
|
+
|
4
5
|
Minimal blog forked from toto to use for your existing app's.
|
5
6
|
This is very useful for SEO optimization
|
7
|
+
See http://toto-bongo.heroku.com/
|
6
8
|
|
7
|
-
|
8
|
-
introduction
|
9
|
+
Introduction
|
9
10
|
------------
|
10
11
|
|
11
|
-
|
12
|
+
Toto-bongo is a git-powered, minimalist blog engine forked from toto.
|
12
13
|
There is no toto client, and there probably will never be, everything goes through git.
|
13
14
|
From the security stand point, this makes toto-bongo very secure. By
|
14
15
|
reducing the attack surface( we don't handle any user input) we've made
|
@@ -18,92 +19,40 @@ to security vulnerabilities, toto-bongo has non of that.
|
|
18
19
|
|
19
20
|
blog in your app in 10 seconds
|
20
21
|
------------------
|
21
|
-
|
22
|
-
Toto-bongo was designed to be used with a reverse-proxy cache, such as [Varnish](http://varnish-cache.org).
|
23
|
-
This makes it an ideal candidate for **[heroku](http://heroku.com)**.
|
24
|
-
|
25
22
|
This is how to deploy in your existing app:
|
26
23
|
|
27
24
|
1. git clone git@github.com:danpal/toto-bongo-blog.git
|
25
|
+
|
28
26
|
2. Look at toto-bongo-blog Gemfile, add the following gems to your
|
29
27
|
Gemfile.
|
28
|
+
|
29
|
+
- gem 'toto-bongo'
|
30
|
+
|
31
|
+
- gem 'RedCloth'
|
32
|
+
|
33
|
+
- gem 'haml'
|
34
|
+
|
35
|
+
- gem 'sass' #if you want to use the sass stylesheet
|
30
36
|
|
31
|
-
gem 'toto-bongo'
|
32
|
-
gem 'builder'
|
33
|
-
gem 'RedCloth'
|
34
|
-
gem 'haml'
|
35
37
|
|
36
|
-
3.
|
37
|
-
we provide you with an already existing config.ru, take a look at
|
38
|
-
toto-bongo-blog config.ru
|
39
|
-
(note this file might be outdated here, look at the one in the
|
40
|
-
toto-bongo-blog)
|
41
|
-
<pre><code>
|
42
|
-
# This file is used by Rack-based servers to start the application.
|
43
|
-
require 'toto-bongo'
|
44
|
-
require ::File.expand_path('../config/environment', __FILE__)
|
45
|
-
|
46
|
-
#point to your rails apps /public directory
|
47
|
-
use Rack::Static, :urls => ['/stylesheets', '/javascripts', '/images', '/favicon.ico'], :root => 'public'
|
48
|
-
|
49
|
-
use Rack::ShowExceptions
|
50
|
-
use Rack::CommonLogger
|
38
|
+
3. Replace the config.ru on your application to the one from toto-bongo-blog. Then modify accordingly.
|
51
39
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
#override the default location for the toto directories
|
56
|
-
TotoBongo::Paths = {
|
57
|
-
:templates => "blog/templates",
|
58
|
-
:pages => "blog/templates/pages",
|
59
|
-
:articles => "blog/articles"
|
60
|
-
}
|
61
|
-
|
62
|
-
# set your config variables here
|
63
|
-
set :title, 'toto-bongo blog'
|
64
|
-
set :date, lambda {|now| now.strftime("%B #{now.day.ordinal} %Y") }
|
65
|
-
set :summary, :max => 500
|
66
|
-
set :root, 'index'
|
67
|
-
set :prefix, 'blog'
|
68
|
-
|
69
|
-
if RAILS_ENV != 'production'
|
70
|
-
set :url, "http://localhost:3000/blog/"
|
71
|
-
else
|
72
|
-
set :url, "http://toto-bongo.heroku.com/blog/" #EDIT THIS TO ADD YOUR OWN URL
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
#create a rack app
|
77
|
-
app = Rack::Builder.new do
|
78
|
-
use Rack::CommonLogger
|
79
|
-
|
80
|
-
#map requests to /blog to toto
|
81
|
-
map '/blog' do
|
82
|
-
run toto_bongo
|
83
|
-
end
|
84
|
-
|
85
|
-
#map all the other requests to rails
|
86
|
-
map '/' do
|
87
|
-
if Rails.version.to_f >= 3.0
|
88
|
-
ActionDispatch::Static
|
89
|
-
#run [ApplicationName]::Application
|
90
|
-
run TotoBongoBlog::Application #change for your application name
|
91
|
-
else # Rails 2
|
92
|
-
use Rails::Rack::Static
|
93
|
-
run ActionController::Dispatcher.new
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end.to_app
|
97
|
-
|
98
|
-
</code></pre>
|
99
|
-
|
100
|
-
Then make the following changes
|
101
|
-
1. Change :title
|
102
|
-
2. Run TotoBongoBlog::Application #change for your application name
|
40
|
+
Toto-bongo runs on rack, you need to modify your existing config.ru
|
41
|
+
we provide you with an already existing config.ru, take a look at toto-bongo-blog
|
42
|
+
config.ru
|
103
43
|
|
44
|
+
make the following changes
|
45
|
+
1. Change :title
|
46
|
+
2. Run TotoBongoBlog::Application #change for your application name
|
47
|
+
|
48
|
+
|
49
|
+
4. Copy the blog directory into your application root folder.
|
104
50
|
|
51
|
+
5. Copy the blog.sass stylesheet or blog.css from /public/stylesheets/sass/blog.sass or /public/stylesheets/sass/blog.css
|
52
|
+
to your app stylesheets.
|
105
53
|
|
106
54
|
|
55
|
+
You are done.
|
107
56
|
|
108
57
|
|
109
58
|
how it works
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
data/lib/toto-bongo.rb
CHANGED
@@ -4,7 +4,7 @@ require 'haml'
|
|
4
4
|
require 'rack'
|
5
5
|
require 'digest'
|
6
6
|
require 'open-uri'
|
7
|
-
require '
|
7
|
+
require 'rdiscount'
|
8
8
|
require 'builder'
|
9
9
|
require 'logger'
|
10
10
|
$:.unshift File.dirname(__FILE__)
|
@@ -51,12 +51,12 @@ module TotoBongo
|
|
51
51
|
if(ENV['TOTODEBUG'])
|
52
52
|
@logger.level = Logger::DEBUG
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
#
|
56
56
|
# Handles all templating options
|
57
57
|
# Is responsible for:
|
58
58
|
# 1. Calling the Haml engine on pages to render them to html
|
59
|
-
# 2. Calling the
|
59
|
+
# 2. Calling the markdown engine on markdown text to render them to html
|
60
60
|
# 3. Registering All the classes at initialization
|
61
61
|
#
|
62
62
|
module Template
|
@@ -73,11 +73,17 @@ module TotoBongo
|
|
73
73
|
end
|
74
74
|
|
75
75
|
#
|
76
|
-
#Converst a
|
76
|
+
#Converst a markdown text into html
|
77
77
|
#
|
78
|
-
def
|
79
|
-
TotoBongo::logger.debug("Called Template::
|
80
|
-
|
78
|
+
def markdown text
|
79
|
+
TotoBongo::logger.debug("Called Template::Markdown")
|
80
|
+
if (options = @config[:markdown])
|
81
|
+
Markdown.new(text.to_s.strip, *(options.eql?(true) ? [] : options)).to_html
|
82
|
+
else
|
83
|
+
text.strip
|
84
|
+
end
|
85
|
+
|
86
|
+
Markdown.new(text.to_s.strip).to_html
|
81
87
|
end
|
82
88
|
|
83
89
|
#
|
@@ -385,7 +391,7 @@ module TotoBongo
|
|
385
391
|
else
|
386
392
|
self[:body].match(/(.{1,#{length || config[:length] || config[:max]}}.*?)(\n|\Z)/m).to_s
|
387
393
|
end
|
388
|
-
|
394
|
+
markdown(sum.length == self[:body].length ? sum : sum.strip.sub(/\.\Z/, '…'))
|
389
395
|
end
|
390
396
|
|
391
397
|
def url
|
@@ -396,7 +402,7 @@ module TotoBongo
|
|
396
402
|
|
397
403
|
def body
|
398
404
|
TotoBongo::logger.debug("Article::body")
|
399
|
-
|
405
|
+
markdown self[:body].sub(@config[:summary][:delim], '') rescue markdown self[:body]
|
400
406
|
end
|
401
407
|
|
402
408
|
#Path returns a SEO friendly URL path
|
@@ -453,6 +459,7 @@ module TotoBongo
|
|
453
459
|
:author => ENV['USER'], # blog author
|
454
460
|
:title => Dir.pwd.split('/').last, # blog index title
|
455
461
|
:description => "Blog for your existing rails app", # blog meta description
|
462
|
+
:markdown => :smart, # use markdown
|
456
463
|
:keywords => "blog rails existing", # blog meta keywords
|
457
464
|
:root => "index", # site index
|
458
465
|
:url => "http://127.0.0.1", # root URL of the site
|
@@ -470,9 +477,8 @@ module TotoBongo
|
|
470
477
|
}
|
471
478
|
}
|
472
479
|
|
473
|
-
|
474
480
|
def initialize obj
|
475
|
-
|
481
|
+
|
476
482
|
self.update Defaults
|
477
483
|
self.update obj
|
478
484
|
end
|
@@ -494,14 +500,13 @@ module TotoBongo
|
|
494
500
|
# The HTTP server
|
495
501
|
class Server
|
496
502
|
attr_reader :config, :site
|
497
|
-
|
503
|
+
|
498
504
|
def initialize config = {}, &blk
|
499
505
|
@config = config.is_a?(Config) ? config : Config.new(config)
|
500
506
|
@config.instance_eval(&blk) if block_given?
|
501
507
|
@site = TotoBongo::Site.new(@config)
|
502
508
|
end
|
503
509
|
|
504
|
-
|
505
510
|
#
|
506
511
|
# This is the entry point of the request
|
507
512
|
# On each request, this is the first method that gets
|
data/toto-bongo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{toto-bongo}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Palacio"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-06-07}
|
13
13
|
s.description = %q{Minimal blog to use with your existing app}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 3
|
9
|
+
version: 1.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Palacio
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-06-07 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|