added ebuild for gitlabhq 6.4.3; copied from gitlabhq-6.0.2-r2, patches adapted from that version as well
This commit is contained in:
		
							parent
							
								
									90ac68676a
								
							
						
					
					
						commit
						cbb005ad63
					
				
					 24 changed files with 1867 additions and 0 deletions
				
			
		
							
								
								
									
										24
									
								
								www-apps/gitlabhq/Manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								www-apps/gitlabhq/Manifest
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | ||||||
|  | AUX config.ssh 245 SHA256 5bf5d5a357e88b71e14a12bb28ea68d0286ed29118045aa944484b84b6fa5e4b SHA512 52dbec481cd45136e72370713ab20a41616dccb252e75b884b66e2494aaefe7795719169906dcad5030dcbe33201d021bdad1f7a99120ac40a64611290ff8759 WHIRLPOOL 9b991ad20787e0e7274136ddb8e22e1082360d580f8576feb722730b5c3f3fa22992f671f7916e191052a78d8d688d32044b39059dc7146d14c2da57fa891214 | ||||||
|  | AUX gitlab-sidekiq.init 979 SHA256 f9bc02031b0418e4c765fae37bb40cd9e16dbe5b1a7f5c105a2d7ba3568b0195 SHA512 e3311f1110fca02a378a9f74704d9241884a1973e90be1dbd663809b524528eda25e3ad0ac5d20737f6ccd78343582557ac579adb976473f8aabc0320172921f WHIRLPOOL 365d539cceacb5ff9171aa7316ac061ef4b4a8d63e6d4a26395afb841878a08bdd1b9bf2709602dc90f15a1ed5ff8566a0e8239e8ab9184e84814a16993f3aeb | ||||||
|  | AUX gitlab-support.init 1188 SHA256 09059c391a5d5a8856030b4a50a9c8bb7d8fdb8f7ab75c1a869015bbff6a3a32 SHA512 25fe623e1d506a750897b4e100fcaddc654997a7cf23b7f1a6b4c3b77907cbe8af669cc38da86753696861e4fd14415ea7bc1decb0fdb500de1ef8a3e845860c WHIRLPOOL 169fab28b013762d3eaac4d8a37ded0ba6dedd9ebcd9fdd55347409f279d332a8d0326ec6eb66255c6f1d488c856c7135c60f3069972a7a07e55453e55bbe969 | ||||||
|  | AUX gitlab-unicorn-6.init 1663 SHA256 ba211c63d559cbca510483d5536d28131e08f67dc8914444a2c85b27c7a92b60 SHA512 a574b3bb5b9af3e3a707045ac6d783bab73bab1db033d07999b3d06789da0853bc3de0bba39a3c154e5b1ab385926ee3ec4487f4c797708a318fa5df22827069 WHIRLPOOL 497cf52ebb4b33cc6bbd81e53d4961878b2ea9dc42bacabf7a32686e52a54c22eed73836705e80714d7b759cfd2ee1929e6aa12083435f265c472270e158f72a | ||||||
|  | AUX gitlab-unicorn.init 1874 SHA256 8bede14eb7beaba955e64d0ff2928324992522e22e777aab33bf51d743c7ba4e SHA512 a8595a623cd724a3d2e3b95ea7216e2574d0beea75369a46dfd6c5483310675a827d08cda516dec0df7ccbff399d27e3dde0e0fae07d11eed6412b0d3f9ca8d9 WHIRLPOOL c619180431ee27b5fe724aaf6ed31bb9fcf8db3779d7879e79c7a04927ea7d4efcd363d5cc44184917bd4de8292267e93136de849e8892ffc1e2891aacb5f51c | ||||||
|  | AUX gitlab.logrotate 191 SHA256 9c02c26f5faa443cd576599462c6a8206d62495ab9671098a5f0e379f216541b SHA512 2212a8e5f2d4704256d5abb92b5a1201b20f82b04610758e734d163792a60b78f482017510169666a70ed9352b171177d05237ffe87988cacb764c5ef7ba5443 WHIRLPOOL f61297015311316554e63af4822b8d274f5a2378e829e5c14bb22e642b0d83023446acff45a13aa354f127543ce1552c99488b92ed8f39d86959343c7e67bbee | ||||||
|  | AUX gitlabhq-4.0.0-fix-checks-gentoo.patch 1936 SHA256 d1775b91fa55f3706793771fd98564a06322e3dfc07970a6fd3497709507f527 SHA512 45e1e55fc9ed514e1cb18c5d4bc8b514fb995035e1ff9cf58b6bc238271bd3468fad1af23f53035b7c43a1a7becf51234522953064eefedcae8b507e5b7cfd7a WHIRLPOOL b18cc3df85b6251b823219657397ea89f9f08c67b57b64e09bfedfa341a04aa6910acb4876c2bcca2b853e27bf5ee43a1f2237625b84f183edab134cf08fa17a | ||||||
|  | AUX gitlabhq-4.0.0-fix-gemfile.patch 1736 SHA256 b37a447b38e5303e94205fda9ce131f5c8828c323974e9ed30253d53938d7640 SHA512 6e5e875a53bb2efda1153c6ef8275f93cd8b9eb8d936b34a6df6f0db3bc577099fbc22f2e6c844ee8629af13c4d4fed968b0c5d3360ebdcee1136010a04be34e WHIRLPOOL 1f24e69f52df32d75863295378a781da4ff6df22699a77d1b9f53a98c78df81a1cd0136b60695fe28ff904dcb32c87b6e67b4ae324c070c873bfefc3bd3d6c2e | ||||||
|  | AUX gitlabhq-4.0.0-fix-passenger.patch 1156 SHA256 f2ccaad4e349cb8c965ed46607a78f7d738ed434565fc7d80b15ac92121a29a0 SHA512 31906f2a8831ce0484279bbac68d9935dca52e831cf8c473746a51d1b2de4077f40726544a09b10b80890c72b9028bda7b294fb19ccec5df5a312f5a2ce3d1aa WHIRLPOOL 384912fc1c1ae5da05e98525b435417f6488d3927e285fd16d3cf7659bc376bf5e801e3bc3be7f4de480c7302cc1d7edc3fa88825e82836dbaf0606f8218e662 | ||||||
|  | AUX gitlabhq-4.0.0-fix-resque-pg.patch 415 SHA256 c1b764777a0089020893f05649b6d15cf8c60611e90d9d0b3e74ee29bcb57614 SHA512 83639200bbc49350ab9bfc033c0a5401967ad2ab6b23bbdcd948c09dc5e2c05b7b17ae144751b410b9d67e2c3cc76a7b268dcfc0381ce9385bc5c3e8507f969e WHIRLPOOL 2fd974d4a2db04de2b1c6dbef320319dc33be553faf3dd7a40e5af20d2aecd245da35354fc6568f98e8fbb40da1e11eda41e60d6353c32664132fdd6a478e56d | ||||||
|  | AUX gitlabhq-4.0.0-fix-wiki-pg.patch 2871 SHA256 c27f7ebd8614d217d824782dd65f9e2e12c7bc507a3eb01339a8a962279483f0 SHA512 6f86728574e495ab9604855be43a3739194b0f81ba9dd9dd3fdb76ca950400d1068119be4190612030cfe8e2c59cb771cc434dbe9cc0ad55329953178fe6d8fb WHIRLPOOL 4bb437cc63ad721a3826da4d796d2d79a79f140fa02a18b1d36cfa5b1caaea082888bd950ead666f24d5951ddbc9f81ef0d4914aae61dd262eae6e31dcb501ac | ||||||
|  | AUX gitlabhq-4.0.0-google-analytics.patch 3490 SHA256 52eb67c29fa6f41e8776ce2ba8d86c098fa2583a827541aae7ffe5c496da42d7 SHA512 7a4d551e69d15dcd7f180c34381f98f80b76d6a0fa0b8d702d74bf0f6178b80bb6c9595e8d9ab3b56e4ede249532294adb8727c7bebb73fddf67e71e88117e8b WHIRLPOOL 85a62da7088c5e11d5a727ecf2057c831a4f3c8c42cc8a69c5d8778dfda495b351d72c45e73ced2e7876c7cb56a37eefaab125f32ca48fde3078c7e92e7a31fb | ||||||
|  | AUX gitlabhq-4.0.0-performance.patch 6391 SHA256 7857a5f3c0789680cd3be2bfdea5981a97521726aac49430cbf9ef21069113a4 SHA512 573fb038c91eb7749f4fca50f8ef51f70895e5b695eabeb59553831850fe957c130f8e32aa3e866133d10ee3129b39e8fcfb7b6200b8f058a98989d8c1bfaec8 WHIRLPOOL 2f37d70ba9295bd38399e7411162ec339854ae283129df7e743054363eb4f7c130c1bd3cf1f93ccc97ab416bed1f9a86abcb398c2b979eada0cff89554ede96c | ||||||
|  | AUX gitlabhq-4.0.0-public-projects.patch 5611 SHA256 e006809ab10496e31432496504f720a78a9cffc00f49f1b3ba267f323e0dc674 SHA512 d0e39b502504cd2d76419f57c1ea4061b8f9166317f11c1690df1c1bc41f278efbcd11a3762990a18a2141088c14c7446697559a95c1c5214487f179be099370 WHIRLPOOL 6d10625a101a8839f27be2dd9813126b9cee6f38267c345199ff51800c7c2e711add38c0d51667c80df68c5489d2c8404722ad69f0748d9ef86e25103a3aea51 | ||||||
|  | AUX gitlabhq-4.0.0-r1-fix-gemfile.patch 3189 SHA256 f6efec5d8ed7533adade361efcbd0d485d5b7ca9d9dd9f4b4d3a30264804fcca SHA512 fbf4685db1501fc85d0dc16bbae614ebe21b4546dbde8cd52a0ca8b0be0b818c4737835d833e09cfc621edc70583bb7c8f002f28734ced3ffd0c8ae906467f44 WHIRLPOOL b92a8c3e7df5b97ffe21aad1ec4ceaf4a0904e5d758f8994b771e51218f0998fa8043d654d6a5cabfd0d2d82da9481caf640baf5e1f25395a7c7156798095320 | ||||||
|  | AUX gitlabhq-6.0.2-r2-fix-gemfile.patch 2103 SHA256 f4d07fd2a8b59a7a89f3b522324f059ce00ce4292d1647d161d64d3c8fc27995 SHA512 dbd439d2338240622cd63e09703035bd676266edf1ceba90b402e78f500d3a80ef32a63ef1a178d12b0ca9f9e60e250b3c3e287772a6cba25d2371372b1e02af WHIRLPOOL 4fb037080c5d4051c9f38c2f3d32521ee5241cab6348ffabd9c8c606413526fc127a71e70079e296aaf34b055cdb874879cf46e1378617ac393669fbb5da90b8 | ||||||
|  | AUX gitlabhq-6.0.2-r2-fix-project-name-regex.patch 1203 SHA256 9ffa0c164384c00de3953a57c1f3984fe08cfcd996216ea7fece0ffa70ea91d6 SHA512 04bc0d2940f551d8b8c283b402cfb992dcd34900154d15a9372c4b560d0d07900923268a24785cfa647894f6a3ade8a0db3f84075d1365387dd2ef6a2cf11bec WHIRLPOOL 21250714ea6e273e0133673171812b1725228a60c616eece52c7feaf1a475c40a633f96d25d7e7089f6a6670ad21eae85d4bdc8728c63b483eb6b813381606be | ||||||
|  | AUX gitlabhq-6.0.2-r2-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60 | ||||||
|  | AUX gitlabhq-6.0.2-r2-ldap-user-mapping.patch 7176 SHA256 202c21c2cc2ca26cabf648ba61d0269a73ea12dd8ea67f07c003c911620d4205 SHA512 40644e71f2977ef5fa26b260c151b96589ab57e5fbef5403614e22da0475f211f01569fe54865ea0ffb944431843dac02db997a5d5d64733dda3a878c9b09b97 WHIRLPOOL 7889c3052a370849b0a329dc8fa745e6f61754578807b2527312b3d09b34ec3c6c4bfc7a85315aff9e56488f6c66661ef025d5b2510e010266e935080214a0f4 | ||||||
|  | AUX gitlabhq-6.4.3-fix-gemfile.patch 2168 SHA256 dafa8390b1b3421d174a4f3f4e1f4fcb65be4c972aae89c4cc0f61c8492a136c SHA512 123a8f2d893159f7da235a3b7c8913686bace04eb36dbee110ebddbfbc2c4a166338e41a030f86d4b5ae7e86fdb367035b3612e62a668e365ecde1ce2e16c39a WHIRLPOOL 2ee7c88d42273d1547cdb1f27c1fe550fe29003d5f308c61d57457723658675b7cfd91fdd37a095a30810e3e55cadc1ba1b080b679875ee4bf618fd563d8dfcc | ||||||
|  | AUX gitlabhq-6.4.3-fix-project-name-regex.patch 1143 SHA256 6f12268ae65ea0fbb80a8eed0740f7270d22d2b17f7768d5d2f0feddf38301ea SHA512 3d70766c0cb0fda5f57235424633d507f30005edbf569b03af99965e26d758e7ecd3669f20c7f06350b277529f5be63e99814eed5ac74eacaec5a1f85199a25f WHIRLPOOL d2acb2ea30f44166e6164913d7345366ed9ff5646832240c6287745c1c86915b5661eaea68a3d842a363fff8301a4bcdaf71563d1c768d30c163fd396757f833 | ||||||
|  | AUX gitlabhq-6.4.3-fix-sendmail-config.patch 731 SHA256 51f0d0af2a7c048d7cff56cf27955632f340ca67f9d460af840cf34ed60ca574 SHA512 b10d5b8d89927404d25345e17ba37ca4e7848b04c2ca20c5eef14eaac43d9ba14b62ae4c0d532eefaf6f9a2944578e84eb65a3420335d32495855c4807eec356 WHIRLPOOL 66f6443f311f2355ffd4efaea914f462816a1966a715b3b5ffaaa26b41bdced928b9905b8606f06fac3c2ccf20741553cfed2615430287bede01cf376aae2a60 | ||||||
|  | DIST gitlabhq-6.4.3.tar.gz 10979694 SHA256 a2df6ec3de927a45fdaec70b806f731d66694db54dc674cd8b3378703d28114b SHA512 df06c07434ca45273e4988827d11a287249f2f3baddd799c45fafc56661ba4e1d872536f233eac7ac5aa704ddae0bcc92850af926a07f42f399873e1eda4e8f7 WHIRLPOOL 33e6199f2955fcbe65177c4f0520ceeaed82b9c1df94721048eeb8cefc798b9c83beb66f8ddec3cc91a848ba056f39e633ffba2f588880828bcae4a52d560dbc | ||||||
|  | EBUILD gitlabhq-6.4.3.ebuild 10560 SHA256 afb3c0e0fb89d209f258434ed2aef36ede8c8f267ef200670d4cb43a529805b2 SHA512 4bf3ad8a6e480d5a56513bcfd61578b23cbf911e0619f5e27c2e89d0f1f24a873fa90541678df194c657f7e8c7a7c474519fbc4246e4adc5db6aacfa7ace3e11 WHIRLPOOL f108aeac518d05ea5860a3ed101a7d472d1025bf8ae474760bfcfe109dc0100cd266383a54742f2b29277b64f89882936bc57b97c7285a5d0e69726d14e97a87 | ||||||
							
								
								
									
										10
									
								
								www-apps/gitlabhq/files/config.ssh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								www-apps/gitlabhq/files/config.ssh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | Host localhost | ||||||
