Commit db96c5be889010c8c459762c141adc746d4c617d
Exists in
master
and in
17 other branches
Merge branch 'gitlab_core_wrappers' into 'master'
Gitlab Core Wrappers
Showing
2 changed files
with
21 additions
and
16 deletions
Show diff stats
config/software/gitlab-core.rb
@@ -61,21 +61,14 @@ build do | @@ -61,21 +61,14 @@ build do | ||
61 | command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-core/" | 61 | command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-core/" |
62 | 62 | ||
63 | # Create a wrapper for the rake tasks of the Rails app | 63 | # Create a wrapper for the rake tasks of the Rails app |
64 | - block do | ||
65 | - open("#{install_dir}/bin/gitlab-rake", "w") do |file| | ||
66 | - file.print <<-EOH | ||
67 | -#!/bin/bash | ||
68 | -export PATH=/opt/gitlab/bin:/opt/gitlab/embedded/bin:$PATH | 64 | + erb :dest => "#{install_dir}/bin/gitlab-rake", |
65 | + :source => "bundle_exec_wrapper.erb", | ||
66 | + :mode => 0755, | ||
67 | + :vars => {:command => 'rake "$@"', :install_dir => install_dir} | ||
69 | 68 | ||
70 | -# default to RAILS_ENV=production | ||
71 | -if [[ -z $RAILS_ENV ]]; then | ||
72 | - export RAILS_ENV=production | ||
73 | -fi | ||
74 | - | ||
75 | -cd /opt/gitlab/embedded/service/gitlab-core | ||
76 | -/opt/gitlab/embedded/bin/chpst -u git -U git /opt/gitlab/embedded/bin/bundle exec rake "$@" | ||
77 | -EOH | ||
78 | - end | ||
79 | - end | ||
80 | - command "chmod +x #{install_dir}/bin/gitlab-rake" | 69 | + # Create a wrapper for the rails command, useful for e.g. `rails console` |
70 | + erb :dest => "#{install_dir}/bin/gitlab-rails", | ||
71 | + :source => "bundle_exec_wrapper.erb", | ||
72 | + :mode => 0755, | ||
73 | + :vars => {:command => 'rails "$@"', :install_dir => install_dir} | ||
81 | end | 74 | end |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +#!/bin/bash | ||
2 | +export PATH=<%= install_dir %>/bin:<%= install_dir %>/embedded/bin:$PATH | ||
3 | + | ||
4 | +# default to RAILS_ENV=production | ||
5 | +if [[ -z $RAILS_ENV ]]; then | ||
6 | + export RAILS_ENV=production | ||
7 | +fi | ||
8 | + | ||
9 | +gitlab_user=$(ls -lLd <%= install_dir %>/embedded/service/gitlab-core/log | awk '{ print $3 }') | ||
10 | + | ||
11 | +cd <%= install_dir %>/embedded/service/gitlab-core | ||
12 | +exec <%= install_dir %>/embedded/bin/chpst -u $gitlab_user -U $gitlab_user <%= install_dir %>/embedded/bin/bundle exec <%= command %> |