class Stoor::GitConfig
Attributes
repo_path[R]
Public Class Methods
new(app, repo_path = nil)
click to toggle source
# File lib/stoor/git_config.rb, line 5 def initialize(app, repo_path = nil) @app, @repo_path = app, repo_path end
Public Instance Methods
call(env)
click to toggle source
# File lib/stoor/git_config.rb, line 9 def call(env) @request = Rack::Request.new(env) unless @request.session['gollum.author'] if repo_path && (name = git_option_value('user.name')) && (email = git_option_value('user.email')) @request.session['gollum.author'] = { :name => name, :email => email } end end @app.call(env) end
Private Instance Methods
git_option_value(option)
click to toggle source
# File lib/stoor/git_config.rb, line 21 def git_option_value(option) @repo ||= Grit::Repo.new(repo_path) @repo.config[option] end