|  |   StrictHostKeyChecking no | ||||||
|  |   UserKnownHostsFile=/dev/null | ||||||
|  |   BatchMode yes | ||||||
|  |   CheckHostIP no | ||||||
|  |   AddressFamily inet | ||||||
|  |   PreferredAuthentications publickey | ||||||
|  |   ControlMaster auto | ||||||
|  |   ControlPath ~/.ssh/ssh-%r-%h:%p.sock | ||||||
|  |   ControlPersist 24h | ||||||
							
								
								
									
										43
									
								
								www-apps/gitlabhq/files/gitlab-sidekiq.init
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								www-apps/gitlabhq/files/gitlab-sidekiq.init
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | ||||||
|  | #!/sbin/runscript | ||||||
|  | 
 | ||||||
|  | name="GitLab Sidekiq" | ||||||
|  | description="Sidekiq for GitLab @SLOT@" | ||||||
|  | 
 | ||||||
|  | : ${gitlab_user:=@USER@} | ||||||
|  | : ${gitlab_base:="@GITLAB_BASE@"} | ||||||
|  | : ${rails_env:=production} | ||||||
|  | 
 | ||||||
|  | : ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"} | ||||||
|  | : ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"} | ||||||
|  | : ${sidekiq_queues:="@QUEUES@"} | ||||||
|  | 
 | ||||||
|  | sidekiq_command="/usr/bin/bundle" | ||||||
|  | sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}" | ||||||
|  | 
 | ||||||
