Sha256: a148ced9986179bf85a2cd508b2e58ff3def012a5d0abba175291237d1a2be6c

Contents?: true

Size: 620 Bytes

Versions: 5

Compression:

Stored size: 620 Bytes

Contents

module Stoor
  class GitConfig
    def initialize(app); @app = app; end

    def call(env)
      @request = Rack::Request.new(env)
      unless @request.session['gollum.author']
        if ENV['WIKI_PATH_IN_USE']
          if name = git_option_value('user.name')
            if email = git_option_value('user.email')
              @request.session['gollum.author'] = { :name => name, :email => email }
            end
          end
        end
      end
      @app.call(env)
    end

    def git_option_value(option)
      `cd #{ENV['WIKI_PATH_IN_USE']} && git config --get #{option}`.strip
    rescue
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stoor-0.1.4 lib/stoor/git_config.rb
stoor-0.1.3 lib/stoor/git_config.rb
stoor-0.1.2 lib/stoor/git_config.rb
stoor-0.1.1 lib/stoor/git_config.rb
stoor-0.1.0 lib/stoor/git_config.rb