bin - tttaaaa/gollum GitHub Wiki

bin

gollum

code

This is the execution file. Main work is argument handling and calling server. We explain the program logic below.

Change Program Path(line3)

$:.unshift File.join(File.dirname(FILE), *%w[.. lib])

$: is array of execution paths for Ruby.

In my enviroments, $: is following.

irb(main):001:0> $:
=> ["/Library/Ruby/Site/2.0.0", "/Library/Ruby/Site/2.0.0/x86_64-darwin15", "/Library/Ruby/Site/2.0.0/universal-darwin15", "/Library/Ruby/Site", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin15", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin15", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin15", "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15"]
  • unshift is method that add each auguments to top of array.
  • *(Aster) supports Variable-length arguments.
  • 'File.dirname(FILE)' returns relative path of directory for this file.
  • File.join return '../lib'

What is purpose?
require lib/gollum.rb

definition(line10-19)

define default value that web server listens and default wiki-options.

option paraser(line21-177)

get gollum path(line180)

execution app

if irb(line182-240)

if normal executions(line241-293)

require gollum/app

require 'gollum/app'

  • read 'gollum/lib/gollum/app.rb'
  • set default option setting
  • if base_bath option didn't exists,run app.
  • if base_path option exists, use Rack.