|  | depend() { | ||||||
|  | 	need redis | ||||||
|  | 	use net | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | start() { | ||||||
|  | 	checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")" | ||||||
|  | 
 | ||||||
|  | 	ebegin "Starting ${name} - Sidekiq" | ||||||
|  | 
 | ||||||
|  | 	start-stop-daemon --start \ | ||||||
|  | 		--background --quiet \ | ||||||
|  | 		--chdir "${gitlab_base}" \ | ||||||
|  | 		--user=${gitlab_user} \ | ||||||
|  | 		--pidfile="${sidekiq_pidfile}" \ | ||||||
|  | 		--env RAILS_ENV=${rails_env} \ | ||||||
|  | 		--exec ${sidekiq_command} -- ${sidekiq_command_args} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | stop() { | ||||||
|  | 	ebegin "Stopping ${name} - Sidekiq" | ||||||
|  | 	start-stop-daemon --stop \ | ||||||
|  | 		--pidfile=${sidekiq_pidfile} \ | ||||||
|  | 		--exec ${sidekiq_command} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
							
								
								
									
										50
									
								
								www-apps/gitlabhq/files/gitlab-support.init
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								www-apps/gitlabhq/files/gitlab-support.init
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,50 @@ | ||||||
|  | #!/sbin/runscript | ||||||
|  | 
 | ||||||
|  | name="GitLab support" | ||||||
|  | description="Support for GitLab @SLOT@" | ||||||
|  | 
 | ||||||
|  | : ${gitlab_user:=@USER@} | ||||||
|  | : ${gitlab_group:=@GROUP@} | ||||||
|  | : ${gitlab_home:="@GITLAB_HOME@"} | ||||||
|  | 
 | ||||||
|  | : ${resque_pidfile:="/run/gitlab/resque_worker.pid"} | ||||||
|  | : ${resque_log:="@LOG_DIR@/resque.log"} | ||||||
|  | 
 | ||||||
|  | : ${resque_queue:="@RESQUE_QUEUE@"} | ||||||
|  | : ${rails_env:=production} | ||||||
|  | 
 | ||||||
|  | resque_command="/usr/bin/bundle" | ||||||
|  | resque_command_args="exec rake environment resque:work QUEUE=${resque_queue} RAILS_ENV=${rails_env}" | ||||||
|  | 
 | ||||||
|  | if [ ${rails_env} = development ]; then | ||||||
|  | 	resque_command_args+=" VVERBOSE=1" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | depend() { | ||||||
|  | 	provide gitlab | ||||||
|  | 	need redis | ||||||
|  | 	use net | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | start() { | ||||||
|  | 	ebegin "Starting GitLab @SLOT@ Resque worker" | ||||||
|  | 
 | ||||||
|  | 	checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${resque_pidfile}")" | ||||||
|  | 
 | ||||||
|  | 	start-stop-daemon --start \ | ||||||
|  | 		--background --quiet \ | ||||||
|  | 		--chdir "${gitlab_home}" \ | ||||||
|  | 		--user="${gitlab_user}:${gitlab_group}" \ | ||||||
|  | 		--make-pidfile --pidfile=${resque_pidfile} \ | ||||||
|  | 		--stdout "${resque_log}" --stderr "${resque_log}" \ | ||||||
|  | 		--exec ${resque_command} -- ${resque_command_args} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | stop() { | ||||||
|  | 	ebegin "Stopping GitLab @SLOT@ Resque worker" | ||||||
|  | 	start-stop-daemon --stop \ | ||||||
|  | 		--pidfile=${resque_pidfile} \ | ||||||
|  | 		--exec ${resque_command} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
							
								
								
									
										67
									
								
								www-apps/gitlabhq/files/gitlab-unicorn-6.init
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								www-apps/gitlabhq/files/gitlab-unicorn-6.init
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,67 @@ | ||||||
|  | #!/sbin/runscript | ||||||
|  | 
 | ||||||
|  | name="GitLab-@SLOT@" | ||||||
|  | description="GitLab @SLOT@ on Unicorns" | ||||||
|  | 
 | ||||||
|  | : ${gitlab_user:=@USER@} | ||||||
|  | : ${gitlab_base:="@GITLAB_BASE@"} | ||||||
|  | : ${rails_env:=production} | ||||||
|  | 
 | ||||||
|  | : ${server_pidfile:="/run/gitlab/unicorn.pid"} | ||||||
|  | 
 | ||||||
|  | : ${sidekiq_pidfile:="/run/gitlab/sidekiq.pid"} | ||||||
|  | : ${sidekiq_logfile:="@LOGS_DIR@/sidekiq.log"} | ||||||
|  | : ${sidekiq_queues:="@QUEUES@"} | ||||||
|  | 
 | ||||||
|  | server_command="/usr/bin/bundle" | ||||||
|  | server_command_args="exec unicorn_rails -c ${gitlab_base}/config/unicorn.rb -E ${rails_env} -D" | ||||||
|  | 
 | ||||||
|  | sidekiq_command="/usr/bin/bundle" | ||||||
|  | sidekiq_command_args="exec sidekiq -q ${sidekiq_queues} -P ${sidekiq_pidfile} -L ${sidekiq_logfile}" | ||||||
|  | 
 | ||||||
|  | depend() { | ||||||
|  | 	provide gitlab | ||||||
|  | 	need redis | ||||||
|  | 	use net | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | start() { | ||||||
|  | 	ebegin "Starting ${name} - Unicorn servers" | ||||||
|  | 
 | ||||||
|  | 	checkpath -d -o ${gitlab_user} -m755 "$(dirname "${server_pidfile}")" | ||||||
|  | 	checkpath -d -o ${gitlab_user} -m755 "$(dirname "${sidekiq_pidfile}")" | ||||||
|  | 
 | ||||||
|  | 	start-stop-daemon --start \ | ||||||
|  | 		--chdir "${gitlab_base}" \ | ||||||
|  | 		--user=${gitlab_user} \ | ||||||
|  | 		--pidfile="${server_pidfile}" \ | ||||||
|  | 		--env RAILS_ENV=${rails_env} \ | ||||||
|  | 		--exec ${server_command} -- ${server_command_args} | ||||||
|  | 	eend $? | ||||||
|  | 
 | ||||||
|  | 	ebegin "Starting ${name} - Sidekiq" | ||||||
|  | 
 | ||||||
|  | 	start-stop-daemon --start \ | ||||||
|  | 		--background --quiet \ | ||||||
|  | 		--chdir "${gitlab_base}" \ | ||||||
|  | 		--user=${gitlab_user} \ | ||||||
|  | 		--pidfile="${sidekiq_pidfile}" \ | ||||||
|  | 		--env RAILS_ENV=${rails_env} \ | ||||||
|  | 		--exec ${sidekiq_command} -- ${sidekiq_command_args} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | stop() { | ||||||
|  | 	ebegin "Stopping ${name} - Sidekiq" | ||||||
|  | 	start-stop-daemon --stop \ | ||||||
|  | 		--pidfile=${sidekiq_pidfile} \ | ||||||
|  | 		--exec ${sidekiq_command} | ||||||
|  | 	eend $? | ||||||
|  | 
 | ||||||
|  | 	ebegin "Stopping ${name} - Unicorn servers" | ||||||
|  | 	start-stop-daemon --stop \ | ||||||
|  | 		--signal QUIT \ | ||||||
|  | 		--pidfile=${server_pidfile} \ | ||||||
|  | 		--exec ${server_command} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
							
								
								
									
										69
									
								
								www-apps/gitlabhq/files/gitlab-unicorn.init
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								www-apps/gitlabhq/files/gitlab-unicorn.init
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,69 @@ | ||||||
|  | #!/sbin/runscript | ||||||
|  | 
 | ||||||
|  | name="GitLab" | ||||||
|  | description="GitLab @SLOT@ on Unicorns" | ||||||
|  | 
 | ||||||
|  | : ${gitlab_user:=@USER@} | ||||||
|  | : ${gitlab_group:=@GROUP@} | ||||||
|  | : ${gitlab_home:="@GITLAB_HOME@"} | ||||||
|  | 
 | ||||||
|  | : ${server_pidfile:="/run/gitlab/unicorn.pid"} | ||||||
|  | : ${rails_env:=production} | ||||||
|  | 
 | ||||||
|  | : ${resque_pidfile:="/run/gitlab/resque_worker.pid"} | ||||||
|  | : ${resque_log:="/var/log/gitlab-4.0/resque.log"} | ||||||
|  | : ${resque_queue:=@RESQUE_QUEUE@} | ||||||
|  | 
 | ||||||
|  | server_command="/usr/bin/bundle" | ||||||
|  | server_command_args="exec unicorn_rails -c ${gitlab_home}/config/unicorn.rb -E ${rails_env} -D" | ||||||
|  | resque_command="/usr/bin/bundle" | ||||||
|  | resque_command_args="exec rake environment resque:work QUEUE=${resque_queue} RAILS_ENV=${rails_env}" | ||||||
|  | 
 | ||||||
|  | if [ ${rails_env} = development ]; then | ||||||
|  | 	resque_command_args+=" VVERBOSE=1" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | depend() { | ||||||
|  | 	provide gitlab | ||||||
|  | 	need redis | ||||||
|  | 	use net | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | start() { | ||||||
|  | 	ebegin "Starting GitLab @SLOT@ Unicorn servers" | ||||||
|  | 
 | ||||||
|  | 	checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${server_pidfile}")" | ||||||
|  | 	checkpath -d -o "${gitlab_user}:${gitlab_group}" -m750 "$(dirname "${resque_pidfile}")" | ||||||
|  | 
 | ||||||
|  | 	start-stop-daemon --start \ | ||||||
|  | 		--chdir "${gitlab_home}" \ | ||||||
|  | 		--user="${gitlab_user}:${gitlab_group}" \ | ||||||
|  | 		--pidfile="${server_pidfile}" \ | ||||||
|  | 		--exec ${server_command} -- ${server_command_args} | ||||||
|  | 	eend $? | ||||||
|  | 
 | ||||||
|  | 	ebegin "Starting GitLab @SLOT@ Resque worker" | ||||||
|  | 
 | ||||||
|  | 	start-stop-daemon --start \ | ||||||
|  | 		--background --quiet \ | ||||||
|  | 		--chdir "${gitlab_home}" \ | ||||||
|  | 		--user="${gitlab_user}:${gitlab_group}" \ | ||||||
|  | 		--make-pidfile --pidfile=${resque_pidfile} \ | ||||||
|  | 		--stdout "${resque_log}" --stderr "${resque_log}" \ | ||||||
|  | 		--exec ${resque_command} -- ${resque_command_args} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | stop() { | ||||||
|  | 	ebegin "Stopping GitLab @SLOT@ Resque worker" | ||||||
|  | 	start-stop-daemon --stop \ | ||||||
|  | 		--pidfile=${resque_pidfile} \ | ||||||
|  | 		--exec ${resque_command} | ||||||
|  | 	eend $? | ||||||
|  | 
 | ||||||
|  | 	ebegin "Stopping GitLab @SLOT@ Unicorn servers" | ||||||
|  | 	start-stop-daemon --stop \ | ||||||
|  | 		--pidfile=${server_pidfile} \ | ||||||
|  | 		--exec ${server_command} -- ${server_command_args} | ||||||
|  | 	eend $? | ||||||
|  | } | ||||||
							
								
								
									
										10
									
								
								www-apps/gitlabhq/files/gitlab.logrotate
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								www-apps/gitlabhq/files/gitlab.logrotate
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | # Copyright 1999-2012 Gentoo Foundation | ||||||
|  | # Distributed under the terms of the GNU General Public License v2 | ||||||
|  | # $Header: $ | ||||||
|  | 
 | ||||||
|  | @LOG_DIR@/*.log { | ||||||
|  | 	missingok | ||||||
|  | 	delaycompress | ||||||
|  | 	compress | ||||||
|  | 	copytruncate | ||||||
|  | } | ||||||
|  | @ -0,0 +1,58 @@ | ||||||
|  | --- a/lib/tasks/gitlab/info.rake	2012-12-25 00:33:12.066872526 +0100
 | ||||||
|  | +++ b/lib/tasks/gitlab/info.rake	2012-12-25 00:33:55.682878240 +0100
 | ||||||
|  | @@ -12,6 +12,9 @@
 | ||||||
|  |                      debian_version = File.read('/etc/debian_version') | ||||||
|  |                      "Debian #{debian_version}" | ||||||
|  |                    end | ||||||
|  | +      os_name ||= if File.readable?('/etc/gentoo-release')
 | ||||||
|  | +                    File.read('/etc/gentoo-release')
 | ||||||
|  | +                  end
 | ||||||
|  |        os_name.squish! | ||||||
|  |   | ||||||
|  |        # check if there is an RVM environment | ||||||
|  | --- a/lib/tasks/gitlab/check.rake	2012-12-25 01:47:35.162380668 +0100
 | ||||||
|  | +++ b/lib/tasks/gitlab/check.rake	2012-12-25 01:49:49.006346565 +0100
 | ||||||
|  | @@ -20,8 +20,8 @@
 | ||||||
|  |        check_gitlab_config_not_outdated | ||||||
|  |        check_log_writable | ||||||
|  |        check_tmp_writable | ||||||
|  | -      check_init_script_exists
 | ||||||
|  | -      check_init_script_up_to_date
 | ||||||
|  | +#      check_init_script_exists
 | ||||||
|  | +#      check_init_script_up_to_date
 | ||||||
|  |        check_satellites_exist | ||||||
|  |   | ||||||
|  |        finished_checking "GitLab" | ||||||
|  | @@ -254,7 +254,7 @@
 | ||||||
|  |        start_checking "Environment" | ||||||
|  |   | ||||||
|  |        check_gitlab_in_git_group | ||||||
|  | -      check_issue_1056_shell_profile_error
 | ||||||
|  | +#      check_issue_1056_shell_profile_error --don't need on Gentoo
 | ||||||
|  |        check_gitlab_git_config | ||||||
|  |        check_python2_exists | ||||||
|  |        check_python2_version | ||||||
|  | @@ -542,7 +542,7 @@
 | ||||||
|  |   | ||||||
|  |      def check_gitolite_is_up_to_date | ||||||
|  |        print "Using recommended version ... " | ||||||
|  | -      if gitolite_version.try(:start_with?, "v3.04")
 | ||||||
|  | +      if gitolite_version.try(:start_with?, "3.2")
 | ||||||
|  |          puts "yes".green | ||||||
|  |        else | ||||||
|  |          puts "no".red | ||||||
|  | @@ -838,11 +838,13 @@
 | ||||||
|  |        gitolite_version_file = "#{gitolite_home}/gitolite/src/VERSION" | ||||||
|  |        if File.readable?(gitolite_version_file) | ||||||
|  |          File.read(gitolite_version_file) | ||||||
|  | +      else
 | ||||||
|  | +        run("equery -q list -F '$version' 'gitolite'")
 | ||||||
|  |        end | ||||||
|  |      end | ||||||
|  |   | ||||||
|  |      def has_gitolite3? | ||||||
|  | -      gitolite_version.try(:start_with?, "v3.")
 | ||||||
|  | +      gitolite_version.try(:start_with?, "3.")
 | ||||||
|  |      end | ||||||
|  |    end | ||||||
|  |   | ||||||
							
								
								
									
										48
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,48 @@ | ||||||
|  | diff --git a/Gemfile b/Gemfile
 | ||||||
|  | index 49fbcad04fcdbb0d9a46c79e9185e10013c00f33..14b3553ffb8ae9bcb88c55b2d2772a926771cc55 100644
 | ||||||
|  | --- a/Gemfile
 | ||||||
|  | +++ b/Gemfile
 | ||||||
|  | @@ -28,6 +28,9 @@ gem 'yaml_db',       git: "https://github.com/gitlabhq/yaml_db.git",        ref:
 | ||||||
|  |  gem 'grack',         git: "https://github.com/gitlabhq/grack.git",          ref: 'ba46f3b0845c6a09d488ae6abdce6ede37e227e8' | ||||||
|  |  gem 'grit_ext',      git: "https://github.com/gitlabhq/grit_ext.git",       ref: '8e6afc2da821354774aa4d1ee8a1aa2082f84a3e' | ||||||
|  |   | ||||||
|  | +# Patched to fix issues with compiling on Gentoo
 | ||||||
|  | +gem "charlock_holmes", git: "https://github.com/ISSIntel/charlock_holmes.git", ref: '994dcf37aba066250750866e13bb51e3d5e72898'
 | ||||||
|  | +
 | ||||||
|  |  # Gitolite client (for work with gitolite-admin repo) | ||||||
|  |  gem "gitolite", '1.1.0' | ||||||
|  |   | ||||||
|  | diff --git a/Gemfile.lock b/Gemfile.lock
 | ||||||
|  | index d8be14ba80ab191d6001e601026d27cdfa8fbb54..60f98ef22a8daf77ef08b58c52fab8f0cf560b51 100644
 | ||||||
|  | --- a/Gemfile.lock
 | ||||||
|  | +++ b/Gemfile.lock
 | ||||||
|  | @@ -6,6 +6,13 @@ GIT
 | ||||||
|  |      database_cleaner (0.9.1) | ||||||
|  |   | ||||||
|  |  GIT | ||||||
|  | +  remote: https://github.com/ISSIntel/charlock_holmes.git
 | ||||||
|  | +  revision: 994dcf37aba066250750866e13bb51e3d5e72898
 | ||||||
|  | +  ref: 994dcf37aba066250750866e13bb51e3d5e72898
 | ||||||
|  | +  specs:
 | ||||||
|  | +    charlock_holmes (0.6.9)
 | ||||||
|  | +
 | ||||||
|  | +GIT
 | ||||||
|  |    remote: https://github.com/ctran/annotate_models.git | ||||||
|  |    revision: be4e26825b521f0b2d86b181e2dff89901aa9b1e | ||||||
|  |    specs: | ||||||
|  | @@ -129,7 +136,6 @@ GEM
 | ||||||
|  |      carrierwave (0.7.1) | ||||||
|  |        activemodel (>= 3.2.0) | ||||||
|  |        activesupport (>= 3.2.0) | ||||||
|  | -    charlock_holmes (0.6.9)
 | ||||||
|  |      childprocess (0.3.6) | ||||||
|  |        ffi (~> 1.0, >= 1.0.6) | ||||||
|  |      chosen-rails (0.9.8) | ||||||
|  | @@ -461,6 +467,7 @@ DEPENDENCIES
 | ||||||
|  |    bootstrap-sass (= 2.2.1.1) | ||||||
|  |    capybara | ||||||
|  |    carrierwave (~> 0.7.1) | ||||||
|  | +  charlock_holmes!
 | ||||||
|  |    chosen-rails (= 0.9.8) | ||||||
|  |    coffee-rails (~> 3.2.2) | ||||||
|  |    colored | ||||||
							
								
								
									
										29
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-passenger.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-passenger.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | --- /dev/null	2012-12-22 21:17:05.856026005 +0100
 | ||||||
|  | +++ /config/initializers/passenger_fix.rb	2013-01-01 23:11:18.717833817 +0100
 | ||||||
|  | @@ -0,0 +1,26 @@
 | ||||||
|  | +if defined?(PhusionPassenger)
 | ||||||
|  | +
 | ||||||
|  | +  # When you're using Passenger with smart-lv2 (default) or smart spawn method,
 | ||||||
|  | +  # Resque doesn't recognize that it has been forked and should re-establish
 | ||||||
|  | +  # Redis connection. You can see this error message in log:
 | ||||||
|  | +  #   Redis::InheritedError, Tried to use a connection from a child process 
 | ||||||
|  | +  #   without reconnecting. You need to reconnect to Redis after forking.
 | ||||||
|  | +  # 
 | ||||||
|  | +  # This solution is based on 
 | ||||||
|  | +  # https://github.com/redis/redis-rb/wiki/redis-rb-on-Phusion-Passenger
 | ||||||
|  | +  #
 | ||||||
|  | +  PhusionPassenger.on_event(:starting_worker_process) do |forked|
 | ||||||
|  | +    # do nothing if we're not in smart spawning mode
 | ||||||
|  | +    return unless forked
 | ||||||
|  | +
 | ||||||
|  | +    # reconnect to Redis
 | ||||||
|  | +    Resque.redis.client.reconnect
 | ||||||
|  | +
 | ||||||
|  | +    # reconnect to cache store unless :memory_store or :null_store is used
 | ||||||
|  | +    unless [ActiveSupport::Cache::MemoryStore,
 | ||||||
|  | +            ActiveSupport::Cache::NullStore].include? Rails.cache.class
 | ||||||
|  | +      Rails.cache.instance_variable_get(:@data).reset
 | ||||||
|  | +    end
 | ||||||
|  | +  end
 | ||||||
|  | +end
 | ||||||
|  | +
 | ||||||
							
								
								
									
										13
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-resque-pg.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-resque-pg.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | ||||||
|  | --- a/lib/tasks/resque.rake	2012-12-25 14:39:00.679594127 +0100
 | ||||||
|  | +++ b/lib/tasks/resque.rake	2012-12-25 14:40:14.003591438 +0100
 | ||||||
|  | @@ -3,6 +3,10 @@
 | ||||||
|  |  task "resque:setup" => :environment do | ||||||
|  |    Resque.after_fork do | ||||||
|  |      Resque.redis.client.reconnect | ||||||
|  | +
 | ||||||
|  | +    # Without that you will see exception:
 | ||||||
|  | +    #   'PGError: ERROR: prepared statement "a1" already exists'
 | ||||||
|  | +    ActiveRecord::Base.establish_connection
 | ||||||
|  |    end | ||||||
|  |  end | ||||||
|  |   | ||||||
							
								
								
									
										93
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-wiki-pg.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-fix-wiki-pg.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,93 @@ | ||||||
|  | diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb
 | ||||||
|  | index a93afe114df68c026716911fa49963a0c77db016..0be71d465a28779db3ed646df9ac116fea73e49a 100644
 | ||||||
|  | --- a/app/controllers/wikis_controller.rb
 | ||||||
|  | +++ b/app/controllers/wikis_controller.rb
 | ||||||
|  | @@ -2,9 +2,9 @@ class WikisController < ProjectResourceController
 | ||||||
|  |    before_filter :authorize_read_wiki! | ||||||
|  |    before_filter :authorize_write_wiki!, only: [:edit, :create, :history] | ||||||
|  |    before_filter :authorize_admin_wiki!, only: :destroy | ||||||
|  | -  
 | ||||||
|  | +
 | ||||||
|  |    def pages | ||||||
|  | -    @wikis = @project.wikis.group(:slug).order("created_at")
 | ||||||
|  | +    @wikis = @project.wikis.last_revisions.order("created_at")
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def show | ||||||
|  | @@ -49,7 +49,7 @@ class WikisController < ProjectResourceController
 | ||||||
|  |    def history | ||||||
|  |      @wikis = @project.wikis.where(slug: params[:id]).order("created_at") | ||||||
|  |    end | ||||||
|  | -  
 | ||||||
|  | +
 | ||||||
|  |    def destroy | ||||||
|  |      @wikis = @project.wikis.where(slug: params[:id]).delete_all | ||||||
|  |   | ||||||
|  | diff --git a/app/models/wiki.rb b/app/models/wiki.rb
 | ||||||
|  | index 252a97e8cca647dda190cec95f3a9bbe8129181e..53d52ec2a19760a7e6d37e38e8858c1ed92433cc 100644
 | ||||||
|  | --- a/app/models/wiki.rb
 | ||||||
|  | +++ b/app/models/wiki.rb
 | ||||||
|  | @@ -47,6 +47,19 @@ class Wiki < ActiveRecord::Base
 | ||||||
|  |      new_wiki | ||||||
|  |    end | ||||||
|  |   | ||||||
|  | +  # Scope with last revisions of pages (i.e. newest page per project_id
 | ||||||
|  | +  # and slug).
 | ||||||
|  | +  #
 | ||||||
|  | +  # return:
 | ||||||
|  | +  # ActiveRecord::Relation
 | ||||||
|  | +  #
 | ||||||
|  | +  def self.last_revisions
 | ||||||
|  | +    t1 = arel_table.alias(table_name + '1')
 | ||||||
|  | +    where(
 | ||||||
|  | +      id: from(t1).select(t1[:id].maximum).where(project_id: t1[:project_id], slug: t1[:slug])
 | ||||||
|  | +    )
 | ||||||
|  | +  end
 | ||||||
|  | +
 | ||||||
|  |    def set_slug | ||||||
|  |      self.slug = self.title.parameterize | ||||||
|  |    end | ||||||
|  | diff --git a/spec/factories.rb b/spec/factories.rb
 | ||||||
|  | index abc0d37470176e57eb8006e0af64dbb4fbbebb02..8357fe2127f358c3e82f06b9cc3c575e5d9ae6b2 100644
 | ||||||
|  | --- a/spec/factories.rb
 | ||||||
|  | +++ b/spec/factories.rb
 | ||||||
|  | @@ -138,9 +138,10 @@ FactoryGirl.define do
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    factory :wiki do | ||||||
|  | -    title
 | ||||||
|  | -    content
 | ||||||
|  | +    sequence(:title) { |n| "wiki#{n}" }
 | ||||||
|  | +    content "Content"
 | ||||||
|  |      user | ||||||
|  | +    project
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    factory :snippet do | ||||||
|  | diff --git a/spec/models/wiki_spec.rb b/spec/models/wiki_spec.rb
 | ||||||
|  | index 9750b81d303ecd1105a6c2bbe2d6b76aa79edd5b..a8967e95b200f45e26374be419f90375870c8d4a 100644
 | ||||||
|  | --- a/spec/models/wiki_spec.rb
 | ||||||
|  | +++ b/spec/models/wiki_spec.rb
 | ||||||
|  | @@ -32,4 +32,22 @@ describe Wiki do
 | ||||||
|  |      it { should validate_presence_of(:content) } | ||||||
|  |      it { should validate_presence_of(:user) } | ||||||
|  |    end | ||||||
|  | +
 | ||||||
|  | +  describe "#last_revisions" do
 | ||||||
|  | +    let(:project) { create(:project) }
 | ||||||
|  | +    before do
 | ||||||
|  | +      %w(p1 p2).each do |title|
 | ||||||
|  | +        %w(old new).each do |content|
 | ||||||
|  | +          create(:wiki, title: title, slug: title, project: project, content: content)
 | ||||||
|  | +        end
 | ||||||
|  | +      end
 | ||||||
|  | +    end
 | ||||||
|  | +    subject(:last_revisions) { project.wikis.last_revisions.all }
 | ||||||
|  | +
 | ||||||
|  | +    its(:count) { should == 2 }
 | ||||||
|  | +    it "should return each page once" do
 | ||||||
|  | +      last_revisions.map(&:title).should =~ %w(p1 p2)
 | ||||||
|  | +    end
 | ||||||
|  | +  end
 | ||||||
|  | +
 | ||||||
|  |  end | ||||||
|  | @ -0,0 +1,81 @@ | ||||||
|  | diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
 | ||||||
|  | index 52715a265bd49e0cc54a0f524351c15a70ea3c66..359d5cdaef52cd27322c9dfd71890c46c9f16bc7 100644
 | ||||||
|  | --- a/app/helpers/application_helper.rb
 | ||||||
|  | +++ b/app/helpers/application_helper.rb
 | ||||||
|  | @@ -160,4 +160,8 @@ module ApplicationHelper
 | ||||||
|  |      image_tag("authbuttons/#{file_name}", | ||||||
|  |                alt: "Sign in with #{provider.to_s.titleize}") | ||||||
|  |    end | ||||||
|  | +
 | ||||||
|  | +  def analytics_enable?
 | ||||||
|  | +    Gitlab.config.analytics.enabled and Rails.env.production?
 | ||||||
|  | +  end
 | ||||||
|  |  end | ||||||
|  | diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
 | ||||||
|  | index 4a0f60d36c26b5f5eb3a02d44a7da39bacaae04b..013ff6d15e02ea1e0c08b06b391fe865e7ba94f5 100644
 | ||||||
|  | --- a/app/views/layouts/_head.html.haml
 | ||||||
|  | +++ b/app/views/layouts/_head.html.haml
 | ||||||
|  | @@ -15,3 +15,4 @@
 | ||||||
|  |      - if current_controller?(:issues) | ||||||
|  |        = auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") | ||||||
|  |    = csrf_meta_tags | ||||||
|  | +  = render "shared/google_analytics" if analytics_enable?
 | ||||||
|  | diff --git a/app/views/shared/_google_analytics.html.haml b/app/views/shared/_google_analytics.html.haml
 | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000000000000000000000000000000000000..e8d4b9146680fb4da666d1462881f991bb1661fe
 | ||||||
|  | --- /dev/null
 | ||||||
|  | +++ b/app/views/shared/_google_analytics.html.haml
 | ||||||
|  | @@ -0,0 +1,9 @@
 | ||||||
|  | +:javascript
 | ||||||
|  | +  var _gaq = _gaq || [];
 | ||||||
|  | +  _gaq.push(['_setAccount', '#{ Gitlab.config.analytics.tracking_id }']);
 | ||||||
|  | +  _gaq.push(['_trackPageview']);
 | ||||||
|  | +  (function() {
 | ||||||
|  | +    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 | ||||||
|  | +    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 | ||||||
|  | +    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 | ||||||
|  | +  })();
 | ||||||
|  | diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
 | ||||||
|  | index f47625eb132ab304a71e35bf2ccf998fbe413c1f..3a603159cfab83ce078f839cf8c14ddf934dd837 100644
 | ||||||
|  | --- a/config/gitlab.yml.example
 | ||||||
|  | +++ b/config/gitlab.yml.example
 | ||||||
|  | @@ -1,4 +1,4 @@
 | ||||||
|  | -# # # # # # # # # # # # # # # # # # 
 | ||||||
|  | +# # # # # # # # # # # # # # # # # #
 | ||||||
|  |  # Gitlab application config file  # | ||||||
|  |  # # # # # # # # # # # # # # # # # # | ||||||
|  |  # | ||||||
|  | @@ -109,3 +109,13 @@ git:
 | ||||||
|  |    max_size: 5242880 # 5.megabytes | ||||||
|  |    # Git timeout to read commit, in seconds | ||||||
|  |    timeout: 10 | ||||||
|  | +  git_timeout: 10
 | ||||||
|  | +
 | ||||||
|  | +#
 | ||||||
|  | +# 4. Other settings:
 | ||||||
|  | +# ==========================
 | ||||||
|  | +
 | ||||||
|  | +# Google Analytics
 | ||||||
|  | +analytics:
 | ||||||
|  | +  enabled: false
 | ||||||
|  | +  tracking_id: '_your_tracking_id'
 | ||||||
|  | diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
 | ||||||
|  | index 4fe3ced4d8d1f7021a4e8cc8064a1ceaf74d65bc..6699c7f896781da77ecc4e525a7acf53b12c80cb 100644
 | ||||||
|  | --- a/config/initializers/1_settings.rb
 | ||||||
|  | +++ b/config/initializers/1_settings.rb
 | ||||||
|  | @@ -266,8 +266,6 @@ class Settings < Settingslogic
 | ||||||
|  |        app['gravatar_ssl_url'] || 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | ||||||
|  |      end | ||||||
|  |   | ||||||
|  | -
 | ||||||
|  | -
 | ||||||
|  |      def gitlab_on_non_standard_port? | ||||||
|  |        ![443, 80].include?(gitlab.port.to_i) | ||||||
|  |      end | ||||||
|  | @@ -350,3 +348,6 @@ Settings.git['max_size']  ||= Settings.pre_40_config ? Settings.git_max_size : 5
 | ||||||
|  |  Settings.git['bin_path']  ||= Settings.pre_40_config ? Settings.git_bin_path : '/usr/bin/git' | ||||||
|  |  Settings.git['timeout']   ||= Settings.pre_40_config ? Settings.git_timeout : 10 | ||||||
|  |  Settings.git['path']      ||= Settings.git.bin_path # FIXME: Deprecated: remove for 4.1 | ||||||
|  | +
 | ||||||
|  | +Settings['analytics'] ||= Settingslogic.new({})
 | ||||||
|  | +Settings.analytics['enabled'] ||= false
 | ||||||
							
								
								
									
										190
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-performance.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										190
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-performance.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,190 @@ | ||||||
|  | diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
 | ||||||
|  | --- a/app/helpers/application_helper.rb
 | ||||||
|  | +++ b/app/helpers/application_helper.rb
 | ||||||
|  | @@ -147,9 +147,8 @@ module ApplicationHelper
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def project_last_activity project | ||||||
|  | -    activity = project.last_activity
 | ||||||
|  | -    if activity && activity.created_at
 | ||||||
|  | -      time_ago_in_words(activity.created_at) + " ago"
 | ||||||
|  | +    if project.last_activity_date != project.created_at
 | ||||||
|  | +      time_ago_in_words(project.last_activity_date) + " ago"
 | ||||||
|  |      else | ||||||
|  |        "Never" | ||||||
|  |      end | ||||||
|  | diff --git a/app/models/event.rb b/app/models/event.rb
 | ||||||
|  | --- a/app/models/event.rb
 | ||||||
|  | +++ b/app/models/event.rb
 | ||||||
|  | @@ -38,7 +38,7 @@ class Event < ActiveRecord::Base
 | ||||||
|  |    delegate :title, to: :merge_request, prefix: true, allow_nil: true | ||||||
|  |   | ||||||
|  |    belongs_to :author, class_name: "User" | ||||||
|  | -  belongs_to :project
 | ||||||
|  | +  belongs_to :project, touch: true
 | ||||||
|  |    belongs_to :target, polymorphic: true | ||||||
|  |   | ||||||
|  |    # For Hash only | ||||||
|  | diff --git a/app/models/project.rb b/app/models/project.rb
 | ||||||
|  | --- a/app/models/project.rb
 | ||||||
|  | +++ b/app/models/project.rb
 | ||||||
|  | @@ -227,7 +227,8 @@ class Project < ActiveRecord::Base
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def last_activity_date | ||||||
|  | -    last_event.try(:created_at) || updated_at
 | ||||||
|  | +    # touched when any associated event is saved
 | ||||||
|  | +    updated_at
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def project_id | ||||||
|  | diff --git a/db/migrate/20121227190440_touch_projects_last_activity.rb b/db/migrate/20121227190440_touch_projects_last_activity.rb
 | ||||||
|  | --- /dev/null
 | ||||||
|  | +++ b/db/migrate/20121227190440_touch_projects_last_activity.rb
 | ||||||
|  | @@ -0,0 +1,18 @@
 | ||||||
|  | +class TouchProjectsLastActivity < ActiveRecord::Migration
 | ||||||
|  | +  def up
 | ||||||
|  | +    Project.record_timestamps = false
 | ||||||
|  | +
 | ||||||
|  | +    Project.find_each do |project|
 | ||||||
|  | +      last_event = project.events.order(:created_at).last
 | ||||||
|  | +      if last_event and last_event.created_at > project.updated_at
 | ||||||
|  | +        project.update_attribute(:updated_at, last_event.created_at)
 | ||||||
|  | +      end
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  | +    Project.record_timestamps = true
 | ||||||
|  | +  end
 | ||||||
|  | +
 | ||||||
|  | +  def down
 | ||||||
|  | +    raise ActiveRecord::IrreversibleMigration
 | ||||||
|  | +  end
 | ||||||
|  | +end
 | ||||||
|  | diff --git a/db/schema.rb b/db/schema.rb
 | ||||||
|  | --- a/db/schema.rb
 | ||||||
|  | +++ b/db/schema.rb
 | ||||||
|  | @@ -11,7 +11,7 @@
 | ||||||
|  |  # | ||||||
|  |  # It's strongly recommended to check this file into your version control system. | ||||||
|  |   | ||||||
|  | -ActiveRecord::Schema.define(:version => 20121219095402) do
 | ||||||
|  | +ActiveRecord::Schema.define(:version => 20121227190440) do
 | ||||||
|  |   | ||||||
|  |    create_table "events", :force => true do |t| | ||||||
|  |      t.string   "target_type" | ||||||
|  | diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb
 | ||||||
|  | --- a/spec/models/event_spec.rb
 | ||||||
|  | +++ b/spec/models/event_spec.rb
 | ||||||
|  | @@ -30,6 +30,17 @@ describe Event do
 | ||||||
|  |      it { should respond_to(:commits) } | ||||||
|  |    end | ||||||
|  |   | ||||||
|  | +  describe "Save" do
 | ||||||
|  | +    let(:event) { create(:event) }
 | ||||||
|  | +    let(:project) { create(:project) }
 | ||||||
|  | +
 | ||||||
|  | +    it "should touch associated project" do
 | ||||||
|  | +      event.stub(project: project)
 | ||||||
|  | +      event.project.should_receive(:touch)
 | ||||||
|  | +      event.save!
 | ||||||
|  | +    end
 | ||||||
|  | +  end
 | ||||||
|  | +
 | ||||||
|  |    describe "Push event" do | ||||||
|  |      before do | ||||||
|  |        project = create(:project) | ||||||
|  | diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
 | ||||||
|  | --- a/spec/models/project_spec.rb
 | ||||||
|  | +++ b/spec/models/project_spec.rb
 | ||||||
|  | @@ -163,22 +163,18 @@ describe Project do
 | ||||||
|  |   | ||||||
|  |    describe "last_activity methods" do | ||||||
|  |      let(:project)    { create(:project) } | ||||||
|  | -    let(:last_event) { double(created_at: Time.now) }
 | ||||||
|  | +    let(:last_event) { create(:event) }
 | ||||||
|  |   | ||||||
|  |      describe "last_activity" do | ||||||
|  | -      it "should alias last_activity to last_event"do
 | ||||||
|  | +      it "should alias last_activity to last_event" do
 | ||||||
|  |          project.stub(last_event: last_event) | ||||||
|  |          project.last_activity.should == last_event | ||||||
|  |        end | ||||||
|  |      end | ||||||
|  |   | ||||||
|  | -    describe 'last_activity_date' do
 | ||||||
|  | -      it 'returns the creation date of the project\'s last event if present' do
 | ||||||
|  | -        project.stub(last_event: last_event)
 | ||||||
|  | -        project.last_activity_date.should == last_event.created_at
 | ||||||
|  | -      end
 | ||||||
|  | -
 | ||||||
|  | -      it 'returns the project\'s last update date if it has no events' do
 | ||||||
|  | +    describe "last_activity_date" do
 | ||||||
|  | +      it "should alias last_activity_date to updated_at" do
 | ||||||
|  | +        project.stub(updated_at: Time.now)
 | ||||||
|  |          project.last_activity_date.should == project.updated_at | ||||||
|  |        end | ||||||
|  |      end | ||||||
|  | diff --git a/app/roles/authority.rb b/app/roles/authority.rb
 | ||||||
|  | --- a/app/roles/authority.rb
 | ||||||
|  | +++ b/app/roles/authority.rb
 | ||||||
|  | @@ -19,21 +19,25 @@ module Authority
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def repository_readers | ||||||
|  | -    keys = Key.joins({user: :users_projects}).
 | ||||||
|  | -      where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::REPORTER)
 | ||||||
|  | -    keys.map(&:identifier) + deploy_keys.map(&:identifier)
 | ||||||
|  | +    repository_members[UsersProject::REPORTER]
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def repository_writers | ||||||
|  | -    keys = Key.joins({user: :users_projects}).
 | ||||||
|  | -      where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::DEVELOPER)
 | ||||||
|  | -    keys.map(&:identifier)
 | ||||||
|  | +    repository_members[UsersProject::DEVELOPER]
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def repository_masters | ||||||
|  | -    keys = Key.joins({user: :users_projects}).
 | ||||||
|  | -      where("users_projects.project_id = ? AND users_projects.project_access = ?", id, UsersProject::MASTER)
 | ||||||
|  | -    keys.map(&:identifier)
 | ||||||
|  | +    repository_members[UsersProject::MASTER]
 | ||||||
|  | +  end
 | ||||||
|  | +
 | ||||||
|  | +  def repository_members
 | ||||||
|  | +    keys = Hash.new {|h,k| h[k] = [] }
 | ||||||
|  | +    UsersProject.select("keys.identifier, project_access").
 | ||||||
|  | +        joins(user: :keys).where(project_id: id).
 | ||||||
|  | +        each {|row| keys[row.project_access] << [row.identifier] }
 | ||||||
|  | +
 | ||||||
|  | +    keys[UsersProject::REPORTER] += deploy_keys.pluck(:identifier)
 | ||||||
|  | +    keys
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    def allow_read_for?(user) | ||||||
|  | diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml
 | ||||||
|  | --- a/app/views/events/_event.html.haml
 | ||||||
|  | +++ b/app/views/events/_event.html.haml
 | ||||||
|  | @@ -2,14 +2,14 @@
 | ||||||
|  |    %div.event-item | ||||||
|  |      %span.cgray.right | ||||||
|  |        #{time_ago_in_words(event.created_at)} ago. | ||||||
|  | +    - cache event do
 | ||||||
|  | +      = image_tag gravatar_icon(event.author_email), class: "avatar s24"
 | ||||||
|  |   | ||||||
|  | -    = image_tag gravatar_icon(event.author_email), class: "avatar s24"
 | ||||||
|  | -
 | ||||||
|  | -    - if event.push?
 | ||||||
|  | -      = render "events/event/push", event: event
 | ||||||
|  | -      .clearfix
 | ||||||
|  | -    - elsif event.note?
 | ||||||
|  | -      = render "events/event/note", event: event
 | ||||||
|  | -    - else
 | ||||||
|  | -      = render "events/event/common", event: event
 | ||||||
|  | +      - if event.push?
 | ||||||
|  | +        = render "events/event/push", event: event
 | ||||||
|  | +        .clearfix
 | ||||||
|  | +      - elsif event.note?
 | ||||||
|  | +        = render "events/event/note", event: event
 | ||||||
|  | +      - else
 | ||||||
|  | +        = render "events/event/common", event: event
 | ||||||
							
								
								
									
										141
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-public-projects.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-public-projects.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,141 @@ | ||||||
|  | diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
 | ||||||
|  | index 1fcadbfefbaf4d015d68ab7bc349f67becb717df..9d6a9449fcdcfbd138c7f8d4feb1e6b0e5a11926 100644
 | ||||||
|  | --- a/app/controllers/dashboard_controller.rb
 | ||||||
|  | +++ b/app/controllers/dashboard_controller.rb
 | ||||||
|  | @@ -14,6 +14,8 @@ class DashboardController < ApplicationController
 | ||||||
|  |                    @projects.personal(current_user) | ||||||
|  |                  when 'joined' then | ||||||
|  |                    @projects.joined(current_user) | ||||||
|  | +                when 'public' then
 | ||||||
|  | +                  @projects.public_only
 | ||||||
|  |                  else | ||||||
|  |                    @projects | ||||||
|  |                  end | ||||||
|  | diff --git a/app/models/ability.rb b/app/models/ability.rb
 | ||||||
|  | index 2d80c6720b79da74ae9e4d20d816b2433f3082a8..946ec1e1128da3f55ac9b7198b6c0fbdc1d4aba7 100644
 | ||||||
|  | --- a/app/models/ability.rb
 | ||||||
|  | +++ b/app/models/ability.rb
 | ||||||
|  | @@ -27,6 +27,8 @@ class Ability
 | ||||||
|  |   | ||||||
|  |        elsif project.guest_access_for?(user) | ||||||
|  |          rules << project_guest_rules | ||||||
|  | +      elsif project.public?
 | ||||||
|  | +        rules << project_public_rules
 | ||||||
|  |        end | ||||||
|  |   | ||||||
|  |        if project.namespace | ||||||
|  | @@ -104,6 +106,10 @@ class Ability
 | ||||||
|  |        ] | ||||||
|  |      end | ||||||
|  |   | ||||||
|  | +    def project_public_rules
 | ||||||
|  | +      project_report_rules
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  |      def group_abilities user, group | ||||||
|  |        rules = [] | ||||||
|  |   | ||||||
|  | diff --git a/app/models/project.rb b/app/models/project.rb
 | ||||||
|  | index 3e5c912e0b47a22cc5489b9cbfb1dd53da5095e9..f10a6afde27ce4226677c0aa28aabd7497fb4a9d 100644
 | ||||||
|  | --- a/app/models/project.rb
 | ||||||
|  | +++ b/app/models/project.rb
 | ||||||
|  | @@ -30,7 +30,7 @@ class Project < ActiveRecord::Base
 | ||||||
|  |    class TransferError < StandardError; end | ||||||
|  |   | ||||||
|  |    attr_accessible :name, :path, :description, :default_branch, :issues_enabled, | ||||||
|  | -                  :wall_enabled, :merge_requests_enabled, :wiki_enabled, as: [:default, :admin]
 | ||||||
|  | +                  :wall_enabled, :merge_requests_enabled, :wiki_enabled, :private_flag, as: [:default, :admin]
 | ||||||
|  |   | ||||||
|  |    attr_accessible :namespace_id, :owner_id, as: :admin | ||||||
|  |   | ||||||
|  | @@ -87,7 +87,7 @@ class Project < ActiveRecord::Base
 | ||||||
|  |    class << self | ||||||
|  |      def authorized_for user | ||||||
|  |        projects = includes(:users_projects, :namespace) | ||||||
|  | -      projects = projects.where("users_projects.user_id = :user_id or projects.owner_id = :user_id or namespaces.owner_id = :user_id", user_id: user.id)
 | ||||||
|  | +      projects = projects.where("users_projects.user_id = :user_id or projects.owner_id = :user_id or namespaces.owner_id = :user_id or projects.private_flag = false", user_id: user.id)
 | ||||||
|  |      end | ||||||
|  |   | ||||||
|  |      def active | ||||||
|  | diff --git a/app/roles/authority.rb b/app/roles/authority.rb
 | ||||||
|  | --- a/app/roles/authority.rb
 | ||||||
|  | +++ b/app/roles/authority.rb
 | ||||||
|  | @@ -20,2 +20,3 @@ module Authority
 | ||||||
|  |   | ||||||
|  |    def repository_readers | ||||||
|  | +    return ['@all'] if public?
 | ||||||
|  | diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml
 | ||||||
|  | index 27c22872d501456bc4b7fd4bfd2a31c45b0a0a53..793f6a22ac3a96540c4f18e518d2197de51482bf 100644
 | ||||||
|  | --- a/app/views/admin/projects/_form.html.haml
 | ||||||
|  | +++ b/app/views/admin/projects/_form.html.haml
 | ||||||
|  | @@ -24,6 +24,10 @@
 | ||||||
|  |          = f.label :default_branch, "Default Branch" | ||||||
|  |          .input= f.select(:default_branch, project.heads.map(&:name), {}, style: "width:210px;") | ||||||
|  |   | ||||||
|  | +    .clearfix
 | ||||||
|  | +      = f.label :private_flag, "Private"
 | ||||||
|  | +      .input= f.check_box :private_flag
 | ||||||
|  | +
 | ||||||
|  |    %fieldset.adv_settings | ||||||
|  |      %legend Features: | ||||||
|  |   | ||||||
|  | diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml
 | ||||||
|  | index 634b1836754a026cd26a32a30e4b0745629fc1e5..7bcedf6156e341ce7be48bee56cf1087ba63ccdb 100644
 | ||||||
|  | --- a/app/views/admin/projects/show.html.haml
 | ||||||
|  | +++ b/app/views/admin/projects/show.html.haml
 | ||||||
|  | @@ -102,6 +102,13 @@
 | ||||||
|  |      %td | ||||||
|  |        = check_box_tag :post_receive_file, 1, @project.has_post_receive_file?, disabled: true | ||||||
|  |   | ||||||
|  | +  %tr
 | ||||||
|  | +    %td
 | ||||||
|  | +      %b
 | ||||||
|  | +        Private:
 | ||||||
|  | +    %td
 | ||||||
|  | +      = check_box_tag :private_flag, 1, @project.private?, disabled: true
 | ||||||
|  | +
 | ||||||
|  |  %br | ||||||
|  |  %h5 | ||||||
|  |    Team | ||||||
|  | diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml
 | ||||||
|  | index cffafb5445c2b476018974c500f3e924dd8ee9c7..058e13f1741a52aedf7632052f745bf52ee00bbe 100644
 | ||||||
|  | --- a/app/views/dashboard/_projects.html.haml
 | ||||||
|  | +++ b/app/views/dashboard/_projects.html.haml
 | ||||||
|  | @@ -15,6 +15,8 @@
 | ||||||
|  |        = link_to "Personal", dashboard_path(scope: 'personal') | ||||||
|  |      = nav_tab :scope, 'joined' do | ||||||
|  |        = link_to "Joined", dashboard_path(scope: 'joined') | ||||||
|  | +    = nav_tab :scope, 'public' do
 | ||||||
|  | +      = link_to "Public", dashboard_path(scope: 'public')
 | ||||||
|  |   | ||||||
|  |    %ul.well-list | ||||||
|  |      - projects.each do |project| | ||||||
|  | diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
 | ||||||
|  | index 7044d1f20be1183c446de80268903f3018b7646e..2073b78d0606b688ffda69209130a4fb9f6d513c 100644
 | ||||||
|  | --- a/app/views/projects/_form.html.haml
 | ||||||
|  | +++ b/app/views/projects/_form.html.haml
 | ||||||
|  | @@ -23,6 +23,11 @@
 | ||||||
|  |          = f.label :default_branch, "Default Branch" | ||||||
|  |          .input= f.select(:default_branch, @project.heads.map(&:name), {}, style: "width:210px;") | ||||||
|  |   | ||||||
|  | +    .control-group
 | ||||||
|  | +      = f.label :private_flag, "Private"
 | ||||||
|  | +      .controls
 | ||||||
|  | +        = f.check_box :private_flag
 | ||||||
|  | +
 | ||||||
|  |    %fieldset.features | ||||||
|  |      %legend Features: | ||||||
|  |   | ||||||
|  | diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
 | ||||||
|  | index 83a769760987b719e10892723c78ae797bed01d0..31ce053a7657d3d834a99d33faa5c6ebdfa03fbe 100644
 | ||||||
|  | --- a/spec/models/project_spec.rb
 | ||||||
|  | +++ b/spec/models/project_spec.rb
 | ||||||
|  | @@ -42,7 +42,7 @@ describe Project do
 | ||||||
|  |    describe "Mass assignment" do | ||||||
|  |      it { should_not allow_mass_assignment_of(:namespace_id) } | ||||||
|  |      it { should_not allow_mass_assignment_of(:owner_id) } | ||||||
|  | -    it { should_not allow_mass_assignment_of(:private_flag) }
 | ||||||
|  | +    it { should allow_mass_assignment_of(:private_flag) }
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    describe "Validation" do | ||||||
							
								
								
									
										105
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-r1-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								www-apps/gitlabhq/files/gitlabhq-4.0.0-r1-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,105 @@ | ||||||
|  | --- a/Gemfile	2012-12-23 12:58:41.000000000 +0100
 | ||||||
|  | +++ b/Gemfile	2013-01-02 01:05:20.267204968 +0100
 | ||||||
|  | @@ -14,6 +14,9 @@
 | ||||||
|  |  gem "mysql2", group: :mysql | ||||||
|  |  gem "pg", group: :postgres | ||||||
|  |   | ||||||
|  | +# Cache store adapter for Memcached
 | ||||||
|  | +gem "dalli", group: :memcached
 | ||||||
|  | +
 | ||||||
|  |  # Auth | ||||||
|  |  gem "devise", "~> 2.1.0" | ||||||
|  |  gem 'omniauth', "~> 1.1.1" | ||||||
|  | @@ -28,8 +31,12 @@
 | ||||||
|  |  gem 'grack',         git: "https://github.com/gitlabhq/grack.git",          ref: 'ba46f3b0845c6a09d488ae6abdce6ede37e227e8' | ||||||
|  |  gem 'grit_ext',      git: "https://github.com/gitlabhq/grit_ext.git",       ref: '8e6afc2da821354774aa4d1ee8a1aa2082f84a3e' | ||||||
|  |   | ||||||
|  | +# Patched to fix issues with compiling on Gentoo
 | ||||||
|  | +gem "charlock_holmes", git: "https://github.com/ISSIntel/charlock_holmes.git", ref: '994dcf37aba066250750866e13bb51e3d5e72898'
 | ||||||
|  | +
 | ||||||
|  |  # Gitolite client (for work with gitolite-admin repo) | ||||||
|  | -gem "gitolite", '1.1.0'
 | ||||||
|  | +# Forked version with important performance patch (will be merged to upstream soon)
 | ||||||
|  | +gem "gitolite",      git: "git://github.com/jirutka/gitolite.git",          ref: '75d64ea15aa51557034fae44c578438f85249f1e'
 | ||||||
|  |   | ||||||
|  |  # Syntax highlighter | ||||||
|  |  gem "pygments.rb",  git: "https://github.com/gitlabhq/pygments.rb.git", branch: "master" | ||||||
|  | --- a/Gemfile.lock	2012-12-23 12:58:41.000000000 +0100
 | ||||||
|  | +++ b/Gemfile.lock	2013-01-02 01:05:20.271204975 +0100
 | ||||||
|  | @@ -1,4 +1,14 @@
 | ||||||
|  |  GIT | ||||||
|  | +  remote: git://github.com/jirutka/gitolite.git
 | ||||||
|  | +  revision: 75d64ea15aa51557034fae44c578438f85249f1e
 | ||||||
|  | +  ref: 75d64ea15aa51557034fae44c578438f85249f1e
 | ||||||
|  | +  specs:
 | ||||||
|  | +    gitolite (1.1.0)
 | ||||||
|  | +      gratr19 (~> 0.4.4.1)
 | ||||||
|  | +      grit (~> 2.5.0)
 | ||||||
|  | +      hashery (~> 1.5.0)
 | ||||||
|  | +
 | ||||||
|  | +GIT
 | ||||||
|  |    remote: https://github.com/bmabey/database_cleaner.git | ||||||
|  |    revision: f89c34300e114be99532f14c115b2799a3380ac6 | ||||||
|  |    ref: f89c34300e114be99532f14c115b2799a3380ac6 | ||||||
|  | @@ -6,6 +16,13 @@
 | ||||||
|  |      database_cleaner (0.9.1) | ||||||
|  |   | ||||||
|  |  GIT | ||||||
|  | +  remote: https://github.com/ISSIntel/charlock_holmes.git
 | ||||||
|  | +  revision: 994dcf37aba066250750866e13bb51e3d5e72898
 | ||||||
|  | +  ref: 994dcf37aba066250750866e13bb51e3d5e72898
 | ||||||
|  | +  specs:
 | ||||||
|  | +    charlock_holmes (0.6.9)
 | ||||||
|  | +
 | ||||||
|  | +GIT
 | ||||||
|  |    remote: https://github.com/ctran/annotate_models.git | ||||||
|  |    revision: be4e26825b521f0b2d86b181e2dff89901aa9b1e | ||||||
|  |    specs: | ||||||
|  | @@ -129,7 +146,6 @@
 | ||||||
|  |      carrierwave (0.7.1) | ||||||
|  |        activemodel (>= 3.2.0) | ||||||
|  |        activesupport (>= 3.2.0) | ||||||
|  | -    charlock_holmes (0.6.9)
 | ||||||
|  |      childprocess (0.3.6) | ||||||
|  |        ffi (~> 1.0, >= 1.0.6) | ||||||
|  |      chosen-rails (0.9.8) | ||||||
|  | @@ -147,6 +163,7 @@
 | ||||||
|  |      colorize (0.5.8) | ||||||
|  |      crack (0.3.1) | ||||||
|  |      daemons (1.1.9) | ||||||
|  | +    dalli (2.6.0)
 | ||||||
|  |      devise (2.1.2) | ||||||
|  |        bcrypt-ruby (~> 3.0) | ||||||
|  |        orm_adapter (~> 0.1) | ||||||
|  | @@ -190,10 +207,6 @@
 | ||||||
|  |        pygments.rb (>= 0.2.13) | ||||||
|  |      github-markup (0.7.4) | ||||||
|  |      gitlab_meta (4.0) | ||||||
|  | -    gitolite (1.1.0)
 | ||||||
|  | -      gratr19 (~> 0.4.4.1)
 | ||||||
|  | -      grit (~> 2.5.0)
 | ||||||
|  | -      hashery (~> 1.5.0)
 | ||||||
|  |      grape (0.2.2) | ||||||
|  |        activesupport | ||||||
|  |        hashie (~> 1.2) | ||||||
|  | @@ -461,9 +474,11 @@
 | ||||||
|  |    bootstrap-sass (= 2.2.1.1) | ||||||
|  |    capybara | ||||||
|  |    carrierwave (~> 0.7.1) | ||||||
|  | +  charlock_holmes!
 | ||||||
|  |    chosen-rails (= 0.9.8) | ||||||
|  |    coffee-rails (~> 3.2.2) | ||||||
|  |    colored | ||||||
|  | +  dalli
 | ||||||
|  |    database_cleaner! | ||||||
|  |    devise (~> 2.1.0) | ||||||
|  |    draper (~> 0.18.0) | ||||||
|  | @@ -477,7 +492,7 @@
 | ||||||
|  |    github-linguist (~> 2.3.4) | ||||||
|  |    github-markup (~> 0.7.4) | ||||||
|  |    gitlab_meta (= 4.0) | ||||||
|  | -  gitolite (= 1.1.0)
 | ||||||
|  | +  gitolite!
 | ||||||
|  |    grack! | ||||||
|  |    grape (~> 0.2.1) | ||||||
|  |    grit! | ||||||
							
								
								
									
										82
									
								
								www-apps/gitlabhq/files/gitlabhq-6.0.2-r2-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								www-apps/gitlabhq/files/gitlabhq-6.0.2-r2-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,82 @@ | ||||||
|  | --- a/Gemfile	2013-09-10 00:16:33.951426871 +0200
 | ||||||
|  | +++ b/Gemfile	2013-09-10 01:02:00.745109650 +0200
 | ||||||
|  | @@ -120,11 +120,14 @@
 | ||||||
|  |  # Sanitize user input | ||||||
|  |  gem "sanitize" | ||||||
|  |   | ||||||
|  | +# The newer revision of charlock_holmes that is finally fixed to 
 | ||||||
|  | +# be compatible with Gentoo
 | ||||||
|  | +gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
 | ||||||
|  | +
 | ||||||
|  |  group :assets do | ||||||
|  |    gem "sass-rails" | ||||||
|  |    gem "coffee-rails" | ||||||
|  |    gem "uglifier" | ||||||
|  | -  gem "therubyracer"
 | ||||||
|  |    gem 'turbolinks' | ||||||
|  |    gem 'jquery-turbolinks' | ||||||
|  |   | ||||||
|  | --- a/Gemfile.lock	2013-09-10 00:16:40.079441559 +0200
 | ||||||
|  | +++ b/Gemfile.lock	2013-09-10 01:03:51.837297421 +0200
 | ||||||
|  | @@ -1,4 +1,11 @@
 | ||||||
|  |  GIT | ||||||
|  | +  remote: https://github.com/brianmario/charlock_holmes.git
 | ||||||
|  | +  revision: dde194609b3513b0d2369ce8f916ae52566154b4
 | ||||||
|  | +  ref: dde194609b3513b0d2369ce8f916ae52566154b4
 | ||||||
|  | +  specs:
 | ||||||
|  | +    charlock_holmes (0.6.9.4)
 | ||||||
|  | +
 | ||||||
|  | +GIT
 | ||||||
|  |    remote: https://github.com/ctran/annotate_models.git | ||||||
|  |    revision: 18a4e2eb77c8f3ef695b563e4a7ca45dfede819b | ||||||
|  |    specs: | ||||||
|  | @@ -69,7 +76,6 @@
 | ||||||
|  |        activesupport (>= 3.2.0) | ||||||
|  |      celluloid (0.14.1) | ||||||
|  |        timers (>= 1.0.0) | ||||||
|  | -    charlock_holmes (0.6.9.4)
 | ||||||
|  |      childprocess (0.3.9) | ||||||
|  |        ffi (~> 1.0, >= 1.0.11) | ||||||
|  |      chosen-rails (1.0.0) | ||||||
|  | @@ -271,7 +277,6 @@
 | ||||||
|  |        addressable (~> 2.3) | ||||||
|  |      letter_opener (1.1.1) | ||||||
|  |        launchy (~> 2.2) | ||||||
|  | -    libv8 (3.11.8.17)
 | ||||||
|  |      listen (1.2.2) | ||||||
|  |        rb-fsevent (>= 0.9.3) | ||||||
|  |        rb-inotify (>= 0.9) | ||||||
|  | @@ -407,7 +412,6 @@
 | ||||||
|  |        redis-store (~> 1.1.0) | ||||||
|  |      redis-store (1.1.3) | ||||||
|  |        redis (>= 2.2.0) | ||||||
|  | -    ref (1.0.5)
 | ||||||
|  |      rest-client (1.6.7) | ||||||
|  |        mime-types (>= 1.16) | ||||||
|  |      rspec (2.13.0) | ||||||
|  | @@ -493,9 +497,6 @@
 | ||||||
|  |      stringex (1.5.1) | ||||||
|  |      temple (0.6.5) | ||||||
|  |      test_after_commit (0.2.0) | ||||||
|  | -    therubyracer (0.11.4)
 | ||||||
|  | -      libv8 (~> 3.11.8.12)
 | ||||||
|  | -      ref
 | ||||||
|  |      thin (1.5.1) | ||||||
|  |        daemons (>= 1.0.9) | ||||||
|  |        eventmachine (>= 0.12.6) | ||||||
|  | @@ -556,6 +557,7 @@
 | ||||||
|  |    bootstrap-sass | ||||||
|  |    capybara | ||||||
|  |    carrierwave | ||||||
|  | +  charlock_holmes!
 | ||||||
|  |    chosen-rails (= 1.0.0) | ||||||
|  |    coffee-rails | ||||||
|  |    colored | ||||||
|  | @@ -634,7 +636,6 @@
 | ||||||
|  |    stamp | ||||||
|  |    state_machine | ||||||
|  |    test_after_commit | ||||||
|  | -  therubyracer
 | ||||||
|  |    thin | ||||||
|  |    tinder (~> 1.9.2) | ||||||
|  |    turbolinks | ||||||
|  | @ -0,0 +1,32 @@ | ||||||
|  | diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
 | ||||||
|  | index b4be46d..2120f5a 100644
 | ||||||
|  | --- a/lib/gitlab/regex.rb
 | ||||||
|  | +++ b/lib/gitlab/regex.rb
 | ||||||
|  | @@ -1,3 +1,5 @@
 | ||||||
|  | +# encoding: utf-8
 | ||||||
|  | +
 | ||||||
|  |  module Gitlab | ||||||
|  |    module Regex | ||||||
|  |      extend self | ||||||
|  | @@ -7,7 +9,7 @@ module Gitlab
 | ||||||
|  |      end | ||||||
|  |   | ||||||
|  |      def project_name_regex | ||||||
|  | -      /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
 | ||||||
|  | +      /\A\p{Word}[\p{Word}\-:\. ]*\z/
 | ||||||
|  |      end | ||||||
|  |   | ||||||
|  |      def name_regex | ||||||
|  | diff --git a/app/models/project.rb b/app/models/project.rb
 | ||||||
|  | index d8fa6cb..c4e5427 100644
 | ||||||
|  | --- a/app/models/project.rb
 | ||||||
|  | +++ b/app/models/project.rb
 | ||||||
|  | @@ -73,7 +73,7 @@ class Project < ActiveRecord::Base
 | ||||||
|  |    validates :description, length: { within: 0..2000 } | ||||||
|  |    validates :name, presence: true, length: { within: 0..255 }, | ||||||
|  |              format: { with: Gitlab::Regex.project_name_regex, | ||||||
|  | -                      message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first" }
 | ||||||
|  | +                      message: "only letters, digits, spaces & '_' '-' '.' ':' allowed. Letter or digit should be first" }
 | ||||||
|  |    validates :path, presence: true, length: { within: 0..255 }, | ||||||
|  |              exclusion: { in: Gitlab::Blacklist.path }, | ||||||
|  |              format: { with: Gitlab::Regex.path_regex, | ||||||
|  | @ -0,0 +1,20 @@ | ||||||
|  | diff --git a/config/environments/production.rb b/gitlab-6/environments/production.rb
 | ||||||
|  | index 82eb250..10e25e5 100644
 | ||||||
|  | --- a/config/environments/production.rb
 | ||||||
|  | +++ b/config/environments/production.rb
 | ||||||
|  | @@ -73,11 +73,10 @@ Gitlab::Application.configure do
 | ||||||
|  |    # config.active_record.auto_explain_threshold_in_seconds = 0.5 | ||||||
|  |   | ||||||
|  |    config.action_mailer.delivery_method = :sendmail | ||||||
|  | -  # Defaults to:
 | ||||||
|  | -  # # config.action_mailer.sendmail_settings = {
 | ||||||
|  | -  # #   location: '/usr/sbin/sendmail',
 | ||||||
|  | -  # #   arguments: '-i -t'
 | ||||||
|  | -  # # }
 | ||||||
|  | +  config.action_mailer.sendmail_settings = {
 | ||||||
|  | +    location: '/usr/sbin/sendmail',
 | ||||||
|  | +    arguments: '-i'
 | ||||||
|  | +  }
 | ||||||
|  |    config.action_mailer.perform_deliveries = true | ||||||
|  |    config.action_mailer.raise_delivery_errors = true | ||||||
|  |  end | ||||||
|  | @ -0,0 +1,207 @@ | ||||||
|  | diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
 | ||||||
|  | index 59a4d1f..e48dfe7 100644
 | ||||||
|  | --- a/config/gitlab.yml.example
 | ||||||
|  | +++ b/config/gitlab.yml.example
 | ||||||
|  | @@ -103,6 +103,10 @@ production: &base
 | ||||||
|  |      bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' | ||||||
|  |      password: '_the_password_of_the_bind_user' | ||||||
|  |      allow_username_or_email_login: true | ||||||
|  | +    mapping:
 | ||||||
|  | +      name: 'cn'
 | ||||||
|  | +      username: 'uid'
 | ||||||
|  | +      email: 'mail'
 | ||||||
|  |   | ||||||
|  |    ## OmniAuth settings | ||||||
|  |    omniauth: | ||||||
|  | @@ -131,7 +135,14 @@ production: &base
 | ||||||
|  |        # - { name: 'github', app_id: 'YOUR APP ID', | ||||||
|  |        #     app_secret: 'YOUR APP SECRET' } | ||||||
|  |   | ||||||
|  | -
 | ||||||
|  | +  ## User Mapping Procs
 | ||||||
|  | +  # These procs allow for custom mapping of user information from LDAP / Omniauth
 | ||||||
|  | +  # onto your user model.
 | ||||||
|  | +  #
 | ||||||
|  | +  # user_mapping:
 | ||||||
|  | +  #  name: ->(auth) { auth.info.name.to_s }
 | ||||||
|  | +  #  username: ->(auth) { auth.info.email.to_s.downcase.match(/^[^@]*/)[0] }
 | ||||||
|  | +  #  email: ->(auth) { auth.info.email.to_s.downcase }
 | ||||||
|  |   | ||||||
|  |    # | ||||||
|  |    # 3. Advanced settings | ||||||
|  | diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
 | ||||||
|  | index e0207c6..c079cc4 100644
 | ||||||
|  | --- a/config/initializers/1_settings.rb
 | ||||||
|  | +++ b/config/initializers/1_settings.rb
 | ||||||
|  | @@ -36,6 +36,7 @@ end
 | ||||||
|  |   | ||||||
|  |  # Default settings | ||||||
|  |  Settings['ldap'] ||= Settingslogic.new({}) | ||||||
|  | +Settings.ldap['mapping'] ||= Settingslogic.new({})
 | ||||||
|  |  Settings.ldap['enabled'] = false if Settings.ldap['enabled'].nil? | ||||||
|  |  Settings.ldap['allow_username_or_email_login'] = false if Settings.ldap['allow_username_or_email_login'].nil? | ||||||
|  |   | ||||||
|  | diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
 | ||||||
|  | index de70c5c..bea8191 100644
 | ||||||
|  | --- a/lib/gitlab/auth.rb
 | ||||||
|  | +++ b/lib/gitlab/auth.rb
 | ||||||
|  | @@ -33,13 +33,14 @@ module Gitlab
 | ||||||
|  |      def create_from_omniauth(auth, ldap = false) | ||||||
|  |        provider = auth.provider | ||||||
|  |        uid = auth.info.uid || auth.uid | ||||||
|  | -      uid = uid.to_s.force_encoding("utf-8")
 | ||||||
|  | -      name = auth.info.name.to_s.force_encoding("utf-8")
 | ||||||
|  | -      email = auth.info.email.to_s.downcase unless auth.info.email.nil?
 | ||||||
|  | +      uid = uid.to_s.force_encoding('utf-8')
 | ||||||
|  | +      name = extract(:name, auth, ldap).force_encoding('utf-8')
 | ||||||
|  | +      username = extract(:username, auth, ldap).force_encoding('utf-8')
 | ||||||
|  | +      email = extract(:email, auth, ldap).force_encoding('utf-8')
 | ||||||
|  |   | ||||||
|  |        ldap_prefix = ldap ? '(LDAP) ' : '' | ||||||
|  |        raise OmniAuth::Error, "#{ldap_prefix}#{provider} does not provide an email"\ | ||||||
|  | -        " address" if auth.info.email.blank?
 | ||||||
|  | +        " address" if email.blank?
 | ||||||
|  |   | ||||||
|  |        log.info "#{ldap_prefix}Creating user from #{provider} login"\ | ||||||
|  |          " {uid => #{uid}, name => #{name}, email => #{email}}" | ||||||
|  | @@ -48,7 +49,7 @@ module Gitlab
 | ||||||
|  |          extern_uid: uid, | ||||||
|  |          provider: provider, | ||||||
|  |          name: name, | ||||||
|  | -        username: email.match(/^[^@]*/)[0],
 | ||||||
|  | +        username: username,
 | ||||||
|  |          email: email, | ||||||
|  |          password: password, | ||||||
|  |          password_confirmation: password, | ||||||
|  | @@ -101,5 +102,31 @@ module Gitlab
 | ||||||
|  |      def ldap_conf | ||||||
|  |        @ldap_conf ||= Gitlab.config.ldap | ||||||
|  |      end | ||||||
|  | +
 | ||||||
|  | +    private
 | ||||||
|  | +
 | ||||||
|  | +    def extract(field_name, auth, ldap = false)
 | ||||||
|  | +      @ldap_mapper ||= Gitlab.config.ldap.mapping rescue Hash.new
 | ||||||
|  | +      @mapper ||= begin
 | ||||||
|  | +        defaults = {
 | ||||||
|  | +          name: ->(auth) { auth.info.name.to_s },
 | ||||||
|  | +          username: ->(auth) { auth.info.email.to_s.downcase.match(/^[^@]*/)[0] },
 | ||||||
|  | +          email: ->(auth) { auth.info.email.to_s.downcase },
 | ||||||
|  | +        }
 | ||||||
|  | +        extras = Gitlab.config.user_mapping rescue Hash.new
 | ||||||
|  | +        defaults.merge(extras)
 | ||||||
|  | +      end
 | ||||||
|  | +
 | ||||||
|  | +      if ldap && !@ldap_mapper[field_name].nil?
 | ||||||
|  | +        begin
 | ||||||
|  | +          ldap_attr = @ldap_mapper[field_name].to_sym
 | ||||||
|  | +          Array(auth.extra.raw_info[ldap_attr])[0]
 | ||||||
|  | +        rescue
 | ||||||
|  | +          raise "(LDAP) Failed to get '#{@ldap_mapper[field_name]}' for #{field_name} for #{auth.info.uid}"
 | ||||||
|  | +        end
 | ||||||
|  | +      else
 | ||||||
|  | +        @mapper[field_name].call(auth)
 | ||||||
|  | +      end
 | ||||||
|  | +    end
 | ||||||
|  |    end | ||||||
|  |  end | ||||||
|  | diff --git a/spec/lib/auth_spec.rb b/spec/lib/auth_spec.rb
 | ||||||
|  | index 903d276..cf9e7b7 100644
 | ||||||
|  | --- a/spec/lib/auth_spec.rb
 | ||||||
|  | +++ b/spec/lib/auth_spec.rb
 | ||||||
|  | @@ -4,7 +4,7 @@ describe Gitlab::Auth do
 | ||||||
|  |    let(:gl_auth) { Gitlab::Auth.new } | ||||||
|  |   | ||||||
|  |    before do | ||||||
|  | -    Gitlab.config.stub(omniauth: {})
 | ||||||
|  | +    Gitlab.config.stub(omniauth: {}, ldap: {})
 | ||||||
|  |   | ||||||
|  |      @info = mock( | ||||||
|  |        uid: '12djsak321', | ||||||
|  | @@ -74,9 +74,22 @@ describe Gitlab::Auth do
 | ||||||
|  |    end | ||||||
|  |   | ||||||
|  |    describe :create_from_omniauth do | ||||||
|  | +    before do
 | ||||||
|  | +      @raw_info = {
 | ||||||
|  | +        cn: 'John Black',
 | ||||||
|  | +        mail: [ 'john.black@email.com' ],
 | ||||||
|  | +        nickname: 'jonny'
 | ||||||
|  | +      }
 | ||||||
|  | +
 | ||||||
|  | +      @ldap_auth = mock(
 | ||||||
|  | +        info: @info,
 | ||||||
|  | +        extra: mock(raw_info: @raw_info),
 | ||||||
|  | +        provider: 'ldap'
 | ||||||
|  | +      )
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  |      it "should create user from LDAP" do | ||||||
|  | -      @auth = mock(info: @info, provider: 'ldap')
 | ||||||
|  | -      user = gl_auth.create_from_omniauth(@auth, true)
 | ||||||
|  | +      user = gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  |   | ||||||
|  |        user.should be_valid | ||||||
|  |        user.extern_uid.should == @info.uid | ||||||
|  | @@ -92,9 +105,59 @@ describe Gitlab::Auth do
 | ||||||
|  |        user.provider.should == 'twitter' | ||||||
|  |      end | ||||||
|  |   | ||||||
|  | +    it "should still import without extra mapping" do
 | ||||||
|  | +      Gitlab.config.stub(omniauth: {})
 | ||||||
|  | +      user = gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  | +
 | ||||||
|  | +      user.should be_valid
 | ||||||
|  | +      user.extern_uid.should == @info.uid
 | ||||||
|  | +      user.provider.should == 'ldap'
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  | +    it "should have user details from procs" do
 | ||||||
|  | +      Gitlab.config.stub(omniauth: {}, user_mapping: {})
 | ||||||
|  | +      Gitlab.config.user_mapping[:name] = ->(auth) { 'TestName' }
 | ||||||
|  | +      Gitlab.config.user_mapping[:email] = ->(auth) { 'email@somewhere.com' }
 | ||||||
|  | +      Gitlab.config.user_mapping[:username] = ->(auth) { 'TestUsername' }
 | ||||||
|  | +
 | ||||||
|  | +      user = gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  | +      user.should be_valid
 | ||||||
|  | +      user.extern_uid.should == @info.uid
 | ||||||
|  | +      user.name.should == 'TestName'
 | ||||||
|  | +      user.email.should == 'email@somewhere.com'
 | ||||||
|  | +      user.username.should == 'TestUsername'
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  | +    it "should modify value using proc" do
 | ||||||
|  | +      Gitlab.config.stub(omniauth: {}, user_mapping: {})
 | ||||||
|  | +      Gitlab.config.user_mapping[:username] = ->(auth) { auth.info.email.to_s.downcase.split('@').first }
 | ||||||
|  | +
 | ||||||
|  | +      user = gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  | +      user.should be_valid
 | ||||||
|  | +      user.extern_uid.should == @info.uid
 | ||||||
|  | +      user.username.should == 'john'
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  | +    it "should be able to use raw ldap information through simple ldap mapping" do
 | ||||||
|  | +      Gitlab.config.ldap.stub(mapping: { name: 'cn', email: 'mail' })
 | ||||||
|  | +
 | ||||||
|  | +      user = gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  | +      user.should be_valid
 | ||||||
|  | +      user.extern_uid.should == @info.uid
 | ||||||
|  | +      user.name.should == 'John Black'
 | ||||||
|  | +      user.email.should == 'john.black@email.com'
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  | +    it "should raise an error if an invalid field is in ldap mapping" do
 | ||||||
|  | +      Gitlab.config.ldap.stub(mapping: { name: 'invalid' })
 | ||||||
|  | +
 | ||||||
|  | +      expect {
 | ||||||
|  | +        gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  | +      }.to raise_error
 | ||||||
|  | +    end
 | ||||||
|  | +
 | ||||||
|  |      it "should apply defaults to user" do | ||||||
|  | -      @auth = mock(info: @info, provider: 'ldap')
 | ||||||
|  | -      user = gl_auth.create_from_omniauth(@auth, true)
 | ||||||
|  | +      user = gl_auth.create_from_omniauth(@ldap_auth, true)
 | ||||||
|  |   | ||||||
|  |        user.should be_valid | ||||||
|  |        user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit | ||||||
							
								
								
									
										84
									
								
								www-apps/gitlabhq/files/gitlabhq-6.4.3-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								www-apps/gitlabhq/files/gitlabhq-6.4.3-fix-gemfile.patch
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,84 @@ | ||||||
|  | --- Gemfile.orig	2014-01-17 17:27:47.960000000 +0100
 | ||||||
|  | +++ Gemfile	2014-01-17 17:28:20.620000000 +0100
 | ||||||
|  | @@ -134,13 +134,16 @@
 | ||||||
|  |  # Sanitize user input | ||||||
|  |  gem "sanitize" | ||||||
|  |   | ||||||
|  | +# The newer revision of charlock_holmes that is finally fixed to
 | ||||||
|  | +# be compatible with Gentoo
 | ||||||
|  | +gem "charlock_holmes", git: "https://github.com/brianmario/charlock_holmes.git", ref: "dde194609b3513b0d2369ce8f916ae52566154b4"
 | ||||||
|  | +
 | ||||||
|  |  # Protect against bruteforcing | ||||||
|  |  gem "rack-attack" | ||||||
|  |   | ||||||
|  |  gem "sass-rails" | ||||||
|  |  gem "coffee-rails" | ||||||
|  |  gem "uglifier" | ||||||
|  | -gem "therubyracer"
 | ||||||
|  |  gem 'turbolinks' | ||||||
|  |  gem 'jquery-turbolinks' | ||||||
|  |   | ||||||
|  | --- Gemfile.lock.orig	2014-01-17 17:29:53.490000000 +0100
 | ||||||
|  | +++ Gemfile.lock	2014-01-17 17:33:01.660000000 +0100
 | ||||||
|  | @@ -1,4 +1,11 @@
 | ||||||
|  |  GIT | ||||||
|  | +  remote: https://github.com/brianmario/charlock_holmes.git
 | ||||||
|  | +  revision: dde194609b3513b0d2369ce8f916ae52566154b4
 | ||||||
|  | +  ref: dde194609b3513b0d2369ce8f916ae52566154b4
 | ||||||
|  | +  specs:
 | ||||||
|  | +    charlock_holmes (0.6.9.4)
 | ||||||
|  | +
 | ||||||
|  | +GIT
 | ||||||
|  |    remote: https://github.com/gitlabhq/gon.git | ||||||
|  |    revision: 58ca8e17273051cb370182cabd3602d1da6783ab | ||||||
|  |    ref: 58ca8e17273051cb370182cabd3602d1da6783ab | ||||||
|  | @@ -72,7 +79,6 @@
 | ||||||
|  |        json (>= 1.7) | ||||||
|  |      celluloid (0.15.2) | ||||||
|  |        timers (~> 1.1.0) | ||||||
|  | -    charlock_holmes (0.6.9.4)
 | ||||||
|  |      chosen-rails (1.0.1) | ||||||
|  |        coffee-rails (>= 3.2) | ||||||
|  |        compass-rails (>= 1.0) | ||||||
|  | @@ -278,7 +284,6 @@
 | ||||||
|  |        addressable (~> 2.3) | ||||||
|  |      letter_opener (1.1.2) | ||||||
|  |        launchy (~> 2.2) | ||||||
|  | -    libv8 (3.16.14.3)
 | ||||||
|  |      listen (2.3.1) | ||||||
|  |        celluloid (>= 0.15.2) | ||||||
|  |        rb-fsevent (>= 0.9.3) | ||||||
|  | @@ -412,7 +417,6 @@
 | ||||||
|  |        redis-store (~> 1.1.0) | ||||||
|  |      redis-store (1.1.4) | ||||||
|  |        redis (>= 2.2) | ||||||
|  | -    ref (1.0.5)
 | ||||||
|  |      require_all (1.3.2) | ||||||
|  |      rest-client (1.6.7) | ||||||
|  |        mime-types (>= 1.16) | ||||||
|  | @@ -499,9 +503,6 @@
 | ||||||
|  |      term-ansicolor (1.2.2) | ||||||
|  |        tins (~> 0.8) | ||||||
|  |      test_after_commit (0.2.2) | ||||||
|  | -    therubyracer (0.12.0)
 | ||||||
|  | -      libv8 (~> 3.16.14.0)
 | ||||||
|  | -      ref
 | ||||||
|  |      thin (1.6.1) | ||||||
|  |        daemons (>= 1.0.9) | ||||||
|  |        eventmachine (>= 1.0.0) | ||||||
|  | @@ -572,6 +573,7 @@
 | ||||||
|  |    bootstrap-sass (~> 2.3) | ||||||
|  |    capybara | ||||||
|  |    carrierwave | ||||||
|  | +  charlock_holmes!
 | ||||||
|  |    chosen-rails (= 1.0.1) | ||||||
|  |    coffee-rails | ||||||
|  |    colored | ||||||
|  | @@ -655,7 +657,6 @@
 | ||||||
|  |    stamp | ||||||
|  |    state_machine | ||||||
|  |    test_after_commit | ||||||
|  | -  therubyracer
 | ||||||
|  |    thin | ||||||
|  |    tinder (~> 1.9.2) | ||||||
|  |    turbolinks | ||||||
|  | @ -0,0 +1,28 @@ | ||||||
|  | --- lib/gitlab/regex.rb.orig	2013-12-23 19:43:59.000000000 +0100
 | ||||||
|  | +++ lib/gitlab/regex.rb	2014-01-17 17:43:00.020000000 +0100
 | ||||||
|  | @@ -1,3 +1,5 @@
 | ||||||
|  | +# encoding: utf-8
 | ||||||
|  | +
 | ||||||
|  |  module Gitlab | ||||||
|  |    module Regex | ||||||
|  |      extend self | ||||||
|  | @@ -7,7 +9,7 @@
 | ||||||
|  |      end | ||||||
|  |   | ||||||
|  |      def project_name_regex | ||||||
|  | -      /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
 | ||||||
|  | +      /\A\p{Word}[\p{Word}\-:\. ]*\z/
 | ||||||
|  |      end | ||||||
|  |   | ||||||
|  |      def name_regex | ||||||
|  | --- app/models/project.rb.orig	2014-01-17 17:40:02.050000000 +0100
 | ||||||
|  | +++ app/models/project.rb	2014-01-17 17:44:09.150000000 +0100
 | ||||||
|  | @@ -85,7 +85,7 @@
 | ||||||
|  |    validates :description, length: { maximum: 2000 }, allow_blank: true | ||||||
|  |    validates :name, presence: true, length: { within: 0..255 }, | ||||||
|  |              format: { with: Gitlab::Regex.project_name_regex, | ||||||
|  | -                      message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first" }
 | ||||||
|  | +                      message: "only letters, digits, spaces & '_' '-' '.' ':' allowed. Letter or digit should be first" }
 | ||||||
|  |    validates :path, presence: true, length: { within: 0..255 }, | ||||||
|  |              exclusion: { in: Gitlab::Blacklist.path }, | ||||||
|  |              format: { with: Gitlab::Regex.path_regex, | ||||||
|  | @ -0,0 +1,20 @@ | ||||||
|  | diff --git a/config/environments/production.rb b/gitlab-6/environments/production.rb
 | ||||||
|  | index 82eb250..10e25e5 100644
 | ||||||
|  | --- a/config/environments/production.rb
 | ||||||
|  | +++ b/config/environments/production.rb
 | ||||||
|  | @@ -73,11 +73,10 @@ Gitlab::Application.configure do
 | ||||||
|  |    # config.active_record.auto_explain_threshold_in_seconds = 0.5 | ||||||
|  |   | ||||||
|  |    config.action_mailer.delivery_method = :sendmail | ||||||
|  | -  # Defaults to:
 | ||||||
|  | -  # # config.action_mailer.sendmail_settings = {
 | ||||||
|  | -  # #   location: '/usr/sbin/sendmail',
 | ||||||
|  | -  # #   arguments: '-i -t'
 | ||||||
|  | -  # # }
 | ||||||
|  | +  config.action_mailer.sendmail_settings = {
 | ||||||
|  | +    location: '/usr/sbin/sendmail',
 | ||||||
|  | +    arguments: '-i'
 | ||||||
|  | +  }
 | ||||||
|  |    config.action_mailer.perform_deliveries = true | ||||||
|  |    config.action_mailer.raise_delivery_errors = true | ||||||
|  |  end | ||||||
							
								
								
									
										363
									
								
								www-apps/gitlabhq/gitlabhq-6.4.3.ebuild
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										363
									
								
								www-apps/gitlabhq/gitlabhq-6.4.3.ebuild
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,363 @@ | ||||||
|  | # Copyright 1999-2013 Gentoo Foundation | ||||||
|  | # Distributed under the terms of the GNU General Public License v2 | ||||||
|  | # $Header: $ | ||||||
|  | 
 | ||||||
|  | EAPI="5" | ||||||
|  | 
 | ||||||
|  | # Mainteiner notes: | ||||||
|  | # - This ebuild uses Bundler to download and install all gems in deployment mode | ||||||
|  | #   (i.e. into isolated directory inside application). That's not Gentoo way how | ||||||
|  | #   it should be done, but GitLab has too many dependencies that it will be too | ||||||
|  | #   difficult to maintain them via ebuilds. | ||||||
|  | # | ||||||
|  | 
 | ||||||
|  | USE_RUBY="ruby19 ruby20" | ||||||
|  | PYTHON_DEPEND="2:2.7" | ||||||
|  | 
 | ||||||
|  | inherit eutils python ruby-ng | ||||||
|  | 
 | ||||||
|  | DESCRIPTION="GitLab is a free project and repository management application" | ||||||
|  | HOMEPAGE="https://github.com/gitlabhq/gitlabhq" | ||||||
|  | SRC_URI="https://github.com/gitlabhq/gitlabhq/archive/v${PV}.tar.gz -> ${P}.tar.gz" | ||||||
|  | 
 | ||||||
|  | RESTRICT="mirror" | ||||||
|  | 
 | ||||||
|  | LICENSE="MIT" | ||||||
|  | SLOT="6" | ||||||
|  | KEYWORDS="~amd64 ~x86" | ||||||
|  | IUSE="mysql +postgres +unicorn" | ||||||
|  | 
 | ||||||
|  | ## Gems dependencies: | ||||||
|  | #   charlock_holmes		dev-libs/icu | ||||||
|  | #	grape, capybara		dev-libs/libxml2, dev-libs/libxslt | ||||||
|  | #   json				dev-util/ragel | ||||||
|  | #   pygments.rb			python 2.7+ | ||||||
|  | #   execjs				net-libs/nodejs, or any other JS runtime | ||||||
|  | #   pg					dev-db/postgresql-base | ||||||
|  | #   mysql				virtual/mysql | ||||||
|  | # | ||||||
|  | GEMS_DEPEND=" | ||||||
|  | 	dev-libs/icu | ||||||
|  | 	dev-libs/libxml2 | ||||||
|  | 	dev-libs/libxslt | ||||||
|  | 	dev-util/ragel | ||||||
|  | 	net-libs/nodejs | ||||||
|  | 	postgres? ( dev-db/postgresql-base ) | ||||||
|  | 	mysql? ( virtual/mysql )" | ||||||
|  | DEPEND="${GEMS_DEPEND} | ||||||
|  | 	>=dev-vcs/gitlab-shell-1.8 | ||||||
|  | 	dev-vcs/git" | ||||||
|  | RDEPEND="${DEPEND} | ||||||
|  | 	dev-db/redis | ||||||
|  | 	virtual/mta" | ||||||
|  | ruby_add_bdepend " | ||||||
|  | 	virtual/rubygems | ||||||
|  | 	>=dev-ruby/bundler-1.0" | ||||||
|  | 
 | ||||||
|  | # | ||||||
|  | # fix-gemfile: | ||||||
|  | #     Remove therubyracer that doesn't compile well on Gentoo (we're using | ||||||
|  | #     nodejs instead that is faster and better). Also replace broken | ||||||
|  | #     charlock_holmes version with fixed one. | ||||||
|  | # | ||||||
|  | # fix-project-name-regex: | ||||||
|  | #     Allow project name to contain non-ASCII characters. | ||||||
|  | # | ||||||
|  | # fix-sendmail-config: | ||||||
|  | #     Fix default settings to work with ssmtp that doesn't know '-t' argument. | ||||||
|  | # | ||||||
|  | # ldap-user-mapping: | ||||||
|  | #     Updated and fixed patch from https://github.com/gitlabhq/gitlabhq/pull/3646. | ||||||
|  | # | ||||||
|  | RUBY_PATCHES=( | ||||||
|  | 	"${P}-fix-gemfile.patch" | ||||||
|  | 	"${P}-fix-project-name-regex.patch" | ||||||
|  | 	"${P}-fix-sendmail-config.patch" | ||||||
|  | #	"${P}-ldap-user-mapping.patch" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | MY_NAME="gitlab" | ||||||
|  | MY_USER="git"    # should be same as in gitlab-shell | ||||||
|  | 
 | ||||||
|  | DEST_DIR="/opt/${MY_NAME}-${SLOT}" | ||||||
|  | CONF_DIR="/etc/${MY_NAME}-${SLOT}" | ||||||
|  | LOGS_DIR="/var/log/${MY_NAME}" | ||||||
|  | TEMP_DIR="/var/tmp/${MY_NAME}" | ||||||
|  | 
 | ||||||
|  | # When updating ebuild to newer version, check list of the queues in | ||||||
|  | # https://github.com/gitlabhq/gitlabhq/blob/${PV}/lib/tasks/sidekiq.rake | ||||||
|  | SIDEKIQ_QUEUES="post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default" | ||||||
|  | 
 | ||||||
|  | all_ruby_prepare() { | ||||||
|  | 
 | ||||||
|  | 	# fix paths | ||||||
|  | 	local satellites_path="${TEMP_DIR}/repo_satellites" | ||||||
|  | 	local repos_path=/var/lib/git/repositories | ||||||
|  | 	local hooks_path=/usr/share/gitlab-shell/hooks | ||||||
|  | 	sed -i -E \ | ||||||
|  | 		-e "/satellites:$/,/\w:$/   s|(\s*path:\s).*|\1${satellites_path}/|" \ | ||||||
|  | 		-e "/gitlab_shell:$/,/\w:$/ s|(\s*repos_path:\s).*|\1${repos_path}/|" \ | ||||||
|  | 		-e "/gitlab_shell:$/,/\w:$/ s|(\s*hooks_path:\s).*|\1${hooks_path}/|" \ | ||||||
|  | 		config/gitlab.yml.example || die "failed to filter gitlab.yml.example" | ||||||
|  | 	 | ||||||
|  | 	local run_path=/run/${MY_NAME} | ||||||
|  | 	sed -i -E \ | ||||||
|  | 		-e "s|/home/git/gitlab/tmp/(pids\|sockets)|${run_path}|" \ | ||||||
|  | 		-e "s|/home/git/gitlab/log|${LOGS_DIR}|" \ | ||||||
|  | 		-e "s|/home/git/gitlab|${DEST_DIR}|" \ | ||||||
|  | 		config/unicorn.rb.example || die "failed to filter unicorn.rb.example" | ||||||
|  | 	 | ||||||
|  | 	sed -i \ | ||||||
|  | 		-e "s|/home/git/gitlab/tmp/sockets|${run_path}|" \ | ||||||
|  | 		lib/support/nginx/gitlab || die "failed to filter nginx/gitlab" | ||||||
|  | 	 | ||||||
|  | 	# modify default database settings for PostgreSQL | ||||||
|  | 	sed -i -E \ | ||||||
|  | 		-e 's|(username:).*|\1 gitlab|' \ | ||||||
|  | 		-e 's|(password:).*|\1 gitlab|' \ | ||||||
|  | 		-e 's|(socket:).*|/run/postgresql/.s.PGSQL.5432|' \ | ||||||
|  | 		config/database.yml.postgresql \ | ||||||
|  | 		|| die "failed to filter database.yml.postgresql" | ||||||
|  | 
 | ||||||
|  | 	# rename config files | ||||||
|  | 	mv config/gitlab.yml.example config/gitlab.yml | ||||||
|  | 	mv config/unicorn.rb.example config/unicorn.rb | ||||||
|  | 
 | ||||||
|  | 	local dbconf=config/database.yml | ||||||
|  | 	if use postgres && ! use mysql; then | ||||||
|  | 		mv ${dbconf}.postgresql ${dbconf} | ||||||
|  | 		rm ${dbconf}.mysql | ||||||
|  | 	elif use mysql && ! use postgres; then | ||||||
|  | 		mv ${dbconf}.mysql ${dbconf} | ||||||
|  | 		rm ${dbconf}.postgresql | ||||||
|  | 	fi | ||||||
|  | 	 | ||||||
|  | 	# remove zzet's stupid migration which expetcs that users are so foolish | ||||||
|  | 	# to run GitLab with PostgreSQL's superuser... | ||||||
|  | 	rm db/migrate/20121009205010_postgres_create_integer_cast.rb | ||||||
|  | 
 | ||||||
|  | 	# remove useless files | ||||||
|  | 	rm -r lib/support/{deploy,init.d} | ||||||
|  | 	use unicorn || rm config/unicorn.rb | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | all_ruby_install() { | ||||||
|  | 	local dest=${DEST_DIR} | ||||||
|  | 	local conf=${CONF_DIR} | ||||||
|  | 	local logs=${LOGS_DIR} | ||||||
|  | 	local temp=${TEMP_DIR} | ||||||
|  | 
 | ||||||
|  | 	# prepare directories | ||||||
|  | 	diropts -m750 | ||||||
|  | 	dodir ${logs} ${temp} ${temp}/repo_satellites | ||||||
|  | 
 | ||||||
|  | 	diropts -m755 | ||||||
|  | 	dodir ${conf} ${dest}/public/uploads | ||||||
|  | 
 | ||||||
|  | 	dosym ${temp} ${dest}/tmp | ||||||
|  | 	dosym ${logs} ${dest}/log | ||||||
|  | 
 | ||||||
|  | 	# install configs | ||||||
|  | 	insinto ${conf} | ||||||
|  | 	doins -r config/* | ||||||
|  | 	dosym ${conf} ${dest}/config | ||||||
|  | 
 | ||||||
|  | 	echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile" | ||||||
|  | 
 | ||||||
|  | 	# remove needless dirs | ||||||
|  | 	rm -Rf config tmp log | ||||||
|  | 
 | ||||||
|  | 	# install the rest files | ||||||
|  | 	insinto ${dest} | ||||||
|  | 	doins -r ./ | ||||||
|  | 
 | ||||||
|  | 	# install logrotate config | ||||||
|  | 	dodir /etc/logrotate.d | ||||||
|  | 	cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF | ||||||
|  | 		${logs}/*.log { | ||||||
|  | 		    missingok | ||||||
|  | 		    delaycompress | ||||||
|  | 		    compress | ||||||
|  | 		    copytruncate | ||||||
|  | 		} | ||||||
|  | 	EOF | ||||||
|  | 
 | ||||||
|  | 	## Install gems via bundler ## | ||||||
|  | 
 | ||||||
|  | 	cd "${D}/${dest}" | ||||||
|  | 
 | ||||||
|  | 	local without="development test aws" | ||||||
|  | 	local flag; for flag in mysql postgres unicorn; do | ||||||
|  | 		without+="$(use $flag || echo ' '$flag)" | ||||||
|  | 	done | ||||||
|  | 	local bundle_args="--deployment ${without:+--without ${without}}" | ||||||
|  | 
 | ||||||
|  | 	einfo "Running bundle install ${bundle_args} ..." | ||||||
|  | 	${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed" | ||||||
|  | 
 | ||||||
|  | 	# clean gems cache | ||||||
|  | 	rm -Rf vendor/bundle/ruby/*/cache | ||||||
|  | 
 | ||||||
|  | 	# fix permissions | ||||||
|  | 	fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs} | ||||||
|  | 	fperms +x script/{rails,check} | ||||||
|  | 
 | ||||||
|  | 	## RC script ## | ||||||
|  | 
 | ||||||
|  | 	local rcscript=gitlab-sidekiq.init | ||||||
|  | 	use unicorn && rcscript=gitlab-unicorn-6.init | ||||||
|  | 
 | ||||||
|  | 	cp "${FILESDIR}/${rcscript}" "${T}" || die | ||||||
|  | 	sed -i \ | ||||||
|  | 		-e "s|@USER@|${MY_USER}|" \ | ||||||
|  | 		-e "s|@SLOT@|${SLOT}|" \ | ||||||
|  | 		-e "s|@GITLAB_BASE@|${dest}|" \ | ||||||
|  | 		-e "s|@LOGS_DIR@|${logs}|" \ | ||||||
|  | 		-e "s|@QUEUES@|${SIDEKIQ_QUEUES}|" \ | ||||||
|  | 		"${T}/${rcscript}" \ | ||||||
|  | 		|| die "failed to filter ${rcscript}" | ||||||
|  | 
 | ||||||
|  | 	newinitd "${T}/${rcscript}" "${MY_NAME}-${SLOT}" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | pkg_postinst() { | ||||||
|  | 	elog | ||||||
|  | 	elog "1. Configure your GitLab's settings in ${CONF_DIR}/gitlab.yml." | ||||||
|  | 	elog | ||||||
|  | 	elog "2. Configure your database settings in ${CONF_DIR}/database.yml" | ||||||
|  | 	elog "   for \"production\" environment." | ||||||
|  | 	elog | ||||||
|  | 	elog "3. Then you should create database for your GitLab instance, if you" | ||||||
|  | 	elog "haven't it already." | ||||||
|  | 	elog | ||||||
|  | 	if use postgres; then | ||||||
|  |         elog   "If you have local PostgreSQL running, just copy&run:" | ||||||
|  |         elog "      su postgres" | ||||||
|  |         elog "      psql -c \"CREATE ROLE gitlab PASSWORD 'gitlab' \\" | ||||||
|  |         elog "          NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\"" | ||||||
|  |         elog "      createdb -E UTF-8 -O gitlab gitlabhq_production" | ||||||
|  | 		elog "  Note: You should change your password to something more random..." | ||||||
|  | 		elog | ||||||
|  | 	fi | ||||||
|  | 	elog "4. Finally execute the following command to initlize environment:" | ||||||
|  | 	elog "       emerge --config \"=${CATEGORY}/${PF}\"" | ||||||
|  | 	elog "   Note: Do not forget to start Redis server first!" | ||||||
|  | 	elog | ||||||
|  | 	elog "If this is an update from previous version, it's HIGHLY recommended" | ||||||
|  | 	elog "to backup your database before running the config phase!" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | pkg_config() { | ||||||
|  | 	local shell_conf='/etc/gitlab-shell.yml' | ||||||
|  | 
 | ||||||
|  | 	einfo "Checking configuration files" | ||||||
|  | 
 | ||||||
|  | 	if [ ! -r "${CONF_DIR}/database.yml" ]; then | ||||||
|  | 		eerror "Copy ${CONF_DIR}/database.yml.* to" | ||||||
|  | 		eerror "${CONF_DIR}/database.yml and edit this file in order to configure your"  | ||||||
|  | 		eerror "database settings for \"production\" environment."; die | ||||||
|  | 	fi | ||||||
|  | 
 | ||||||
|  | 	# check gitlab-shell configuration | ||||||
|  | 	if [ -r ${shell_conf} ]; then | ||||||
|  | 		local shell_repos_path="$(ryaml ${shell_conf} repos_path)" | ||||||
|  | 		local gitlab_repos_path="$(ryaml ${CONF_DIR}/gitlab.yml \ | ||||||
|  | 			production gitlab_shell repos_path)" | ||||||
|  | 
 | ||||||
|  | 		if [ ! "${shell_repos_path}" -ef "${gitlab_repos_path}" ]; then | ||||||
|  | 			eerror "repos_path in ${CONF_DIR}/gitlab.yml and ${shell_conf}" | ||||||
|  | 			eerror "must points to the same location! Fix the repos_path location and" | ||||||
|  | 			eerror "run this again."; die | ||||||
|  | 		fi | ||||||
|  | 	else | ||||||
|  | 		ewarn "GitLab Shell checks skipped, could not find config file at" | ||||||
|  | 		ewarn "${shell_conf}. Make sure that you have gitlab-shell properly" | ||||||
|  | 		ewarn "installed and that repos_path is the same as in GitLab." | ||||||
|  | 	fi | ||||||
|  | 
 | ||||||
|  | 	local email_from="$(ryaml ${CONF_DIR}/gitlab.yml production gitlab email_from)" | ||||||
|  | 	local git_home=$(getent passwd ${MY_USER} | cut -d: -f6) | ||||||
|  | 	 | ||||||
|  | 	# configure Git global settings | ||||||
|  | 	if [ ! -e "${git_home}/.gitconfig" ]; then | ||||||
|  | 		einfo "Setting git user" | ||||||
|  | 		su -l ${MY_USER} -c " | ||||||
|  | 			git config --global user.email '${email_from}'; | ||||||
|  | 			git config --global user.name 'GitLab'" \ | ||||||
|  | 			|| die "failed to setup git name and email" | ||||||
|  | 	fi | ||||||
|  | 
 | ||||||
|  | 	if [ ! -d "${DEST_DIR}/.git" ]; then | ||||||
|  | 		# create dummy git repo as workaround for | ||||||
|  | 		# https://github.com/bundler/bundler/issues/2039 | ||||||
|  | 		einfo "Initializing dummy git repository to avoid false errors from bundler" | ||||||
|  | 		su -l ${MY_USER} -c " | ||||||
|  | 			cd ${DEST_DIR} | ||||||
|  | 			git init | ||||||
|  | 			git add README.md | ||||||
|  | 			git commit -m 'Dummy repository'" >/dev/null | ||||||
|  | 	fi | ||||||
|  | 
 | ||||||
|  | 	## Initialize app ## | ||||||
|  | 
 | ||||||
|  | 	local RAILS_ENV="production" | ||||||
|  | 	local RUBY=${RUBY:-/usr/bin/ruby} | ||||||
|  | 	local BUNDLE="${RUBY} /usr/bin/bundle" | ||||||
|  | 
 | ||||||
|  | 	local dbname="$(ryaml ${CONF_DIR}/database.yml production database)" | ||||||
|  | 
 | ||||||
|  | 	local update= | ||||||
|  | 	while [ ! -n "${update}" ] ; do | ||||||
|  | 		echo | ||||||
|  | 		echo "   Is this an update from previous version (fresh install otherwise)? (y/n)" | ||||||
|  | 		read answer | ||||||
|  | 		if [[ ${answer} =~ ^[Yy]([Ee][Ss])?$ ]]; then | ||||||
|  | 			update=true | ||||||
|  | 		elif [[ ${answer} =~ ^[Nn]([Oo])?$ ]]; then | ||||||
|  | 			update=false | ||||||
|  | 		else | ||||||
|  | 			echo "Answer not recognized" | ||||||
|  | 		fi | ||||||
|  | 	done | ||||||
|  | 
 | ||||||
|  | 	if [ "${update}" = 'true' ]; then | ||||||
|  | 		einfo "Migrating database ..." | ||||||
|  | 		exec_rake db:migrate | ||||||
|  | 
 | ||||||
|  | 		einfo "Cleaning old precompiled assets ..." | ||||||
|  | 		exec_rake assets:clean | ||||||
|  | 
 | ||||||
|  | 		einfo "Cleaning cache ..." | ||||||
|  | 		exec_rake cache:clear | ||||||
|  | 	else | ||||||
|  | 		einfo "Initializing database ..." | ||||||
|  | 		exec_rake gitlab:setup | ||||||
|  | 	fi | ||||||
|  | 	 | ||||||
|  | 	einfo "Precompiling assests ..." | ||||||
|  | 	exec_rake assets:precompile:all | ||||||
|  | 	 | ||||||
|  | 	if [ "${update}" = 'true' ]; then | ||||||
|  | 		ewarn | ||||||
|  | 		ewarn "This configuration script runs only common migration tasks." | ||||||
|  | 		ewarn "Please read guides on" | ||||||
|  | 		ewarn "    https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/" | ||||||
|  | 		ewarn "for any additional migration tasks specific to your previous GitLab" | ||||||
|  | 		ewarn "version." | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ryaml() { | ||||||
|  | 	ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | exec_rake() { | ||||||
|  | 	local command="${BUNDLE} exec rake $@ RAILS_ENV=${RAILS_ENV}" | ||||||
|  | 
 | ||||||
|  | 	echo "   ${command}" | ||||||
|  | 	su -l ${MY_USER} -c " | ||||||
|  | 		export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8 | ||||||
|  | 		cd ${DEST_DIR} | ||||||
|  | 		${command}" \ | ||||||
|  | 		|| die "failed to run rake $@" | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue