public
Fork of jnewland/git-wiki
Description: A wiki engine that uses a Git repository as its data store.
Homepage: http://atonie.org/2008/02/git-wiki
Clone URL: git://github.com/bmizerany/git-wiki.git
git-wiki / environment.rb
100644 32 lines (26 sloc) 0.578 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'fileutils'
require 'rubygems'
require 'sinatra/lib/sinatra'
require 'extensions'
require 'page'
require 'thin'
 
%w(git redcloth rubypants yaml).each do |gem|
  require_gem_with_feedback gem
end
 
GIT_REPO = ENV['HOME'] + '/wiki'
HOMEPAGE = 'Home'
 
unless File.exists?(GIT_REPO) && File.directory?(GIT_REPO)
  puts "Initializing repository in #{GIT_REPO}..."
  Git.init(GIT_REPO)
end
 
$repo = Git.open(GIT_REPO)
 
config = nil
begin
  config = YAML.load(File.read(ENV['CONFIG']))
rescue
  config = {
    'username' => nil,
    'password' => nil
  }
end
 
CONFIG = config