Change a heading in the FAQ
[Worg/babel-doc.git] / blorgit.org
blob04f16b31a1cfa28490f2bccb47c4231dddc2f143
1 #+OPTIONS:    H:3 num:nil toc:2 \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate
3 #+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS:       Write(w) Update(u) Fix(f) Check(c) 
5 #+TITLE:      Blorgit: Org-Mode based, git amenable, blogging engine
6 #+AUTHOR:     Eric Schulte
7 #+EMAIL:      schulte.eric at gmail dot com
8 #+LANGUAGE:   en
9 #+PRIORITIES: A C B
10 #+CATEGORY:   worg
12 # This file is the default header for new Org files in Worg.  Feel free
13 # to tailor it to your needs.
15 [[file:index.org][{Back to Worg's index}]]
17 * Introduction
19 Blorgit is a blogging engine which uses [[http://orgmode.org][Org-Mode]] for markup, runs on
20 the [[http://www.sinatrarb.com/][Sinatra]] mini web framework, and is amenable to posting and
21 maintenance through [[http://git-scm.com/][git]].  With the addition of a little [[http://www.ruby-lang.org/en/][Ruby]] blorgit
22 creates interactive web pages with [[http://orgmode.org][Org-Mode]].
24 ** Features
26 [[file:images/blorgit/blorgit_features.png]]
28 1) *In Browser Editing* Org-mode files can be edited through the
29      browser.  Upon submitting an edit the original org-mode file is
30      overwritten and the web-page is re-exported.  Edits can be turned
31      on off or with the =editable= [[* Changing Configuration Options][configuration option]] and can be
32      password protected by setting the =auth= [[* Changing Configuration Options][configuration option]]
33 2) *Export to org-mode and LaTeX formats*  The raw *Org-mode* source,
34      and *LaTeX* exports of all pages can be downloaded.
35 3) *Search* The search bar compares your search terms as a
36    /perl-style/ regular expression (in most cases working just like a
37    simple term search) against the org-mode source of each page
38    returning a ranked list.  [[file:images/blorgit/blorgit_search.png]]
39 4) *Sidebar with Recent changes and Directory Listing* The top =N=
40      recently edited pages, and/or directory listings can optionally
41      be presented in a sidebar.  These are controlled through the
42      =recent= and =dir_list= configuration options.
43 5) *Themes* The [[http://github.com/eschulte/blorgit_themes/tree/master][blorgit\_themes]] git repository holds prepackaged
44    themes for blorgit.  These can be applied to your instillation
45    using the supplied rake commands.  For a list of available themes
46    run =rake themes= from the root of your blorgit instillation.
47    Please share any new themes you might
48    create. [[file:images/blorgit/themes.png]]
49 6) *Comments in org-mode files* Pages can optionally be opened for
50    comments, all comments will be stored in a special =* COMMENT
51    Comments= outline header appended to the end of the org file.
52 7) *Git Synchronization* By setting the =git_commit= [[* Changing Configuration Options][configuration
53    option]] to =true= blorgit can be made to automatically commit and
54    push to a git repository after every comment or edit of an org-mode
55    file.
58 * Getting Started (instillation and use)
60 0) *Install Ruby*
62    If you don't already have ruby installed on your system then you
63    will need to install [[http://www.ruby-lang.org/en/][Ruby]] and [[http://rubygems.org/][Ruby Gems]] (Ruby's package managment
64    system).*  Be sure to install Ruby 1.8 (should be default option)
65    *not* Ruby 1.9.
67 1) *Install the Required Gems*
69 #+begin_example 
70 sudo gem install rake sinatra haml activesupport
71 #+end_example
73 2) *Install blorgit*
75 #+begin_example 
76 git clone git://github.com/eschulte/blorgit.git
77 #+end_example
79    Update the submodules of blorgit to provide file based persistence
80    ([[http://github.com/eschulte/active_file/tree/master][active\_file]]), org-mode interaction ([[http://github.com/eschulte/acts_as_org/tree/master][acts\_as\_org]]), and themes
81    ([[http://github.com/eschulte/blorgit_themes/tree/master][blorgit\_themes]]).
83 #+begin_example 
84 cd blorgit
85 git submodule init
86 git submodule update
87 #+end_example
89 3) *Create Blogs Directory*
91    Create a blogs directory (in =~/blogs/=) with the default
92    configuration (To change the location of the blogs directory edit
93    =blorgit.yml= in this directory).  Apply the default minimal theme
94    (for a list of available themes run =rake themes=)
96 #+begin_example 
97 rake new
98 rake themes:default
99 #+end_example
101 4) *Start Servers*
102   - *Emacs Server*
104     Starting your emacs server allows Emacs to act as a server which
105     can then export org-mode file to html.  To do this we simply need
106     to load the =org-interaction.el= file in =acts_as_org=.  You can
107     do this by executing the following in emacs
109 #+begin_example 
110 M-x load-file /path/to/blorgit/backend/acts_as_org/elisp/org-interaction.el
111 #+end_example
113     or with the following shell command
115 #+begin_example 
116 emacs -l backend/acts_as_org/elisp/org-interaction.el
117 #+end_example
119   - *Web Server*
121     Start your sinatra web server with the following command
123 #+begin_example 
124 ruby blorgit.rb
125 #+end_example
127 5) *View in Browser*
129    [[http://localhost:4567]]
132 * Additional Information
133 ** Common Tasks
134 Ruby has it's own make tool called [[http://rake.rubyforge.org/][Rake]].  For a list of the blorgit
135 rake commands run =rake -T= from the root of your blorgit
136 instillation.  At the time of writing the available rake tasks are...
138 #+begin_example
139 $ rake -T
140 (in /Users/eschulte/src/blorgit)
141 rake exported:delete  # delete all temporary exported files
142 rake exported:list    # list all temporary exported files
143 rake index            # drop a minimal index page into /Users/eschulte/Site...
144 rake info             # return configuration information about the current ...
145 rake new              # create a new blorgit instance
146 rake themes           # list the available themes
147 rake themes:default   # a default theme, should serve as a good starting point
148 rake themes:food      # a food theme for my recipes
149 rake themes:org       # an org-mode theme featuring the folding unicorn
150 #+end_example
152 ** Changing Configuration Options
154 The configuration is controlled through a [[http://www.yaml.org][YAML]] file located at
155 =blorgit.yml= in the base of your blorgit instillation.  Configuration
156 variables can be used to control the *title*, *index page*,
157 *stylesheet*, the number of *recent entries* and *directory\_listings*
158 shown in the sidebar, automatic synchronization with a *git*
159 repository, *commentability*, *editability* and optional *password
160 protection* for posting edits, .  The default configuration is...
162 #<<configuration_options>>
163 #+begin_example 
164 --- 
165 title: Blorgit
166 index: index
167 style: stylesheet.css
168 recent: 5
169 dir_list: false
170 git_commit: false
171 commentable: true
172 editable: false
173 auth: 
174 - admin
175 - password
176 #+end_example
178 *** Directory Local Configuration
179 It is possible to specify configuration options for each individual
180 directories of your blorgit site.  To do so write the configuration
181 options you wish to specify to a file named =.blorgit.yml=.  These
182 options will be used when displaying files in the same directory as
183 the =.blorgit.yml= file.  This file follows the same format shown [[* Changing Configuration
184  Options][above]].
186 ** Git
188 If you're wondering where git comes in, initialize your new blogs
189 directory as a git repo, and post all future blogs, moderate comments
190 and commentability of blogs, and manage configuration through git.
192 #+begin_example 
193 cd ./blogs
194 git init
195 echo ".exported_*" > .gitignore # ignore export files created automatically by blorgit
196 git add .
197 git commit -a -m "initial commit"
198 #+end_example
200 ** Change blogs directory
202 To change the location of the blogs directory see the =blorgit.yml=
203 global configuration file in the base of your blorgit directory.
205 ** Deploying to a Remote Server
207 **** Thin web server
208 To run using the =run.ru= rackup file use a command like the following
209 (requires the =thin= gem =sudo gem install -v=1.0.0 thin=)
211 #+begin_example 
212 ./run.ru -sthin -p4567
213 #+end_example
215 **** Deploying behind a url prefix
216 If you don't want blorgit to sit at the top level of your webserver,
217 but would rather is exist behind a url prefix set the =url_prefix=
218 variable in the run.ru file.
220 **** Remote Emacs Server
221 Blorgit requires a running Emacs to handle the actual export of
222 org-mode pages to html (through the =emacsclient= command).  This
223 requires that an instance of Emacs be left running on the remote
224 server, which I be problematic.  I use [[http://www.gnu.org/software/screen/][gnu-screen]] to start and detach
225 from this Emacs instance as follows...
227 1) ssh into your remote server
228 2) start your screen session with the =screen= command
229 #+begin_example 
230 screen
231 #+end_example
232 3) cd to your blorgit directory
233 #+begin_example 
234 cd ~/src/blorgit
235 #+end_example
236 4) start emacs loading the =org-interaction.el= file
237 #+begin_example 
238 emacs -l backend/acts_as_org/elisp/org-interaction.el
239 #+end_example
240 5) optionally run your webserver through screen as well by 
241    1) switching to a new screen window with =\C-a c=
242    2) start your webserver
243 #+begin_example 
244 ./run.ru -sthin
245 #+end_example
246 6) disconnect form screen leaving emacs and the webserver running with
247    =\C-a d=
248 7) logoff from the server
249 8) at any later date you can log back into the server and reattach to
250    the original screen session with
251 #+begin_example 
252 screen -r
253 #+end_example
255 ** Extending Blorgit
256 Simplicity and a small hackable code base were key goals in the
257 construction of blorgit.  The =blorgit.rb= file in the base of the
258 application contains all of the logic and html.  Any extensions should
259 be possible through modification of this single file.  For information
260 on the structure of this file, or on the framework on which it is run
261 see [[http://www.sinatrarb.com/][Sinatra]].