Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
The grit gem didn't work on Heroku - change to simpler approach using…
Browse files Browse the repository at this point in the history
… the COMMIT_HASH environment variable and File last modified date.
  • Loading branch information
njh committed May 20, 2012
1 parent 6abe0e4 commit 2a3ddb3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion Gemfile
Expand Up @@ -8,7 +8,6 @@ gem 'json_pure', :require => 'json'
gem 'nokogiri'
gem 'rdiscount'
gem 'doodle'
gem 'grit'

gem 'rdf', ">=0.3.1"
gem 'rdf-json', :require => 'rdf/json'
Expand Down
7 changes: 0 additions & 7 deletions Gemfile.lock
Expand Up @@ -9,19 +9,13 @@ GEM
equivalent-xml (0.2.9)
nokogiri (>= 1.4.3)
fakeweb (1.3.0)
grit (2.5.0)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3.6)
haml (3.1.4)
htmlentities (4.3.1)
json_pure (1.7.0)
metaclass (0.0.1)
mime-types (1.17.2)
mocha (0.11.4)
metaclass (~> 0.0.1)
nokogiri (1.5.2)
posix-spawn (0.3.6)
rack (1.4.1)
rack-protection (1.2.0)
rack
Expand Down Expand Up @@ -76,7 +70,6 @@ DEPENDENCIES
emk-sinatra-url-for
equivalent-xml
fakeweb
grit
json_pure
mocha
nokogiri
Expand Down
4 changes: 2 additions & 2 deletions dbpedialite.rb
Expand Up @@ -9,8 +9,8 @@ class DbpediaLite < Sinatra::Base
set :public_folder, File.join(root, 'public')

DEFAULT_HOST = 'dbpedialite.org'
GIT_REPO_PATH = File.join(root, '.git')
GIT_LAST_COMMIT = Grit::Repo.new(GIT_REPO_PATH).commits.first
GIT_LAST_UPDATED = File.mtime(File.join(root, '.git', 'index'))
GIT_LAST_COMMIT = ENV['COMMIT_HASH'] || `git rev-parse HEAD`

def self.extract_vocabularies(graph)
vocabs = {}
Expand Down
2 changes: 1 addition & 1 deletion views/layout.erb
Expand Up @@ -46,7 +46,7 @@
Source code: <%= link_to('http://github.com/njh/dbpedialite') %>
</div>
<div class="links">
Last updated: <%= link_to(GIT_LAST_COMMIT.authored_date, 'http://github.com/njh/dbpedialite/tree/' + GIT_LAST_COMMIT.id) %>
Last updated: <%= link_to(GIT_LAST_UPDATED, 'http://github.com/njh/dbpedialite/tree/' + GIT_LAST_COMMIT) %>
</div>
</div>

Expand Down

0 comments on commit 2a3ddb3

Please sign in to comment.