Class: Stoor::GitConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/stoor/git_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, repo_path = nil) ⇒ GitConfig

Returns a new instance of GitConfig.



5
6
7
# File 'lib/stoor/git_config.rb', line 5

def initialize(app, repo_path = nil)
  @app, @repo_path = app, repo_path
end

Instance Attribute Details

#repo_pathObject (readonly)

Returns the value of attribute repo_path.



3
4
5
# File 'lib/stoor/git_config.rb', line 3

def repo_path
  @repo_path
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# 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