public
Fork of sr/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/al3x/git-wiki.git
Search Repo:
commit  3e255d9eec73ca85b24a9355fa93fd5c9afb8fb4
tree    c285efed5655b1ab4da6b6184860127a45609684
parent  695dd368feb316f18d623a6e5225ccd17ff7cf90
git-wiki / extensions.rb
100644 21 lines (18 sloc) 0.366 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def require_gem_with_feedback(gem)
  begin
    require gem
  rescue LoadError
    puts "You need to 'sudo gem install #{gem}' before we can proceed"
  end
end
 
class String
  def wiki_linked
    self.gsub!(/\b((?:[A-Z]\w+){2,})/) { |m| "<a href=\"/e/#{m}\">#{m}</a>" }
    self
  end
end
 
class Time
  def for_time_ago_in_words
    "#{(self.to_i * 1000)}"
  end
end