Module: Git::Webby

Defined in:
lib/git/webby.rb,
lib/git/webby/http_backend.rb

Overview

The main goal of the Git::Webby is implement the following useful features.

  • Smart-HTTP, based on git-http-backend.

  • Authentication flexible based on database or configuration file like .htpasswd.

  • API to get information about repository.

This class configure the needed variables used by application. See Config::DEFAULTS for the values will be initialized by default.

Basically, the default attribute set the values that will be necessary by all applications.

The HTTP-Backend application is configured by http_backend attribute to set the Git RCP CLI. More details about this feature, see the git-http-backend official page

default

Default configuration. All attributes will be used by all modular applications.

project_root

Sets the root directory where repositories have been placed.

git_path

Path to the git command line.

http_backend

HTTP-Backend configuration.

authenticate

Sets if authentication is required.

get_any_file

Like http.getanyfile.

upload_pack

Like http.uploadpack.

receive_pack

Like http.receivepack.

Defined Under Namespace

Modules: AuthenticationHelpers, GitHelpers, HttpBackendHelpers Classes: Application, Htpasswd, HttpBackend, ProjectHandler

Class Method Summary collapse

Class Method Details

.configObject



247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/git/webby.rb', line 247

def config
  @config ||= {
    :default => {
      :project_root => "/home/git",
      :git_path     => "/usr/bin/git"
    },
    :http_backend => {
      :authenticate => true,
      :get_any_file => true,
      :upload_pack  => true,
      :receive_pack => false
    }
  }.to_struct
end

.configure {|config| ... } ⇒ Object

Configure Git::Webby modules using keys. See Config for options.

Yields:



263
264
265
266
# File 'lib/git/webby.rb', line 263

def configure(&block)
  yield config
  config
end

.load_config_file(file) ⇒ Object



268
269
270
271
272
273
274
275
276
277
# File 'lib/git/webby.rb', line 268

def load_config_file(file)
  YAML.load_file(file).to_struct.each_pair do |app, options|
    options.each_pair do |option, value|
      config[app][option] = value
    end
  end
  config
rescue IndexError
  abort "configuration option not found"
end