Skip to content
Snippets Groups Projects
Commit 9b337b83 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Epic: Gitlab configuration with default values

parent b3a0ee8e
No related branches found
No related tags found
No related merge requests found
Showing
with 132 additions and 27 deletions
Loading
Loading
@@ -40,6 +40,7 @@ gem "foreman"
gem "colored"
gem 'resque_mailer'
gem 'tabs_on_rails'
gem 'settingslogic'
 
group :assets do
gem "sass-rails", "3.2.5"
Loading
Loading
Loading
Loading
@@ -313,6 +313,7 @@ GEM
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
settingslogic (2.0.8)
shoulda-matchers (1.1.0)
activesupport (>= 3.0.0)
simplecov (0.6.4)
Loading
Loading
@@ -416,6 +417,7 @@ DEPENDENCIES
rspec-rails
sass-rails (= 3.2.5)
seed-fu
settingslogic
shoulda-matchers
simplecov
six
Loading
Loading
Loading
Loading
@@ -158,6 +158,11 @@ table {
&.small {
@extend .btn-small;
}
&.active {
border-color:#aaa;
background-color:#ccc;
}
}
 
a:focus {
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ module ApplicationHelper
end
 
def web_app_url
"#{request_protocol}://#{GIT_HOST["host"]}/"
"#{request_protocol}://#{Gitlab.config.web_host}/"
end
 
def last_commit(project)
Loading
Loading
Loading
Loading
@@ -2,10 +2,10 @@ class Notify < ActionMailer::Base
include Resque::Mailer
add_template_helper ApplicationHelper
 
default_url_options[:host] = EMAIL_OPTS["host"]
default_url_options[:protocol] = -> { EMAIL_OPTS["protocol"] ? EMAIL_OPTS["protocol"] : "http" }.call
default_url_options[:host] = Gitlab.config.web_host
default_url_options[:protocol] = Gitlab.config.web_protocol
 
default from: EMAIL_OPTS["from"]
default from: Gitlab.config.email_from
 
def new_user_email(user_id, password)
@user = User.find(user_id)
Loading
Loading
Loading
Loading
@@ -113,7 +113,7 @@ class Project < ActiveRecord::Base
end
 
def web_url
[GIT_HOST['host'], code].join("/")
[Gitlab.config.url, code].join("/")
end
 
def common_notes
Loading
Loading
Loading
Loading
@@ -73,7 +73,7 @@ module GitPush
id: commit.id,
message: commit.safe_message,
timestamp: commit.date.xmlschema,
url: "http://#{GIT_HOST['host']}/#{code}/commits/#{commit.id}",
url: "#{Gitlab.config.url}/#{code}/commits/#{commit.id}",
author: {
name: commit.author_name,
email: commit.author_email
Loading
Loading
Loading
Loading
@@ -68,7 +68,7 @@ module Repository
end
 
def path_to_repo
File.join(GIT_HOST["base_path"], "#{path}.git")
File.join(Gitlab.config.git_base_path, "#{path}.git")
end
 
def update_repository
Loading
Loading
@@ -141,4 +141,12 @@ module Repository
 
file_path
end
def ssh_url_to_repo
url_to_repo
end
def http_url_to_repo
http_url = [Gitlab.config.url, "/", path, ".git"].join()
end
end
Loading
Loading
@@ -13,7 +13,7 @@
Path
.input
.input-prepend
%span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
%span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@admin_project.new_record?
.clearfix
= f.label :code do
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@
Git Clone
.input
.input-prepend
%span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
%span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
%span.add-on= ".git"
.clearfix
Loading
Loading
Loading
Loading
@@ -17,7 +17,7 @@
Git Clone
.input
.input-prepend
%span.add-on= "#{GIT_HOST["git_user"]}@#{GIT_HOST["host"]}:"
%span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@project.new_record?
%span.add-on= ".git"
.clearfix
Loading
Loading
Loading
Loading
@@ -4,8 +4,11 @@
.row
.span7
.form-horizontal
.input-prepend
.input-prepend.project_clone_holder
%span.add-on git clone
= link_to "SSH", "#", :class => "btn small active", :"data-clone" => @project.ssh_url_to_repo
= link_to "HTTP", "#", :class => "btn small", :"data-clone" => @project.http_url_to_repo
= text_field_tag :project_clone, @project.url_to_repo, :class => "one_click_select span5"
.span4.right
.right
Loading
Loading
@@ -23,4 +26,12 @@
= render "events/event_last_push", :event => @last_push
.content_list= render @events
 
:javascript
$(function(){
var link_sel = ".project_clone_holder a";
$(link_sel).bind("click", function() {
$(link_sel).removeClass("active");
$(this).addClass("active");
$("#project_clone").val($(this).attr("data-clone"));
})
})
# Gitlab application config file
# # # # # # # # # # # # # # # # # #
# Gitlab application config file #
# # # # # # # # # # # # # # # # # #
# Web application specific settings
web:
host: localhost
port: 80
https: false
 
# Email used for notification
# about new issues, comments
email:
from: notify@gitlabhq.com
host: gitlabhq.com
# Protocol used for links in email letters
# Value can be http or https
protocol: http # or https
from: notify@localhost
 
# Git Hosting configuration
git_host:
system: gitolite
admin_uri: git@localhost:gitolite-admin
base_path: /home/git/repositories/
host: localhost
Loading
Loading
GIT_HOST = YAML.load_file("#{Rails.root}/config/gitlab.yml")["git_host"]
EMAIL_OPTS = YAML.load_file("#{Rails.root}/config/gitlab.yml")["email"]
GIT_OPTS = YAML.load_file("#{Rails.root}/config/gitlab.yml")["git"]
GITLAB_OPTS = YAML.load_file("#{Rails.root}/config/gitlab.yml")["gitlab"]
GITLAB_OPTS = YAML.load_file("#{Rails.root}/config/gitlab.yml")["gitlab"]
class Settings < Settingslogic
source "#{Rails.root}/config/gitlab.yml"
class << self
def web_protocol
self.web['protocol'] ||= web.https ? "https://" : "http://"
end
def web_host
self.web['host'] ||= 'localhost'
end
def email_from
self.email['from'] ||= "notify@" + web_host
end
def url
self['url'] ||= build_url
end
def build_url
raw_url = self.web_protocol
raw_url << web.host
raw_url << ":#{web.port}" if web.port.to_i != 80
end
def ssh_port
git_host['port'] || 22
end
def ssh_user
git_host['git_user'] || 'git'
end
def ssh_host
git_host['host'] || 'localhost'
end
def ssh_path
if ssh_port != 22
"ssh://#{ssh_user}@#{ssh_host}:#{ssh_port}/"
else
"#{ssh_user}@#{ssh_host}:"
end
end
def git_base_path
git_host['base_path'] || '/home/git/repositories/'
end
def git_upload_pack
git_host['upload_pack'] || true
end
def git_receive_pack
git_host['receive_pack'] || true
end
def git_bin_path
git['path'] || '/usr/bin/git'
end
def git_max_size
git['git_max_size'] || 5242880 # 5.megabytes
end
def git_timeout
git['git_timeout'] || 10
end
def gitolite_admin_uri
git['admin_uri'] || 'git@localhost:gitolite-admin'
end
end
end
module Gitlab
Version = File.read(Rails.root.join("VERSION"))
Revision = `git log --pretty=format:'%h' -n 1`
def self.config
Settings
end
end
require 'grit'
require 'pygments'
 
Grit::Git.git_timeout = GIT_OPTS["git_timeout"]
Grit::Git.git_max_size = GIT_OPTS["git_max_size"]
Grit::Git.git_timeout = Gitlab.config.git_timeout
Grit::Git.git_max_size = Gitlab.config.git_max_size
 
Grit::Blob.class_eval do
include Linguist::BlobHelper
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
config.mailer_sender = EMAIL_OPTS["from"]
config.mailer_sender = Gitlab.config.email_from
 
# Configure the class responsible to send e-mails.
# config.mailer = "Devise::Mailer"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment