diff --git a/.gitignore b/.gitignore index 94a210b9461..b1f4229925a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,10 @@ config/gitlab.yml config/database.yml config/initializers/omniauth.rb config/unicorn.rb +config/resque.yml db/data.yml .idea .DS_Store .chef vendor/bundle/* +rails_best_practices_output.html diff --git a/.simplecov b/.simplecov new file mode 100644 index 00000000000..d979288df44 --- /dev/null +++ b/.simplecov @@ -0,0 +1,4 @@ +# .simplecov +SimpleCov.start 'rails' do + merge_timeout 3600 +end diff --git a/.travis.yml b/.travis.yml index ad00ded07cb..e8bd744267f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,16 +3,12 @@ env: - DB=mysql before_install: - sudo apt-get install libicu-dev -y - - wget -P /tmp http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-i686.tar.bz2 - - tar -xf /tmp/phantomjs-1.7.0-linux-i686.tar.bz2 -C /tmp/ - - sudo rm -rf /usr/local/phantomjs - - sudo mv /tmp/phantomjs-1.7.0-linux-i686 /usr/local/phantomjs - gem install charlock_holmes -v="0.6.9" branches: only: - 'master' rvm: - - 1.9.3 + - 1.9.2 services: - mysql - postgresql diff --git a/CHANGELOG b/CHANGELOG index 95ed6e8db1c..dda12bd11de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,7 @@ v 4.0.0 + - Remove project code and path from API. Use id instead + - Return valid clonable url to repo for web hook + - Fixed backup issue - Reorganized settings - Fixed commits compare - Refactored scss diff --git a/Gemfile b/Gemfile index 49fbcad04fc..77b054465d0 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ def linux_only(require_as) RUBY_PLATFORM.include?('linux') && require_as end -gem "rails", "3.2.9" +gem "rails", "3.2.11" # Supported DBs gem "mysql2", group: :mysql @@ -23,11 +23,15 @@ gem 'omniauth-github' # GITLAB patched libs gem "grit", git: "https://github.com/gitlabhq/grit.git", ref: '7f35cb98ff17d534a07e3ce6ec3d580f67402837' -gem "omniauth-ldap", git: "https://github.com/gitlabhq/omniauth-ldap.git", ref: 'f038dd852d7bd473a557e385d5d7c2fd5dc1dc2e' -gem 'yaml_db', git: "https://github.com/gitlabhq/yaml_db.git", ref: '98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd' gem 'grack', git: "https://github.com/gitlabhq/grack.git", ref: 'ba46f3b0845c6a09d488ae6abdce6ede37e227e8' gem 'grit_ext', git: "https://github.com/gitlabhq/grit_ext.git", ref: '8e6afc2da821354774aa4d1ee8a1aa2082f84a3e' +# LDAP Auth +gem 'gitlab_omniauth-ldap', '1.0.2', require: "omniauth-ldap" + +# Dump db to yml file. Mostly used to migrate from sqlite to mysql +gem 'gitlab_yaml_db', '1.0.0', require: "yaml_db" + # Gitolite client (for work with gitolite-admin repo) gem "gitolite", '1.1.0' @@ -77,8 +81,9 @@ gem "acts-as-taggable-on", "2.3.3" gem "draper", "~> 0.18.0" # Background jobs -gem "resque", "~> 1.23.0" -gem 'resque_mailer' +gem 'slim' +gem 'sinatra', :require => nil +gem 'sidekiq', '2.6.4' # HTTP requests gem "httparty" @@ -104,7 +109,7 @@ group :assets do gem "jquery-rails", "2.1.3" gem "jquery-ui-rails", "2.0.2" gem "modernizr", "2.6.2" - gem "raphael-rails", "1.5.2" + gem "raphael-rails", git: "https://github.com/gitlabhq/raphael-rails.git" gem 'bootstrap-sass', "2.2.1.1" gem "font-awesome-sass-rails", "~> 2.0.0" gem "gemoji", "~> 1.2.1", require: 'emoji/railtie' @@ -115,6 +120,14 @@ group :development do gem "letter_opener" gem 'quiet_assets', '~> 1.0.1' gem 'rack-mini-profiler' + # Better errors handler + gem 'better_errors' + gem 'binding_of_caller' + + gem 'rails_best_practices' + + # Docs generator + gem "sdoc" end group :development, :test do @@ -145,7 +158,6 @@ group :test do gem "simplecov", require: false gem "shoulda-matchers", "1.3.0" gem 'email_spec' - gem 'resque_spec' gem "webmock" gem 'test_after_commit' end diff --git a/Gemfile.lock b/Gemfile.lock index d8be14ba80a..8fba310d4eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,17 +39,6 @@ GIT grit_ext (0.6.1) charlock_holmes (~> 0.6.9) -GIT - remote: https://github.com/gitlabhq/omniauth-ldap.git - revision: f038dd852d7bd473a557e385d5d7c2fd5dc1dc2e - ref: f038dd852d7bd473a557e385d5d7c2fd5dc1dc2e - specs: - omniauth-ldap (1.0.2) - net-ldap (~> 0.2.2) - omniauth (~> 1.0) - pyu-ruby-sasl (~> 0.0.3.1) - rubyntlm (~> 0.1.1) - GIT remote: https://github.com/gitlabhq/pygments.rb.git revision: db1da0343adf86b49bdc3add04d02d2e80438d38 @@ -60,11 +49,10 @@ GIT yajl-ruby (~> 1.1.0) GIT - remote: https://github.com/gitlabhq/yaml_db.git - revision: 98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd - ref: 98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd + remote: https://github.com/gitlabhq/raphael-rails.git + revision: cb2c92a040b9b941a5f1aa1ea866cc26e944fe58 specs: - yaml_db (0.2.2) + raphael-rails (2.1.0) GIT remote: https://github.com/jonleighton/poltergeist.git @@ -81,12 +69,12 @@ GIT GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.9) - actionpack (= 3.2.9) + actionmailer (3.2.11) + actionpack (= 3.2.11) mail (~> 2.4.4) - actionpack (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) + actionpack (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -94,18 +82,18 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.9) - activesupport (= 3.2.9) + activemodel (3.2.11) + activesupport (= 3.2.11) builder (~> 3.0.0) - activerecord (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) + activerecord (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.9) - activemodel (= 3.2.9) - activesupport (= 3.2.9) - activesupport (3.2.9) + activeresource (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) + activesupport (3.2.11) i18n (~> 0.6) multi_json (~> 1.0) acts-as-taggable-on (2.3.3) @@ -115,6 +103,10 @@ GEM awesome_print (1.1.0) backports (2.6.5) bcrypt-ruby (3.0.1) + better_errors (0.3.2) + coderay (>= 1.0.0) + erubis (>= 2.7.0) + binding_of_caller (0.6.8) blankslate (3.1.2) bootstrap-sass (2.2.1.1) sass (~> 3.2) @@ -129,12 +121,17 @@ GEM carrierwave (0.7.1) activemodel (>= 3.2.0) activesupport (>= 3.2.0) + celluloid (0.12.4) + facter (>= 1.6.12) + timers (>= 1.0.0) charlock_holmes (0.6.9) childprocess (0.3.6) ffi (~> 1.0, >= 1.0.6) chosen-rails (0.9.8) railties (~> 3.0) thor (~> 0.14) + code_analyzer (0.3.1) + sexp_processor coderay (1.0.8) coffee-rails (3.2.2) coffee-script (>= 2.2.0) @@ -145,6 +142,7 @@ GEM coffee-script-source (1.4.0) colored (1.2) colorize (0.5.8) + connection_pool (1.0.0) crack (0.3.1) daemons (1.1.9) devise (2.1.2) @@ -164,6 +162,7 @@ GEM eventmachine (1.0.0) execjs (1.4.0) multi_json (~> 1.0) + facter (1.6.17) factory_girl (4.1.0) activesupport (>= 3.0.0) factory_girl_rails (4.1.0) @@ -190,6 +189,12 @@ GEM pygments.rb (>= 0.2.13) github-markup (0.7.4) gitlab_meta (4.0) + gitlab_omniauth-ldap (1.0.2) + net-ldap (~> 0.2.2) + omniauth (~> 1.0) + pyu-ruby-sasl (~> 0.0.3.1) + rubyntlm (~> 0.1.1) + gitlab_yaml_db (1.0.0) gitolite (1.1.0) gratr19 (~> 0.4.4.1) grit (~> 2.5.0) @@ -240,7 +245,7 @@ GEM jquery-ui-rails (2.0.2) jquery-rails railties (>= 3.1.0) - json (1.7.5) + json (1.7.6) jwt (0.1.5) multi_json (>= 1.0) kaminari (0.14.1) @@ -264,7 +269,7 @@ GEM mime-types (1.19) modernizr (2.6.2) sprockets (~> 2.0) - multi_json (1.3.7) + multi_json (1.5.0) multi_xml (0.5.1) multipart-post (1.1.5) mysql2 (0.3.11) @@ -299,6 +304,7 @@ GEM pg (0.14.1) polyglot (0.3.3) posix-spawn (0.3.6) + progressbar (0.12.0) pry (0.9.10) coderay (~> 1.0.5) method_source (~> 0.8) @@ -306,7 +312,7 @@ GEM pyu-ruby-sasl (0.0.3.3) quiet_assets (1.0.1) railties (~> 3.1) - rack (1.4.1) + rack (1.4.3) rack-accept (0.4.5) rack (>= 0.4) rack-cache (1.2) @@ -315,33 +321,40 @@ GEM rack (>= 1.1.3) rack-mount (0.8.3) rack (>= 1.0.0) - rack-protection (1.2.0) + rack-protection (1.3.2) rack rack-ssl (1.3.2) rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.9) - actionmailer (= 3.2.9) - actionpack (= 3.2.9) - activerecord (= 3.2.9) - activeresource (= 3.2.9) - activesupport (= 3.2.9) + rails (3.2.11) + actionmailer (= 3.2.11) + actionpack (= 3.2.11) + activerecord (= 3.2.11) + activeresource (= 3.2.11) + activesupport (= 3.2.11) bundler (~> 1.0) - railties (= 3.2.9) + railties (= 3.2.11) rails-dev-tweaks (0.6.1) actionpack (~> 3.1) railties (~> 3.1) - railties (3.2.9) - actionpack (= 3.2.9) - activesupport (= 3.2.9) + rails_best_practices (1.13.2) + activesupport + awesome_print + code_analyzer + colored + erubis + i18n + progressbar + railties (3.2.11) + actionpack (= 3.2.11) + activesupport (= 3.2.11) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.10.0) - rake (10.0.1) - raphael-rails (1.5.2) + rake (10.0.3) rb-fsevent (0.9.2) rb-inotify (0.8.8) ffi (>= 0.5.0) @@ -351,16 +364,6 @@ GEM redis (3.0.2) redis-namespace (1.2.1) redis (~> 3.0.0) - resque (1.23.0) - multi_json (~> 1.0) - redis-namespace (~> 1.0) - sinatra (>= 0.9.2) - vegas (~> 0.1.2) - resque_mailer (2.1.0) - actionmailer (~> 3.0) - resque_spec (0.12.5) - resque (>= 1.19.0) - rspec (>= 2.5.0) rspec (2.12.0) rspec-core (~> 2.12.0) rspec-expectations (~> 2.12.0) @@ -383,6 +386,9 @@ GEM railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) + sdoc (0.3.20) + json (>= 1.1.3) + rdoc (~> 3.10) seed-fu (2.2.0) activerecord (~> 3.1) activesupport (~> 3.1) @@ -392,8 +398,15 @@ GEM multi_json (~> 1.0) rubyzip settingslogic (2.0.8) + sexp_processor (4.1.3) shoulda-matchers (1.3.0) activesupport (>= 3.0.0) + sidekiq (2.6.4) + celluloid (~> 0.12.0) + connection_pool (~> 1.0) + multi_json (~> 1) + redis (~> 3) + redis-namespace simplecov (0.7.1) multi_json (~> 1.0) simplecov-html (~> 0.7.1) @@ -403,6 +416,9 @@ GEM rack-protection (~> 1.2) tilt (~> 1.3, >= 1.3.3) six (0.2.0) + slim (1.3.6) + temple (~> 0.5.5) + tilt (~> 1.3.3) slop (3.3.3) spinach (0.5.2) colorize @@ -411,12 +427,13 @@ GEM capybara (~> 1) railties (>= 3) spinach (>= 0.4) - sprockets (2.2.1) + sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) stamp (0.3.0) + temple (0.5.5) test_after_commit (0.0.1) therubyracer (0.10.2) libv8 (~> 3.3.10) @@ -426,6 +443,7 @@ GEM rack (>= 1.0.0) thor (0.16.0) tilt (1.3.3) + timers (1.0.2) treetop (1.4.12) polyglot polyglot (>= 0.3.1) @@ -437,8 +455,6 @@ GEM kgio (~> 2.6) rack raindrops (~> 0.7) - vegas (0.1.11) - rack (>= 1.0.0) virtus (0.5.2) backports (~> 2.6.1) warden (1.2.1) @@ -458,6 +474,8 @@ DEPENDENCIES acts-as-taggable-on (= 2.3.3) annotate! awesome_print + better_errors + binding_of_caller bootstrap-sass (= 2.2.1.1) capybara carrierwave (~> 0.7.1) @@ -477,6 +495,8 @@ DEPENDENCIES github-linguist (~> 2.3.4) github-markup (~> 0.7.4) gitlab_meta (= 4.0) + gitlab_omniauth-ldap (= 1.0.2) + gitlab_yaml_db (= 1.0.0) gitolite (= 1.1.0) grack! grape (~> 0.2.1) @@ -498,7 +518,6 @@ DEPENDENCIES omniauth (~> 1.1.1) omniauth-github omniauth-google-oauth2 - omniauth-ldap! omniauth-twitter pg poltergeist! @@ -506,22 +525,24 @@ DEPENDENCIES pygments.rb! quiet_assets (~> 1.0.1) rack-mini-profiler - rails (= 3.2.9) + rails (= 3.2.11) rails-dev-tweaks - raphael-rails (= 1.5.2) + rails_best_practices + raphael-rails! rb-fsevent rb-inotify redcarpet (~> 2.2.2) - resque (~> 1.23.0) - resque_mailer - resque_spec rspec-rails sass-rails (~> 3.2.5) + sdoc seed-fu settingslogic shoulda-matchers (= 1.3.0) + sidekiq (= 2.6.4) simplecov + sinatra six + slim spinach-rails stamp test_after_commit @@ -530,4 +551,3 @@ DEPENDENCIES uglifier (~> 1.3.0) unicorn (~> 4.4.0) webmock - yaml_db! diff --git a/Procfile b/Procfile index 09ec8cc2745..d3b3e051e88 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ web: bundle exec rails s -p $PORT -worker: bundle exec rake environment resque:work QUEUE=* VVERBOSE=1 +worker: bundle exec sidekiq -q post_receive,mailer,system_hook,common,default diff --git a/README.md b/README.md index 629fcefcb32..1a43be134da 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ GitLab is a free project and repository management application +![CI](http://ci.gitlab.org/projects/1/status?ref=master) ## Application details @@ -39,6 +40,6 @@ Email ## Contribute -[Development Tips](https://github.com/gitlabhq/gitlabhq/blob/master/doc/development.md) +[Developer Guide](https://github.com/gitlabhq/gitlabhq/wiki/Developer-Guide) Want to help - send a pull request. We'll accept good pull requests. diff --git a/VERSION b/VERSION index 3cdeb6b85ee..a1ecd089ec3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.0rc1 +4.1.0pre diff --git a/app/assets/fonts/OFL.txt b/app/assets/fonts/OFL.txt new file mode 100644 index 00000000000..3ce219f0126 --- /dev/null +++ b/app/assets/fonts/OFL.txt @@ -0,0 +1,92 @@ +Copyright (c) 2010, Jan Gerner (post@yanone.de) +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/app/assets/fonts/YanoneKaffeesatz-Light.ttf b/app/assets/fonts/YanoneKaffeesatz-Light.ttf new file mode 100644 index 00000000000..5026d3bdbe2 Binary files /dev/null and b/app/assets/fonts/YanoneKaffeesatz-Light.ttf differ diff --git a/app/assets/fonts/korolev-medium-compressed.otf b/app/assets/fonts/korolev-medium-compressed.otf deleted file mode 100644 index a9cd3cbffff..00000000000 Binary files a/app/assets/fonts/korolev-medium-compressed.otf and /dev/null differ diff --git a/app/assets/images/download.png b/app/assets/images/download.png deleted file mode 100644 index 5791e723de9..00000000000 Binary files a/app/assets/images/download.png and /dev/null differ diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee new file mode 100644 index 00000000000..b0ae6bf8a02 --- /dev/null +++ b/app/assets/javascripts/dashboard.js.coffee @@ -0,0 +1,30 @@ +$ -> + dashboardPage() + +dashboardPage = -> + Pager.init 20, true + $(".event_filter_link").bind "click", (event) -> + event.preventDefault() + toggleFilter $(this) + reloadActivities() + +reloadActivities = -> + $(".content_list").html '' + Pager.init 20, true + +toggleFilter = (sender) -> + sender.parent().toggleClass "inactive" + event_filters = $.cookie("event_filter") + filter = sender.attr("id").split("_")[0] + if event_filters + event_filters = event_filters.split(",") + else + event_filters = new Array() + + index = event_filters.indexOf(filter) + if index is -1 + event_filters.push filter + else + event_filters.splice index, 1 + + $.cookie "event_filter", event_filters.join(",") diff --git a/app/assets/javascripts/issues.js b/app/assets/javascripts/issues.js index 719d2c176c1..9ba1a3f1bba 100644 --- a/app/assets/javascripts/issues.js +++ b/app/assets/javascripts/issues.js @@ -11,7 +11,7 @@ function initIssuesSearch() { last_terms = terms; if (terms.length >= 2 || terms.length == 0) { - $.get(href, { 'f': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) { + $.get(href, { 'status': status, 'terms': terms, 'milestone_id': milestone_id }, function(response) { $('#issues-table').html(response); }); } diff --git a/app/assets/javascripts/merge_requests.js b/app/assets/javascripts/merge_requests.js deleted file mode 100644 index ee714f9cabb..00000000000 --- a/app/assets/javascripts/merge_requests.js +++ /dev/null @@ -1,132 +0,0 @@ -var MergeRequest = { - diffs_loaded: false, - commits_loaded: false, - opts: false, - - init: - function(opts) { - var self = this; - self.opts = opts; - - self.initTabs(); - self.initMergeWidget(); - - $(".mr_show_all_commits").bind("click", function() { - self.showAllCommits(); - }); - }, - - initMergeWidget: - function() { - var self = this; - self.showState(self.opts.current_state); - - if($(".automerge_widget").length && self.opts.check_enable){ - $.get(self.opts.url_to_automerge_check, function(data){ - self.showState(data.state); - }, "json"); - } - - if(self.opts.ci_enable){ - $.get(self.opts.url_to_ci_check, function(data){ - self.showCiState(data.status); - }, "json"); - } - }, - - initTabs: - function() { - $(".mr_nav_tabs a").live("click", function() { - $(".mr_nav_tabs a").parent().removeClass("active"); - $(this).parent().addClass("active"); - }); - - var current_tab; - if(this.opts.action == "diffs") { - current_tab = $(".mr_nav_tabs .merge-diffs-tab"); - } else { - current_tab = $(".mr_nav_tabs .merge-notes-tab"); - } - current_tab.parent().addClass("active"); - - this.initNotesTab(); - this.initDiffTab(); - }, - - initNotesTab: - function() { - $(".mr_nav_tabs a.merge-notes-tab").live("click", function(e) { - $(".merge-request-diffs").hide(); - $(".merge_request_notes").show(); - var mr_path = $(".merge-notes-tab").attr("data-url"); - history.pushState({ path: mr_path }, '', mr_path); - e.preventDefault(); - }); - }, - - initDiffTab: - function() { - $(".mr_nav_tabs a.merge-diffs-tab").live("click", function(e) { - if(!MergeRequest.diffs_loaded) { - MergeRequest.loadDiff(); - } - $(".merge_request_notes").hide(); - $(".merge-request-diffs").show(); - var mr_diff_path = $(".merge-diffs-tab").attr("data-url"); - history.pushState({ path: mr_diff_path }, '', mr_diff_path); - e.preventDefault(); - }); - - }, - - showState: - function(state){ - $(".automerge_widget").hide(); - $(".automerge_widget." + state).show(); - }, - - showCiState: - function(state){ - $(".ci_widget").hide(); - $(".ci_widget.ci-" + state).show(); - }, - - loadDiff: - function() { - $(".dashboard-loader").show(); - $.ajax({ - type: "GET", - url: $(".merge-diffs-tab").attr("data-url"), - beforeSend: function(){ $('.status').addClass("loading")}, - complete: function(){ - MergeRequest.diffs_loaded = true; - $(".merge_request_notes").hide(); - $('.status').removeClass("loading"); - }, - dataType: "script"}); - }, - - showAllCommits: - function() { - $(".first_mr_commits").remove(); - $(".all_mr_commits").removeClass("hide"); - }, - - already_cannot_be_merged: - function(){ - $(".automerge_widget").hide(); - $(".merge_in_progress").hide(); - $(".automerge_widget.already_cannot_be_merged").show(); - } -}; - -/* - * Filter merge requests - */ -function merge_requestsPage() { - $("#assignee_id").chosen(); - $("#milestone_id").chosen(); - $("#milestone_id, #assignee_id").on("change", function(){ - $(this).closest("form").submit(); - }); -} diff --git a/app/assets/javascripts/merge_requests.js.coffee b/app/assets/javascripts/merge_requests.js.coffee new file mode 100644 index 00000000000..cdc685f2c09 --- /dev/null +++ b/app/assets/javascripts/merge_requests.js.coffee @@ -0,0 +1,97 @@ +# +# * Filter merge requests +# +@merge_requestsPage = -> + $('#assignee_id').chosen() + $('#milestone_id').chosen() + $('#milestone_id, #assignee_id').on 'change', -> + $(this).closest('form').submit() + +class MergeRequest + + constructor: (@opts) -> + this.$el = $('.merge-request') + @diffs_loaded = false + @commits_loaded = false + + this.activateTab(@opts.action) + + this.bindEvents() + + this.initMergeWidget() + this.$('.show-all-commits').on 'click', => + this.showAllCommits() + + # Local jQuery finder + $: (selector) -> + this.$el.find(selector) + + initMergeWidget: -> + this.showState( @opts.current_state ) + + if this.$('.automerge_widget').length and @opts.check_enable + $.get @opts.url_to_automerge_check, (data) => + this.showState( data.state ) + , 'json' + + if @opts.ci_enable + $.get @opts.url_to_ci_check, (data) => + this.showCiState data.status + , 'json' + + bindEvents: -> + this.$('.nav-tabs').on 'click', 'a', (event) => + a = $(event.currentTarget) + + href = a.attr('href') + History.replaceState {path: href}, document.title, href + + event.preventDefault() + + this.$('.nav-tabs').on 'click', 'li', (event) => + this.activateTab($(event.currentTarget).data('action')) + + activateTab: (action) -> + this.$('.nav-tabs li').removeClass 'active' + this.$('.tab-content').hide() + switch action + when 'diffs' + this.$('.nav-tabs .diffs-tab').addClass 'active' + this.loadDiff() unless @diffs_loaded + this.$('.diffs').show() + else + this.$('.nav-tabs .notes-tab').addClass 'active' + this.$('.notes').show() + + showState: (state) -> + $('.automerge_widget').hide() + $('.automerge_widget.' + state).show() + + showCiState: (state) -> + $('.ci_widget').hide() + $('.ci_widget.ci-' + state).show() + + loadDiff: (event) -> + $('.dashboard-loader').show() + $.ajax + type: 'GET' + url: this.$('.nav-tabs .diffs-tab a').attr('href') + beforeSend: => + this.$('.status').addClass 'loading' + + complete: => + @diffs_loaded = true + this.$('.status').removeClass 'loading' + + dataType: 'script' + + showAllCommits: -> + this.$('.first-commits').remove() + this.$('.all-commits').removeClass 'hide' + + alreadyOrCannotBeMerged: -> + this.$('.automerge_widget').hide() + this.$('.merge-in-progress').hide() + this.$('.automerge_widget.already_cannot_be_merged').show() + +this.MergeRequest = MergeRequest diff --git a/app/assets/javascripts/milestones.js.coffee b/app/assets/javascripts/milestones.js.coffee index e40a69ebaa5..99a52bf4d3f 100644 --- a/app/assets/javascripts/milestones.js.coffee +++ b/app/assets/javascripts/milestones.js.coffee @@ -1,14 +1,14 @@ $ -> - $('.milestone-issue-filter tr[data-closed]').addClass('hide') + $('.milestone-issue-filter li[data-closed]').addClass('hide') $('.milestone-issue-filter ul.nav li a').click -> $('.milestone-issue-filter li').toggleClass('active') - $('.milestone-issue-filter tr[data-closed]').toggleClass('hide') + $('.milestone-issue-filter li[data-closed]').toggleClass('hide') false - $('.milestone-merge-requests-filter tr[data-closed]').addClass('hide') + $('.milestone-merge-requests-filter li[data-closed]').addClass('hide') $('.milestone-merge-requests-filter ul.nav li a').click -> $('.milestone-merge-requests-filter li').toggleClass('active') - $('.milestone-merge-requests-filter tr[data-closed]').toggleClass('hide') + $('.milestone-merge-requests-filter li[data-closed]').toggleClass('hide') false diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js index 769e8a62343..7edd6bd6186 100644 --- a/app/assets/javascripts/pager.js +++ b/app/assets/javascripts/pager.js @@ -4,9 +4,16 @@ var Pager = { disable:false, init: - function(limit) { + function(limit, preload) { this.limit=limit; - this.offset=limit; + + if(preload) { + this.offset = 0; + this.getOld(); + } else { + this.offset = limit; + } + this.initLoadMore(); }, diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 6d4c815106b..e192bb426a1 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -117,34 +117,10 @@ span.update-author { } .label { - background-color: #474D57; - - &.label-tag { - background: none; - border: none; - padding: 4px 6px; - color: #444; - text-shadow: 0 0 1px #fff; - - &.grouped { - float: left; - margin-right: 6px; - padding: 6px; - } - } - &.label-issue { - background-color: #eee; - border: 1px solid #ccc; - padding: 4px 6px; - color: #444; - text-shadow: 0 0 1px #fff; - - &.grouped { - float: left; - margin-right: 6px; - padding: 6px; - } - } + padding: 0px 4px; + font-size: 10px; + font-style: normal; + background-color: $link_color; &.label-success { background-color: #8D8; @@ -425,7 +401,7 @@ li.note { .supp_diff_link, -.mr_show_all_commits { +.show-all-commits { cursor: pointer; } diff --git a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss index f9c8b7b05ea..8cb1c045778 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss @@ -1,23 +1,24 @@ /** * =================================== - * Contain 3 main UI block elements: - * .main_box - for show pages - * .ui-box - for simple block & widgets + * Contain UI block elements: + * .ui-box - for any block & widgets * =================================== */ /** - * UI box element - * contains top, middle, bottom blocks + * UI Block * */ -.main_box { - @extend .borders; - @extend .prepend-top-20; - @extend .append-bottom-20; - border-width: 1px; +.ui-box { + background: #F9F9F9; + margin-bottom: 25px; + border: 1px solid #CCC; @include solid-shade; + &.ui-box-show { + margin:20px 0; + background: #FFF; + } img { max-width: 100%; } @@ -27,9 +28,9 @@ } } - .top_box_content, - .middle_box_content, - .bottom_box_content { + .ui-box-head, + .ui-box-body, + .ui-box-bottom { padding: 15px; word-wrap: break-word; @@ -39,19 +40,25 @@ border: none; padding: 0; } + + .clearfix { + margin: 0; + } } - .top_box_content { + .ui-box-head { .box-title { color: $style_color; font-size: 18px; font-weight: normal; line-height: 28px; } + h3 { + margin: 0; + } } - .middle_box_content { - @include border-radius(0); + .ui-box-body { border: none; font-size: 12px; background-color: #f5f5f5; @@ -59,24 +66,9 @@ border-top: 1px solid #eee; } - .bottom_box_content { + .ui-box-bottom { border-top: 1px solid #eee; } -} - -/** - * Big UI Block for show page content - * - */ -.ui-box { - background: #F9F9F9; - margin-bottom: 25px; - - border: 1px solid #eaeaea; - @include border-radius(4px); - - border-color: #CCC; - @include solid-shade; &.white { background: #fff; @@ -86,47 +78,47 @@ margin: 0; } - h5, .title { - padding: 0 10px; - @include border-radius(4px 4px 0 0); + .title { @include bg-gray-gradient; - border-top: 1px solid #eaeaea; - border-bottom: 1px solid #bbb; + border-bottom: 1px solid #CCC; + color: #456; + font-size: 16px; + text-shadow: 0 1px 1px #fff; + padding: 0px 10px; + line-height: 36px; + font-size: 14px; + font-weight: normal; > a { text-shadow: 0 1px 1px #fff; } - &.small { - line-height: 28px; - font-size: 14px; - line-height: 28px; - text-shadow: 0 1px 1px white; - } - form { - padding: 9px 0; - margin: 0px; + margin-bottom: 0; + margin-top: 3px; } .nav-pills { - li { - padding: 3px 0; - &.active a { background-color: $style_color; } - a { - @include border-radius(7px); + > li { + > a { + padding: 13px; + margin: 0; + font-size: 13px; + } + &.active { + > a { + background: #D5D5D5; + color: $style_color; + @include border-radius(0); + border-radius: 0; + border-left: 1px solid #CCC; + border-right: 1px solid #CCC; + } } } } } - .bottom { - @include bg-gray-gradient; - @include border-radius(0 0 4px 4px); - border-bottom: none; - border-top: 1px solid #bbb; - } - &.padded { h5, .title { margin: -20px; @@ -143,6 +135,7 @@ color: #777; } } + .row_title { font-weight: bold; color: #444; @@ -151,8 +144,4 @@ text-decoration: underline; } } - - .ui-box-body { - padding: 10px; - } } diff --git a/app/assets/stylesheets/gitlab_bootstrap/buttons.scss b/app/assets/stylesheets/gitlab_bootstrap/buttons.scss index 883a8773962..2b5ecce4246 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/buttons.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/buttons.scss @@ -7,6 +7,10 @@ color: #333; } + &.btn-white { + background: #FFF; + } + &.primary { background: #2a79A3; @include linear-gradient(#47A7b7, #2585b5); diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index 3bb7cdbf706..f088766afbd 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -17,20 +17,43 @@ .padded { padding:20px } .ipadded { padding:20px!important } .lborder { border-left:1px solid #eee } -.no-padding { padding:0 !important; } -.underlined { border-bottom: 1px solid #CCC; } -.no-borders { border: none; } -.vlink { color: $link_color !important; } .underlined_link { text-decoration: underline; } -.borders { border: 1px solid #ccc; @include shade; } .hint { font-style: italic; color: #999; } .light { color: #888 } .tiny { font-weight: normal } /** PILLS & TABS**/ -.nav-pills a:hover { background-color: #888; } -.nav-pills .active a { background-color: $style_color; } +.nav-pills { + .active a { + background: $primary_color; + } + + > li > a { + @include border-radius(0); + } + &.nav-stacked { + > li > a { + border-left: 4px solid #EEE; + padding: 12px; + } + > .active > a { + border-color: #29B; + border-radius: 0; + background: #F1F1F1; + color: $style_color; + font-weight: bold; + } + } +} + .nav-pills > .active > a > i[class^="icon-"] { background: inherit; } + + + +/** + * nav-tabs + * + */ .nav-tabs > li > a, .nav-pills > li > a { color: $style_color; } .nav.nav-tabs { li { diff --git a/app/assets/stylesheets/gitlab_bootstrap/fonts.scss b/app/assets/stylesheets/gitlab_bootstrap/fonts.scss index 88c966d18f7..b4217fa9cfa 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/fonts.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/fonts.scss @@ -1,7 +1,7 @@ -@font-face{ - font-family: Korolev; - src: font-url('korolev-medium-compressed.otf'); +@font-face{ + font-family: Yanone; + src: font-url('YanoneKaffeesatz-Light.ttf'); } /** Typo **/ -$monospace: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono', 'lucida console', monospace; \ No newline at end of file +$monospace: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono', 'lucida console', monospace; diff --git a/app/assets/stylesheets/gitlab_bootstrap/lists.scss b/app/assets/stylesheets/gitlab_bootstrap/lists.scss index edaf3cef2cf..0f893a553ee 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/lists.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/lists.scss @@ -23,14 +23,12 @@ border-bottom: 1px solid #ADF; } - &:first-child { - @include border-radius(4px 4px 0 0); - border-top: none; - } - &:last-child { - @include border-radius(0 0 4px 4px); - border: none; + border-bottom: none; + + &.bottom { + background: #f5f5f5; + } } .author { color: #999; } diff --git a/app/assets/stylesheets/gitlab_bootstrap/mixins.scss b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss index 81830368c4c..9b1e2f2c728 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/mixins.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss @@ -62,8 +62,8 @@ @mixin header-font { color: $style_color; text-shadow: 0 1px 1px #FFF; - font-family: 'Korolev', sans-serif; - font-size: 28px; - line-height: 48px; + font-family: 'Yanone', sans-serif; + font-size: 26px; + line-height: 42px; font-weight: normal; } diff --git a/app/assets/stylesheets/gitlab_bootstrap/tables.scss b/app/assets/stylesheets/gitlab_bootstrap/tables.scss index 5905efd3aae..7a9eac82566 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/tables.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/tables.scss @@ -25,7 +25,7 @@ table { } th, td { - padding: 8px; + padding: 10px; line-height: 18px; text-align: left; } diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index 1cae7b0c6b1..c60aae49eaa 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -1,74 +1,17 @@ -.commit-box { - @extend .main_box; - - .commit-head { - @extend .top_box_content; - - .commit-title { - line-height: 26px; - margin: 0; - } - - .commit-description { - font-size: 14px; - border: none; - background-color: white; - padding-top: 10px; - } - - .browse-button { - @extend .btn; - @extend .btn-small; - float: right; - } - } - - .commit-info { - @extend .middle_box_content; - @extend .clearfix; - - .sha-block { - text-align: right; - &:first-child { - padding-bottom: 6px; - } - - a { - border-bottom: 1px solid #aaa; - margin-left: 9px; - } - } - - &.merge-commit .sha-block { - clear: right; - } - - .committer { - padding-left: 32px; - } - - .author a, - .committer a { - font-size: 14px; - line-height: 22px; - text-shadow: 0 1px 1px #fff; - color: #777; - &:hover { - color: #999; - } - } - - .avatar { - margin-right: 10px; - } - } -} - /** * * COMMIT SHOw * */ +.commit-committer-link, +.commit-author-link { + font-size: 13px; + color: #555; + &:hover { + color: #999; + } +} + .diff_file { border: 1px solid #CCC; margin-bottom: 1em; @@ -258,13 +201,6 @@ min-width: 65px; font-family: $monospace; } - - .commit-author-name { - color: #777; - &:hover { - color: #999; - } - } } .diff_file_header a, diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index 071a9c35468..2d41de25103 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -47,6 +47,12 @@ .event-info { color: #666; } + .event-note { + padding-top: 5px; + padding-left: 5px; + display: inline-block; + color: #777; + } } .avatar { position: relative; diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss index c1b210be1ab..048a3ffcbb2 100644 --- a/app/assets/stylesheets/sections/header.scss +++ b/app/assets/stylesheets/sections/header.scss @@ -33,22 +33,29 @@ header { * */ .app_logo { - width: 170px; float: left; + margin-right: 15px; + position: relative; + top: -5px; + padding-top: 5px; + a { float: left; padding: 0px; + margin: 0 10px; h1 { - width: 90px; background: url('logo_dark.png') no-repeat 0px 2px; float: left; - margin-left: 2px; - padding-left: 45px; height: 40px; + width: 40px; @include header-font; + text-indent: -9999px; } } + &:hover { + background-color: #EEE; + } } /** @@ -60,7 +67,7 @@ header { position: relative; float: left; margin: 0; - margin-right: 30px; + margin-left: 15px; @include header-font; } @@ -233,7 +240,7 @@ header { .app_logo { a { h1 { - background: url('logo_white.png') no-repeat 0px 2px; + background: url('logo_white.png') no-repeat center center; color: #fff; text-shadow: 0 1px 1px #111; } @@ -244,5 +251,23 @@ header { text-shadow: 0 1px 1px #111; } } + + .app_logo { + .separator { + margin-left: 0; + margin-right: 0; + } + } + + .separator { + float: left; + height: 60px; + width: 1px; + background: white; + border-left: 1px solid #DDD; + margin-top: -10px; + margin-left: 10px; + margin-right: 10px; + } } diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss index fd995728978..351f2404492 100644 --- a/app/assets/stylesheets/sections/issues.scss +++ b/app/assets/stylesheets/sections/issues.scss @@ -1,34 +1,6 @@ -.issue_form_box { - @extend .main_box; - .issue_title { - @extend .top_box_content; - .clearfix { - margin-bottom: 0px; - input { - @extend .span8; - } - } - } - .issue_middle_block { - @extend .middle_box_content; - height: 30px; - .issue_assignee { - @extend .span6; - float: left; - } - .issue_milestone { - @extend .span4; - float: left; - } - } - .issue_description { - @extend .bottom_box_content; - } -} - .issues_table { .issue { - padding: 7px 10px; + padding: 10px; .issue_check { float: left; @@ -82,38 +54,34 @@ input.check_all_issues { } } -@media (min-width: 800px) { .issues_filters select { width: 160px; } } -@media (min-width: 1000px) { .issues_filters select { width: 200px; } } +@media (min-width: 800px) { .issues_filters select { width: 160px; } } @media (min-width: 1200px) { .issues_filters select { width: 220px; } } +@media (min-width: 800px) { .issues_bulk_update select { width: 120px; } } +@media (min-width: 1200px) { .issues_bulk_update select { width: 160px; } } #issues-table-holder { .issues_filters { - form { - padding: 0; - margin: 0; - margin-top:7px - } } .issues_bulk_update { margin: 0; form { - padding: 0; - margin: 0; - margin-top:7px + float:left; } + .update_selected_issues { position: relative; - top:-2px; + top:5px; margin-left: 4px; float: left; } .update_issues_text { padding: 3px; - line-height: 18px; + line-height: 28px; float: left; + color: #479; } } } diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index 4808117d02a..5225a242726 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -1,17 +1,3 @@ -/** - * MR form - * - */ - -.mr_branch_box { - @extend .ui-box; - margin-bottom: 20px; - - .body { - background: #f1f1f1; - } - -} /** * MR -> show: Automerge widget @@ -47,6 +33,7 @@ } label { color: #444; + text-align: left } } @@ -56,7 +43,7 @@ } } -.mr_nav_tabs { +.merge-request .nav-tabs{ li { a { font-weight: bold; @@ -67,7 +54,7 @@ } li.merge_request { - padding: 7px 10px; + padding: 10px; img.avatar { width: 32px; margin-top: 1px; @@ -78,7 +65,7 @@ li.merge_request { } } -.merge_in_progress { +.merge-in-progress { @extend .padded; @extend .append-bottom-10; } @@ -120,19 +107,3 @@ li.merge_request { .mr_direction_tip { margin-top:40px } - -.merge_requests_form_box { - @extend .main_box; - .merge_requests_middle_box { - @extend .middle_box_content; - height: 30px; - .merge_requests_assignee { - @extend .span6; - float: left; - } - .merge_requests_milestone { - @extend .span4; - float: left; - } - } -} diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index 465d578f3b7..93ad0d45037 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -294,6 +294,8 @@ ul.notes { padding: 4px 6px; } .note_text { + border: 1px solid #DDD; + box-shadow: none; font-size: 14px; height: 80px; width: 98.6%; diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index 717f85024cc..072ade80ad3 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -8,16 +8,12 @@ .groups_box, .projects_box { - > h5 { - color: $style_color; - font-size: 16px; - text-shadow: 0 1px 1px #fff; - padding: 2px 10px; - line-height: 32px; - font-size: 14px; + > .title { + padding: 2px 15px; } .nav-projects-tabs li { padding: 0; } .well-list { + li { padding: 15px; } .arrow { float: right; padding: 10px; @@ -109,7 +105,7 @@ ul.nav.nav-projects-tabs { li { a { - padding: 4px 20px; + padding: 6px 25px; margin-top: 2px; border-color: #DDD; background-color: #EEE; diff --git a/app/assets/stylesheets/themes/ui_basic.scss b/app/assets/stylesheets/themes/ui_basic.scss index b377727779a..4e34e8b1b6b 100644 --- a/app/assets/stylesheets/themes/ui_basic.scss +++ b/app/assets/stylesheets/themes/ui_basic.scss @@ -4,21 +4,8 @@ * */ .ui_basic { - .app_logo { - .separator { - margin-left: 0; - margin-right: 0; - } - } - .separator { - float: left; - height: 60px; - width: 1px; background: white; border-left: 1px solid #DDD; - margin-top: -10px; - margin-left: 10px; - margin-right: 10px; } } diff --git a/app/assets/stylesheets/themes/ui_color.scss b/app/assets/stylesheets/themes/ui_color.scss index 8c60fabb3a7..d7a554ff9e5 100644 --- a/app/assets/stylesheets/themes/ui_color.scss +++ b/app/assets/stylesheets/themes/ui_color.scss @@ -17,6 +17,15 @@ &.navbar-gitlab { .navbar-inner { background: #657; + .app_logo { + &:hover { + background-color: #6A5A7A; + } + } + .separator { + background: #546; + border-left: 1px solid #706080; + } } } } diff --git a/app/assets/stylesheets/themes/ui_gray.scss b/app/assets/stylesheets/themes/ui_gray.scss index e80137a69c8..f0547c72157 100644 --- a/app/assets/stylesheets/themes/ui_gray.scss +++ b/app/assets/stylesheets/themes/ui_gray.scss @@ -17,6 +17,15 @@ &.navbar-gitlab { .navbar-inner { background: #708090; + .app_logo { + &:hover { + background-color: #6A7A8A; + } + } + .separator { + background: #607080; + border-left: 1px solid #8090A0; + } } } } diff --git a/app/assets/stylesheets/themes/ui_mars.scss b/app/assets/stylesheets/themes/ui_mars.scss index 9e6433c5f9e..0a78c5c09f5 100644 --- a/app/assets/stylesheets/themes/ui_mars.scss +++ b/app/assets/stylesheets/themes/ui_mars.scss @@ -46,21 +46,26 @@ .app_logo { a { h1 { - background: url('logo_white.png') no-repeat 0px 2px; + background: url('logo_white.png') no-repeat center center; color: #eee; text-shadow: 0 1px 1px #111; } } - .separator { - display: none; + &:hover { + background-color: #41464e; } - } .project_name { color: #eee; text-shadow: 0 1px 1px #111; } } + + .separator { + background: #31363E; + border-left: 1px solid #666; + } + /* * End of Application Header * diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss index 32b5ad7d968..a5bf414c443 100644 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ b/app/assets/stylesheets/themes/ui_modern.scss @@ -17,6 +17,15 @@ &.navbar-gitlab { .navbar-inner { background: #567; + .app_logo { + &:hover { + background-color: #516171; + } + } + .separator { + background: #456; + border-left: 1px solid #678; + } } } } diff --git a/app/contexts/commit_load_context.rb b/app/contexts/commit_load_context.rb index e43e5a07805..1f23f633af3 100644 --- a/app/contexts/commit_load_context.rb +++ b/app/contexts/commit_load_context.rb @@ -9,16 +9,16 @@ class CommitLoadContext < BaseContext status: :ok } - commit = project.commit(params[:id]) + commit = project.repository.commit(params[:id]) if commit commit = CommitDecorator.decorate(commit) - line_notes = project.commit_line_notes(commit) + line_notes = project.notes.for_commit_id(commit.id).inline result[:commit] = commit result[:note] = project.build_commit_note(commit) result[:line_notes] = line_notes - result[:notes_count] = line_notes.count + project.commit_notes(commit).count + result[:notes_count] = project.notes.for_commit_id(commit.id).count begin result[:suppress_diff] = true if commit.diffs.size > Commit::DIFF_SAFE_SIZE && !params[:force_show_diff] diff --git a/app/contexts/filter_context.rb b/app/contexts/filter_context.rb new file mode 100644 index 00000000000..401d19b31c8 --- /dev/null +++ b/app/contexts/filter_context.rb @@ -0,0 +1,31 @@ +class FilterContext + attr_accessor :items, :params + + def initialize(items, params) + @items = items + @params = params + end + + def execute + apply_filter(items) + end + + def apply_filter items + if params[:project_id] + items = items.where(project_id: params[:project_id]) + end + + if params[:search].present? + items = items.search(params[:search]) + end + + case params[:status] + when 'closed' + items.closed + when 'all' + items + else + items.opened + end + end +end diff --git a/app/contexts/issues_list_context.rb b/app/contexts/issues_list_context.rb index 9bbdfe1db39..0cc73f99535 100644 --- a/app/contexts/issues_list_context.rb +++ b/app/contexts/issues_list_context.rb @@ -4,7 +4,7 @@ class IssuesListContext < BaseContext attr_accessor :issues def execute - @issues = case params[:f] + @issues = case params[:status] when issues_filter[:all] then @project.issues when issues_filter[:closed] then @project.issues.closed when issues_filter[:to_me] then @project.issues.opened.assigned(current_user) diff --git a/app/contexts/notes/load_context.rb b/app/contexts/notes/load_context.rb index 4e2f35040fd..e3875e1d4e2 100644 --- a/app/contexts/notes/load_context.rb +++ b/app/contexts/notes/load_context.rb @@ -9,7 +9,7 @@ module Notes @notes = case target_type when "commit" - project.commit_notes(project.commit(target_id)).fresh + project.notes.for_commit_id(target_id).not_inline.fresh when "issue" project.issues.find(target_id).notes.inc_author.fresh when "merge_request" @@ -18,7 +18,7 @@ module Notes project.snippets.find(target_id).notes.fresh when "wall" # this is the only case, where the order is DESC - project.common_notes.order("created_at DESC, id DESC").limit(50) + project.notes.common.inc_author_project.order("created_at DESC, id DESC").limit(50) end @notes = if after_id diff --git a/app/contexts/test_hook_context.rb b/app/contexts/test_hook_context.rb index cba5d1f87c2..d2d82a52cf5 100644 --- a/app/contexts/test_hook_context.rb +++ b/app/contexts/test_hook_context.rb @@ -1,7 +1,7 @@ class TestHookContext < BaseContext def execute hook = project.hooks.find(params[:id]) - commits = project.commits(project.default_branch, nil, 3) + commits = project.repository.commits(project.default_branch, nil, 3) data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user) hook.execute(data) end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 827dd0cf7cd..f97c56b0b31 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -3,10 +3,6 @@ class Admin::DashboardController < AdminController @projects = Project.order("created_at DESC").limit(10) @users = User.order("created_at DESC").limit(10) - @resque_accessible = true - @workers = Resque.workers - @pending_jobs = Resque.size(:post_receive) - rescue Redis::InheritedError @resque_accessible = false end diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index a492e66611f..90dbda3eeea 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,5 +1,5 @@ class Admin::GroupsController < AdminController - before_filter :group, only: [:edit, :show, :update, :destroy, :project_update] + before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :project_teams_update] def index @groups = Group.order('name ASC') @@ -12,6 +12,8 @@ class Admin::GroupsController < AdminController @projects = @projects.not_in_group(@group) if @group.projects.present? @projects = @projects.all @projects.reject!(&:empty_repo?) + + @users = User.active end def new @@ -65,7 +67,14 @@ class Admin::GroupsController < AdminController redirect_to :back, notice: 'Group was successfully updated.' end + def project_teams_update + @group.add_users_to_project_teams(params[:user_ids], params[:project_access]) + redirect_to [:admin, @group], notice: 'Users was successfully added.' + end + def destroy + @group.truncate_teams + @group.destroy redirect_to admin_groups_path, notice: 'Group was successfully deleted.' diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 4fea8709b70..d5e6f3cdc0e 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -10,6 +10,7 @@ class Admin::ProjectsController < AdminController end def show + @repository = @project.repository @users = User.active @users = @users.not_in_project(@project) if @project.users.present? @users = @users.all @@ -19,7 +20,7 @@ class Admin::ProjectsController < AdminController end def team_update - @project.add_users_ids_to_team(params[:user_ids], params[:project_access]) + @project.team.add_users_ids(params[:user_ids], params[:project_access]) redirect_to [:admin, @project], notice: 'Project was successfully updated.' end @@ -35,6 +36,9 @@ class Admin::ProjectsController < AdminController end def destroy + # Delete team first in order to prevent multiple gitolite calls + @project.team.truncate + @project.destroy redirect_to admin_projects_path, notice: 'Project was successfully deleted.' diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 5f259bd7e27..8669f5d1d38 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -3,13 +3,13 @@ class Admin::UsersController < AdminController @admin_users = User.scoped @admin_users = @admin_users.filter(params[:filter]) @admin_users = @admin_users.search(params[:name]) if params[:name].present? - @admin_users = @admin_users.order("name ASC").page(params[:page]) + @admin_users = @admin_users.alphabetically.page(params[:page]) end def show @admin_user = User.find(params[:id]) - @projects = if @admin_user.projects.empty? + @projects = if @admin_user.authorized_projects.empty? Project else Project.without_user(@admin_user) @@ -19,9 +19,9 @@ class Admin::UsersController < AdminController def team_update @admin_user = User.find(params[:id]) - UsersProject.user_bulk_import( - @admin_user, + UsersProject.add_users_into_projects( params[:project_ids], + [@admin_user.id], params[:project_access] ) @@ -98,7 +98,7 @@ class Admin::UsersController < AdminController def destroy @admin_user = User.find(params[:id]) - if @admin_user.my_own_projects.count > 0 + if @admin_user.personal_projects.count > 0 redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return end @admin_user.destroy diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 75cd8f15605..3457a1ab1b4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -76,6 +76,12 @@ class ApplicationController < ActionController::Base end end + def repository + @repository ||= project.repository + rescue Grit::NoSuchPathError + nil + end + def add_abilities abilities << Ability end diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index 3b8ebdb5ddc..534ae1edd31 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -9,10 +9,10 @@ class CommitsController < ProjectResourceController before_filter :require_non_empty_project def show - @repo = @project.repo + @repo = @project.repository @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) - @commits = @project.commits(@ref, @path, @limit, @offset) + @commits = @repo.commits(@ref, @path, @limit, @offset) @commits = CommitDecorator.decorate(@commits) respond_to do |format| diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 1fcadbfefba..c0ec4708e0a 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -20,7 +20,7 @@ class DashboardController < ApplicationController @projects = @projects.page(params[:page]).per(30) - @events = Event.in_projects(current_user.project_ids) + @events = Event.in_projects(current_user.authorized_projects.pluck(:id)) @events = @event_filter.apply_filter(@events) @events = @events.limit(20).offset(params[:offset] || 0) @@ -36,14 +36,14 @@ class DashboardController < ApplicationController # Get authored or assigned open merge requests def merge_requests @merge_requests = current_user.cared_merge_requests - @merge_requests = dashboard_filter(@merge_requests) + @merge_requests = FilterContext.new(@merge_requests, params).execute @merge_requests = @merge_requests.recent.page(params[:page]).per(20) end # Get only assigned issues def issues @issues = current_user.assigned_issues - @issues = dashboard_filter(@issues) + @issues = FilterContext.new(@issues, params).execute @issues = @issues.recent.page(params[:page]).per(20) @issues = @issues.includes(:author, :project) @@ -60,25 +60,7 @@ class DashboardController < ApplicationController end def event_filter - @event_filter ||= EventFilter.new(params[:event_filter]) - end - - def dashboard_filter items - if params[:project_id] - items = items.where(project_id: params[:project_id]) - end - - if params[:search].present? - items = items.search(params[:search]) - end - - case params[:status] - when 'closed' - items.closed - when 'all' - items - else - items.opened - end + filters = cookies['event_filter'].split(',') if cookies['event_filter'] + @event_filter ||= EventFilter.new(filters) end end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index c82edb4c168..c25fc32a62c 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -21,15 +21,16 @@ class GroupsController < ApplicationController # Get authored or assigned open merge requests def merge_requests - @merge_requests = current_user.cared_merge_requests.opened - @merge_requests = @merge_requests.of_group(@group).recent.page(params[:page]).per(20) + @merge_requests = current_user.cared_merge_requests.of_group(@group) + @merge_requests = FilterContext.new(@merge_requests, params).execute + @merge_requests = @merge_requests.recent.page(params[:page]).per(20) end # Get only assigned issues def issues - @user = current_user - @issues = current_user.assigned_issues.opened - @issues = @issues.of_group(@group).recent.page(params[:page]).per(20) + @issues = current_user.assigned_issues.of_group(@group) + @issues = FilterContext.new(@issues, params).execute + @issues = @issues.recent.page(params[:page]).per(20) @issues = @issues.includes(:author, :project) respond_to do |format| @@ -44,6 +45,7 @@ class GroupsController < ApplicationController @projects = result[:projects] @merge_requests = result[:merge_requests] @issues = result[:issues] + @wiki_pages = result[:wiki_pages] end def people @@ -53,9 +55,16 @@ class GroupsController < ApplicationController if @project @team_member = @project.users_projects.new + else + @team_member = UsersProject.new end end + def team_members + @group.add_users_to_project_teams(params[:user_ids], params[:project_access]) + redirect_to people_group_path(@group), notice: 'Users was successfully added.' + end + protected def group @@ -63,7 +72,7 @@ class GroupsController < ApplicationController end def projects - @projects ||= group.projects.authorized_for(current_user).sorted_by_activity + @projects ||= current_user.authorized_projects.where(namespace_id: group.id).sorted_by_activity end def project_ids diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb index 355f4d79d67..ab6bf595982 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/merge_requests_controller.rb @@ -74,6 +74,8 @@ class MergeRequestsController < ProjectResourceController @merge_request.check_if_can_be_merged end render json: {state: @merge_request.human_state} + rescue Gitlab::SatelliteNotExistError + render json: {state: :no_satellite} end def automerge @@ -88,12 +90,12 @@ class MergeRequestsController < ProjectResourceController end def branch_from - @commit = project.commit(params[:ref]) + @commit = @repository.commit(params[:ref]) @commit = CommitDecorator.decorate(@commit) end def branch_to - @commit = project.commit(params[:ref]) + @commit = @repository.commit(params[:ref]) @commit = CommitDecorator.decorate(@commit) end diff --git a/app/controllers/project_resource_controller.rb b/app/controllers/project_resource_controller.rb index 81bc3a91bd1..ea78b3ff7c4 100644 --- a/app/controllers/project_resource_controller.rb +++ b/app/controllers/project_resource_controller.rb @@ -1,3 +1,4 @@ class ProjectResourceController < ApplicationController before_filter :project + before_filter :repository end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 17b0921ba6c..6f1180eaa6b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -2,6 +2,7 @@ require Rails.root.join('lib', 'gitlab', 'graph', 'json_builder') class ProjectsController < ProjectResourceController skip_before_filter :project, only: [:new, :create] + skip_before_filter :repository, only: [:new, :create] # Authorize before_filter :authorize_read_project!, except: [:index, :new, :create] @@ -58,7 +59,7 @@ class ProjectsController < ProjectResourceController respond_to do |format| format.html do - unless @project.empty_repo? + if @project.repository && !@project.repository.empty? @last_push = current_user.recent_push(@project.id) render :show else @@ -102,11 +103,10 @@ class ProjectsController < ProjectResourceController def destroy return access_denied! unless can?(current_user, :remove_project, project) - # Disable the UsersProject update_repository call, otherwise it will be - # called once for every person removed from the project - UsersProject.skip_callback(:destroy, :after, :update_repository) + # Delete team first in order to prevent multiple gitolite calls + project.team.truncate + project.destroy - UsersProject.set_callback(:destroy, :after, :update_repository) respond_to do |format| format.html { redirect_to root_path } diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index b48d5ec7027..09d9eb51b82 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -12,7 +12,7 @@ class RefsController < ProjectResourceController respond_to do |format| format.html do new_path = if params[:destination] == "tree" - project_tree_path(@project, @ref) + project_tree_path(@project, (@ref + "/" + params[:path])) else project_commits_path(@project, @ref) end @@ -31,7 +31,7 @@ class RefsController < ProjectResourceController contents = @tree.contents @logs = contents.map do |content| file = params[:path] ? File.join(params[:path], content.name) : content.name - last_commit = @project.commits(@commit.id, file, 1).last + last_commit = @repo.commits(@commit.id, file, 1).last last_commit = CommitDecorator.decorate(last_commit) { file_name: content.name, @@ -45,10 +45,10 @@ class RefsController < ProjectResourceController def define_tree_vars params[:path] = nil if params[:path].blank? - @repo = project.repo - @commit = project.commit(@ref) + @repo = project.repository + @commit = @repo.commit(@ref) @commit = CommitDecorator.decorate(@commit) - @tree = Tree.new(@commit.tree, project, @ref, params[:path]) + @tree = Tree.new(@commit.tree, @ref, params[:path]) @tree = TreeDecorator.new(@tree) @hex_path = Digest::SHA1.hexdigest(params[:path] || "") diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 7678fbff3f1..229cb36949b 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -5,19 +5,19 @@ class RepositoriesController < ProjectResourceController before_filter :require_non_empty_project def show - @activities = @project.commits_with_refs(20) + @activities = @repository.commits_with_refs(20) end def branches - @branches = @project.branches + @branches = @repository.branches end def tags - @tags = @project.tags + @tags = @repository.tags end def stats - @stats = Gitlab::GitStats.new(@project.repo, @project.root_ref) + @stats = Gitlab::GitStats.new(@repository.raw, @repository.root_ref) @graph = @stats.graph end @@ -27,7 +27,7 @@ class RepositoriesController < ProjectResourceController end - file_path = @project.archive_repo(params[:ref]) + file_path = @repository.archive_repo(params[:ref]) if file_path # Send file to user diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 4f45f9ddccb..a23292396a0 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,6 +1,6 @@ class SearchController < ApplicationController def show - result = SearchContext.new(current_user.project_ids, params).execute + result = SearchContext.new(current_user.authorized_projects.map(&:id), params).execute @projects = result[:projects] @merge_requests = result[:merge_requests] diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 50f7e97af9f..d0df469b967 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -26,7 +26,7 @@ class ServicesController < ProjectResourceController end def test - commits = project.commits(project.default_branch, nil, 3) + commits = project.repository.commits(project.default_branch, nil, 3) data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user) @service = project.gitlab_ci_service diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 977524a4db8..26898abfa82 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -16,7 +16,7 @@ class SnippetsController < ProjectResourceController respond_to :html def index - @snippets = @project.snippets.fresh + @snippets = @project.snippets.fresh.non_expired end def new diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb index 311af62b8db..8378a8458ff 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/team_members_controller.rb @@ -16,10 +16,9 @@ class TeamMembersController < ProjectResourceController end def create - @project.add_users_ids_to_team( - params[:user_ids], - params[:project_access] - ) + users = User.where(id: params[:user_ids]) + + @project.team << [users, params[:project_access]] if params[:redirect_to] redirect_to params[:redirect_to] @@ -50,7 +49,7 @@ class TeamMembersController < ProjectResourceController def apply_import giver = Project.find(params[:source_project_id]) - status = UsersProject.import_team(giver, project) + status = @project.team.import(giver) notice = status ? "Succesfully imported" : "Import failed" redirect_to project_team_members_path(project), notice: notice diff --git a/app/controllers/tree_controller.rb b/app/controllers/tree_controller.rb index 725f48fa014..2151bd7cbbd 100644 --- a/app/controllers/tree_controller.rb +++ b/app/controllers/tree_controller.rb @@ -22,7 +22,7 @@ class TreeController < ProjectResourceController end def edit - @last_commit = @project.last_commit_for(@ref, @path).sha + @last_commit = @project.repository.last_commit_for(@ref, @path).sha end def update diff --git a/app/decorators/tree_decorator.rb b/app/decorators/tree_decorator.rb index c12227afb5d..0e760f97dee 100644 --- a/app/decorators/tree_decorator.rb +++ b/app/decorators/tree_decorator.rb @@ -6,16 +6,14 @@ class TreeDecorator < ApplicationDecorator part_path = "" parts = path.split("\/") - #parts = parts[0...-1] if is_blob? - - yield(h.link_to("..", "#")) if parts.count > max_links + yield('..', nil) if parts.count > max_links parts.each do |part| part_path = File.join(part_path, part) unless part_path.empty? part_path = part if part_path.empty? next unless parts.last(2).include?(part) if parts.count > max_links - yield(h.link_to(h.truncate(part, length: 40), h.project_tree_path(project, h.tree_join(ref, part_path)))) + yield(part, h.tree_join(ref, part_path)) end end end @@ -26,7 +24,7 @@ class TreeDecorator < ApplicationDecorator def up_dir_path file = File.join(path, "..") - h.project_tree_path(project, h.tree_join(ref, file)) + h.tree_join(ref, file) end def readme diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 52715a265bd..a1eea96be43 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -53,7 +53,7 @@ module ApplicationHelper def last_commit(project) if project.repo_exists? - time_ago_in_words(project.commit.committed_date) + " ago" + time_ago_in_words(project.repository.commit.committed_date) + " ago" else "Never" end @@ -62,9 +62,11 @@ module ApplicationHelper end def grouped_options_refs(destination = :tree) + repository = @project.repository + options = [ - ["Branch", @project.branch_names ], - [ "Tag", @project.tag_names ] + ["Branch", repository.branch_names ], + [ "Tag", repository.tag_names ] ] # If reference is commit id - @@ -78,7 +80,8 @@ module ApplicationHelper end def search_autocomplete_source - projects = current_user.projects.map{ |p| { label: p.name_with_namespace, url: project_path(p) } } + projects = current_user.authorized_projects.map { |p| { label: p.name_with_namespace, url: project_path(p) } } + groups = current_user.authorized_groups.map { |group| { label: " #{group.name}", url: group_path(group) } } default_nav = [ { label: "My Profile", url: profile_path }, @@ -99,21 +102,21 @@ module ApplicationHelper ] project_nav = [] - if @project && !@project.new_record? + if @project && @project.repository && @project.repository.root_ref project_nav = [ { label: "#{@project.name} Issues", url: project_issues_path(@project) }, - { label: "#{@project.name} Commits", url: project_commits_path(@project, @ref || @project.root_ref) }, + { label: "#{@project.name} Commits", url: project_commits_path(@project, @ref || @project.repository.root_ref) }, { label: "#{@project.name} Merge Requests", url: project_merge_requests_path(@project) }, { label: "#{@project.name} Milestones", url: project_milestones_path(@project) }, { label: "#{@project.name} Snippets", url: project_snippets_path(@project) }, { label: "#{@project.name} Team", url: project_team_index_path(@project) }, - { label: "#{@project.name} Tree", url: project_tree_path(@project, @ref || @project.root_ref) }, + { label: "#{@project.name} Tree", url: project_tree_path(@project, @ref || @project.repository.root_ref) }, { label: "#{@project.name} Wall", url: wall_project_path(@project) }, { label: "#{@project.name} Wiki", url: project_wikis_path(@project) }, ] end - [projects, default_nav, project_nav, help_nav].flatten.to_json + [groups, projects, default_nav, project_nav, help_nav].flatten.to_json end def emoji_autocomplete_source @@ -139,6 +142,7 @@ module ApplicationHelper event.last_push_to_non_root? && !event.rm_ref? && event.project && + event.project.repository && event.project.merge_requests_enabled end diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 2349888ed7a..8fc637a2bf6 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -70,4 +70,12 @@ module CommitsHelper escape_javascript(render 'commits/commit', commit: commit) end end + + def diff_line_content(line) + if line.blank? + "  " + else + line + end + end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index a2548a23e5e..9b9d2a913e9 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -20,25 +20,8 @@ module EventsHelper [event.action_name, target].join(" ") end - def event_image event - event_image_path = if event.push? - "event_push.png" - elsif event.merged? - "event_mr_merged.png" - end - - return nil unless event_image_path - - content_tag :div, class: 'event_icon' do - image_tag event_image_path - end - end - def event_filter_link key, tooltip key = key.to_s - - filter = @event_filter.options key - inactive = if @event_filter.active? key nil else @@ -46,7 +29,7 @@ module EventsHelper end content_tag :div, class: "filter_icon #{inactive}" do - link_to dashboard_path(event_filter: filter), class: 'has_tooltip', 'data-original-title' => tooltip do + link_to dashboard_path, class: 'has_tooltip event_filter_link', id: "#{key}_event_filter", 'data-original-title' => tooltip do image_tag "event_filter_#{key}.png" end end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb new file mode 100644 index 00000000000..283119bc24c --- /dev/null +++ b/app/helpers/groups_helper.rb @@ -0,0 +1,17 @@ +module GroupsHelper + def group_filter_path(entity, options={}) + exist_opts = { + status: params[:status], + project_id: params[:project_id], + } + + options = exist_opts.merge(options) + + case entity + when 'issue' then + issues_group_path(@group, options) + when 'merge_request' + merge_requests_group_path(@group, options) + end + end +end diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index f48425bd6de..ca0a89c3749 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -4,7 +4,7 @@ module MergeRequestsHelper event.project, merge_request: { source_branch: event.branch_name, - target_branch: event.project.root_ref, + target_branch: event.project.repository.root_ref, title: event.branch_name.titleize } ) diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index fdf6725cc13..2d25c8f854d 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -1,6 +1,6 @@ module NamespacesHelper def namespaces_options(selected = :current_user, scope = :default) - groups = current_user.namespaces.select {|n| n.type == 'Group'} + groups = current_user.owned_groups.select {|n| n.type == 'Group'} users = if scope == :all Namespace.root diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 7d68e50b382..706d7a8e4ed 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -1,11 +1,12 @@ class Notify < ActionMailer::Base - include Resque::Mailer + add_template_helper ApplicationHelper add_template_helper GitlabMarkdownHelper default_url_options[:host] = Gitlab.config.gitlab.host default_url_options[:protocol] = Gitlab.config.gitlab.protocol default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port? + default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root default from: Gitlab.config.gitlab.email_from @@ -87,7 +88,7 @@ class Notify < ActionMailer::Base def note_wall_email(recipient_id, note_id) @note = Note.find(note_id) @project = @note.project - mail(to: recipient(recipient_id), subject: subject) + mail(to: recipient(recipient_id), subject: subject("note on wall")) end @@ -147,12 +148,15 @@ class Notify < ActionMailer::Base # >> @project = Project.last # => # # >> subject('Lorem ipsum') - # => "GitLab | Lorem ipsum | Ruby on Rails" + # => "GitLab | Ruby on Rails | Lorem ipsum " # # # Accepts multiple arguments # >> subject('Lorem ipsum', 'Dolor sit amet') # => "GitLab | Lorem ipsum | Dolor sit amet" def subject(*extra) - "GitLab | " << extra.join(' | ') << (@project ? " | #{@project.name}" : "") + subject = "GitLab" + subject << (@project ? " | #{@project.name_with_namespace}" : "") + subject << " | " + extra.join(' | ') if extra.present? + subject end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 2d80c6720b7..256af1e800b 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -15,35 +15,26 @@ class Ability def project_abilities(user, project) rules = [] + team = project.team + # Rules based on role in project - if project.master_access_for?(user) + if team.masters.include?(user) rules << project_master_rules - elsif project.dev_access_for?(user) + elsif team.developers.include?(user) rules << project_dev_rules - elsif project.report_access_for?(user) + elsif team.reporters.include?(user) rules << project_report_rules - elsif project.guest_access_for?(user) + elsif team.guests.include?(user) rules << project_guest_rules end - if project.namespace - # If user own project namespace - # (Ex. group owner or account owner) - if project.namespace.owner == user - rules << project_admin_rules - end - else - # For compatibility with global projects - # use projects.owner_id - if project.owner == user - rules << project_admin_rules - end + if project.owner == user + rules << project_admin_rules end - rules.flatten end @@ -107,9 +98,12 @@ class Ability def group_abilities user, group rules = [] - rules << [ - :manage_group - ] if group.owner == user + # Only group owner and administrators can manage group + if group.owner == user || user.admin? + rules << [ + :manage_group + ] + end rules.flatten end diff --git a/app/models/commit.rb b/app/models/commit.rb index f11b7fe0202..17d41f27f34 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -11,7 +11,7 @@ class Commit attr_accessor :commit, :head, :refs delegate :message, :authored_date, :committed_date, :parents, :sha, - :date, :committer, :author, :message, :diffs, :tree, :id, + :date, :committer, :author, :diffs, :tree, :id, :stats, :to_patch, to: :commit class << self @@ -83,8 +83,8 @@ class Commit return result unless from && to - first = project.commit(to.try(:strip)) - last = project.commit(from.try(:strip)) + first = project.repository.commit(to.try(:strip)) + last = project.repository.commit(from.try(:strip)) if first && last result[:same] = (first.id == last.id) @@ -98,6 +98,8 @@ class Commit end def initialize(raw_commit, head = nil) + raise "Nil as raw commit passed" unless raw_commit + @commit = raw_commit @head = head end @@ -136,17 +138,17 @@ class Commit end def prev_commit - parents.try :first + @prev_commit ||= if parents.present? + Commit.new(parents.first) + else + nil + end end def prev_commit_id prev_commit.try :id end - def parents_count - parents && parents.count || 0 - end - # Shows the diff between the commit's parent and the commit. # # Cuts out the header and stats from #to_patch and returns only the diff. diff --git a/app/roles/issue_commonality.rb b/app/models/concerns/issuable.rb similarity index 70% rename from app/roles/issue_commonality.rb rename to app/models/concerns/issuable.rb index 79831cdca67..d1717d3bbee 100644 --- a/app/roles/issue_commonality.rb +++ b/app/models/concerns/issuable.rb @@ -1,5 +1,10 @@ +# == Issuable concern +# # Contains common functionality shared between Issues and MergeRequests -module IssueCommonality +# +# Used by Issue, MergeRequest +# +module Issuable extend ActiveSupport::Concern included do @@ -64,4 +69,38 @@ module IssueCommonality closed_changed? && !closed end + # + # Votes + # + + # Return the number of -1 comments (downvotes) + def downvotes + notes.select(&:downvote?).size + end + + def downvotes_in_percent + if votes_count.zero? + 0 + else + 100.0 - upvotes_in_percent + end + end + + # Return the number of +1 comments (upvotes) + def upvotes + notes.select(&:upvote?).size + end + + def upvotes_in_percent + if votes_count.zero? + 0 + else + 100.0 / votes_count * upvotes + end + end + + # Return the total number of votes + def votes_count + upvotes + downvotes + end end diff --git a/app/models/event.rb b/app/models/event.rb index 90376e73753..d0ba61544d1 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -15,9 +15,6 @@ # class Event < ActiveRecord::Base - include NoteEvent - include PushEvent - attr_accessible :project, :action, :data, :author_id, :project_id, :target_id, :target_type @@ -113,26 +110,6 @@ class Event < ActiveRecord::Base target_type == "MergeRequest" end - def new_issue? - target_type == "Issue" && - action == Created - end - - def new_merge_request? - target_type == "MergeRequest" && - action == Created - end - - def changed_merge_request? - target_type == "MergeRequest" && - [Closed, Reopened].include?(action) - end - - def changed_issue? - target_type == "Issue" && - [Closed, Reopened].include?(action) - end - def joined? action == Joined end @@ -170,4 +147,143 @@ class Event < ActiveRecord::Base "opened" end end + + def valid_push? + data[:ref] + rescue => ex + false + end + + def tag? + data[:ref]["refs/tags"] + end + + def branch? + data[:ref]["refs/heads"] + end + + def new_branch? + commit_from =~ /^00000/ + end + + def new_ref? + commit_from =~ /^00000/ + end + + def rm_ref? + commit_to =~ /^00000/ + end + + def md_ref? + !(rm_ref? || new_ref?) + end + + def commit_from + data[:before] + end + + def commit_to + data[:after] + end + + def ref_name + if tag? + tag_name + else + branch_name + end + end + + def branch_name + @branch_name ||= data[:ref].gsub("refs/heads/", "") + end + + def tag_name + @tag_name ||= data[:ref].gsub("refs/tags/", "") + end + + # Max 20 commits from push DESC + def commits + @commits ||= data[:commits].map { |commit| repository.commit(commit[:id]) }.reverse + end + + def commits_count + data[:total_commits_count] || commits.count || 0 + end + + def ref_type + tag? ? "tag" : "branch" + end + + def push_action_name + if new_ref? + "pushed new" + elsif rm_ref? + "deleted" + else + "pushed to" + end + end + + def repository + project.repository + end + + def parent_commit + repository.commit(commit_from) + rescue => ex + nil + end + + def last_commit + repository.commit(commit_to) + rescue => ex + nil + end + + def push_with_commits? + md_ref? && commits.any? && parent_commit && last_commit + rescue Grit::NoSuchPathError + false + end + + def last_push_to_non_root? + branch? && project.default_branch != branch_name + end + + def note_commit_id + target.commit_id + end + + def note_short_commit_id + note_commit_id[0..8] + end + + def note_commit? + target.noteable_type == "Commit" + end + + def note_target + target.noteable + end + + def note_target_id + if note_commit? + target.commit_id + else + target.noteable_id.to_s + end + end + + def wall_note? + target.noteable_type.blank? + end + + def note_target_type + if target.noteable_type.present? + target.noteable_type.titleize + else + "Wall" + end.downcase + end end diff --git a/app/models/gitlab_ci_service.rb b/app/models/gitlab_ci_service.rb index a2f5634a86f..4eb39c7ef4d 100644 --- a/app/models/gitlab_ci_service.rb +++ b/app/models/gitlab_ci_service.rb @@ -23,20 +23,12 @@ class GitlabCiService < Service after_save :compose_service_hook, if: :activated? - def activated? - active - end - def compose_service_hook hook = service_hook || build_service_hook hook.url = [project_url, "/build", "?token=#{token}"].join("") hook.save end - def commit_badge_path sha - project_url + "/status?sha=#{sha}" - end - def commit_status_path sha project_url + "/builds/#{sha}/status.json?token=#{token}" end diff --git a/app/models/group.rb b/app/models/group.rb index b668f5560ab..8ba92980a9b 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -12,6 +12,14 @@ # class Group < Namespace + def add_users_to_project_teams(user_ids, project_access) + UsersProject.add_users_into_projects( + projects.map(&:id), + user_ids, + project_access + ) + end + def users users = User.joins(:users_projects).where(users_projects: {project_id: project_ids}) users = users << owner @@ -21,4 +29,8 @@ class Group < Namespace def human_name name end + + def truncate_teams + UsersProject.truncate_teams(project_ids) + end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 1de9d0f9ebc..7381136c979 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -17,8 +17,7 @@ # class Issue < ActiveRecord::Base - include IssueCommonality - include Votes + include Issuable attr_accessible :title, :assignee_id, :closed, :position, :description, :milestone_id, :label_list, :author_id_of_changes diff --git a/app/models/key.rb b/app/models/key.rb index 5dac1c1c9fd..2bf50f56565 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -73,7 +73,7 @@ class Key < ActiveRecord::Base if is_deploy_key [project] else - user.projects + user.authorized_projects end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 052e0850d96..b6ea85f6507 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -20,11 +20,10 @@ # require Rails.root.join("app/models/commit") -require Rails.root.join("app/roles/static_model") +require Rails.root.join("lib/static_model") class MergeRequest < ActiveRecord::Base - include IssueCommonality - include Votes + include Issuable attr_accessible :title, :assignee_id, :closed, :target_branch, :source_branch, :milestone_id, :author_id_of_changes diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 4fac9bec259..8b4c895dc17 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -29,7 +29,7 @@ class Milestone < ActiveRecord::Base def expired? if due_date - due_date < Date.today + due_date.past? else false end @@ -58,7 +58,13 @@ class Milestone < ActiveRecord::Base end def expires_at - "expires at #{due_date.stamp("Aug 21, 2011")}" if due_date + if due_date + if due_date.past? + "expired at #{due_date.stamp("Aug 21, 2011")}" + else + "expires at #{due_date.stamp("Aug 21, 2011")}" + end + end end def can_be_closed? diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 8c90f5aee26..89c1f9adb5a 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -27,10 +27,13 @@ class Namespace < ActiveRecord::Base after_create :ensure_dir_exist after_update :move_dir + after_commit :update_gitolite, on: :update, if: :require_update_gitolite after_destroy :rm_dir scope :root, where('type IS NULL') + attr_accessor :require_update_gitolite + def self.search query where("name LIKE :query OR path LIKE :query", query: "%#{query}%") end @@ -48,8 +51,17 @@ class Namespace < ActiveRecord::Base end def ensure_dir_exist - namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path) - system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path) + unless dir_exists? + FileUtils.mkdir( namespace_full_path, mode: 0770 ) + end + end + + def dir_exists? + File.exists?(namespace_full_path) + end + + def namespace_full_path + @namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path) end def move_dir @@ -59,16 +71,25 @@ class Namespace < ActiveRecord::Base if File.exists?(new_path) raise "Already exists" end - - if system("mv #{old_path} #{new_path}") + + begin + FileUtils.mv( old_path, new_path ) send_update_instructions + @require_update_gitolite = true + rescue Exception => e + raise "Namespace move error #{old_path} #{new_path}" end end end + def update_gitolite + @require_update_gitolite = false + projects.each(&:update_repository) + end + def rm_dir dir_path = File.join(Gitlab.config.gitolite.repos_path, path) - system("rm -rf #{dir_path}") + FileUtils.rm_r( dir_path, force: true ) end def send_update_instructions diff --git a/app/models/note.rb b/app/models/note.rb index b62b3fe61d5..3ad03cc601b 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -4,7 +4,6 @@ # # id :integer not null, primary key # note :text -# noteable_id :string(255) # noteable_type :string(255) # author_id :integer # created_at :datetime not null @@ -12,6 +11,8 @@ # project_id :integer # attachment :string(255) # line_code :string(255) +# commit_id :string(255) +# noteable_id :integer # require 'carrierwave/orm/activerecord' @@ -41,11 +42,11 @@ class Note < ActiveRecord::Base mount_uploader :attachment, AttachmentUploader # Scopes - scope :for_commits, ->{ where(noteable_type: "Commit") } - scope :common, ->{ where(noteable_id: nil, commit_id: nil) } - scope :today, ->{ where("created_at >= :date", date: Date.today) } - scope :last_week, ->{ where("created_at >= :date", date: (Date.today - 7.days)) } - scope :since, ->(day) { where("created_at >= :date", date: (day)) } + scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) } + scope :inline, where("line_code IS NOT NULL") + scope :not_inline, where("line_code IS NULL") + + scope :common, ->{ where(noteable_type: ["", nil]) } scope :fresh, ->{ order("created_at ASC, id ASC") } scope :inc_author_project, ->{ includes(:project, :author) } scope :inc_author, ->{ includes(:author) } @@ -126,7 +127,7 @@ class Note < ActiveRecord::Base # override to return commits, which are not active record def noteable if for_commit? - project.commit(commit_id) + project.repository.commit(commit_id) else super end diff --git a/app/models/project.rb b/app/models/project.rb index 251f497548e..32b951349a9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -9,7 +9,7 @@ # created_at :datetime not null # updated_at :datetime not null # private_flag :boolean default(TRUE), not null -# owner_id :integer +# creator_id :integer # default_branch :string(255) # issues_enabled :boolean default(TRUE), not null # wall_enabled :boolean default(TRUE), not null @@ -21,18 +21,14 @@ require "grit" class Project < ActiveRecord::Base - include Repository - include PushObserver - include Authority - include Team - include NamespacedProject + include Gitolited class TransferError < StandardError; end attr_accessible :name, :path, :description, :default_branch, :issues_enabled, :wall_enabled, :merge_requests_enabled, :wiki_enabled, as: [:default, :admin] - attr_accessible :namespace_id, :owner_id, as: :admin + attr_accessible :namespace_id, :creator_id, as: :admin attr_accessor :error_code @@ -40,10 +36,10 @@ class Project < ActiveRecord::Base belongs_to :group, foreign_key: "namespace_id", conditions: "type = 'Group'" belongs_to :namespace - # TODO: replace owner with creator. - # With namespaces a project owner will be a namespace owner - # so this field makes sense only for global projects - belongs_to :owner, class_name: "User" + belongs_to :creator, + class_name: "User", + foreign_key: "creator_id" + has_many :users, through: :users_projects has_many :events, dependent: :destroy has_many :merge_requests, dependent: :destroy @@ -62,9 +58,11 @@ class Project < ActiveRecord::Base delegate :name, to: :owner, allow_nil: true, prefix: true # Validations - validates :owner, presence: true + validates :creator, presence: true validates :description, length: { within: 0..2000 } - validates :name, presence: true, length: { within: 0..255 } + validates :name, presence: true, length: { within: 0..255 }, + format: { with: Gitlab::Regex.project_name_regex, + message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter should be first" } validates :path, presence: true, length: { within: 0..255 }, format: { with: Gitlab::Regex.path_regex, message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } @@ -77,19 +75,14 @@ class Project < ActiveRecord::Base validate :check_limit, :repo_name # Scopes - scope :public_only, where(private_flag: false) - scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) } + scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) } scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) } + scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) } scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) } 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) - end - def active joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC") end @@ -101,8 +94,10 @@ class Project < ActiveRecord::Base def find_with_namespace(id) if id.include?("/") id = id.split("/") - namespace_id = Namespace.find_by_path(id.first).id - where(namespace_id: namespace_id).find_by_path(id.last) + namespace = Namespace.find_by_path(id.first) + return nil unless namespace + + where(namespace_id: namespace.id).find_by_path(id.second) else where(path: id, namespace_id: nil).last end @@ -122,7 +117,7 @@ class Project < ActiveRecord::Base # project.path = project.name.dup.parameterize - project.owner = user + project.creator = user # Apply namespace if user has access to it # else fallback to user namespace @@ -162,6 +157,20 @@ class Project < ActiveRecord::Base end end + def team + @team ||= Team.new(self) + end + + def repository + if path + @repository ||= Repository.new(path_with_namespace, default_branch) + else + nil + end + rescue Grit::NoSuchPathError + nil + end + def git_error? error_code == :gitolite end @@ -171,8 +180,8 @@ class Project < ActiveRecord::Base end def check_limit - unless owner.can_create_project? - errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it") + unless creator.can_create_project? + errors[:base] << ("Your own projects limit is #{creator.projects_limit}! Please contact administrator to increase it") end rescue errors[:base] << ("Can't check your ability to create project") @@ -198,30 +207,10 @@ class Project < ActiveRecord::Base [Gitlab.config.gitlab.url, path_with_namespace].join("/") end - def common_notes - notes.where(noteable_type: ["", nil]).inc_author_project - end - def build_commit_note(commit) notes.new(commit_id: commit.id, noteable_type: "Commit") end - def commit_notes(commit) - notes.where(commit_id: commit.id, noteable_type: "Commit").where('line_code IS NULL OR line_code = ""') - end - - def commit_line_notes(commit) - notes.where(commit_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL") - end - - def public? - !private_flag - end - - def private? - private_flag - end - def last_activity last_event end @@ -262,7 +251,282 @@ class Project < ActiveRecord::Base def send_move_instructions self.users_projects.each do |member| - Notify.project_was_moved_email(member.id).deliver + Notify.delay.project_was_moved_email(member.id) end end + + def owner + if namespace + namespace_owner + else + creator + end + end + + def team_member_by_name_or_email(name = nil, email = nil) + user = users.where("name like ? or email like ?", name, email).first + users_projects.where(user: user) if user + end + + # Get Team Member record by user id + def team_member_by_id(user_id) + users_projects.find_by_user_id(user_id) + end + + def transfer(new_namespace) + Project.transaction do + old_namespace = namespace + self.namespace = new_namespace + + old_dir = old_namespace.try(:path) || '' + new_dir = new_namespace.try(:path) || '' + + old_repo = if old_dir.present? + File.join(old_dir, self.path) + else + self.path + end + + if Project.where(path: self.path, namespace_id: new_namespace.try(:id)).present? + raise TransferError.new("Project with same path in target namespace already exists") + end + + Gitlab::ProjectMover.new(self, old_dir, new_dir).execute + + gitolite.move_repository(old_repo, self) + + save! + end + rescue Gitlab::ProjectMover::ProjectMoveError => ex + raise Project::TransferError.new(ex.message) + end + + def name_with_namespace + @name_with_namespace ||= begin + if namespace + namespace.human_name + " / " + name + else + name + end + end + end + + def namespace_owner + namespace.try(:owner) + end + + def path_with_namespace + if namespace + namespace.path + '/' + path + else + path + end + end + + # This method will be called after each post receive and only if the provided + # user is present in GitLab. + # + # All callbacks for post receive should be placed here. + def trigger_post_receive(oldrev, newrev, ref, user) + data = post_receive_data(oldrev, newrev, ref, user) + + # Create push event + self.observe_push(data) + + if push_to_branch? ref, oldrev + # Close merged MR + self.update_merge_requests(oldrev, newrev, ref, user) + + # Execute web hooks + self.execute_hooks(data.dup) + + # Execute project services + self.execute_services(data.dup) + end + + # Create satellite + self.satellite.create unless self.satellite.exists? + + # Discover the default branch, but only if it hasn't already been set to + # something else + if repository && default_branch.nil? + update_attributes(default_branch: self.repository.discover_default_branch) + end + end + + def push_to_branch? ref, oldrev + ref_parts = ref.split('/') + + # Return if this is not a push to a branch (e.g. new commits) + !(ref_parts[1] !~ /heads/ || oldrev == "00000000000000000000000000000000") + end + + def observe_push(data) + Event.create( + project: self, + action: Event::Pushed, + data: data, + author_id: data[:user_id] + ) + end + + def execute_hooks(data) + hooks.each { |hook| hook.execute(data) } + end + + def execute_services(data) + services.each do |service| + + # Call service hook only if it is active + service.execute(data) if service.active + end + end + + # Produce a hash of post-receive data + # + # data = { + # before: String, + # after: String, + # ref: String, + # user_id: String, + # user_name: String, + # repository: { + # name: String, + # url: String, + # description: String, + # homepage: String, + # }, + # commits: Array, + # total_commits_count: Fixnum + # } + # + def post_receive_data(oldrev, newrev, ref, user) + + push_commits = repository.commits_between(oldrev, newrev) + + # Total commits count + push_commits_count = push_commits.size + + # Get latest 20 commits ASC + push_commits_limited = push_commits.last(20) + + # Hash to be passed as post_receive_data + data = { + before: oldrev, + after: newrev, + ref: ref, + user_id: user.id, + user_name: user.name, + repository: { + name: name, + url: url_to_repo, + description: description, + homepage: web_url, + }, + commits: [], + total_commits_count: push_commits_count + } + + # For perfomance purposes maximum 20 latest commits + # will be passed as post receive hook data. + # + push_commits_limited.each do |commit| + data[:commits] << { + id: commit.id, + message: commit.safe_message, + timestamp: commit.date.xmlschema, + url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{commit.id}", + author: { + name: commit.author_name, + email: commit.author_email + } + } + end + + data + end + + def update_merge_requests(oldrev, newrev, ref, user) + return true unless ref =~ /heads/ + branch_name = ref.gsub("refs/heads/", "") + c_ids = self.repository.commits_between(oldrev, newrev).map(&:id) + + # Update code for merge requests + mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all + mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } + + # Close merge requests + mrs = self.merge_requests.opened.where(target_branch: branch_name).all + mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) } + mrs.each { |merge_request| merge_request.merge!(user.id) } + + true + end + + def valid_repo? + repo + rescue + errors.add(:path, "Invalid repository path") + false + end + + def empty_repo? + !repository || repository.empty? + end + + def satellite + @satellite ||= Gitlab::Satellite::Satellite.new(self) + end + + def repo + repository.raw + end + + def url_to_repo + gitolite.url_to_repo(path_with_namespace) + end + + def namespace_dir + namespace.try(:path) || '' + end + + def update_repository + gitolite.update_repository(self) + end + + def destroy_repository + gitolite.remove_repository(self) + end + + def repo_exists? + @repo_exists ||= (repository && repository.branches.present?) + rescue + @repo_exists = false + end + + def open_branches + if protected_branches.empty? + self.repo.heads + else + pnames = protected_branches.map(&:name) + self.repo.heads.reject { |h| pnames.include?(h.name) } + end.sort_by(&:name) + end + + def root_ref?(branch) + repository.root_ref == branch + end + + def ssh_url_to_repo + url_to_repo + end + + def http_url_to_repo + http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('') + end + + # Check if current branch name is marked as protected in the system + def protected_branch? branch_name + protected_branches.map(&:name).include?(branch_name) + end end diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index c54aa3ce9a2..3308caf360a 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -10,7 +10,7 @@ # class ProtectedBranch < ActiveRecord::Base - include GitHost + include Gitolited attr_accessible :name @@ -22,10 +22,10 @@ class ProtectedBranch < ActiveRecord::Base after_destroy :update_repository def update_repository - git_host.update_repository(project) + gitolite.update_repository(project) end def commit - project.commit(self.name) + project.repository.commit(self.name) end end diff --git a/app/roles/repository.rb b/app/models/repository.rb similarity index 70% rename from app/roles/repository.rb rename to app/models/repository.rb index 78190ca96d0..cf8ba4530a1 100644 --- a/app/roles/repository.rb +++ b/app/models/repository.rb @@ -1,15 +1,35 @@ -module Repository - include GitHost +class Repository + # Repository directory name with namespace direcotry + # Examples: + # gitlab/gitolite + # diaspora + # + attr_accessor :path_with_namespace - def valid_repo? + # Grit repo object + attr_accessor :repo + + # Default branch in the repository + attr_accessor :root_ref + + def initialize(path_with_namespace, root_ref = 'master') + @root_ref = root_ref || "master" + @path_with_namespace = path_with_namespace + + # Init grit repo object repo - rescue - errors.add(:path, "Invalid repository path") - false end - def empty_repo? - !repo_exists? || !has_commits? + def raw + repo + end + + def path_to_repo + @path_to_repo ||= File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git") + end + + def repo + @repo ||= Grit::Repo.new(path_to_repo) end def commit(commit_id = nil) @@ -40,10 +60,6 @@ module Repository Commit.commits_between(repo, from, to) end - def satellite - @satellite ||= Gitlab::Satellite::Satellite.new(self) - end - def has_post_receive_file? !!hook_file end @@ -88,36 +104,6 @@ module Repository [branch_names + tag_names].flatten end - def repo - @repo ||= Grit::Repo.new(path_to_repo) - end - - def url_to_repo - git_host.url_to_repo(path_with_namespace) - end - - def path_to_repo - File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git") - end - - def namespace_dir - namespace.try(:path) || '' - end - - def update_repository - git_host.update_repository(self) - end - - def destroy_repository - git_host.remove_repository(self) - end - - def repo_exists? - @repo_exists ||= (repo && !repo.branches.empty?) - rescue - @repo_exists = false - end - def heads @heads ||= repo.heads end @@ -128,13 +114,14 @@ module Repository path ? (tree / path) : tree end - def open_branches - if protected_branches.empty? - self.repo.heads - else - pnames = protected_branches.map(&:name) - self.repo.heads.reject { |h| pnames.include?(h.name) } - end.sort_by(&:name) + def has_commits? + !!commit + rescue Grit::NoSuchPathError + false + end + + def empty? + !has_commits? end # Discovers the default branch based on the repository's available branches @@ -153,20 +140,6 @@ module Repository end end - def has_commits? - !!commit - rescue Grit::NoSuchPathError - false - end - - def root_ref - default_branch || "master" - end - - def root_ref?(branch) - root_ref == branch - end - # Archive Project to .tar.gz # # Already packed repo archives stored at @@ -193,17 +166,4 @@ module Repository file_path end - - def ssh_url_to_repo - url_to_repo - end - - def http_url_to_repo - http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('') - end - - # Check if current branch name is marked as protected in the system - def protected_branch? branch_name - protected_branches.map(&:name).include?(branch_name) - end end diff --git a/app/models/service.rb b/app/models/service.rb index 17a7a656de5..d3486d29200 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -20,4 +20,8 @@ class Service < ActiveRecord::Base has_one :service_hook validates :project_id, presence: true + + def activated? + active + end end diff --git a/app/models/system_hook.rb b/app/models/system_hook.rb index 2ae5b1314e9..5f1bd6477c4 100644 --- a/app/models/system_hook.rb +++ b/app/models/system_hook.rb @@ -19,6 +19,6 @@ class SystemHook < WebHook end def async_execute(data) - Resque.enqueue(SystemHookWorker, id, data) + Sidekiq::Client.enqueue(SystemHookWorker, id, data) end end diff --git a/app/models/team.rb b/app/models/team.rb new file mode 100644 index 00000000000..f235d20ebdb --- /dev/null +++ b/app/models/team.rb @@ -0,0 +1,118 @@ +class Team + attr_accessor :project + + def initialize(project) + @project = project + end + + # Shortcut to add users + # + # Use: + # @team << [@user, :master] + # @team << [@users, :master] + # + def << args + users = args.first + + if users.respond_to?(:each) + add_users(users, args.second) + else + add_user(users, args.second) + end + end + + def add_user(user, access) + add_users_ids([user.id], access) + end + + def add_users(users, access) + add_users_ids(users.map(&:id), access) + end + + def add_users_ids(user_ids, access) + UsersProject.add_users_into_projects( + [project.id], + user_ids, + access + ) + end + + # Remove all users from project team + def truncate + UsersProject.truncate_team(project) + end + + def members + project.users_projects + end + + def guests + members.guests.map(&:user) + end + + def reporters + members.reporters.map(&:user) + end + + def developers + members.developers.map(&:user) + end + + def masters + members.masters.map(&:user) + end + + def repository_readers + repository_members[UsersProject::REPORTER] + end + + def repository_writers + repository_members[UsersProject::DEVELOPER] + end + + def repository_masters + 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: project.id). + each {|row| keys[row.project_access] << [row.identifier] } + + keys[UsersProject::REPORTER] += project.deploy_keys.pluck(:identifier) + keys + end + + def import(source_project) + target_project = project + + source_team = source_project.users_projects.all + target_team = target_project.users_projects.all + target_user_ids = target_team.map(&:user_id) + + source_team.reject! do |tm| + # Skip if user already present in team + target_user_ids.include?(tm.user_id) + end + + source_team.map! do |tm| + new_tm = tm.dup + new_tm.id = nil + new_tm.project_id = target_project.id + new_tm.skip_git = true + new_tm + end + + UsersProject.transaction do + source_team.each do |tm| + tm.save + end + target_project.update_repository + end + + true + rescue + false + end +end diff --git a/app/models/tree.rb b/app/models/tree.rb index c3dfd4c718c..96395a42394 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -1,12 +1,13 @@ class Tree include Linguist::BlobHelper - attr_accessor :path, :tree, :project, :ref + + attr_accessor :path, :tree, :ref delegate :contents, :basename, :name, :data, :mime_type, :mode, :size, :text?, :colorize, to: :tree - def initialize(raw_tree, project, ref = nil, path = nil) - @project, @ref, @path = project, ref, path + def initialize(raw_tree, ref = nil, path = nil) + @ref, @path = ref, path @tree = if path.present? raw_tree / path else diff --git a/app/models/user.rb b/app/models/user.rb index 1bc070f040d..55d75892fc4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -34,8 +34,6 @@ # class User < ActiveRecord::Base - include Account - devise :database_authenticatable, :token_authenticatable, :lockable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable @@ -51,7 +49,6 @@ class User < ActiveRecord::Base has_many :groups, class_name: "Group", foreign_key: :owner_id has_many :keys, dependent: :destroy - has_many :projects, through: :users_projects has_many :users_projects, dependent: :destroy has_many :issues, foreign_key: :author_id, dependent: :destroy has_many :notes, foreign_key: :author_id, dependent: :destroy @@ -70,6 +67,8 @@ class User < ActiveRecord::Base message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } + validate :namespace_uniq, if: ->(user) { user.username_changed? } + before_validation :generate_password, on: :create before_save :ensure_authentication_token alias_attribute :private_token, :authentication_token @@ -77,11 +76,14 @@ class User < ActiveRecord::Base delegate :path, to: :namespace, allow_nil: true, prefix: true # Scopes - scope :not_in_project, ->(project) { where("id not in (:ids)", ids: project.users.map(&:id) ) } scope :admins, where(admin: true) scope :blocked, where(blocked: true) scope :active, where(blocked: false) + scope :alphabetically, order('name ASC') + # + # Class methods + # class << self def filter filter_name case filter_name @@ -93,6 +95,14 @@ class User < ActiveRecord::Base end end + def not_in_project(project) + if project.users.present? + where("id not in (:ids)", ids: project.users.map(&:id) ) + else + scoped + end + end + def without_projects where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') end @@ -118,9 +128,158 @@ class User < ActiveRecord::Base end end + # + # Instance methods + # def generate_password if self.force_random_password self.password = self.password_confirmation = Devise.friendly_token.first(8) end end + + def namespace_uniq + namespace_name = self.username + if Namespace.find_by_path(namespace_name) + self.errors.add :username, "already exist" + end + end + + # Namespaces user has access to + def namespaces + namespaces = [] + + # Add user account namespace + namespaces << self.namespace if self.namespace + + # Add groups you can manage + namespaces += if admin + Group.all + else + groups.all + end + namespaces + end + + # Groups where user is an owner + def owned_groups + groups + end + + # Groups user has access to + def authorized_groups + @authorized_groups ||= begin + groups = Group.where(id: self.authorized_projects.pluck(:namespace_id)).all + groups = groups + self.groups + groups.uniq + end + end + + + # Projects user has access to + def authorized_projects + project_ids = users_projects.pluck(:project_id) + project_ids = project_ids | owned_projects.pluck(:id) + Project.where(id: project_ids) + end + + # Projects in user namespace + def personal_projects + Project.personal(self) + end + + # Projects where user is an owner + def owned_projects + Project.where("(projects.namespace_id IN (:namespaces)) OR + (projects.namespace_id IS NULL AND projects.creator_id = :user_id)", + namespaces: namespaces.map(&:id), user_id: self.id) + end + + # Team membership in personal projects + def tm_in_personal_projects + UsersProject.where(project_id: personal_projects.map(&:id), user_id: self.id) + end + + # Returns a string for use as a Gitolite user identifier + # + # Note that Gitolite 2.x requires the following pattern for users: + # + # ^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$ + def identifier + # Replace non-word chars with underscores, then make sure it starts with + # valid chars + email.gsub(/\W/, '_').gsub(/\A([\W\_])+/, '') + end + + def is_admin? + admin + end + + def require_ssh_key? + keys.count == 0 + end + + def can_create_project? + projects_limit > personal_projects.count + end + + def can_create_group? + is_admin? + end + + def abilities + @abilities ||= begin + abilities = Six.new + abilities << Ability + abilities + end + end + + def can? action, subject + abilities.allowed?(self, action, subject) + end + + def first_name + name.split.first unless name.blank? + end + + def cared_merge_requests + MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id) + end + + # Remove user from all projects and + # set blocked attribute to true + def block + users_projects.find_each do |membership| + return false unless membership.destroy + end + + self.blocked = true + save + end + + def projects_limit_percent + return 100 if projects_limit.zero? + (personal_projects.count.to_f / projects_limit) * 100 + end + + def recent_push project_id = nil + # Get push events not earlier than 2 hours ago + events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours) + events = events.where(project_id: project_id) if project_id + + # Take only latest one + events = events.recent.limit(1).first + end + + def projects_sorted_by_activity + authorized_projects.sorted_by_activity + end + + def several_namespaces? + namespaces.size > 1 + end + + def namespace_id + namespace.try :id + end end diff --git a/app/models/users_project.rb b/app/models/users_project.rb index 3d76a4df037..79146289836 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -11,7 +11,7 @@ # class UsersProject < ActiveRecord::Base - include GitHost + include Gitolited GUEST = 10 REPORTER = 20 @@ -23,87 +23,96 @@ class UsersProject < ActiveRecord::Base belongs_to :user belongs_to :project - after_save :update_repository - after_destroy :update_repository + attr_accessor :skip_git + + after_save :update_repository, unless: :skip_git? + after_destroy :update_repository, unless: :skip_git? validates :user, presence: true - validates :user_id, uniqueness: { :scope => [:project_id], message: "already exists in project" } + validates :user_id, uniqueness: { scope: [:project_id], message: "already exists in project" } validates :project_access, inclusion: { in: [GUEST, REPORTER, DEVELOPER, MASTER] }, presence: true validates :project, presence: true delegate :name, :email, to: :user, prefix: true + scope :guests, where(project_access: GUEST) + scope :reporters, where(project_access: REPORTER) + scope :developers, where(project_access: DEVELOPER) + scope :masters, where(project_access: MASTER) + scope :in_project, ->(project) { where(project_id: project.id) } + class << self - def import_team(source_project, target_project) - UsersProject.without_repository_callback do - UsersProject.transaction do - team = source_project.users_projects.all - team.each do |tm| - # Skip if user already present in team - next if target_project.users.include?(tm.user) + # Add users to project teams with passed access option + # + # access can be an integer representing a access code + # or symbol like :master representing role + # + # Ex. + # add_users_into_projects( + # project_ids, + # user_ids, + # UsersProject::MASTER + # ) + # + # add_users_into_projects( + # project_ids, + # user_ids, + # :master + # ) + # + def add_users_into_projects(project_ids, user_ids, access) + project_access = if roles_hash.has_key?(access) + roles_hash[access] + elsif roles_hash.values.include?(access.to_i) + access + else + raise "Non valid access" + end - new_tm = tm.dup - new_tm.id = nil - new_tm.project_id = target_project.id - new_tm.save + UsersProject.transaction do + project_ids.each do |project_id| + user_ids.each do |user_id| + users_project = UsersProject.new(project_access: project_access, user_id: user_id) + users_project.project_id = project_id + users_project.skip_git = true + users_project.save end end + Gitlab::Gitolite.new.update_repositories(Project.where(id: project_ids)) end - target_project.update_repository true rescue false end - def without_repository_callback - UsersProject.skip_callback(:destroy, :after, :update_repository) - yield - UsersProject.set_callback(:destroy, :after, :update_repository) - end - - def bulk_delete(project, user_ids) + def truncate_teams(project_ids) UsersProject.transaction do - UsersProject.where(:user_id => user_ids, :project_id => project.id).each do |users_project| + users_projects = UsersProject.where(project_id: project_ids) + users_projects.each do |users_project| + users_project.skip_git = true users_project.destroy end + Gitlab::Gitolite.new.update_repositories(Project.where(id: project_ids)) end + + true + rescue + false end - def bulk_update(project, user_ids, project_access) - UsersProject.transaction do - UsersProject.where(:user_id => user_ids, :project_id => project.id).each do |users_project| - users_project.project_access = project_access - users_project.save - end - end + def truncate_team project + truncate_teams [project.id] end - def bulk_import(project, user_ids, project_access) - UsersProject.transaction do - user_ids.each do |user_id| - users_project = UsersProject.new( - project_access: project_access, - user_id: user_id - ) - users_project.project = project - users_project.save - end - end - end - - def user_bulk_import(user, project_ids, project_access) - UsersProject.transaction do - project_ids.each do |project_id| - users_project = UsersProject.new( - project_access: project_access, - ) - users_project.project_id = project_id - users_project.user_id = user.id - users_project.save - end - end + def roles_hash + { + guest: GUEST, + reporter: REPORTER, + developer: DEVELOPER, + master: MASTER + } end def access_roles @@ -116,12 +125,8 @@ class UsersProject < ActiveRecord::Base end end - def role_access - project_access - end - def update_repository - git_host.update_repository(project) + gitolite.update_repository(project) end def project_access_human @@ -131,4 +136,8 @@ class UsersProject < ActiveRecord::Base def repo_access_human self.class.access_roles.invert[self.project_access] end + + def skip_git? + !!@skip_git + end end diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 252a97e8cca..4f113957f99 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -50,5 +50,4 @@ class Wiki < ActiveRecord::Base def set_slug self.slug = self.title.parameterize end - end diff --git a/app/observers/issue_observer.rb b/app/observers/issue_observer.rb index 131336be8b6..262d0f892c4 100644 --- a/app/observers/issue_observer.rb +++ b/app/observers/issue_observer.rb @@ -3,7 +3,7 @@ class IssueObserver < ActiveRecord::Observer def after_create(issue) if issue.assignee && issue.assignee != current_user - Notify.new_issue_email(issue.id).deliver + Notify.delay.new_issue_email(issue.id) end end @@ -16,7 +16,7 @@ class IssueObserver < ActiveRecord::Observer if status Note.create_status_change_note(issue, current_user, status) [issue.author, issue.assignee].compact.each do |recipient| - Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user.id).deliver + Notify.delay.issue_status_changed_email(recipient.id, issue.id, status, current_user.id) end end end @@ -27,7 +27,7 @@ class IssueObserver < ActiveRecord::Observer recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id } recipient_ids.each do |recipient_id| - Notify.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was).deliver + Notify.delay.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was) end end end diff --git a/app/observers/key_observer.rb b/app/observers/key_observer.rb index a3f17bdec92..bf5fa647647 100644 --- a/app/observers/key_observer.rb +++ b/app/observers/key_observer.rb @@ -1,12 +1,12 @@ class KeyObserver < ActiveRecord::Observer - include GitHost + include Gitolited def after_save(key) - git_host.set_key(key.identifier, key.key, key.projects) + gitolite.set_key(key.identifier, key.key, key.projects) end def after_destroy(key) return if key.is_deploy_key && !key.last_deploy? - git_host.remove_key(key.identifier, key.projects) + gitolite.remove_key(key.identifier, key.projects) end end diff --git a/app/observers/merge_request_observer.rb b/app/observers/merge_request_observer.rb index c4040f1542d..6d3c2bdd186 100644 --- a/app/observers/merge_request_observer.rb +++ b/app/observers/merge_request_observer.rb @@ -3,7 +3,7 @@ class MergeRequestObserver < ActiveRecord::Observer def after_create(merge_request) if merge_request.assignee && merge_request.assignee != current_user - Notify.new_merge_request_email(merge_request.id).deliver + Notify.delay.new_merge_request_email(merge_request.id) end end @@ -25,7 +25,7 @@ class MergeRequestObserver < ActiveRecord::Observer recipients_ids.delete current_user.id recipients_ids.each do |recipient_id| - Notify.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was).deliver + Notify.delay.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was) end end end diff --git a/app/observers/note_observer.rb b/app/observers/note_observer.rb index 0a353cf1092..2ec644ef7c1 100644 --- a/app/observers/note_observer.rb +++ b/app/observers/note_observer.rb @@ -11,7 +11,7 @@ class NoteObserver < ActiveRecord::Observer notify_team(note) elsif note.notify_author # Notify only author of resource - Notify.note_commit_email(note.noteable.author_email, note.id).deliver + Notify.delay.note_commit_email(note.noteable.author_email, note.id) else # Otherwise ignore it nil @@ -26,7 +26,7 @@ class NoteObserver < ActiveRecord::Observer if Notify.respond_to? notify_method team_without_note_author(note).map do |u| - Notify.send(notify_method, u.id, note.id).deliver + Notify.delay.send(notify_method, u.id, note.id) end end end diff --git a/app/observers/user_observer.rb b/app/observers/user_observer.rb index 09b3c1d622f..c1179ed7881 100644 --- a/app/observers/user_observer.rb +++ b/app/observers/user_observer.rb @@ -2,7 +2,7 @@ class UserObserver < ActiveRecord::Observer def after_create(user) log_info("User \"#{user.name}\" (#{user.email}) was created") - Notify.new_user_email(user.id, user.password).deliver + Notify.delay.new_user_email(user.id, user.password) end def after_destroy user @@ -14,7 +14,7 @@ class UserObserver < ActiveRecord::Observer if user.namespace user.namespace.update_attributes(path: user.username) else - user.create_namespace!(path: user.username, name: user.name) + user.create_namespace!(path: user.username, name: user.username) end end end diff --git a/app/observers/users_project_observer.rb b/app/observers/users_project_observer.rb index 0c9c2b2614a..b969d6a13ef 100644 --- a/app/observers/users_project_observer.rb +++ b/app/observers/users_project_observer.rb @@ -1,7 +1,7 @@ class UsersProjectObserver < ActiveRecord::Observer def after_commit(users_project) return if users_project.destroyed? - Notify.project_access_granted_email(users_project.id).deliver + Notify.delay.project_access_granted_email(users_project.id) end def after_create(users_project) diff --git a/app/roles/account.rb b/app/roles/account.rb deleted file mode 100644 index ede12b6056d..00000000000 --- a/app/roles/account.rb +++ /dev/null @@ -1,124 +0,0 @@ -module Account - # Returns a string for use as a Gitolite user identifier - # - # Note that Gitolite 2.x requires the following pattern for users: - # - # ^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$ - def identifier - # Replace non-word chars with underscores, then make sure it starts with - # valid chars - email.gsub(/\W/, '_').gsub(/\A([\W\_])+/, '') - end - - def is_admin? - admin - end - - def require_ssh_key? - keys.count == 0 - end - - def can_create_project? - projects_limit > my_own_projects.count - end - - def can_create_group? - is_admin? - end - - def abilities - @abilities ||= begin - abilities = Six.new - abilities << Ability - abilities - end - end - - def can? action, subject - abilities.allowed?(self, action, subject) - end - - def last_activity_project - projects.first - end - - def first_name - name.split.first unless name.blank? - end - - def cared_merge_requests - MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id) - end - - def project_ids - projects.map(&:id) - end - - # Remove user from all projects and - # set blocked attribute to true - def block - users_projects.find_each do |membership| - return false unless membership.destroy - end - - self.blocked = true - save - end - - def projects_limit_percent - return 100 if projects_limit.zero? - (my_own_projects.count.to_f / projects_limit) * 100 - end - - def recent_push project_id = nil - # Get push events not earlier than 2 hours ago - events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours) - events = events.where(project_id: project_id) if project_id - - # Take only latest one - events = events.recent.limit(1).first - end - - def projects_sorted_by_activity - projects.sorted_by_activity - end - - def namespaces - namespaces = [] - - # Add user account namespace - namespaces << self.namespace if self.namespace - - # Add groups you can manage - namespaces += if admin - Group.all - else - groups.all - end - namespaces - end - - def several_namespaces? - namespaces.size > 1 - end - - def namespace_id - namespace.try :id - end - - def authorized_groups - @authorized_groups ||= begin - groups = Group.where(id: self.projects.pluck(:namespace_id)).all - groups = groups + self.groups - groups.uniq - end - end - - def authorized_projects - Project.authorized_for(self) - end - - def my_own_projects - Project.personal(self) - end -end diff --git a/app/roles/authority.rb b/app/roles/authority.rb deleted file mode 100644 index e0796d5f120..00000000000 --- a/app/roles/authority.rb +++ /dev/null @@ -1,58 +0,0 @@ -module Authority - # Compatible with all access rights - # Should be rewrited for new access rights - def add_access(user, *access) - access = if access.include?(:admin) - { project_access: UsersProject::MASTER } - elsif access.include?(:write) - { project_access: UsersProject::DEVELOPER } - else - { project_access: UsersProject::REPORTER } - end - opts = { user: user } - opts.merge!(access) - users_projects.create(opts) - end - - def reset_access(user) - users_projects.where(project_id: self.id, user_id: user.id).destroy if self.id - 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) - 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) - 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) - end - - def allow_read_for?(user) - !users_projects.where(user_id: user.id).empty? - end - - def guest_access_for?(user) - !users_projects.where(user_id: user.id).empty? - end - - def report_access_for?(user) - !users_projects.where(user_id: user.id, project_access: [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty? - end - - def dev_access_for?(user) - !users_projects.where(user_id: user.id, project_access: [UsersProject::DEVELOPER, UsersProject::MASTER]).empty? - end - - def master_access_for?(user) - !users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty? - end -end diff --git a/app/roles/git_host.rb b/app/roles/git_host.rb deleted file mode 100644 index aa620f77ea4..00000000000 --- a/app/roles/git_host.rb +++ /dev/null @@ -1,5 +0,0 @@ -module GitHost - def git_host - Gitlab::Gitolite.new - end -end diff --git a/app/roles/namespaced_project.rb b/app/roles/namespaced_project.rb deleted file mode 100644 index 8656890a456..00000000000 --- a/app/roles/namespaced_project.rb +++ /dev/null @@ -1,59 +0,0 @@ -module NamespacedProject - def transfer(new_namespace) - Project.transaction do - old_namespace = namespace - self.namespace = new_namespace - - old_dir = old_namespace.try(:path) || '' - new_dir = new_namespace.try(:path) || '' - - old_repo = if old_dir.present? - File.join(old_dir, self.path) - else - self.path - end - - if Project.where(path: self.path, namespace_id: new_namespace.try(:id)).present? - raise TransferError.new("Project with same path in target namespace already exists") - end - - Gitlab::ProjectMover.new(self, old_dir, new_dir).execute - - git_host.move_repository(old_repo, self) - - save! - end - rescue Gitlab::ProjectMover::ProjectMoveError => ex - raise TransferError.new(ex.message) - end - - def name_with_namespace - @name_with_namespace ||= begin - if namespace - namespace.human_name + " / " + name - else - name - end - end - end - - def namespace_owner - namespace.try(:owner) - end - - def chief - if namespace - namespace_owner - else - owner - end - end - - def path_with_namespace - if namespace - namespace.path + '/' + path - else - path - end - end -end diff --git a/app/roles/note_event.rb b/app/roles/note_event.rb deleted file mode 100644 index db4ced0c095..00000000000 --- a/app/roles/note_event.rb +++ /dev/null @@ -1,37 +0,0 @@ -module NoteEvent - def note_commit_id - target.commit_id - end - - def note_short_commit_id - note_commit_id[0..8] - end - - def note_commit? - target.noteable_type == "Commit" - end - - def note_target - target.noteable - end - - def note_target_id - if note_commit? - target.commit_id - else - target.noteable_id.to_s - end - end - - def wall_note? - target.noteable_type.blank? - end - - def note_target_type - if target.noteable_type.present? - target.noteable_type.titleize - else - "Wall" - end.downcase - end -end diff --git a/app/roles/push_event.rb b/app/roles/push_event.rb deleted file mode 100644 index 8ce71b54045..00000000000 --- a/app/roles/push_event.rb +++ /dev/null @@ -1,100 +0,0 @@ -module PushEvent - def valid_push? - data[:ref] - rescue => ex - false - end - - def tag? - data[:ref]["refs/tags"] - end - - def branch? - data[:ref]["refs/heads"] - end - - def new_branch? - commit_from =~ /^00000/ - end - - def new_ref? - commit_from =~ /^00000/ - end - - def rm_ref? - commit_to =~ /^00000/ - end - - def md_ref? - !(rm_ref? || new_ref?) - end - - def commit_from - data[:before] - end - - def commit_to - data[:after] - end - - def ref_name - if tag? - tag_name - else - branch_name - end - end - - def branch_name - @branch_name ||= data[:ref].gsub("refs/heads/", "") - end - - def tag_name - @tag_name ||= data[:ref].gsub("refs/tags/", "") - end - - # Max 20 commits from push DESC - def commits - @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse - end - - def commits_count - data[:total_commits_count] || commits.count || 0 - end - - def ref_type - tag? ? "tag" : "branch" - end - - def push_action_name - if new_ref? - "pushed new" - elsif rm_ref? - "deleted" - else - "pushed to" - end - end - - def parent_commit - project.commit(commit_from) - rescue => ex - nil - end - - def last_commit - project.commit(commit_to) - rescue => ex - nil - end - - def push_with_commits? - md_ref? && commits.any? && parent_commit && last_commit - rescue Grit::NoSuchPathError - false - end - - def last_push_to_non_root? - branch? && project.default_branch != branch_name - end -end diff --git a/app/roles/push_observer.rb b/app/roles/push_observer.rb deleted file mode 100644 index dda18267207..00000000000 --- a/app/roles/push_observer.rb +++ /dev/null @@ -1,144 +0,0 @@ -# Includes methods for handling Git Push events -# -# Triggered by PostReceive job -module PushObserver - # This method will be called after each post receive and only if the provided - # user is present in GitLab. - # - # All callbacks for post receive should be placed here. - def trigger_post_receive(oldrev, newrev, ref, user) - data = post_receive_data(oldrev, newrev, ref, user) - - # Create push event - self.observe_push(data) - - if push_to_branch? ref, oldrev - # Close merged MR - self.update_merge_requests(oldrev, newrev, ref, user) - - # Execute web hooks - self.execute_hooks(data.dup) - - # Execute project services - self.execute_services(data.dup) - end - - # Create satellite - self.satellite.create unless self.satellite.exists? - - # Discover the default branch, but only if it hasn't already been set to - # something else - if default_branch.nil? - update_attributes(default_branch: discover_default_branch) - end - end - - def push_to_branch? ref, oldrev - ref_parts = ref.split('/') - - # Return if this is not a push to a branch (e.g. new commits) - !(ref_parts[1] !~ /heads/ || oldrev == "00000000000000000000000000000000") - end - - def observe_push(data) - Event.create( - project: self, - action: Event::Pushed, - data: data, - author_id: data[:user_id] - ) - end - - def execute_hooks(data) - hooks.each { |hook| hook.execute(data) } - end - - def execute_services(data) - services.each do |service| - - # Call service hook only if it is active - service.execute(data) if service.active - end - end - - # Produce a hash of post-receive data - # - # data = { - # before: String, - # after: String, - # ref: String, - # user_id: String, - # user_name: String, - # repository: { - # name: String, - # url: String, - # description: String, - # homepage: String, - # }, - # commits: Array, - # total_commits_count: Fixnum - # } - # - def post_receive_data(oldrev, newrev, ref, user) - - push_commits = commits_between(oldrev, newrev) - - # Total commits count - push_commits_count = push_commits.size - - # Get latest 20 commits ASC - push_commits_limited = push_commits.last(20) - - # Hash to be passed as post_receive_data - data = { - before: oldrev, - after: newrev, - ref: ref, - user_id: user.id, - user_name: user.name, - repository: { - name: name, - url: web_url, - description: description, - homepage: web_url, - }, - commits: [], - total_commits_count: push_commits_count - } - - # For perfomance purposes maximum 20 latest commits - # will be passed as post receive hook data. - # - push_commits_limited.each do |commit| - data[:commits] << { - id: commit.id, - message: commit.safe_message, - timestamp: commit.date.xmlschema, - url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{commit.id}", - author: { - name: commit.author_name, - email: commit.author_email - } - } - end - - data - end - - def update_merge_requests(oldrev, newrev, ref, user) - return true unless ref =~ /heads/ - branch_name = ref.gsub("refs/heads/", "") - c_ids = self.commits_between(oldrev, newrev).map(&:id) - - # Update code for merge requests - mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all - mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } - - # Close merge requests - mrs = self.merge_requests.opened.where(target_branch: branch_name).all - mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) } - mrs.each { |merge_request| merge_request.merge!(user.id) } - - true - end -end diff --git a/app/roles/team.rb b/app/roles/team.rb deleted file mode 100644 index a7ba0588cf5..00000000000 --- a/app/roles/team.rb +++ /dev/null @@ -1,52 +0,0 @@ -module Team - def team_member_by_name_or_email(name = nil, email = nil) - user = users.where("name like ? or email like ?", name, email).first - users_projects.where(user: user) if user - end - - # Get Team Member record by user id - def team_member_by_id(user_id) - users_projects.find_by_user_id(user_id) - end - - # Add user to project - # with passed access role - def add_user_to_team(user, access_role) - add_user_id_to_team(user.id, access_role) - end - - # Add multiple users to project - # with same access role - def add_users_to_team(users, access_role) - add_users_ids_to_team(users.map(&:id), access_role) - end - - # Add user to project - # with passed access role by user id - def add_user_id_to_team(user_id, access_role) - users_projects.create( - user_id: user_id, - project_access: access_role - ) - end - - # Add multiple users to project - # with same access role by user ids - def add_users_ids_to_team(users_ids, access_role) - UsersProject.bulk_import(self, users_ids, access_role) - self.update_repository - end - - # Update multiple project users - # to same access role by user ids - def update_users_ids_to_role(users_ids, access_role) - UsersProject.bulk_update(self, users_ids, access_role) - self.update_repository - end - - # Delete multiple users from project by user ids - def delete_users_ids_from_team(users_ids) - UsersProject.bulk_delete(self, users_ids) - self.update_repository - end -end diff --git a/app/roles/votes.rb b/app/roles/votes.rb deleted file mode 100644 index 10fa120c6e9..00000000000 --- a/app/roles/votes.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Votes - - # Return the number of -1 comments (downvotes) - def downvotes - notes.select(&:downvote?).size - end - - def downvotes_in_percent - if votes_count.zero? - 0 - else - 100.0 - upvotes_in_percent - end - end - - # Return the number of +1 comments (upvotes) - def upvotes - notes.select(&:upvote?).size - end - - def upvotes_in_percent - if votes_count.zero? - 0 - else - 100.0 / votes_count * upvotes - end - end - - # Return the total number of votes - def votes_count - upvotes + downvotes - end -end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index bb7dc0dab10..391731d9470 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -1,49 +1,13 @@ # encoding: utf-8 class AttachmentUploader < CarrierWave::Uploader::Base - - # Include RMagick or ImageScience support: - # include CarrierWave::RMagick - # include CarrierWave::MiniMagick - # include CarrierWave::ImageScience - - # Choose what kind of storage to use for this uploader: storage :file - # storage :fog - # Override the directory where uploaded files will be stored. - # This is a sensible default for uploaders that are meant to be mounted: def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end - # Provide a default URL as a default if there hasn't been a file uploaded: - # def default_url - # "/images/fallback/" + [version_name, "default.png"].compact.join('_') - # end - - # Process files as they are uploaded: - # process scale: [200, 300] - # - # def scale(width, height) - # # do something - # end - - # Create different versions of your uploaded files: - # version :thumb do - # process scale: [50, 50] - # end - - # Add a white list of extensions which are allowed to be uploaded. - # For images you might use something like this: - # def extension_white_list - # %w(jpg jpeg gif png) - # end - - # Override the filename of the uploaded files: - # Avoid using model.id or version_name here, see uploader/store.rb for details. - # def filename - # "something.jpg" if original_filename - # end - + def image? + %w(png jpg jpeg).include?(file.extension) + end end diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index 4320bda4999..2e572aaba79 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -1,47 +1,28 @@ .admin_dash.row - .span3 + .span4 .ui-box - %h5 Projects + %h5.title Projects .data.padded = link_to admin_projects_path do %h1= Project.count %hr = link_to 'New Project', new_project_path, class: "btn small" - .span3 + .span4 .ui-box - %h5 Groups + %h5.title Groups .data.padded = link_to admin_groups_path do %h1= Group.count %hr = link_to 'New Group', new_admin_group_path, class: "btn small" - .span3 + .span4 .ui-box - %h5 Users + %h5.title Users .data.padded = link_to admin_users_path do %h1= User.count %hr = link_to 'New User', new_admin_user_path, class: "btn small" - .span3 - .ui-box - %h5 - Resque Workers - .data.padded - - if @resque_accessible - = link_to admin_resque_path do - %h1{class: @workers.present? ? "cgreen" : "cred"} - = @workers.count - %hr - %p - %strong{class: @pending_jobs > 0 ? "cred" : "cgreen"} - #{@pending_jobs} post receive jobs waiting - - else - = link_to admin_resque_path do - %h1.cdark ? - %hr - %p - %strong Resque status unknown .row .span6 diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 41f6d9b3516..0a25b125905 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -44,25 +44,57 @@ %div = f.submit 'Change Owner', class: "btn danger" = link_to "Cancel", "#", class: "btn change-owner-cancel-link" -%fieldset - %legend Projects (#{@group.projects.count}) - %table - %thead - %tr - %th Project name - %th Path - %th Users - %th.cred Danger Zone! - - @group.projects.each do |project| - %tr - %td - = link_to project.name_with_namespace, [:admin, project] - %td - %span.monospace= project.path_with_namespace + ".git" - %td= project.users.count - %td.bgred - = link_to 'Transfer project to global namespace', remove_project_admin_group_path(@group, project_id: project.id), confirm: 'Remove project from group and move to global namespace. Are you sure?', method: :delete, class: "btn danger small" +- if @group.projects.any? + %fieldset + %legend Projects (#{@group.projects.count}) + %table + %thead + %tr + %th Project name + %th Path + %th Users + %th.cred Danger Zone! + - @group.projects.each do |project| + %tr + %td + = link_to project.name_with_namespace, [:admin, project] + %td + %span.monospace= project.path_with_namespace + ".git" + %td= project.users.count + %td.bgred + = link_to 'Transfer project to global namespace', remove_project_admin_group_path(@group, project_id: project.id), confirm: 'Remove project from group and move to global namespace. Are you sure?', method: :delete, class: "btn danger small" + + = form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do + %table.zebra-striped + %thead + %tr + %th Users + %th Project Access: + + - @group.users.each do |u| + %tr{class: "user_#{u.id}"} + %td.name= link_to u.name, admin_user_path(u) + %td.projects_access + - u.authorized_projects.in_namespace(@group).each do |project| + - u_p = u.users_projects.in_project(project).first + - next unless u_p + %span + = project.name + = link_to "(#{ u_p.project_access_human })", edit_admin_team_member_path(u_p) + %tr + %td.input= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5' + %td= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3"} + + %tr + %td= submit_tag 'Add user to projects in group', class: "btn primary" + %td + Read more about project permissions + %strong= link_to "here", help_permissions_path, class: "vlink" + +- else + %fieldset + %legend Group is empty = form_tag project_update_admin_group_path(@group), class: "bulk_import", method: :put do %fieldset diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml index 27c22872d50..36c0c655cae 100644 --- a/app/views/admin/projects/_form.html.haml +++ b/app/views/admin/projects/_form.html.haml @@ -11,18 +11,18 @@ .input = f.text_field :name, placeholder: "Example Project", class: "xxlarge" - %fieldset.adv_settings - %legend Advanced settings: - .clearfix - = f.label :path do - Path - .input - = text_field_tag :ppath, @project.path_to_repo, class: "xlarge", disabled: true + - if project.repo_exists? + %fieldset.adv_settings + %legend Advanced settings: + .clearfix + = f.label :path do + Path + .input + = text_field_tag :ppath, @project.repository.path_to_repo, class: "xlarge", disabled: true - - if project.repo_exists? .clearfix = f.label :default_branch, "Default Branch" - .input= f.select(:default_branch, project.heads.map(&:name), {}, style: "width:210px;") + .input= f.select(:default_branch, @project.repository.heads.map(&:name), {}, style: "width:210px;") %fieldset.adv_settings %legend Features: diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 310cfa53890..1f5b31eca5f 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -1,5 +1,5 @@ %h3.page_title - Projects (#{@projects.count}) + Projects (#{Project.count}) = link_to 'New Project', new_project_path, class: "btn small right" %br = form_tag admin_projects_path, method: :get, class: 'form-inline' do @@ -15,6 +15,7 @@ %i.icon-sort-down %th Path %th Team Members + %th Owner %th Last Commit %th Edit %th.cred Danger Zone! @@ -26,6 +27,11 @@ %td %span.monospace= project.path_with_namespace + ".git" %td= project.users_projects.count + %td + - if project.owner + = link_to project.owner.name, [:admin, project.owner] + - else + (deleted) %td= last_commit(project) %td= link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small" %td.bgred= link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger" diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 634b1836754..5a745f58fe3 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -4,15 +4,15 @@ %i.icon-edit Edit -- if @project.has_commits? - - if !@project.has_post_receive_file? +- if @repository && @repository.has_commits? + - if !@repository.has_post_receive_file? %br .alert.alert-error %span %strong Project has commits but missing post-receive file. %br If you exported project manually - make a link of post-receive hook file from gitolite to project repository - - elsif !@project.valid_post_receive_file? + - elsif !@repository.valid_post_receive_file? %br .alert.alert-error %span @@ -49,8 +49,8 @@ %b Owned by: %td - - if @project.chief - = link_to @project.chief.name, admin_user_path(@project.chief) + - if @project.owner + = link_to @project.owner_name, admin_user_path(@project.owner) - else (deleted) %tr @@ -58,49 +58,50 @@ %b Created by: %td - = @project.owner_name || '(deleted)' + = @project.creator.try(:name) || '(deleted)' %tr %td %b Created at: %td = @project.created_at.stamp("March 1, 1999") - -%table.zebra-striped - %thead %tr - %th Repository - %th - %tr - %td - %b - FS Path: - %td - %code= @project.path_to_repo - %tr - %td - %b - Smart HTTP: - %td - = link_to @project.http_url_to_repo - %tr - %td - %b - SSH: - %td - = link_to @project.ssh_url_to_repo - %tr - %td - %b - Last commit at: - %td - = last_commit(@project) - %tr - %td - %b - Post Receive File: - %td - = check_box_tag :post_receive_file, 1, @project.has_post_receive_file?, disabled: true + %td + %b + Smart HTTP: + %td + = link_to @project.http_url_to_repo + %tr + %td + %b + SSH: + %td + = link_to @project.ssh_url_to_repo + +- if @repository + %table.zebra-striped + %thead + %tr + %th Repository + %th + %tr + %td + %b + FS Path: + %td + %code= @repository.path_to_repo + %tr + %td + %b + Last commit at: + %td + = last_commit(@project) + %tr + %td + %b + Post Receive File: + %td + = check_box_tag :post_receive_file, 1, @repository.has_post_receive_file?, disabled: true %br %h5 diff --git a/app/views/admin/resque/show.html.haml b/app/views/admin/resque/show.html.haml index 41254a6b6c2..499738f9a06 100644 --- a/app/views/admin/resque/show.html.haml +++ b/app/views/admin/resque/show.html.haml @@ -1,4 +1,4 @@ -%h3.page_title Resque +%h3.page_title Background Jobs %br .ui-box - %iframe{src: resque_path, width: '100%', height: 600, style: "border: none"} + %iframe{src: sidekiq_path, width: '100%', height: 900, style: "border: none"} diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 1df4f590bcb..87290abe7a6 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -1,5 +1,5 @@ %h3.page_title - Users (#{@admin_users.count}) + Users = link_to 'New User', new_admin_user_path, class: "btn small right" %br @@ -8,16 +8,21 @@ = submit_tag "Search", class: "btn submit primary" %ul.nav.nav-tabs %li{class: "#{'active' unless params[:filter]}"} - = link_to "Active", admin_users_path + = link_to admin_users_path do + Active + %span.badge= User.active.count %li{class: "#{'active' if params[:filter] == "admins"}"} = link_to admin_users_path(filter: "admins") do Admins + %span.badge= User.admins.count %li{class: "#{'active' if params[:filter] == "blocked"}"} = link_to admin_users_path(filter: "blocked") do Blocked + %span.badge= User.blocked.count %li{class: "#{'active' if params[:filter] == "wop"}"} = link_to admin_users_path(filter: "wop") do Without projects + %span.badge= User.without_projects.count %table %thead diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 852aead79e2..db132359c7f 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -106,8 +106,8 @@ %td= link_to group.name, admin_group_path(group) -- if @admin_user.projects.present? - %h5 Projects: +- if @admin_user.personal_projects.present? + %h5 Personal Projects: %br %table.zebra-striped @@ -118,7 +118,7 @@ %th %th - - @admin_user.users_projects.each do |tm| + - @admin_user.tm_in_personal_projects.each do |tm| - project = tm.project %tr %td= link_to project.name_with_namespace, admin_project_path(project) diff --git a/app/views/commit/show.html.haml b/app/views/commit/show.html.haml index 5ba43f951dc..f920534e03a 100644 --- a/app/views/commit/show.html.haml +++ b/app/views/commit/show.html.haml @@ -1,4 +1,11 @@ = render "commits/commit_box" + +%p.right.cgray + This commit has + %span.cgreen #{@commit.stats.additions} additions + and + %span.cred #{@commit.stats.deletions} deletions + = render "commits/diffs", diffs: @commit.diffs = render "notes/notes_with_form" @@ -16,5 +23,7 @@ , h = event.currentTarget.naturalHeight; $('.image.diff_added .image-info', this).append(' | W: ' + w + 'px | H: ' + h + 'px'); }, this)); + }); + }); diff --git a/app/views/commits/_commit.html.haml b/app/views/commits/_commit.html.haml index 156ff1e9d85..eb0312d01e1 100644 --- a/app/views/commits/_commit.html.haml +++ b/app/views/commits/_commit.html.haml @@ -14,8 +14,8 @@   %span.notes_count - - notes = @project.commit_notes(commit) + @project.commit_line_notes(commit) + - notes = @project.notes.for_commit_id(commit.id) - if notes.any? - %span.btn.small.disabled.grouped + %span.btn.disabled.grouped %i.icon-comment = notes.count diff --git a/app/views/commits/_commit_box.html.haml b/app/views/commits/_commit_box.html.haml index 8f7826e0c8d..0544a1d10fe 100644 --- a/app/views/commits/_commit_box.html.haml +++ b/app/views/commits/_commit_box.html.haml @@ -1,47 +1,50 @@ -.commit-box{class: @commit.parents_count > 1 ? "merge-commit" : ""} - .commit-head +.ui-box.ui-box-show + .ui-box-head .right - if @notes_count > 0 %span.btn.disabled.grouped %i.icon-comment = @notes_count .left.btn-group - %a.btn.small.grouped.dropdown-toggle{ data: {toggle: :dropdown} } + %a.btn.grouped.dropdown-toggle{ data: {toggle: :dropdown} } %i.icon-download-alt Download as %span.caret %ul.dropdown-menu %li= link_to "Email Patches", project_commit_path(@project, @commit, format: :patch) %li= link_to "Plain Diff", project_commit_path(@project, @commit, format: :diff) - = link_to project_tree_path(@project, @commit), class: "browse-button primary grouped" do - %strong Browse Code » + = link_to project_tree_path(@project, @commit), class: "btn primary grouped" do + %span Browse Code » %h3.commit-title.page_title = gfm escape_once(@commit.title) - if @commit.description.present? %pre.commit-description = gfm escape_once(@commit.description) - .commit-info + .ui-box-body .row .span5 .author - %strong= @commit.author_link avatar: true, size: 40 + = @commit.author_link avatar: true, size: 32 authored %time{title: @commit.authored_date.stamp("Aug 21, 2011 9:23pm")} #{time_ago_in_words(@commit.authored_date)} ago - if @commit.different_committer? .committer → - %strong= @commit.committer_link + = @commit.committer_link committed %time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")} #{time_ago_in_words(@commit.committed_date)} ago - .span6.right - .sha-block - %span.cgray commit - %code.label_commit= @commit.id - .sha-block - %span.cgray= pluralize(@commit.parents.count, "parent") - - @commit.parents.each do |parent| - = link_to parent.id[0...10], project_commit_path(@project, parent) + .span6.pull-right + .pull-right + .sha-block + %span.cgray commit + %span.label_commit= @commit.id + .clearfix + .pull-right + .sha-block + %span.cgray= pluralize(@commit.parents.count, "parent") + - @commit.parents.each do |parent| + = link_to parent.id[0...10], project_commit_path(@project, parent) diff --git a/app/views/commits/_commits.html.haml b/app/views/commits/_commits.html.haml index c9217989884..0dc6664c1d6 100644 --- a/app/views/commits/_commits.html.haml +++ b/app/views/commits/_commits.html.haml @@ -1,6 +1,6 @@ - @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits| %div.ui-box - %h5.small + %h5.title %i.icon-calendar = day.stamp("28 Aug, 2010") %ul.well-list= render commits diff --git a/app/views/commits/_head.html.haml b/app/views/commits/_head.html.haml index 2ec1d24bbef..a5f3fdf5c5e 100644 --- a/app/views/commits/_head.html.haml +++ b/app/views/commits/_head.html.haml @@ -2,19 +2,19 @@ %li= render partial: 'shared/ref_switcher', locals: {destination: 'commits'} = nav_link(controller: [:commit, :commits]) do - = link_to 'Commits', project_commits_path(@project, @project.root_ref) + = link_to 'Commits', project_commits_path(@project, @repository.root_ref) = nav_link(controller: :compare) do = link_to 'Compare', project_compare_index_path(@project) = nav_link(html_options: {class: branches_tab_class}) do = link_to project_repository_path(@project) do Branches - %span.badge= @project.branches.length + %span.badge= @repository.branches.length = nav_link(controller: :repositories, action: :tags) do = link_to tags_project_repository_path(@project) do Tags - %span.badge= @project.tags.length + %span.badge= @repository.tags.length = nav_link(controller: :repositories, action: :stats) do = link_to stats_project_repository_path(@project) do diff --git a/app/views/commits/_text_diff.html.haml b/app/views/commits/_text_diff.html.haml index f5784dea511..ce07b87d548 100644 --- a/app/views/commits/_text_diff.html.haml +++ b/app/views/commits/_text_diff.html.haml @@ -15,7 +15,7 @@ - if @comments_allowed = render "notes/diff_note_link", line_code: line_code %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) - if @reply_allowed - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) diff --git a/app/views/compare/_form.html.haml b/app/views/compare/_form.html.haml index 7e3a2a0e1f5..0915782dddc 100644 --- a/app/views/compare/_form.html.haml +++ b/app/views/compare/_form.html.haml @@ -28,7 +28,7 @@ :javascript $(function() { - var availableTags = #{@project.ref_names.to_json}; + var availableTags = #{@project.repository.ref_names.to_json}; $("#from, #to").autocomplete({ source: availableTags, diff --git a/app/views/compare/show.html.haml b/app/views/compare/show.html.haml index 2abbd3fc0ee..d8ea3727d57 100644 --- a/app/views/compare/show.html.haml +++ b/app/views/compare/show.html.haml @@ -8,7 +8,8 @@ - if @commits.present? %div.ui-box - %h5.small Commits (#{@commits.count}) + %h5.title + Commits (#{@commits.count}) %ul.well-list= render @commits - unless @diffs.empty? diff --git a/app/views/dashboard/_activities.html.haml b/app/views/dashboard/_activities.html.haml index c63ef24fca5..2b7d23c225d 100644 --- a/app/views/dashboard/_activities.html.haml +++ b/app/views/dashboard/_activities.html.haml @@ -7,7 +7,7 @@ = event_filter_link EventFilter.team, 'Team' - if @events.any? - .content_list= render @events + .content_list - else %p.nothing_here_message Projects activity will be displayed here .loading.hide diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml index 9e3401e51b8..7f544406761 100644 --- a/app/views/dashboard/_groups.html.haml +++ b/app/views/dashboard/_groups.html.haml @@ -1,5 +1,5 @@ .groups_box - %h5 + %h5.title Groups %small (#{groups.count}) @@ -17,4 +17,4 @@ → %span.last_activity %strong Projects: - %span= group.projects.authorized_for(current_user).count + %span= current_user.authorized_projects.where(namespace_id: group.id).count diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml index cffafb5445c..6c1304ee4a8 100644 --- a/app/views/dashboard/_projects.html.haml +++ b/app/views/dashboard/_projects.html.haml @@ -1,5 +1,5 @@ .projects_box - %h5 + %h5.title Projects %small (#{projects.total_count}) diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index b64aa86cf73..abbe3101fc3 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -7,5 +7,3 @@ - else = render "zero_authorized_projects" -:javascript - $(function(){ Pager.init(20); }); diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 52863229644..68e3b3dcaf5 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -13,7 +13,8 @@ - @issues.group_by(&:project).each do |group| %div.ui-box - @project = group[0] - %h5= link_to_project @project + %h5.title + = link_to_project @project %ul.well-list.issues_table - group[1].each do |issue| = render(partial: 'issues/show', locals: {issue: issue}) diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index ea7c8c9a3d5..c5245da731a 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -12,7 +12,8 @@ - @merge_requests.group_by(&:project).each do |group| .ui-box - @project = group[0] - %h5= link_to_project @project + %h5.title + = link_to_project @project %ul.well-list - group[1].each do |merge_request| = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index 8c12969345f..7b57f424d61 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -19,7 +19,6 @@ = event.project_name .event-body - %span.hint -   - %i.icon-comment + %span.event-note + %i.icon-comment-alt = truncate event.target.note, length: 70 diff --git a/app/views/groups/_filter.html.haml b/app/views/groups/_filter.html.haml new file mode 100644 index 00000000000..c8b0ad0f433 --- /dev/null +++ b/app/views/groups/_filter.html.haml @@ -0,0 +1,33 @@ += form_tag group_filter_path(entity), method: 'get' do + %fieldset.dashboard-search-filter + = search_field_tag "search", params[:search], { placeholder: 'Search', class: 'search-text-input' } + = button_tag type: 'submit', class: 'btn' do + %i.icon-search + + %fieldset + %legend Status: + %ul.nav.nav-pills.nav-stacked + %li{class: ("active" if !params[:status])} + = link_to group_filter_path(entity, status: nil) do + Open + %li{class: ("active" if params[:status] == 'closed')} + = link_to group_filter_path(entity, status: 'closed') do + Closed + %li{class: ("active" if params[:status] == 'all')} + = link_to group_filter_path(entity, status: 'all') do + All + + %fieldset + %legend Projects: + %ul.nav.nav-pills.nav-stacked + - @projects.each do |project| + - unless entities_per_project(project, entity).zero? + %li{class: ("active" if params[:project_id] == project.id.to_s)} + = link_to group_filter_path(entity, project_id: project.id) do + = project.name_with_namespace + %small.right= entities_per_project(project, entity) + + %fieldset + %hr + = link_to "Reset", group_filter_path(entity), class: 'btn right' + diff --git a/app/views/groups/_new_group_member.html.haml b/app/views/groups/_new_group_member.html.haml new file mode 100644 index 00000000000..2d599816e2a --- /dev/null +++ b/app/views/groups/_new_group_member.html.haml @@ -0,0 +1,18 @@ += form_for @team_member, as: :team_member, url: team_members_group_path(@group) do |f| + %fieldset + %legend= "New Team member(s) for projects in #{@group.name}" + + %h6 1. Choose people you want in the team + .clearfix + = f.label :user_ids, "People" + .input= select_tag(:user_ids, options_from_collection_for_select(User.active.alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) + + %h6 2. Set access level for them + .clearfix + = f.label :project_access, "Project Access" + .input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen" + + .form-actions + = hidden_field_tag :redirect_to, people_group_path(@group) + = f.submit 'Add', class: "btn save-btn" + diff --git a/app/views/groups/_new_member.html.haml b/app/views/groups/_new_member.html.haml index f48c2c23d83..89ac05e774e 100644 --- a/app/views/groups/_new_member.html.haml +++ b/app/views/groups/_new_member.html.haml @@ -5,7 +5,7 @@ %h6 1. Choose people you want in the team .clearfix = f.label :user_ids, "People" - .input= select_tag(:user_ids, options_from_collection_for_select(User.not_in_project(@project).all, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) + .input= select_tag(:user_ids, options_from_collection_for_select(User.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) %h6 2. Set access level for them .clearfix diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml index 0b491879fe0..040d1ae94aa 100644 --- a/app/views/groups/_projects.html.haml +++ b/app/views/groups/_projects.html.haml @@ -1,5 +1,5 @@ .projects_box - %h5 + %h5.title Projects %small (#{projects.count}) diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 0daf4d752a8..ffca2dc75ea 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -3,17 +3,21 @@ %small (assigned to you) %small.right #{@issues.total_count} issues -%br -.clearfix -- if @issues.any? - - @issues.group_by(&:project).each do |group| - %div.ui-box - - @project = group[0] - %h5= @project.name - %ul.well-list.issues_table - - group[1].each do |issue| - = render(partial: 'issues/show', locals: {issue: issue}) - %hr - = paginate @issues, theme: "gitlab" -- else - %h3.nothing_here_message Nothing to show here +%hr +.row + .span3 + = render 'filter', entity: 'issue' + .span9 + - if @issues.any? + - @issues.group_by(&:project).each do |group| + %div.ui-box + - @project = group[0] + %h5.title + = link_to_project @project + %ul.well-list.issues_table + - group[1].each do |issue| + = render(partial: 'issues/show', locals: {issue: issue}) + %hr + = paginate @issues, theme: "gitlab" + - else + %p.nothing_here_message Nothing to show here diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 72aa4ad11e1..c5245da731a 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -3,16 +3,22 @@ %small (authored by or assigned to you) %small.right #{@merge_requests.total_count} merge requests -%br -- if @merge_requests.any? - - @merge_requests.group_by(&:project).each do |group| - %ul.well-list.ui-box - - @project = group[0] - %h5= @project.name - - group[1].each do |merge_request| - = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) - %hr - = paginate @merge_requests, theme: "gitlab" +%hr +.row + .span3 + = render 'filter', entity: 'merge_request' + .span9 + - if @merge_requests.any? + - @merge_requests.group_by(&:project).each do |group| + .ui-box + - @project = group[0] + %h5.title + = link_to_project @project + %ul.well-list + - group[1].each do |merge_request| + = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) + %hr + = paginate @merge_requests, theme: "gitlab" -- else - %h3.nothing_here_message Nothing to show here + - else + %h3.nothing_here_message Nothing to show here diff --git a/app/views/groups/people.html.haml b/app/views/groups/people.html.haml index be3dd7a4d78..0bceeaa3ceb 100644 --- a/app/views/groups/people.html.haml +++ b/app/views/groups/people.html.haml @@ -2,10 +2,10 @@ .span3 = render 'people_filter' .span9 - - if @project && can?(current_user, :manage_group, @group) - = render "new_member" + - if can?(current_user, :manage_group, @group) + = render (@project ? "new_member" : "new_group_member") .ui-box - %h5 + %h5.title Team %small (#{@users.size}) diff --git a/app/views/groups/search.html.haml b/app/views/groups/search.html.haml index 6ca5630f43d..1ba4707aa52 100644 --- a/app/views/groups/search.html.haml +++ b/app/views/groups/search.html.haml @@ -6,70 +6,4 @@ = search_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge search-text-input", id: "dashboard_search" = submit_tag 'Search', class: "btn primary wide" - if params[:search].present? - %br - %h3 - Search results - %small (#{@projects.count + @merge_requests.count + @issues.count}) - %hr - .search_results - .row - .span6 - %table - %thead - %tr - %th Projects - %tbody - - @projects.each do |project| - %tr - %td - = link_to project do - %strong.term= project.name - %small.cgray - last activity at - = project.last_activity_date.stamp("Aug 25, 2011") - - if @projects.blank? - %tr - %td - %h4.nothing_here_message No Projects - %br - %table - %thead - %tr - %th Merge Requests - %tbody - - @merge_requests.each do |merge_request| - %tr - %td - = link_to [merge_request.project, merge_request] do - %span.badge.badge-info ##{merge_request.id} - – - %strong.term= truncate merge_request.title, length: 50 - %strong.right - %span.label= merge_request.project.name - - if @merge_requests.blank? - %tr - %td - %h4.nothing_here_message No Merge Requests - .span6 - %table - %thead - %tr - %th Issues - %tbody - - @issues.each do |issue| - %tr - %td - = link_to [issue.project, issue] do - %span.badge.badge-info ##{issue.id} - – - %strong.term= truncate issue.title, length: 40 - %strong.right - %span.label= issue.project.name - - if @issues.blank? - %tr - %td - %h4.nothing_here_message No Issues - :javascript - $(function() { - $(".search_results .term").highlight("#{params[:search]}"); - }) + = render 'search/result' diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 76bc2639d61..d7d3f869895 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -7,7 +7,7 @@ %span.cgray Events and projects are filtered in scope of group %hr - if @events.any? - .content_list= render @events + .content_list - else %p.nothing_here_message Projects activity will be displayed here .loading.hide @@ -26,4 +26,4 @@ = link_to "@gitlabhq", "https://twitter.com/gitlabhq" :javascript - $(function(){ Pager.init(20); }); + $(function(){ Pager.init(20, true); }); diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index ebd499c05e0..dc22b672cb7 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -9,31 +9,41 @@ %br Fast, secure and stable solution based on Ruby on Rails & Gitolite. -%hr +%br -%h3 Help +.row + .span6 + .ui-box + .title + %h5 Help + %ul.well-list + %li + %span= link_to "Workflow", help_workflow_path -%ol - %li - %h5= link_to "Workflow", help_workflow_path + %li + %span= link_to "Permissions", help_permissions_path - %li - %h5= link_to "Permissions", help_permissions_path + %li + %span= link_to "Web Hooks", help_web_hooks_path - %li - %h5= link_to "Web Hooks", help_web_hooks_path + %li + %span= link_to "API", help_api_path - %li - %h5= link_to "System Hooks", help_system_hooks_path + %li + %span= link_to "GitLab Markdown", help_markdown_path - %li - %h5= link_to "API", help_api_path + %li + %span= link_to "SSH keys", help_ssh_path - %li - %h5= link_to "GitLab Markdown", help_markdown_path + .span6 + .ui-box + .title + %h5 Admin Guide + %ul.well-list - %li - %h5= link_to "SSH keys", help_ssh_path + %li + %span= link_to "GitLab Rake Tasks", help_raketasks_path + + %li + %span= link_to "System Hooks", help_system_hooks_path - %li - %h5= link_to "GitLab Rake Tasks", help_raketasks_path diff --git a/app/views/help/markdown.html.haml b/app/views/help/markdown.html.haml index aa608ed6d9a..0419f7c131a 100644 --- a/app/views/help/markdown.html.haml +++ b/app/views/help/markdown.html.haml @@ -1,6 +1,6 @@ %h3.page_title GitLab Flavored Markdown .back_link - = link_to help_path do + = link_to help_path do ← to index %hr @@ -120,7 +120,7 @@ for commits -# this example will only be shown if the user has a project with at least one issue - - if @project = current_user.projects.first + - if @project = current_user.authorized_projects.first - if issue = @project.issues.first %p For example in your #{link_to @project.name, project_path(@project)} project, writing: %pre= "This is related to ##{issue.id}. @#{current_user.name} is working on solving it." diff --git a/app/views/help/raketasks.html.haml b/app/views/help/raketasks.html.haml index 62cfa1521a7..f015451a673 100644 --- a/app/views/help/raketasks.html.haml +++ b/app/views/help/raketasks.html.haml @@ -16,6 +16,8 @@ = link_to "User Management", "#user_management", 'data-toggle' => 'tab' %li = link_to "Backup & Restore", "#backup_restore", 'data-toggle' => 'tab' + %li + = link_to "Cleanup", "#cleanup", 'data-toggle' => 'tab' .tab-content .tab-pane.active#features @@ -45,6 +47,15 @@ = preserve do = markdown File.read(Rails.root.join("doc", "raketasks", "user_management.md")) + .tab-pane#cleanup + .file_holder + .file_title + %i.icon-file + Cleanup + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "cleanup.md")) + .tab-pane#backup_restore .file_holder .file_title diff --git a/app/views/hooks/_data_ex.html.erb b/app/views/hooks/_data_ex.html.erb index 7dd6b9e0750..b4281fa18c7 100644 --- a/app/views/hooks/_data_ex.html.erb +++ b/app/views/hooks/_data_ex.html.erb @@ -1,45 +1,43 @@ <% data_ex_str = < "95790bf891e76fee5e1747ab589903a6a1f80f22", - :after => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", - :ref => "refs/heads/master", - :user_id => 4, - :user_name => "John Smith", - :repository => { - :name => "Diaspora", - :url => "localhost/diaspora", - :description => "", - :homepage => "localhost/diaspora", - :private => true + "before": "95790bf891e76fee5e1747ab589903a6a1f80f22", + "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "ref": "refs/heads/master", + "user_id": 4, + "user_name": "John Smith", + "repository": { + "name": "Diaspora", + "url": "git@localhost:diaspora.git", + "description": "", + "homepage": "http://localhost/diaspora", + }, + "commits": [ + { + "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", + "message": "Update Catalan translation to e38cb41.", + "timestamp": "2011-12-12T14:27:31+02:00", + "url": "http://localhost/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", + "author": { + "name": "Jordi Mallach", + "email": "jordi@softcatala.org", + } }, - :commits => [ - [0] { - :id => "450d0de7532f8b663b9c5cce183b...", - :message => "Update Catalan translation to e38cb41.", - :timestamp => "2011-12-12T14:27:31+02:00", - :url => "http://localhost/diaspora/commits/450d0de7532f...", - :author => { - :name => "Jordi Mallach", - :email => "jordi@softcatala.org" - } - }, - - .... - - [3] { - :id => "da1560886d4f094c3e6c9ef40349...", - :message => "fixed readme", - :timestamp => "2012-01-03T23:36:29+02:00", - :url => "http://localhost/diaspora/commits/da1560886d...", - :author => { - :name => "GitLab dev user", - :email => "gitlabdev@dv6700.(none)" - } - } - ], - total_commits_count => 4 -} + // ... + { + "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "message": "fixed readme", + "timestamp": "2012-01-03T23:36:29+02:00", + "url": "http://localhost/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "author": { + "name": "GitLab dev user", + "email": "gitlabdev@dv6700.(none)", + }, + }, + ], + "total_commits_count": 4, +}; eos %> -<% js_lexer = Pygments::Lexer[:js] %> -<%= raw js_lexer.highlight(data_ex_str) %> +
+ <%= raw Pygments::Lexer[:js].highlight(data_ex_str) %> +
diff --git a/app/views/issues/_filter.html.haml b/app/views/issues/_filter.html.haml new file mode 100644 index 00000000000..9b710a71772 --- /dev/null +++ b/app/views/issues/_filter.html.haml @@ -0,0 +1,20 @@ += form_tag project_issues_path(@project), method: 'get' do + %fieldset + %ul.nav.nav-pills.nav-stacked + %li{class: ("active" if !params[:status])} + = link_to project_issues_path(@project, status: nil) do + Open + %li{class: ("active" if params[:status] == 'to_me')} + = link_to project_issues_path(@project, status: 'to_me') do + Assigned To Me + %li{class: ("active" if params[:status] == 'closed')} + = link_to project_issues_path(@project, status: 'closed') do + Closed + %li{class: ("active" if params[:status] == 'all')} + = link_to project_issues_path(@project, status: 'all') do + All + + %fieldset + %hr + = link_to "Reset", project_issues_path(@project), class: 'btn right' + diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index 030f797c088..bef235f2dea 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -6,26 +6,27 @@ - @issue.errors.full_messages.each do |msg| %span= msg %br - .issue_form_box - .issue_title + .ui-box.ui-box-show + .ui-box-head .clearfix = f.label :title do %strong= "Subject *" .input = f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true, required: true - .issue_middle_block - .issue_assignee - = f.label :assignee_id do - %i.icon-user - Assign to - .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) - .issue_milestone - = f.label :milestone_id do - %i.icon-time - Milestone - .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) + .ui-box-body + .clearfix + .issue_assignee.pull-left + = f.label :assignee_id do + %i.icon-user + Assign to + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) + .issue_milestone.pull-left + = f.label :milestone_id do + %i.icon-time + Milestone + .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) - .issue_description + .ui-box-bottom .clearfix = f.label :label_list do %i.icon-tag @@ -43,7 +44,7 @@ .actions - if @issue.new_record? - = f.submit 'Submit new issue', class: "btn save-btn" + = f.submit 'Submit new issue', class: "btn success" -else = f.submit 'Save changes', class: "save-btn btn" diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml index d7ba4300ce7..8821dbb8d98 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/issues/_issues.html.haml @@ -3,12 +3,10 @@ - if @issues.present? %li.bottom - .row - .span7= paginate @issues, remote: true, theme: "gitlab" - .span3.right - %span.cgray.right - %span.issue_counter #{@issues.total_count} - issues for this filter + .left= paginate @issues, remote: true, theme: "gitlab" + .right + %span.issue_counter #{@issues.total_count} + issues for this filter - else %li %h4.nothing_here_message Nothing to show here diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index 4641e8bdc63..dcef901c15f 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -3,10 +3,6 @@ .issue_check = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue", disabled: !can?(current_user, :modify_issue, issue) .right - - issue.labels.each do |label| - %span.label.label-tag.grouped - %i.icon-tag - = label.name - if issue.notes.any? %span.btn.small.disabled.grouped %i.icon-comment @@ -36,3 +32,8 @@ - if issue.votes_count > 0 = render 'votes/votes_inline', votable: issue + %span + - issue.labels.each do |label| + %span.label + %i.icon-tag + = label.name diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index 08d4393b201..d5c29c780ce 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -2,61 +2,47 @@ .issues_content %h3.page_title Issues - %small (#{@issues.total_count}) + %span (#{@issues.total_count}) .right .span5 - if can? current_user, :write_issue, @project - = link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "right btn", title: "New Issue", id: "new_issue_link" do + = link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "right btn primary", title: "New Issue", id: "new_issue_link" do %i.icon-plus New Issue = form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do = hidden_field_tag :project_id, @project.id, { id: 'project_id' } - = hidden_field_tag :status, params[:f] + = hidden_field_tag :status, params[:status] = search_field_tag :issue_search, nil, { placeholder: 'Search', class: 'issue_search span3 right neib search-text-input' } .clearfix - %div#issues-table-holder.ui-box - .title - = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left" - - - .issues_bulk_update.hide - = form_tag bulk_update_project_issues_path(@project), method: :post do - %span.update_issues_text Update selected issues with   - .left - = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") - = hidden_field_tag 'update[issues_ids]', [] - = hidden_field_tag :f, params[:f] - = button_tag "Save", class: "btn update_selected_issues" - .issues_filters - .left - %ul.nav.nav-pills.left - %li{class: ("active" if (params[:f] == issues_filter[:open] || !params[:f]))} - = link_to project_issues_path(@project, f: issues_filter[:open], milestone_id: params[:milestone_id]) do - Open - %li{class: ("active" if params[:f] == issues_filter[:closed])} - = link_to project_issues_path(@project, f: issues_filter[:closed], milestone_id: params[:milestone_id]) do - Closed - %li{class: ("active" if params[:f] == issues_filter[:to_me])} - = link_to project_issues_path(@project, f: issues_filter[:to_me], milestone_id: params[:milestone_id]) do - To Me - %li{class: ("active" if params[:f] == issues_filter[:all])} - = link_to project_issues_path(@project, f: issues_filter[:all], milestone_id: params[:milestone_id]) do - All - - .right - = form_tag project_issues_path(@project), method: :get, class: :right do - = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels") - = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") - = hidden_field_tag :f, params[:f] +.row + .span3 + = render 'filter', entity: 'issue' + .span9 + %div#issues-table-holder.ui-box + .title + = check_box_tag "check_all_issues", nil, false, class: "check_all_issues left" .clearfix + .issues_bulk_update.hide + = form_tag bulk_update_project_issues_path(@project), method: :post do + %span.update_issues_text Update selected issues with   + .left + = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") + = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") + = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") + = hidden_field_tag 'update[issues_ids]', [] + = hidden_field_tag :status, params[:status] + = button_tag "Save", class: "btn update_selected_issues btn-small save-btn" + .issues_filters + = form_tag project_issues_path(@project), method: :get do + = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels") + = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") + = hidden_field_tag :status, params[:status] - %ul#issues-table.well-list.issues_table - = render "issues" + %ul#issues-table.well-list.issues_table + = render "issues" :javascript $(function(){ diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index b1014edc6c5..55fc0aee0df 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -24,14 +24,14 @@ ← To issues list -.main_box - .top_box_content +.ui-box.ui-box-show + .ui-box-head %h4.box-title - if @issue.closed .error.status_info Closed = gfm escape_once(@issue.title) - .middle_box_content + .ui-box-body %cite.cgray Created by #{link_to_member(@project, @issue.author)} - if @issue.assignee @@ -44,13 +44,13 @@ .right - @issue.labels.each do |label| - %span.label.label-issue + %span.label %i.icon-tag = label.name   - if @issue.description.present? - .bottom_box_content + .ui-box-bottom = preserve do = markdown @issue.description diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index 4a0f60d36c2..9d035f0e012 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -1,8 +1,8 @@ %head %meta{charset: "utf-8"} %title + = "#{title} | " if defined?(title) GitLab - = " > #{title}" if defined?(title) = favicon_link_tag 'favicon.ico' = stylesheet_link_tag "application" = javascript_include_tag "application" diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index 8fbec43f4a1..f4b2228a41b 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -2,7 +2,8 @@ .navbar-inner .container %div.app_logo - = link_to root_path, class: "home", title: "Home" do + %span.separator + = link_to root_path, class: "home has_bottom_tooltip", title: "Dashboard" do %h1 GITLAB %span.separator %h1.project_name= title diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 6b643ec8ccb..a60e7febe76 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -19,6 +19,6 @@ = nav_link(controller: :hooks) do = link_to "Hooks", admin_hooks_path = nav_link(controller: :resque) do - = link_to "Resque", admin_resque_path + = link_to "Background Jobs", admin_resque_path .content= yield diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a41de538436..a197de38749 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -15,7 +15,7 @@ = nav_link(path: 'dashboard#merge_requests') do = link_to dashboard_merge_requests_path do Merge Requests - %span.count= current_user.cared_merge_requests.count + %span.count= current_user.cared_merge_requests.opened.count = nav_link(path: 'search#show') do = link_to "Search", search_path = nav_link(path: 'help#index') do diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml index d40d9525bb8..f47e8b3e9ff 100644 --- a/app/views/layouts/group.html.haml +++ b/app/views/layouts/group.html.haml @@ -15,7 +15,7 @@ = nav_link(path: 'groups#merge_requests') do = link_to merge_requests_group_path(@group) do Merge Requests - %span.count= current_user.cared_merge_requests.of_group(@group).count + %span.count= current_user.cared_merge_requests.opened.of_group(@group).count = nav_link(path: 'groups#search') do = link_to "Search", search_group_path(@group) = nav_link(path: 'groups#people') do diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index c418e1dbc68..3db1f59b54d 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -13,10 +13,10 @@ %td{style: "font-size: 0px;", width: "20"} \  %td{align: "left", style: "padding: 10px 0", width: "580"} - %h1{style: "font-size: 24px; color: #BBBBBB; font: normal 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"} + %h1{style: "color: #BBBBBB; font: normal 20px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"} GITLAB - if @project - → #{@project.name_with_namespace} + \/ #{@project.name_with_namespace} %table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"} %tr= yield %tr diff --git a/app/views/layouts/project_resource.html.haml b/app/views/layouts/project_resource.html.haml index 709807456c8..e00f96a7723 100644 --- a/app/views/layouts/project_resource.html.haml +++ b/app/views/layouts/project_resource.html.haml @@ -14,9 +14,9 @@ - if @project.repo_exists? - if can? current_user, :download_code, @project = nav_link(controller: %w(tree blob blame)) do - = link_to 'Files', project_tree_path(@project, @ref || @project.root_ref) + = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref) = nav_link(controller: %w(commit commits compare repositories protected_branches)) do - = link_to "Commits", project_commits_path(@project, @ref || @project.root_ref) + = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref) = nav_link(path: 'projects#graph') do = link_to "Network", graph_project_path(@project) diff --git a/app/views/merge_requests/_filter.html.haml b/app/views/merge_requests/_filter.html.haml new file mode 100644 index 00000000000..86148fbcfee --- /dev/null +++ b/app/views/merge_requests/_filter.html.haml @@ -0,0 +1,20 @@ += form_tag project_issues_path(@project), method: 'get' do + %fieldset + %ul.nav.nav-pills.nav-stacked + %li{class: ("active" if (params[:f] == 'open' || !params[:f]))} + = link_to project_merge_requests_path(@project, f: 'open', milestone_id: params[:milestone_id]) do + Open + %li{class: ("active" if params[:f] == "closed")} + = link_to project_merge_requests_path(@project, f: "closed", milestone_id: params[:milestone_id]) do + Closed + %li{class: ("active" if params[:f] == 'assigned-to-me')} + = link_to project_merge_requests_path(@project, f: 'assigned-to-me', milestone_id: params[:milestone_id]) do + Assigned To Me + %li{class: ("active" if params[:f] == 'all')} + = link_to project_merge_requests_path(@project, f: 'all', milestone_id: params[:milestone_id]) do + All + + %fieldset + %hr + = link_to "Reset", project_merge_requests_path(@project), class: 'btn right' + diff --git a/app/views/merge_requests/_form.html.haml b/app/views/merge_requests/_form.html.haml index 9606e2e53b3..9a4f0617a3a 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/merge_requests/_form.html.haml @@ -1,54 +1,59 @@ -= form_for [@project, @merge_request], html: { class: "new_merge_request form-horizontal" } do |f| += form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f| -if @merge_request.errors.any? .alert-message.block-message.error %ul - @merge_request.errors.full_messages.each do |msg| %li= msg - %h4.cdark 1. Select Branches - %br + %fieldset + %legend 1. Select Branches - .row - .span5 - .mr_branch_box - %h5 From (Head Branch) - .body - .padded= f.select(:source_branch, @project.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'}) - .mr_source_commit + .row + .span5 + .mr_branch_box + %h5.cgray From (Head Branch) + .body + .padded= f.select(:source_branch, @repository.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'}) + .mr_source_commit - .span2 - %center= image_tag "merge.png", class: 'mr_direction_tip' - .span5 - .mr_branch_box - %h5 To (Base Branch) - .body - .padded= f.select(:target_branch, @project.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'}) - .mr_target_commit + .span2 + %center= image_tag "merge.png", class: 'mr_direction_tip' + .span5 + .mr_branch_box + %h5.cgray To (Base Branch) + .body + .padded= f.select(:target_branch, @repository.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'}) + .mr_target_commit - %h4.cdark 2. Fill info + %fieldset + %legend 2. Fill info - .clearfix - .merge_requests_form_box - .top_box_content - = f.label :title do - %strong= "Title *" - .input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5, required: true - .merge_requests_middle_box - .merge_requests_assignee - = f.label :assignee_id do - %i.icon-user - Assign to - .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'}) - .merge_requests_milestone - = f.label :milestone_id do - %i.icon-time - Milestone - .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) + .ui-box.ui-box-show + .ui-box-head + .clearfix + = f.label :title do + %strong= "Title *" + .input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5, required: true + .ui-box-body + .clearfix + .left + = f.label :assignee_id do + %i.icon-user + Assign to + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'}) + .left + = f.label :milestone_id do + %i.icon-time + Milestone + .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) .control-group .form-actions - = f.submit 'Save', class: "btn save-btn" + - if @merge_request.new_record? + = f.submit 'Submit merge request', class: "btn success" + -else + = f.submit 'Save changes', class: "save-btn btn" - if @merge_request.new_record? = link_to project_merge_requests_path(@project), class: "btn cancel-btn" do Cancel @@ -59,8 +64,9 @@ :javascript $(function(){ disableButtonIfEmptyField("#merge_request_title", ".save-btn"); - var source_branch = $("#merge_request_source_branch"); - var target_branch = $("#merge_request_target_branch"); + + var source_branch = $("#merge_request_source_branch") + , target_branch = $("#merge_request_target_branch"); $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: source_branch.val() }); $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: target_branch.val() }); diff --git a/app/views/merge_requests/_show.html.haml b/app/views/merge_requests/_show.html.haml index 8285a56d184..cefd33c0cdf 100644 --- a/app/views/merge_requests/_show.html.haml +++ b/app/views/merge_requests/_show.html.haml @@ -1,31 +1,33 @@ -= render "merge_requests/show/mr_title" -= render "merge_requests/show/how_to_merge" -= render "merge_requests/show/mr_box" -= render "merge_requests/show/mr_accept" -- if @project.gitlab_ci? - = render "merge_requests/show/mr_ci" -= render "merge_requests/show/commits" +.merge-request + = render "merge_requests/show/mr_title" + = render "merge_requests/show/how_to_merge" + = render "merge_requests/show/mr_box" + = render "merge_requests/show/mr_accept" + - if @project.gitlab_ci? + = render "merge_requests/show/mr_ci" + = render "merge_requests/show/commits" -- if @commits.present? - %ul.nav.nav-tabs.mr_nav_tabs - %li - = link_to "#notes", title: "Discussion", "data-url" => project_merge_request_path(@project, @merge_request), class: "merge-notes-tab tab" do - %i.icon-comments - Discussion - %li - = link_to "#diffs", title: "Diff", "data-url" => diffs_project_merge_request_path(@project, @merge_request), class: "merge-diffs-tab tab" do - %i.icon-list-alt - Diff + - if @commits.present? + %ul.nav.nav-tabs + %li.notes-tab{data: {action: 'notes'}} + = link_to project_merge_request_path(@project, @merge_request) do + %i.icon-comment + Discussion + %li.diffs-tab{data: {action: 'diffs'}} + = link_to diffs_project_merge_request_path(@project, @merge_request) do + %i.icon-list-alt + Diff -.merge_request_notes.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } - = render "notes/notes_with_form" -.merge-request-diffs - = render "merge_requests/show/diffs" if @diffs -.status + .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } + = render "notes/notes_with_form" + .diffs.tab-content + = render "merge_requests/show/diffs" if @diffs + .status :javascript + var merge_request; $(function(){ - MergeRequest.init({ + merge_request = new MergeRequest({ url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}", check_enable: #{@merge_request.state == MergeRequest::UNCHECKED ? "true" : "false"}, url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}", @@ -33,10 +35,5 @@ current_state: "#{@merge_request.human_state}", action: "#{controller.action_name}" }); - - $(".edit_merge_request").live("ajax:beforeSend", function() { - $('.can_be_merged').hide(); - $('.merge_in_progress').show(); - }) - }) + }); diff --git a/app/views/merge_requests/automerge.js.haml b/app/views/merge_requests/automerge.js.haml index 93e184455af..e01ff662e7d 100644 --- a/app/views/merge_requests/automerge.js.haml +++ b/app/views/merge_requests/automerge.js.haml @@ -3,5 +3,5 @@ location.reload(); -else :plain - MergeRequest.already_cannot_be_merged() + merge_request.alreadyOrCannotBeMerged() diff --git a/app/views/merge_requests/commits.js.haml b/app/views/merge_requests/commits.js.haml index 76322bdb210..923b1ea032f 100644 --- a/app/views/merge_requests/commits.js.haml +++ b/app/views/merge_requests/commits.js.haml @@ -1,4 +1,4 @@ :plain - $(".merge-request-commits").html("#{escape_javascript(render(partial: "commits"))}"); + merge_request.$(".commits").html("#{escape_javascript(render(partial: "commits"))}"); diff --git a/app/views/merge_requests/diffs.js.haml b/app/views/merge_requests/diffs.js.haml index c758cf69015..266892c01ef 100644 --- a/app/views/merge_requests/diffs.js.haml +++ b/app/views/merge_requests/diffs.js.haml @@ -1,3 +1,2 @@ :plain - $(".merge-request-diffs").html("#{escape_javascript(render(partial: "merge_requests/show/diffs"))}"); - + merge_request.$(".diffs").html("#{escape_javascript(render(partial: "merge_requests/show/diffs"))}"); diff --git a/app/views/merge_requests/index.html.haml b/app/views/merge_requests/index.html.haml index 5b234bfbe02..43651a5ca15 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/merge_requests/index.html.haml @@ -1,48 +1,35 @@ +- if can? current_user, :write_issue, @project + = link_to new_project_merge_request_path(@project), class: "right btn primary", title: "New Merge Request" do + %i.icon-plus + New Merge Request %h3.page_title Merge Requests - - if can? current_user, :write_issue, @project - = link_to new_project_merge_request_path(@project), class: "right btn", title: "New Merge Request" do - New Merge Request %br -.ui-box - .title - .left - %ul.nav.nav-pills - %li{class: ("active" if (params[:f] == 'open' || !params[:f]))} - = link_to project_merge_requests_path(@project, f: 'open', milestone_id: params[:milestone_id]) do - Open - %li{class: ("active" if params[:f] == "closed")} - = link_to project_merge_requests_path(@project, f: "closed", milestone_id: params[:milestone_id]) do - Closed - %li{class: ("active" if params[:f] == 'assigned-to-me')} - = link_to project_merge_requests_path(@project, f: 'assigned-to-me', milestone_id: params[:milestone_id]) do - To Me - %li{class: ("active" if params[:f] == 'all')} - = link_to project_merge_requests_path(@project, f: 'all', milestone_id: params[:milestone_id]) do - All - .right - = form_tag project_merge_requests_path(@project), id: "merge_requests_search_form", method: :get, class: :right do - = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") - = hidden_field_tag :f, params[:f] - .clearfix +.row + .span3 + = render 'filter', entity: 'issue' + .span9 + .ui-box + .title + = form_tag project_merge_requests_path(@project), id: "merge_requests_search_form", method: :get, class: :left do + = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") + = hidden_field_tag :f, params[:f] + .clearfix - %ul.well-list - = render @merge_requests - - if @merge_requests.blank? - %li - %h4.nothing_here_message Nothing to show here - - if @merge_requests.present? - %li.bottom - .row - .span7= paginate @merge_requests, theme: "gitlab" - .span4.right - %span.cgray.right #{@merge_requests.total_count} merge requests for this filter + %ul.well-list + = render @merge_requests + - if @merge_requests.blank? + %li + %h4.nothing_here_message Nothing to show here + - if @merge_requests.present? + %li.bottom + .left= paginate @merge_requests, theme: "gitlab" + .right + %span.cgray.right #{@merge_requests.total_count} merge requests for this filter :javascript - $(function() { - merge_requestsPage(); - }) + $(merge_requestsPage); diff --git a/app/views/merge_requests/show.js.haml b/app/views/merge_requests/show.js.haml index 7f423c786de..2ce6eb63290 100644 --- a/app/views/merge_requests/show.js.haml +++ b/app/views/merge_requests/show.js.haml @@ -1,2 +1,2 @@ :plain - $(".merge-request-notes").html("#{escape_javascript(render notes/notes_with_form")}"); + merge_request.$(".notes").html("#{escape_javascript(render "notes/notes_with_form")}"); diff --git a/app/views/merge_requests/show/_commits.html.haml b/app/views/merge_requests/show/_commits.html.haml index 796922776d9..5e27b6dc25a 100644 --- a/app/views/merge_requests/show/_commits.html.haml +++ b/app/views/merge_requests/show/_commits.html.haml @@ -1,18 +1,18 @@ - if @commits.present? .ui-box - %h5 + %h5.title %i.icon-list Commits (#{@commits.count}) - .merge-request-commits + .commits - if @commits.count > 8 - %ul.first_mr_commits.well-list + %ul.first-commits.well-list - @commits.first(8).each do |commit| = render "commits/commit", commit: commit %li.bottom 8 of #{@commits.count} commits displayed. %strong - %a.mr_show_all_commits Click here to show all - %ul.all_mr_commits.hide.well-list + %a.show-all-commits Click here to show all + %ul.all-commits.hide.well-list - @commits.each do |commit| = render "commits/commit", commit: commit diff --git a/app/views/merge_requests/show/_mr_accept.html.haml b/app/views/merge_requests/show/_mr_accept.html.haml index f24228856ff..128ffe76782 100644 --- a/app/views/merge_requests/show/_mr_accept.html.haml +++ b/app/views/merge_requests/show/_mr_accept.html.haml @@ -9,19 +9,24 @@ %span = form_for [:automerge, @project, @merge_request], remote: true, method: :get do |f| %p - You can accept this request automatically. - If you still want to do it manually - + You can accept this request automatically. + If you still want to do it manually - %strong= link_to "click here", "#", class: "how_to_merge_link vlink", title: "How To Merge" for instructions .accept_group - = f.submit "Accept Merge Request", class: "btn small success accept_merge_request" - - unless @project.root_ref? @merge_request.source_branch + = f.submit "Accept Merge Request", class: "btn success accept_merge_request" + - unless @project.root_ref? @merge_request.source_branch .remove_branch_holder - = label_tag :should_remove_source_branch, class: "checkbox" do + = label_tag :should_remove_source_branch, class: "checkbox" do = check_box_tag :should_remove_source_branch Remove source-branch .clearfix - + + + .automerge_widget.no_satellite{style: "display:none"} + .alert.alert-error + %span + %strong This repository does not have satellite. Ask administrator to fix this issue .automerge_widget.cannot_be_merged{style: "display:none"} .alert.alert-info @@ -40,6 +45,6 @@ .alert.alert-info %strong This merge request already can not be merged. Try to reload page. - .merge_in_progress.hide + .merge-in-progress.hide %span.cgray Merge is in progress. Please wait. Page will be automatically reloaded.   = image_tag "ajax_loader.gif" diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/merge_requests/show/_mr_box.html.haml index cd33732d191..644d7fcc58e 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/merge_requests/show/_mr_box.html.haml @@ -1,5 +1,5 @@ -.main_box - .top_box_content +.ui-box.ui-box-show + .ui-box-head %h4.box-title - if @merge_request.merged .error.status_info @@ -9,7 +9,7 @@ .error.status_info Closed = gfm escape_once(@merge_request.title) - .middle_box_content + .ui-box-body %div %cite.cgray Created at #{@merge_request.created_at.stamp("Aug 21, 2011")} by #{link_to_member(@project, @merge_request.author)} @@ -22,7 +22,7 @@ - if @merge_request.closed - .bottom_box_content + .ui-box-bottom - if @merge_request.merged? %span Merged by #{link_to_member(@project, @merge_request.merge_event.author)} diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index c4975c72ef2..fc7ae51f184 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -27,8 +27,8 @@ %span All issues for this milestone are closed. You may close milestone now. = link_to 'Close Milestone', project_milestone_path(@project, @milestone, milestone: {closed: true }), method: :put, class: "btn small danger" -.main_box - .top_box_content +.ui-box.ui-box-show + .ui-box-head %h4.box-title - if @milestone.closed .error.status_info Closed @@ -37,52 +37,47 @@ = gfm escape_once(@milestone.title) - .middle_box_content - %h5 + .ui-box-body + %p Progress: - %small - #{@milestone.closed_items_count} closed - – - #{@milestone.open_items_count} open + #{@milestone.closed_items_count} closed + – + #{@milestone.open_items_count} open %span.right= @milestone.expires_at .progress.progress-info .bar{style: "width: #{@milestone.percent_complete}%;"} - if @milestone.description.present? - .bottom_box_content + .ui-box-bottom = preserve do = markdown @milestone.description .row .span6 - %table.milestone-issue-filter - %thead - %tr - %th - %ul.nav.nav-pills - %li.active= link_to('Open Issues', '#') - %li=link_to('All Issues', '#') - - @issues.each do |issue| - %tr{data: {closed: issue.closed}} - %td + .ui-box.milestone-issue-filter + .title + %ul.nav.nav-pills + %li.active= link_to('Open Issues', '#') + %li=link_to('All Issues', '#') + %ul.well-list + - @issues.each do |issue| + %li{data: {closed: issue.closed}} = link_to [@project, issue] do %span.badge.badge-info ##{issue.id} – = link_to_gfm truncate(issue.title, length: 60), [@project, issue] .span6 - %table.milestone-merge-requests-filter - %thead - %tr - %th - %ul.nav.nav-pills - %li.active= link_to('Open Merge Requests', '#') - %li=link_to('All Merge Requests', '#') - - @merge_requests.each do |merge_request| - %tr{data: {closed: merge_request.closed}} - %td + .ui-box.milestone-merge-requests-filter + .title + %ul.nav.nav-pills + %li.active= link_to('Open Merge Requests', '#') + %li=link_to('All Merge Requests', '#') + %ul.well-list + - @merge_requests.each do |merge_request| + %li{data: {closed: merge_request.closed}} = link_to [@project, merge_request] do %span.badge.badge-info ##{merge_request.id} – diff --git a/app/views/notes/_note.html.haml b/app/views/notes/_note.html.haml index 8881cf5a847..6f7eea9827f 100644 --- a/app/views/notes/_note.html.haml +++ b/app/views/notes/_note.html.haml @@ -28,6 +28,8 @@ = preserve do = markdown(note.note) - if note.attachment.url + - if note.attachment.image? + = image_tag note.attachment.url, class: 'thumbnail span4' .attachment.right = link_to note.attachment.url, target: "_blank" do %i.icon-attachment diff --git a/app/views/notify/issue_status_changed_email.html.haml b/app/views/notify/issue_status_changed_email.html.haml index c433e80c9e5..27168eef742 100644 --- a/app/views/notify/issue_status_changed_email.html.haml +++ b/app/views/notify/issue_status_changed_email.html.haml @@ -1,8 +1,8 @@ %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{align: "left", style: "padding: 20px 0 0;"} + %td{width: "21"} + %td %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Issue was #{@issue_status} by #{@updated_by.name}" %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml index fba4b865487..3cb5351319e 100644 --- a/app/views/notify/new_issue_email.html.haml +++ b/app/views/notify/new_issue_email.html.haml @@ -1,13 +1,13 @@ %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{align: "left", style: "padding: 20px 0 0;"} + %td{width: "21"} + %td %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} New Issue was created and assigned to you. - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{width: "21"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{width: "21"} %td{align: "left", style: "padding: 20px 0 0;"} %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} = "Issue ##{@issue.id}" diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index 9819767011e..990d4d2aa87 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -14,6 +14,6 @@ %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} Branches: #{@merge_request.source_branch} → #{@merge_request.target_branch} %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - Asignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} + Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} %td diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml index 764cd094b76..3857f2f0318 100644 --- a/app/views/notify/note_merge_request_email.html.haml +++ b/app/views/notify/note_merge_request_email.html.haml @@ -1,23 +1,27 @@ %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{align: "left", style: "padding: 20px 0 0;"} - %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} - = "New comment for Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, length: 16), project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}") - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{width: "21"} + %td + %h2{style: "color:#646464; font-weight: normal;"} + - if @note.for_diff_line? + = link_to "New comment on diff", diffs_project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}") + - else + = link_to "New comment", project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}") + for Merge Request ##{@merge_request.id} + %cite "#{truncate(@merge_request.title, length: 20)}" + %td{width: "21"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{style: "padding: 15px 0 15px;", valign: "top"} - %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} - %a{href: "#", style: "color: #0eb6ce; text-decoration: none;"} #{@note.author_name} + %td{width: "21"} + %td + %p + %strong #{@note.author_name} left next message: %br %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} %tr %td{valign: "top"} - %div{ style: "background:#f5f5f5; padding:20px;border:1px solid #ddd" } + %div{ style: "background:#f5f5f5; padding:10px 20px;border:1px solid #ddd" } = markdown(@note.note) - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %td{width: "21"} diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml index 31a5d23242c..bc2d6f7078b 100644 --- a/app/views/notify/reassigned_issue_email.html.haml +++ b/app/views/notify/reassigned_issue_email.html.haml @@ -2,7 +2,7 @@ %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{align: "left", style: "padding: 20px 0 0;"} + %td %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Reassigned Issue ##{@issue.id}" = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) diff --git a/app/views/profiles/account.html.haml b/app/views/profiles/account.html.haml index 3c290948d6c..522e45e637a 100644 --- a/app/views/profiles/account.html.haml +++ b/app/views/profiles/account.html.haml @@ -69,7 +69,7 @@ %i.icon-ok Saved %span.update-failed.cred.hide - %i.icon-ok + %i.icon-remove Failed %ul.cred %li It will change web url for personal projects. diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 934c1fdf7c4..64f931ca887 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -64,7 +64,7 @@ %legend Personal projects: %small.right - %span= current_user.my_own_projects.count + %span= current_user.personal_projects.count of %span= current_user.projects_limit .padded diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 7044d1f20be..c8eacdc2a46 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -15,13 +15,13 @@ = f.label :path do Repository .controls - = text_field_tag :ppath, @project.path_to_repo, class: "xxlarge", readonly: true + = text_field_tag :ppath, @repository.path_to_repo, class: "xxlarge", readonly: true - - unless @project.heads.empty? + - unless @repository.heads.empty? .clearfix = f.label :default_branch, "Default Branch" - .input= f.select(:default_branch, @project.heads.map(&:name), {}, style: "width:210px;") + .input= f.select(:default_branch, @repository.heads.map(&:name), {}, style: "width:210px;") %fieldset.features %legend Features: diff --git a/app/views/projects/_new_form.html.haml b/app/views/projects/_new_form.html.haml index 2ef29cb0c65..2391c750bc8 100644 --- a/app/views/projects/_new_form.html.haml +++ b/app/views/projects/_new_form.html.haml @@ -7,7 +7,7 @@ Project name is .input = f.text_field :name, placeholder: "Example Project", class: "xxlarge" - = f.submit 'Create project', class: "btn primary project-submit" + = f.submit 'Create project', class: "btn success project-submit" - if current_user.several_namespaces? .clearfix diff --git a/app/views/protected_branches/index.html.haml b/app/views/protected_branches/index.html.haml index f408fd16c2c..c1ecceda435 100644 --- a/app/views/protected_branches/index.html.haml +++ b/app/views/protected_branches/index.html.haml @@ -1,51 +1,54 @@ -= render "repositories/branches_head" += render "commits/head" +.row + .span3 + = render "repositories/filter" + .span9 + .alert + %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. + %p This ability allows: + %ul + %li keep stable branches secured + %li forced code review before merge to protected branches + %p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"} -.alert - %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. - %p This ability allows: - %ul - %li keep stable branches secured - %li forced code review before merge to protected branches - %p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"} + - if can? current_user, :admin_project, @project + = form_for [@project, @protected_branch] do |f| + -if @protected_branch.errors.any? + .alert-message.block-message.error + %ul + - @protected_branch.errors.full_messages.each do |msg| + %li= msg -- if can? current_user, :admin_project, @project - = form_for [@project, @protected_branch] do |f| - -if @protected_branch.errors.any? - .alert-message.block-message.error - %ul - - @protected_branch.errors.full_messages.each do |msg| - %li= msg + .entry.clearfix + = f.label :name, "Branch" + .span3 + = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"}) +   + = f.submit 'Protect', class: "primary btn" - .entry.clearfix - = f.label :name, "Branch" - .span3 - = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"}) -   - = f.submit 'Protect', class: "primary btn" - -- unless @branches.empty? - %table - %thead - %tr - %th Name - %th Last commit - %th - %tbody - - @branches.each do |branch| - %tr - %td - = link_to project_commits_path(@project, branch.name) do - %strong= branch.name - - if branch.name == @project.root_ref - %span.label default - %td - - if branch.commit - = link_to project_commit_path(@project, branch.commit.id) do - = truncate branch.commit.id.to_s, length: 10 - = time_ago_in_words(branch.commit.committed_date) - ago - - else - (branch was removed from repository) - %td - - if can? current_user, :admin_project, @project - = link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "danger btn small" + - unless @branches.empty? + %table + %thead + %tr + %th Name + %th Last commit + %th + %tbody + - @branches.each do |branch| + %tr + %td + = link_to project_commits_path(@project, branch.name) do + %strong= branch.name + - if @project.root_ref?(branch.name) + %span.label default + %td + - if branch.commit + = link_to project_commit_path(@project, branch.commit.id) do + = truncate branch.commit.id.to_s, length: 10 + = time_ago_in_words(branch.commit.committed_date) + ago + - else + (branch was removed from repository) + %td + - if can? current_user, :admin_project, @project + = link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "danger btn small" diff --git a/app/views/repositories/_branch.html.haml b/app/views/repositories/_branch.html.haml index 2728b100ff6..a6faa5fd633 100644 --- a/app/views/repositories/_branch.html.haml +++ b/app/views/repositories/_branch.html.haml @@ -8,7 +8,7 @@ - else %i.icon-unlock %strong= truncate(branch.name, length: 60) - - if branch.name == @project.root_ref + - if branch.name == @repository.root_ref %span.label default %td = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do @@ -22,6 +22,6 @@ %td - if can? current_user, :download_code, @project = link_to archive_project_repository_path(@project, ref: branch.name) do - %i.icon-download + %i.icon-download-alt Download diff --git a/app/views/repositories/_feed.html.haml b/app/views/repositories/_feed.html.haml index 496328baca5..44380133718 100644 --- a/app/views/repositories/_feed.html.haml +++ b/app/views/repositories/_feed.html.haml @@ -5,7 +5,7 @@ = link_to project_commits_path(@project, commit.head.name) do %strong = commit.head.name - - if commit.head.name == @project.root_ref + - if @project.root_ref?(commit.head.name) %span.label default %td diff --git a/app/views/repositories/_branches_head.html.haml b/app/views/repositories/_filter.html.haml similarity index 73% rename from app/views/repositories/_branches_head.html.haml rename to app/views/repositories/_filter.html.haml index 8f3e1ba3f81..e718d48190a 100644 --- a/app/views/repositories/_branches_head.html.haml +++ b/app/views/repositories/_filter.html.haml @@ -1,10 +1,9 @@ -= render "commits/head" -%ul.nav.nav-pills +%ul.nav.nav-pills.nav-stacked = nav_link(path: 'repositories#show') do = link_to 'Recent', project_repository_path(@project) = nav_link(path: 'protected_branches#index') do = link_to project_protected_branches_path(@project) do - %i.icon-lock Protected + %i.icon-lock = nav_link(path: 'repositories#branches') do - = link_to 'All', branches_project_repository_path(@project) + = link_to 'All branches', branches_project_repository_path(@project) diff --git a/app/views/repositories/branches.html.haml b/app/views/repositories/branches.html.haml index 4c246c69d7c..14b5082e44e 100644 --- a/app/views/repositories/branches.html.haml +++ b/app/views/repositories/branches.html.haml @@ -1,12 +1,15 @@ -= render "repositories/branches_head" -- unless @branches.empty? - %table - %thead - %tr - %th Name - %th Last commit - %th - - %tbody - - @branches.each do |branch| - = render "repositories/branch", branch: branch += render "commits/head" +.row + .span3 + = render "filter" + .span9 + - unless @branches.empty? + %table + %thead + %tr + %th Name + %th Last commit + %th + %tbody + - @branches.each do |branch| + = render "repositories/branch", branch: branch diff --git a/app/views/repositories/show.html.haml b/app/views/repositories/show.html.haml index fd0abac8414..e58e16f8bf1 100644 --- a/app/views/repositories/show.html.haml +++ b/app/views/repositories/show.html.haml @@ -1,11 +1,14 @@ -= render "branches_head" - -%table - %thead - %tr - %th Name - %th Last commit - %th - - @activities.each do |update| - = render "repositories/branch", branch: update.head += render "commits/head" +.row + .span3 + = render "filter" + .span9 + %table + %thead + %tr + %th Name + %th Last commit + %th + - @activities.each do |update| + = render "repositories/branch", branch: update.head diff --git a/app/views/repositories/stats.html.haml b/app/views/repositories/stats.html.haml index a93814a4777..bdf047f1e98 100644 --- a/app/views/repositories/stats.html.haml +++ b/app/views/repositories/stats.html.haml @@ -7,7 +7,7 @@ %b Total commits: %span= @stats.commits_count %p - %b Total files in #{@project.root_ref}: + %b Total files in #{@repository.root_ref}: %span= @stats.files_count %p %b Authors: diff --git a/app/views/repositories/tags.html.haml b/app/views/repositories/tags.html.haml index 193cb2e30f2..d4b8bbe10d4 100644 --- a/app/views/repositories/tags.html.haml +++ b/app/views/repositories/tags.html.haml @@ -26,8 +26,14 @@ %td - if can? current_user, :download_code, @project = link_to archive_project_repository_path(@project, ref: tag.name) do - %i.icon-download + %i.icon-download-alt Download - else - %h3 No tags + %h3.nothing_here_message + Repository has no tags yet. + %br + %small + Use git tag command to add a new one: + %br + %span.monospace git tag -a v1.4 -m 'version 1.4' diff --git a/app/views/search/_result.html.haml b/app/views/search/_result.html.haml index 8b137891791..79bed4f737c 100644 --- a/app/views/search/_result.html.haml +++ b/app/views/search/_result.html.haml @@ -1 +1,85 @@ +%br +%h3.page_title + Search results + %span.cgray (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count}) +%hr +.search_results + .row + .span6 + %table + %thead + %tr + %th Projects + %tbody + - @projects.each do |project| + %tr + %td + = link_to project do + %strong.term= project.name_with_namespace + %small.cgray + last activity at + = project.last_activity_date.stamp("Aug 25, 2011") + - if @projects.blank? + %tr + %td + %h4.nothing_here_message No Projects + %br + %table + %thead + %tr + %th Merge Requests + %tbody + - @merge_requests.each do |merge_request| + %tr + %td + = link_to [merge_request.project, merge_request] do + %span.badge.badge-info ##{merge_request.id} + – + %strong.term= truncate merge_request.title, length: 50 + %strong.right + %span.label= merge_request.project.name + - if @merge_requests.blank? + %tr + %td + %h4.nothing_here_message No Merge Requests + .span6 + %table + %thead + %tr + %th Issues + %tbody + - @issues.each do |issue| + %tr + %td + = link_to [issue.project, issue] do + %span.badge.badge-info ##{issue.id} + – + %strong.term= truncate issue.title, length: 40 + %strong.right + %span.label= issue.project.name + - if @issues.blank? + %tr + %td + %h4.nothing_here_message No Issues + .span6 + %table + %thead + %tr + %th Wiki + %tbody + - @wiki_pages.each do |wiki_page| + %tr + %td + = link_to project_wiki_path(wiki_page.project, wiki_page) do + %strong.term= truncate wiki_page.title, length: 40 + %strong.right + %span.label= wiki_page.project.name + - if @wiki_pages.blank? + %tr + %td + %h4.nothing_here_message No wiki pages +:javascript + $(function() { + $(".search_results .term").highlight("#{escape_javascript(params[:search])}"); + }) diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 8448193deb9..aa0d6d700d9 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -6,87 +6,4 @@ = search_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge search-text-input", id: "dashboard_search" = submit_tag 'Search', class: "btn primary wide" - if params[:search].present? - %br - %h3 - Search results - %small (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count}) - %hr - .search_results - .row - .span6 - %table - %thead - %tr - %th Projects - %tbody - - @projects.each do |project| - %tr - %td - = link_to project do - %strong.term= project.name_with_namespace - %small.cgray - last activity at - = project.last_activity_date.stamp("Aug 25, 2011") - - if @projects.blank? - %tr - %td - %h4.nothing_here_message No Projects - %br - %table - %thead - %tr - %th Merge Requests - %tbody - - @merge_requests.each do |merge_request| - %tr - %td - = link_to [merge_request.project, merge_request] do - %span.badge.badge-info ##{merge_request.id} - – - %strong.term= truncate merge_request.title, length: 50 - %strong.right - %span.label= merge_request.project.name - - if @merge_requests.blank? - %tr - %td - %h4.nothing_here_message No Merge Requests - .span6 - %table - %thead - %tr - %th Issues - %tbody - - @issues.each do |issue| - %tr - %td - = link_to [issue.project, issue] do - %span.badge.badge-info ##{issue.id} - – - %strong.term= truncate issue.title, length: 40 - %strong.right - %span.label= issue.project.name - - if @issues.blank? - %tr - %td - %h4.nothing_here_message No Issues - .span6 - %table - %thead - %tr - %th Wiki - %tbody - - @wiki_pages.each do |wiki_page| - %tr - %td - = link_to project_wiki_path(wiki_page.project, wiki_page) do - %strong.term= truncate wiki_page.title, length: 40 - %strong.right - %span.label= wiki_page.project.name - - if @wiki_pages.blank? - %tr - %td - %h4.nothing_here_message No wiki pages - :javascript - $(function() { - $(".search_results .term").highlight("#{params[:search]}"); - }) + = render 'search/result' diff --git a/app/views/team_members/_form.html.haml b/app/views/team_members/_form.html.haml index e5d9a4a4b5e..a963e462a78 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/team_members/_form.html.haml @@ -11,7 +11,7 @@ %h6 1. Choose people you want in the team .clearfix = f.label :user_ids, "People" - .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).all, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) + .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) %h6 2. Set access level for them .clearfix diff --git a/app/views/team_members/_team.html.haml b/app/views/team_members/_team.html.haml index 462e75af183..365d9b65942 100644 --- a/app/views/team_members/_team.html.haml +++ b/app/views/team_members/_team.html.haml @@ -1,6 +1,6 @@ - grouper_project_members(@project).each do |access, members| .ui-box - %h5 + %h5.title = Project.access_options.key(access).pluralize %small= members.size %ul.well-list diff --git a/app/views/team_members/import.html.haml b/app/views/team_members/import.html.haml index 34f7fb03288..de82f416248 100644 --- a/app/views/team_members/import.html.haml +++ b/app/views/team_members/import.html.haml @@ -9,7 +9,7 @@ %p.slead Choose project you want to use as team source: .padded = label_tag :source_project_id, "Project" - .input= select_tag(:source_project_id, options_from_collection_for_select(current_user.projects, :id, :name), prompt: "Select project", class: "chosen xxlarge", required: true) + .input= select_tag(:source_project_id, options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace), prompt: "Select project", class: "chosen xxlarge", required: true) .actions = submit_tag 'Import', class: "btn save-btn" diff --git a/app/views/team_members/show.html.haml b/app/views/team_members/show.html.haml index af9a6e6b92d..4008e8bd23e 100644 --- a/app/views/team_members/show.html.haml +++ b/app/views/team_members/show.html.haml @@ -8,8 +8,7 @@ = image_tag gravatar_icon(user.email, 60), class: "borders" %h3.page_title = user.name - %small - = user.email + %small (@#{user.username}) %hr .back_link diff --git a/app/views/tree/_tree.html.haml b/app/views/tree/_tree.html.haml index a632bb3b0d7..c2842959510 100644 --- a/app/views/tree/_tree.html.haml +++ b/app/views/tree/_tree.html.haml @@ -3,9 +3,13 @@ %span.arrow = link_to project_tree_path(@project, @ref) do = @project.name - - tree.breadcrumbs(6) do |link| + - tree.breadcrumbs(6) do |title, path| \/ - %li= link + %li + - if path + = link_to truncate(title, length: 40), project_tree_path(@project, path) + - else + = link_to title, '#' .clear %div.tree_progress @@ -26,7 +30,7 @@ %tr.tree-item %td.tree-item-file-name = image_tag "file_empty.png", size: '16x16' - = link_to "..", tree.up_dir_path + = link_to "..", project_tree_path(@project, tree.up_dir_path) %td %td %td diff --git a/app/views/tree/blob/_download.html.haml b/app/views/tree/blob/_download.html.haml index c307622995b..864c209db76 100644 --- a/app/views/tree/blob/_download.html.haml +++ b/app/views/tree/blob/_download.html.haml @@ -2,7 +2,7 @@ %center = link_to project_blob_path(@project, @id) do %div.padded - %br - = image_tag "download.png", width: 64 - %h3 + %h4 + %i.icon-download-alt + %br Download (#{number_to_human_size blob.size}) diff --git a/app/views/wikis/_form.html.haml b/app/views/wikis/_form.html.haml index 83b16b138d3..9eb2a571fe5 100644 --- a/app/views/wikis/_form.html.haml +++ b/app/views/wikis/_form.html.haml @@ -6,12 +6,12 @@ - @wiki.errors.full_messages.each do |msg| %li= msg - .main_box - .top_box_content + .ui-box.ui-box-show + .ui-box-head = f.label :title .input= f.text_field :title, class: 'span8' = f.hidden_field :slug - .middle_box_content + .ui-box-body .input %span.cgray Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. @@ -19,7 +19,7 @@ %code [Link Title](page-slug) \. - .bottom_box_content + .ui-box-bottom = f.label :content .input= f.text_area :content, class: 'span8 js-gfm-input' .actions diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index 1414ed490c9..e74379a65dd 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -1,7 +1,9 @@ class PostReceive - @queue = :post_receive + include Sidekiq::Worker - def self.perform(repo_path, oldrev, newrev, ref, identifier) + sidekiq_options queue: :post_receive + + def perform(repo_path, oldrev, newrev, ref, identifier) repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "") repo_path.gsub!(/.git$/, "") repo_path.gsub!(/^\//, "") @@ -11,7 +13,7 @@ class PostReceive # Ignore push from non-gitlab users user = if identifier.eql? Gitlab.config.gitolite.admin_key - email = project.commit(newrev).author.email rescue nil + email = project.repository.commit(newrev).author.email rescue nil User.find_by_email(email) if email elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) User.find_by_email(identifier) diff --git a/app/workers/system_hook_worker.rb b/app/workers/system_hook_worker.rb index ca154136b97..3ebc62b7e7a 100644 --- a/app/workers/system_hook_worker.rb +++ b/app/workers/system_hook_worker.rb @@ -1,7 +1,9 @@ class SystemHookWorker - @queue = :system_hook + include Sidekiq::Worker - def self.perform(hook_id, data) + sidekiq_options queue: :system_hook + + def perform(hook_id, data) SystemHook.find(hook_id).execute data end end diff --git a/config.ru b/config.ru index 5ef2a0289fe..dfd2d862237 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,7 @@ # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) -run Gitlab::Application + +map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do + run Gitlab::Application +end diff --git a/config/application.rb b/config/application.rb index d6bb90a3052..d71de88ebe3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -16,7 +16,7 @@ module Gitlab # -- all .rb files in that directory are automatically loaded. # Custom directories with classes and modules you want to be autoloadable. - config.autoload_paths += %W(#{config.root}/lib) + config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/models/concerns) # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 067dbd9b72b..76dc6214088 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -1,6 +1,12 @@ # # # # # # # # # # # # # # # # # # # Gitlab application config file # # # # # # # # # # # # # # # # # # # +# +# How to use: +# 1. copy file as gitlab.yml +# 2. Replace gitlab -> host with your domain +# 3. Replace gitolite -> ssh_host with your domain +# 4. Replace gitlab -> email_from # # 1. GitLab app settings @@ -12,6 +18,9 @@ gitlab: host: localhost port: 80 https: false + # uncomment and customize to run in non-root path + # note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/unicorn.rb may need to be changed + # relative_url_root: /gitlab ## Email settings # Email address used in the "From" field in mails sent by GitLab @@ -83,6 +92,7 @@ backup: ## Gitolite settings gitolite: admin_uri: git@localhost:gitolite-admin + # repos_path must not be a symlink repos_path: /home/git/repositories/ hooks_path: /home/git/.gitolite/hooks/ admin_key: gitlab diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 4fe3ced4d8d..6b47a9cc948 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -2,272 +2,6 @@ class Settings < Settingslogic source "#{Rails.root}/config/gitlab.yml" class << self - # FIXME: Deprecated: remove for 4.1 - def web_protocol - ActiveSupport::Deprecation.warn("Settings.web_protocol is deprecated and will be removed from GitLab 4.1", caller) - gitlab.protocol - rescue Settingslogic::MissingSetting - self.web['protocol'] ||= web.https ? "https" : "http" - end - - # FIXME: Deprecated: remove for 4.1 - def web_host - ActiveSupport::Deprecation.warn("Settings.web_host is deprecated and will be removed from GitLab 4.1", caller) - gitlab.host - rescue Settingslogic::MissingSetting - self.web['host'] ||= 'localhost' - end - - # FIXME: Deprecated: remove for 4.1 - def email_from - ActiveSupport::Deprecation.warn("Settings.email_from is deprecated and will be removed from GitLab 4.1", caller) - gitlab.email_from - rescue Settingslogic::MissingSetting - self.email['from'] ||= ("notify@" + web_host) - end - - # FIXME: Deprecated: remove for 4.1 - def url - ActiveSupport::Deprecation.warn("Settings.url is deprecated and will be removed from GitLab 4.1", caller) - gitlab.url - rescue Settingslogic::MissingSetting - self['url'] ||= build_url - end - - # FIXME: Deprecated: remove for 4.1 - def web_port - ActiveSupport::Deprecation.warn("Settings.web_port is deprecated and will be removed from GitLab 4.1", caller) - gitlab.port.to_i - rescue Settingslogic::MissingSetting - if web.https - web['port'] = 443 - else - web['port'] ||= 80 - end.to_i - end - - # FIXME: Deprecated: remove for 4.1 - def web_custom_port? - ActiveSupport::Deprecation.warn("Settings.web_custom_port? is deprecated and will be removed from GitLab 4.1", caller) - gitlab_on_non_standard_port? - rescue Settingslogic::MissingSetting - ![443, 80].include?(web_port) - end - - # FIXME: Deprecated: remove for 4.1 - def build_url - ActiveSupport::Deprecation.warn("Settings.build_url is deprecated and will be removed from GitLab 4.1", caller) - if web_custom_port? - custom_port = ":#{web_port}" - else - custom_port = nil - end - [ - web_protocol, - "://", - web_host, - custom_port - ].join('') - end - - # FIXME: Deprecated: remove for 4.1 - def ssh_port - ActiveSupport::Deprecation.warn("Settings.ssh_port is deprecated and will be removed from GitLab 4.1", caller) - gitolite.ssh_port - rescue Settingslogic::MissingSetting - git_host['port'] || 22 - end - - # FIXME: Deprecated: remove for 4.1 - def ssh_user - ActiveSupport::Deprecation.warn("Settings.ssh_user is deprecated and will be removed from GitLab 4.1", caller) - gitolite.ssh_user - rescue Settingslogic::MissingSetting - git_host['git_user'] || 'git' - end - - # FIXME: Deprecated: remove for 4.1 - def ssh_host - ActiveSupport::Deprecation.warn("Settings.ssh_host is deprecated and will be removed from GitLab 4.1", caller) - gitolite.ssh_host - rescue Settingslogic::MissingSetting - git_host['host'] || web_host || 'localhost' - end - - # FIXME: Deprecated: remove for 4.1 - def ssh_path - ActiveSupport::Deprecation.warn("Settings.ssh_path is deprecated and will be removed from GitLab 4.1", caller) - gitolite.ssh_path_prefix - rescue Settingslogic::MissingSetting - if ssh_port != 22 - "ssh://#{ssh_user}@#{ssh_host}:#{ssh_port}/" - else - "#{ssh_user}@#{ssh_host}:" - end - end - - # FIXME: Deprecated: remove for 4.1 - def git_base_path - ActiveSupport::Deprecation.warn("Settings.git_base_path is deprecated and will be removed from GitLab 4.1", caller) - gitolite.repos_path - rescue Settingslogic::MissingSetting - git_host['base_path'] || '/home/git/repositories/' - end - - # FIXME: Deprecated: remove for 4.1 - def git_hooks_path - ActiveSupport::Deprecation.warn("Settings.git_hooks_path is deprecated and will be removed from GitLab 4.1", caller) - gitolite.hooks_path - rescue Settingslogic::MissingSetting - git_host['hooks_path'] || '/home/git/share/gitolite/hooks/' - end - - # FIXME: Deprecated: remove for 4.1 - def git_upload_pack - ActiveSupport::Deprecation.warn("Settings.git_upload_pack is deprecated and will be removed from GitLab 4.1", caller) - gitolite.upload_pack - rescue Settingslogic::MissingSetting - if git_host['upload_pack'] != false - true - else - false - end - end - - # FIXME: Deprecated: remove for 4.1 - def git_receive_pack - ActiveSupport::Deprecation.warn("Settings.git_receive_pack is deprecated and will be removed from GitLab 4.1", caller) - gitolite.receive_pack - rescue Settingslogic::MissingSetting - if git_host['receive_pack'] != false - true - else - false - end - end - - # FIXME: Deprecated: remove for 4.1 - def git_bin_path - ActiveSupport::Deprecation.warn("Settings.git_bin_path is deprecated and will be removed from GitLab 4.1", caller) - git.bin_path - rescue Settingslogic::MissingSetting - git['path'] || '/usr/bin/git' - end - - # FIXME: Deprecated: remove for 4.1 - def git_max_size - ActiveSupport::Deprecation.warn("Settings.git_max_size is deprecated and will be removed from GitLab 4.1", caller) - git.max_size - rescue Settingslogic::MissingSetting - git['git_max_size'] || 5242880 # 5.megabytes - end - - # FIXME: Deprecated: remove for 4.1 - def git_timeout - ActiveSupport::Deprecation.warn("Settings.git_timeout is deprecated and will be removed from GitLab 4.1", caller) - git.timeout - rescue Settingslogic::MissingSetting - git['git_timeout'] || 10 - end - - # FIXME: Deprecated: remove for 4.1 - def gitolite_admin_uri - ActiveSupport::Deprecation.warn("Settings.gitolite_admin_uri is deprecated and will be removed from GitLab 4.1", caller) - gitolite.admin_uri - rescue Settingslogic::MissingSetting - git_host['admin_uri'] || 'git@localhost:gitolite-admin' - end - - # FIXME: Deprecated: remove for 4.1 - def gitolite_config_file - ActiveSupport::Deprecation.warn("Settings.gitolite_config_file is deprecated and will be removed from GitLab 4.1", caller) - gitolite.config_file - rescue Settingslogic::MissingSetting - git_host['config_file'] || 'gitolite.conf' - end - - # FIXME: Deprecated: remove for 4.1 - def gitolite_admin_key - ActiveSupport::Deprecation.warn("Settings.gitolite_admin_key is deprecated and will be removed from GitLab 4.1", caller) - gitolite.admin_key - rescue Settingslogic::MissingSetting - git_host['gitolite_admin_key'] || 'gitlab' - end - - # FIXME: Deprecated: remove for 4.1 - def default_projects_limit - ActiveSupport::Deprecation.warn("Settings.default_projects_limit is deprecated and will be removed from GitLab 4.1", caller) - gitlab.default_projects_limit - rescue Settingslogic::MissingSetting - app['default_projects_limit'] || 10 - end - - # FIXME: Deprecated: remove for 4.1 - def backup_path - ActiveSupport::Deprecation.warn("Settings.backup_path is deprecated and will be removed from GitLab 4.1", caller) - backup.path - rescue Settingslogic::MissingSetting - File.expand_path(app['backup_path'] || "backups/", Rails.root) - end - - # FIXME: Deprecated: remove for 4.1 - def backup_keep_time - ActiveSupport::Deprecation.warn("Settings.backup_keep_time is deprecated and will be removed from GitLab 4.1", caller) - backup.keep_time - rescue Settingslogic::MissingSetting - app['backup_keep_time'] || 0 - end - - # FIXME: Deprecated: remove for 4.1 - def ldap_enabled? - ActiveSupport::Deprecation.warn("Settings.ldap_enabled? is deprecated and will be removed from GitLab 4.1", caller) - ldap.enabled - rescue Settingslogic::MissingSetting - false - end - - # FIXME: Deprecated: remove for 4.1 - def omniauth_enabled? - ActiveSupport::Deprecation.warn("Settings.omniauth_enabled? is deprecated and will be removed from GitLab 4.1", caller) - omniauth.enabled - rescue Settingslogic::MissingSetting - false - end - - # FIXME: Deprecated: remove for 4.1 - def omniauth_providers - ActiveSupport::Deprecation.warn("Settings.omniauth_providers is deprecated and will be removed from GitLab 4.1", caller) - omniauth.providers - rescue Settingslogic::MissingSetting - [] - end - - # FIXME: Deprecated: remove for 4.1 - def disable_gravatar? - ActiveSupport::Deprecation.warn("Settings.disable_gravatar? is deprecated and will be removed from GitLab 4.1", caller) - !gravatar.enabled - rescue Settingslogic::MissingSetting - app['disable_gravatar'] || false - end - - # FIXME: Deprecated: remove for 4.1 - def gravatar_url - ActiveSupport::Deprecation.warn("Settings.gravatar_url is deprecated and will be removed from GitLab 4.1", caller) - gravatar.plain_url - rescue Settingslogic::MissingSetting - app['gravatar_url'] || 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' - end - - # FIXME: Deprecated: remove for 4.1 - def gravatar_ssl_url - ActiveSupport::Deprecation.warn("Settings.gravatar_ssl_url is deprecated and will be removed from GitLab 4.1", caller) - gravatar.ssl_url - rescue Settingslogic::MissingSetting - 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 @@ -291,7 +25,8 @@ class Settings < Settingslogic [ gitlab.protocol, "://", gitlab.host, - custom_port + custom_port, + gitlab.relative_url_root ].join('') end end @@ -299,14 +34,6 @@ end # Default settings - -# FIXME: Deprecated: remove for 4.1 -# all Settings.web ... -# all Settings.app ... -# all Settings.email ... -# all Settings.git_host ... -Settings['pre_40_config'] ||= Settings['web'].present? - Settings['ldap'] ||= Settingslogic.new({}) Settings.ldap['enabled'] ||= false @@ -315,38 +42,38 @@ Settings.omniauth['enabled'] ||= false Settings.omniauth['providers'] ||= [] Settings['gitlab'] ||= Settingslogic.new({}) -Settings.gitlab['default_projects_limit'] ||= Settings.pre_40_config ? Settings.default_projects_limit : 10 -Settings.gitlab['host'] ||= Settings.pre_40_config ? Settings.web_host : 'localhost' -Settings.gitlab['https'] ||= Settings.pre_40_config ? Settings.web.https : false +Settings.gitlab['default_projects_limit'] ||= 10 +Settings.gitlab['host'] ||= 'localhost' +Settings.gitlab['https'] ||= false Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 +Settings.gitlab['relative_url_root'] ||= '' Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" -Settings.gitlab['email_from'] ||= Settings.pre_40_config ? Settings.email_from : "gitlab@#{Settings.gitlab.host}" -Settings.gitlab['url'] ||= Settings.pre_40_config ? Settings.url : Settings.send(:build_gitlab_url) +Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" +Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) Settings['gravatar'] ||= Settingslogic.new({}) -Settings.gravatar['enabled'] ||= Settings.pre_40_config ? !Settings.disable_gravatar? : true -Settings.gravatar['plain_url'] ||= Settings.pre_40_config ? Settings.gravatar_url : 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' -Settings.gravatar['ssl_url'] ||= Settings.pre_40_config ? Settings.gravatar_ssl_url : 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' +Settings.gravatar['enabled'] ||= true +Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' +Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' Settings['gitolite'] ||= Settingslogic.new({}) -Settings.gitolite['admin_key'] ||= Settings.pre_40_config ? Settings.gitolite_admin_key : 'gitlab' -Settings.gitolite['admin_uri'] ||= Settings.pre_40_config ? Settings.gitolite_admin_uri : 'git@localhost:gitolite-admin' -Settings.gitolite['config_file'] ||= Settings.pre_40_config ? Settings.gitolite_config_file : 'gitolite.conf' -Settings.gitolite['hooks_path'] ||= Settings.pre_40_config ? Settings.git_hooks_path : '/home/git/share/gitolite/hooks/' -Settings.gitolite['receive_pack'] ||= Settings.pre_40_config ? Settings.git_receive_pack : (Settings.gitolite['receive_pack'] != false) -Settings.gitolite['repos_path'] ||= Settings.pre_40_config ? Settings.git_base_path : '/home/git/repositories/' -Settings.gitolite['upload_pack'] ||= Settings.pre_40_config ? Settings.git_upload_pack : (Settings.gitolite['upload_pack'] != false) -Settings.gitolite['ssh_host'] ||= Settings.pre_40_config ? Settings.ssh_host : (Settings.gitlab.host || 'localhost') -Settings.gitolite['ssh_port'] ||= Settings.pre_40_config ? Settings.ssh_port : 22 -Settings.gitolite['ssh_user'] ||= Settings.pre_40_config ? Settings.ssh_user : 'git' -Settings.gitolite['ssh_path_prefix'] ||= Settings.pre_40_config ? Settings.ssh_path : Settings.send(:build_gitolite_ssh_path_prefix) +Settings.gitolite['admin_key'] ||= 'gitlab' +Settings.gitolite['admin_uri'] ||= 'git@localhost:gitolite-admin' +Settings.gitolite['config_file'] ||= 'gitolite.conf' +Settings.gitolite['hooks_path'] ||= '/home/git/share/gitolite/hooks/' +Settings.gitolite['receive_pack'] ||= (Settings.gitolite['receive_pack'] != false) +Settings.gitolite['repos_path'] ||= '/home/git/repositories/' +Settings.gitolite['upload_pack'] ||= (Settings.gitolite['upload_pack'] != false) +Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost') +Settings.gitolite['ssh_port'] ||= 22 +Settings.gitolite['ssh_user'] ||= 'git' +Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix) Settings['backup'] ||= Settingslogic.new({}) -Settings.backup['keep_time'] ||= Settings.pre_40_config ? Settings.backup_keep_time : 0 -Settings.backup['path'] = Settings.pre_40_config ? Settings.backup_path : File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) +Settings.backup['keep_time'] ||= 0 +Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) Settings['git'] ||= Settingslogic.new({}) -Settings.git['max_size'] ||= Settings.pre_40_config ? Settings.git_max_size : 5242880 # 5.megabytes -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.git['max_size'] ||= 5242880 # 5.megabytes +Settings.git['bin_path'] ||= '/usr/bin/git' +Settings.git['timeout'] ||= 10 diff --git a/config/initializers/4_resque.rb b/config/initializers/4_resque.rb deleted file mode 100644 index 419dbe06061..00000000000 --- a/config/initializers/4_resque.rb +++ /dev/null @@ -1,29 +0,0 @@ -# Custom Redis configuration -config_file = Rails.root.join('config', 'resque.yml') - -if File.exists?(config_file) - resque_config = YAML.load_file(config_file) - Resque.redis = resque_config[Rails.env] -end -Resque.redis.namespace = 'resque:gitlab' -# Queues -Resque.watch_queue(PostReceive.instance_variable_get("@queue")) - -# Authentication -require 'resque/server' -class Authentication - def initialize(app) - @app = app - end - - def call(env) - account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user) - raise "Access denied" if !account.admin? - @app.call(env) - end -end - -Resque::Server.use Authentication - -# Mailer -Resque::Mailer.excluded_environments = [] diff --git a/config/initializers/4_sidekiq.rb b/config/initializers/4_sidekiq.rb new file mode 100644 index 00000000000..6abe6e74fa0 --- /dev/null +++ b/config/initializers/4_sidekiq.rb @@ -0,0 +1,22 @@ +# Custom Redis configuration +config_file = Rails.root.join('config', 'resque.yml') + +resque_url = if File.exists?(config_file) + YAML.load_file(config_file)[Rails.env] + else + "localhost:6379" + end + +Sidekiq.configure_server do |config| + config.redis = { + url: "redis://#{resque_url}", + namespace: 'resque:gitlab' + } +end + +Sidekiq.configure_client do |config| + config.redis = { + url: "redis://#{resque_url}", + namespace: 'resque:gitlab' + } +end diff --git a/config/initializers/passenger_fix.rb b/config/initializers/passenger_fix.rb new file mode 100644 index 00000000000..3a88eb10a36 --- /dev/null +++ b/config/initializers/passenger_fix.rb @@ -0,0 +1,16 @@ +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| + # if we're in smart spawning mode, reconnect to Redis + Resque.redis.client.reconnect if forked + end +end diff --git a/config/routes.rb b/config/routes.rb index e08bfebc020..ffcfd1ee6f5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +require 'sidekiq/web' + Gitlab::Application.routes.draw do # # Search @@ -8,9 +10,10 @@ Gitlab::Application.routes.draw do require 'api' mount Gitlab::API => '/api' - # Optionally, enable Resque here - require 'resque/server' - mount Resque::Server => '/info/resque', as: 'resque' + constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin? } + constraints constraint do + mount Sidekiq::Web, at: "/admin/sidekiq", as: :sidekiq + end # Enable Grack support mount Grack::Bundle.new({ @@ -18,7 +21,7 @@ Gitlab::Application.routes.draw do project_root: Gitlab.config.gitolite.repos_path, upload_pack: Gitlab.config.gitolite.upload_pack, receive_pack: Gitlab.config.gitolite.receive_pack - }), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ } + }), at: '/', constraints: lambda { |request| /[-\/\w\.-]+\.git\//.match(request.path_info) } # # Help @@ -47,6 +50,7 @@ Gitlab::Application.routes.draw do resources :groups, constraints: { id: /[^\/]+/ } do member do put :project_update + put :project_teams_update delete :remove_project end end @@ -102,6 +106,7 @@ Gitlab::Application.routes.draw do get :merge_requests get :search get :people + post :team_members end end @@ -112,13 +117,22 @@ Gitlab::Application.routes.draw do # # Project Area # - resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do + resources :projects, constraints: { id: /[a-zA-Z.0-9_\-\/]+/ }, except: [:new, :create, :index], path: "/" do member do get "wall" get "graph" get "files" end + resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} + resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} + resources :commits, only: [:show], constraints: {id: /.+/} + resources :compare, only: [:index, :create] + resources :blame, only: [:show], constraints: {id: /.+/} + resources :blob, only: [:show], constraints: {id: /.+/} + match "/compare/:from...:to" => "compare#show", as: "compare", + :via => [:get, :post], constraints: {from: /.+/, to: /.+/} + resources :wikis, only: [:show, :edit, :destroy, :create] do collection do get :pages @@ -147,7 +161,7 @@ Gitlab::Application.routes.draw do resources :deploy_keys resources :protected_branches, only: [:index, :create, :destroy] - resources :refs, only: [], path: "/" do + resources :refs, only: [] do collection do get "switch" end @@ -190,14 +204,6 @@ Gitlab::Application.routes.draw do end end - resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} - resources :commits, only: [:show], constraints: {id: /.+/} - resources :compare, only: [:index, :create] - resources :blame, only: [:show], constraints: {id: /.+/} - resources :blob, only: [:show], constraints: {id: /.+/} - resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} - match "/compare/:from...:to" => "compare#show", as: "compare", - :via => [:get, :post], constraints: {from: /.+/, to: /.+/} resources :team, controller: 'team_members', only: [:index] resources :milestones, except: [:destroy] diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index 425dbf33f86..4852cd65daa 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -1,3 +1,7 @@ +# uncomment and customize to run in non-root path +# note that config/gitlab.yml web path should also be changed +# ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" + app_dir = "/home/gitlab/gitlab/" worker_processes 2 working_directory app_dir diff --git a/db/fixtures/development/002_project.rb b/db/fixtures/development/002_project.rb index 4db11a878ec..e50ab5d9d52 100644 --- a/db/fixtures/development/002_project.rb +++ b/db/fixtures/development/002_project.rb @@ -1,14 +1,26 @@ Group.seed(:id, [ + { id: 99, name: "GitLab", path: 'gitlab', owner_id: 1 }, { id: 100, name: "Brightbox", path: 'brightbox', owner_id: 1 }, { id: 101, name: "KDE", path: 'kde', owner_id: 1 }, ]) Project.seed(:id, [ - { id: 1, name: "Underscore.js", path: "underscore", owner_id: 1 }, - { id: 2, name: "Diaspora", path: "diaspora", owner_id: 1 }, - { id: 3, namespace_id: 100, name: "Brightbox CLI", path: "brightbox-cli", owner_id: 1 }, - { id: 4, namespace_id: 100, name: "Puppet", path: "puppet", owner_id: 1 }, - { id: 5, namespace_id: 101, name: "kdebase", path: "kdebase", owner_id: 1}, - { id: 6, namespace_id: 101, name: "kdelibs", path: "kdelibs", owner_id: 1}, - { id: 7, namespace_id: 101, name: "amarok", path: "amarok", owner_id: 1}, + + # Global + { id: 1, name: "Underscore.js", path: "underscore", creator_id: 1 }, + { id: 2, name: "Diaspora", path: "diaspora", creator_id: 1 }, + + # Brightbox + { id: 3, namespace_id: 100, name: "Brightbox CLI", path: "brightbox-cli", creator_id: 1 }, + { id: 4, namespace_id: 100, name: "Puppet", path: "puppet", creator_id: 1 }, + + # KDE + { id: 5, namespace_id: 101, name: "kdebase", path: "kdebase", creator_id: 1}, + { id: 6, namespace_id: 101, name: "kdelibs", path: "kdelibs", creator_id: 1}, + { id: 7, namespace_id: 101, name: "amarok", path: "amarok", creator_id: 1}, + + # GitLab + { id: 8, namespace_id: 99, name: "gitlabhq", path: "gitlabhq", creator_id: 1}, + { id: 9, namespace_id: 99, name: "gitlab-ci", path: "gitlab-ci", creator_id: 1}, + { id: 10, namespace_id: 99, name: "gitlab-recipes", path: "gitlab-recipes", creator_id: 1}, ]) diff --git a/db/fixtures/development/003_users.rb b/db/fixtures/development/003_users.rb index 25705f1b726..abcb0259618 100644 --- a/db/fixtures/development/003_users.rb +++ b/db/fixtures/development/003_users.rb @@ -1,11 +1,15 @@ -User.seed(:id, [ - { id: 2, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 3, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 4, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 5, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 6, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 7, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 8, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email}, - { id: 9, username: Faker::Internet.user_name, name: Faker::Name.name, email: Faker::Internet.email} -]) - +Gitlab::Seeder.quiet do + (2..300).each do |i| + begin + User.seed(:id, [{ + id: i, + username: Faker::Internet.user_name, + name: Faker::Name.name, + email: Faker::Internet.email, + }]) + print '.' + rescue ActiveRecord::RecordNotSaved + print 'F' + end + end +end diff --git a/db/fixtures/development/004_teams.rb b/db/fixtures/development/004_teams.rb index 2752cb44e1d..7a8f9139d3f 100644 --- a/db/fixtures/development/004_teams.rb +++ b/db/fixtures/development/004_teams.rb @@ -1,24 +1,26 @@ UsersProject.skip_callback(:save, :after, :update_repository) -UsersProject.seed(:id, [ - { :id => 1, :project_id => 1, :user_id => 1, :project_access => UsersProject::MASTER }, - { :id => 2, :project_id => 1, :user_id => 2, :project_access => UsersProject::REPORTER}, - { :id => 3, :project_id => 1, :user_id => 3, :project_access => UsersProject::REPORTER}, - { :id => 4, :project_id => 1, :user_id => 4, :project_access => UsersProject::REPORTER}, - { :id => 5, :project_id => 1, :user_id => 5, :project_access => UsersProject::REPORTER}, +Gitlab::Seeder.quiet do - { :id => 6, :project_id => 2, :user_id => 1, :project_access => UsersProject::MASTER }, - { :id => 7, :project_id => 2, :user_id => 2, :project_access => UsersProject::REPORTER}, - { :id => 8, :project_id => 2, :user_id => 3, :project_access => UsersProject::REPORTER}, - { :id => 9, :project_id => 2, :user_id => 4, :project_access => UsersProject::MASTER}, - { :id => 11, :project_id => 2, :user_id => 5, :project_access => UsersProject::MASTER}, + (1..300).each do |i| + # Random Project + project = Project.scoped.sample - { :id => 12, :project_id => 3, :user_id => 1, :project_access => UsersProject::MASTER }, - { :id => 13, :project_id => 3, :user_id => 2, :project_access => UsersProject::REPORTER}, - { :id => 14, :project_id => 3, :user_id => 3, :project_access => UsersProject::MASTER}, - { :id => 15, :project_id => 3, :user_id => 4, :project_access => UsersProject::REPORTER}, - { :id => 16, :project_id => 3, :user_id => 5, :project_access => UsersProject::MASTER} -]) + # Random user + user = User.not_in_project(project).sample + + next unless user + + UsersProject.seed(:id, [{ + id: i, + project_id: project.id, + user_id: user.id, + project_access: UsersProject.access_roles.values.sample + }]) + + print('.') + end +end UsersProject.set_callback(:save, :after, :update_repository) diff --git a/db/fixtures/development/006_wall.rb b/db/fixtures/development/006_wall.rb index a9fb66dda6b..c4e304cc217 100644 --- a/db/fixtures/development/006_wall.rb +++ b/db/fixtures/development/006_wall.rb @@ -1,16 +1,18 @@ Gitlab::Seeder.quiet do (1..300).each do |i| # Random Project - project_id = rand(2) + 1 - project = Project.find(project_id) + project = Project.all.sample # Random user user = project.users.sample + + next unless user + user_id = user.id Note.seed(:id, [{ id: i, - project_id: project_id, + project_id: project.id, author_id: user_id, note: Faker::Lorem.sentence(6) }]) diff --git a/db/fixtures/development/007_issues.rb b/db/fixtures/development/007_issues.rb index 98e32fccc3d..8978db4742b 100644 --- a/db/fixtures/development/007_issues.rb +++ b/db/fixtures/development/007_issues.rb @@ -1,17 +1,19 @@ Gitlab::Seeder.quiet do (1..300).each do |i| # Random Project - project_id = rand(2) + 1 - project = Project.find(project_id) + project = Project.all.sample # Random user user = project.users.sample + + next unless user + user_id = user.id IssueObserver.current_user = user Issue.seed(:id, [{ id: i, - project_id: project_id, + project_id: project.id, author_id: user_id, assignee_id: user_id, closed: [true, false].sample, diff --git a/db/fixtures/development/008_merge_requests.rb b/db/fixtures/development/008_merge_requests.rb index 698c55ad95f..9904b4a1505 100644 --- a/db/fixtures/development/008_merge_requests.rb +++ b/db/fixtures/development/008_merge_requests.rb @@ -1,19 +1,20 @@ Gitlab::Seeder.quiet do (1..300).each do |i| # Random Project - project_id = rand(2) + 1 - project = Project.find(project_id) + project = Project.all.sample # Random user user = project.users.sample + + next unless user + user_id = user.id MergeRequestObserver.current_user = user - MergeRequest.seed(:id, [{ id: i, source_branch: 'master', target_branch: 'feature', - project_id: project_id, + project_id: project.id, author_id: user_id, assignee_id: user_id, closed: [true, false].sample, diff --git a/db/fixtures/development/009_source_code.rb b/db/fixtures/development/009_source_code.rb index 6b9b6584a58..a64b905ee89 100644 --- a/db/fixtures/development/009_source_code.rb +++ b/db/fixtures/development/009_source_code.rb @@ -1,16 +1,18 @@ -root = Gitlab.config.git_base_path +root = Gitlab.config.gitolite.repos_path projects = [ - { path: 'underscore.git', git: 'https://github.com/documentcloud/underscore.git' }, - { path: 'diaspora.git', git: 'https://github.com/diaspora/diaspora.git' }, + { path: 'underscore.git', git: 'https://github.com/documentcloud/underscore.git' }, + { path: 'diaspora.git', git: 'https://github.com/diaspora/diaspora.git' }, { path: 'brightbox/brightbox-cli.git', git: 'https://github.com/brightbox/brightbox-cli.git' }, - { path: 'brightbox/puppet.git', git: 'https://github.com/brightbox/puppet.git' }, + { path: 'brightbox/puppet.git', git: 'https://github.com/brightbox/puppet.git' }, + { path: 'gitlab/gitlabhq.git', git: 'https://github.com/gitlabhq/gitlabhq.git' }, + { path: 'gitlab/gitlab-ci.git', git: 'https://github.com/gitlabhq/gitlab-ci.git' }, + { path: 'gitlab/gitlab-recipes.git', git: 'https://github.com/gitlabhq/gitlab-recipes.git' }, ] projects.each do |project| project_path = File.join(root, project[:path]) - next if File.exists?(project_path) cmds = [ diff --git a/db/fixtures/development/010_keys.rb b/db/fixtures/development/010_keys.rb new file mode 100644 index 00000000000..8e4724c277c --- /dev/null +++ b/db/fixtures/development/010_keys.rb @@ -0,0 +1,14 @@ + +Gitlab::Seeder.quiet do + User.first(30).each_with_index do |user, i| + Key.seed(:id, [ + { + id: i, + title: "Sample key #{i}", + key: "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt#{i + 100}6k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", + user_id: user.id, + } + ]) + puts "SSH KEY ##{i} added.".green + end +end diff --git a/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb b/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb new file mode 100644 index 00000000000..d0fca269871 --- /dev/null +++ b/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb @@ -0,0 +1,5 @@ +class RenameOwnerToCreatorForProject < ActiveRecord::Migration + def change + rename_column :projects, :owner_id, :creator_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 7de5593285a..b1cf0ccbdb2 100644 --- 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 => 20130102143055) do create_table "events", :force => true do |t| t.string "target_type" @@ -148,7 +148,7 @@ ActiveRecord::Schema.define(:version => 20121219095402) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.boolean "private_flag", :default => true, :null => false - t.integer "owner_id" + t.integer "creator_id" t.string "default_branch" t.boolean "issues_enabled", :default => true, :null => false t.boolean "wall_enabled", :default => true, :null => false @@ -157,8 +157,8 @@ ActiveRecord::Schema.define(:version => 20121219095402) do t.integer "namespace_id" end + add_index "projects", ["creator_id"], :name => "index_projects_on_owner_id" add_index "projects", ["namespace_id"], :name => "index_projects_on_namespace_id" - add_index "projects", ["owner_id"], :name => "index_projects_on_owner_id" create_table "protected_branches", :force => true do |t| t.integer "project_id", :null => false diff --git a/doc/app/Ability.html b/doc/app/Ability.html deleted file mode 100644 index f780d067332..00000000000 --- a/doc/app/Ability.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - - -class Ability - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Ability

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- allowed(object, subject) - click to toggle source -
- - -
- - - - - -
-
# File app/models/ability.rb, line 3
-def allowed(object, subject)
-  case subject.class.name
-  when "Project" then project_abilities(object, subject)
-  when "Issue" then issue_abilities(object, subject)
-  when "Note" then note_abilities(object, subject)
-  when "Snippet" then snippet_abilities(object, subject)
-  when "MergeRequest" then merge_request_abilities(object, subject)
-  else []
-  end
-end
-
- -
- - - - -
- - -
- -
- project_abilities(user, project) - click to toggle source -
- - -
- - - - - -
-
# File app/models/ability.rb, line 14
-def project_abilities(user, project)
-  rules = []
-
-  rules << [
-    :read_project,
-    :read_wiki,
-    :read_issue,
-    :read_milestone,
-    :read_snippet,
-    :read_team_member,
-    :read_merge_request,
-    :read_note,
-    :write_project,
-    :write_issue,
-    :write_note
-  ] if project.guest_access_for?(user)
-
-  rules << [
-    :download_code,
-    :write_merge_request,
-    :write_snippet
-  ] if project.report_access_for?(user)
-
-  rules << [
-    :write_wiki,
-    :push_code
-  ] if project.dev_access_for?(user)
-
-  rules << [
-    :push_code_to_protected_branches
-  ] if project.master_access_for?(user)
-
-  rules << [
-    :modify_issue,
-    :modify_snippet,
-    :modify_merge_request,
-    :admin_project,
-    :admin_issue,
-    :admin_milestone,
-    :admin_snippet,
-    :admin_team_member,
-    :admin_merge_request,
-    :admin_note,
-    :accept_mr,
-    :admin_wiki
-  ] if project.master_access_for?(user) || project.owner == user
-
-  rules.flatten
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Account.html b/doc/app/Account.html deleted file mode 100644 index 58f657586b2..00000000000 --- a/doc/app/Account.html +++ /dev/null @@ -1,881 +0,0 @@ - - - - - - -module Account - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Account

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- block() - click to toggle source -
- - -
- -

Remove user from all projects and set blocked attribute to true

- - - -
-
# File app/roles/account.rb, line 47
-def block
-  users_projects.find_each do |membership|
-    return false unless membership.destroy
-  end
-
-  self.blocked = true
-  save
-end
-
- -
- - - - -
- - -
- -
- can_create_group?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 25
-def can_create_group?
-  is_admin?
-end
-
- -
- - - - -
- - -
- -
- can_create_project?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 21
-def can_create_project?
-  projects_limit > my_own_projects.count
-end
-
- -
- - - - -
- - -
- -
- cared_merge_requests() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 37
-def cared_merge_requests
-  MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id).opened
-end
-
- -
- - - - -
- - -
- -
- first_name() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 33
-def first_name
-  name.split.first unless name.blank?
-end
-
- -
- - - - -
- - -
- -
- identifier() - click to toggle source -
- - -
- -

Returns a string for use as a Gitolite user identifier

- -

Note that Gitolite 2.x requires the following -pattern for users:

- -
^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$
- - - -
-
# File app/roles/account.rb, line 7
-def identifier
-  # Replace non-word chars with underscores, then make sure it starts with
-  # valid chars
-  email.gsub(%r\W/, '_').gsub(%r\A([\W\_])+/, '')
-end
-
- -
- - - - -
- - -
- -
- is_admin?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 13
-def is_admin?
-  admin
-end
-
- -
- - - - -
- - -
- -
- last_activity_project() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 29
-def last_activity_project
-  projects.first
-end
-
- -
- - - - -
- - -
- -
- project_ids() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 41
-def project_ids
-  projects.map(&:id)
-end
-
- -
- - - - -
- - -
- -
- projects_limit_percent() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 56
-def projects_limit_percent
-  return 100 if projects_limit.zero?
-  (my_own_projects.count.to_f / projects_limit) * 100
-end
-
- -
- - - - -
- - -
- -
- projects_with_events() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 70
-def projects_with_events
-  projects.includes(:events).order("events.created_at DESC")
-end
-
- -
- - - - -
- - -
- -
- recent_push(project_id = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 61
-def recent_push project_id = nil
-  # Get push events not earlier than 2 hours ago
-  events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours)
-  events = events.where(project_id: project_id) if project_id
-
-  # Take only latest one
-  events = events.recent.limit(1).first
-end
-
- -
- - - - -
- - -
- -
- require_ssh_key?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/account.rb, line 17
-def require_ssh_key?
-  keys.count == 0
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ActivityObserver.html b/doc/app/ActivityObserver.html deleted file mode 100644 index 3b31271d5ca..00000000000 --- a/doc/app/ActivityObserver.html +++ /dev/null @@ -1,531 +0,0 @@ - - - - - - -class ActivityObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ActivityObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(record) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/activity_observer.rb, line 4
-def after_create(record)
-  Event.create(
-    project: record.project,
-    target_id: record.id,
-    target_type: record.class.name,
-    action: Event.determine_action(record),
-    author_id: record.author_id
-  )
-end
-
- -
- - - - -
- - -
- -
- after_save(record) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/activity_observer.rb, line 14
-def after_save(record)
-  if record.changed.include?("closed") 
-    Event.create(
-      project: record.project,
-      target_id: record.id,
-      target_type: record.class.name,
-      action: (record.closed ? Event::Closed : Event::Reopened),
-      author_id: record.author_id_of_changes
-    )
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin.html b/doc/app/Admin.html deleted file mode 100644 index 94fb27efb98..00000000000 --- a/doc/app/Admin.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - -module Admin - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Admin

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Admin/DashboardController.html b/doc/app/Admin/DashboardController.html deleted file mode 100644 index 00154b3dff3..00000000000 --- a/doc/app/Admin/DashboardController.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - -class Admin::DashboardController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::DashboardController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/dashboard_controller.rb, line 2
-def index
-  @workers = Resque.workers
-  @pending_jobs = Resque.size(:post_receive)
-  @projects = Project.order("created_at DESC").limit(10)
-  @users = User.order("created_at DESC").limit(10)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin/GroupsController.html b/doc/app/Admin/GroupsController.html deleted file mode 100644 index ef4dae9ecda..00000000000 --- a/doc/app/Admin/GroupsController.html +++ /dev/null @@ -1,771 +0,0 @@ - - - - - - -class Admin::GroupsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::GroupsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 23
-def create
-  @group = Group.new(params[:group])
-  @group.owner = current_user
-
-  if @group.save
-    redirect_to [:admin, @group], notice: 'Group was successfully created.'
-  else
-    render action: "new"
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 64
-def destroy
-  @group.destroy
-
-  redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 20
-def edit
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 4
-def index
-  @groups = Group.scoped
-  @groups = @groups.search(params[:name]) if params[:name].present?
-  @groups = @groups.page(params[:page]).per(20)
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 16
-def new
-  @group = Group.new
-end
-
- -
- - - - -
- - -
- -
- project_update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 49
-def project_update
-  project_ids = params[:project_ids]
-  Project.where(id: project_ids).update_all(group_id: @group.id)
-
-  redirect_to :back, notice: 'Group was successfully updated.'
-end
-
- -
- - - - -
- - -
- -
- remove_project() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 56
-def remove_project
-  @project = Project.find(params[:project_id])
-  @project.group_id = nil
-  @project.save
-
-  redirect_to :back, notice: 'Group was successfully updated.'
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 10
-def show
-  @projects = Project.scoped
-  @projects = @projects.not_in_group(@group) if @group.projects.present?
-  @projects = @projects.all
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/groups_controller.rb, line 34
-def update
-  group_params = params[:group].dup
-  owner_id =group_params.delete(:owner_id)
-
-  if owner_id
-    @group.owner = User.find(owner_id)
-  end
-
-  if @group.update_attributes(group_params)
-    redirect_to [:admin, @group], notice: 'Group was successfully updated.'
-  else
-    render action: "edit"
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin/HooksController.html b/doc/app/Admin/HooksController.html deleted file mode 100644 index 48cd5d00454..00000000000 --- a/doc/app/Admin/HooksController.html +++ /dev/null @@ -1,603 +0,0 @@ - - - - - - -class Admin::HooksController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::HooksController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/hooks_controller.rb, line 7
-def create
-  @hook = SystemHook.new(params[:hook])
-
-  if @hook.save
-    redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
-  else
-    @hooks = SystemHook.all
-    render :index
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/hooks_controller.rb, line 18
-def destroy
-  @hook = SystemHook.find(params[:id])
-  @hook.destroy
-
-  redirect_to admin_hooks_path
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/hooks_controller.rb, line 2
-def index
-  @hooks = SystemHook.all
-  @hook = SystemHook.new
-end
-
- -
- - - - -
- - -
- -
- test() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/hooks_controller.rb, line 26
-def test
-  @hook = SystemHook.find(params[:hook_id])
-  data = {
-    event_name: "project_create",
-    name: "Ruby",
-    path: "ruby",
-    project_id: 1,
-    owner_name: "Someone",
-    owner_email: "example@gitlabhq.com"
-  }
-  @hook.execute(data)
-
-  redirect_to :back
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin/LogsController.html b/doc/app/Admin/LogsController.html deleted file mode 100644 index 8f70b1ade2c..00000000000 --- a/doc/app/Admin/LogsController.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Admin::LogsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::LogsController

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Admin/ProjectsController.html b/doc/app/Admin/ProjectsController.html deleted file mode 100644 index 5744746b47c..00000000000 --- a/doc/app/Admin/ProjectsController.html +++ /dev/null @@ -1,733 +0,0 @@ - - - - - - -class Admin::ProjectsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::ProjectsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 29
-def create
-  @admin_project = Project.new(params[:project])
-  @admin_project.owner = current_user
-
-  if @admin_project.save
-    redirect_to [:admin, @admin_project], notice: 'Project was successfully created.'
-  else
-    render action: "new"
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 54
-def destroy
-  @admin_project.destroy
-
-  redirect_to admin_projects_url, notice: 'Project was successfully deleted.'
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 20
-def edit
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 4
-def index
-  @admin_projects = Project.scoped
-  @admin_projects = @admin_projects.search(params[:name]) if params[:name].present?
-  @admin_projects = @admin_projects.page(params[:page]).per(20)
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 16
-def new
-  @admin_project = Project.new
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 10
-def show
-  @users = User.scoped
-  @users = @users.not_in_project(@admin_project) if @admin_project.users.present?
-  @users = @users.all
-end
-
- -
- - - - -
- - -
- -
- team_update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 23
-def team_update
-  @admin_project.add_users_ids_to_team(params[:user_ids], params[:project_access])
-
-  redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/projects_controller.rb, line 40
-def update
-  owner_id = params[:project].delete(:owner_id)
-
-  if owner_id
-    @admin_project.owner = User.find(owner_id)
-  end
-
-  if @admin_project.update_attributes(params[:project])
-    redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.'
-  else
-    render action: "edit"
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin/ResqueController.html b/doc/app/Admin/ResqueController.html deleted file mode 100644 index db73599b4a7..00000000000 --- a/doc/app/Admin/ResqueController.html +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - -class Admin::ResqueController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::ResqueController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/resque_controller.rb, line 2
-def show
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin/TeamMembersController.html b/doc/app/Admin/TeamMembersController.html deleted file mode 100644 index 907bf279f8e..00000000000 --- a/doc/app/Admin/TeamMembersController.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - - -class Admin::TeamMembersController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::TeamMembersController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/team_members_controller.rb, line 16
-def destroy
-  @admin_team_member = UsersProject.find(params[:id])
-  @admin_team_member.destroy
-
-  redirect_to :back
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/team_members_controller.rb, line 2
-def edit
-  @admin_team_member = UsersProject.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/team_members_controller.rb, line 6
-def update
-  @admin_team_member = UsersProject.find(params[:id])
-
-  if @admin_team_member.update_attributes(params[:team_member])
-    redirect_to [:admin, @admin_team_member.project],  notice: 'Project Access was successfully updated.'
-  else
-    render action: "edit"
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Admin/UsersController.html b/doc/app/Admin/UsersController.html deleted file mode 100644 index b300e4f7fc5..00000000000 --- a/doc/app/Admin/UsersController.html +++ /dev/null @@ -1,839 +0,0 @@ - - - - - - -class Admin::UsersController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Admin::UsersController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- block() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 40
-def block
-  @admin_user = User.find(params[:id])
-
-  if @admin_user.block
-    redirect_to :back, alert: "Successfully blocked"
-  else
-    redirect_to :back, alert: "Error occured. User was not blocked"
-  end
-end
-
- -
- - - - -
- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 60
-def create
-  admin = params[:user].delete("admin")
-
-  @admin_user = User.new(params[:user], as: :admin)
-  @admin_user.admin = (admin && admin.to_i > 0)
-
-  respond_to do |format|
-    if @admin_user.save
-      format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully created.' }
-      format.json { render json: @admin_user, status: :created, location: @admin_user }
-    else
-      format.html { render action: "new" }
-      format.json { render json: @admin_user.errors, status: :unprocessable_entity }
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 99
-def destroy
-  @admin_user = User.find(params[:id])
-  @admin_user.destroy
-
-  respond_to do |format|
-    format.html { redirect_to admin_users_url }
-    format.json { head :ok }
-  end
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 36
-def edit
-  @admin_user = User.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 2
-def index
-  @admin_users = User.scoped
-  @admin_users = @admin_users.filter(params[:filter])
-  @admin_users = @admin_users.search(params[:name]) if params[:name].present?
-  @admin_users = @admin_users.order("updated_at DESC").page(params[:page])
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 32
-def new
-  @admin_user = User.new({ projects_limit: Gitlab.config.default_projects_limit }, as: :admin)
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 9
-def show
-  @admin_user = User.find(params[:id])
-
-  @projects = if @admin_user.projects.empty?
-             Project
-           else
-             Project.without_user(@admin_user)
-           end.all
-end
-
- -
- - - - -
- - -
- -
- team_update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 19
-def team_update
-  @admin_user = User.find(params[:id])
-
-  UsersProject.user_bulk_import(
-    @admin_user,
-    params[:project_ids],
-    params[:project_access]
-  )
-
-  redirect_to [:admin, @admin_user], notice: 'Teams were successfully updated.'
-end
-
- -
- - - - -
- - -
- -
- unblock() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 50
-def unblock
-  @admin_user = User.find(params[:id])
-
-  if @admin_user.update_attribute(:blocked, false)
-    redirect_to :back, alert: "Successfully unblocked"
-  else
-    redirect_to :back, alert: "Error occured. User was not unblocked"
-  end
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin/users_controller.rb, line 77
-def update
-  admin = params[:user].delete("admin")
-
-  if params[:user][:password].blank?
-    params[:user].delete(:password)
-    params[:user].delete(:password_confirmation)
-  end
-
-  @admin_user = User.find(params[:id])
-  @admin_user.admin = (admin && admin.to_i > 0)
-
-  respond_to do |format|
-    if @admin_user.update_attributes(params[:user], as: :admin)
-      format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully updated.' }
-      format.json { head :ok }
-    else
-      format.html { render action: "edit" }
-      format.json { render json: @admin_user.errors, status: :unprocessable_entity }
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/AdminController.html b/doc/app/AdminController.html deleted file mode 100644 index bdda7958da9..00000000000 --- a/doc/app/AdminController.html +++ /dev/null @@ -1,490 +0,0 @@ - - - - - - -class AdminController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class AdminController

- -
- -

Provides a base class for Admin controllers to -subclass

- -

Automatically sets the layout and ensures an administrator is logged in

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- authenticate_admin!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/admin_controller.rb, line 8
-def authenticate_admin!
-  return render_404 unless current_user.is_admin?
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ApplicationController.html b/doc/app/ApplicationController.html deleted file mode 100644 index dafa341313a..00000000000 --- a/doc/app/ApplicationController.html +++ /dev/null @@ -1,1015 +0,0 @@ - - - - - - -class ApplicationController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ApplicationController

- -
- -
- - - - -
- - - - - - - - - - -
-

Protected Instance Methods

- - -
- -
- abilities() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 48
-def abilities
-  @abilities ||= Six.new
-end
-
- -
- - - - -
- - -
- -
- access_denied!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 73
-def access_denied!
-  render "errors/access_denied", layout: "errors", status: 404
-end
-
- -
- - - - -
- - -
- -
- add_project_abilities() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 61
-def add_project_abilities
-  abilities << Ability
-end
-
- -
- - - - -
- - -
- -
- after_sign_in_path_for(resource) - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 33
-def after_sign_in_path_for resource
-  if resource.is_a?(User) && resource.respond_to?(:blocked) && resource.blocked
-    sign_out resource
-    flash[:alert] = "Your account was blocked"
-    new_user_session_path
-  else
-    super
-  end
-end
-
- -
- - - - -
- - -
- -
- authorize_code_access!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 69
-def authorize_code_access!
-  return access_denied! unless can?(current_user, :download_code, project)
-end
-
- -
- - - - -
- - -
- -
- authorize_project!(action) - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 65
-def authorize_project!(action)
-  return access_denied! unless can?(current_user, action, project)
-end
-
- -
- - - - -
- - -
- -
- can?(object, action, subject) - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 52
-def can?(object, action, subject)
-  abilities.allowed?(object, action, subject)
-end
-
- -
- - - - -
- - -
- -
- dev_tools() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 107
-def dev_tools
-  Rack::MiniProfiler.authorize_request
-end
-
- -
- - - - -
- - -
- -
- git_not_found!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 81
-def git_not_found!
-  render "errors/git_not_found", layout: "errors", status: 404
-end
-
- -
- - - - -
- - -
- -
- method_missing(method_sym, *arguments, &block) - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 85
-def method_missing(method_sym, *arguments, &block)
-  if method_sym.to_s =~ %r^authorize_(.*)!$/
-    authorize_project!($1.to_sym)
-  else
-    super
-  end
-end
-
- -
- - - - -
- - -
- -
- no_cache_headers() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 101
-def no_cache_headers
-  response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
-  response.headers["Pragma"] = "no-cache"
-  response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
-end
-
- -
- - - - -
- - -
- -
- not_found!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 77
-def not_found!
-  render "errors/not_found", layout: "errors", status: 404
-end
-
- -
- - - - -
- - -
- -
- project() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 56
-def project
-  @project ||= current_user.projects.find_by_code(params[:project_id] || params[:id])
-  @project || render_404
-end
-
- -
- - - - -
- - -
- -
- reject_blocked!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 25
-def reject_blocked!
-  if current_user && current_user.blocked
-    sign_out current_user
-    flash[:alert] = "Your account was blocked"
-    redirect_to new_user_session_path
-  end
-end
-
- -
- - - - -
- - -
- -
- render_404() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 93
-def render_404
-  render file: Rails.root.join("public", "404"), layout: false, status: "404"
-end
-
- -
- - - - -
- - -
- -
- require_non_empty_project() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 97
-def require_non_empty_project
-  redirect_to @project if @project.empty_repo?
-end
-
- -
- - - - -
- - -
- -
- set_current_user_for_observers() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/application_controller.rb, line 43
-def set_current_user_for_observers
-  MergeRequestObserver.current_user = current_user
-  IssueObserver.current_user = current_user
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ApplicationDecorator.html b/doc/app/ApplicationDecorator.html deleted file mode 100644 index 72a459bb686..00000000000 --- a/doc/app/ApplicationDecorator.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class ApplicationDecorator - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ApplicationDecorator

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/ApplicationHelper.html b/doc/app/ApplicationHelper.html deleted file mode 100644 index 9bc4243e2d0..00000000000 --- a/doc/app/ApplicationHelper.html +++ /dev/null @@ -1,1018 +0,0 @@ - - - - - - -module ApplicationHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module ApplicationHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- app_theme() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 125
-def app_theme
-  Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
-end
-
- -
- - - - -
- - -
- -
- authbutton(provider, size = 64) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 150
-def authbutton(provider, size = 64)
-  file_name = "#{provider.to_s.split('_').first}_#{size}.png"
-  image_tag("authbuttons/#{file_name}",
-            alt: "Sign in with #{provider.to_s.titleize}")
-end
-
- -
- - - - -
- - -
- -
- current_action?(*args) - click to toggle source -
- - -
- -

Check if a partcular action is the current one

- -

args - One or more action names to check

- -

Examples

- -
# On Projects#new
-current_action?(:new)           # => true
-current_action?(:create)        # => false
-current_action?(:new, :create)  # => true
-
- - - -
-
# File app/helpers/application_helper.rb, line 29
-def current_action?(*args)
-  args.any? { |v| v.to_s.downcase == action_name }
-end
-
- -
- - - - -
- - -
- -
- current_controller?(*args) - click to toggle source -
- - -
- -

Check if a particular controller is the current one

- -

args - One or more controller names to check

- -

Examples

- -
# On TreeController
-current_controller?(:tree)           # => true
-current_controller?(:commits)        # => false
-current_controller?(:commits, :tree) # => true
-
- - - -
-
# File app/helpers/application_helper.rb, line 15
-def current_controller?(*args)
-  args.any? { |v| v.to_s.downcase == controller.controller_name }
-end
-
- -
- - - - -
- - -
- -
- emoji_autocomplete_source() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 115
-def emoji_autocomplete_source
-  # should be an array of strings
-  # so to_s can be called, because it is sufficient and to_json is too slow
-  Emoji.names.to_s
-end
-
- -
- - - - -
- - -
- -
- gravatar_icon(user_email = '', size = 40) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 33
-def gravatar_icon(user_email = '', size = 40)
-  if Gitlab.config.disable_gravatar? || user_email.blank?
-    'no_avatar.png'
-  else
-    gravatar_prefix = request.ssl? ? "https://secure" : "http://www"
-    user_email.strip!
-    "#{gravatar_prefix}.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&d=identicon"
-  end
-end
-
- -
- - - - -
- - -
- -
- grouped_options_refs(destination = :tree) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 61
-def grouped_options_refs(destination = :tree)
-  options = [
-    ["Branch", @project.branch_names ],
-    [ "Tag", @project.tag_names ]
-  ]
-
-  # If reference is commit id -
-  # we should add it to branch/tag selectbox
-  if(@ref && !options.flatten.include?(@ref) &&
-     @ref =~ %r^[0-9a-zA-Z]{6,52}$/)
-    options << ["Commit", [@ref]]
-  end
-
-  grouped_options_for_select(options, @ref || @project.default_branch)
-end
-
- -
- - - - -
- - -
- -
- hexdigest(string) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 137
-def hexdigest(string)
-  Digest::SHA1.hexdigest string
-end
-
- -
- - - - -
- - -
- -
- last_commit(project) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 51
-def last_commit(project)
-  if project.repo_exists?
-    time_ago_in_words(project.commit.committed_date) + " ago"
-  else
-    "Never"
-  end
-rescue
-  "Never"
-end
-
- -
- - - - -
- - -
- -
- ldap_enable?() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 121
-def ldap_enable?
-  Devise.omniauth_providers.include?(:ldap)
-end
-
- -
- - - - -
- - -
- -
- project_last_activity(project) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 141
-def project_last_activity project
-  activity = project.last_activity
-  if activity && activity.created_at
-    time_ago_in_words(activity.created_at) + " ago"
-  else
-    "Never"
-  end
-end
-
- -
- - - - -
- - -
- -
- request_protocol() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 43
-def request_protocol
-  request.ssl? ? "https" : "http"
-end
-
- -
- - - - -
- - -
- -
- search_autocomplete_source() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 77
-def search_autocomplete_source
-  projects = current_user.projects.map{ |p| { label: p.name, url: project_path(p) } }
-
-  default_nav = [
-    { label: "My Profile", url: profile_path },
-    { label: "My SSH Keys", url: keys_path },
-    { label: "My Dashboard", url: root_path },
-    { label: "Admin Section", url: admin_root_path },
-  ]
-
-  help_nav = [
-    { label: "Workflow Help", url: help_workflow_path },
-    { label: "Permissions Help", url: help_permissions_path },
-    { label: "Web Hooks Help", url: help_web_hooks_path },
-    { label: "System Hooks Help", url: help_system_hooks_path },
-    { label: "API Help", url: help_api_path },
-    { label: "Markdown Help", url: help_markdown_path },
-    { label: "SSH Keys Help", url: help_ssh_path },
-  ]
-
-  project_nav = []
-  if @project && !@project.new_record?
-    project_nav = [
-      { label: "#{@project.name} Issues",   url: project_issues_path(@project) },
-      { label: "#{@project.name} Commits",  url: project_commits_path(@project, @ref || @project.root_ref) },
-      { label: "#{@project.name} Merge Requests", url: project_merge_requests_path(@project) },
-      { label: "#{@project.name} Milestones", url: project_milestones_path(@project) },
-      { label: "#{@project.name} Snippets", url: project_snippets_path(@project) },
-      { label: "#{@project.name} Team",     url: project_team_index_path(@project) },
-      { label: "#{@project.name} Tree",     url: project_tree_path(@project, @ref || @project.root_ref) },
-      { label: "#{@project.name} Wall",     url: wall_project_path(@project) },
-      { label: "#{@project.name} Wiki",     url: project_wikis_path(@project) },
-    ]
-  end
-
-  [projects, default_nav, project_nav, help_nav].flatten.to_json
-end
-
- -
- - - - -
- - -
- -
- show_last_push_widget?(event) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 129
-def show_last_push_widget?(event)
-  event &&
-    event.last_push_to_non_root? &&
-    !event.rm_ref? &&
-    event.project &&
-    event.project.merge_requests_enabled
-end
-
- -
- - - - -
- - -
- -
- web_app_url() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/application_helper.rb, line 47
-def web_app_url
-  "#{request_protocol}://#{Gitlab.config.web_host}/"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/AttachmentUploader.html b/doc/app/AttachmentUploader.html deleted file mode 100644 index b6e9d1bab37..00000000000 --- a/doc/app/AttachmentUploader.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - - -class AttachmentUploader - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class AttachmentUploader

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- store_dir() - click to toggle source -
- - -
- -

Override the directory where uploaded files will be stored. This is a -sensible default for uploaders that are meant to be mounted:

- - - -
-
# File app/uploaders/attachment_uploader.rb, line 15
-def store_dir
-  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Authority.html b/doc/app/Authority.html deleted file mode 100644 index 92f46c55b0a..00000000000 --- a/doc/app/Authority.html +++ /dev/null @@ -1,782 +0,0 @@ - - - - - - -module Authority - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Authority

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- add_access(user, *access) - click to toggle source -
- - -
- -

Compatible with all access rights Should be rewrited for new access rights

- - - -
-
# File app/roles/authority.rb, line 4
-def add_access(user, *access)
-  access = if access.include?(:admin)
-             { project_access: UsersProject::MASTER }
-           elsif access.include?(:write)
-             { project_access: UsersProject::DEVELOPER }
-           else
-             { project_access: UsersProject::REPORTER }
-           end
-  opts = { user: user }
-  opts.merge!(access)
-  users_projects.create(opts)
-end
-
- -
- - - - -
- - -
- -
- allow_read_for?(user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 39
-def allow_read_for?(user)
-  !users_projects.where(user_id: user.id).empty?
-end
-
- -
- - - - -
- - -
- -
- dev_access_for?(user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 51
-def dev_access_for?(user)
-  !users_projects.where(user_id: user.id, project_access: [UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
-end
-
- -
- - - - -
- - -
- -
- guest_access_for?(user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 43
-def guest_access_for?(user)
-  !users_projects.where(user_id: user.id).empty?
-end
-
- -
- - - - -
- - -
- -
- master_access_for?(user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 55
-def master_access_for?(user)
-  !users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty?
-end
-
- -
- - - - -
- - -
- -
- report_access_for?(user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 47
-def report_access_for?(user)
-  !users_projects.where(user_id: user.id, project_access: [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
-end
-
- -
- - - - -
- - -
- -
- repository_masters() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 33
-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)
-end
-
- -
- - - - -
- - -
- -
- repository_readers() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 21
-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)
-end
-
- -
- - - - -
- - -
- -
- repository_writers() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 27
-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)
-end
-
- -
- - - - -
- - -
- -
- reset_access(user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/authority.rb, line 17
-def reset_access(user)
-  users_projects.where(project_id: self.id, user_id: user.id).destroy if self.id
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/BaseContext.html b/doc/app/BaseContext.html deleted file mode 100644 index b9c46738bf8..00000000000 --- a/doc/app/BaseContext.html +++ /dev/null @@ -1,605 +0,0 @@ - - - - - - -class BaseContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class BaseContext

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- current_user[RW] -
- -
- - - -
-
- -
-
- params[RW] -
- -
- - - -
-
- -
-
- project[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(project, user, params) - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/base_context.rb, line 4
-def initialize(project, user, params)
-  @project, @current_user, @params = project, user, params.dup
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- abilities() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/base_context.rb, line 8
-def abilities
-  @abilities ||= begin
-                   abilities = Six.new
-                   abilities << Ability
-                   abilities
-                 end
-end
-
- -
- - - - -
- - -
- -
- can?(object, action, subject) - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/base_context.rb, line 16
-def can?(object, action, subject)
-  abilities.allowed?(object, action, subject)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/BlameController.html b/doc/app/BlameController.html deleted file mode 100644 index 4b23b227c49..00000000000 --- a/doc/app/BlameController.html +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - -class BlameController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class BlameController

- -
- -

Controller for viewing a file’s blame

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/blame_controller.rb, line 12
-def show
-  @repo = @project.repo
-  @blame = Grit::Blob.blame(@repo, @commit.id, @path)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/BlobController.html b/doc/app/BlobController.html deleted file mode 100644 index e8f069c2f4a..00000000000 --- a/doc/app/BlobController.html +++ /dev/null @@ -1,519 +0,0 @@ - - - - - - -class BlobController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class BlobController

- -
- -

Controller for viewing a file’s blame

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/blob_controller.rb, line 13
-def show
-  if @tree.is_blob?
-    if @tree.text?
-      encoding = detect_encoding(@tree.data)
-      mime_type = encoding ? "text/plain; charset=#{encoding}" : "text/plain"
-    else
-      mime_type = @tree.mime_type
-    end
-
-    send_data(
-      @tree.data,
-      type: mime_type,
-      disposition: 'inline',
-      filename: @tree.name
-    )
-  else
-    not_found!
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Commit.html b/doc/app/Commit.html deleted file mode 100644 index 05a3f3ceff8..00000000000 --- a/doc/app/Commit.html +++ /dev/null @@ -1,1191 +0,0 @@ - - - - - - -class Commit - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Commit

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- commit[RW] -
- -
- - - -
-
- -
-
- head[RW] -
- -
- - - -
-
- -
-
- refs[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- commits(repo, ref, path = nil, limit = nil, offset = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 58
-def commits(repo, ref, path = nil, limit = nil, offset = nil)
-  if path
-    repo.log(ref, path, max_count: limit, skip: offset)
-  elsif limit && offset
-    repo.commits(ref, limit, offset)
-  else
-    repo.commits(ref)
-  end.map{ |c| Commit.new(c) }
-end
-
- -
- - - - -
- - -
- -
- commits_between(repo, from, to) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 68
-def commits_between(repo, from, to)
-  repo.commits_between(from, to).map { |c| Commit.new(c) }
-end
-
- -
- - - - -
- - -
- -
- commits_since(repo, date) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 46
-def commits_since(repo, date)
-  commits = repo.heads.map do |h|
-    repo.log(h.name, nil, since: date).each { |c| Commit.new(c, h) }
-  end.flatten.uniq { |c| c.id }
-
-  commits.sort! do |x, y|
-    y.committed_date <=> x.committed_date
-  end
-
-  commits
-end
-
- -
- - - - -
- - -
- -
- commits_with_refs(repo, n = 20) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 36
-def commits_with_refs(repo, n = 20)
-  commits = repo.branches.map { |ref| Commit.new(ref.commit, ref) }
-
-  commits.sort! do |x, y|
-    y.committed_date <=> x.committed_date
-  end
-
-  commits[0..n]
-end
-
- -
- - - - -
- - -
- -
- compare(project, from, to) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 72
-def compare(project, from, to)
-  result = {
-    commits: [],
-    diffs: [],
-    commit: nil,
-    same: false
-  }
-
-  return result unless from && to
-
-  first = project.commit(to.try(:strip))
-  last = project.commit(from.try(:strip))
-
-  if first && last
-    commits = [first, last].sort_by(&:created_at)
-    younger = commits.first
-    older = commits.last
-
-    result[:same] = (younger.id == older.id)
-    result[:commits] = project.repo.commits_between(younger.id, older.id).map {|c| Commit.new(c)}
-    result[:diffs] = project.repo.diff(younger.id, older.id) rescue []
-    result[:commit] = Commit.new(older)
-  end
-
-  result
-end
-
- -
- - - - -
- - -
- -
- find_or_first(repo, commit_id = nil, root_ref) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 14
-def find_or_first(repo, commit_id = nil, root_ref)
-  commit = if commit_id
-             repo.commit(commit_id)
-           else
-             repo.commits(root_ref).first
-           end
-
-  Commit.new(commit) if commit
-end
-
- -
- - - - -
- - -
- -
- fresh_commits(repo, n = 10) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 24
-def fresh_commits(repo, n = 10)
-  commits = repo.heads.map do |h|
-    repo.commits(h.name, n).map { |c| Commit.new(c, h) }
-  end.flatten.uniq { |c| c.id }
-
-  commits.sort! do |x, y|
-    y.committed_date <=> x.committed_date
-  end
-
-  commits[0...n]
-end
-
- -
- - - - -
- - -
- -
- new(raw_commit, head = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 100
-def initialize(raw_commit, head = nil)
-  @commit = raw_commit
-  @head = head
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- author_email() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 117
-def author_email
-  author.email
-end
-
- -
- - - - -
- - -
- -
- author_name() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 121
-def author_name
-  utf8 author.name
-end
-
- -
- - - - -
- - -
- -
- committer_email() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 134
-def committer_email
-  committer.email
-end
-
- -
- - - - -
- - -
- -
- committer_name() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 130
-def committer_name
-  utf8 committer.name
-end
-
- -
- - - - -
- - -
- -
- created_at() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 113
-def created_at
-  committed_date
-end
-
- -
- - - - -
- - -
- -
- different_committer?() - click to toggle source -
- - -
- -

Was this commit committed by a different person than the original author?

- - - -
-
# File app/models/commit.rb, line 126
-def different_committer?
-  author_name != committer_name || author_email != committer_email
-end
-
- -
- - - - -
- - -
- -
- parents_count() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 146
-def parents_count
-  parents && parents.count || 0
-end
-
- -
- - - - -
- - -
- -
- prev_commit() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 138
-def prev_commit
-  parents.try :first
-end
-
- -
- - - - -
- - -
- -
- prev_commit_id() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 142
-def prev_commit_id
-  prev_commit.try :id
-end
-
- -
- - - - -
- - -
- -
- safe_message() - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 109
-def safe_message
-  @safe_message ||= utf8 message
-end
-
- -
- - - - -
- - -
- -
- short_id(length = 10) - click to toggle source -
- - -
- - - - - -
-
# File app/models/commit.rb, line 105
-def short_id(length = 10)
-  id.to_s[0..length]
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/CommitController.html b/doc/app/CommitController.html deleted file mode 100644 index 564161e90e3..00000000000 --- a/doc/app/CommitController.html +++ /dev/null @@ -1,509 +0,0 @@ - - - - - - -class CommitController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class CommitController

- -
- -

Controller for a specific Commit

- -

Not to be confused with CommitsController, plural.

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/commit_controller.rb, line 10
-def show
-  result = CommitLoadContext.new(project, current_user, params).execute
-
-  @commit = result[:commit]
-  git_not_found! unless @commit
-
-  @suppress_diff    = result[:suppress_diff]
-  @note             = result[:note]
-  @line_notes       = result[:line_notes]
-  @notes_count      = result[:notes_count]
-  @comments_allowed = true
-
-  respond_to do |format|
-    format.html do
-      if result[:status] == :huge_commit
-        render "huge_commit" and return
-      end
-    end
-
-    format.patch
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/CommitDecorator.html b/doc/app/CommitDecorator.html deleted file mode 100644 index 3cca57a4c16..00000000000 --- a/doc/app/CommitDecorator.html +++ /dev/null @@ -1,663 +0,0 @@ - - - - - - -class CommitDecorator - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class CommitDecorator

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - - - - -
- -
- description() - click to toggle source -
- - -
- -

Returns the commits description

- -

cut off, ellipses (`&hellp;`) are prepended to the commit message.

- - - -
-
# File app/decorators/commit_decorator.rb, line 34
-def description
-  description = safe_message
-
-  title_end = description.index(%r\n/)
-  if (!title_end && description.length > 80) || (title_end && title_end > 80)
-    "&hellip;".html_safe << description[70..-1]
-  else
-    description.split(%r\n/, 2)[1].try(:chomp)
-  end
-end
-
- -
- - - - -
- - - - - -
- -
- title() - click to toggle source -
- - -
- -

Returns the commits title.

- -

Usually, the commit title is the first line of the commit message. In case -this first line is longer than 80 characters, it is cut off after 70 -characters and ellipses (`&hellp;`) are appended.

- - - -
-
# File app/decorators/commit_decorator.rb, line 18
-def title
-  title = safe_message
-
-  return no_commit_message if title.blank?
-
-  title_end = title.index(%r\n/)
-  if (!title_end && title.length > 80) || (title_end && title_end > 80)
-    title[0..69] << "&hellip;".html_safe
-  else
-    title.split(%r\n/, 2).first
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- no_commit_message() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/commit_decorator.rb, line 69
-def no_commit_message
-  "--no commit message"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/CommitLoadContext.html b/doc/app/CommitLoadContext.html deleted file mode 100644 index feb6dbf4a42..00000000000 --- a/doc/app/CommitLoadContext.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - -class CommitLoadContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class CommitLoadContext

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/commit_load_context.rb, line 2
-def execute
-  result = {
-    commit: nil,
-    suppress_diff: false,
-    line_notes: [],
-    notes_count: 0,
-    note: nil,
-    status: :ok
-  }
-
-  commit = project.commit(params[:id])
-
-  if commit
-    commit = CommitDecorator.decorate(commit)
-    line_notes = project.commit_line_notes(commit)
-
-    result[:commit] = commit
-    result[:note] = project.build_commit_note(commit)
-    result[:line_notes] = line_notes
-    result[:notes_count] = line_notes.count + project.commit_notes(commit).count
-
-    begin
-      result[:suppress_diff] = true if commit.diffs.size > 200 && !params[:force_show_diff]
-    rescue Grit::Git::GitTimeout
-      result[:suppress_diff] = true
-      result[:status] = :huge_commit
-    end
-  end
-
-  result
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/CommitsController.html b/doc/app/CommitsController.html deleted file mode 100644 index 52eaad041da..00000000000 --- a/doc/app/CommitsController.html +++ /dev/null @@ -1,507 +0,0 @@ - - - - - - -class CommitsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class CommitsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/commits_controller.rb, line 11
-def show
-  @repo = @project.repo
-  @limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
-
-  @commits = @project.commits(@ref, @path, @limit, @offset)
-  @commits = CommitDecorator.decorate(@commits)
-
-  respond_to do |format|
-    format.html # index.html.erb
-    format.js
-    format.atom { render layout: false }
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/CommitsHelper.html b/doc/app/CommitsHelper.html deleted file mode 100644 index 58844bec1d3..00000000000 --- a/doc/app/CommitsHelper.html +++ /dev/null @@ -1,625 +0,0 @@ - - - - - - -module CommitsHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module CommitsHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- build_line_anchor(index, line_new, line_old) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/commits_helper.rb, line 12
-def build_line_anchor(index, line_new, line_old)
-  "#{index}_#{line_old}_#{line_new}"
-end
-
- -
- - - - -
- - -
- -
- each_diff_line(diff_arr, index) { |full_line, type, nil, nil, nil| ... } - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/commits_helper.rb, line 16
-def each_diff_line(diff_arr, index)
-  line_old = 1
-  line_new = 1
-  type = nil
-
-  lines_arr = ::Gitlab::InlineDiff.processing diff_arr
-  lines_arr.each do |line|
-    next if line.match(%r^\-\-\- \/dev\/null/)
-    next if line.match(%r^\+\+\+ \/dev\/null/)
-    next if line.match(%r^\-\-\- a/)
-    next if line.match(%r^\+\+\+ b/)
-
-    full_line = html_escape(line.gsub(%r\n/, ''))
-    full_line = ::Gitlab::InlineDiff.replace_markers full_line
-
-    if line.match(%r^@@ -/)
-      type = "match"
-
-      line_old = line.match(%r\-[0-9]*/)[0].to_i.abs rescue 0
-      line_new = line.match(%r\+[0-9]*/)[0].to_i.abs rescue 0
-
-      next if line_old == 1 && line_new == 1 #top of file
-      yield(full_line, type, nil, nil, nil)
-      next
-    else
-      type = identification_type(line)
-      line_code = build_line_anchor(index, line_new, line_old)
-      yield(full_line, type, line_code, line_new, line_old)
-    end
-
-
-    if line[0] == "+"
-      line_new += 1
-    elsif line[0] == "-"
-      line_old += 1
-    else
-      line_new += 1
-      line_old += 1
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- identification_type(line) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/commits_helper.rb, line 2
-def identification_type(line)
-  if line[0] == "+"
-    "new"
-  elsif line[0] == "-"
-    "old"
-  else
-    nil
-  end
-end
-
- -
- - - - -
- - -
- -
- image_diff_class(diff) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/commits_helper.rb, line 58
-def image_diff_class(diff)
-  if diff.deleted_file
-    "diff_image_removed"
-  elsif diff.new_file
-    "diff_image_added"
-  else
-    nil
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/CompareController.html b/doc/app/CompareController.html deleted file mode 100644 index 177e22d2520..00000000000 --- a/doc/app/CompareController.html +++ /dev/null @@ -1,556 +0,0 @@ - - - - - - -class CompareController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class CompareController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/compare_controller.rb, line 22
-def create
-  redirect_to project_compare_path(@project, params[:from], params[:to])
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/compare_controller.rb, line 7
-def index
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/compare_controller.rb, line 10
-def show
-  result = Commit.compare(project, params[:from], params[:to])
-
-  @commits       = result[:commits]
-  @commit        = result[:commit]
-  @diffs         = result[:diffs]
-  @refs_are_same = result[:same]
-  @line_notes    = []
-
-  @commits = CommitDecorator.decorate(@commits)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/DashboardController.html b/doc/app/DashboardController.html deleted file mode 100644 index e3f4d1b49b2..00000000000 --- a/doc/app/DashboardController.html +++ /dev/null @@ -1,569 +0,0 @@ - - - - - - -class DashboardController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class DashboardController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/dashboard_controller.rb, line 4
-def index
-  @groups = Group.where(id: current_user.projects.pluck(:group_id))
-  @projects = current_user.projects_with_events
-  @projects = @projects.page(params[:page]).per(30)
-
-  @events = Event.in_projects(current_user.project_ids).limit(20).offset(params[:offset] || 0)
-  @last_push = current_user.recent_push
-
-  respond_to do |format|
-    format.html
-    format.js
-    format.atom { render layout: false }
-  end
-end
-
- -
- - - - -
- - -
- -
- issues() - click to toggle source -
- - -
- -

Get only assigned issues

- - - -
-
# File app/controllers/dashboard_controller.rb, line 26
-def issues
-  @projects = current_user.projects.all
-  @user   = current_user
-  @issues = current_user.assigned_issues.opened.recent.page(params[:page]).per(20)
-  @issues = @issues.includes(:author, :project)
-
-  respond_to do |format|
-    format.html
-    format.atom { render layout: false }
-  end
-end
-
- -
- - - - -
- - -
- -
- merge_requests() - click to toggle source -
- - -
- -

Get authored or assigned open merge requests

- - - -
-
# File app/controllers/dashboard_controller.rb, line 20
-def merge_requests
-  @projects = current_user.projects.all
-  @merge_requests = current_user.cared_merge_requests.recent.page(params[:page]).per(20)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/DeployKeysController.html b/doc/app/DeployKeysController.html deleted file mode 100644 index 318a1441a67..00000000000 --- a/doc/app/DeployKeysController.html +++ /dev/null @@ -1,626 +0,0 @@ - - - - - - -class DeployKeysController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class DeployKeysController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/deploy_keys_controller.rb, line 21
-def create
-  @key = @project.deploy_keys.new(params[:key])
-  if @key.save
-    redirect_to project_deploy_keys_path(@project)
-  else
-    render "new"
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/deploy_keys_controller.rb, line 30
-def destroy
-  @key = @project.deploy_keys.find(params[:id])
-  @key.destroy
-
-  respond_to do |format|
-    format.html { redirect_to project_deploy_keys_url }
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/deploy_keys_controller.rb, line 7
-def index
-  @keys = @project.deploy_keys.all
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/deploy_keys_controller.rb, line 15
-def new
-  @key = @project.deploy_keys.new
-
-  respond_with(@key)
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/deploy_keys_controller.rb, line 11
-def show
-  @key = @project.deploy_keys.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ErrorsController.html b/doc/app/ErrorsController.html deleted file mode 100644 index e77a67d7880..00000000000 --- a/doc/app/ErrorsController.html +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - -class ErrorsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ErrorsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- githost() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/errors_controller.rb, line 2
-def githost
-  render "errors/gitolite"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Event.html b/doc/app/Event.html deleted file mode 100644 index 1347cda316d..00000000000 --- a/doc/app/Event.html +++ /dev/null @@ -1,1222 +0,0 @@ - - - - - - -class Event - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Event

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
Closed - -
- - -
Commented - -
- - -
Created - -
- - -
Joined - -
- - -
Left - -
- - -
Merged - -
- - -
Pushed - -
- - -
Reopened - -
- - -
Updated - -
- - -
-
- - - - - - -
-

Public Class Methods

- - -
- -
- determine_action(record) - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 36
-def determine_action(record)
-  if [Issue, MergeRequest].include? record.class
-    Event::Created
-  elsif record.kind_of? Note
-    Event::Commented
-  end
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- action_name() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 133
-def action_name
-  if closed?
-    "closed"
-  elsif merged?
-    "merged"
-  elsif joined?
-    'joined'
-  elsif left?
-    'left'
-  else
-    "opened"
-  end
-end
-
- -
- - - - -
- - -
- -
- allowed?() - click to toggle source -
- - -
- -

Next events currently enabled for system

- -
- push
-- new issue
-- merge request
- - - -
-
# File app/models/event.rb, line 49
-def allowed?
-  push? || issue? || merge_request? || membership_changed?
-end
-
- -
- - - - -
- - -
- -
- author() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 129
-def author
-  @author ||= User.find(author_id)
-end
-
- -
- - - - -
- - -
- -
- changed_issue?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 104
-def changed_issue?
-  target_type == "Issue" &&
-    [Closed, Reopened].include?(action)
-end
-
- -
- - - - -
- - -
- -
- changed_merge_request?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 99
-def changed_merge_request?
-  target_type == "MergeRequest" &&
-    [Closed, Reopened].include?(action)
-end
-
- -
- - - - -
- - -
- -
- closed?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 73
-def closed?
-  action == self.class::Closed
-end
-
- -
- - - - -
- - -
- -
- issue() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 121
-def issue
-  target if target_type == "Issue"
-end
-
- -
- - - - -
- - -
- -
- issue?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 81
-def issue?
-  target_type == "Issue"
-end
-
- -
- - - - -
- - -
- -
- joined?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 109
-def joined?
-  action == Joined
-end
-
- -
- - - - -
- - -
- -
- left?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 113
-def left?
-  action == Left
-end
-
- -
- - - - -
- - -
- -
- membership_changed?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 117
-def membership_changed?
-  joined? || left?
-end
-
- -
- - - - -
- - -
- -
- merge_request() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 125
-def merge_request
-  target if target_type == "MergeRequest"
-end
-
- -
- - - - -
- - -
- -
- merge_request?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 85
-def merge_request?
-  target_type == "MergeRequest"
-end
-
- -
- - - - -
- - -
- -
- merged?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 69
-def merged?
-  action == self.class::Merged
-end
-
- -
- - - - -
- - -
- -
- new_issue?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 89
-def new_issue?
-  target_type == "Issue" &&
-    action == Created
-end
-
- -
- - - - -
- - -
- -
- new_merge_request?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 94
-def new_merge_request?
-  target_type == "MergeRequest" &&
-    action == Created
-end
-
- -
- - - - -
- - -
- -
- project_name() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 53
-def project_name
-  if project
-    project.name
-  else
-    "(deleted project)"
-  end
-end
-
- -
- - - - -
- - -
- -
- push?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 65
-def push?
-  action == self.class::Pushed && valid_push?
-end
-
- -
- - - - -
- - -
- -
- reopened?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 77
-def reopened?
-  action == self.class::Reopened
-end
-
- -
- - - - -
- - -
- -
- target_title() - click to toggle source -
- - -
- - - - - -
-
# File app/models/event.rb, line 61
-def target_title
-  target.try :title
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/EventDecorator.html b/doc/app/EventDecorator.html deleted file mode 100644 index dddb98a6147..00000000000 --- a/doc/app/EventDecorator.html +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - -class EventDecorator - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class EventDecorator

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- feed_summary() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/event_decorator.rb, line 37
-def feed_summary
-  if self.issue?
-    h.render "events/event_issue", issue: self.issue
-  elsif self.push?
-    h.render "events/event_push", event: self
-  end
-end
-
- -
- - - - -
- - -
- -
- feed_title() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/event_decorator.rb, line 4
-def feed_title
-  if self.issue?
-    "#{self.author_name} #{self.action_name} issue ##{self.target_id}: #{self.issue_title} at #{self.project.name}"
-  elsif self.merge_request?
-    "#{self.author_name} #{self.action_name} MR ##{self.target_id}: #{self.merge_request_title} at #{self.project.name}"
-  elsif self.push?
-    "#{self.author_name} #{self.push_action_name} #{self.ref_type} #{self.ref_name} at #{self.project.name}"
-  elsif self.membership_changed?
-    "#{self.author_name} #{self.action_name} #{self.project.name}"
-  else
-    ""
-  end
-end
-
- -
- - - - -
- - -
- -
- feed_url() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/event_decorator.rb, line 18
-def feed_url
-  if self.issue?
-    h.project_issue_url(self.project, self.issue)
-  elsif self.merge_request?
-    h.project_merge_request_url(self.project, self.merge_request)
-
-  elsif self.push?
-    if self.push_with_commits?
-      if self.commits_count > 1
-        h.project_compare_url(self.project, :from => self.parent_commit.id, :to => self.last_commit.id)
-      else
-        h.project_commit_url(self.project, :id => self.last_commit.id)
-      end
-    else
-      h.project_commits_url(self.project, self.ref_name)
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/EventsHelper.html b/doc/app/EventsHelper.html deleted file mode 100644 index 4f7c0454901..00000000000 --- a/doc/app/EventsHelper.html +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - -module EventsHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module EventsHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- event_action_name(event) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/events_helper.rb, line 13
-def event_action_name(event)
-  target = if event.target_type
-             event.target_type.titleize.downcase
-           else
-             'project'
-           end
-
-  [event.action_name, target].join(" ")
-end
-
- -
- - - - -
- - -
- -
- event_image(event) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/events_helper.rb, line 23
-def event_image event
-  event_image_path = if event.push?
-                 "event_push.png"
-               elsif event.merged?
-                 "event_mr_merged.png"
-               end
-
-  return nil unless event_image_path
-
-  content_tag :div, class: 'event_icon' do
-    image_tag event_image_path
-  end
-end
-
- -
- - - - -
- - - - - -
- -
- -
- - - - diff --git a/doc/app/ExtractsPath.html b/doc/app/ExtractsPath.html deleted file mode 100644 index e382530745c..00000000000 --- a/doc/app/ExtractsPath.html +++ /dev/null @@ -1,614 +0,0 @@ - - - - - - -module ExtractsPath - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module ExtractsPath

- -
- -

Module providing methods for dealing with separating a tree-ish string and -a file path string when combined in a request parameter

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- assign_ref_vars() - click to toggle source -
- - -
- -

Assigns common instance variables for views working with Git tree-ish -objects

- -

Assignments are:

-
  • -

    @id - A string representing the joined ref and path

    -
  • -

    @ref - A string representing the ref (e.g., the branch, tag, or commit -SHA)

    -
  • -

    @path - A string representing the filesystem path

    -
  • -

    @commit - A CommitDecorator representing -the commit from the given ref

    -
  • -

    @tree - A TreeDecorator representing the -tree at the given ref/path

    -
- -

If the :id parameter appears to be requesting a specific response format, -that will be handled as well.

- -

Automatically renders `not_found!` if a valid tree path could not be -resolved (e.g., when a user inserts an invalid path or ref).

- - - -
-
# File lib/extracts_path.rb, line 94
-def assign_ref_vars
-  # Handle formats embedded in the id
-  if params[:id].ends_with?('.atom')
-    params[:id].gsub!(%r\.atom$/, '')
-    request.format = :atom
-  end
-
-  @ref, @path = extract_ref(params[:id])
-
-  @id = File.join(@ref, @path)
-
-  @commit = CommitDecorator.decorate(@project.commit(@ref))
-
-  @tree = Tree.new(@commit.tree, @project, @ref, @path)
-  @tree = TreeDecorator.new(@tree)
-
-  raise InvalidPathError if @tree.invalid?
-rescue NoMethodError, InvalidPathError
-  not_found!
-end
-
- -
- - - - -
- - -
- -
- extract_ref(input) - click to toggle source -
- - -
- -

Given a string containing both a Git tree-ish, such as a branch or tag, and -a filesystem path joined by forward slashes, attempts to separate the two.

- -

Expects a @project instance variable to contain the active project. This is -used to check the input against a list of valid repository refs.

- -

Examples

- -
# No @project available
-extract_ref('master')
-# => ['', '']
-
-extract_ref('master')
-# => ['master', '']
-
-extract_ref("f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG")
-# => ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG']
-
-extract_ref("v2.0.0/README.md")
-# => ['v2.0.0', 'README.md']
-
-extract_ref('issues/1234/app/models/project.rb')
-# => ['issues/1234', 'app/models/project.rb']
-
-# Given an invalid branch, we fall back to just splitting on the first slash
-extract_ref('non/existent/branch/README.md')
-# => ['non', 'existent/branch/README.md']
-
- -

Returns an Array where the first value is the tree-ish and the second is -the path

- - - -
-
# File lib/extracts_path.rb, line 45
-def extract_ref(input)
-  pair = ['', '']
-
-  return pair unless @project
-
-  if input.match(%r^([[:alnum:]]{40})(.+)/)
-    # If the ref appears to be a SHA, we're done, just split the string
-    pair = $~.captures
-  else
-    # Otherwise, attempt to detect the ref using a list of the project's
-    # branches and tags
-
-    # Append a trailing slash if we only get a ref and no file path
-    id = input
-    id += '/' unless id.ends_with?('/')
-
-    valid_refs = @project.ref_names
-    valid_refs.select! { |v| id.start_with?("#{v}/") }
-
-    if valid_refs.length != 1
-      # No exact ref match, so just try our best
-      pair = id.match(%r([^\/]+)(.*)/).captures
-    else
-      # Partition the string into the ref and the path, ignoring the empty first value
-      pair = id.partition(valid_refs.first)[1..-1]
-    end
-  end
-
-  # Remove ending slashes from path
-  pair[1].gsub!(%r^\/|\/$/, '')
-
-  pair
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ExtractsPath/InvalidPathError.html b/doc/app/ExtractsPath/InvalidPathError.html deleted file mode 100644 index 3c8c60fc91e..00000000000 --- a/doc/app/ExtractsPath/InvalidPathError.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - -class ExtractsPath::InvalidPathError - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ExtractsPath::InvalidPathError

- -
- -

Raised when given an invalid file path

- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/FileSizeValidator.html b/doc/app/FileSizeValidator.html deleted file mode 100644 index 5acdf291b09..00000000000 --- a/doc/app/FileSizeValidator.html +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - -class FileSizeValidator - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class FileSizeValidator

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
CHECKS - -
- - -
DEFAULT_TOKENIZER - -
- - -
MESSAGES - -
- - -
RESERVED_OPTIONS - -
- - -
-
- - - - - - -
-

Public Class Methods

- - -
- -
- new(options) - click to toggle source -
- - -
- - - - - -
-
# File lib/file_size_validator.rb, line 8
-def initialize(options)
-  if range = (options.delete(:in) || options.delete(:within))
-    raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
-    options[:minimum], options[:maximum] = range.begin, range.end
-    options[:maximum] -= 1 if range.exclude_end?
-  end
-
-  super
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- check_validity!() - click to toggle source -
- - -
- - - - - -
-
# File lib/file_size_validator.rb, line 18
-def check_validity!
-  keys = CHECKS.keys & options.keys
-
-  if keys.empty?
-    raise ArgumentError, 'Range unspecified. Specify the :within, :maximum, :minimum, or :is option.'
-  end
-
-  keys.each do |key|
-    value = options[key]
-
-    unless value.is_a?(Integer) && value >= 0
-      raise ArgumentError, ":#{key} must be a nonnegative Integer"
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- help() - click to toggle source -
- - -
- - - - - -
-
# File lib/file_size_validator.rb, line 57
-def help
-  Helper.instance
-end
-
- -
- - - - -
- - -
- -
- validate_each(record, attribute, value) - click to toggle source -
- - -
- - - - - -
-
# File lib/file_size_validator.rb, line 34
-def validate_each(record, attribute, value)
-  raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
-
-  value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
-
-  CHECKS.each do |key, validity_check|
-    next unless check_value = options[key]
-
-    value ||= [] if key == :maximum
-
-    value_size = value.size
-    next if value_size.send(validity_check, check_value)
-
-    errors_options = options.except(*RESERVED_OPTIONS)
-    errors_options[:file_size] = help.number_to_human_size check_value
-
-    default_message = options[MESSAGES[key]]
-    errors_options[:message] ||= default_message if default_message
-
-    record.errors.add(attribute, MESSAGES[key], errors_options)
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/FileSizeValidator/Helper.html b/doc/app/FileSizeValidator/Helper.html deleted file mode 100644 index 4fd146c2887..00000000000 --- a/doc/app/FileSizeValidator/Helper.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - -class FileSizeValidator::Helper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class FileSizeValidator::Helper

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/GitHost.html b/doc/app/GitHost.html deleted file mode 100644 index 3197a73f3e5..00000000000 --- a/doc/app/GitHost.html +++ /dev/null @@ -1,479 +0,0 @@ - - - - - - -module GitHost - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module GitHost

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- git_host() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/git_host.rb, line 2
-def git_host
-  Gitlab::Gitolite.new
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab.html b/doc/app/Gitlab.html deleted file mode 100644 index 0e28a24bc3f..00000000000 --- a/doc/app/Gitlab.html +++ /dev/null @@ -1,454 +0,0 @@ - - - - - - -module Gitlab - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Gitlab

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/API.html b/doc/app/Gitlab/API.html deleted file mode 100644 index 8fad1eecafc..00000000000 --- a/doc/app/Gitlab/API.html +++ /dev/null @@ -1,452 +0,0 @@ - - - - - - -class Gitlab::API - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::API

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
VERSION - -
- - -
-
- - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/APIHelpers.html b/doc/app/Gitlab/APIHelpers.html deleted file mode 100644 index 47bf3fb193d..00000000000 --- a/doc/app/Gitlab/APIHelpers.html +++ /dev/null @@ -1,846 +0,0 @@ - - - - - - -module Gitlab::APIHelpers - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Gitlab::APIHelpers

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- attributes_for_keys(keys) - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 35
-def attributes_for_keys(keys)
-  attrs = {}
-  keys.each do |key|
-    attrs[key] = params[key] if params[key].present?
-  end
-  attrs
-end
-
- -
- - - - -
- - -
- -
- authenticate!() - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 21
-def authenticate!
-  unauthorized! unless current_user
-end
-
- -
- - - - -
- - -
- -
- authenticated_as_admin!() - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 25
-def authenticated_as_admin!
-  forbidden! unless current_user.is_admin?
-end
-
- -
- - - - -
- - -
- -
- authorize!(action, subject) - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 29
-def authorize! action, subject
-  unless abilities.allowed?(current_user, action, subject)
-    forbidden!
-  end
-end
-
- -
- - - - -
- - -
- -
- current_user() - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 3
-def current_user
-  @current_user ||= User.find_by_authentication_token(params[:private_token] || env["HTTP_PRIVATE_TOKEN"])
-end
-
- -
- - - - -
- - -
- -
- forbidden!() - click to toggle source -
- - -
- -

error helpers

- - - -
-
# File lib/api/helpers.rb, line 45
-def forbidden!
-  render_api_error!('403 Forbidden', 403)
-end
-
- -
- - - - -
- - -
- -
- not_allowed!() - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 60
-def not_allowed!
-  render_api_error!('Method Not Allowed', 405)
-end
-
- -
- - - - -
- - -
- -
- not_found!(resource = nil) - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 49
-def not_found!(resource = nil)
-  message = ["404"]
-  message << resource if resource
-  message << "Not Found"
-  render_api_error!(message.join(' '), 404)
-end
-
- -
- - - - -
- - -
- -
- paginate(object) - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 17
-def paginate(object)
-  object.page(params[:page]).per(params[:per_page].to_i)
-end
-
- -
- - - - -
- - -
- -
- render_api_error!(message, status) - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 64
-def render_api_error!(message, status)
-  error!({'message' => message}, status)
-end
-
- -
- - - - -
- - -
- -
- unauthorized!() - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 56
-def unauthorized!
-  render_api_error!('401 Unauthorized', 401)
-end
-
- -
- - - - -
- - -
- -
- user_project() - click to toggle source -
- - -
- - - - - -
-
# File lib/api/helpers.rb, line 7
-def user_project
-  if @project ||= current_user.projects.find_by_id(params[:id]) ||
-                  current_user.projects.find_by_code(params[:id])
-  else
-    not_found!
-  end
-
-  @project
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/AppLogger.html b/doc/app/Gitlab/AppLogger.html deleted file mode 100644 index e3a352af70f..00000000000 --- a/doc/app/Gitlab/AppLogger.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - -class Gitlab::AppLogger - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::AppLogger

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- file_name() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/app_logger.rb, line 3
-def self.file_name
-  'application.log'
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- format_message(severity, timestamp, progname, msg) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/app_logger.rb, line 7
-def format_message(severity, timestamp, progname, msg)
-  "#{timestamp.to_s(:long)}: #{msg}\n"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Auth.html b/doc/app/Gitlab/Auth.html deleted file mode 100644 index ac4fd556a79..00000000000 --- a/doc/app/Gitlab/Auth.html +++ /dev/null @@ -1,630 +0,0 @@ - - - - - - -class Gitlab::Auth - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Auth

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create_from_omniauth(auth, ldap = false) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/auth.rb, line 20
-def create_from_omniauth(auth, ldap = false)
-  provider = auth.provider
-  uid = auth.info.uid || auth.uid
-  name = auth.info.name.force_encoding("utf-8")
-  email = auth.info.email.downcase unless auth.info.email.nil?
-
-  ldap_prefix = ldap ? '(LDAP) ' : ''
-  raise OmniAuth::Error, "#{ldap_prefix}#{provider} does not provide an email"         " address" if auth.info.email.blank?
-
-  log.info "#{ldap_prefix}Creating user from #{provider} login"         " {uid => #{uid}, name => #{name}, email => #{email}}"
-  password = Devise.friendly_token[0, 8].downcase
-  @user = User.new({
-    extern_uid: uid,
-    provider: provider,
-    name: name,
-    email: email,
-    password: password,
-    password_confirmation: password,
-    projects_limit: Gitlab.config.default_projects_limit,
-  }, as: :admin)
-  if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
-    @user.blocked = true
-  end
-  @user.save!
-  @user
-end
-
- -
- - - - -
- - -
- -
- find_for_ldap_auth(auth, signed_in_resource = nil) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/auth.rb, line 3
-def find_for_ldap_auth(auth, signed_in_resource = nil)
-  uid = auth.info.uid
-  provider = auth.provider
-  email = auth.info.email.downcase unless auth.info.email.nil?
-  raise OmniAuth::Error, "LDAP accounts must provide an uid and email address" if uid.nil? or email.nil?
-
-  if @user = User.find_by_extern_uid_and_provider(uid, provider)
-    @user
-  elsif @user = User.find_by_email(email)
-    log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}"
-    @user.update_attributes(:extern_uid => uid, :provider => provider)
-    @user
-  else
-    create_from_omniauth(auth, true)
-  end
-end
-
- -
- - - - -
- - -
- -
- find_or_new_for_omniauth(auth) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/auth.rb, line 49
-def find_or_new_for_omniauth(auth)
-  provider, uid = auth.provider, auth.uid
-  email = auth.info.email.downcase unless auth.info.email.nil?
-
-  if @user = User.find_by_provider_and_extern_uid(provider, uid)
-    @user
-  elsif @user = User.find_by_email(email)
-    @user.update_attributes(:extern_uid => uid, :provider => provider)
-    @user
-  else
-    if Gitlab.config.omniauth['allow_single_sign_on']
-      @user = create_from_omniauth(auth)
-      @user
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- log() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/auth.rb, line 66
-def log
-  Gitlab::AppLogger
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Encode.html b/doc/app/Gitlab/Encode.html deleted file mode 100644 index 387e0db22e0..00000000000 --- a/doc/app/Gitlab/Encode.html +++ /dev/null @@ -1,537 +0,0 @@ - - - - - - -module Gitlab::Encode - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Gitlab::Encode

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- detect_encoding(message) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/encode.rb, line 34
-def detect_encoding message
-  return nil unless message
-
-  hash = CharlockHolmes::EncodingDetector.detect(message) rescue {}
-  return hash[:encoding] ? hash[:encoding] : nil
-end
-
- -
- - - - -
- - -
- -
- utf8(message) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/encode.rb, line 7
-def utf8 message
-  # return nil if message is nil
-  return nil unless message
-
-  message.force_encoding("utf-8")
-  # return message if message type is binary
-  detect = CharlockHolmes::EncodingDetector.detect(message)
-  return message if detect[:type] == :binary
-
-  # if message is utf-8 encoding, just return it
-  return message if message.valid_encoding?
-
-  # if message is not utf-8 encoding, convert it
-  if detect[:encoding]
-    message.force_encoding(detect[:encoding])
-    message.encode!("utf-8", detect[:encoding], undef: :replace, replace: "", invalid: :replace)
-  end
-
-  # ensure message encoding is utf8
-  message.valid_encoding? ? message : raise
-
-# Prevent app from crash cause of encoding errors
-rescue
-  encoding = detect ? detect[:encoding] : "unknown"
-  "--broken encoding: #{encoding}"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Entities.html b/doc/app/Gitlab/Entities.html deleted file mode 100644 index 8cd0d837ed9..00000000000 --- a/doc/app/Gitlab/Entities.html +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - -module Gitlab::Entities - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Gitlab::Entities

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/Hook.html b/doc/app/Gitlab/Entities/Hook.html deleted file mode 100644 index c9eba832bc8..00000000000 --- a/doc/app/Gitlab/Entities/Hook.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::Hook - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::Hook

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/Issue.html b/doc/app/Gitlab/Entities/Issue.html deleted file mode 100644 index f713b7ab609..00000000000 --- a/doc/app/Gitlab/Entities/Issue.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::Issue - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::Issue

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/Milestone.html b/doc/app/Gitlab/Entities/Milestone.html deleted file mode 100644 index f762ad29227..00000000000 --- a/doc/app/Gitlab/Entities/Milestone.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::Milestone - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::Milestone

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/Project.html b/doc/app/Gitlab/Entities/Project.html deleted file mode 100644 index 725e6b75d49..00000000000 --- a/doc/app/Gitlab/Entities/Project.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::Project - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::Project

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/ProjectMember.html b/doc/app/Gitlab/Entities/ProjectMember.html deleted file mode 100644 index 468d3dc1ac9..00000000000 --- a/doc/app/Gitlab/Entities/ProjectMember.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::ProjectMember - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::ProjectMember

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/ProjectSnippet.html b/doc/app/Gitlab/Entities/ProjectSnippet.html deleted file mode 100644 index e19fad759ac..00000000000 --- a/doc/app/Gitlab/Entities/ProjectSnippet.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::ProjectSnippet - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::ProjectSnippet

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/RepoCommit.html b/doc/app/Gitlab/Entities/RepoCommit.html deleted file mode 100644 index 04c118a3f9c..00000000000 --- a/doc/app/Gitlab/Entities/RepoCommit.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::RepoCommit - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::RepoCommit

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/RepoObject.html b/doc/app/Gitlab/Entities/RepoObject.html deleted file mode 100644 index 27f928c1b8e..00000000000 --- a/doc/app/Gitlab/Entities/RepoObject.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::RepoObject - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::RepoObject

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/SSHKey.html b/doc/app/Gitlab/Entities/SSHKey.html deleted file mode 100644 index 43ed0f01dcf..00000000000 --- a/doc/app/Gitlab/Entities/SSHKey.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::SSHKey - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::SSHKey

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/User.html b/doc/app/Gitlab/Entities/User.html deleted file mode 100644 index fb978194084..00000000000 --- a/doc/app/Gitlab/Entities/User.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::User - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::User

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/UserBasic.html b/doc/app/Gitlab/Entities/UserBasic.html deleted file mode 100644 index dcb1e78209d..00000000000 --- a/doc/app/Gitlab/Entities/UserBasic.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::UserBasic - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::UserBasic

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Entities/UserLogin.html b/doc/app/Gitlab/Entities/UserLogin.html deleted file mode 100644 index fde77335268..00000000000 --- a/doc/app/Gitlab/Entities/UserLogin.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Entities::UserLogin - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Entities::UserLogin

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/FileEditor.html b/doc/app/Gitlab/FileEditor.html deleted file mode 100644 index 0916d63cbe0..00000000000 --- a/doc/app/Gitlab/FileEditor.html +++ /dev/null @@ -1,647 +0,0 @@ - - - - - - -class Gitlab::FileEditor - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::FileEditor

- -
- -

GitLab file editor

- -

It gives you ability to make changes to files & commit this changes -from GitLab UI.

- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- project[RW] -
- -
- - - -
-
- -
-
- ref[RW] -
- -
- - - -
-
- -
-
- user[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(user, project, ref) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/file_editor.rb, line 9
-def initialize(user, project, ref)
-  self.user = user
-  self.project = project
-  self.ref = ref
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- update(path, content, commit_message, last_commit) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/file_editor.rb, line 15
-def update(path, content, commit_message, last_commit)
-  return false unless can_edit?(path, last_commit)
-
-  Grit::Git.with_timeout(10.seconds) do
-    lock_file = Rails.root.join("tmp", "#{project.path}.lock")
-
-    File.open(lock_file, "w+") do |f|
-      f.flock(File::LOCK_EX)
-
-      unless project.satellite.exists?
-        raise "Satellite doesn't exist"
-      end
-
-      project.satellite.clear
-
-      Dir.chdir(project.satellite.path) do
-        r = Grit::Repo.new('.')
-        r.git.sh "git reset --hard"
-        r.git.sh "git fetch origin"
-        r.git.sh "git config user.name \"#{user.name}\""
-        r.git.sh "git config user.email \"#{user.email}\""
-        r.git.sh "git checkout -b #{ref} origin/#{ref}"
-        File.open(path, 'w'){|f| f.write(content)}
-        r.git.sh "git add ."
-        r.git.sh "git commit -am '#{commit_message}'"
-        output = r.git.sh "git push origin #{ref}"
-
-        if output =~ %rreject/
-          return false
-        end
-      end
-    end
-  end
-  true
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- can_edit?(path, last_commit) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/file_editor.rb, line 53
-def can_edit?(path, last_commit)
-  current_last_commit = @project.last_commit_for(ref, path).sha
-  last_commit == current_last_commit
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/GitLogger.html b/doc/app/Gitlab/GitLogger.html deleted file mode 100644 index c37bce98ca5..00000000000 --- a/doc/app/Gitlab/GitLogger.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - -class Gitlab::GitLogger - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::GitLogger

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- file_name() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/git_logger.rb, line 3
-def self.file_name
-  'githost.log'
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- format_message(severity, timestamp, progname, msg) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/git_logger.rb, line 7
-def format_message(severity, timestamp, progname, msg)
-  "#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Gitolite.html b/doc/app/Gitlab/Gitolite.html deleted file mode 100644 index 60ef3b136e5..00000000000 --- a/doc/app/Gitlab/Gitolite.html +++ /dev/null @@ -1,716 +0,0 @@ - - - - - - -class Gitlab::Gitolite - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Gitolite

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- config() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 7
-def config
-  Gitlab::GitoliteConfig.new
-end
-
- -
- - - - -
- - -
- -
- create_repository(project) - click to toggle source -
- - -
- - - - - -
- - - - -
- Alias for: update_repository -
- -
- - -
- -
- enable_automerge() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 37
-def enable_automerge
-  config.admin_all_repo!
-end
-
- -
- - - - -
- - -
- -
- remove_key(key_id, projects) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 18
-def remove_key key_id, projects
-  config.apply do |config|
-    config.rm_key(key_id)
-    config.update_projects(projects)
-  end
-end
-
- -
- - - - -
- - -
- -
- remove_repository(project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 29
-def remove_repository project
-  config.destroy_project!(project)
-end
-
- -
- - - - -
- - -
- -
- set_key(key_id, key_content, projects) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 11
-def set_key key_id, key_content, projects
-  config.apply do |config|
-    config.write_key(key_id, key_content)
-    config.update_projects(projects)
-  end
-end
-
- -
- - - - -
- - -
- -
- update_repository(project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 25
-def update_repository project
-  config.update_project!(project.path, project)
-end
-
- -
- - -
- Also aliased as: create_repository -
- - - -
- - -
- -
- url_to_repo(path) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite.rb, line 33
-def url_to_repo path
-  Gitlab.config.ssh_path + "#{path}.git"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Gitolite/AccessDenied.html b/doc/app/Gitlab/Gitolite/AccessDenied.html deleted file mode 100644 index 64a3b17a30f..00000000000 --- a/doc/app/Gitlab/Gitolite/AccessDenied.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::Gitolite::AccessDenied - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Gitolite::AccessDenied

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/GitoliteConfig.html b/doc/app/Gitlab/GitoliteConfig.html deleted file mode 100644 index 19671089b15..00000000000 --- a/doc/app/Gitlab/GitoliteConfig.html +++ /dev/null @@ -1,994 +0,0 @@ - - - - - - -class Gitlab::GitoliteConfig - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::GitoliteConfig

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- conf[R] -
- -
- - - -
-
- -
-
- config_tmp_dir[R] -
- -
- - - -
-
- -
-
- ga_repo[R] -
- -
- - - -
-
- -
- - - - -
-

Public Instance Methods

- - -
- -
- admin_all_repo() - click to toggle source -
- - -
- -

Enable access to all repos for gitolite admin. We use it for accept merge -request feature

- - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 162
-def admin_all_repo
-  owner_name = Gitlab.config.gitolite_admin_key
-
-  # @ALL repos premission for gitolite owner
-  repo_name = "@all"
-  repo = if conf.has_repo?(repo_name)
-           conf.get_repo(repo_name)
-         else
-           ::Gitolite::Config::Repo.new(repo_name)
-         end
-
-  repo.add_permission("RW+", "", owner_name)
-  conf.add_repo(repo, true)
-end
-
- -
- - - - -
- - -
- -
- admin_all_repo!() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 177
-def admin_all_repo!
-  apply { |config| config.admin_all_repo }
-end
-
- -
- - - - -
- - -
- -
- apply() { |self| ... } - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 20
-def apply
-  Timeout::timeout(30) do
-    File.open(Rails.root.join('tmp', "gitlabhq-gitolite.lock"), "w+") do |f|
-      begin
-        # Set exclusive lock
-        # to prevent race condition
-        f.flock(File::LOCK_EX)
-
-        # Pull gitolite-admin repo
-        # in tmp dir before do any changes
-        pull(config_tmp_dir)
-
-        # Build ga_repo object and @conf
-        # to access gitolite-admin configuration
-        @conf = ga_repo.config
-
-        # Do any changes
-        # in gitolite-admin
-        # config here
-        yield(self)
-
-        # Save changes in
-        # gitolite-admin repo
-        # before push it
-        ga_repo.save
-
-        # Push gitolite-admin repo
-        # to apply all changes
-        push(config_tmp_dir)
-      ensure
-        # Remove tmp dir
-        # removing the gitolite folder first is important to avoid
-        # NFS issues.
-        FileUtils.rm_rf(File.join(config_tmp_dir, 'gitolite'))
-
-        # Remove parent tmp dir
-        FileUtils.rm_rf(config_tmp_dir)
-
-        # Unlock so other task can access
-        # gitolite configuration
-        f.flock(File::LOCK_UN)
-      end
-    end
-  end
-rescue PullError => ex
-  log("Pull error ->  " + ex.message)
-  raise Gitolite::AccessDenied, ex.message
-
-rescue PushError => ex
-  log("Push error ->  " + " " + ex.message)
-  raise Gitolite::AccessDenied, ex.message
-
-rescue Exception => ex
-  log(ex.class.name + " " + ex.message)
-  raise Gitolite::AccessDenied.new("gitolite timeout")
-end
-
- -
- - - - -
- - -
- -
- destroy_project(project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 81
-def destroy_project(project)
-  FileUtils.rm_rf(project.path_to_repo)
-  conf.rm_repo(project.path)
-end
-
- -
- - - - -
- - -
- -
- destroy_project!(project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 86
-def destroy_project!(project)
-  apply do |config|
-    config.destroy_project(project)
-  end
-end
-
- -
- - - - -
- - -
- -
- log(message) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 77
-def log message
-  Gitlab::GitLogger.error(message)
-end
-
- -
- - - - -
- - -
- -
- rm_key(user) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 98
-def rm_key(user)
-  key_path = File.join(config_tmp_dir, 'gitolite/keydir', "#{user}.pub")
-  ga_key = ::Gitolite::SSHKey.from_file(key_path)
-  ga_repo.rm_key(ga_key)
-end
-
- -
- - - - -
- - -
- -
- update_project(repo_name, project) - click to toggle source -
- - -
- -

update or create

- - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 105
-def update_project(repo_name, project)
-  repo = update_project_config(project, conf)
-  conf.add_repo(repo, true)
-end
-
- -
- - - - -
- - -
- -
- update_project!(repo_name, project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 110
-def update_project!(repo_name, project)
-  apply do |config|
-    config.update_project(repo_name, project)
-  end
-end
-
- -
- - - - -
- - -
- -
- update_project_config(project, conf) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 125
-def update_project_config(project, conf)
-  repo_name = project.path
-
-  repo = if conf.has_repo?(repo_name)
-           conf.get_repo(repo_name)
-         else
-           ::Gitolite::Config::Repo.new(repo_name)
-         end
-
-  name_readers = project.repository_readers
-  name_writers = project.repository_writers
-  name_masters = project.repository_masters
-
-  pr_br = project.protected_branches.map(&:name).join("$ ")
-
-  repo.clean_permissions
-
-  # Deny access to protected branches for writers
-  unless name_writers.blank? || pr_br.blank?
-    repo.add_permission("-", pr_br.strip + "$ ", name_writers)
-  end
-
-  # Add read permissions
-  repo.add_permission("R", "", name_readers) unless name_readers.blank?
-
-  # Add write permissions
-  repo.add_permission("RW+", "", name_writers) unless name_writers.blank?
-  repo.add_permission("RW+", "", name_masters) unless name_masters.blank?
-
-  # Add sharedRepository config
-  repo.set_git_config("core.sharedRepository", "0660")
-
-  repo
-end
-
- -
- - - - -
- - -
- -
- update_projects(projects) - click to toggle source -
- - -
- -

Updates many projects and uses project.path as the repo path An order of -magnitude faster than #update_project

- - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 118
-def update_projects(projects)
-  projects.each do |project|
-    repo = update_project_config(project, conf)
-    conf.add_repo(repo, true)
-  end
-end
-
- -
- - - - -
- - -
- -
- write_key(id, key) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/gitolite_config.rb, line 92
-def write_key(id, key)
-  File.open(File.join(config_tmp_dir, 'gitolite/keydir',"#{id}.pub"), 'w') do |f|
-    f.write(key.gsub(%r\n/,''))
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/GitoliteConfig/PullError.html b/doc/app/Gitlab/GitoliteConfig/PullError.html deleted file mode 100644 index 8e5a1510d45..00000000000 --- a/doc/app/Gitlab/GitoliteConfig/PullError.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::GitoliteConfig::PullError - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::GitoliteConfig::PullError

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/GitoliteConfig/PushError.html b/doc/app/Gitlab/GitoliteConfig/PushError.html deleted file mode 100644 index c1541f49d66..00000000000 --- a/doc/app/Gitlab/GitoliteConfig/PushError.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class Gitlab::GitoliteConfig::PushError - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::GitoliteConfig::PushError

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/GraphCommit.html b/doc/app/Gitlab/GraphCommit.html deleted file mode 100644 index b8ffa6f4161..00000000000 --- a/doc/app/Gitlab/GraphCommit.html +++ /dev/null @@ -1,967 +0,0 @@ - - - - - - -class Gitlab::GraphCommit - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::GraphCommit

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- refs[RW] -
- -
- - - -
-
- -
-
- space[RW] -
- -
- - - -
-
- -
-
- time[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- find_free_space(time_range) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 113
-def self.find_free_space(time_range)
-  reserved = []
-  for day in time_range
-      reserved += @_reserved[day]
-  end
-  space = 1
-  while reserved.include? space do
-    space += 1
-  end
-  space
-end
-
- -
- - - - -
- - -
- -
- index_commits(commits) - click to toggle source -
- - -
- -

Method is adding time and space on the list of commits. As well as returns -date list corelated with time set on commits.

- -

@param [Array<GraphCommit>] comits to index

- -

@return [Array<TimeDate>] list of commit dates corelated with time on -commits

- - - -
-
# File lib/gitlab/graph_commit.rb, line 33
-def self.index_commits(commits)
-  days, heads = [], []
-  map = {}
-
-  commits.reverse.each_with_index do |c,i|
-    c.time = i
-    days[i] = c.committed_date
-    map[c.id] = c
-    heads += c.refs unless c.refs.nil?
-  end
-
-  heads.select!{|h| h.is_a? Grit::Head or h.is_a? Grit::Remote}
-  # sort heads so the master is top and current branches are closer
-  heads.sort! do |a,b|
-    if a.name == "master"
-      -1
-    elsif b.name == "master"
-      1
-    else
-      b.commit.committed_date <=> a.commit.committed_date
-    end
-  end
-
-  @_reserved = {}
-  days.each_index do |i|
-    @_reserved[i] = []
-  end
-
-  heads.each do |h|
-    if map.include? h.commit.id then
-      place_chain(map[h.commit.id], map)
-    end
-  end
-  days
-end
-
- -
- - - - -
- - -
- -
- mark_reserved(time_range, space) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 107
-def self.mark_reserved(time_range, space)
-  for day in time_range
-    @_reserved[day].push(space)
-  end
-end
-
- -
- - - - -
- - -
- -
- new(commit) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 148
-def initialize(commit)
-  @_commit = commit
-  @time = -1
-  @space = 0
-end
-
- -
- - - - -
- - -
- -
- place_chain(commit, map, parent_time = nil) - click to toggle source -
- - -
- -

Add space mark on commit and its parents

- -

@param [GraphCommit] the commit object. @param -[Hash<String,GraphCommit>] map of commits

- - - -
-
# File lib/gitlab/graph_commit.rb, line 73
-def self.place_chain(commit, map, parent_time = nil)
-  leaves = take_left_leaves(commit, map)
-  if leaves.empty? then
-    return
-  end
-  space = find_free_space(leaves.last.time..leaves.first.time)
-  leaves.each{|l| l.space = space}
-  # and mark it as reserved
-  min_time = leaves.last.time
-  parents = leaves.last.parents.collect
-  parents.each do |p|
-    if map.include? p.id then
-      parent = map[p.id]
-      if parent.time < min_time then
-        min_time = parent.time
-      end
-    end
-  end
-  if parent_time.nil? then
-    max_time = leaves.first.time
-  else
-    max_time = parent_time - 1
-  end
-  mark_reserved(min_time..max_time, space)
-  # Visit branching chains
-  leaves.each do |l|
-    parents = l.parents.collect
-      .select{|p| map.include? p.id and map[p.id].space == 0}
-    for p in parents
-      place_chain(map[p.id], map, l.time)
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- take_left_leaves(commit, map) - click to toggle source -
- - -
- -

Takes most left subtree branch of commits which don’t have space mark yet.

- -

@param [GraphCommit] the commit object. @param -[Hash<String,GraphCommit>] map of commits

- -

@return [Array<GraphCommit>] list of branch commits

- - - -
-
# File lib/gitlab/graph_commit.rb, line 132
-def self.take_left_leaves(commit, map)
-  leaves = []
-  leaves.push(commit)  if commit.space == 0
-  while true
-    parent = commit.parents.collect
-      .select{|p| map.include? p.id and map[p.id].space == 0}
-    if parent.count == 0 then
-      return leaves
-    else
-      commit = map[parent.first.id]
-      leaves.push(commit)
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- to_graph(project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 10
-def self.to_graph(project)
-  @repo = project.repo
-  commits = Grit::Commit.find_all(@repo, nil, {max_count: 650})
-
-  ref_cache = {}
-
-  commits.map! {|c| GraphCommit.new(Commit.new(c))}
-  commits.each { |commit| commit.add_refs(ref_cache, @repo) }
-
-  days = GraphCommit.index_commits(commits)
-  @days_json = days.compact.collect{|d| [d.day, d.strftime("%b")] }.to_json
-  @commits_json = commits.map(&:to_graph_hash).to_json
-
-  return @days_json, @commits_json
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- add_refs(ref_cache, repo) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 174
-def add_refs(ref_cache, repo)
-  if ref_cache.empty?
-    repo.refs.each do |ref|
-      ref_cache[ref.commit.id] ||= []
-      ref_cache[ref.commit.id] << ref
-    end
-  end
-  @refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
-  @refs ||= []
-end
-
- -
- - - - -
- - -
- -
- method_missing(m, *args, &block) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 154
-def method_missing(m, *args, &block)
-  @_commit.send(m, *args, &block)
-end
-
- -
- - - - -
- - -
- -
- to_graph_hash() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/graph_commit.rb, line 158
-def to_graph_hash
-  h = {}
-  h[:parents] = self.parents.collect do |p|
-    [p.id,0,0]
-  end
-  h[:author]  = Gitlab::Encode.utf8(author.name)
-  h[:time]    = time
-  h[:space]   = space
-  h[:refs]    = refs.collect{|r|r.name}.join(" ") unless refs.nil?
-  h[:id]      = sha
-  h[:date]    = date
-  h[:message] = escape_once(Gitlab::Encode.utf8(message))
-  h[:login]   = author.email
-  h
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/InlineDiff.html b/doc/app/Gitlab/InlineDiff.html deleted file mode 100644 index 91eeae9c441..00000000000 --- a/doc/app/Gitlab/InlineDiff.html +++ /dev/null @@ -1,611 +0,0 @@ - - - - - - -class Gitlab::InlineDiff - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::InlineDiff

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
FINISH - -
- - -
START - -
- - -
-
- - - - - - -
-

Public Class Methods

- - -
- -
- _indexes_of_changed_lines(diff_arr) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/inline_diff.rb, line 42
-def _indexes_of_changed_lines diff_arr
-  chain_of_first_symbols = ""
-  diff_arr.each_with_index do |line, i|
-    chain_of_first_symbols += line[0]
-  end
-  chain_of_first_symbols.gsub!(%r[^\-\+]/, "#")
-
-  offset = 0
-  indexes = []
-  while index = chain_of_first_symbols.index("#-+#", offset)
-    indexes << index
-    offset = index + 1
-  end
-  indexes
-end
-
- -
- - - - -
- - -
- -
- processing(diff_arr) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/inline_diff.rb, line 8
-def processing diff_arr
-  indexes = _indexes_of_changed_lines diff_arr
-
-  indexes.each do |index|
-    first_line = diff_arr[index+1]
-    second_line = diff_arr[index+2]
-    max_length = [first_line.size, second_line.size].max
-
-    first_the_same_symbols = 0
-    (0..max_length + 1).each do |i|
-      first_the_same_symbols = i - 1
-      if first_line[i] != second_line[i] && i > 0
-        break
-      end
-    end
-    first_token = first_line[0..first_the_same_symbols][1..-1]
-    diff_arr[index+1].sub!(first_token, first_token + START)
-    diff_arr[index+2].sub!(first_token, first_token + START)
-    last_the_same_symbols = 0
-    (1..max_length + 1).each do |i|
-      last_the_same_symbols = -i
-      shortest_line = second_line.size > first_line.size ? first_line : second_line
-      if ( first_line[-i] != second_line[-i] ) || "#{first_token}#{START}".size == shortest_line[1..-i].size
-        break
-      end
-    end
-    last_the_same_symbols += 1
-    last_token = first_line[last_the_same_symbols..-1]
-    diff_arr[index+1].sub!(%r#{Regexp.escape(last_token)}$/, FINISH + last_token)
-    diff_arr[index+2].sub!(%r#{Regexp.escape(last_token)}$/, FINISH + last_token)
-  end
-  diff_arr
-end
-
- -
- - - - -
- - -
- -
- replace_markers(line) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/inline_diff.rb, line 58
-def replace_markers line
-  line.gsub!(START, "<span class='idiff'>")
-  line.gsub!(FINISH, "</span>")
-  line
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Issues.html b/doc/app/Gitlab/Issues.html deleted file mode 100644 index eda99ed10dc..00000000000 --- a/doc/app/Gitlab/Issues.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - -class Gitlab::Issues - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Issues

- -
- -

Issues API

- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Logger.html b/doc/app/Gitlab/Logger.html deleted file mode 100644 index 8cc6cdea81b..00000000000 --- a/doc/app/Gitlab/Logger.html +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - -class Gitlab::Logger - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Logger

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- build() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/logger.rb, line 17
-def self.build
-  new(Rails.root.join("log", file_name))
-end
-
- -
- - - - -
- - -
- -
- error(message) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/logger.rb, line 3
-def self.error(message)
-  build.error(message)
-end
-
- -
- - - - -
- - -
- -
- info(message) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/logger.rb, line 7
-def self.info(message)
-  build.info(message)
-end
-
- -
- - - - -
- - -
- -
- read_latest() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/logger.rb, line 11
-def self.read_latest
-  path = Rails.root.join("log", file_name)
-  self.build unless File.exist?(path)
-  logs = File.read(path).split("\n")
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Markdown.html b/doc/app/Gitlab/Markdown.html deleted file mode 100644 index 12691455600..00000000000 --- a/doc/app/Gitlab/Markdown.html +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - -module Gitlab::Markdown - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Gitlab::Markdown

- -
- -

Custom parser for GitLab-flavored Markdown

- -

It replaces references in the text with links to the appropriate items in -GitLab.

- -

Supported reference formats are:

- -
* @foo for team members
-* #123 for issues
-* !123 for merge requests
-* $123 for snippets
-* 123456 for commits
- -

It also parses Emoji codes to insert images. See www.emoji-cheat-sheet.com/ for -a list of the supported icons.

- -

Examples

- -
>> gfm("Hey @david, can you fix this?")
-=> "Hey <a href="/gitlab/team_members/1">@david</a>, can you fix this?"
-
->> gfm("Commit 35d5f7c closes #1234")
-=> "Commit <a href="/gitlab/commits/35d5f7c">35d5f7c</a> closes <a href="/gitlab/issues/1234">#1234</a>"
-
->> gfm(":trollface:")
-=> "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
-
- -
- - - - -
- - - - - - -
-

Constants

-
- -
EMOJI_PATTERN - -
- - -
REFERENCE_PATTERN - -
- - -
-
- - - - -
-

Attributes

- - -
-
- html_options[R] -
- -
- - - -
-
- -
- - - - -
-

Public Instance Methods

- - -
- -
- gfm(text, html_options = {}) - click to toggle source -
- - -
- -

Public: Parse the provided text with GitLab-Flavored Markdown

- -

text - the source text #html_options - extra -options for the reference links as given to link_to

- -

Note: reference links will only be generated if @project is set

- - - -
-
# File lib/gitlab/markdown.rb, line 48
-def gfm(text, html_options = {})
-  return text if text.nil?
-
-  # Duplicate the string so we don't alter the original, then call to_str
-  # to cast it back to a String instead of a SafeBuffer. This is required
-  # for gsub calls to work as we need them to.
-  text = text.dup.to_str
-
-  @html_options = html_options
-
-  # Extract pre blocks so they are not altered
-  # from http://github.github.com/github-flavored-markdown/
-  extractions = {}
-  text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}) do |match|
-    md5 = Digest::MD5.hexdigest(match)
-    extractions[md5] = match
-    "{gfm-extraction-#{md5}}"
-  end
-
-  # TODO: add popups with additional information
-
-  text = parse(text)
-
-  # Insert pre block extractions
-  text.gsub!(%r\{gfm-extraction-(\h{32})\}/) do
-    extractions[$1]
-  end
-
-  sanitize text.html_safe, attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Merge.html b/doc/app/Gitlab/Merge.html deleted file mode 100644 index 99a66cd53bb..00000000000 --- a/doc/app/Gitlab/Merge.html +++ /dev/null @@ -1,628 +0,0 @@ - - - - - - -class Gitlab::Merge - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Merge

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- merge_request[RW] -
- -
- - - -
-
- -
-
- project[RW] -
- -
- - - -
-
- -
-
- user[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(merge_request, user) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/merge.rb, line 5
-def initialize(merge_request, user)
-  @merge_request = merge_request
-  @project = merge_request.project
-  @user = user
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- can_be_merged?() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/merge.rb, line 11
-def can_be_merged?
-  in_locked_and_timed_satellite do |merge_repo|
-    merge_in_satellite!(merge_repo)
-  end
-end
-
- -
- - - - -
- - -
- -
- merge!() - click to toggle source -
- - -
- -

Merges the source branch into the target branch in the satellite and pushes -it back to Gitolite. It also removes the source -branch if requested in the merge request.

- -

Returns false if the merge produced conflicts Returns false if pushing from -the satallite to Gitolite failed or was -rejected Returns true otherwise

- - - -
-
# File lib/gitlab/merge.rb, line 24
-def merge!
-  in_locked_and_timed_satellite do |merge_repo|
-    if merge_in_satellite!(merge_repo)
-      # push merge back to Gitolite
-      # will raise CommandFailed when push fails
-      merge_repo.git.push({raise: true}, :origin, merge_request.target_branch)
-
-      # remove source branch
-      if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)
-        # will raise CommandFailed when push fails
-        merge_repo.git.push({raise: true}, :origin, ":#{merge_request.source_branch}")
-      end
-
-      # merge, push and branch removal successful
-      true
-    end
-  end
-rescue Grit::Git::CommandFailed
-  false
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Milestones.html b/doc/app/Gitlab/Milestones.html deleted file mode 100644 index aac605b2896..00000000000 --- a/doc/app/Gitlab/Milestones.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - -class Gitlab::Milestones - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Milestones

- -
- -

Milestones API

- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Projects.html b/doc/app/Gitlab/Projects.html deleted file mode 100644 index a44cba3c7c6..00000000000 --- a/doc/app/Gitlab/Projects.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - -class Gitlab::Projects - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Projects

- -
- -

Projects API

- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Satellite.html b/doc/app/Gitlab/Satellite.html deleted file mode 100644 index 4615d1c67c2..00000000000 --- a/doc/app/Gitlab/Satellite.html +++ /dev/null @@ -1,664 +0,0 @@ - - - - - - -class Gitlab::Satellite - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Satellite

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
PARKING_BRANCH - -
- - -
-
- - - - -
-

Attributes

- - -
-
- project[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(project) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/satellite.rb, line 8
-def initialize project
-  self.project = project
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- clear() - click to toggle source -
- - -
- -

will be deleted all branches except PARKING_BRANCH

- - - -
-
# File lib/gitlab/satellite.rb, line 25
-def clear
-  Dir.chdir(path) do
-    heads = Grit::Repo.new(".").heads.map{|head| head.name}
-    if heads.include? PARKING_BRANCH
-      %xgit checkout #{PARKING_BRANCH}`
-    else
-      %xgit checkout -b #{PARKING_BRANCH}`
-    end
-    heads.delete(PARKING_BRANCH)
-    heads.each do |head|
-      %xgit branch -D #{head}`
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/satellite.rb, line 12
-def create
-  %xgit clone #{project.url_to_repo} #{path}`
-end
-
- -
- - - - -
- - -
- -
- exists?() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/satellite.rb, line 20
-def exists?
-  File.exists? path
-end
-
- -
- - - - -
- - -
- -
- path() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/satellite.rb, line 16
-def path
-  Rails.root.join("tmp", "repo_satellites", project.path)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Session.html b/doc/app/Gitlab/Session.html deleted file mode 100644 index 12f3433ebfd..00000000000 --- a/doc/app/Gitlab/Session.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - -class Gitlab::Session - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Session

- -
- -

Users API

- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Gitlab/Theme.html b/doc/app/Gitlab/Theme.html deleted file mode 100644 index 00b3e5f6b62..00000000000 --- a/doc/app/Gitlab/Theme.html +++ /dev/null @@ -1,493 +0,0 @@ - - - - - - -class Gitlab::Theme - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Theme

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- css_class_by_id(id) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/theme.rb, line 3
-def self.css_class_by_id(id)
-  themes = { 
-    1 => "ui_basic",
-    2 => "ui_mars",
-    3 => "ui_modern"
-  }
-
-  id ||= 1
-
-  return themes[id]
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Gitlab/Users.html b/doc/app/Gitlab/Users.html deleted file mode 100644 index c9712874c65..00000000000 --- a/doc/app/Gitlab/Users.html +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - -class Gitlab::Users - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Gitlab::Users

- -
- -

Users API

- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/GitlabMarkdownHelper.html b/doc/app/GitlabMarkdownHelper.html deleted file mode 100644 index 6bf172ac8f8..00000000000 --- a/doc/app/GitlabMarkdownHelper.html +++ /dev/null @@ -1,559 +0,0 @@ - - - - - - -module GitlabMarkdownHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module GitlabMarkdownHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - - - - -
- -
- markdown(text) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/gitlab_markdown_helper.rb, line 25
-def markdown(text)
-  unless @markdown
-    gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
-                        # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
-                        filter_html: true,
-                        with_toc_data: true,
-                        hard_wrap: true)
-    @markdown = Redcarpet::Markdown.new(gitlab_renderer,
-                    # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
-                    no_intra_emphasis: true,
-                    tables: true,
-                    fenced_code_blocks: true,
-                    autolink: true,
-                    strikethrough: true,
-                    lax_html_blocks: true,
-                    space_after_headers: true,
-                    superscript: true)
-  end
-
-  @markdown.render(text).html_safe
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Grack.html b/doc/app/Grack.html deleted file mode 100644 index e3c5bbd482e..00000000000 --- a/doc/app/Grack.html +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - -module Grack - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Grack

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Grack/Auth.html b/doc/app/Grack/Auth.html deleted file mode 100644 index 5da483f791a..00000000000 --- a/doc/app/Grack/Auth.html +++ /dev/null @@ -1,734 +0,0 @@ - - - - - - -class Grack::Auth - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Grack::Auth

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- project[RW] -
- -
- - - -
-
- -
-
- user[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Instance Methods

- - -
- -
- can?(object, action, subject) - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/grack_auth.rb, line 56
-def can?(object, action, subject)
-  abilities.allowed?(object, action, subject)
-end
-
- -
- - - - -
- - -
- -
- current_ref() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/grack_auth.rb, line 60
-def current_ref
-  if @env["HTTP_CONTENT_ENCODING"] =~ %rgzip/
-    input = Zlib::GzipReader.new(@request.body).read
-  else
-    input = @request.body.read
-  end
-  # Need to reset seek point
-  @request.body.rewind
-  %rrefs\/heads\/([\w-]+)/.match(input).to_a.first
-end
-
- -
- - - - -
- - -
- -
- valid?() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/grack_auth.rb, line 5
-def valid?
-  # Authentication with username and password
-  email, password = @auth.credentials
-  self.user = User.find_by_email(email)
-  return false unless user.try(:valid_password?, password)
-
-  # Set GL_USER env variable
-  ENV['GL_USER'] = email
-  # Pass Gitolite update hook
-  ENV['GL_BYPASS_UPDATE_HOOK'] = "true"
-
-  # Need this patch due to the rails mount
-  @env['PATH_INFO'] = @request.path
-  @env['SCRIPT_NAME'] = ""
-
-  # Find project by PATH_INFO from env
-  if m = %r^\/([\w-]+).git/.match(@request.path_info).to_a
-    self.project = Project.find_by_path(m.last)
-    return false unless project
-  end
-
-  # Git upload and receive
-  if @request.get?
-    validate_get_request
-  elsif @request.post?
-    validate_post_request
-  else
-    false
-  end
-end
-
- -
- - - - -
- - -
- -
- validate_get_request() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/grack_auth.rb, line 36
-def validate_get_request
-  true
-end
-
- -
- - - - -
- - -
- -
- validate_post_request() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/grack_auth.rb, line 40
-def validate_post_request
-  if @request.path_info.end_with?('git-upload-pack')
-    can?(user, :push_code, project)
-  elsif @request.path_info.end_with?('git-receive-pack')
-    action = if project.protected_branch?(current_ref)
-               :push_code_to_protected_branches
-             else
-               :push_code
-             end
-
-    can?(user, action, project)
-  else
-    false
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- abilities() - click to toggle source -
- - -
- - - - - -
-
# File lib/gitlab/backend/grack_auth.rb, line 73
-def abilities
-  @abilities ||= begin
-                   abilities = Six.new
-                   abilities << Ability
-                   abilities
-                 end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Group.html b/doc/app/Group.html deleted file mode 100644 index a23e1da6788..00000000000 --- a/doc/app/Group.html +++ /dev/null @@ -1,555 +0,0 @@ - - - - - - -class Group - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Group

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - - - - -
- -
-

Public Instance Methods

- - -
- -
- to_param() - click to toggle source -
- - -
- - - - - -
-
# File app/models/group.rb, line 17
-def to_param
-  code
-end
-
- -
- - - - -
- - -
- -
- users() - click to toggle source -
- - -
- - - - - -
-
# File app/models/group.rb, line 21
-def users
-  User.joins(:users_projects).where(users_projects: {project_id: project_ids}).uniq
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/GroupsController.html b/doc/app/GroupsController.html deleted file mode 100644 index 72e1022cc06..00000000000 --- a/doc/app/GroupsController.html +++ /dev/null @@ -1,735 +0,0 @@ - - - - - - -class GroupsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class GroupsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- issues() - click to toggle source -
- - -
- -

Get only assigned issues

- - - -
-
# File app/controllers/groups_controller.rb, line 26
-def issues
-  @user   = current_user
-  @issues = current_user.assigned_issues.opened
-  @issues = @issues.of_group(@group).recent.page(params[:page]).per(20)
-  @issues = @issues.includes(:author, :project)
-
-  respond_to do |format|
-    format.html
-    format.atom { render layout: false }
-  end
-end
-
- -
- - - - -
- - -
- -
- merge_requests() - click to toggle source -
- - -
- -

Get authored or assigned open merge requests

- - - -
-
# File app/controllers/groups_controller.rb, line 20
-def merge_requests
-  @merge_requests = current_user.cared_merge_requests
-  @merge_requests = @merge_requests.of_group(@group).recent.page(params[:page]).per(20)
-end
-
- -
- - - - -
- - -
- -
- people() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/groups_controller.rb, line 46
-def people
-  @users = group.users.all
-end
-
- -
- - - - -
- - - - - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/groups_controller.rb, line 8
-def show
-  @events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0)
-  @last_push = current_user.recent_push
-
-  respond_to do |format|
-    format.html
-    format.js
-    format.atom { render layout: false }
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- group() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/groups_controller.rb, line 52
-def group
-  @group ||= Group.find_by_code(params[:id])
-end
-
- -
- - - - -
- - -
- -
- project_ids() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/groups_controller.rb, line 60
-def project_ids
-  projects.map(&:id)
-end
-
- -
- - - - -
- - -
- -
- projects() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/groups_controller.rb, line 56
-def projects
-  @projects ||= current_user.projects_with_events.where(group_id: @group.id)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/HelpController.html b/doc/app/HelpController.html deleted file mode 100644 index afbbeb0bfc3..00000000000 --- a/doc/app/HelpController.html +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - -class HelpController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class HelpController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/help_controller.rb, line 2
-def index
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/HooksController.html b/doc/app/HooksController.html deleted file mode 100644 index 70fd89c3317..00000000000 --- a/doc/app/HooksController.html +++ /dev/null @@ -1,595 +0,0 @@ - - - - - - -class HooksController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class HooksController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/hooks_controller.rb, line 13
-def create
-  @hook = @project.hooks.new(params[:hook])
-  @hook.save
-
-  if @hook.valid?
-    redirect_to project_hooks_path(@project)
-  else
-    @hooks = @project.hooks.all
-    render :index
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/hooks_controller.rb, line 31
-def destroy
-  @hook = @project.hooks.find(params[:id])
-  @hook.destroy
-
-  redirect_to project_hooks_path(@project)
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/hooks_controller.rb, line 8
-def index
-  @hooks = @project.hooks.all
-  @hook = ProjectHook.new
-end
-
- -
- - - - -
- - -
- -
- test() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/hooks_controller.rb, line 25
-def test
-  TestHookContext.new(project, current_user, params).execute
-
-  redirect_to :back
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Issue.html b/doc/app/Issue.html deleted file mode 100644 index e8a7881c484..00000000000 --- a/doc/app/Issue.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - -class Issue - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Issue

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- open_for(user) - click to toggle source -
- - -
- - - - - -
-
# File app/models/issue.rb, line 14
-def self.open_for(user)
-  opened.assigned(user)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/IssueCommonality.html b/doc/app/IssueCommonality.html deleted file mode 100644 index 336580d8f9b..00000000000 --- a/doc/app/IssueCommonality.html +++ /dev/null @@ -1,641 +0,0 @@ - - - - - - -module IssueCommonality - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module IssueCommonality

- -
- -

Contains common functionality shared between Issues and MergeRequests

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- is_assigned?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/issue_commonality.rb, line 50
-def is_assigned?
-  !!assignee_id
-end
-
- -
- - - - -
- - -
- -
- is_being_closed?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/issue_commonality.rb, line 58
-def is_being_closed?
-  closed_changed? && closed
-end
-
- -
- - - - -
- - -
- -
- is_being_reassigned?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/issue_commonality.rb, line 54
-def is_being_reassigned?
-  assignee_id_changed?
-end
-
- -
- - - - -
- - -
- -
- is_being_reopened?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/issue_commonality.rb, line 62
-def is_being_reopened?
-  closed_changed? && !closed
-end
-
- -
- - - - -
- - -
- -
- new?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/issue_commonality.rb, line 46
-def new?
-  today? && created_at == updated_at
-end
-
- -
- - - - -
- - -
- -
- today?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/issue_commonality.rb, line 42
-def today?
-  Date.today == created_at.to_date
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/IssueCommonality/ClassMethods.html b/doc/app/IssueCommonality/ClassMethods.html deleted file mode 100644 index d4ab179d07c..00000000000 --- a/doc/app/IssueCommonality/ClassMethods.html +++ /dev/null @@ -1,479 +0,0 @@ - - - - - - -module IssueCommonality::ClassMethods - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module IssueCommonality::ClassMethods

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - - - - -
- -
- -
- - - - diff --git a/doc/app/IssueObserver.html b/doc/app/IssueObserver.html deleted file mode 100644 index 7f16a8653f5..00000000000 --- a/doc/app/IssueObserver.html +++ /dev/null @@ -1,571 +0,0 @@ - - - - - - -class IssueObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class IssueObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(issue) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/issue_observer.rb, line 4
-def after_create(issue)
-  if issue.assignee && issue.assignee != current_user
-    Notify.new_issue_email(issue.id).deliver 
-  end
-end
-
- -
- - - - -
- - -
- -
- after_update(issue) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/issue_observer.rb, line 10
-def after_update(issue)
-  send_reassigned_email(issue) if issue.is_being_reassigned?
-
-  status = nil
-  status = 'closed' if issue.is_being_closed?
-  status = 'reopened' if issue.is_being_reopened?
-  if status
-    Note.create_status_change_note(issue, current_user, status) 
-    [issue.author, issue.assignee].compact.each do |recipient| 
-      Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user)
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- send_reassigned_email(issue) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/issue_observer.rb, line 26
-def send_reassigned_email(issue)
-  recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id }
-
-  recipient_ids.each do |recipient_id|
-    Notify.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was).deliver
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/IssuesBulkUpdateContext.html b/doc/app/IssuesBulkUpdateContext.html deleted file mode 100644 index 1d87a757917..00000000000 --- a/doc/app/IssuesBulkUpdateContext.html +++ /dev/null @@ -1,503 +0,0 @@ - - - - - - -class IssuesBulkUpdateContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class IssuesBulkUpdateContext

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/issues_bulk_update_context.rb, line 2
-def execute
-  update_data = params[:update]
-
-  issues_ids   = update_data[:issues_ids].split(",")
-  milestone_id = update_data[:milestone_id]
-  assignee_id  = update_data[:assignee_id]
-  status       = update_data[:status]
-
-  opts = {} 
-  opts[:milestone_id] = milestone_id if milestone_id.present?
-  opts[:assignee_id] = assignee_id if assignee_id.present?
-  opts[:closed] = (status == "closed") if status.present?
-
-  issues = Issue.where(id: issues_ids).all
-  issues = issues.select { |issue| can?(current_user, :modify_issue, issue) }
-  issues.each { |issue| issue.update_attributes(opts) }
-  { 
-    count: issues.count,
-    success: !issues.count.zero?
-  }
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/IssuesController.html b/doc/app/IssuesController.html deleted file mode 100644 index 6b3edbb6354..00000000000 --- a/doc/app/IssuesController.html +++ /dev/null @@ -1,996 +0,0 @@ - - - - - - -class IssuesController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class IssuesController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- bulk_update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 111
-def bulk_update
-  result = IssuesBulkUpdateContext.new(project, current_user, params).execute
-  redirect_to :back, notice: "#{result[:count]} issues updated"
-end
-
- -
- - - - -
- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 48
-def create
-  @issue = @project.issues.new(params[:issue])
-  @issue.author = current_user
-  @issue.save
-
-  respond_to do |format|
-    format.html do
-      if @issue.valid?
-        redirect_to project_issue_path(@project, @issue)
-      else
-        render :new
-      end
-    end
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 80
-def destroy
-  @issue.destroy
-
-  respond_to do |format|
-    format.html { redirect_to project_issues_path }
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 35
-def edit
-  respond_with(@issue)
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 19
-def index
-  @issues = issues_filtered
-  @issues = @issues.page(params[:page]).per(20)
-
-  respond_to do |format|
-    format.html # index.html.erb
-    format.js
-    format.atom { render layout: false }
-  end
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 30
-def new
-  @issue = @project.issues.new(params[:issue])
-  respond_with(@issue)
-end
-
- -
- - - - -
- - - - - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 39
-def show
-  @note = @project.notes.new(noteable: @issue)
-
-  respond_to do |format|
-    format.html
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- sort() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 89
-def sort
-  return render_404 unless can?(current_user, :admin_issue, @project)
-
-  @issues = @project.issues.where(id: params['issue'])
-  @issues.each do |issue|
-    issue.position = params['issue'].index(issue.id.to_s) + 1
-    issue.save
-  end
-
-  render nothing: true
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 65
-def update
-  @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))
-
-  respond_to do |format|
-    format.js
-    format.html do
-      if @issue.valid?
-        redirect_to [@project, @issue]
-      else
-        render :edit
-      end
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- authorize_admin_issue!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 126
-def authorize_admin_issue!
-  return render_404 unless can?(current_user, :admin_issue, @issue)
-end
-
- -
- - - - -
- - -
- -
- authorize_modify_issue!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 122
-def authorize_modify_issue!
-  return render_404 unless can?(current_user, :modify_issue, @issue)
-end
-
- -
- - - - -
- - -
- -
- issue() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 118
-def issue
-  @issue ||= @project.issues.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- issues_filtered() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 134
-def issues_filtered
-  @issues = IssuesListContext.new(project, current_user, params).execute
-end
-
- -
- - - - -
- - -
- -
- module_enabled() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/issues_controller.rb, line 130
-def module_enabled
-  return render_404 unless @project.issues_enabled
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/IssuesHelper.html b/doc/app/IssuesHelper.html deleted file mode 100644 index d58a5f7f1a5..00000000000 --- a/doc/app/IssuesHelper.html +++ /dev/null @@ -1,698 +0,0 @@ - - - - - - -module IssuesHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module IssuesHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- issue_css_classes(issue) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/issues_helper.rb, line 29
-def issue_css_classes issue
-  classes = "issue"
-  classes << " closed" if issue.closed
-  classes << " today" if issue.today?
-  classes
-end
-
- -
- - - - -
- - -
- -
- issue_tags() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/issues_helper.rb, line 36
-def issue_tags
-  @project.issues.tag_counts_on(:labels).map(&:name)
-end
-
- -
- - - - -
- - -
- -
- issues_filter() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/issues_helper.rb, line 47
-def issues_filter
-  {
-    all: "all",
-    closed: "closed",
-    to_me: "assigned-to-me",
-    open: "open"
-  }
-end
-
- -
- - - - -
- - - - - - - - -
- -
- project_issues_filter_path(project, params = {}) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/issues_helper.rb, line 2
-def project_issues_filter_path project, params = {}
-  params[:f] ||= cookies['issue_filter']
-  project_issues_path project, params
-end
-
- -
- - - - -
- - -
- -
- unassigned_filter() - click to toggle source -
- - -
- -

Returns an OpenStruct object suitable for use by -options_from_collection_for_select to allow filtering issues -by an unassigned User or Milestone

- - - -
-
# File app/helpers/issues_helper.rb, line 42
-def unassigned_filter
-  # Milestone uses :title, Issue uses :name
-  OpenStruct.new(id: 0, title: 'Unspecified', name: 'Unassigned')
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/IssuesListContext.html b/doc/app/IssuesListContext.html deleted file mode 100644 index 01acec4583e..00000000000 --- a/doc/app/IssuesListContext.html +++ /dev/null @@ -1,537 +0,0 @@ - - - - - - -class IssuesListContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class IssuesListContext

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- issues[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/issues_list_context.rb, line 6
-def execute
-  @issues = case params[:f]
-            when issues_filter[:all] then @project.issues
-            when issues_filter[:closed] then @project.issues.closed
-            when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
-            else @project.issues.opened
-            end
-
-  @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
-  @issues = @issues.includes(:author, :project).order("updated_at")
-
-  # Filter by specific assignee_id (or lack thereof)?
-  if params[:assignee_id].present?
-    @issues = @issues.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
-  end
-
-  # Filter by specific milestone_id (or lack thereof)?
-  if params[:milestone_id].present?
-    @issues = @issues.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
-  end
-
-  @issues
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Key.html b/doc/app/Key.html deleted file mode 100644 index afbcea93b99..00000000000 --- a/doc/app/Key.html +++ /dev/null @@ -1,700 +0,0 @@ - - - - - - -class Key - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Key

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- fingerprintable_key() - click to toggle source -
- - -
- - - - - -
-
# File app/models/key.rb, line 30
-def fingerprintable_key
-  return true unless key # Don't test if there is no key.
-  # `ssh-keygen -lf /dev/stdin <<< "#{key}"` errors with: redirection unexpected
-  file = Tempfile.new('key_file')
-  begin
-    file.puts key
-    file.rewind
-    fingerprint_output = %xssh-keygen -lf #{file.path} 2>&1` # Catch stderr.
-  ensure
-    file.close
-    file.unlink # deletes the temp file
-  end
-  errors.add(:key, "can't be fingerprinted") if fingerprint_output.match("failed")
-end
-
- -
- - - - -
- - -
- -
- is_deploy_key() - click to toggle source -
- - -
- - - - - -
-
# File app/models/key.rb, line 53
-def is_deploy_key
-  true if project_id
-end
-
- -
- - - - -
- - -
- -
- last_deploy?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/key.rb, line 66
-def last_deploy?
-  Key.where(identifier: identifier).count == 0
-end
-
- -
- - - - -
- - -
- -
- projects() - click to toggle source -
- - -
- -

projects that has this key

- - - -
-
# File app/models/key.rb, line 58
-def projects
-  if is_deploy_key
-    [project]
-  else
-    user.projects
-  end
-end
-
- -
- - - - -
- - -
- -
- set_identifier() - click to toggle source -
- - -
- - - - - -
-
# File app/models/key.rb, line 45
-def set_identifier
-  if is_deploy_key
-    self.identifier = "deploy_#{Digest::MD5.hexdigest(key)}"
-  else
-    self.identifier = "#{user.identifier}_#{Time.now.to_i}"
-  end
-end
-
- -
- - - - -
- - -
- -
- strip_white_space() - click to toggle source -
- - -
- - - - - -
-
# File app/models/key.rb, line 18
-def strip_white_space
-  self.key = self.key.strip unless self.key.blank?
-end
-
- -
- - - - -
- - -
- -
- unique_key() - click to toggle source -
- - -
- - - - - -
-
# File app/models/key.rb, line 22
-def unique_key
-  query = Key.where(key: key)
-  query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
-  if (query.count > 0)
-    errors.add :key, 'already exist.'
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/KeyObserver.html b/doc/app/KeyObserver.html deleted file mode 100644 index bdaf9f84b0f..00000000000 --- a/doc/app/KeyObserver.html +++ /dev/null @@ -1,530 +0,0 @@ - - - - - - -class KeyObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class KeyObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_destroy(key) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/key_observer.rb, line 8
-def after_destroy(key)
-  return if key.is_deploy_key && !key.last_deploy?
-  git_host.remove_key(key.identifier, key.projects)
-end
-
- -
- - - - -
- - -
- -
- after_save(key) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/key_observer.rb, line 4
-def after_save(key)
-  git_host.set_key(key.identifier, key.key, key.projects)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/KeysController.html b/doc/app/KeysController.html deleted file mode 100644 index 13fac402005..00000000000 --- a/doc/app/KeysController.html +++ /dev/null @@ -1,624 +0,0 @@ - - - - - - -class KeysController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class KeysController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/keys_controller.rb, line 19
-def create
-  @key = current_user.keys.new(params[:key])
-  @key.save
-
-  respond_with(@key)
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/keys_controller.rb, line 26
-def destroy
-  @key = current_user.keys.find(params[:id])
-  @key.destroy
-
-  respond_to do |format|
-    format.html { redirect_to keys_url }
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/keys_controller.rb, line 5
-def index
-  @keys = current_user.keys.all
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/keys_controller.rb, line 13
-def new
-  @key = current_user.keys.new
-
-  respond_with(@key)
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/keys_controller.rb, line 9
-def show
-  @key = current_user.keys.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/LabelsController.html b/doc/app/LabelsController.html deleted file mode 100644 index 7dece84091e..00000000000 --- a/doc/app/LabelsController.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - - -class LabelsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class LabelsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/labels_controller.rb, line 9
-def index
-  @labels = @project.issues_labels.order('count DESC')
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- module_enabled() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/labels_controller.rb, line 15
-def module_enabled
-  return render_404 unless @project.issues_enabled
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/MergeRequest.html b/doc/app/MergeRequest.html deleted file mode 100644 index 7dbe6f4f41c..00000000000 --- a/doc/app/MergeRequest.html +++ /dev/null @@ -1,1478 +0,0 @@ - - - - - - -class MergeRequest - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class MergeRequest

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
BROKEN_DIFF - -
- - -
CANNOT_BE_MERGED - -
- - -
CAN_BE_MERGED - -
- - -
UNCHECKED - -
- - -
-
- - - - -
-

Attributes

- - -
-
- should_remove_source_branch[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- find_all_by_branch(branch_name) - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 25
-def self.find_all_by_branch(branch_name)
-  where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name)
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- automerge!(current_user) - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 169
-def automerge!(current_user)
-  if Gitlab::Merge.new(self, current_user).merge! && self.unmerged_commits.empty?
-    self.merge!(current_user.id)
-    true
-  end
-rescue
-  self.mark_as_unmergable
-  false
-end
-
- -
- - - - -
- - -
- -
- broken_diffs?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 86
-def broken_diffs?
-  diffs == [BROKEN_DIFF]
-end
-
- -
- - - - -
- - -
- -
- can_be_merged?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 58
-def can_be_merged?
-  state == CAN_BE_MERGED
-end
-
- -
- - - - -
- - -
- -
- check_if_can_be_merged() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 62
-def check_if_can_be_merged
-  self.state = if Gitlab::Merge.new(self, self.author).can_be_merged?
-                 CAN_BE_MERGED
-               else
-                 CANNOT_BE_MERGED
-               end
-  self.save
-end
-
- -
- - - - -
- - -
- -
- closed_event() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 114
-def closed_event
-  self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Closed).last
-end
-
- -
- - - - -
- - -
- -
- commits() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 118
-def commits
-  st_commits || []
-end
-
- -
- - - - -
- - -
- -
- diffs() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 71
-def diffs
-  st_diffs || []
-end
-
- -
- - - - -
- - -
- -
- human_state() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 29
-def human_state
-  states = {
-    CAN_BE_MERGED =>  "can_be_merged",
-    CANNOT_BE_MERGED => "cannot_be_merged",
-    UNCHECKED => "unchecked"
-  }
-  states[self.state]
-end
-
- -
- - - - -
- - -
- -
- last_commit() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 102
-def last_commit
-  commits.first
-end
-
- -
- - - - -
- - -
- -
- mark_as_merged!() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 131
-def mark_as_merged!
-  self.merged = true
-  self.closed = true
-  save
-end
-
- -
- - - - -
- - -
- -
- mark_as_unchecked() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 53
-def mark_as_unchecked
-  self.state = UNCHECKED
-  self.save
-end
-
- -
- - - - -
- - -
- -
- mark_as_unmergable() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 137
-def mark_as_unmergable
-  self.state = CANNOT_BE_MERGED
-  self.save
-end
-
- -
- - - - -
- - -
- -
- merge!(user_id) - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 158
-def merge!(user_id)
-  self.mark_as_merged!
-  Event.create(
-    project: self.project,
-    action: Event::Merged,
-    target_id: self.id,
-    target_type: "MergeRequest",
-    author_id: user_id
-  )
-end
-
- -
- - - - -
- - -
- -
- merge_event() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 110
-def merge_event
-  self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Merged).last
-end
-
- -
- - - - -
- - -
- -
- merged?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 106
-def merged?
-  merged && merge_event
-end
-
- -
- - - - -
- - -
- -
- mr_and_commit_notes() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 191
-def mr_and_commit_notes
-  commit_ids = commits.map(&:id)
-  Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids)
-end
-
- -
- - - - -
- - -
- -
- open?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 127
-def open?
-  !closed
-end
-
- -
- - - - -
- - -
- -
- probably_merged?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 122
-def probably_merged?
-  unmerged_commits.empty? &&
-    commits.any? && open?
-end
-
- -
- - - - -
- - -
- -
- reload_code() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 44
-def reload_code
-  self.reloaded_commits
-  self.reloaded_diffs
-end
-
- -
- - - - -
- - -
- -
- reloaded_commits() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 142
-def reloaded_commits
-  if open? && unmerged_commits.any?
-    self.st_commits = unmerged_commits
-    save
-  end
-  commits
-end
-
- -
- - - - -
- - -
- -
- reloaded_diffs() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 75
-def reloaded_diffs
-  if open? && unmerged_diffs.any?
-    self.st_diffs = unmerged_diffs
-    self.save
-  end
-
-rescue Grit::Git::GitTimeout
-  self.st_diffs = [BROKEN_DIFF]
-  self.save
-end
-
- -
- - - - -
- - -
- -
- to_raw() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 179
-def to_raw
-  FileUtils.mkdir_p(Rails.root.join("tmp", "patches"))
-  patch_path = Rails.root.join("tmp", "patches", "merge_request_#{self.id}.patch")
-
-  from = commits.last.id
-  to = source_branch
-
-  project.repo.git.run('', "format-patch" , " > #{patch_path.to_s}", {}, ["#{from}..#{to}", "--stdout"])
-
-  patch_path
-end
-
- -
- - - - -
- - -
- -
- unchecked?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 49
-def unchecked?
-  state == UNCHECKED
-end
-
- -
- - - - -
- - -
- -
- unmerged_commits() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 150
-def unmerged_commits
-  self.project.repo.
-    commits_between(self.target_branch, self.source_branch).
-    map {|c| Commit.new(c)}.
-    sort_by(&:created_at).
-    reverse
-end
-
- -
- - - - -
- - -
- -
- unmerged_diffs() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 94
-def unmerged_diffs
-  # Only show what is new in the source branch compared to the target branch, not the other way around.
-  # The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
-  # From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
-  common_commit = project.repo.git.native(:merge_base, {}, [target_branch, source_branch]).strip
-  diffs = project.repo.diff(common_commit, source_branch)
-end
-
- -
- - - - -
- - -
- -
- valid_diffs?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 90
-def valid_diffs?
-  !broken_diffs?
-end
-
- -
- - - - -
- - -
- -
- validate_branches() - click to toggle source -
- - -
- - - - - -
-
# File app/models/merge_request.rb, line 38
-def validate_branches
-  if target_branch == source_branch
-    errors.add :base, "You can not use same branch for source and target branches"
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/MergeRequestObserver.html b/doc/app/MergeRequestObserver.html deleted file mode 100644 index f2d0dbd7dd1..00000000000 --- a/doc/app/MergeRequestObserver.html +++ /dev/null @@ -1,569 +0,0 @@ - - - - - - -class MergeRequestObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class MergeRequestObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(merge_request) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/merge_request_observer.rb, line 4
-def after_create(merge_request)
-  if merge_request.assignee && merge_request.assignee != current_user
-    Notify.new_merge_request_email(merge_request.id).deliver
-  end
-end
-
- -
- - - - -
- - -
- -
- after_update(merge_request) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/merge_request_observer.rb, line 10
-def after_update(merge_request)
-  send_reassigned_email(merge_request) if merge_request.is_being_reassigned?
-
-  status = nil
-  status = 'closed' if merge_request.is_being_closed?
-  status = 'reopened' if merge_request.is_being_reopened?
-  if status
-    Note.create_status_change_note(merge_request, current_user, status)
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- send_reassigned_email(merge_request) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/merge_request_observer.rb, line 23
-def send_reassigned_email(merge_request)
-  recipients_ids = merge_request.assignee_id_was, merge_request.assignee_id
-  recipients_ids.delete current_user.id
-
-  recipients_ids.each do |recipient_id|
-    Notify.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was).deliver
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/MergeRequestsController.html b/doc/app/MergeRequestsController.html deleted file mode 100644 index ef257c6cad0..00000000000 --- a/doc/app/MergeRequestsController.html +++ /dev/null @@ -1,1114 +0,0 @@ - - - - - - -class MergeRequestsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class MergeRequestsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- automerge() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 79
-def automerge
-  return access_denied! unless can?(current_user, :accept_mr, @project)
-  if @merge_request.open? && @merge_request.can_be_merged?
-    @merge_request.should_remove_source_branch = params[:should_remove_source_branch]
-    @merge_request.automerge!(current_user)
-    @status = true
-  else
-    @status = false
-  end
-end
-
- -
- - - - -
- - -
- -
- automerge_check() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 72
-def automerge_check
-  if @merge_request.unchecked?
-    @merge_request.check_if_can_be_merged
-  end
-  render json: {state: @merge_request.human_state}
-end
-
- -
- - - - -
- - -
- -
- branch_from() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 98
-def branch_from
-  @commit = project.commit(params[:ref])
-  @commit = CommitDecorator.decorate(@commit)
-end
-
- -
- - - - -
- - -
- -
- branch_to() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 103
-def branch_to
-  @commit = project.commit(params[:ref])
-  @commit = CommitDecorator.decorate(@commit)
-end
-
- -
- - - - -
- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 50
-def create
-  @merge_request = @project.merge_requests.new(params[:merge_request])
-  @merge_request.author = current_user
-
-  if @merge_request.save
-    @merge_request.reload_code
-    redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.'
-  else
-    render action: "new"
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 90
-def destroy
-  @merge_request.destroy
-
-  respond_to do |format|
-    format.html { redirect_to project_merge_requests_url(@project) }
-  end
-end
-
- -
- - - - -
- - -
- -
- diffs() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 35
-def diffs
-  @diffs = @merge_request.diffs
-  @commit = @merge_request.last_commit
-
-  @comments_allowed = true
-  @line_notes = @merge_request.notes.where("line_code is not null")
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 47
-def edit
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 20
-def index
-  @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 43
-def new
-  @merge_request = @project.merge_requests.new(params[:merge_request])
-end
-
- -
- - - - -
- - -
- -
- raw() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 31
-def raw
-  send_file @merge_request.to_raw
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 24
-def show
-  respond_to do |format|
-    format.html
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 62
-def update
-  if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id))
-    @merge_request.reload_code
-    @merge_request.mark_as_unchecked
-    redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.'
-  else
-    render action: "edit"
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- authorize_admin_merge_request!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 118
-def authorize_admin_merge_request!
-  return render_404 unless can?(current_user, :admin_merge_request, @merge_request)
-end
-
- -
- - - - -
- - -
- -
- authorize_modify_merge_request!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 114
-def authorize_modify_merge_request!
-  return render_404 unless can?(current_user, :modify_merge_request, @merge_request)
-end
-
- -
- - - - -
- - -
- -
- define_show_vars() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 135
-def define_show_vars
-  # Build a note object for comment form
-  @note = @project.notes.new(noteable: @merge_request)
-
-  # Get commits from repository
-  # or from cache if already merged
-  @commits = @merge_request.commits
-  @commits = CommitDecorator.decorate(@commits)
-end
-
- -
- - - - -
- - -
- -
- merge_request() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 110
-def merge_request
-  @merge_request ||= @project.merge_requests.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- module_enabled() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 122
-def module_enabled
-  return render_404 unless @project.merge_requests_enabled
-end
-
- -
- - - - -
- - -
- -
- validates_merge_request() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/merge_requests_controller.rb, line 126
-def validates_merge_request
-  # Show git not found page if target branch doesnt exist
-  return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch)
-
-  # Show git not found page if source branch doesnt exist
-  # and there is no saved commits between source & target branch
-  return git_not_found! if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank?
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/MergeRequestsHelper.html b/doc/app/MergeRequestsHelper.html deleted file mode 100644 index fec9b0e01ab..00000000000 --- a/doc/app/MergeRequestsHelper.html +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - -module MergeRequestsHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module MergeRequestsHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - - - - - - - -
- -
- mr_css_classes(mr) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/merge_requests_helper.rb, line 35
-def mr_css_classes mr
-  classes = "merge_request"
-  classes << " closed" if mr.closed
-  classes << " merged" if mr.merged?
-  classes
-end
-
- -
- - - - -
- - -
- -
- new_mr_path_from_push_event(event) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/merge_requests_helper.rb, line 24
-def new_mr_path_from_push_event(event)
-  new_project_merge_request_path(
-    event.project,
-    merge_request: {
-      source_branch: event.branch_name,
-      target_branch: event.project.root_ref,
-      title: event.branch_name.titleize
-    }
-  )
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/MergeRequestsLoadContext.html b/doc/app/MergeRequestsLoadContext.html deleted file mode 100644 index 5c1b882939f..00000000000 --- a/doc/app/MergeRequestsLoadContext.html +++ /dev/null @@ -1,496 +0,0 @@ - - - - - - -class MergeRequestsLoadContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class MergeRequestsLoadContext

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/merge_requests_load_context.rb, line 2
-def execute
-  type = params[:f]
-
-  merge_requests = project.merge_requests
-
-  merge_requests = case type
-                   when 'all' then merge_requests
-                   when 'closed' then merge_requests.closed
-                   when 'assigned-to-me' then merge_requests.opened.assigned(current_user)
-                   else merge_requests.opened
-                   end.page(params[:page]).per(20)
-
-  merge_requests.includes(:author, :project).order("closed, created_at desc")
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Milestone.html b/doc/app/Milestone.html deleted file mode 100644 index cc3bdc585b1..00000000000 --- a/doc/app/Milestone.html +++ /dev/null @@ -1,589 +0,0 @@ - - - - - - -class Milestone - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Milestone

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- active() - click to toggle source -
- - -
- - - - - -
-
# File app/models/milestone.rb, line 10
-def self.active
-  where("due_date > ? OR due_date IS NULL", Date.today)
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- expires_at() - click to toggle source -
- - -
- - - - - -
-
# File app/models/milestone.rb, line 24
-def expires_at
-  "expires at #{due_date.stamp("Aug 21, 2011")}" if due_date
-end
-
- -
- - - - -
- - -
- -
- participants() - click to toggle source -
- - -
- - - - - -
-
# File app/models/milestone.rb, line 14
-def participants
-  User.where(id: issues.pluck(:assignee_id))
-end
-
- -
- - - - -
- - -
- -
- percent_complete() - click to toggle source -
- - -
- - - - - -
-
# File app/models/milestone.rb, line 18
-def percent_complete
-  ((self.issues.closed.count * 100) / self.issues.count).abs
-rescue ZeroDivisionError
-  100
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/MilestonesController.html b/doc/app/MilestonesController.html deleted file mode 100644 index e15d6fef06f..00000000000 --- a/doc/app/MilestonesController.html +++ /dev/null @@ -1,816 +0,0 @@ - - - - - - -class MilestonesController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class MilestonesController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 42
-def create
-  @milestone = @project.milestones.new(params[:milestone])
-
-  if @milestone.save
-    redirect_to project_milestone_path(@project, @milestone)
-  else
-    render "new"
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 67
-def destroy
-  return access_denied! unless can?(current_user, :admin_milestone, @milestone)
-
-  @milestone.destroy
-
-  respond_to do |format|
-    format.html { redirect_to project_milestones_path }
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 28
-def edit
-  respond_with(@milestone)
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 13
-def index
-  @milestones = case params[:f]
-                when 'all'; @project.milestones
-                else @project.milestones.active
-                end
-
-  @milestones = @milestones.includes(:project).order("due_date")
-  @milestones = @milestones.page(params[:page]).per(20)
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 23
-def new
-  @milestone = @project.milestones.new
-  respond_with(@milestone)
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 32
-def show
-  @issues = @milestone.issues
-  @users = @milestone.participants
-
-  respond_to do |format|
-    format.html
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 52
-def update
-  @milestone.update_attributes(params[:milestone])
-
-  respond_to do |format|
-    format.js
-    format.html do
-      if @milestone.valid?
-        redirect_to [@project, @milestone]
-      else
-        render :edit
-      end
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- authorize_admin_milestone!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 84
-def authorize_admin_milestone!
-  return render_404 unless can?(current_user, :admin_milestone, @project)
-end
-
- -
- - - - -
- - -
- -
- milestone() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 80
-def milestone
-  @milestone ||= @project.milestones.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- module_enabled() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/milestones_controller.rb, line 88
-def module_enabled
-  return render_404 unless @project.issues_enabled
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Note.html b/doc/app/Note.html deleted file mode 100644 index 24a474b0296..00000000000 --- a/doc/app/Note.html +++ /dev/null @@ -1,777 +0,0 @@ - - - - - - -class Note - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Note

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- notify[RW] -
- -
- - - -
-
- -
-
- notify_author[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- create_status_change_note(noteable, author, status) - click to toggle source -
- - -
- - - - - -
-
# File app/models/note.rb, line 34
-def self.create_status_change_note(noteable, author, status)
-  create({
-    noteable: noteable,
-    project: noteable.project,
-    author: author,
-    note: "_Status changed to #{status}_"
-  }, without_protection: true)
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- commit_author() - click to toggle source -
- - -
- - - - - -
-
# File app/models/note.rb, line 90
-def commit_author
-  @commit_author ||=
-    project.users.find_by_email(noteable.author_email) ||
-    project.users.find_by_name(noteable.author_name)
-rescue
-  nil
-end
-
- -
- - - - -
- - -
- -
- downvote?() - click to toggle source -
- - -
- -

Returns true if this is a downvote note, otherwise false is returned

- - - -
-
# File app/models/note.rb, line 106
-def downvote?
-  note.start_with?('-1') || note.start_with?(':-1:')
-end
-
- -
- - - - -
- - -
- -
- for_commit?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/note.rb, line 82
-def for_commit?
-  noteable_type == "Commit"
-end
-
- -
- - - - -
- - -
- -
- for_diff_line?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/note.rb, line 86
-def for_diff_line?
-  line_code.present?
-end
-
- -
- - - - -
- - -
- -
- noteable() - click to toggle source -
- - -
- -

override to return commits, which are not active record

- - - -
-
# File app/models/note.rb, line 52
-def noteable
-  if for_commit?
-    project.commit(noteable_id)
-  else
-    super
-  end
-# Temp fix to prevent app crash
-# if note commit id doesnt exist
-rescue
-  nil
-end
-
- -
- - - - -
- - -
- -
- notify_only_author?(user) - click to toggle source -
- - -
- -

Check if we can notify commit author with email about our comment

- -

If commit author email exist in project and commit author is not passed -user we can send email to him

- -

params:

- -
user - current user
- -

return:

- -
Boolean
- - - -
-
# File app/models/note.rb, line 77
-def notify_only_author?(user)
-  for_commit? && commit_author &&
-    commit_author.email != user.email
-end
-
- -
- - - - -
- - -
- -
- upvote?() - click to toggle source -
- - -
- -

Returns true if this is an upvote note, otherwise false is returned

- - - -
-
# File app/models/note.rb, line 100
-def upvote?
-  note.start_with?('+1') || note.start_with?(':+1:')
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/NoteObserver.html b/doc/app/NoteObserver.html deleted file mode 100644 index d0528833815..00000000000 --- a/doc/app/NoteObserver.html +++ /dev/null @@ -1,603 +0,0 @@ - - - - - - -class NoteObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class NoteObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(note) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/note_observer.rb, line 3
-def after_create(note)
-  send_notify_mails(note)
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- notify_team(note) - click to toggle source -
- - -
- -

Notifies the whole team except the author of note

- - - -
-
# File app/observers/note_observer.rb, line 22
-def notify_team(note)
-  # Note: wall posts are not "attached" to anything, so fall back to "Wall"
-  noteable_type = note.noteable_type || "Wall"
-  notify_method = "note_#{noteable_type.underscore}_email".to_sym
-
-  if Notify.respond_to? notify_method
-    team_without_note_author(note).map do |u|
-      Notify.send(notify_method, u.id, note.id).deliver
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- send_notify_mails(note) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/note_observer.rb, line 9
-def send_notify_mails(note)
-  if note.notify
-    notify_team(note)
-  elsif note.notify_author
-    # Notify only author of resource
-    Notify.note_commit_email(note.commit_author.id, note.id).deliver
-  else
-    # Otherwise ignore it
-    nil
-  end
-end
-
- -
- - - - -
- - -
- -
- team_without_note_author(note) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/note_observer.rb, line 34
-def team_without_note_author(note)
-  note.project.users.reject { |u| u.id == note.author.id }
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Notes.html b/doc/app/Notes.html deleted file mode 100644 index d6bcc54011a..00000000000 --- a/doc/app/Notes.html +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - -module Notes - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Notes

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Notes/CreateContext.html b/doc/app/Notes/CreateContext.html deleted file mode 100644 index 6d4c8449323..00000000000 --- a/doc/app/Notes/CreateContext.html +++ /dev/null @@ -1,490 +0,0 @@ - - - - - - -class Notes::CreateContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Notes::CreateContext

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/notes/create_context.rb, line 3
-def execute
-  note = project.notes.new(params[:note])
-  note.author = current_user
-  note.notify = true if params[:notify] == '1'
-  note.notify_author = true if params[:notify_author] == '1'
-  note.save
-  note
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Notes/LoadContext.html b/doc/app/Notes/LoadContext.html deleted file mode 100644 index 273fc0f0c8d..00000000000 --- a/doc/app/Notes/LoadContext.html +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - -class Notes::LoadContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Notes::LoadContext

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/notes/load_context.rb, line 3
-def execute
-  target_type = params[:target_type]
-  target_id   = params[:target_id]
-  after_id    = params[:after_id]
-  before_id   = params[:before_id]
-
-
-  @notes = case target_type
-           when "commit"
-             project.commit_notes(project.commit(target_id)).fresh.limit(20)
-           when "issue"
-             project.issues.find(target_id).notes.inc_author.fresh.limit(20)
-           when "merge_request"
-             project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh.limit(20)
-           when "snippet"
-             project.snippets.find(target_id).notes.fresh
-           when "wall"
-             # this is the only case, where the order is DESC
-             project.common_notes.order("created_at DESC, id DESC").limit(50)
-           when "wiki"
-             project.wiki_notes.limit(20)
-           end
-
-  @notes = if after_id
-             @notes.where("id > ?", after_id)
-           elsif before_id
-             @notes.where("id < ?", before_id)
-           else
-             @notes
-           end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/NotesController.html b/doc/app/NotesController.html deleted file mode 100644 index 5623d4a2f5c..00000000000 --- a/doc/app/NotesController.html +++ /dev/null @@ -1,636 +0,0 @@ - - - - - - -class NotesController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class NotesController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/notes_controller.rb, line 18
-def create
-  @note = Notes::CreateContext.new(project, current_user, params).execute
-
-  respond_to do |format|
-    format.html {redirect_to :back}
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/notes_controller.rb, line 27
-def destroy
-  @note = @project.notes.find(params[:id])
-  return access_denied! unless can?(current_user, :admin_note, @note)
-  @note.destroy
-
-  respond_to do |format|
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/notes_controller.rb, line 8
-def index
-  notes
-  if params[:target_type] == "merge_request"
-    @mixed_targets = true
-    @main_target_type = params[:target_type].camelize
-  end
-
-  respond_with(@notes)
-end
-
- -
- - - - -
- - -
- -
- preview() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/notes_controller.rb, line 37
-def preview
-  render text: view_context.markdown(params[:note])
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- notes() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/notes_controller.rb, line 43
-def notes
-  @notes = Notes::LoadContext.new(project, current_user, params).execute
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/NotesHelper.html b/doc/app/NotesHelper.html deleted file mode 100644 index c2940f8dc95..00000000000 --- a/doc/app/NotesHelper.html +++ /dev/null @@ -1,581 +0,0 @@ - - - - - - -module NotesHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module NotesHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - - - - -
- -
- loading_more_notes?() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/notes_helper.rb, line 2
-def loading_more_notes?
-  params[:loading_more].present?
-end
-
- -
- - - - -
- - -
- -
- loading_new_notes?() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/notes_helper.rb, line 6
-def loading_new_notes?
-  params[:loading_new].present?
-end
-
- -
- - - - -
- - -
- -
- note_for_main_target?(note) - click to toggle source -
- - -
- -

Helps to distinguish e.g. commit notes in mr notes list

- - - -
-
# File app/helpers/notes_helper.rb, line 11
-def note_for_main_target?(note)
-  !@mixed_targets || @main_target_type == note.noteable_type
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Notify.html b/doc/app/Notify.html deleted file mode 100644 index 933e1cbc372..00000000000 --- a/doc/app/Notify.html +++ /dev/null @@ -1,883 +0,0 @@ - - - - - - -class Notify - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Notify

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 31
-def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
-  @issue = Issue.find issue_id
-  @issue_status = status
-  @updated_by = User.find updated_by_user_id
-  mail(to: recipient(recipient_id),
-      subject: subject("changed issue ##{@issue.id}", @issue.title))
-end
-
- -
- - - - -
- - -
- -
- new_issue_email(issue_id) - click to toggle source -
- - -
- -

Issue

- - - -
-
# File app/mailers/notify.rb, line 18
-def new_issue_email(issue_id)
-  @issue = Issue.find(issue_id)
-  @project = @issue.project
-  mail(to: @issue.assignee_email, subject: subject("new issue ##{@issue.id}", @issue.title))
-end
-
- -
- - - - -
- - -
- -
- new_merge_request_email(merge_request_id) - click to toggle source -
- - -
- -

Merge Request

- - - -
-
# File app/mailers/notify.rb, line 45
-def new_merge_request_email(merge_request_id)
-  @merge_request = MergeRequest.find(merge_request_id)
-  @project = @merge_request.project
-  mail(to: @merge_request.assignee_email, subject: subject("new merge request !#{@merge_request.id}", @merge_request.title))
-end
-
- -
- - - - -
- - -
- -
- new_user_email(user_id, password) - click to toggle source -
- - -
- -

User

- - - -
-
# File app/mailers/notify.rb, line 118
-def new_user_email(user_id, password)
-  @user = User.find(user_id)
-  @password = password
-  mail(to: @user.email, subject: subject("Account was created for you"))
-end
-
- -
- - - - -
- - -
- -
- note_commit_email(recipient_id, note_id) - click to toggle source -
- - -
- -

Note

- - - -
-
# File app/mailers/notify.rb, line 64
-def note_commit_email(recipient_id, note_id)
-  @note = Note.find(note_id)
-  @commit = @note.noteable
-  @commit = CommitDecorator.decorate(@commit)
-  @project = @note.project
-  mail(to: recipient(recipient_id), subject: subject("note for commit #{@commit.short_id}", @commit.title))
-end
-
- -
- - - - -
- - -
- -
- note_issue_email(recipient_id, note_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 72
-def note_issue_email(recipient_id, note_id)
-  @note = Note.find(note_id)
-  @issue = @note.noteable
-  @project = @note.project
-  mail(to: recipient(recipient_id), subject: subject("note for issue ##{@issue.id}"))
-end
-
- -
- - - - -
- - -
- -
- note_merge_request_email(recipient_id, note_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 79
-def note_merge_request_email(recipient_id, note_id)
-  @note = Note.find(note_id)
-  @merge_request = @note.noteable
-  @project = @note.project
-  mail(to: recipient(recipient_id), subject: subject("note for merge request !#{@merge_request.id}"))
-end
-
- -
- - - - -
- - -
- -
- note_wall_email(recipient_id, note_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 86
-def note_wall_email(recipient_id, note_id)
-  @note = Note.find(note_id)
-  @project = @note.project
-  mail(to: recipient(recipient_id), subject: subject)
-end
-
- -
- - - - -
- - -
- -
- note_wiki_email(recipient_id, note_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 92
-def note_wiki_email(recipient_id, note_id)
-  @note = Note.find(note_id)
-  @wiki = @note.noteable
-  @project = @note.project
-  mail(to: recipient(recipient_id), subject: subject("note for wiki"))
-end
-
- -
- - - - -
- - -
- -
- project_access_granted_email(user_project_id) - click to toggle source -
- - -
- -

Project

- - - -
-
# File app/mailers/notify.rb, line 105
-def project_access_granted_email(user_project_id)
-  @users_project = UsersProject.find user_project_id
-  @project = @users_project.project
-  mail(to: @users_project.user.email, 
-       subject: subject("access to project was granted"))
-end
-
- -
- - - - -
- - -
- -
- reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 24
-def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
-  @issue = Issue.find(issue_id)
-  @previous_assignee ||= User.find(previous_assignee_id)
-  @project = @issue.project
-  mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title))
-end
-
- -
- - - - -
- - -
- -
- reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) - click to toggle source -
- - -
- - - - - -
-
# File app/mailers/notify.rb, line 51
-def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
-  @merge_request = MergeRequest.find(merge_request_id)
-  @previous_assignee ||= User.find(previous_assignee_id)
-  @project = @merge_request.project
-  mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title))
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/OmniauthCallbacksController.html b/doc/app/OmniauthCallbacksController.html deleted file mode 100644 index d40a16a3eb9..00000000000 --- a/doc/app/OmniauthCallbacksController.html +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - -class OmniauthCallbacksController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class OmniauthCallbacksController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- failure_message() - click to toggle source -
- - -
- -

Extend the standard message generation to accept our custom exception

- - - -
-
# File app/controllers/omniauth_callbacks_controller.rb, line 9
-def failure_message
-  exception = env["omniauth.error"]
-  error   = exception.error_reason if exception.respond_to?(:error_reason)
-  error ||= exception.error        if exception.respond_to?(:error)
-  error ||= exception.message      if exception.respond_to?(:message)
-  error ||= env["omniauth.error.type"].to_s
-  error.to_s.humanize if error
-end
-
- -
- - - - -
- - -
- -
- ldap() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/omniauth_callbacks_controller.rb, line 18
-def ldap
-  # We only find ourselves here if the authentication to LDAP was successful.
-  @user = User.find_for_ldap_auth(request.env["omniauth.auth"], current_user)
-  if @user.persisted?
-    @user.remember_me = true
-  end
-  sign_in_and_redirect @user
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/PostReceive.html b/doc/app/PostReceive.html deleted file mode 100644 index 11468fd9ca9..00000000000 --- a/doc/app/PostReceive.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - -class PostReceive - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class PostReceive

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- perform(reponame, oldrev, newrev, ref, identifier) - click to toggle source -
- - -
- - - - - -
-
# File app/workers/post_receive.rb, line 4
-def self.perform(reponame, oldrev, newrev, ref, identifier)
-  project = Project.find_by_path(reponame)
-  return false if project.nil?
-
-  # Ignore push from non-gitlab users
-  if %r^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
-    return false unless user = User.find_by_email(identifier)
-  else
-    return false unless user = Key.find_by_identifier(identifier).try(:user)
-  end
-
-  project.trigger_post_receive(oldrev, newrev, ref, user)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProfileController.html b/doc/app/ProfileController.html deleted file mode 100644 index deb4b0bcb67..00000000000 --- a/doc/app/ProfileController.html +++ /dev/null @@ -1,683 +0,0 @@ - - - - - - -class ProfileController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProfileController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- design() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 7
-def design
-end
-
- -
- - - - -
- - -
- -
- history() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 34
-def history
-  @events = current_user.recent_events.page(params[:page]).per(20)
-end
-
- -
- - - - -
- - -
- -
- password_update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 18
-def password_update
-  params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
-
-  if @user.update_attributes(params[:user])
-    flash[:notice] = "Password was successfully updated. Please login with it"
-    redirect_to new_user_session_path
-  else
-    render action: "password"
-  end
-end
-
- -
- - - - -
- - -
- -
- reset_private_token() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 29
-def reset_private_token
-  current_user.reset_authentication_token!
-  redirect_to profile_account_path
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 4
-def show
-end
-
- -
- - - - -
- - -
- -
- token() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 15
-def token
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/profile_controller.rb, line 10
-def update
-  @user.update_attributes(params[:user])
-  redirect_to :back
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProfileHelper.html b/doc/app/ProfileHelper.html deleted file mode 100644 index ab7773ba6be..00000000000 --- a/doc/app/ProfileHelper.html +++ /dev/null @@ -1,481 +0,0 @@ - - - - - - -module ProfileHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module ProfileHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- oauth_active_class(provider) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/profile_helper.rb, line 2
-def oauth_active_class provider
-  if current_user.provider == provider.to_s
-    'active'
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Project.html b/doc/app/Project.html deleted file mode 100644 index 55868ef1838..00000000000 --- a/doc/app/Project.html +++ /dev/null @@ -1,1202 +0,0 @@ - - - - - - -class Project - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Project

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- error_code[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- access_options() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 85
-def access_options
-  UsersProject.access_roles
-end
-
- -
- - - - -
- - -
- -
- active() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 52
-def active
-  joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
-end
-
- -
- - - - -
- - -
- -
- create_by_user(params, user) - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 60
-def create_by_user(params, user)
-  project = Project.new params
-
-  Project.transaction do
-    project.owner = user
-    project.save!
-
-    # Add user as project master
-    project.users_projects.create!(project_access: UsersProject::MASTER, user: user)
-
-    # when project saved no team member exist so
-    # project repository should be updated after first user add
-    project.update_repository
-  end
-
-  project
-rescue Gitlab::Gitolite::AccessDenied => ex
-  project.error_code = :gitolite
-  project
-rescue => ex
-  project.error_code = :db
-  project.errors.add(:base, "Can't save project. Please try again later")
-  project
-end
-
- -
- - - - -
- - - - - -
- -
-

Public Instance Methods

- - -
- -
- build_commit_note(commit) - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 124
-def build_commit_note(commit)
-  notes.new(noteable_id: commit.id, noteable_type: "Commit")
-end
-
- -
- - - - -
- - -
- -
- check_limit() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 98
-def check_limit
-  unless owner.can_create_project?
-    errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
-  end
-rescue
-  errors[:base] << ("Can't check your ability to create project")
-end
-
- -
- - - - -
- - -
- -
- commit_line_notes(commit) - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 132
-def commit_line_notes(commit)
-  notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
-end
-
- -
- - - - -
- - -
- -
- commit_notes(commit) - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 128
-def commit_notes(commit)
-  notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil)
-end
-
- -
- - - - -
- - -
- -
- common_notes() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 120
-def common_notes
-  notes.where(noteable_type: ["", nil]).inc_author_project
-end
-
- -
- - - - -
- - -
- -
- git_error?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 90
-def git_error?
-  error_code == :gitolite
-end
-
- -
- - - - -
- - -
- -
- issues_labels() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 160
-def issues_labels
-  issues.tag_counts_on(:labels)
-end
-
- -
- - - - -
- - -
- -
- last_activity() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 144
-def last_activity
-  last_event
-end
-
- -
- - - - -
- - -
- -
- last_activity_date() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 148
-def last_activity_date
-  last_event.try(:created_at) || updated_at
-end
-
- -
- - - - -
- - -
- -
- private?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 140
-def private?
-  private_flag
-end
-
- -
- - - - -
- - -
- -
- project_id() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 156
-def project_id
-  self.id
-end
-
- -
- - - - -
- - -
- -
- public?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 136
-def public?
-  !private_flag
-end
-
- -
- - - - -
- - -
- -
- repo_name() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 106
-def repo_name
-  if path == "gitolite-admin"
-    errors.add(:path, " like 'gitolite-admin' is not allowed")
-  end
-end
-
- -
- - - - -
- - -
- -
- saved?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 94
-def saved?
-  id && valid?
-end
-
- -
- - - - -
- - -
- -
- to_param() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 112
-def to_param
-  code
-end
-
- -
- - - - -
- - -
- -
- web_url() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 116
-def web_url
-  [Gitlab.config.url, code].join("/")
-end
-
- -
- - - - -
- - -
- -
- wiki_notes() - click to toggle source -
- - -
- - - - - -
-
# File app/models/project.rb, line 152
-def wiki_notes
-  Note.where(noteable_id: wikis.pluck(:id), noteable_type: 'Wiki', project_id: self.id)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProjectHook.html b/doc/app/ProjectHook.html deleted file mode 100644 index e5d17ef0e0a..00000000000 --- a/doc/app/ProjectHook.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class ProjectHook - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProjectHook

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/ProjectObserver.html b/doc/app/ProjectObserver.html deleted file mode 100644 index d4ce78247d2..00000000000 --- a/doc/app/ProjectObserver.html +++ /dev/null @@ -1,589 +0,0 @@ - - - - - - -class ProjectObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProjectObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(project) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/project_observer.rb, line 12
-def after_create project
-  log_info("#{project.owner.name} created a new project \"#{project.name}\"")
-end
-
- -
- - - - -
- - -
- -
- after_destroy(project) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/project_observer.rb, line 6
-def after_destroy(project)
-  log_info("Project \"#{project.name}\" was removed")
-
-  project.destroy_repository
-end
-
- -
- - - - -
- - -
- -
- after_save(project) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/project_observer.rb, line 2
-def after_save(project)
-  project.update_repository
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- log_info(message) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/project_observer.rb, line 18
-def log_info message
-  Gitlab::AppLogger.info message
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProjectResourceController.html b/doc/app/ProjectResourceController.html deleted file mode 100644 index aa972617cb5..00000000000 --- a/doc/app/ProjectResourceController.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - -class ProjectResourceController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProjectResourceController

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/ProjectsController.html b/doc/app/ProjectsController.html deleted file mode 100644 index 6982deabcf9..00000000000 --- a/doc/app/ProjectsController.html +++ /dev/null @@ -1,785 +0,0 @@ - - - - - - -class ProjectsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProjectsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 20
-def create
-  @project = Project.create_by_user(params[:project], current_user)
-
-  respond_to do |format|
-    format.html do
-      if @project.saved?
-        redirect_to(@project, notice: 'Project was successfully created.')
-      else
-        render action: "new"
-      end
-    end
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 85
-def destroy
-  # Disable the UsersProject update_repository call, otherwise it will be
-  # called once for every person removed from the project
-  UsersProject.skip_callback(:destroy, :after, :update_repository)
-  project.destroy
-  UsersProject.set_callback(:destroy, :after, :update_repository)
-
-  respond_to do |format|
-    format.html { redirect_to root_path }
-  end
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 17
-def edit
-end
-
- -
- - - - -
- - -
- -
- files() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 64
-def files
-  @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
-end
-
- -
- - - - -
- - -
- -
- graph() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 81
-def graph
-  @days_json, @commits_json = Gitlab::GraphCommit.to_graph(project)
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 13
-def new
-  @project = Project.new
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 47
-def show
-  limit = (params[:limit] || 20).to_i
-  @events = @project.events.recent.limit(limit).offset(params[:offset] || 0)
-
-  respond_to do |format|
-    format.html do
-       unless @project.empty_repo?
-         @last_push = current_user.recent_push(@project.id)
-         render :show
-       else
-         render "projects/empty"
-       end
-    end
-    format.js
-  end
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/projects_controller.rb, line 35
-def update
-  respond_to do |format|
-    if project.update_attributes(params[:project])
-      format.html { redirect_to edit_project_path(project), notice: 'Project was successfully updated.' }
-      format.js
-    else
-      format.html { render action: "edit" }
-      format.js
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- wall() - click to toggle source -
- - -
- -

Wall

- - - -
-
# File app/controllers/projects_controller.rb, line 72
-def wall
-  return render_404 unless @project.wall_enabled
-  @note = Note.new
-
-  respond_to do |format|
-    format.html
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProjectsHelper.html b/doc/app/ProjectsHelper.html deleted file mode 100644 index 5edd4592cc7..00000000000 --- a/doc/app/ProjectsHelper.html +++ /dev/null @@ -1,543 +0,0 @@ - - - - - - -module ProjectsHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module ProjectsHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- grouper_project_members(project) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/projects_helper.rb, line 2
-def grouper_project_members(project)
-  @project.users_projects.sort_by(&:project_access).reverse.group_by(&:project_access)
-end
-
- -
- - - - -
- - - - - -
- -
- remove_from_team_message(project, member) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/projects_helper.rb, line 6
-def remove_from_team_message(project, member)
-  "You are going to remove #{member.user_name} from #{project.name}. Are you sure?"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProtectedBranch.html b/doc/app/ProtectedBranch.html deleted file mode 100644 index 900646dc53a..00000000000 --- a/doc/app/ProtectedBranch.html +++ /dev/null @@ -1,529 +0,0 @@ - - - - - - -class ProtectedBranch - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProtectedBranch

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- commit() - click to toggle source -
- - -
- - - - - -
-
# File app/models/protected_branch.rb, line 17
-def commit
-  project.commit(self.name)
-end
-
- -
- - - - -
- - -
- -
- update_repository() - click to toggle source -
- - -
- - - - - -
-
# File app/models/protected_branch.rb, line 13
-def update_repository
-  git_host.update_repository(project)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/ProtectedBranchesController.html b/doc/app/ProtectedBranchesController.html deleted file mode 100644 index 7eb2b1fdae3..00000000000 --- a/doc/app/ProtectedBranchesController.html +++ /dev/null @@ -1,556 +0,0 @@ - - - - - - -class ProtectedBranchesController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class ProtectedBranchesController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/protected_branches_controller.rb, line 13
-def create
-  @project.protected_branches.create(params[:protected_branch])
-  redirect_to project_protected_branches_path(@project)
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/protected_branches_controller.rb, line 18
-def destroy
-  @project.protected_branches.find(params[:id]).destroy
-
-  respond_to do |format|
-    format.html { redirect_to project_protected_branches_path }
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/protected_branches_controller.rb, line 8
-def index
-  @branches = @project.protected_branches.all
-  @protected_branch = @project.protected_branches.new
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/PushEvent.html b/doc/app/PushEvent.html deleted file mode 100644 index 002866a66fe..00000000000 --- a/doc/app/PushEvent.html +++ /dev/null @@ -1,1105 +0,0 @@ - - - - - - -module PushEvent - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module PushEvent

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- branch?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 12
-def branch?
-  data[:ref]["refs/heads"]
-end
-
- -
- - - - -
- - -
- -
- branch_name() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 48
-def branch_name
-  @branch_name ||= data[:ref].gsub("refs/heads/", "")
-end
-
- -
- - - - -
- - -
- -
- commit_from() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 32
-def commit_from
-  data[:before]
-end
-
- -
- - - - -
- - -
- -
- commit_to() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 36
-def commit_to
-  data[:after]
-end
-
- -
- - - - -
- - -
- -
- commits() - click to toggle source -
- - -
- -

Max 20 commits from push DESC

- - - -
-
# File app/roles/push_event.rb, line 57
-def commits
-  @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse
-end
-
- -
- - - - -
- - -
- -
- commits_count() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 61
-def commits_count 
-  data[:total_commits_count] || commits.count || 0
-end
-
- -
- - - - -
- - -
- -
- last_commit() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 85
-def last_commit
-  project.commit(commit_to)
-rescue => ex
-  nil
-end
-
- -
- - - - -
- - -
- -
- last_push_to_non_root?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 97
-def last_push_to_non_root?
-  branch? && project.default_branch != branch_name
-end
-
- -
- - - - -
- - -
- -
- md_ref?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 28
-def md_ref?
-  !(rm_ref? || new_ref?)
-end
-
- -
- - - - -
- - -
- -
- new_branch?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 16
-def new_branch?
-  commit_from =~ %r^00000/
-end
-
- -
- - - - -
- - -
- -
- new_ref?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 20
-def new_ref?
-  commit_from =~ %r^00000/
-end
-
- -
- - - - -
- - -
- -
- parent_commit() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 79
-def parent_commit
-  project.commit(commit_from)
-rescue => ex
-  nil
-end
-
- -
- - - - -
- - -
- -
- push_action_name() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 69
-def push_action_name
-  if new_ref?
-    "pushed new"
-  elsif rm_ref?
-    "deleted"
-  else
-    "pushed to"
-  end
-end
-
- -
- - - - -
- - -
- -
- push_with_commits?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 91
-def push_with_commits? 
-  md_ref? && commits.any? && parent_commit && last_commit
-rescue Grit::NoSuchPathError
-  false
-end
-
- -
- - - - -
- - -
- -
- ref_name() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 40
-def ref_name
-  if tag?
-    tag_name
-  else
-    branch_name
-  end
-end
-
- -
- - - - -
- - -
- -
- ref_type() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 65
-def ref_type
-  tag? ? "tag" : "branch"
-end
-
- -
- - - - -
- - -
- -
- rm_ref?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 24
-def rm_ref?
-  commit_to =~ %r^00000/
-end
-
- -
- - - - -
- - -
- -
- tag?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 8
-def tag?
-  data[:ref]["refs/tags"]
-end
-
- -
- - - - -
- - -
- -
- tag_name() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 52
-def tag_name
-  @tag_name ||= data[:ref].gsub("refs/tags/", "")
-end
-
- -
- - - - -
- - -
- -
- valid_push?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_event.rb, line 2
-def valid_push?
-  data[:ref]
-rescue => ex
-  false
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/PushObserver.html b/doc/app/PushObserver.html deleted file mode 100644 index 804447a6917..00000000000 --- a/doc/app/PushObserver.html +++ /dev/null @@ -1,699 +0,0 @@ - - - - - - -module PushObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module PushObserver

- -
- -

Includes methods for handling Git Push events

- -

Triggered by PostReceive job

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute_hooks(oldrev, newrev, ref, user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_observer.rb, line 33
-def execute_hooks(oldrev, newrev, ref, user)
-  ref_parts = ref.split('/')
-
-  # Return if this is not a push to a branch (e.g. new commits)
-  return if ref_parts[1] !~ %rheads/ || oldrev == "00000000000000000000000000000000"
-
-  data = post_receive_data(oldrev, newrev, ref, user)
-
-  hooks.each { |hook| hook.execute(data) }
-end
-
- -
- - - - -
- - -
- -
- observe_push(oldrev, newrev, ref, user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_observer.rb, line 5
-def observe_push(oldrev, newrev, ref, user)
-  data = post_receive_data(oldrev, newrev, ref, user)
-
-  Event.create(
-    project: self,
-    action: Event::Pushed,
-    data: data,
-    author_id: data[:user_id]
-  )
-end
-
- -
- - - - -
- - -
- -
- post_receive_data(oldrev, newrev, ref, user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_observer.rb, line 44
-def post_receive_data(oldrev, newrev, ref, user)
-
-  push_commits = commits_between(oldrev, newrev)
-
-  # Total commits count
-  push_commits_count = push_commits.size
-
-  # Get latest 20 commits ASC
-  push_commits_limited = push_commits.last(20)
-
-  # Hash to be passed as post_receive_data
-  data = {
-    before: oldrev,
-    after: newrev,
-    ref: ref,
-    user_id: user.id,
-    user_name: user.name,
-    repository: {
-      name: name,
-      url: web_url,
-      description: description,
-      homepage: web_url,
-    },
-    commits: [],
-    total_commits_count: push_commits_count
-  }
-
-  # For perfomance purposes maximum 20 latest commits
-  # will be passed as post receive hook data.
-  #
-  push_commits_limited.each do |commit|
-    data[:commits] << {
-      id: commit.id,
-      message: commit.safe_message,
-      timestamp: commit.date.xmlschema,
-      url: "#{Gitlab.config.url}/#{code}/commits/#{commit.id}",
-      author: {
-        name: commit.author_name,
-        email: commit.author_email
-      }
-    }
-  end
-
-  data
-end
-
- -
- - - - -
- - -
- -
- trigger_post_receive(oldrev, newrev, ref, user) - click to toggle source -
- - -
- -

This method will be called after each post receive and only if the provided -user is present in GitLab.

- -

All callbacks for post receive should be placed here.

- - - -
-
# File app/roles/push_observer.rb, line 94
-def trigger_post_receive(oldrev, newrev, ref, user)
-  # Create push event
-  self.observe_push(oldrev, newrev, ref, user)
-
-  # Close merged MR
-  self.update_merge_requests(oldrev, newrev, ref, user)
-
-  # Execute web hooks
-  self.execute_hooks(oldrev, newrev, ref, user)
-
-  # Create satellite
-  self.satellite.create unless self.satellite.exists?
-
-  # Discover the default branch, but only if it hasn't already been set to
-  # something else
-  if default_branch.nil?
-    update_attributes(default_branch: discover_default_branch)
-  end
-end
-
- -
- - - - -
- - -
- -
- update_merge_requests(oldrev, newrev, ref, user) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/push_observer.rb, line 16
-def update_merge_requests(oldrev, newrev, ref, user)
-  return true unless ref =~ %rheads/
-  branch_name = ref.gsub("refs/heads/", "")
-  c_ids = self.commits_between(oldrev, newrev).map(&:id)
-
-  # Update code for merge requests
-  mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all
-  mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
-
-  # Close merge requests
-  mrs = self.merge_requests.opened.where(target_branch: branch_name).all
-  mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
-  mrs.each { |merge_request| merge_request.merge!(user.id) }
-
-  true
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Redcarpet.html b/doc/app/Redcarpet.html deleted file mode 100644 index 238b7f2596c..00000000000 --- a/doc/app/Redcarpet.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - -module Redcarpet - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Redcarpet

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Redcarpet/Render.html b/doc/app/Redcarpet/Render.html deleted file mode 100644 index acb7ba3cdf4..00000000000 --- a/doc/app/Redcarpet/Render.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - -module Redcarpet::Render - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Redcarpet::Render

- -
- -
- - - - -
- - - - - - - - - - -
- -
- - - - diff --git a/doc/app/Redcarpet/Render/GitlabHTML.html b/doc/app/Redcarpet/Render/GitlabHTML.html deleted file mode 100644 index 93212eaba21..00000000000 --- a/doc/app/Redcarpet/Render/GitlabHTML.html +++ /dev/null @@ -1,594 +0,0 @@ - - - - - - -class Redcarpet::Render::GitlabHTML - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Redcarpet::Render::GitlabHTML

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- h[R] -
- -
- - - -
-
- -
-
- template[R] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(template, options = {}) - click to toggle source -
- - -
- - - - - -
-
# File lib/redcarpet/render/gitlab_html.rb, line 6
-def initialize(template, options = {})
-  @template = template
-  @project = @template.instance_variable_get("@project")
-  super options
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- block_code(code, language) - click to toggle source -
- - -
- - - - - -
-
# File lib/redcarpet/render/gitlab_html.rb, line 12
-def block_code(code, language)
-  if Pygments::Lexer.find(language)
-    Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'})
-  else
-    Pygments.highlight(code, options: {encoding: 'utf-8'})
-  end
-end
-
- -
- - - - -
- - -
- -
- postprocess(full_document) - click to toggle source -
- - -
- - - - - -
-
# File lib/redcarpet/render/gitlab_html.rb, line 20
-def postprocess(full_document)
-  h.gfm(full_document)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/RefsController.html b/doc/app/RefsController.html deleted file mode 100644 index a8248da0ec0..00000000000 --- a/doc/app/RefsController.html +++ /dev/null @@ -1,638 +0,0 @@ - - - - - - -class RefsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class RefsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- logs_tree() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/refs_controller.rb, line 31
-def logs_tree
-  contents = @tree.contents
-  @logs = contents.map do |content|
-    file = params[:path] ? File.join(params[:path], content.name) : content.name
-    last_commit = @project.commits(@commit.id, file, 1).last
-    last_commit = CommitDecorator.decorate(last_commit)
-    {
-      file_name: content.name,
-      commit: last_commit
-    }
-  end
-end
-
- -
- - - - -
- - -
- -
- switch() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/refs_controller.rb, line 12
-def switch
-  respond_to do |format|
-    format.html do
-      new_path = if params[:destination] == "tree"
-                   project_tree_path(@project, @ref)
-                 else
-                   project_commits_path(@project, @ref)
-                 end
-
-      redirect_to new_path
-    end
-    format.js do
-      @ref = params[:ref]
-      define_tree_vars
-      render "tree"
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- define_tree_vars() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/refs_controller.rb, line 46
-def define_tree_vars
-  params[:path] = nil if params[:path].blank?
-
-  @repo = project.repo
-  @commit = project.commit(@ref)
-  @commit = CommitDecorator.decorate(@commit)
-  @tree = Tree.new(@commit.tree, project, @ref, params[:path])
-  @tree = TreeDecorator.new(@tree)
-  @hex_path = Digest::SHA1.hexdigest(params[:path] || "")
-
-  if params[:path]
-    @logs_path = logs_file_project_ref_path(@project, @ref, params[:path])
-  else
-    @logs_path = logs_tree_project_ref_path(@project, @ref)
-  end
-rescue
-  return render_404
-end
-
- -
- - - - -
- - -
- -
- ref() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/refs_controller.rb, line 65
-def ref
-  @ref = params[:id] || params[:ref]
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/RepositoriesController.html b/doc/app/RepositoriesController.html deleted file mode 100644 index 3a22f71e49a..00000000000 --- a/doc/app/RepositoriesController.html +++ /dev/null @@ -1,593 +0,0 @@ - - - - - - -class RepositoriesController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class RepositoriesController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- archive() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/repositories_controller.rb, line 19
-def archive
-  unless can?(current_user, :download_code, @project)
-    render_404 and return 
-  end
-
-
-  file_path = @project.archive_repo(params[:ref])
-
-  if file_path
-    # Send file to user
-    send_file file_path
-  else
-    render_404
-  end
-end
-
- -
- - - - -
- - -
- -
- branches() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/repositories_controller.rb, line 11
-def branches
-  @branches = @project.branches
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/repositories_controller.rb, line 7
-def show
-  @activities = @project.commits_with_refs(20)
-end
-
- -
- - - - -
- - -
- -
- tags() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/repositories_controller.rb, line 15
-def tags
-  @tags = @project.tags
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Repository.html b/doc/app/Repository.html deleted file mode 100644 index cb68146cfda..00000000000 --- a/doc/app/Repository.html +++ /dev/null @@ -1,1566 +0,0 @@ - - - - - - -module Repository - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Repository

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- archive_repo(ref) - click to toggle source -
- - -
- -

Archive Project to .tar.gz

- -

Already packed repo archives stored at -app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz

- - - -
-
# File app/roles/repository.rb, line 157
-def archive_repo(ref)
-  ref = ref || self.root_ref
-  commit = self.commit(ref)
-  return nil unless commit
-
-  # Build file path
-  file_name = self.code + "-" + commit.id.to_s + ".tar.gz"
-  storage_path = Rails.root.join("tmp", "repositories", self.code)
-  file_path = File.join(storage_path, file_name)
-
-  # Put files into a directory before archiving
-  prefix = self.code + "/"
-
-  # Create file if not exists
-  unless File.exists?(file_path)
-    FileUtils.mkdir_p storage_path
-    file = self.repo.archive_to_file(ref, prefix,  file_path)
-  end
-
-  file_path
-end
-
- -
- - - - -
- - -
- -
- branch_names() - click to toggle source -
- - -
- -

Returns an Array of branch names

- - - -
-
# File app/roles/repository.rb, line 53
-def branch_names
-  repo.branches.collect(&:name).sort
-end
-
- -
- - - - -
- - -
- -
- branches() - click to toggle source -
- - -
- -

Returns an Array of Branches

- - - -
-
# File app/roles/repository.rb, line 58
-def branches
-  repo.branches.sort_by(&:name)
-end
-
- -
- - - - -
- - -
- -
- commit(commit_id = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 15
-def commit(commit_id = nil)
-  Commit.find_or_first(repo, commit_id, root_ref)
-end
-
- -
- - - - -
- - -
- -
- commits(ref, path = nil, limit = nil, offset = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 31
-def commits(ref, path = nil, limit = nil, offset = nil)
-  Commit.commits(repo, ref, path, limit, offset)
-end
-
- -
- - - - -
- - -
- -
- commits_between(from, to) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 39
-def commits_between(from, to)
-  Commit.commits_between(repo, from, to)
-end
-
- -
- - - - -
- - -
- -
- commits_since(date) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 27
-def commits_since(date)
-  Commit.commits_since(repo, date)
-end
-
- -
- - - - -
- - -
- -
- commits_with_refs(n = 20) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 23
-def commits_with_refs(n = 20)
-  Commit.commits_with_refs(repo, n)
-end
-
- -
- - - - -
- - -
- -
- destroy_repository() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 93
-def destroy_repository
-  git_host.remove_repository(self)
-end
-
- -
- - - - -
- - -
- -
- discover_default_branch() - click to toggle source -
- - -
- -

Discovers the default branch based on the repository’s available branches

-
  • -

    If no branches are present, returns nil

    -
  • -

    If one branch is present, returns its name

    -
  • -

    If two or more branches are present, returns the one that has a name -matching #root_ref -(default_branch or ‘master’ if default_branch is nil)

    -
- - - -
-
# File app/roles/repository.rb, line 128
-def discover_default_branch
-  if branch_names.length == 0
-    nil
-  elsif branch_names.length == 1
-    branch_names.first
-  else
-    branch_names.select { |v| v == root_ref }.first
-  end
-end
-
- -
- - - - -
- - -
- -
- empty_repo?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 11
-def empty_repo?
-  !repo_exists? || !has_commits?
-end
-
- -
- - - - -
- - -
- -
- fresh_commits(n = 10) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 19
-def fresh_commits(n = 10)
-  Commit.fresh_commits(repo, n)
-end
-
- -
- - - - -
- - -
- -
- has_commits?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 138
-def has_commits?
-  !!commit
-rescue Grit::NoSuchPathError
-  false
-end
-
- -
- - - - -
- - -
- -
- has_post_receive_file?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 47
-def has_post_receive_file?
-  hook_file = File.join(path_to_repo, 'hooks', 'post-receive')
-  File.exists?(hook_file)
-end
-
- -
- - - - -
- - -
- -
- heads() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 103
-def heads
-  @heads ||= repo.heads
-end
-
- -
- - - - -
- - -
- -
- http_url_to_repo() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 183
-def http_url_to_repo
-  http_url = [Gitlab.config.url, "/", path, ".git"].join('')
-end
-
- -
- - - - -
- - -
- -
- last_commit_for(ref, path = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 35
-def last_commit_for(ref, path = nil)
-  commits(ref, path, 1).first
-end
-
- -
- - - - -
- - -
- -
- open_branches() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 113
-def open_branches
-  if protected_branches.empty?
-    self.repo.heads
-  else
-    pnames = protected_branches.map(&:name)
-    self.repo.heads.reject { |h| pnames.include?(h.name) }
-  end.sort_by(&:name)
-end
-
- -
- - - - -
- - -
- -
- path_to_repo() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 85
-def path_to_repo
-  File.join(Gitlab.config.git_base_path, "#{path}.git")
-end
-
- -
- - - - -
- - -
- -
- protected_branch?(branch_name) - click to toggle source -
- - -
- -

Check if current branch name is marked as protected in the system

- - - -
-
# File app/roles/repository.rb, line 188
-def protected_branch? branch_name
-  protected_branches.map(&:name).include?(branch_name)
-end
-
- -
- - - - -
- - -
- -
- ref_names() - click to toggle source -
- - -
- -

Returns an Array of branch and tag names

- - - -
-
# File app/roles/repository.rb, line 73
-def ref_names
-  [branch_names + tag_names].flatten
-end
-
- -
- - - - -
- - -
- -
- repo() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 77
-def repo
-  @repo ||= Grit::Repo.new(path_to_repo)
-end
-
- -
- - - - -
- - -
- -
- repo_exists?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 97
-def repo_exists?
-  @repo_exists ||= (repo && !repo.branches.empty?)
-rescue
-  @repo_exists = false
-end
-
- -
- - - - -
- - -
- -
- root_ref() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 144
-def root_ref
-  default_branch || "master"
-end
-
- -
- - - - -
- - -
- -
- root_ref?(branch) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 148
-def root_ref?(branch)
-  root_ref == branch
-end
-
- -
- - - - -
- - -
- -
- satellite() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 43
-def satellite
-  @satellite ||= Gitlab::Satellite.new(self)
-end
-
- -
- - - - -
- - -
- -
- ssh_url_to_repo() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 179
-def ssh_url_to_repo
-  url_to_repo
-end
-
- -
- - - - -
- - -
- -
- tag_names() - click to toggle source -
- - -
- -

Returns an Array of tag names

- - - -
-
# File app/roles/repository.rb, line 63
-def tag_names
-  repo.tags.collect(&:name).sort.reverse
-end
-
- -
- - - - -
- - -
- -
- tags() - click to toggle source -
- - -
- -

Returns an Array of Tags

- - - -
-
# File app/roles/repository.rb, line 68
-def tags
-  repo.tags.sort_by(&:name).reverse
-end
-
- -
- - - - -
- - -
- -
- tree(fcommit, path = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 107
-def tree(fcommit, path = nil)
-  fcommit = commit if fcommit == :head
-  tree = fcommit.tree
-  path ? (tree / path) : tree
-end
-
- -
- - - - -
- - -
- -
- update_repository() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 89
-def update_repository
-  git_host.update_repository(self)
-end
-
- -
- - - - -
- - -
- -
- url_to_repo() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 81
-def url_to_repo
-  git_host.url_to_repo(path)
-end
-
- -
- - - - -
- - -
- -
- valid_repo?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/repository.rb, line 4
-def valid_repo?
-  repo
-rescue
-  errors.add(:path, "Invalid repository path")
-  false
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SearchContext.html b/doc/app/SearchContext.html deleted file mode 100644 index 6a3d2bd5047..00000000000 --- a/doc/app/SearchContext.html +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - -class SearchContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class SearchContext

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- params[RW] -
- -
- - - -
-
- -
-
- project_ids[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(project_ids, params) - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/search_context.rb, line 4
-def initialize(project_ids, params)
-  @project_ids, @params = project_ids, params.dup
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/search_context.rb, line 8
-def execute
-  query = params[:search]
-
-  return result unless query.present?
-
-  result[:projects] = Project.where(id: project_ids).search(query).limit(10)
-  result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
-  result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
-  result
-end
-
- -
- - - - -
- - -
- -
- result() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/search_context.rb, line 19
-def result
-  @result ||= {
-    projects: [],
-    merge_requests: [],
-    issues: []
-  }
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SearchController.html b/doc/app/SearchController.html deleted file mode 100644 index 0c14ea8f557..00000000000 --- a/doc/app/SearchController.html +++ /dev/null @@ -1,489 +0,0 @@ - - - - - - -class SearchController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class SearchController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/search_controller.rb, line 2
-def show
-  result = SearchContext.new(current_user.project_ids, params).execute
-
-  @projects       = result[:projects]
-  @merge_requests = result[:merge_requests]
-  @issues         = result[:issues]
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Snippet.html b/doc/app/Snippet.html deleted file mode 100644 index a24e4494f44..00000000000 --- a/doc/app/Snippet.html +++ /dev/null @@ -1,667 +0,0 @@ - - - - - - -class Snippet - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Snippet

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- content_types() - click to toggle source -
- - -
- - - - - -
-
# File app/models/snippet.rb, line 23
-def self.content_types
-  [
-    ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
-    ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb",
-    ".js", ".sh", ".coffee", ".yml", ".md"
-  ]
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- data() - click to toggle source -
- - -
- - - - - -
-
# File app/models/snippet.rb, line 31
-def data
-  content
-end
-
- -
- - - - -
- - -
- -
- expired?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/snippet.rb, line 47
-def expired?
-  expires_at && expires_at < Time.current
-end
-
- -
- - - - -
- - -
- -
- mode() - click to toggle source -
- - -
- - - - - -
-
# File app/models/snippet.rb, line 43
-def mode
-  nil
-end
-
- -
- - - - -
- - -
- -
- name() - click to toggle source -
- - -
- - - - - -
-
# File app/models/snippet.rb, line 39
-def name
-  file_name
-end
-
- -
- - - - -
- - -
- -
- size() - click to toggle source -
- - -
- - - - - -
-
# File app/models/snippet.rb, line 35
-def size
-  0
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SnippetsController.html b/doc/app/SnippetsController.html deleted file mode 100644 index 7585a295f72..00000000000 --- a/doc/app/SnippetsController.html +++ /dev/null @@ -1,833 +0,0 @@ - - - - - - -class SnippetsController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class SnippetsController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 26
-def create
-  @snippet = @project.snippets.new(params[:snippet])
-  @snippet.author = current_user
-  @snippet.save
-
-  if @snippet.valid?
-    redirect_to [@project, @snippet]
-  else
-    respond_with(@snippet)
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 55
-def destroy
-  return access_denied! unless can?(current_user, :admin_snippet, @snippet)
-
-  @snippet.destroy
-
-  redirect_to project_snippets_path(@project)
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 38
-def edit
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 18
-def index
-  @snippets = @project.snippets
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 22
-def new
-  @snippet = @project.snippets.new
-end
-
- -
- - - - -
- - -
- -
- raw() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 63
-def raw 
-  send_data(
-    @snippet.content,
-    type: "text/plain",
-    disposition: 'inline',
-    filename: @snippet.file_name
-  )
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 51
-def show
-  @note = @project.notes.new(noteable: @snippet)
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 41
-def update
-  @snippet.update_attributes(params[:snippet])
-
-  if @snippet.valid?
-    redirect_to [@project, @snippet]
-  else
-    respond_with(@snippet)
-  end
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- authorize_admin_snippet!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 82
-def authorize_admin_snippet!
-  return render_404 unless can?(current_user, :admin_snippet, @snippet)
-end
-
- -
- - - - -
- - -
- -
- authorize_modify_snippet!() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 78
-def authorize_modify_snippet!
-  return render_404 unless can?(current_user, :modify_snippet, @snippet)
-end
-
- -
- - - - -
- - -
- -
- snippet() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/snippets_controller.rb, line 74
-def snippet
-  @snippet ||= @project.snippets.find(params[:id])
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SnippetsHelper.html b/doc/app/SnippetsHelper.html deleted file mode 100644 index 99c08d51189..00000000000 --- a/doc/app/SnippetsHelper.html +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - -module SnippetsHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module SnippetsHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- lifetime_select_options() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/snippets_helper.rb, line 2
-def lifetime_select_options
-  options = [
-      ['forever', nil],
-      ['1 day',   "#{Date.current + 1.day}"],
-      ['1 week',  "#{Date.current + 1.week}"],
-      ['1 month', "#{Date.current + 1.month}"]
-  ]
-  options_for_select(options)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/StaticModel.html b/doc/app/StaticModel.html deleted file mode 100644 index 9dd1617c6b5..00000000000 --- a/doc/app/StaticModel.html +++ /dev/null @@ -1,648 +0,0 @@ - - - - - - -module StaticModel - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module StaticModel

- -
- -

Provides an ActiveRecord-like interface to a model whose data is not -persisted to a database.

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- ==(other) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/static_model.rb, line 40
-def ==(other)
-  if other.is_a? StaticModel
-    id == other.id
-  else
-    super
-  end
-end
-
- -
- - - - -
- - -
- -
- [](key) - click to toggle source -
- - -
- -

Used by AR for fetching attributes

- -

Pass it along if we respond to it.

- - - -
-
# File app/roles/static_model.rb, line 20
-def [](key)
-  send(key) if respond_to?(key)
-end
-
- -
- - - - -
- - -
- -
- destroyed?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/static_model.rb, line 36
-def destroyed?
-  false
-end
-
- -
- - - - -
- - -
- -
- new_record?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/static_model.rb, line 28
-def new_record?
-  false
-end
-
- -
- - - - -
- - -
- -
- persisted?() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/static_model.rb, line 32
-def persisted?
-  false
-end
-
- -
- - - - -
- - -
- -
- to_param() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/static_model.rb, line 24
-def to_param
-  id
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/StaticModel/ClassMethods.html b/doc/app/StaticModel/ClassMethods.html deleted file mode 100644 index 27ee1373838..00000000000 --- a/doc/app/StaticModel/ClassMethods.html +++ /dev/null @@ -1,511 +0,0 @@ - - - - - - -module StaticModel::ClassMethods - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module StaticModel::ClassMethods

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- base_class() - click to toggle source -
- - -
- -

Used by ActiveRecord’s polymorphic association to set object_type

- - - -
-
# File app/roles/static_model.rb, line 12
-def base_class
-  self
-end
-
- -
- - - - -
- - -
- -
- primary_key() - click to toggle source -
- - -
- -

Used by ActiveRecord’s polymorphic association to set object_id

- - - -
-
# File app/roles/static_model.rb, line 7
-def primary_key
-  'id'
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SystemHook.html b/doc/app/SystemHook.html deleted file mode 100644 index 8e35bf27294..00000000000 --- a/doc/app/SystemHook.html +++ /dev/null @@ -1,525 +0,0 @@ - - - - - - -class SystemHook - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class SystemHook

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- all_hooks_fire(data) - click to toggle source -
- - -
- - - - - -
-
# File app/models/system_hook.rb, line 2
-def self.all_hooks_fire(data)
-  SystemHook.all.each do |sh|
-    sh.async_execute data
-  end
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- async_execute(data) - click to toggle source -
- - -
- - - - - -
-
# File app/models/system_hook.rb, line 8
-def async_execute(data)
-  Resque.enqueue(SystemHookWorker, id, data)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SystemHookObserver.html b/doc/app/SystemHookObserver.html deleted file mode 100644 index 20d819637d1..00000000000 --- a/doc/app/SystemHookObserver.html +++ /dev/null @@ -1,573 +0,0 @@ - - - - - - -class SystemHookObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class SystemHookObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(model) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/system_hook_observer.rb, line 4
-def after_create(model)
-  if model.kind_of? Project
-    SystemHook.all_hooks_fire({
-      event_name: "project_create",
-      name: model.name,
-      path: model.path,
-      project_id: model.id,
-      owner_name: model.owner.name,
-      owner_email: model.owner.email,
-      created_at: model.created_at
-    })
-  elsif model.kind_of? User 
-    SystemHook.all_hooks_fire({
-      event_name: "user_create",
-      name: model.name,
-      email: model.email,
-      created_at: model.created_at
-    })
-
-  elsif model.kind_of? UsersProject
-    SystemHook.all_hooks_fire({
-      event_name: "user_add_to_team",
-      project_name: model.project.name,
-      project_path: model.project.path,
-      project_id: model.project_id,
-      user_name: model.user.name,
-      user_email: model.user.email,
-      project_access: model.repo_access_human,
-      created_at: model.created_at
-    })
-
-  end
-end
-
- -
- - - - -
- - -
- -
- after_destroy(model) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/system_hook_observer.rb, line 38
-def after_destroy(model)
-  if model.kind_of? Project
-    SystemHook.all_hooks_fire({
-      event_name: "project_destroy",
-      name: model.name,
-      path: model.path,
-      project_id: model.id,
-      owner_name: model.owner.name,
-      owner_email: model.owner.email,
-    })
-  elsif model.kind_of? User
-    SystemHook.all_hooks_fire({
-      event_name: "user_destroy",
-      name: model.name,
-      email: model.email
-    })
-
-  elsif model.kind_of? UsersProject
-    SystemHook.all_hooks_fire({
-      event_name: "user_remove_from_team",
-      project_name: model.project.name,
-      project_path: model.project.path,
-      project_id: model.project_id,
-      user_name: model.user.name,
-      user_email: model.user.email,
-      project_access: model.repo_access_human
-    })
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/SystemHookWorker.html b/doc/app/SystemHookWorker.html deleted file mode 100644 index 153eb5776fe..00000000000 --- a/doc/app/SystemHookWorker.html +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - -class SystemHookWorker - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class SystemHookWorker

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Class Methods

- - -
- -
- perform(hook_id, data) - click to toggle source -
- - -
- - - - - -
-
# File app/workers/system_hook_worker.rb, line 4
-def self.perform(hook_id, data)
-  SystemHook.find(hook_id).execute data
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TabHelper.html b/doc/app/TabHelper.html deleted file mode 100644 index 43cc08a4f53..00000000000 --- a/doc/app/TabHelper.html +++ /dev/null @@ -1,621 +0,0 @@ - - - - - - -module TabHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module TabHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- branches_tab_class() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tab_helper.rb, line 80
-def branches_tab_class
-  if current_page?(branches_project_repository_path(@project)) ||
-    current_controller?(:protected_branches) ||
-    current_page?(project_repository_path(@project))
-    'active'
-  end
-end
-
- -
- - - - -
- - - - - -
- -
- project_tab_class() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tab_helper.rb, line 70
-def project_tab_class
-  [:show, :files, :edit, :update].each do |action|
-    return "active" if current_page?(controller: "projects", action: action, id: @project)
-  end
-
-  if ['snippets', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
-   "active"
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TagsHelper.html b/doc/app/TagsHelper.html deleted file mode 100644 index 3a98d61f38d..00000000000 --- a/doc/app/TagsHelper.html +++ /dev/null @@ -1,516 +0,0 @@ - - - - - - -module TagsHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module TagsHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- tag_list(project) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tags_helper.rb, line 6
-def tag_list project
-  html = ''
-  project.tag_list.each do |tag|
-    html += link_to tag, tag_path(tag)
-  end
-
-  html.html_safe
-end
-
- -
- - - - -
- - -
- -
- tag_path(tag) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tags_helper.rb, line 2
-def tag_path tag
-  "/tags/#{tag}"
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Team.html b/doc/app/Team.html deleted file mode 100644 index 3a583694799..00000000000 --- a/doc/app/Team.html +++ /dev/null @@ -1,710 +0,0 @@ - - - - - - -module Team - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Team

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- add_user_id_to_team(user_id, access_role) - click to toggle source -
- - -
- -

Add user to project with passed access role by user id

- - - -
-
# File app/roles/team.rb, line 26
-def add_user_id_to_team(user_id, access_role)
-  users_projects.create(
-    user_id: user_id,
-    project_access: access_role
-  )
-end
-
- -
- - - - -
- - -
- -
- add_user_to_team(user, access_role) - click to toggle source -
- - -
- -

Add user to project with passed access role

- - - -
-
# File app/roles/team.rb, line 14
-def add_user_to_team(user, access_role)
-  add_user_id_to_team(user.id, access_role)
-end
-
- -
- - - - -
- - -
- -
- add_users_ids_to_team(users_ids, access_role) - click to toggle source -
- - -
- -

Add multiple users to project with same access role by user ids

- - - -
-
# File app/roles/team.rb, line 35
-def add_users_ids_to_team(users_ids, access_role)
-  UsersProject.bulk_import(self, users_ids, access_role)
-  self.update_repository
-end
-
- -
- - - - -
- - -
- -
- add_users_to_team(users, access_role) - click to toggle source -
- - -
- -

Add multiple users to project with same access role

- - - -
-
# File app/roles/team.rb, line 20
-def add_users_to_team(users, access_role)
-  add_users_ids_to_team(users.map(&:id), access_role)
-end
-
- -
- - - - -
- - -
- -
- delete_users_ids_from_team(users_ids) - click to toggle source -
- - -
- -

Delete multiple users from project by user ids

- - - -
-
# File app/roles/team.rb, line 48
-def delete_users_ids_from_team(users_ids)
-  UsersProject.bulk_delete(self, users_ids)
-  self.update_repository
-end
-
- -
- - - - -
- - -
- -
- team_member_by_id(user_id) - click to toggle source -
- - -
- -

Get Team Member record by user id

- - - -
-
# File app/roles/team.rb, line 8
-def team_member_by_id(user_id)
-  users_projects.find_by_user_id(user_id)
-end
-
- -
- - - - -
- - -
- -
- team_member_by_name_or_email(name = nil, email = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/roles/team.rb, line 2
-def team_member_by_name_or_email(name = nil, email = nil)
-  user = users.where("name like ? or email like ?", name, email).first
-  users_projects.where(user: user) if user
-end
-
- -
- - - - -
- - -
- -
- update_users_ids_to_role(users_ids, access_role) - click to toggle source -
- - -
- -

Update multiple project users to same access role by user ids

- - - -
-
# File app/roles/team.rb, line 42
-def update_users_ids_to_role(users_ids, access_role)
-  UsersProject.bulk_update(self, users_ids, access_role)
-  self.update_repository
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TeamMembersController.html b/doc/app/TeamMembersController.html deleted file mode 100644 index 46af7c9fd57..00000000000 --- a/doc/app/TeamMembersController.html +++ /dev/null @@ -1,698 +0,0 @@ - - - - - - -class TeamMembersController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class TeamMembersController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- apply_import() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 47
-def apply_import
-  giver = Project.find(params[:source_project_id])
-  status = UsersProject.import_team(giver, project)
-  notice = status ? "Succesfully imported" : "Import failed"
-
-  redirect_to project_team_members_path(project), notice: notice
-end
-
- -
- - - - -
- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 18
-def create
-  @project.add_users_ids_to_team(
-    params[:user_ids],
-    params[:project_access]
-  )
-
-  redirect_to project_team_index_path(@project)
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 37
-def destroy
-  @team_member = project.users_projects.find(params[:id])
-  @team_member.destroy
-
-  respond_to do |format|
-    format.html { redirect_to project_team_index_path(@project) }
-    format.js { render nothing: true }
-  end
-end
-
- -
- - - - -
- - -
- -
- index() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 6
-def index
-end
-
- -
- - - - -
- - -
- -
- new() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 14
-def new
-  @team_member = project.users_projects.new
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 9
-def show
-  @team_member = project.users_projects.find(params[:id])
-  @events = @team_member.user.recent_events.where(:project_id => @project.id).limit(7)
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/team_members_controller.rb, line 27
-def update
-  @team_member = project.users_projects.find(params[:id])
-  @team_member.update_attributes(params[:team_member])
-
-  unless @team_member.valid?
-    flash[:alert] = "User should have at least one role"
-  end
-  redirect_to project_team_index_path(@project)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TestHookContext.html b/doc/app/TestHookContext.html deleted file mode 100644 index e18701cb035..00000000000 --- a/doc/app/TestHookContext.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - -class TestHookContext - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class TestHookContext

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute() - click to toggle source -
- - -
- - - - - -
-
# File app/contexts/test_hook_context.rb, line 2
-def execute
-  hook = project.hooks.find(params[:id])
-  commits = project.commits(project.default_branch, nil, 3)
-  data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user)
-  hook.execute(data)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Tree.html b/doc/app/Tree.html deleted file mode 100644 index f1f414a4f36..00000000000 --- a/doc/app/Tree.html +++ /dev/null @@ -1,663 +0,0 @@ - - - - - - -class Tree - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Tree

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- path[RW] -
- -
- - - -
-
- -
-
- project[RW] -
- -
- - - -
-
- -
-
- ref[RW] -
- -
- - - -
-
- -
-
- tree[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- new(raw_tree, project, ref = nil, path = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/models/tree.rb, line 8
-def initialize(raw_tree, project, ref = nil, path = nil)
-  @project, @ref, @path = project, ref, path
-  @tree = if path.present?
-            raw_tree / path.dup.force_encoding('ascii-8bit')
-          else
-            raw_tree
-          end
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- empty?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/tree.rb, line 25
-def empty?
-  data.blank?
-end
-
- -
- - - - -
- - -
- -
- invalid?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/tree.rb, line 21
-def invalid?
-  tree.nil?
-end
-
- -
- - - - -
- - -
- -
- is_blob?() - click to toggle source -
- - -
- - - - - -
-
# File app/models/tree.rb, line 17
-def is_blob?
-  tree.is_a?(Grit::Blob)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TreeController.html b/doc/app/TreeController.html deleted file mode 100644 index 1adba0ec4b2..00000000000 --- a/doc/app/TreeController.html +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - -class TreeController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class TreeController

- -
- -

Controller for viewing a repository’s file structure

- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/tree_controller.rb, line 24
-def edit
-  @last_commit = @project.last_commit_for(@ref, @path).sha
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/tree_controller.rb, line 13
-def show
-  @hex_path  = Digest::SHA1.hexdigest(@path)
-  @logs_path = logs_file_project_ref_path(@project, @ref, @path)
-
-  respond_to do |format|
-    format.html
-    # Disable cache so browser history works
-    format.js { no_cache_headers }
-  end
-end
-
- -
- - - - -
- - -
- -
- update() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/tree_controller.rb, line 28
-def update
-  file_editor = Gitlab::FileEditor.new(current_user, @project, @ref)
-  update_status = file_editor.update(
-    @path,
-    params[:content],
-    params[:commit_message],
-    params[:last_commit]
-  )
-
-  if update_status
-    redirect_to project_tree_path(@project, @id), notice: "Your changes have been successfully commited"
-  else
-    flash[:notice] = "Your changes could not be commited, because the file has been changed"
-    render :edit
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TreeDecorator.html b/doc/app/TreeDecorator.html deleted file mode 100644 index e6bdc0fa826..00000000000 --- a/doc/app/TreeDecorator.html +++ /dev/null @@ -1,597 +0,0 @@ - - - - - - -class TreeDecorator - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class TreeDecorator

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- breadcrumbs(max_links = 2) { |link_to("..", "| ... } - click to toggle source -
- - -
- - - - - - - -
- - - - -
- - -
- -
- readme() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/tree_decorator.rb, line 32
-def readme
-  @readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ %r^readme/ }
-end
-
- -
- - - - -
- - -
- -
- up_dir?() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/tree_decorator.rb, line 23
-def up_dir?
-  path.present?
-end
-
- -
- - - - -
- - -
- -
- up_dir_path() - click to toggle source -
- - -
- - - - - -
-
# File app/decorators/tree_decorator.rb, line 27
-def up_dir_path
-  file = File.join(path, "..")
-  h.project_tree_path(project, h.tree_join(ref, file))
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/TreeHelper.html b/doc/app/TreeHelper.html deleted file mode 100644 index e185ba728ae..00000000000 --- a/doc/app/TreeHelper.html +++ /dev/null @@ -1,736 +0,0 @@ - - - - - - -module TreeHelper - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module TreeHelper

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- allowed_tree_edit?() - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tree_helper.rb, line 63
-def allowed_tree_edit?
-  if @project.protected_branch? @ref
-    can?(current_user, :push_code_to_protected_branches, @project)
-  else
-    can?(current_user, :push_code, @project)
-  end
-end
-
- -
- - - - -
- - -
- -
- gitlab_markdown?(filename) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tree_helper.rb, line 50
-def gitlab_markdown?(filename)
-  filename.end_with?(*%w(.mdown .md .markdown))
-end
-
- -
- - - - -
- - -
- -
- markup?(filename) - click to toggle source -
- - -
- -

Public: Determines if a given filename is compatible with GitHub::Markup.

- -

filename - Filename string to check

- -

Returns boolean

- - - -
-
# File app/helpers/tree_helper.rb, line 45
-def markup?(filename)
-  filename.end_with?(*%w(.textile .rdoc .org .creole
-                         .mediawiki .rst .asciidoc .pod))
-end
-
- -
- - - - -
- - -
- -
- plain_text_readme?(filename) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tree_helper.rb, line 54
-def plain_text_readme? filename
-  filename == 'README'
-end
-
- -
- - - - -
- - -
- -
- render_tree(contents) - click to toggle source -
- - -
- -

Sorts a repository’s tree so that folders are before files and renders -their corresponding partials

- -

contents - A Grit::Tree object for the current tree

- - - -
-
# File app/helpers/tree_helper.rb, line 6
-def render_tree(contents)
-  # Render Folders before Files/Submodules
-  folders, files = contents.partition { |v| v.kind_of?(Grit::Tree) }
-
-  tree = ""
-
-  # Render folders if we have any
-  tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
-
-  files.each do |f|
-    if f.respond_to?(:url)
-      # Object is a Submodule
-      tree += render partial: 'tree/submodule_item', object: f
-    else
-      # Object is a Blob
-      tree += render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
-    end
-  end
-
-  tree.html_safe
-end
-
- -
- - - - -
- - -
- -
- tree_hex_class(content) - click to toggle source -
- - -
- - - - - -
-
# File app/helpers/tree_helper.rb, line 36
-def tree_hex_class(content)
-  "file_#{hexdigest(content.name)}"
-end
-
- -
- - - - -
- - -
- -
- tree_icon(type) - click to toggle source -
- - -
- -

Return an image icon depending on the file type

- -

type - String type of the tree item; either ‘folder’ or ‘file’

- - - -
-
# File app/helpers/tree_helper.rb, line 31
-def tree_icon(type)
-  image = type == 'folder' ? 'file_dir.png' : 'file_txt.png'
-  image_tag(image, size: '16x16')
-end
-
- -
- - - - -
- - -
- -
- tree_join(*args) - click to toggle source -
- - -
- -

Simple shortcut to File.join

- - - -
-
# File app/helpers/tree_helper.rb, line 59
-def tree_join(*args)
-  File.join(*args)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/User.html b/doc/app/User.html deleted file mode 100644 index 513f96444b5..00000000000 --- a/doc/app/User.html +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - -class User - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class User

- -
- -
- - - - -
- - - - - - - - -
-

Attributes

- - -
-
- force_random_password[RW] -
- -
- - - -
-
- -
- - - - -
-

Public Class Methods

- - -
- -
- create_from_omniauth(auth, ldap = false) - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 55
-def create_from_omniauth(auth, ldap = false)
-  gitlab_auth.create_from_omniauth(auth, ldap)
-end
-
- -
- - - - -
- - -
- -
- filter(filter_name) - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 41
-def filter filter_name
-  case filter_name
-  when "admins"; self.admins
-  when "blocked"; self.blocked
-  when "wop"; self.without_projects
-  else
-    self.active
-  end
-end
-
- -
- - - - -
- - -
- -
- find_for_ldap_auth(auth, signed_in_resource = nil) - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 63
-def find_for_ldap_auth(auth, signed_in_resource = nil)
-  gitlab_auth.find_for_ldap_auth(auth, signed_in_resource)
-end
-
- -
- - - - -
- - -
- -
- find_or_new_for_omniauth(auth) - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 59
-def find_or_new_for_omniauth(auth)
-  gitlab_auth.find_or_new_for_omniauth(auth)
-end
-
- -
- - - - -
- - -
- -
- gitlab_auth() - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 67
-def gitlab_auth
-  Gitlab::Auth.new
-end
-
- -
- - - - -
- - - - - -
- -
- without_projects() - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 51
-def without_projects
-  where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)')
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- generate_password() - click to toggle source -
- - -
- - - - - -
-
# File app/models/user.rb, line 76
-def generate_password
-  if self.force_random_password
-    self.password = self.password_confirmation = Devise.friendly_token.first(8)
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/UserObserver.html b/doc/app/UserObserver.html deleted file mode 100644 index 95c7249d508..00000000000 --- a/doc/app/UserObserver.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - - -class UserObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class UserObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_create(user) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/user_observer.rb, line 2
-def after_create(user)
-  log_info("User \"#{user.name}\" (#{user.email}) was created")
-
-  Notify.new_user_email(user.id, user.password).deliver
-end
-
- -
- - - - -
- - -
- -
- after_destroy(user) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/user_observer.rb, line 8
-def after_destroy user
-  log_info("User \"#{user.name}\" (#{user.email})  was removed")
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- log_info(message) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/user_observer.rb, line 14
-def log_info message
-  Gitlab::AppLogger.info message
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/UsersProject.html b/doc/app/UsersProject.html deleted file mode 100644 index f157832b492..00000000000 --- a/doc/app/UsersProject.html +++ /dev/null @@ -1,904 +0,0 @@ - - - - - - -class UsersProject - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class UsersProject

- -
- -
- - - - -
- - - - - - -
-

Constants

-
- -
DEVELOPER - -
- - -
GUEST - -
- - -
MASTER - -
- - -
REPORTER - -
- - -
-
- - - - - - -
-

Public Class Methods

- - -
- -
- access_roles() - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 96
-def access_roles
-  {
-    "Guest"     => GUEST,
-    "Reporter"  => REPORTER,
-    "Developer" => DEVELOPER,
-    "Master"    => MASTER
-  }
-end
-
- -
- - - - -
- - -
- -
- bulk_delete(project, user_ids) - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 53
-def bulk_delete(project, user_ids)
-  UsersProject.transaction do
-    UsersProject.where(:user_id => user_ids, :project_id => project.id).each do |users_project|
-      users_project.destroy
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- bulk_import(project, user_ids, project_access) - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 70
-def bulk_import(project, user_ids, project_access)
-  UsersProject.transaction do
-    user_ids.each do |user_id|
-      users_project = UsersProject.new(
-        project_access: project_access,
-        user_id: user_id
-      )
-      users_project.project = project
-      users_project.save
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- bulk_update(project, user_ids, project_access) - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 61
-def bulk_update(project, user_ids, project_access)
-  UsersProject.transaction do
-    UsersProject.where(:user_id => user_ids, :project_id => project.id).each do |users_project|
-      users_project.project_access = project_access
-      users_project.save
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- import_team(source_project, target_project) - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 24
-def import_team(source_project, target_project)
-  UsersProject.without_repository_callback do
-    UsersProject.transaction do
-      team = source_project.users_projects.all
-
-      team.each do |tm|
-        # Skip if user already present in team
-        next if target_project.users.include?(tm.user)
-
-        new_tm = tm.dup
-        new_tm.id = nil
-        new_tm.project_id = target_project.id
-        new_tm.save
-      end
-    end
-  end
-
-  target_project.update_repository
-  true
-rescue
-  false
-end
-
- -
- - - - -
- - -
- -
- user_bulk_import(user, project_ids, project_access) - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 83
-def user_bulk_import(user, project_ids, project_access)
-  UsersProject.transaction do
-    project_ids.each do |project_id|
-      users_project = UsersProject.new(
-        project_access: project_access,
-      )
-      users_project.project_id = project_id
-      users_project.user_id = user.id
-      users_project.save
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- without_repository_callback() { || ... } - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 47
-def without_repository_callback
-  UsersProject.skip_callback(:destroy, :after, :update_repository)
-  yield
-  UsersProject.set_callback(:destroy, :after, :update_repository)
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- project_access_human() - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 114
-def project_access_human
-  Project.access_options.key(self.project_access)
-end
-
- -
- - - - -
- - -
- -
- repo_access_human() - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 118
-def repo_access_human
-  self.class.access_roles.invert[self.project_access]
-end
-
- -
- - - - -
- - -
- -
- role_access() - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 106
-def role_access
-  project_access
-end
-
- -
- - - - -
- - -
- -
- update_repository() - click to toggle source -
- - -
- - - - - -
-
# File app/models/users_project.rb, line 110
-def update_repository
-  git_host.update_repository(project)
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/UsersProjectObserver.html b/doc/app/UsersProjectObserver.html deleted file mode 100644 index 7c7b90a09ca..00000000000 --- a/doc/app/UsersProjectObserver.html +++ /dev/null @@ -1,558 +0,0 @@ - - - - - - -class UsersProjectObserver - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class UsersProjectObserver

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- after_commit(users_project) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/users_project_observer.rb, line 2
-def after_commit(users_project)
-  return if users_project.destroyed?
-  Notify.project_access_granted_email(users_project.id).deliver
-end
-
- -
- - - - -
- - -
- -
- after_create(users_project) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/users_project_observer.rb, line 7
-def after_create(users_project)
-  Event.create(
-    project_id: users_project.project.id,
-    action: Event::Joined,
-    author_id: users_project.user.id
-  )
-end
-
- -
- - - - -
- - -
- -
- after_destroy(users_project) - click to toggle source -
- - -
- - - - - -
-
# File app/observers/users_project_observer.rb, line 15
-def after_destroy(users_project)
-  Event.create(
-    project_id: users_project.project.id,
-    action: Event::Left,
-    author_id: users_project.user.id
-  )
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Votes.html b/doc/app/Votes.html deleted file mode 100644 index 9fa2a0b7f17..00000000000 --- a/doc/app/Votes.html +++ /dev/null @@ -1,615 +0,0 @@ - - - - - - -module Votes - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

module Votes

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- downvotes() - click to toggle source -
- - -
- -

Return the number of -1 comments (downvotes)

- - - -
-
# File app/roles/votes.rb, line 16
-def downvotes
-  notes.select(&:downvote?).size
-end
-
- -
- - - - -
- - -
- -
- downvotes_in_percent() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/votes.rb, line 20
-def downvotes_in_percent
-  if votes_count.zero?
-    0
-  else
-    100.0 - upvotes_in_percent
-  end
-end
-
- -
- - - - -
- - -
- -
- upvotes() - click to toggle source -
- - -
- -

Return the number of +1 comments (upvotes)

- - - -
-
# File app/roles/votes.rb, line 3
-def upvotes
-  notes.select(&:upvote?).size
-end
-
- -
- - - - -
- - -
- -
- upvotes_in_percent() - click to toggle source -
- - -
- - - - - -
-
# File app/roles/votes.rb, line 7
-def upvotes_in_percent
-  if votes_count.zero?
-    0
-  else
-    100.0 / votes_count * upvotes
-  end
-end
-
- -
- - - - -
- - -
- -
- votes_count() - click to toggle source -
- - -
- -

Return the total number of votes

- - - -
-
# File app/roles/votes.rb, line 29
-def votes_count
-  upvotes + downvotes
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/WebHook.html b/doc/app/WebHook.html deleted file mode 100644 index 44a89adb8ad..00000000000 --- a/doc/app/WebHook.html +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - -class WebHook - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class WebHook

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- execute(data) - click to toggle source -
- - -
- - - - - -
-
# File app/models/web_hook.rb, line 12
-def execute(data)
-  parsed_url = URI.parse(url)
-  if parsed_url.userinfo.blank?
-    WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" })
-  else
-    post_url = url.gsub("#{parsed_url.userinfo}@", "")
-    WebHook.post(post_url,
-                 body: data.to_json,
-                 headers: {"Content-Type" => "application/json"},
-                 basic_auth: {username: parsed_url.user, password: parsed_url.password})
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/Wiki.html b/doc/app/Wiki.html deleted file mode 100644 index c2bf5b615b7..00000000000 --- a/doc/app/Wiki.html +++ /dev/null @@ -1,567 +0,0 @@ - - - - - - -class Wiki - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class Wiki

- -
- -
- - - - -
- - - - - - - - - - -
-

Protected Class Methods

- - -
- -
- regenerate_from(wiki) - click to toggle source -
- - -
- - - - - -
-
# File app/models/wiki.rb, line 20
-def self.regenerate_from wiki
-  regenerated_field = [:slug, :content, :title]
-
-  new_wiki = Wiki.new
-  regenerated_field.each do |field|
-    new_wiki.send("#{field}=", wiki.send(field))
-  end
-  new_wiki
-end
-
- -
- - - - -
- - -
- -
-

Public Instance Methods

- - -
- -
- to_param() - click to toggle source -
- - -
- - - - - -
-
# File app/models/wiki.rb, line 14
-def to_param
-  slug
-end
-
- -
- - - - -
- - -
- -
-

Protected Instance Methods

- - -
- -
- set_slug() - click to toggle source -
- - -
- - - - - -
-
# File app/models/wiki.rb, line 30
-def set_slug
-  self.slug = self.title.parameterize
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/WikisController.html b/doc/app/WikisController.html deleted file mode 100644 index 4a4e930cd5b..00000000000 --- a/doc/app/WikisController.html +++ /dev/null @@ -1,676 +0,0 @@ - - - - - - -class WikisController - Rails Application Documentation - - - - - - - - - - - - - - - - -
-

class WikisController

- -
- -
- - - - -
- - - - - - - - - - -
-

Public Instance Methods

- - -
- -
- create() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/wikis_controller.rb, line 36
-def create
-  @wiki = @project.wikis.new(params[:wiki])
-  @wiki.user = current_user
-
-  respond_to do |format|
-    if @wiki.save
-      format.html { redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' }
-    else
-      format.html { render action: "edit" }
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- destroy() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/wikis_controller.rb, line 53
-def destroy
-  @wikis = @project.wikis.where(slug: params[:id]).delete_all
-
-  respond_to do |format|
-    format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" }
-  end
-end
-
- -
- - - - -
- - -
- -
- edit() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/wikis_controller.rb, line 31
-def edit
-  @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
-  @wiki = Wiki.regenerate_from @wiki
-end
-
- -
- - - - -
- - -
- -
- history() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/wikis_controller.rb, line 49
-def history
-  @wikis = @project.wikis.where(slug: params[:id]).order("created_at")
-end
-
- -
- - - - -
- - -
- -
- pages() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/wikis_controller.rb, line 6
-def pages
-  @wikis = @project.wikis.group(:slug).order("created_at")
-end
-
- -
- - - - -
- - -
- -
- show() - click to toggle source -
- - -
- - - - - -
-
# File app/controllers/wikis_controller.rb, line 10
-def show
-  if params[:old_page_id]
-    @wiki = @project.wikis.find(params[:old_page_id])
-  else
-    @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
-  end
-
-  @note = @project.notes.new(noteable: @wiki)
-
-  if @wiki
-    render 'show'
-  else
-    if can?(current_user, :write_wiki, @project)
-      @wiki = @project.wikis.new(slug: params[:id])
-      render 'edit'
-    else
-      render 'empty'
-    end
-  end
-end
-
- -
- - - - -
- - -
- -
- -
- - - - diff --git a/doc/app/created.rid b/doc/app/created.rid deleted file mode 100644 index 972a7e6f5da..00000000000 --- a/doc/app/created.rid +++ /dev/null @@ -1,135 +0,0 @@ -Thu, 25 Oct 2012 11:45:21 +0300 -doc/README_FOR_APP Wed, 06 Jun 2012 13:56:49 +0300 -app/observers/issue_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/observers/key_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/observers/project_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/observers/activity_observer.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/observers/user_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/observers/merge_request_observer.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/observers/note_observer.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/observers/system_hook_observer.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/observers/users_project_observer.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/contexts/test_hook_context.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/contexts/commit_load_context.rb Mon, 22 Oct 2012 16:08:19 +0300 -app/contexts/notes/create_context.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/contexts/notes/load_context.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/contexts/search_context.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/contexts/issues_bulk_update_context.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/contexts/base_context.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/contexts/merge_requests_load_context.rb Mon, 22 Oct 2012 16:08:19 +0300 -app/contexts/issues_list_context.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/mailers/notify.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/team.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/push_event.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/votes.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/roles/issue_commonality.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/git_host.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/roles/authority.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/push_observer.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/roles/account.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/static_model.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/roles/repository.rb Wed, 24 Oct 2012 12:43:00 +0300 -app/workers/post_receive.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/workers/system_hook_worker.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/controllers/issues_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/labels_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/project_resource_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/dashboard_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/projects_controller.rb Tue, 23 Oct 2012 11:29:23 +0300 -app/controllers/repositories_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/milestones_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/hooks_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/blob_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/merge_requests_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/admin/logs_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/admin/dashboard_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/admin/projects_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/admin/hooks_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/admin/team_members_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/admin/groups_controller.rb Wed, 24 Oct 2012 12:43:00 +0300 -app/controllers/admin/users_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/admin/resque_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/blame_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/keys_controller.rb Wed, 26 Sep 2012 13:10:32 +0300 -app/controllers/admin_controller.rb Wed, 26 Sep 2012 13:10:32 +0300 -app/controllers/errors_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/help_controller.rb Wed, 06 Jun 2012 13:56:49 +0300 -app/controllers/profile_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/commits_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/team_members_controller.rb Wed, 24 Oct 2012 16:14:03 +0300 -app/controllers/omniauth_callbacks_controller.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/controllers/protected_branches_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/snippets_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/groups_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/compare_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/wikis_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/search_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/deploy_keys_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/tree_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/commit_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/refs_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/controllers/application_controller.rb Wed, 24 Oct 2012 14:17:22 +0300 -app/controllers/notes_controller.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/uploaders/attachment_uploader.rb Wed, 22 Aug 2012 14:52:27 +0300 -app/models/tree.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/project.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/issue.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/project_hook.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/group.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/key.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/snippet.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/user.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/note.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/wiki.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/users_project.rb Wed, 24 Oct 2012 16:14:03 +0300 -app/models/web_hook.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/ability.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/milestone.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/commit.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/protected_branch.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/merge_request.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/event.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/models/system_hook.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/decorators/commit_decorator.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/decorators/event_decorator.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/decorators/application_decorator.rb Fri, 21 Sep 2012 15:40:04 +0300 -app/decorators/tree_decorator.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/tags_helper.rb Wed, 06 Jun 2012 13:56:49 +0300 -app/helpers/application_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/gitlab_markdown_helper.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/helpers/notes_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/profile_helper.rb Fri, 21 Sep 2012 15:47:07 +0300 -app/helpers/tree_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/commits_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/projects_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/events_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/issues_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/tab_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -app/helpers/snippets_helper.rb Wed, 06 Jun 2012 13:56:49 +0300 -app/helpers/merge_requests_helper.rb Mon, 22 Oct 2012 16:08:18 +0300 -lib/file_size_validator.rb Wed, 22 Aug 2012 14:52:27 +0300 -lib/api.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/gitlab/encode.rb Wed, 22 Aug 2012 14:52:27 +0300 -lib/gitlab/graph_commit.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/gitlab/theme.rb Tue, 26 Jun 2012 16:08:37 +0300 -lib/gitlab/app_logger.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/gitlab/inline_diff.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/merge.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/backend/gitolite.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/gitlab/backend/grack_auth.rb Mon, 22 Oct 2012 19:02:02 +0300 -lib/gitlab/backend/gitolite_config.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/git_logger.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/gitlab/markdown.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/file_editor.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/logger.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/satellite.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/gitlab/auth.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/extracts_path.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/api/issues.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/api/projects.rb Mon, 22 Oct 2012 16:08:18 +0300 -lib/api/helpers.rb Mon, 22 Oct 2012 16:08:18 +0300 -lib/api/entities.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/api/session.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/api/users.rb Mon, 22 Oct 2012 16:08:19 +0300 -lib/api/milestones.rb Fri, 21 Sep 2012 15:47:07 +0300 -lib/redcarpet/render/gitlab_html.rb Wed, 22 Aug 2012 14:52:27 +0300 diff --git a/doc/app/doc/README_FOR_APP.html b/doc/app/doc/README_FOR_APP.html deleted file mode 100644 index 9456512ebf3..00000000000 --- a/doc/app/doc/README_FOR_APP.html +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - -README_FOR_APP - Rails Application Documentation - - - - - - - - - - - - - - - - -
- -

Use this README file to introduce your application and point to useful -places in the API for learning more. Run “rake doc:app” to generate API -documentation for your models, controllers, helpers, and libraries.

- -
- - - - - diff --git a/doc/app/images/add.png b/doc/app/images/add.png deleted file mode 100755 index 6332fefea4b..00000000000 Binary files a/doc/app/images/add.png and /dev/null differ diff --git a/doc/app/images/brick.png b/doc/app/images/brick.png deleted file mode 100644 index 7851cf34c94..00000000000 Binary files a/doc/app/images/brick.png and /dev/null differ diff --git a/doc/app/images/brick_link.png b/doc/app/images/brick_link.png deleted file mode 100644 index 9ebf013a23a..00000000000 Binary files a/doc/app/images/brick_link.png and /dev/null differ diff --git a/doc/app/images/bug.png b/doc/app/images/bug.png deleted file mode 100644 index 2d5fb90ec6e..00000000000 Binary files a/doc/app/images/bug.png and /dev/null differ diff --git a/doc/app/images/bullet_black.png b/doc/app/images/bullet_black.png deleted file mode 100644 index 57619706d10..00000000000 Binary files a/doc/app/images/bullet_black.png and /dev/null differ diff --git a/doc/app/images/bullet_toggle_minus.png b/doc/app/images/bullet_toggle_minus.png deleted file mode 100644 index b47ce55f685..00000000000 Binary files a/doc/app/images/bullet_toggle_minus.png and /dev/null differ diff --git a/doc/app/images/bullet_toggle_plus.png b/doc/app/images/bullet_toggle_plus.png deleted file mode 100644 index 9ab4a89664e..00000000000 Binary files a/doc/app/images/bullet_toggle_plus.png and /dev/null differ diff --git a/doc/app/images/date.png b/doc/app/images/date.png deleted file mode 100644 index 783c83357fd..00000000000 Binary files a/doc/app/images/date.png and /dev/null differ diff --git a/doc/app/images/delete.png b/doc/app/images/delete.png deleted file mode 100755 index 08f249365af..00000000000 Binary files a/doc/app/images/delete.png and /dev/null differ diff --git a/doc/app/images/find.png b/doc/app/images/find.png deleted file mode 100644 index 15474796467..00000000000 Binary files a/doc/app/images/find.png and /dev/null differ diff --git a/doc/app/images/loadingAnimation.gif b/doc/app/images/loadingAnimation.gif deleted file mode 100644 index 82290f48334..00000000000 Binary files a/doc/app/images/loadingAnimation.gif and /dev/null differ diff --git a/doc/app/images/macFFBgHack.png b/doc/app/images/macFFBgHack.png deleted file mode 100644 index c6473b324ee..00000000000 Binary files a/doc/app/images/macFFBgHack.png and /dev/null differ diff --git a/doc/app/images/package.png b/doc/app/images/package.png deleted file mode 100644 index da3c2a2d74b..00000000000 Binary files a/doc/app/images/package.png and /dev/null differ diff --git a/doc/app/images/page_green.png b/doc/app/images/page_green.png deleted file mode 100644 index de8e003f9fb..00000000000 Binary files a/doc/app/images/page_green.png and /dev/null differ diff --git a/doc/app/images/page_white_text.png b/doc/app/images/page_white_text.png deleted file mode 100644 index 813f712f726..00000000000 Binary files a/doc/app/images/page_white_text.png and /dev/null differ diff --git a/doc/app/images/page_white_width.png b/doc/app/images/page_white_width.png deleted file mode 100644 index 1eb880947dd..00000000000 Binary files a/doc/app/images/page_white_width.png and /dev/null differ diff --git a/doc/app/images/plugin.png b/doc/app/images/plugin.png deleted file mode 100644 index 6187b15aec0..00000000000 Binary files a/doc/app/images/plugin.png and /dev/null differ diff --git a/doc/app/images/ruby.png b/doc/app/images/ruby.png deleted file mode 100644 index f763a168807..00000000000 Binary files a/doc/app/images/ruby.png and /dev/null differ diff --git a/doc/app/images/tag_blue.png b/doc/app/images/tag_blue.png deleted file mode 100755 index 3f02b5f8f8b..00000000000 Binary files a/doc/app/images/tag_blue.png and /dev/null differ diff --git a/doc/app/images/tag_green.png b/doc/app/images/tag_green.png deleted file mode 100644 index 83ec984bd73..00000000000 Binary files a/doc/app/images/tag_green.png and /dev/null differ diff --git a/doc/app/images/transparent.png b/doc/app/images/transparent.png deleted file mode 100644 index d665e179efd..00000000000 Binary files a/doc/app/images/transparent.png and /dev/null differ diff --git a/doc/app/images/wrench.png b/doc/app/images/wrench.png deleted file mode 100644 index 5c8213fef5a..00000000000 Binary files a/doc/app/images/wrench.png and /dev/null differ diff --git a/doc/app/images/wrench_orange.png b/doc/app/images/wrench_orange.png deleted file mode 100644 index 565a9330e0a..00000000000 Binary files a/doc/app/images/wrench_orange.png and /dev/null differ diff --git a/doc/app/images/zoom.png b/doc/app/images/zoom.png deleted file mode 100644 index 908612e3945..00000000000 Binary files a/doc/app/images/zoom.png and /dev/null differ diff --git a/doc/app/index.html b/doc/app/index.html deleted file mode 100644 index a46b4fbc03d..00000000000 --- a/doc/app/index.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - -Rails Application Documentation - - - - - - - - - - - - - - - - -

This is the API documentation for Rails Application Documentation. - - -

- diff --git a/doc/app/js/darkfish.js b/doc/app/js/darkfish.js deleted file mode 100644 index 4be722fac38..00000000000 --- a/doc/app/js/darkfish.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * - * Darkfish Page Functions - * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ - * - * Author: Michael Granger - * - */ - -/* Provide console simulation for firebug-less environments */ -if (!("console" in window) || !("firebug" in console)) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", - "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; - - window.console = {}; - for (var i = 0; i < names.length; ++i) - window.console[names[i]] = function() {}; -}; - - -/** - * Unwrap the first element that matches the given @expr@ from the targets and return them. - */ -$.fn.unwrap = function( expr ) { - return this.each( function() { - $(this).parents( expr ).eq( 0 ).after( this ).remove(); - }); -}; - - -function showSource( e ) { - var target = e.target; - var codeSections = $(target). - parents('.method-detail'). - find('.method-source-code'); - - $(target). - parents('.method-detail'). - find('.method-source-code'). - slideToggle(); -}; - -function hookSourceViews() { - $('.method-heading').click( showSource ); -}; - -function toggleDebuggingSection() { - $('.debugging-section').slideToggle(); -}; - -function hookDebuggingToggle() { - $('#debugging-toggle img').click( toggleDebuggingSection ); -}; - -function hookTableOfContentsToggle() { - $('.indexpage li .toc-toggle').each( function() { - $(this).click( function() { - $(this).toggleClass('open'); - }); - - var section = $(this).next(); - - $(this).click( function() { - section.slideToggle(); - }); - }); -} - -function hookSearch() { - var input = $('#search-field').eq(0); - var result = $('#search-results').eq(0); - $(result).show(); - - var search_section = $('#search-section').get(0); - $(search_section).show(); - - var search = new Search(search_data, input, result); - - search.renderItem = function(result) { - var li = document.createElement('li'); - var html = ''; - - // TODO add relative path to - - - - - - - - - - -

Table of Contents - Rails Application Documentation

- -

Pages

- - -

Classes/Modules

- - -

Methods

- - - - - diff --git a/doc/code/apple-touch-icon.png b/doc/code/apple-touch-icon.png new file mode 100644 index 00000000000..50f98b0ffa6 Binary files /dev/null and b/doc/code/apple-touch-icon.png differ diff --git a/doc/code/classes/Ability.html b/doc/code/classes/Ability.html new file mode 100644 index 00000000000..c50e5d3e708 --- /dev/null +++ b/doc/code/classes/Ability.html @@ -0,0 +1,507 @@ + + + + + Ability + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
G
+
+ +
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + allowed(object, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 3
+def allowed(object, subject)
+  case subject.class.name
+  when "Project" then project_abilities(object, subject)
+  when "Issue" then issue_abilities(object, subject)
+  when "Note" then note_abilities(object, subject)
+  when "Snippet" then snippet_abilities(object, subject)
+  when "MergeRequest" then merge_request_abilities(object, subject)
+  when "Group" then group_abilities(object, subject)
+  else []
+  end
+end
+
+
+ +
+ +
+
+ + group_abilities(user, group) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 107
+def group_abilities user, group
+  rules = []
+
+  rules << [
+    :manage_group
+  ] if group.owner == user
+
+  rules.flatten
+end
+
+
+ +
+ +
+
+ + project_abilities(user, project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 15
+def project_abilities(user, project)
+  rules = []
+
+  # Rules based on role in project
+  if project.master_access_for?(user)
+    rules << project_master_rules
+
+  elsif project.dev_access_for?(user)
+    rules << project_dev_rules
+
+  elsif project.report_access_for?(user)
+    rules << project_report_rules
+
+  elsif project.guest_access_for?(user)
+    rules << project_guest_rules
+  end
+
+  if project.namespace
+    # If user own project namespace
+    # (Ex. group owner or account owner)
+    if project.namespace.owner == user
+      rules << project_admin_rules
+    end
+  else
+    # For compatibility with global projects
+    # use projects.owner_id
+    if project.owner == user
+      rules << project_admin_rules
+    end
+  end
+
+
+  rules.flatten
+end
+
+
+ +
+ +
+
+ + project_admin_rules() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 99
+def project_admin_rules
+  project_master_rules + [
+    :change_namespace,
+    :rename_project,
+    :remove_project
+  ]
+end
+
+
+ +
+ +
+
+ + project_dev_rules() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 74
+def project_dev_rules
+  project_report_rules + [
+    :write_wiki,
+    :push_code
+  ]
+end
+
+
+ +
+ +
+
+ + project_guest_rules() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 50
+def project_guest_rules
+  [
+    :read_project,
+    :read_wiki,
+    :read_issue,
+    :read_milestone,
+    :read_snippet,
+    :read_team_member,
+    :read_merge_request,
+    :read_note,
+    :write_project,
+    :write_issue,
+    :write_note
+  ]
+end
+
+
+ +
+ +
+
+ + project_master_rules() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 81
+def project_master_rules
+  project_dev_rules + [
+    :push_code_to_protected_branches,
+    :modify_issue,
+    :modify_snippet,
+    :modify_merge_request,
+    :admin_issue,
+    :admin_milestone,
+    :admin_snippet,
+    :admin_team_member,
+    :admin_merge_request,
+    :admin_note,
+    :accept_mr,
+    :admin_wiki,
+    :admin_project
+  ]
+end
+
+
+ +
+ +
+
+ + project_report_rules() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/ability.rb, line 66
+def project_report_rules
+  project_guest_rules + [
+    :download_code,
+    :write_merge_request,
+    :write_snippet
+  ]
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Account.html b/doc/code/classes/Account.html new file mode 100644 index 00000000000..21119cc8462 --- /dev/null +++ b/doc/code/classes/Account.html @@ -0,0 +1,1032 @@ + + + + + Account + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
I
+
+ +
+ +
L
+
+ +
+ +
M
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + abilities() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 29
+def abilities
+  @abilities ||= begin
+                   abilities = Six.new
+                   abilities << Ability
+                   abilities
+                 end
+end
+
+
+ +
+ +
+
+ + authorized_groups() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 109
+def authorized_groups
+  @authorized_groups ||= begin
+                         groups = Group.where(id: self.projects.pluck(:namespace_id)).all
+                         groups = groups + self.groups
+                         groups.uniq
+                       end
+end
+
+
+ +
+ +
+
+ + authorized_projects() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 117
+def authorized_projects
+  Project.authorized_for(self)
+end
+
+
+ +
+ +
+
+ + block() + + +
+ + +
+

Remove user from all projects and set blocked attribute to true

+
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 59
+def block
+  users_projects.find_each do |membership|
+    return false unless membership.destroy
+  end
+
+  self.blocked = true
+  save
+end
+
+
+ +
+ +
+
+ + can?(action, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 37
+def can? action, subject
+  abilities.allowed?(self, action, subject)
+end
+
+
+ +
+ +
+
+ + can_create_group?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 25
+def can_create_group?
+  is_admin?
+end
+
+
+ +
+ +
+
+ + can_create_project?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 21
+def can_create_project?
+  projects_limit > my_own_projects.count
+end
+
+
+ +
+ +
+
+ + cared_merge_requests() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 49
+def cared_merge_requests
+  MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id)
+end
+
+
+ +
+ +
+
+ + first_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 45
+def first_name
+  name.split.first unless name.blank?
+end
+
+
+ +
+ +
+
+ + identifier() + + +
+ + +
+

Returns a string for use as a Gitolite user identifier

+ +

Note that Gitolite 2.x requires the following +pattern for users:

+ +
^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$
+
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 7
+def identifier
+  # Replace non-word chars with underscores, then make sure it starts with
+  # valid chars
+  email.gsub(%r\W/, '_').gsub(%r\A([\W\_])+/, '')
+end
+
+
+ +
+ +
+
+ + is_admin?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 13
+def is_admin?
+  admin
+end
+
+
+ +
+ +
+
+ + last_activity_project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 41
+def last_activity_project
+  projects.first
+end
+
+
+ +
+ +
+
+ + my_own_projects() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 121
+def my_own_projects
+  Project.personal(self)
+end
+
+
+ +
+ +
+
+ + namespace_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 105
+def namespace_id
+  namespace.try :id
+end
+
+
+ +
+ +
+
+ + namespaces() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 86
+def namespaces
+  namespaces = []
+
+  # Add user account namespace
+  namespaces << self.namespace if self.namespace
+
+  # Add groups you can manage
+  namespaces += if admin
+                  Group.all
+                else
+                  groups.all
+                end
+  namespaces
+end
+
+
+ +
+ +
+
+ + project_ids() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 53
+def project_ids
+  projects.map(&:id)
+end
+
+
+ +
+ +
+
+ + projects_limit_percent() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 68
+def projects_limit_percent
+  return 100 if projects_limit.zero?
+  (my_own_projects.count.to_f / projects_limit) * 100
+end
+
+
+ +
+ +
+
+ + projects_sorted_by_activity() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 82
+def projects_sorted_by_activity
+  projects.sorted_by_activity
+end
+
+
+ +
+ +
+
+ + recent_push(project_id = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 73
+def recent_push project_id = nil
+  # Get push events not earlier than 2 hours ago
+  events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours)
+  events = events.where(project_id: project_id) if project_id
+
+  # Take only latest one
+  events = events.recent.limit(1).first
+end
+
+
+ +
+ +
+
+ + require_ssh_key?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 17
+def require_ssh_key?
+  keys.count == 0
+end
+
+
+ +
+ +
+
+ + several_namespaces?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/account.rb, line 101
+def several_namespaces?
+  namespaces.size > 1
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ActiveRecord.html b/doc/code/classes/ActiveRecord.html new file mode 100644 index 00000000000..fdf88c1cf34 --- /dev/null +++ b/doc/code/classes/ActiveRecord.html @@ -0,0 +1,79 @@ + + + + + ActiveRecord + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ActiveRecord/ConnectionAdapters.html b/doc/code/classes/ActiveRecord/ConnectionAdapters.html new file mode 100644 index 00000000000..ec3891660ab --- /dev/null +++ b/doc/code/classes/ActiveRecord/ConnectionAdapters.html @@ -0,0 +1,86 @@ + + + + + ActiveRecord::ConnectionAdapters + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ActiveRecord/ConnectionAdapters/Mysql2Adapter.html b/doc/code/classes/ActiveRecord/ConnectionAdapters/Mysql2Adapter.html new file mode 100644 index 00000000000..2c8d740a69a --- /dev/null +++ b/doc/code/classes/ActiveRecord/ConnectionAdapters/Mysql2Adapter.html @@ -0,0 +1,167 @@ + + + + + ActiveRecord::ConnectionAdapters::Mysql2Adapter + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute(*args) + + +
+ + +
+ +
+ + + +
+ Also aliased as: execute_without_retry +
+ + + + +
+ + +
+
# File config/initializers/connection_fix.rb, line 21
+def execute(*args)
+  execute_without_retry(*args)
+rescue ActiveRecord::StatementInvalid => e
+  if e.message =~ %rserver has gone away/
+    warn "Server timed out, retrying"
+    reconnect!
+    retry
+  else
+    raise e
+  end
+end
+
+
+ +
+ +
+
+ + execute_without_retry(*args) + + +
+ + +
+ +
+ + + + + +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter.html b/doc/code/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter.html new file mode 100644 index 00000000000..0ee82105cd4 --- /dev/null +++ b/doc/code/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter.html @@ -0,0 +1,191 @@ + + + + + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + add_column_with_limit_filter(table_name, column_name, type, options = {}) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File config/initializers/postgresql_limit_fix.rb, line 13
+def add_column_with_limit_filter(table_name, column_name, type, options = {})
+  options.delete(:limit) if type == :text
+  add_column_without_limit_filter(table_name, column_name, type, options)
+end
+
+
+ +
+ +
+
+ + change_column_with_limit_filter(table_name, column_name, type, options = {}) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File config/initializers/postgresql_limit_fix.rb, line 18
+def change_column_with_limit_filter(table_name, column_name, type, options = {})
+  options.delete(:limit) if type == :text
+  change_column_without_limit_filter(table_name, column_name, type, options)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/TableDefinition.html b/doc/code/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/TableDefinition.html new file mode 100644 index 00000000000..f2ea0db417a --- /dev/null +++ b/doc/code/classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/TableDefinition.html @@ -0,0 +1,135 @@ + + + + + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+
    + + +
  • + text +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + text(*args) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File config/initializers/postgresql_limit_fix.rb, line 4
+def text(*args)
+  options = args.extract_options!
+  options.delete(:limit)
+  column_names = args
+  type = :text
+  column_names.each { |name| column(name, type, options) }
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ActivityObserver.html b/doc/code/classes/ActivityObserver.html new file mode 100644 index 00000000000..31f4982edd0 --- /dev/null +++ b/doc/code/classes/ActivityObserver.html @@ -0,0 +1,194 @@ + + + + + ActivityObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(record) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/activity_observer.rb, line 4
+def after_create(record)
+  event_author_id = record.author_id
+
+  # Skip status notes
+  if record.kind_of?(Note) && record.note.include?("_Status changed to ")
+    return true
+  end
+
+  if event_author_id
+    Event.create(
+      project: record.project,
+      target_id: record.id,
+      target_type: record.class.name,
+      action: Event.determine_action(record),
+      author_id: event_author_id
+    )
+  end
+end
+
+
+ +
+ +
+
+ + after_save(record) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/activity_observer.rb, line 23
+def after_save(record)
+  if record.changed.include?("closed") && record.author_id_of_changes
+    Event.create(
+      project: record.project,
+      target_id: record.id,
+      target_type: record.class.name,
+      action: (record.closed ? Event::Closed : Event::Reopened),
+      author_id: record.author_id_of_changes
+    )
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin.html b/doc/code/classes/Admin.html new file mode 100644 index 00000000000..ba82287d551 --- /dev/null +++ b/doc/code/classes/Admin.html @@ -0,0 +1,114 @@ + + + + + Admin + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/DashboardController.html b/doc/code/classes/Admin/DashboardController.html new file mode 100644 index 00000000000..02643b7fe39 --- /dev/null +++ b/doc/code/classes/Admin/DashboardController.html @@ -0,0 +1,139 @@ + + + + + Admin::DashboardController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
I
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/dashboard_controller.rb, line 2
+def index
+  @projects = Project.order("created_at DESC").limit(10)
+  @users = User.order("created_at DESC").limit(10)
+
+  @resque_accessible = true
+  @workers = Resque.workers
+  @pending_jobs = Resque.size(:post_receive)
+
+rescue Redis::InheritedError
+  @resque_accessible = false
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/GroupsController.html b/doc/code/classes/Admin/GroupsController.html new file mode 100644 index 00000000000..b3651e8b98e --- /dev/null +++ b/doc/code/classes/Admin/GroupsController.html @@ -0,0 +1,586 @@ + + + + + Admin::GroupsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 26
+def create
+  @group = Group.new(params[:group])
+  @group.path = @group.name.dup.parameterize if @group.name
+  @group.owner = current_user
+
+  if @group.save
+    redirect_to [:admin, @group], notice: 'Group was successfully created.'
+  else
+    render action: "new"
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 75
+def destroy
+  @group.truncate_teams
+
+  @group.destroy
+
+  redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 23
+def edit
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 4
+def index
+  @groups = Group.order('name ASC')
+  @groups = @groups.search(params[:name]) if params[:name].present?
+  @groups = @groups.page(params[:page]).per(20)
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 19
+def new
+  @group = Group.new
+end
+
+
+ +
+ +
+
+ + project_teams_update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 70
+def project_teams_update
+  @group.add_users_to_project_teams(params[:user_ids], params[:project_access])
+  redirect_to [:admin, @group], notice: 'Users was successfully added.'
+end
+
+
+ +
+ +
+
+ + project_update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 53
+def project_update
+  project_ids = params[:project_ids]
+
+  Project.where(id: project_ids).each do |project|
+    project.transfer(@group)
+  end
+
+  redirect_to :back, notice: 'Group was successfully updated.'
+end
+
+
+ +
+ +
+
+ + remove_project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 63
+def remove_project
+  @project = Project.find(params[:project_id])
+  @project.transfer(nil)
+
+  redirect_to :back, notice: 'Group was successfully updated.'
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 10
+def show
+  @projects = Project.scoped
+  @projects = @projects.not_in_group(@group) if @group.projects.present?
+  @projects = @projects.all
+  @projects.reject!(&:empty_repo?)
+
+  @users = User.active
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/groups_controller.rb, line 38
+def update
+  group_params = params[:group].dup
+  owner_id =group_params.delete(:owner_id)
+
+  if owner_id
+    @group.owner = User.find(owner_id)
+  end
+
+  if @group.update_attributes(group_params)
+    redirect_to [:admin, @group], notice: 'Group was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/HooksController.html b/doc/code/classes/Admin/HooksController.html new file mode 100644 index 00000000000..1d56fbc7b98 --- /dev/null +++ b/doc/code/classes/Admin/HooksController.html @@ -0,0 +1,294 @@ + + + + + Admin::HooksController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
T
+
+
    + + +
  • + test +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/hooks_controller.rb, line 7
+def create
+  @hook = SystemHook.new(params[:hook])
+
+  if @hook.save
+    redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
+  else
+    @hooks = SystemHook.all
+    render :index
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/hooks_controller.rb, line 18
+def destroy
+  @hook = SystemHook.find(params[:id])
+  @hook.destroy
+
+  redirect_to admin_hooks_path
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/hooks_controller.rb, line 2
+def index
+  @hooks = SystemHook.all
+  @hook = SystemHook.new
+end
+
+
+ +
+ +
+
+ + test() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/hooks_controller.rb, line 26
+def test
+  @hook = SystemHook.find(params[:hook_id])
+  data = {
+    event_name: "project_create",
+    name: "Ruby",
+    path: "ruby",
+    project_id: 1,
+    owner_name: "Someone",
+    owner_email: "example@gitlabhq.com"
+  }
+  @hook.execute(data)
+
+  redirect_to :back
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/LogsController.html b/doc/code/classes/Admin/LogsController.html new file mode 100644 index 00000000000..8782d95f5ac --- /dev/null +++ b/doc/code/classes/Admin/LogsController.html @@ -0,0 +1,76 @@ + + + + + Admin::LogsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/ProjectsController.html b/doc/code/classes/Admin/ProjectsController.html new file mode 100644 index 00000000000..1a0bd492112 --- /dev/null +++ b/doc/code/classes/Admin/ProjectsController.html @@ -0,0 +1,436 @@ + + + + + Admin::ProjectsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
P
+
+ +
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 37
+def destroy
+  # Delete team first in order to prevent multiple gitolite calls
+  @project.truncate_team
+
+  @project.destroy
+
+  redirect_to admin_projects_path, notice: 'Project was successfully deleted.'
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 18
+def edit
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 4
+def index
+  @projects = Project.scoped
+  @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present?
+  @projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id
+  @projects = @projects.search(params[:name]) if params[:name].present?
+  @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20)
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 12
+def show
+  @users = User.active
+  @users = @users.not_in_project(@project) if @project.users.present?
+  @users = @users.all
+end
+
+
+ +
+ +
+
+ + team_update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 21
+def team_update
+  @project.add_users_ids_to_team(params[:user_ids], params[:project_access])
+
+  redirect_to [:admin, @project], notice: 'Project was successfully updated.'
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 27
+def update
+  status = ProjectUpdateContext.new(project, current_user, params).execute(:admin)
+
+  if status
+    redirect_to [:admin, @project], notice: 'Project was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/projects_controller.rb, line 48
+def project
+  id = params[:project_id] || params[:id]
+
+  @project = Project.find_with_namespace(id)
+  @project || render_404
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/ResqueController.html b/doc/code/classes/Admin/ResqueController.html new file mode 100644 index 00000000000..52cb2f870e9 --- /dev/null +++ b/doc/code/classes/Admin/ResqueController.html @@ -0,0 +1,130 @@ + + + + + Admin::ResqueController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/resque_controller.rb, line 2
+def show
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/TeamMembersController.html b/doc/code/classes/Admin/TeamMembersController.html new file mode 100644 index 00000000000..b055f509137 --- /dev/null +++ b/doc/code/classes/Admin/TeamMembersController.html @@ -0,0 +1,234 @@ + + + + + Admin::TeamMembersController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/team_members_controller.rb, line 16
+def destroy
+  @admin_team_member = UsersProject.find(params[:id])
+  @admin_team_member.destroy
+
+  redirect_to :back
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/team_members_controller.rb, line 2
+def edit
+  @admin_team_member = UsersProject.find(params[:id])
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/team_members_controller.rb, line 6
+def update
+  @admin_team_member = UsersProject.find(params[:id])
+
+  if @admin_team_member.update_attributes(params[:team_member])
+    redirect_to [:admin, @admin_team_member.project],  notice: 'Project Access was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Admin/UsersController.html b/doc/code/classes/Admin/UsersController.html new file mode 100644 index 00000000000..cfe1e514ae8 --- /dev/null +++ b/doc/code/classes/Admin/UsersController.html @@ -0,0 +1,616 @@ + + + + + Admin::UsersController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + block() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 40
+def block
+  @admin_user = User.find(params[:id])
+
+  if @admin_user.block
+    redirect_to :back, alert: "Successfully blocked"
+  else
+    redirect_to :back, alert: "Error occured. User was not blocked"
+  end
+end
+
+
+ +
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 60
+def create
+  admin = params[:user].delete("admin")
+
+  @admin_user = User.new(params[:user], as: :admin)
+  @admin_user.admin = (admin && admin.to_i > 0)
+
+  respond_to do |format|
+    if @admin_user.save
+      format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully created.' }
+      format.json { render json: @admin_user, status: :created, location: @admin_user }
+    else
+      format.html { render action: "new" }
+      format.json { render json: @admin_user.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 99
+def destroy
+  @admin_user = User.find(params[:id])
+  if @admin_user.my_own_projects.count > 0
+    redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return
+  end
+  @admin_user.destroy
+
+  respond_to do |format|
+    format.html { redirect_to admin_users_url }
+    format.json { head :ok }
+  end
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 36
+def edit
+  @admin_user = User.find(params[:id])
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 2
+def index
+  @admin_users = User.scoped
+  @admin_users = @admin_users.filter(params[:filter])
+  @admin_users = @admin_users.search(params[:name]) if params[:name].present?
+  @admin_users = @admin_users.alphabetically.page(params[:page])
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 32
+def new
+  @admin_user = User.new({ projects_limit: Gitlab.config.gitlab.default_projects_limit }, as: :admin)
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 9
+def show
+  @admin_user = User.find(params[:id])
+
+  @projects = if @admin_user.projects.empty?
+             Project
+           else
+             Project.without_user(@admin_user)
+           end.all
+end
+
+
+ +
+ +
+
+ + team_update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 19
+def team_update
+  @admin_user = User.find(params[:id])
+
+  UsersProject.user_bulk_import(
+    @admin_user,
+    params[:project_ids],
+    params[:project_access]
+  )
+
+  redirect_to [:admin, @admin_user], notice: 'Teams were successfully updated.'
+end
+
+
+ +
+ +
+
+ + unblock() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 50
+def unblock
+  @admin_user = User.find(params[:id])
+
+  if @admin_user.update_attribute(:blocked, false)
+    redirect_to :back, alert: "Successfully unblocked"
+  else
+    redirect_to :back, alert: "Error occured. User was not unblocked"
+  end
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin/users_controller.rb, line 77
+def update
+  admin = params[:user].delete("admin")
+
+  if params[:user][:password].blank?
+    params[:user].delete(:password)
+    params[:user].delete(:password_confirmation)
+  end
+
+  @admin_user = User.find(params[:id])
+  @admin_user.admin = (admin && admin.to_i > 0)
+
+  respond_to do |format|
+    if @admin_user.update_attributes(params[:user], as: :admin)
+      format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully updated.' }
+      format.json { head :ok }
+    else
+      format.html { render action: "edit" }
+      format.json { render json: @admin_user.errors, status: :unprocessable_entity }
+    end
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/AdminController.html b/doc/code/classes/AdminController.html new file mode 100644 index 00000000000..629a30fe62c --- /dev/null +++ b/doc/code/classes/AdminController.html @@ -0,0 +1,140 @@ + + + + + AdminController + + + + + + + + + + + + + +
+
+ +
+ +

Provides a base class for Admin controllers to +subclass

+ +

Automatically sets the layout and ensures an administrator is logged in

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + authenticate_admin!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/admin_controller.rb, line 8
+def authenticate_admin!
+  return render_404 unless current_user.is_admin?
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ApplicationController.html b/doc/code/classes/ApplicationController.html new file mode 100644 index 00000000000..f1c3bed954e --- /dev/null +++ b/doc/code/classes/ApplicationController.html @@ -0,0 +1,942 @@ + + + + + ApplicationController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+
    + + +
  • + can? +
  • + +
+
+ +
D
+
+ +
+ +
G
+
+ +
+ +
L
+
+ +
+ +
M
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Protected methods
+ +
+
+ + abilities() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 58
+def abilities
+  @abilities ||= Six.new
+end
+
+
+ +
+ +
+
+ + access_denied!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 91
+def access_denied!
+  render "errors/access_denied", layout: "errors", status: 404
+end
+
+
+ +
+ +
+
+ + add_abilities() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 79
+def add_abilities
+  abilities << Ability
+end
+
+
+ +
+ +
+
+ + after_sign_in_path_for(resource) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 43
+def after_sign_in_path_for resource
+  if resource.is_a?(User) && resource.respond_to?(:blocked) && resource.blocked
+    sign_out resource
+    flash[:alert] = "Your account is blocked. Retry when an admin unblock it."
+    new_user_session_path
+  else
+    super
+  end
+end
+
+
+ +
+ +
+
+ + authorize_code_access!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 87
+def authorize_code_access!
+  return access_denied! unless can?(current_user, :download_code, project)
+end
+
+
+ +
+ +
+
+ + authorize_project!(action) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 83
+def authorize_project!(action)
+  return access_denied! unless can?(current_user, action, project)
+end
+
+
+ +
+ +
+
+ + can?(object, action, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 62
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+
+ +
+ +
+
+ + dev_tools() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 129
+def dev_tools
+  Rack::MiniProfiler.authorize_request
+end
+
+
+ +
+ +
+
+ + git_not_found!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 99
+def git_not_found!
+  render "errors/git_not_found", layout: "errors", status: 404
+end
+
+
+ +
+ +
+
+ + log_exception(exception) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 29
+def log_exception(exception)
+  application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace
+  application_trace.map!{ |t| "  #{t}\n" }
+  logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}"
+end
+
+
+ +
+ +
+
+ + method_missing(method_sym, *arguments, &block) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 103
+def method_missing(method_sym, *arguments, &block)
+  if method_sym.to_s =~ %r^authorize_(.*)!$/
+    authorize_project!($1.to_sym)
+  else
+    super
+  end
+end
+
+
+ +
+ +
+
+ + no_cache_headers() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 123
+def no_cache_headers
+  response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
+  response.headers["Pragma"] = "no-cache"
+  response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
+end
+
+
+ +
+ +
+
+ + not_found!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 95
+def not_found!
+  render "errors/not_found", layout: "errors", status: 404
+end
+
+
+ +
+ +
+
+ + project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 66
+def project
+  id = params[:project_id] || params[:id]
+
+  @project = Project.find_with_namespace(id)
+
+  if @project and can?(current_user, :read_project, @project)
+    @project
+  else
+    @project = nil
+    render_404
+  end
+end
+
+
+ +
+ +
+
+ + reject_blocked!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 35
+def reject_blocked!
+  if current_user && current_user.blocked
+    sign_out current_user
+    flash[:alert] = "Your account is blocked. Retry when an admin unblock it."
+    redirect_to new_user_session_path
+  end
+end
+
+
+ +
+ +
+
+ + render_403() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 115
+def render_403
+  render file: Rails.root.join("public", "403"), layout: false, status: "403"
+end
+
+
+ +
+ +
+
+ + render_404() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 111
+def render_404
+  render file: Rails.root.join("public", "404"), layout: false, status: "404"
+end
+
+
+ +
+ +
+
+ + require_non_empty_project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 119
+def require_non_empty_project
+  redirect_to @project if @project.empty_repo?
+end
+
+
+ +
+ +
+
+ + set_current_user_for_observers() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/application_controller.rb, line 53
+def set_current_user_for_observers
+  MergeRequestObserver.current_user = current_user
+  IssueObserver.current_user = current_user
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ApplicationDecorator.html b/doc/code/classes/ApplicationDecorator.html new file mode 100644 index 00000000000..348cf42a0c9 --- /dev/null +++ b/doc/code/classes/ApplicationDecorator.html @@ -0,0 +1,76 @@ + + + + + ApplicationDecorator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ApplicationHelper.html b/doc/code/classes/ApplicationHelper.html new file mode 100644 index 00000000000..2c3a82bb7b1 --- /dev/null +++ b/doc/code/classes/ApplicationHelper.html @@ -0,0 +1,890 @@ + + + + + ApplicationHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
E
+
+ +
+ +
G
+
+ +
+ +
H
+
+ +
+ +
L
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
U
+
+ +
+ +
W
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + app_theme() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 130
+def app_theme
+  Gitlab::Theme.css_class_by_id(current_user.try(:theme_id))
+end
+
+
+ +
+ +
+
+ + authbutton(provider, size = 64) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 159
+def authbutton(provider, size = 64)
+  file_name = "#{provider.to_s.split('_').first}_#{size}.png"
+  image_tag("authbuttons/#{file_name}",
+            alt: "Sign in with #{provider.to_s.titleize}")
+end
+
+
+ +
+ +
+
+ + current_action?(*args) + + +
+ + +
+

Check if a partcular action is the current one

+ +

args - One or more action names to check

+ +

Examples

+ +
# On Projects#new
+current_action?(:new)           # => true
+current_action?(:create)        # => false
+current_action?(:new, :create)  # => true
+
+
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 30
+def current_action?(*args)
+  args.any? { |v| v.to_s.downcase == action_name }
+end
+
+
+ +
+ +
+
+ + current_controller?(*args) + + +
+ + +
+

Check if a particular controller is the current one

+ +

args - One or more controller names to check

+ +

Examples

+ +
# On TreeController
+current_controller?(:tree)           # => true
+current_controller?(:commits)        # => false
+current_controller?(:commits, :tree) # => true
+
+
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 16
+def current_controller?(*args)
+  args.any? { |v| v.to_s.downcase == controller.controller_name }
+end
+
+
+ +
+ +
+
+ + emoji_autocomplete_source() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 120
+def emoji_autocomplete_source
+  # should be an array of strings
+  # so to_s can be called, because it is sufficient and to_json is too slow
+  Emoji.names.to_s
+end
+
+
+ +
+ +
+
+ + gravatar_icon(user_email = '', size = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 34
+def gravatar_icon(user_email = '', size = nil)
+  size = 40 if size.nil? || size <= 0
+
+  if !Gitlab.config.gravatar.enabled || user_email.blank?
+    'no_avatar.png'
+  else
+    gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
+    user_email.strip!
+    sprintf(gravatar_url, {:hash => Digest::MD5.hexdigest(user_email.downcase), :email => URI.escape(user_email), :size => size})
+  end
+end
+
+
+ +
+ +
+
+ + grouped_options_refs(destination = :tree) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 64
+def grouped_options_refs(destination = :tree)
+  options = [
+    ["Branch", @project.branch_names ],
+    [ "Tag", @project.tag_names ]
+  ]
+
+  # If reference is commit id -
+  # we should add it to branch/tag selectbox
+  if(@ref && !options.flatten.include?(@ref) &&
+     @ref =~ %r^[0-9a-zA-Z]{6,52}$/)
+    options << ["Commit", [@ref]]
+  end
+
+  grouped_options_for_select(options, @ref || @project.default_branch)
+end
+
+
+ +
+ +
+
+ + hexdigest(string) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 146
+def hexdigest(string)
+  Digest::SHA1.hexdigest string
+end
+
+
+ +
+ +
+
+ + last_commit(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 54
+def last_commit(project)
+  if project.repo_exists?
+    time_ago_in_words(project.commit.committed_date) + " ago"
+  else
+    "Never"
+  end
+rescue
+  "Never"
+end
+
+
+ +
+ +
+
+ + ldap_enable?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 126
+def ldap_enable?
+  Devise.omniauth_providers.include?(:ldap)
+end
+
+
+ +
+ +
+
+ + project_last_activity(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 150
+def project_last_activity project
+  activity = project.last_activity
+  if activity && activity.created_at
+    time_ago_in_words(activity.created_at) + " ago"
+  else
+    "Never"
+  end
+end
+
+
+ +
+ +
+
+ + request_protocol() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 46
+def request_protocol
+  request.ssl? ? "https" : "http"
+end
+
+
+ +
+ +
+
+ + search_autocomplete_source() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 80
+def search_autocomplete_source
+  projects = current_user.authorized_projects.map { |p| { label: p.name_with_namespace, url: project_path(p) } }
+  groups = current_user.authorized_groups.map { |group| { label: "<group> #{group.name}", url: group_path(group) } }
+
+  default_nav = [
+    { label: "My Profile", url: profile_path },
+    { label: "My SSH Keys", url: keys_path },
+    { label: "My Dashboard", url: root_path },
+    { label: "Admin Section", url: admin_root_path },
+  ]
+
+  help_nav = [
+    { label: "Workflow Help", url: help_workflow_path },
+    { label: "Permissions Help", url: help_permissions_path },
+    { label: "Web Hooks Help", url: help_web_hooks_path },
+    { label: "System Hooks Help", url: help_system_hooks_path },
+    { label: "API Help", url: help_api_path },
+    { label: "Markdown Help", url: help_markdown_path },
+    { label: "SSH Keys Help", url: help_ssh_path },
+    { label: "Gitlab Rake Tasks Help", url: help_raketasks_path },
+  ]
+
+  project_nav = []
+  if @project && !@project.new_record?
+    project_nav = [
+      { label: "#{@project.name} Issues",   url: project_issues_path(@project) },
+      { label: "#{@project.name} Commits",  url: project_commits_path(@project, @ref || @project.root_ref) },
+      { label: "#{@project.name} Merge Requests", url: project_merge_requests_path(@project) },
+      { label: "#{@project.name} Milestones", url: project_milestones_path(@project) },
+      { label: "#{@project.name} Snippets", url: project_snippets_path(@project) },
+      { label: "#{@project.name} Team",     url: project_team_index_path(@project) },
+      { label: "#{@project.name} Tree",     url: project_tree_path(@project, @ref || @project.root_ref) },
+      { label: "#{@project.name} Wall",     url: wall_project_path(@project) },
+      { label: "#{@project.name} Wiki",     url: project_wikis_path(@project) },
+    ]
+  end
+
+  [groups, projects, default_nav, project_nav, help_nav].flatten.to_json
+end
+
+
+ +
+ +
+
+ + show_last_push_widget?(event) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 138
+def show_last_push_widget?(event)
+  event &&
+    event.last_push_to_non_root? &&
+    !event.rm_ref? &&
+    event.project &&
+    event.project.merge_requests_enabled
+end
+
+
+ +
+ +
+
+ + user_color_scheme_class() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 134
+def user_color_scheme_class
+  current_user.dark_scheme ? :black : :white
+end
+
+
+ +
+ +
+
+ + web_app_url() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/application_helper.rb, line 50
+def web_app_url
+  "#{request_protocol}://#{Gitlab.config.gitlab.host}/"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/AttachmentUploader.html b/doc/code/classes/AttachmentUploader.html new file mode 100644 index 00000000000..79bc7c989c5 --- /dev/null +++ b/doc/code/classes/AttachmentUploader.html @@ -0,0 +1,132 @@ + + + + + AttachmentUploader + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + store_dir() + + +
+ + +
+

Override the directory where uploaded files will be stored. This is a +sensible default for uploaders that are meant to be mounted:

+
+ + + + + + +
+ + +
+
# File app/uploaders/attachment_uploader.rb, line 15
+def store_dir
+  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Authority.html b/doc/code/classes/Authority.html new file mode 100644 index 00000000000..fc93f4bea1a --- /dev/null +++ b/doc/code/classes/Authority.html @@ -0,0 +1,528 @@ + + + + + Authority + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
D
+
+ +
+ +
G
+
+ +
+ +
M
+
+ +
+ +
R
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + add_access(user, *access) + + +
+ + +
+

Compatible with all access rights Should be rewrited for new access rights

+
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 4
+def add_access(user, *access)
+  access = if access.include?(:admin)
+             { project_access: UsersProject::MASTER }
+           elsif access.include?(:write)
+             { project_access: UsersProject::DEVELOPER }
+           else
+             { project_access: UsersProject::REPORTER }
+           end
+  opts = { user: user }
+  opts.merge!(access)
+  users_projects.create(opts)
+end
+
+
+ +
+ +
+
+ + allow_read_for?(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 39
+def allow_read_for?(user)
+  !users_projects.where(user_id: user.id).empty?
+end
+
+
+ +
+ +
+
+ + dev_access_for?(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 51
+def dev_access_for?(user)
+  !users_projects.where(user_id: user.id, project_access: [UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
+end
+
+
+ +
+ +
+
+ + guest_access_for?(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 43
+def guest_access_for?(user)
+  !users_projects.where(user_id: user.id).empty?
+end
+
+
+ +
+ +
+
+ + master_access_for?(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 55
+def master_access_for?(user)
+  !users_projects.where(user_id: user.id, project_access: [UsersProject::MASTER]).empty?
+end
+
+
+ +
+ +
+
+ + report_access_for?(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 47
+def report_access_for?(user)
+  !users_projects.where(user_id: user.id, project_access: [UsersProject::REPORTER, UsersProject::DEVELOPER, UsersProject::MASTER]).empty?
+end
+
+
+ +
+ +
+
+ + repository_masters() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 33
+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)
+end
+
+
+ +
+ +
+
+ + repository_readers() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 21
+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)
+end
+
+
+ +
+ +
+
+ + repository_writers() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 27
+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)
+end
+
+
+ +
+ +
+
+ + reset_access(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/authority.rb, line 17
+def reset_access(user)
+  users_projects.where(project_id: self.id, user_id: user.id).destroy if self.id
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/BaseContext.html b/doc/code/classes/BaseContext.html new file mode 100644 index 00000000000..3fbc76bf7e0 --- /dev/null +++ b/doc/code/classes/BaseContext.html @@ -0,0 +1,261 @@ + + + + + BaseContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+
    + + +
  • + can? +
  • + +
+
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + +
+ [RW] + current_user
+ [RW] + params
+ [RW] + project
+ + + + + +
Class Public methods
+ +
+
+ + new(project, user, params) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/base_context.rb, line 4
+def initialize(project, user, params)
+  @project, @current_user, @params = project, user, params.dup
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + abilities() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/base_context.rb, line 8
+def abilities
+  @abilities ||= begin
+                   abilities = Six.new
+                   abilities << Ability
+                   abilities
+                 end
+end
+
+
+ +
+ +
+
+ + can?(object, action, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/base_context.rb, line 16
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/BlameController.html b/doc/code/classes/BlameController.html new file mode 100644 index 00000000000..2d641cb099b --- /dev/null +++ b/doc/code/classes/BlameController.html @@ -0,0 +1,152 @@ + + + + + BlameController + + + + + + + + + + + + + +
+
+ +
+ +

Controller for viewing a file’s blame

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/blame_controller.rb, line 12
+def show
+  @repo = @project.repo
+  @blame = Grit::Blob.blame(@repo, @commit.id, @path)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/BlobController.html b/doc/code/classes/BlobController.html new file mode 100644 index 00000000000..22df013f475 --- /dev/null +++ b/doc/code/classes/BlobController.html @@ -0,0 +1,160 @@ + + + + + BlobController + + + + + + + + + + + + + +
+
+ +
+ +

Controller for viewing a file’s blame

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/blob_controller.rb, line 12
+def show
+  if @tree.is_blob?
+    send_data(
+      @tree.data,
+      type: @tree.mime_type,
+      disposition: 'inline',
+      filename: @tree.name
+    )
+  else
+    not_found!
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Commit.html b/doc/code/classes/Commit.html new file mode 100644 index 00000000000..15369b8981a --- /dev/null +++ b/doc/code/classes/Commit.html @@ -0,0 +1,1077 @@ + + + + + Commit + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
F
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + +
DIFF_SAFE_SIZE=100
 

Safe amount of files with diffs in one commit to render Used to prevent 500 +error on huge commits by suppressing diff

+ + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + +
+ [RW] + commit
+ [RW] + head
+ [RW] + refs
+ + + + + +
Class Public methods
+ +
+
+ + commits(repo, ref, path = nil, limit = nil, offset = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 62
+def commits(repo, ref, path = nil, limit = nil, offset = nil)
+  if path
+    repo.log(ref, path, max_count: limit, skip: offset)
+  elsif limit && offset
+    repo.commits(ref, limit, offset)
+  else
+    repo.commits(ref)
+  end.map{ |c| Commit.new(c) }
+end
+
+
+ +
+ +
+
+ + commits_between(repo, from, to) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 72
+def commits_between(repo, from, to)
+  repo.commits_between(from, to).map { |c| Commit.new(c) }
+end
+
+
+ +
+ +
+
+ + commits_since(repo, date) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 50
+def commits_since(repo, date)
+  commits = repo.heads.map do |h|
+    repo.log(h.name, nil, since: date).each { |c| Commit.new(c, h) }
+  end.flatten.uniq { |c| c.id }
+
+  commits.sort! do |x, y|
+    y.committed_date <=> x.committed_date
+  end
+
+  commits
+end
+
+
+ +
+ +
+
+ + commits_with_refs(repo, n = 20) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 40
+def commits_with_refs(repo, n = 20)
+  commits = repo.branches.map { |ref| Commit.new(ref.commit, ref) }
+
+  commits.sort! do |x, y|
+    y.committed_date <=> x.committed_date
+  end
+
+  commits[0..n]
+end
+
+
+ +
+ +
+
+ + compare(project, from, to) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 76
+def compare(project, from, to)
+  result = {
+    commits: [],
+    diffs: [],
+    commit: nil,
+    same: false
+  }
+
+  return result unless from && to
+
+  first = project.commit(to.try(:strip))
+  last = project.commit(from.try(:strip))
+
+  if first && last
+    result[:same] = (first.id == last.id)
+    result[:commits] = project.repo.commits_between(last.id, first.id).map {|c| Commit.new(c)}
+    result[:diffs] = project.repo.diff(last.id, first.id) rescue []
+    result[:commit] = Commit.new(first)
+  end
+
+  result
+end
+
+
+ +
+ +
+
+ + find_or_first(repo, commit_id = nil, root_ref) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 18
+def find_or_first(repo, commit_id = nil, root_ref)
+  commit = if commit_id
+             repo.commit(commit_id)
+           else
+             repo.commits(root_ref).first
+           end
+
+  Commit.new(commit) if commit
+end
+
+
+ +
+ +
+
+ + fresh_commits(repo, n = 10) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 28
+def fresh_commits(repo, n = 10)
+  commits = repo.heads.map do |h|
+    repo.commits(h.name, n).map { |c| Commit.new(c, h) }
+  end.flatten.uniq { |c| c.id }
+
+  commits.sort! do |x, y|
+    y.committed_date <=> x.committed_date
+  end
+
+  commits[0...n]
+end
+
+
+ +
+ +
+
+ + new(raw_commit, head = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 100
+def initialize(raw_commit, head = nil)
+  @commit = raw_commit
+  @head = head
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + author_email() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 117
+def author_email
+  author.email
+end
+
+
+ +
+ +
+
+ + author_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 121
+def author_name
+  author.name
+end
+
+
+ +
+ +
+
+ + committer_email() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 134
+def committer_email
+  committer.email
+end
+
+
+ +
+ +
+
+ + committer_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 130
+def committer_name
+  committer.name
+end
+
+
+ +
+ +
+
+ + created_at() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 113
+def created_at
+  committed_date
+end
+
+
+ +
+ +
+
+ + different_committer?() + + +
+ + +
+

Was this commit committed by a different person than the original author?

+
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 126
+def different_committer?
+  author_name != committer_name || author_email != committer_email
+end
+
+
+ +
+ +
+
+ + parents_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 146
+def parents_count
+  parents && parents.count || 0
+end
+
+
+ +
+ +
+
+ + prev_commit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 138
+def prev_commit
+  parents.try :first
+end
+
+
+ +
+ +
+
+ + prev_commit_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 142
+def prev_commit_id
+  prev_commit.try :id
+end
+
+
+ +
+ +
+
+ + safe_message() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 109
+def safe_message
+  @safe_message ||= message
+end
+
+
+ +
+ +
+
+ + short_id(length = 10) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 105
+def short_id(length = 10)
+  id.to_s[0..length]
+end
+
+
+ +
+ +
+
+ + to_diff() + + +
+ + +
+

Shows the diff between the commit’s parent and the commit.

+ +

Cuts out the header and stats from to_patch and returns only the diff.

+
+ + + + + + +
+ + +
+
# File app/models/commit.rb, line 153
+def to_diff
+  # see Grit::Commit#show
+  patch = to_patch
+
+  # discard lines before the diff
+  lines = patch.split("\n")
+  while !lines.first.start_with?("diff --git") do
+    lines.shift
+  end
+  lines.pop if lines.last =~ %r^[\d.]+$/ # Git version
+  lines.pop if lines.last == "-- "      # end of diff
+  lines.join("\n")
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/CommitController.html b/doc/code/classes/CommitController.html new file mode 100644 index 00000000000..5f0bbe9e9f3 --- /dev/null +++ b/doc/code/classes/CommitController.html @@ -0,0 +1,160 @@ + + + + + CommitController + + + + + + + + + + + + + +
+
+ +
+ +

Controller for a specific Commit

+ +

Not to be confused with CommitsController, plural.

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/commit_controller.rb, line 10
+def show
+  result = CommitLoadContext.new(project, current_user, params).execute
+
+  @commit = result[:commit]
+  git_not_found! unless @commit
+
+  @suppress_diff    = result[:suppress_diff]
+  @note             = result[:note]
+  @line_notes       = result[:line_notes]
+  @notes_count      = result[:notes_count]
+  @comments_allowed = true
+
+  respond_to do |format|
+    format.html do
+      if result[:status] == :huge_commit
+        render "huge_commit" and return
+      end
+    end
+
+    format.diff  { render text: @commit.to_diff }
+    format.patch { render text: @commit.to_patch }
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/CommitDecorator.html b/doc/code/classes/CommitDecorator.html new file mode 100644 index 00000000000..9063057850c --- /dev/null +++ b/doc/code/classes/CommitDecorator.html @@ -0,0 +1,472 @@ + + + + + CommitDecorator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
L
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+ + + +
+

Returns a link to the commit author. If the author has a matching user and +is a member of the current @project it will link to the team member page. +Otherwise it will link to the author email as specified in the commit.

+ +

options:

+ +
avatar: true will prepend the avatar image
+size:   size of the avatar image in px
+
+ + + + + + +
+ + + +
+ +
+ +
+ + + +
+

Just like author_link but for +the committer.

+
+ + + + + + +
+ + + +
+ +
+ +
+
+ + description() + + +
+ + +
+

Returns the commits description

+ +

cut off, ellipses (`&hellp;`) are prepended to the commit message.

+
+ + + + + + +
+ + +
+
# File app/decorators/commit_decorator.rb, line 34
+def description
+  description = safe_message
+
+  title_end = description.index(%r\n/)
+  if (!title_end && description.length > 80) || (title_end && title_end > 80)
+    "&hellip;".html_safe << description[70..-1]
+  else
+    description.split(%r\n/, 2)[1].try(:chomp)
+  end
+end
+
+
+ +
+ +
+ + + +
+

Returns a string describing the commit for use in a link title

+ +

Example

+ +
"Commit: Alex Denisov - Project git clone panel"
+
+ + + + + + +
+ + + +
+ +
+ +
+
+ + title() + + +
+ + +
+

Returns the commits title.

+ +

Usually, the commit title is the first line of the commit message. In case +this first line is longer than 80 characters, it is cut off after 70 +characters and ellipses (`&hellp;`) are appended.

+
+ + + + + + +
+ + +
+
# File app/decorators/commit_decorator.rb, line 18
+def title
+  title = safe_message
+
+  return no_commit_message if title.blank?
+
+  title_end = title.index(%r\n/)
+  if (!title_end && title.length > 80) || (title_end && title_end > 80)
+    title[0..69] << "&hellip;".html_safe
+  else
+    title.split(%r\n/, 2).first
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + no_commit_message() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/commit_decorator.rb, line 63
+def no_commit_message
+  "--no commit message"
+end
+
+
+ +
+ +
+ + + +
+

Private: Returns a link to a person. If the person has a matching user and +is a member of the current @project it will link to the team member page. +Otherwise it will link to the person email as specified in the commit.

+ +

options:

+ +
source: one of :author or :committer
+avatar: true will prepend the avatar image
+size:   size of the avatar image in px
+
+ + + + + + +
+ + + +
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/CommitLoadContext.html b/doc/code/classes/CommitLoadContext.html new file mode 100644 index 00000000000..82c04febe6b --- /dev/null +++ b/doc/code/classes/CommitLoadContext.html @@ -0,0 +1,159 @@ + + + + + CommitLoadContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/commit_load_context.rb, line 2
+def execute
+  result = {
+    commit: nil,
+    suppress_diff: false,
+    line_notes: [],
+    notes_count: 0,
+    note: nil,
+    status: :ok
+  }
+
+  commit = project.commit(params[:id])
+
+  if commit
+    commit = CommitDecorator.decorate(commit)
+    line_notes = project.commit_line_notes(commit)
+
+    result[:commit] = commit
+    result[:note] = project.build_commit_note(commit)
+    result[:line_notes] = line_notes
+    result[:notes_count] = line_notes.count + project.commit_notes(commit).count
+
+    begin
+      result[:suppress_diff] = true if commit.diffs.size > Commit::DIFF_SAFE_SIZE && !params[:force_show_diff]
+    rescue Grit::Git::GitTimeout
+      result[:suppress_diff] = true
+      result[:status] = :huge_commit
+    end
+  end
+
+  result
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/CommitsController.html b/doc/code/classes/CommitsController.html new file mode 100644 index 00000000000..53d329673f8 --- /dev/null +++ b/doc/code/classes/CommitsController.html @@ -0,0 +1,155 @@ + + + + + CommitsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/commits_controller.rb, line 11
+def show
+  @repo = @project.repo
+  @limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
+
+  @commits = @project.commits(@ref, @path, @limit, @offset)
+  @commits = CommitDecorator.decorate(@commits)
+
+  respond_to do |format|
+    format.html # index.html.erb
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/CommitsHelper.html b/doc/code/classes/CommitsHelper.html new file mode 100644 index 00000000000..4e4addfb8ac --- /dev/null +++ b/doc/code/classes/CommitsHelper.html @@ -0,0 +1,409 @@ + + + + + CommitsHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+ +
+ +
I
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + build_line_anchor(index, line_new, line_old) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/commits_helper.rb, line 12
+def build_line_anchor(index, line_new, line_old)
+  "#{index}_#{line_old}_#{line_new}"
+end
+
+
+ +
+ +
+
+ + commit_to_html(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/commits_helper.rb, line 68
+def commit_to_html commit
+  if commit.model
+    escape_javascript(render 'commits/commit', commit: commit)
+  end
+end
+
+
+ +
+ +
+
+ + diff_line_content(line) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/commits_helper.rb, line 74
+def diff_line_content(line)
+  if line.blank?
+    " &nbsp;"
+  else
+    line
+  end
+end
+
+
+ +
+ +
+
+ + each_diff_line(diff_arr, index) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/commits_helper.rb, line 16
+def each_diff_line(diff_arr, index)
+  line_old = 1
+  line_new = 1
+  type = nil
+
+  lines_arr = ::Gitlab::InlineDiff.processing diff_arr
+  lines_arr.each do |line|
+    next if line.match(%r^\-\-\- \/dev\/null/)
+    next if line.match(%r^\+\+\+ \/dev\/null/)
+    next if line.match(%r^\-\-\- a/)
+    next if line.match(%r^\+\+\+ b/)
+
+    full_line = html_escape(line.gsub(%r\n/, ''))
+    full_line = ::Gitlab::InlineDiff.replace_markers full_line
+
+    if line.match(%r^@@ -/)
+      type = "match"
+
+      line_old = line.match(%r\-[0-9]*/)[0].to_i.abs rescue 0
+      line_new = line.match(%r\+[0-9]*/)[0].to_i.abs rescue 0
+
+      next if line_old == 1 && line_new == 1 #top of file
+      yield(full_line, type, nil, nil, nil)
+      next
+    else
+      type = identification_type(line)
+      line_code = build_line_anchor(index, line_new, line_old)
+      yield(full_line, type, line_code, line_new, line_old)
+    end
+
+
+    if line[0] == "+"
+      line_new += 1
+    elsif line[0] == "-"
+      line_old += 1
+    else
+      line_new += 1
+      line_old += 1
+    end
+  end
+end
+
+
+ +
+ +
+
+ + identification_type(line) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/commits_helper.rb, line 2
+def identification_type(line)
+  if line[0] == "+"
+    "new"
+  elsif line[0] == "-"
+    "old"
+  else
+    nil
+  end
+end
+
+
+ +
+ +
+
+ + image_diff_class(diff) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/commits_helper.rb, line 58
+def image_diff_class(diff)
+  if diff.deleted_file
+    "diff_removed"
+  elsif diff.new_file
+    "diff_added"
+  else
+    nil
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/CompareController.html b/doc/code/classes/CompareController.html new file mode 100644 index 00000000000..3db60f969f4 --- /dev/null +++ b/doc/code/classes/CompareController.html @@ -0,0 +1,232 @@ + + + + + CompareController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
I
+
+ +
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/compare_controller.rb, line 22
+def create
+  redirect_to project_compare_path(@project, params[:from], params[:to])
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/compare_controller.rb, line 7
+def index
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/compare_controller.rb, line 10
+def show
+  result = Commit.compare(project, params[:from], params[:to])
+
+  @commits       = result[:commits]
+  @commit        = result[:commit]
+  @diffs         = result[:diffs]
+  @refs_are_same = result[:same]
+  @line_notes    = []
+
+  @commits = CommitDecorator.decorate(@commits)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/DashboardController.html b/doc/code/classes/DashboardController.html new file mode 100644 index 00000000000..ae8b126da1c --- /dev/null +++ b/doc/code/classes/DashboardController.html @@ -0,0 +1,411 @@ + + + + + DashboardController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
E
+
+ +
+ +
I
+
+ +
+ +
M
+
+ +
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/dashboard_controller.rb, line 7
+def index
+  @groups = current_user.authorized_groups
+
+  @has_authorized_projects = @projects.count > 0
+
+  @projects = case params[:scope]
+              when 'personal' then
+                @projects.personal(current_user)
+              when 'joined' then
+                @projects.joined(current_user)
+              else
+                @projects
+              end
+
+  @projects = @projects.page(params[:page]).per(30)
+
+  @events = Event.in_projects(current_user.project_ids)
+  @events = @event_filter.apply_filter(@events)
+  @events = @events.limit(20).offset(params[:offset] || 0)
+
+  @last_push = current_user.recent_push
+
+  respond_to do |format|
+    format.html
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+
+ +
+ +
+
+ + issues() + + +
+ + +
+

Get only assigned issues

+
+ + + + + + +
+ + +
+
# File app/controllers/dashboard_controller.rb, line 44
+def issues
+  @issues = current_user.assigned_issues
+  @issues = dashboard_filter(@issues)
+  @issues = @issues.recent.page(params[:page]).per(20)
+  @issues = @issues.includes(:author, :project)
+
+  respond_to do |format|
+    format.html
+    format.atom { render layout: false }
+  end
+end
+
+
+ +
+ +
+
+ + merge_requests() + + +
+ + +
+

Get authored or assigned open merge requests

+
+ + + + + + +
+ + +
+
# File app/controllers/dashboard_controller.rb, line 37
+def merge_requests
+  @merge_requests = current_user.cared_merge_requests
+  @merge_requests = dashboard_filter(@merge_requests)
+  @merge_requests = @merge_requests.recent.page(params[:page]).per(20)
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + dashboard_filter(items) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/dashboard_controller.rb, line 66
+def dashboard_filter items
+  if params[:project_id]
+    items = items.where(project_id: params[:project_id])
+  end
+
+  if params[:search].present?
+    items = items.search(params[:search])
+  end
+
+  case params[:status]
+  when 'closed'
+    items.closed
+  when 'all'
+    items
+  else
+    items.opened
+  end
+end
+
+
+ +
+ +
+
+ + event_filter() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/dashboard_controller.rb, line 62
+def event_filter
+  @event_filter ||= EventFilter.new(params[:event_filter])
+end
+
+
+ +
+ +
+
+ + projects() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/dashboard_controller.rb, line 58
+def projects
+  @projects = current_user.authorized_projects.sorted_by_activity
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/DashboardHelper.html b/doc/code/classes/DashboardHelper.html new file mode 100644 index 00000000000..6fcb426cf13 --- /dev/null +++ b/doc/code/classes/DashboardHelper.html @@ -0,0 +1,195 @@ + + + + + DashboardHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + dashboard_filter_path(entity, options={}) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/dashboard_helper.rb, line 2
+def dashboard_filter_path(entity, options={})
+  exist_opts = {
+    status: params[:status],
+    project_id: params[:project_id],
+  }
+
+  options = exist_opts.merge(options)
+
+  case entity
+  when 'issue' then
+    dashboard_issues_path(options)
+  when 'merge_request'
+    dashboard_merge_requests_path(options)
+  end
+end
+
+
+ +
+ +
+
+ + entities_per_project(project, entity) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/dashboard_helper.rb, line 18
+def entities_per_project project, entity
+  items = project.items_for(entity)
+
+  items = case params[:status]
+          when 'closed'
+            items.closed
+          when 'all'
+            items
+          else
+            items.opened
+          end
+
+  items.where(assignee_id: current_user.id).count
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/DeployKeysController.html b/doc/code/classes/DeployKeysController.html new file mode 100644 index 00000000000..952d295cded --- /dev/null +++ b/doc/code/classes/DeployKeysController.html @@ -0,0 +1,332 @@ + + + + + DeployKeysController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/deploy_keys_controller.rb, line 21
+def create
+  @key = @project.deploy_keys.new(params[:key])
+  if @key.save
+    redirect_to project_deploy_keys_path(@project)
+  else
+    render "new"
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/deploy_keys_controller.rb, line 30
+def destroy
+  @key = @project.deploy_keys.find(params[:id])
+  @key.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_deploy_keys_url }
+    format.js { render nothing: true }
+  end
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/deploy_keys_controller.rb, line 7
+def index
+  @keys = @project.deploy_keys.all
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/deploy_keys_controller.rb, line 15
+def new
+  @key = @project.deploy_keys.new
+
+  respond_with(@key)
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/deploy_keys_controller.rb, line 11
+def show
+  @key = @project.deploy_keys.find(params[:id])
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ErrorsController.html b/doc/code/classes/ErrorsController.html new file mode 100644 index 00000000000..b03cc04c9bd --- /dev/null +++ b/doc/code/classes/ErrorsController.html @@ -0,0 +1,131 @@ + + + + + ErrorsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
G
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + githost() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/errors_controller.rb, line 2
+def githost
+  render "errors/gitolite"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Event.html b/doc/code/classes/Event.html new file mode 100644 index 00000000000..608db59979c --- /dev/null +++ b/doc/code/classes/Event.html @@ -0,0 +1,1266 @@ + + + + + Event + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: events

+ +
id          :integer          not null, primary key
+target_type :string(255)
+target_id   :integer
+title       :string(255)
+data        :text
+project_id  :integer
+created_at  :datetime         not null
+updated_at  :datetime         not null
+action      :integer
+author_id   :integer
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
J
+
+ +
+ +
L
+
+ +
+ +
M
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
T
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Created=1
 
Updated=2
 
Closed=3
 
Reopened=4
 
Pushed=5
 
Commented=6
 
Merged=7
 
Joined=8
 
Left=9
 
+ + + + + + + + +
Class Public methods
+ +
+
+ + determine_action(record) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 53
+def determine_action(record)
+  if [Issue, MergeRequest].include? record.class
+    Event::Created
+  elsif record.kind_of? Note
+    Event::Commented
+  end
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + action_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 160
+def action_name
+  if closed?
+    "closed"
+  elsif merged?
+    "merged"
+  elsif joined?
+    'joined'
+  elsif left?
+    'left'
+  else
+    "opened"
+  end
+end
+
+
+ +
+ +
+
+ + author() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 156
+def author
+  @author ||= User.find(author_id)
+end
+
+
+ +
+ +
+
+ + changed_issue?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 131
+def changed_issue?
+  target_type == "Issue" &&
+    [Closed, Reopened].include?(action)
+end
+
+
+ +
+ +
+
+ + changed_merge_request?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 126
+def changed_merge_request?
+  target_type == "MergeRequest" &&
+    [Closed, Reopened].include?(action)
+end
+
+
+ +
+ +
+
+ + closed?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 92
+def closed?
+  action == self.class::Closed
+end
+
+
+ +
+ +
+
+ + issue() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 148
+def issue
+  target if target_type == "Issue"
+end
+
+
+ +
+ +
+
+ + issue?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 108
+def issue?
+  target_type == "Issue"
+end
+
+
+ +
+ +
+
+ + joined?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 136
+def joined?
+  action == Joined
+end
+
+
+ +
+ +
+
+ + left?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 140
+def left?
+  action == Left
+end
+
+
+ +
+ +
+
+ + membership_changed?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 144
+def membership_changed?
+  joined? || left?
+end
+
+
+ +
+ +
+
+ + merge_request() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 152
+def merge_request
+  target if target_type == "MergeRequest"
+end
+
+
+ +
+ +
+
+ + merge_request?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 112
+def merge_request?
+  target_type == "MergeRequest"
+end
+
+
+ +
+ +
+
+ + merged?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 88
+def merged?
+  action == self.class::Merged
+end
+
+
+ +
+ +
+
+ + milestone?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 100
+def milestone?
+  target_type == "Milestone"
+end
+
+
+ +
+ +
+
+ + new_issue?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 116
+def new_issue?
+  target_type == "Issue" &&
+    action == Created
+end
+
+
+ +
+ +
+
+ + new_merge_request?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 121
+def new_merge_request?
+  target_type == "MergeRequest" &&
+    action == Created
+end
+
+
+ +
+ +
+
+ + note?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 104
+def note?
+  target_type == "Note"
+end
+
+
+ +
+ +
+
+ + project_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 72
+def project_name
+  if project
+    project.name
+  else
+    "(deleted project)"
+  end
+end
+
+
+ +
+ +
+
+ + proper?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 62
+def proper?
+  if push?
+    true
+  elsif membership_changed?
+    true
+  else
+    (issue? || merge_request? || note? || milestone?) && target
+  end
+end
+
+
+ +
+ +
+
+ + push?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 84
+def push?
+  action == self.class::Pushed && valid_push?
+end
+
+
+ +
+ +
+
+ + reopened?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 96
+def reopened?
+  action == self.class::Reopened
+end
+
+
+ +
+ +
+
+ + target_title() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/event.rb, line 80
+def target_title
+  target.try :title
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/EventDecorator.html b/doc/code/classes/EventDecorator.html new file mode 100644 index 00000000000..1fdf7f5c4e4 --- /dev/null +++ b/doc/code/classes/EventDecorator.html @@ -0,0 +1,240 @@ + + + + + EventDecorator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
F
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + feed_summary() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/event_decorator.rb, line 37
+def feed_summary
+  if self.issue?
+    h.render "events/event_issue", issue: self.issue
+  elsif self.push?
+    h.render "events/event_push", event: self
+  end
+end
+
+
+ +
+ +
+
+ + feed_title() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/event_decorator.rb, line 4
+def feed_title
+  if self.issue?
+    "#{self.author_name} #{self.action_name} issue ##{self.target_id}: #{self.issue_title} at #{self.project.name}"
+  elsif self.merge_request?
+    "#{self.author_name} #{self.action_name} MR ##{self.target_id}: #{self.merge_request_title} at #{self.project.name}"
+  elsif self.push?
+    "#{self.author_name} #{self.push_action_name} #{self.ref_type} #{self.ref_name} at #{self.project.name}"
+  elsif self.membership_changed?
+    "#{self.author_name} #{self.action_name} #{self.project.name}"
+  else
+    ""
+  end
+end
+
+
+ +
+ +
+
+ + feed_url() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/event_decorator.rb, line 18
+def feed_url
+  if self.issue?
+    h.project_issue_url(self.project, self.issue)
+  elsif self.merge_request?
+    h.project_merge_request_url(self.project, self.merge_request)
+
+  elsif self.push?
+    if self.push_with_commits?
+      if self.commits_count > 1
+        h.project_compare_url(self.project, :from => self.parent_commit.id, :to => self.last_commit.id)
+      else
+        h.project_commit_url(self.project, :id => self.last_commit.id)
+      end
+    else
+      h.project_commits_url(self.project, self.ref_name)
+    end
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/EventFilter.html b/doc/code/classes/EventFilter.html new file mode 100644 index 00000000000..5bf01133d6e --- /dev/null +++ b/doc/code/classes/EventFilter.html @@ -0,0 +1,543 @@ + + + + + EventFilter + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
O
+
+ +
+ +
P
+
+
    + + +
  • + push +
  • + +
+
+ +
T
+
+
    + + +
  • + team +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + params
+ + + + + +
Class Public methods
+ +
+
+ + comments() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 17
+def comments
+  'comments'
+end
+
+
+ +
+ +
+
+ + default_filter() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 5
+def default_filter
+  %w{ push issues merge_requests team}
+end
+
+
+ +
+ +
+
+ + merged() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 13
+def merged
+  'merged'
+end
+
+
+ +
+ +
+
+ + new(params) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 26
+def initialize params
+  @params = if params
+              params.dup
+            else
+              []#EventFilter.default_filter
+            end
+end
+
+
+ +
+ +
+
+ + push() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 9
+def push
+  'push'
+end
+
+
+ +
+ +
+
+ + team() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 21
+def team
+  'team'
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + active?(key) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 65
+def active? key
+  params.include? key
+end
+
+
+ +
+ +
+
+ + apply_filter(events) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 34
+def apply_filter events
+  return events unless params.present?
+
+  filter = params.dup
+
+  actions = []
+  actions << Event::Pushed if filter.include? 'push'
+  actions << Event::Merged if filter.include? 'merged'
+
+  if filter.include? 'team'
+    actions << Event::Joined
+    actions << Event::Left
+  end
+
+  actions << Event::Commented if filter.include? 'comments'
+
+  events = events.where(action: actions)
+end
+
+
+ +
+ +
+
+ + options(key) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/event_filter.rb, line 53
+def options key
+  filter = params.dup
+
+  if filter.include? key
+    filter.delete key
+  else
+    filter << key
+  end
+
+  filter
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/EventsHelper.html b/doc/code/classes/EventsHelper.html new file mode 100644 index 00000000000..7c7041c6698 --- /dev/null +++ b/doc/code/classes/EventsHelper.html @@ -0,0 +1,289 @@ + + + + + EventsHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
L
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + event_action_name(event) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/events_helper.rb, line 13
+def event_action_name(event)
+  target = if event.target_type
+             event.target_type.titleize.downcase
+           else
+             'project'
+           end
+
+  [event.action_name, target].join(" ")
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + + +
+ +
+ +
+
+ + event_image(event) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/events_helper.rb, line 23
+def event_image event
+  event_image_path = if event.push?
+                 "event_push.png"
+               elsif event.merged?
+                 "event_mr_merged.png"
+               end
+
+  return nil unless event_image_path
+
+  content_tag :div, class: 'event_icon' do
+    image_tag event_image_path
+  end
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + + +
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ExtractsPath.html b/doc/code/classes/ExtractsPath.html new file mode 100644 index 00000000000..0b8c0c26f99 --- /dev/null +++ b/doc/code/classes/ExtractsPath.html @@ -0,0 +1,300 @@ + + + + + ExtractsPath + + + + + + + + + + + + + +
+
+ +
+ +

Module providing methods for dealing with separating a tree-ish string and +a file path string when combined in a request parameter

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
A
+
+ +
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + assign_ref_vars() + + +
+ + +
+

Assigns common instance variables for views working with Git tree-ish +objects

+ +

Assignments are:

+
  • +

    @id - A string representing the joined ref and path

    +
  • +

    @ref - A string representing the ref (e.g., the branch, tag, or commit +SHA)

    +
  • +

    @path - A string representing the filesystem path

    +
  • +

    @commit - A CommitDecorator representing +the commit from the given ref

    +
  • +

    @tree - A TreeDecorator representing the +tree at the given ref/path

    +
+ +

If the :id parameter appears to be requesting a specific response format, +that will be handled as well.

+ +

Automatically renders `not_found!` if a valid tree path could not be +resolved (e.g., when a user inserts an invalid path or ref).

+
+ + + + + + +
+ + +
+
# File lib/extracts_path.rb, line 104
+def assign_ref_vars
+  # Handle formats embedded in the id
+  if params[:id].ends_with?('.atom')
+    params[:id].gsub!(%r\.atom$/, '')
+    request.format = :atom
+  end
+
+  @ref, @path = extract_ref(request.fullpath)
+
+  @id = File.join(@ref, @path)
+
+  @commit = CommitDecorator.decorate(@project.commit(@ref))
+
+  @tree = Tree.new(@commit.tree, @project, @ref, @path)
+  @tree = TreeDecorator.new(@tree)
+
+  raise InvalidPathError if @tree.invalid?
+rescue NoMethodError, InvalidPathError
+  not_found!
+end
+
+
+ +
+ +
+
+ + extract_ref(input) + + +
+ + +
+

Given a string containing both a Git tree-ish, such as a branch or tag, and +a filesystem path joined by forward slashes, attempts to separate the two.

+ +

Expects a @project instance variable to contain the active project. This is +used to check the input against a list of valid repository refs.

+ +

Examples

+ +
# No @project available
+extract_ref('master')
+# => ['', '']
+
+extract_ref('master')
+# => ['master', '']
+
+extract_ref("f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG")
+# => ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG']
+
+extract_ref("v2.0.0/README.md")
+# => ['v2.0.0', 'README.md']
+
+extract_ref('/gitlab/vagrant/tree/master/app/models/project.rb')
+# => ['master', 'app/models/project.rb']
+
+extract_ref('issues/1234/app/models/project.rb')
+# => ['issues/1234', 'app/models/project.rb']
+
+# Given an invalid branch, we fall back to just splitting on the first slash
+extract_ref('non/existent/branch/README.md')
+# => ['non', 'existent/branch/README.md']
+
+ +

Returns an Array where the first value is the tree-ish and the second is +the path

+
+ + + + + + +
+ + +
+
# File lib/extracts_path.rb, line 48
+def extract_ref(input)
+  pair = ['', '']
+
+  return pair unless @project
+
+  # Remove project, actions and all other staff from path
+  input.gsub!("/#{@project.path_with_namespace}", "")
+  input.gsub!(%r^\/(tree|commits|blame|blob)\//, "") # remove actions
+  input.gsub!(%r\?.*$/, "") # remove stamps suffix
+  input.gsub!(%r.atom$/, "") # remove rss feed
+  input.gsub!(%r\/edit$/, "") # remove edit route part
+
+  if input.match(%r^([[:alnum:]]{40})(.+)/)
+    # If the ref appears to be a SHA, we're done, just split the string
+    pair = $~.captures
+  else
+    # Otherwise, attempt to detect the ref using a list of the project's
+    # branches and tags
+
+    # Append a trailing slash if we only get a ref and no file path
+    id = input
+    id += '/' unless id.ends_with?('/')
+
+    valid_refs = @project.ref_names
+    valid_refs.select! { |v| id.start_with?("#{v}/") }
+
+    if valid_refs.length != 1
+      # No exact ref match, so just try our best
+      pair = id.match(%r([^\/]+)(.*)/).captures
+    else
+      # Partition the string into the ref and the path, ignoring the empty first value
+      pair = id.partition(valid_refs.first)[1..-1]
+    end
+  end
+
+  # Remove ending slashes from path
+  pair[1].gsub!(%r^\/|\/$/, '')
+
+  pair
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ExtractsPath/InvalidPathError.html b/doc/code/classes/ExtractsPath/InvalidPathError.html new file mode 100644 index 00000000000..67632e3b9ea --- /dev/null +++ b/doc/code/classes/ExtractsPath/InvalidPathError.html @@ -0,0 +1,82 @@ + + + + + ExtractsPath::InvalidPathError + + + + + + + + + + + + + +
+
+ +
+ +

Raised when given an invalid file path

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/FileSizeValidator.html b/doc/code/classes/FileSizeValidator.html new file mode 100644 index 00000000000..b1da2752f52 --- /dev/null +++ b/doc/code/classes/FileSizeValidator.html @@ -0,0 +1,376 @@ + + + + + FileSizeValidator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
C
+
+ +
+ +
H
+
+
    + + +
  • + help +
  • + +
+
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
V
+
+ +
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MESSAGES={ is: :wrong_size, minimum: :size_too_small, maximum: :size_too_big }.freeze
 
CHECKS={ is: :==, minimum: :>=, maximum: :<= }.freeze
 
DEFAULT_TOKENIZER=lambda { |value| value.split(//) }
 
RESERVED_OPTIONS=[:minimum, :maximum, :within, :is, :tokenizer, :too_short, :too_long]
 
+ + + + + + + + +
Class Public methods
+ +
+
+ + new(options) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/file_size_validator.rb, line 8
+def initialize(options)
+  if range = (options.delete(:in) || options.delete(:within))
+    raise ArgumentError, ":in and :within must be a Range" unless range.is_a?(Range)
+    options[:minimum], options[:maximum] = range.begin, range.end
+    options[:maximum] -= 1 if range.exclude_end?
+  end
+
+  super
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + check_validity!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/file_size_validator.rb, line 18
+def check_validity!
+  keys = CHECKS.keys & options.keys
+
+  if keys.empty?
+    raise ArgumentError, 'Range unspecified. Specify the :within, :maximum, :minimum, or :is option.'
+  end
+
+  keys.each do |key|
+    value = options[key]
+
+    unless value.is_a?(Integer) && value >= 0
+      raise ArgumentError, ":#{key} must be a nonnegative Integer"
+    end
+  end
+end
+
+
+ +
+ +
+
+ + help() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/file_size_validator.rb, line 57
+def help
+  Helper.instance
+end
+
+
+ +
+ +
+
+ + validate_each(record, attribute, value) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/file_size_validator.rb, line 34
+def validate_each(record, attribute, value)
+  raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
+
+  value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
+
+  CHECKS.each do |key, validity_check|
+    next unless check_value = options[key]
+
+    value ||= [] if key == :maximum
+
+    value_size = value.size
+    next if value_size.send(validity_check, check_value)
+
+    errors_options = options.except(*RESERVED_OPTIONS)
+    errors_options[:file_size] = help.number_to_human_size check_value
+
+    default_message = options[MESSAGES[key]]
+    errors_options[:message] ||= default_message if default_message
+
+    record.errors.add(attribute, MESSAGES[key], errors_options)
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/FileSizeValidator/Helper.html b/doc/code/classes/FileSizeValidator/Helper.html new file mode 100644 index 00000000000..c11d89b3f2c --- /dev/null +++ b/doc/code/classes/FileSizeValidator/Helper.html @@ -0,0 +1,94 @@ + + + + + FileSizeValidator::Helper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
Included Modules
+
    + +
  • + + Singleton + +
  • + +
  • + + ActionView::Helpers::NumberHelper + +
  • + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/GitHost.html b/doc/code/classes/GitHost.html new file mode 100644 index 00000000000..52ea8b32d4f --- /dev/null +++ b/doc/code/classes/GitHost.html @@ -0,0 +1,125 @@ + + + + + GitHost + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
G
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + git_host() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/git_host.rb, line 2
+def git_host
+  Gitlab::Gitolite.new
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab.html b/doc/code/classes/Gitlab.html new file mode 100644 index 00000000000..5127be6e4db --- /dev/null +++ b/doc/code/classes/Gitlab.html @@ -0,0 +1,265 @@ + + + + + Gitlab + + + + + + + + + + + + + +
+
+ +
+ +

ProjectMover class

+ +

Used for moving project repositories from one subdir to another

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/API.html b/doc/code/classes/Gitlab/API.html new file mode 100644 index 00000000000..fe2ccc76ebe --- /dev/null +++ b/doc/code/classes/Gitlab/API.html @@ -0,0 +1,76 @@ + + + + + Gitlab::API + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/APIHelpers.html b/doc/code/classes/Gitlab/APIHelpers.html new file mode 100644 index 00000000000..603443dda2b --- /dev/null +++ b/doc/code/classes/Gitlab/APIHelpers.html @@ -0,0 +1,703 @@ + + + + + Gitlab::APIHelpers + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + attributes_for_keys(keys) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 44
+def attributes_for_keys(keys)
+  attrs = {}
+  keys.each do |key|
+    attrs[key] = params[key] if params[key].present?
+  end
+  attrs
+end
+
+
+ +
+ +
+
+ + authenticate!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 26
+def authenticate!
+  unauthorized! unless current_user
+end
+
+
+ +
+ +
+
+ + authenticated_as_admin!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 30
+def authenticated_as_admin!
+  forbidden! unless current_user.is_admin?
+end
+
+
+ +
+ +
+
+ + authorize!(action, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 34
+def authorize! action, subject
+  unless abilities.allowed?(current_user, action, subject)
+    forbidden!
+  end
+end
+
+
+ +
+ +
+
+ + can?(object, action, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 40
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+
+ +
+ +
+
+ + current_user() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 3
+def current_user
+  @current_user ||= User.find_by_authentication_token(params[:private_token] || env["HTTP_PRIVATE_TOKEN"])
+end
+
+
+ +
+ +
+
+ + find_project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 12
+def find_project
+  project = Project.find_by_id(params[:id]) || Project.find_with_namespace(params[:id])
+
+  if project && can?(current_user, :read_project, project)
+    project
+  else
+    nil
+  end
+end
+
+
+ +
+ +
+
+ + forbidden!() + + +
+ + +
+

error helpers

+
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 54
+def forbidden!
+  render_api_error!('403 Forbidden', 403)
+end
+
+
+ +
+ +
+
+ + not_allowed!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 69
+def not_allowed!
+  render_api_error!('Method Not Allowed', 405)
+end
+
+
+ +
+ +
+
+ + not_found!(resource = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 58
+def not_found!(resource = nil)
+  message = ["404"]
+  message << resource if resource
+  message << "Not Found"
+  render_api_error!(message.join(' '), 404)
+end
+
+
+ +
+ +
+
+ + paginate(object) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 22
+def paginate(object)
+  object.page(params[:page]).per(params[:per_page].to_i)
+end
+
+
+ +
+ +
+
+ + render_api_error!(message, status) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 73
+def render_api_error!(message, status)
+  error!({'message' => message}, status)
+end
+
+
+ +
+ +
+
+ + unauthorized!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 65
+def unauthorized!
+  render_api_error!('401 Unauthorized', 401)
+end
+
+
+ +
+ +
+
+ + user_project() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/api/helpers.rb, line 7
+def user_project
+  @project ||= find_project
+  @project || not_found!
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/AppLogger.html b/doc/code/classes/Gitlab/AppLogger.html new file mode 100644 index 00000000000..2f4dc5349e3 --- /dev/null +++ b/doc/code/classes/Gitlab/AppLogger.html @@ -0,0 +1,173 @@ + + + + + Gitlab::AppLogger + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
F
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + file_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/app_logger.rb, line 3
+def self.file_name
+  'application.log'
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + format_message(severity, timestamp, progname, msg) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/app_logger.rb, line 7
+def format_message(severity, timestamp, progname, msg)
+  "#{timestamp.to_s(:long)}: #{msg}\n"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Application.html b/doc/code/classes/Gitlab/Application.html new file mode 100644 index 00000000000..c8a1e3c2698 --- /dev/null +++ b/doc/code/classes/Gitlab/Application.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Application + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Auth.html b/doc/code/classes/Gitlab/Auth.html new file mode 100644 index 00000000000..4eeb3fecbc5 --- /dev/null +++ b/doc/code/classes/Gitlab/Auth.html @@ -0,0 +1,315 @@ + + + + + Gitlab::Auth + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
F
+
+ +
+ +
L
+
+
    + + +
  • + log +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create_from_omniauth(auth, ldap = false) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/auth.rb, line 20
+def create_from_omniauth(auth, ldap = false)
+  provider = auth.provider
+  uid = auth.info.uid || auth.uid
+  name = auth.info.name.force_encoding("utf-8")
+  email = auth.info.email.downcase unless auth.info.email.nil?
+
+  ldap_prefix = ldap ? '(LDAP) ' : ''
+  raise OmniAuth::Error, "#{ldap_prefix}#{provider} does not provide an email"         " address" if auth.info.email.blank?
+
+  log.info "#{ldap_prefix}Creating user from #{provider} login"         " {uid => #{uid}, name => #{name}, email => #{email}}"
+  password = Devise.friendly_token[0, 8].downcase
+  @user = User.new({
+    extern_uid: uid,
+    provider: provider,
+    name: name,
+    username: email.match(%r^[^@]*/)[0],
+    email: email,
+    password: password,
+    password_confirmation: password,
+    projects_limit: Gitlab.config.gitlab.default_projects_limit,
+  }, as: :admin)
+  if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
+    @user.blocked = true
+  end
+  @user.save!
+  @user
+end
+
+
+ +
+ +
+
+ + find_for_ldap_auth(auth, signed_in_resource = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/auth.rb, line 3
+def find_for_ldap_auth(auth, signed_in_resource = nil)
+  uid = auth.info.uid
+  provider = auth.provider
+  email = auth.info.email.downcase unless auth.info.email.nil?
+  raise OmniAuth::Error, "LDAP accounts must provide an uid and email address" if uid.nil? or email.nil?
+
+  if @user = User.find_by_extern_uid_and_provider(uid, provider)
+    @user
+  elsif @user = User.find_by_email(email)
+    log.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}"
+    @user.update_attributes(:extern_uid => uid, :provider => provider)
+    @user
+  else
+    create_from_omniauth(auth, true)
+  end
+end
+
+
+ +
+ +
+
+ + find_or_new_for_omniauth(auth) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/auth.rb, line 50
+def find_or_new_for_omniauth(auth)
+  provider, uid = auth.provider, auth.uid
+  email = auth.info.email.downcase unless auth.info.email.nil?
+
+  if @user = User.find_by_provider_and_extern_uid(provider, uid)
+    @user
+  elsif @user = User.find_by_email(email)
+    @user.update_attributes(:extern_uid => uid, :provider => provider)
+    @user
+  else
+    if Gitlab.config.omniauth['allow_single_sign_on']
+      @user = create_from_omniauth(auth)
+      @user
+    end
+  end
+end
+
+
+ +
+ +
+
+ + log() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/auth.rb, line 67
+def log
+  Gitlab::AppLogger
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities.html b/doc/code/classes/Gitlab/Entities.html new file mode 100644 index 00000000000..8cb9ed35679 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities.html @@ -0,0 +1,151 @@ + + + + + Gitlab::Entities + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/Hook.html b/doc/code/classes/Gitlab/Entities/Hook.html new file mode 100644 index 00000000000..a42cc91d4a3 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/Hook.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::Hook + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/Issue.html b/doc/code/classes/Gitlab/Entities/Issue.html new file mode 100644 index 00000000000..432c6f4bc14 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/Issue.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::Issue + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/MRNote.html b/doc/code/classes/Gitlab/Entities/MRNote.html new file mode 100644 index 00000000000..e05a43b8e54 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/MRNote.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::MRNote + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/MergeRequest.html b/doc/code/classes/Gitlab/Entities/MergeRequest.html new file mode 100644 index 00000000000..e68077163e7 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/MergeRequest.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::MergeRequest + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/Milestone.html b/doc/code/classes/Gitlab/Entities/Milestone.html new file mode 100644 index 00000000000..3c375faa8fb --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/Milestone.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::Milestone + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/Note.html b/doc/code/classes/Gitlab/Entities/Note.html new file mode 100644 index 00000000000..f0ba6567df5 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/Note.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::Note + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/Project.html b/doc/code/classes/Gitlab/Entities/Project.html new file mode 100644 index 00000000000..a111b19ffd2 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/Project.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::Project + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/ProjectMember.html b/doc/code/classes/Gitlab/Entities/ProjectMember.html new file mode 100644 index 00000000000..151abf270d2 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/ProjectMember.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::ProjectMember + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/ProjectSnippet.html b/doc/code/classes/Gitlab/Entities/ProjectSnippet.html new file mode 100644 index 00000000000..61259d0c0d1 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/ProjectSnippet.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::ProjectSnippet + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/RepoCommit.html b/doc/code/classes/Gitlab/Entities/RepoCommit.html new file mode 100644 index 00000000000..3d181a6f268 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/RepoCommit.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::RepoCommit + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/RepoObject.html b/doc/code/classes/Gitlab/Entities/RepoObject.html new file mode 100644 index 00000000000..ee6a10e7a6a --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/RepoObject.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::RepoObject + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/SSHKey.html b/doc/code/classes/Gitlab/Entities/SSHKey.html new file mode 100644 index 00000000000..cbc4d1a3a6b --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/SSHKey.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::SSHKey + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/User.html b/doc/code/classes/Gitlab/Entities/User.html new file mode 100644 index 00000000000..5c29667639e --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/User.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::User + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/UserBasic.html b/doc/code/classes/Gitlab/Entities/UserBasic.html new file mode 100644 index 00000000000..a17b808def4 --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/UserBasic.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::UserBasic + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Entities/UserLogin.html b/doc/code/classes/Gitlab/Entities/UserLogin.html new file mode 100644 index 00000000000..d73be2ca6ca --- /dev/null +++ b/doc/code/classes/Gitlab/Entities/UserLogin.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Entities::UserLogin + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/GitLogger.html b/doc/code/classes/Gitlab/GitLogger.html new file mode 100644 index 00000000000..19018c0fc7c --- /dev/null +++ b/doc/code/classes/Gitlab/GitLogger.html @@ -0,0 +1,173 @@ + + + + + Gitlab::GitLogger + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
F
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + file_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_logger.rb, line 3
+def self.file_name
+  'githost.log'
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + format_message(severity, timestamp, progname, msg) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_logger.rb, line 7
+def format_message(severity, timestamp, progname, msg)
+  "#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/GitStats.html b/doc/code/classes/Gitlab/GitStats.html new file mode 100644 index 00000000000..fabe18bb4d7 --- /dev/null +++ b/doc/code/classes/Gitlab/GitStats.html @@ -0,0 +1,506 @@ + + + + + Gitlab::GitStats + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
G
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [RW] + ref
+ [RW] + repo
+ + + + + +
Class Public methods
+ +
+
+ + new(repo, ref) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 5
+def initialize repo, ref
+  @repo, @ref = repo, ref
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + authors() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 9
+def authors
+  @authors ||= collect_authors
+end
+
+
+ +
+ +
+
+ + authors_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 22
+def authors_count
+  authors.size
+end
+
+
+ +
+ +
+
+ + commits_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 13
+def commits_count
+  @commits_count ||= repo.commit_count(ref)
+end
+
+
+ +
+ +
+
+ + files_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 17
+def files_count
+  args = [ref, '-r', '--name-only' ]
+  repo.git.run(nil, 'ls-tree', nil, {}, args).split("\n").count
+end
+
+
+ +
+ +
+
+ + graph() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 26
+def graph
+  @graph ||= build_graph
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + build_graph(n = 4) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 54
+def build_graph n = 4
+  from, to = (Date.today - n.weeks), Date.today
+  args = ['--all', "--since=#{from.to_s(:date)}", '--format=%ad' ]
+  rev_list = repo.git.run(nil, 'rev-list', nil, {}, args).split("\n")
+
+  commits_dates = rev_list.values_at(* rev_list.each_index.select {|i| i.odd?})
+  commits_dates = commits_dates.map { |date_str| Time.parse(date_str).to_date.to_s(:date) }
+
+  commits_per_day = from.upto(to).map do |day|
+    commits_dates.count(day.to_date.to_s(:date))
+  end
+
+  OpenStruct.new(
+    labels: from.upto(to).map { |day| day.stamp('Aug 23') },
+    commits: commits_per_day,
+    weeks: n
+  )
+end
+
+
+ +
+ +
+
+ + collect_authors() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/git_stats.rb, line 32
+def collect_authors
+  shortlog = repo.git.shortlog({e: true, s: true }, ref)
+
+  authors = []
+
+  lines = shortlog.split("\n")
+
+  lines.each do |line|
+    data = line.split("\t")
+    commits = data.first
+    author = Grit::Actor.from_string(data.last)
+
+    authors << OpenStruct.new(
+      name: author.name,
+      email: author.email,
+      commits: commits.to_i
+    )
+  end
+
+  authors.sort_by(&:commits).reverse
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Gitolite.html b/doc/code/classes/Gitlab/Gitolite.html new file mode 100644 index 00000000000..8cf9c58c375 --- /dev/null +++ b/doc/code/classes/Gitlab/Gitolite.html @@ -0,0 +1,536 @@ + + + + + Gitlab::Gitolite + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
C
+
+ +
+ +
E
+
+ +
+ +
M
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + config() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 7
+def config
+  Gitlab::GitoliteConfig.new
+end
+
+
+ +
+ +
+
+ + create_repository(project) + + +
+ + +
+ +
+ + + + + +
+ +
+
+ + enable_automerge() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 44
+def enable_automerge
+  config.admin_all_repo!
+end
+
+
+ +
+ +
+
+ + move_repository(old_repo, project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 29
+def move_repository(old_repo, project)
+  config.apply do |config|
+    config.clean_repo(old_repo)
+    config.update_project(project)
+  end
+end
+
+
+ +
+ +
+
+ + remove_key(key_id, projects) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 18
+def remove_key key_id, projects
+  config.apply do |config|
+    config.rm_key(key_id)
+    config.update_projects(projects)
+  end
+end
+
+
+ +
+ +
+
+ + remove_repository(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 36
+def remove_repository project
+  config.destroy_project!(project)
+end
+
+
+ +
+ +
+
+ + set_key(key_id, key_content, projects) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 11
+def set_key key_id, key_content, projects
+  config.apply do |config|
+    config.write_key(key_id, key_content)
+    config.update_projects(projects)
+  end
+end
+
+
+ +
+ +
+
+ + update_repositories(projects) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 48
+def update_repositories projects
+  config.apply do |config|
+    config.update_projects(projects)
+  end
+end
+
+
+ +
+ +
+
+ + update_repository(project) + + +
+ + +
+ +
+ + + +
+ Also aliased as: create_repository +
+ + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 25
+def update_repository project
+  config.update_project!(project)
+end
+
+
+ +
+ +
+
+ + url_to_repo(path) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite.rb, line 40
+def url_to_repo path
+  Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Gitolite/AccessDenied.html b/doc/code/classes/Gitlab/Gitolite/AccessDenied.html new file mode 100644 index 00000000000..8a45dae1ba2 --- /dev/null +++ b/doc/code/classes/Gitlab/Gitolite/AccessDenied.html @@ -0,0 +1,76 @@ + + + + + Gitlab::Gitolite::AccessDenied + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/GitoliteConfig.html b/doc/code/classes/Gitlab/GitoliteConfig.html new file mode 100644 index 00000000000..11026f5ca44 --- /dev/null +++ b/doc/code/classes/Gitlab/GitoliteConfig.html @@ -0,0 +1,810 @@ + + + + + Gitlab::GitoliteConfig + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
L
+
+
    + + +
  • + log +
  • + +
+
+ +
R
+
+ +
+ +
U
+
+ +
+ +
W
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + +
+ [R] + conf
+ [R] + config_tmp_dir
+ [R] + ga_repo
+ + + + + +
Instance Public methods
+ +
+
+ + admin_all_repo() + + +
+ + +
+

Enable access to all repos for gitolite admin. We use it for accept merge +request feature

+
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 169
+def admin_all_repo
+  owner_name = Gitlab.config.gitolite.admin_key
+
+  # @ALL repos premission for gitolite owner
+  repo_name = "@all"
+  repo = if conf.has_repo?(repo_name)
+           conf.get_repo(repo_name)
+         else
+           ::Gitolite::Config::Repo.new(repo_name)
+         end
+
+  repo.add_permission("RW+", "", owner_name)
+  conf.add_repo(repo, true)
+end
+
+
+ +
+ +
+
+ + admin_all_repo!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 184
+def admin_all_repo!
+  apply { |config| config.admin_all_repo }
+end
+
+
+ +
+ +
+
+ + apply() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 23
+def apply
+  Timeout::timeout(30) do
+    File.open(Rails.root.join('tmp', "gitlabhq-gitolite.lock"), "w+") do |f|
+      begin
+        # Set exclusive lock
+        # to prevent race condition
+        f.flock(File::LOCK_EX)
+
+        # Pull gitolite-admin repo
+        # in tmp dir before do any changes
+        pull(config_tmp_dir)
+
+        # Build ga_repo object and @conf
+        # to access gitolite-admin configuration
+        @conf = ga_repo.config
+
+        # Do any changes
+        # in gitolite-admin
+        # config here
+        yield(self)
+
+        # Save changes in
+        # gitolite-admin repo
+        # before push it
+        ga_repo.save
+
+        # Push gitolite-admin repo
+        # to apply all changes
+        push(config_tmp_dir)
+      ensure
+        # Remove tmp dir
+        # removing the gitolite folder first is important to avoid
+        # NFS issues.
+        FileUtils.rm_rf(File.join(config_tmp_dir, 'gitolite'))
+
+        # Remove parent tmp dir
+        FileUtils.rm_rf(config_tmp_dir)
+
+        # Unlock so other task can access
+        # gitolite configuration
+        f.flock(File::LOCK_UN)
+      end
+    end
+  end
+rescue PullError => ex
+  log("Pull error ->  " + ex.message)
+  raise Gitolite::AccessDenied, ex.message
+
+rescue PushError => ex
+  log("Push error ->  " + " " + ex.message)
+  raise Gitolite::AccessDenied, ex.message
+
+rescue Exception => ex
+  log(ex.class.name + " " + ex.message)
+  raise Gitolite::AccessDenied.new("gitolite timeout")
+end
+
+
+ +
+ +
+
+ + clean_repo(repo_name) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 89
+def clean_repo repo_name
+  conf.rm_repo(repo_name)
+end
+
+
+ +
+ +
+
+ + destroy_project(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 84
+def destroy_project(project)
+  FileUtils.rm_rf(project.path_to_repo)
+  conf.rm_repo(project.path_with_namespace)
+end
+
+
+ +
+ +
+
+ + destroy_project!(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 93
+def destroy_project!(project)
+  apply do |config|
+    config.destroy_project(project)
+  end
+end
+
+
+ +
+ +
+
+ + log(message) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 80
+def log message
+  Gitlab::GitLogger.error(message)
+end
+
+
+ +
+ +
+
+ + rm_key(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 105
+def rm_key(user)
+  key_path = File.join(config_tmp_dir, 'gitolite/keydir', "#{user}.pub")
+  ga_key = ::Gitolite::SSHKey.from_file(key_path)
+  ga_repo.rm_key(ga_key)
+end
+
+
+ +
+ +
+
+ + update_project(project) + + +
+ + +
+

update or create

+
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 112
+def update_project(project)
+  repo = update_project_config(project, conf)
+  conf.add_repo(repo, true)
+end
+
+
+ +
+ +
+
+ + update_project!( project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 117
+def update_project!( project)
+  apply do |config|
+    config.update_project(project)
+  end
+end
+
+
+ +
+ +
+
+ + update_project_config(project, conf) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 132
+def update_project_config(project, conf)
+  repo_name = project.path_with_namespace
+
+  repo = if conf.has_repo?(repo_name)
+           conf.get_repo(repo_name)
+         else
+           ::Gitolite::Config::Repo.new(repo_name)
+         end
+
+  name_readers = project.repository_readers
+  name_writers = project.repository_writers
+  name_masters = project.repository_masters
+
+  pr_br = project.protected_branches.map(&:name).join("$ ")
+
+  repo.clean_permissions
+
+  # Deny access to protected branches for writers
+  unless name_writers.blank? || pr_br.blank?
+    repo.add_permission("-", pr_br.strip + "$ ", name_writers)
+  end
+
+  # Add read permissions
+  repo.add_permission("R", "", name_readers) unless name_readers.blank?
+
+  # Add write permissions
+  repo.add_permission("RW+", "", name_writers) unless name_writers.blank?
+  repo.add_permission("RW+", "", name_masters) unless name_masters.blank?
+
+  # Add sharedRepository config
+  repo.set_git_config("core.sharedRepository", "0660")
+
+  repo
+end
+
+
+ +
+ +
+
+ + update_projects(projects) + + +
+ + +
+

Updates many projects and uses project.path_with_namespace as the repo path +An order of magnitude faster than #update_project

+
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 125
+def update_projects(projects)
+  projects.each do |project|
+    repo = update_project_config(project, conf)
+    conf.add_repo(repo, true)
+  end
+end
+
+
+ +
+ +
+
+ + write_key(id, key) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/gitolite_config.rb, line 99
+def write_key(id, key)
+  File.open(File.join(config_tmp_dir, 'gitolite/keydir',"#{id}.pub"), 'w') do |f|
+    f.write(key.gsub(%r\n/,''))
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/GitoliteConfig/PullError.html b/doc/code/classes/Gitlab/GitoliteConfig/PullError.html new file mode 100644 index 00000000000..35c46f38642 --- /dev/null +++ b/doc/code/classes/Gitlab/GitoliteConfig/PullError.html @@ -0,0 +1,76 @@ + + + + + Gitlab::GitoliteConfig::PullError + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/GitoliteConfig/PushError.html b/doc/code/classes/Gitlab/GitoliteConfig/PushError.html new file mode 100644 index 00000000000..53efe1e8a7d --- /dev/null +++ b/doc/code/classes/Gitlab/GitoliteConfig/PushError.html @@ -0,0 +1,76 @@ + + + + + Gitlab::GitoliteConfig::PushError + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Graph.html b/doc/code/classes/Gitlab/Graph.html new file mode 100644 index 00000000000..e0827c84594 --- /dev/null +++ b/doc/code/classes/Gitlab/Graph.html @@ -0,0 +1,88 @@ + + + + + Gitlab::Graph + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Graph/Commit.html b/doc/code/classes/Gitlab/Graph/Commit.html new file mode 100644 index 00000000000..0198b3f0e3c --- /dev/null +++ b/doc/code/classes/Gitlab/Graph/Commit.html @@ -0,0 +1,337 @@ + + + + + Gitlab::Graph::Commit + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
T
+
+ +
+ +
+ + + + +
Included Modules
+
    + +
  • + + ActionView::Helpers::TagHelper + +
  • + +
+ + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + +
+ [RW] + refs
+ [RW] + space
+ [RW] + time
+ + + + + +
Class Public methods
+ +
+
+ + new(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/commit.rb, line 10
+def initialize(commit)
+  @_commit = commit
+  @time = -1
+  @space = 0
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + add_refs(ref_cache, repo) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/commit.rb, line 36
+def add_refs(ref_cache, repo)
+  if ref_cache.empty?
+    repo.refs.each do |ref|
+      ref_cache[ref.commit.id] ||= []
+      ref_cache[ref.commit.id] << ref
+    end
+  end
+  @refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
+  @refs ||= []
+end
+
+
+ +
+ +
+
+ + method_missing(m, *args, &block) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/commit.rb, line 16
+def method_missing(m, *args, &block)
+  @_commit.send(m, *args, &block)
+end
+
+
+ +
+ +
+
+ + to_graph_hash() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/commit.rb, line 20
+def to_graph_hash
+  h = {}
+  h[:parents] = self.parents.collect do |p|
+    [p.id,0,0]
+  end
+  h[:author]  = author.name
+  h[:time]    = time
+  h[:space]   = space
+  h[:refs]    = refs.collect{|r|r.name}.join(" ") unless refs.nil?
+  h[:id]      = sha
+  h[:date]    = date
+  h[:message] = message
+  h[:login]   = author.email
+  h
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Graph/JsonBuilder.html b/doc/code/classes/Gitlab/Graph/JsonBuilder.html new file mode 100644 index 00000000000..b410947bb85 --- /dev/null +++ b/doc/code/classes/Gitlab/Graph/JsonBuilder.html @@ -0,0 +1,707 @@ + + + + + Gitlab::Graph::JsonBuilder + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
I
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ [RW] + commits
+ [RW] + days
+ [RW] + ref_cache
+ [RW] + repo
+ + + + + +
Class Public methods
+ +
+
+ + max_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 8
+def self.max_count
+  @max_count ||= 650
+end
+
+
+ +
+ +
+
+ + new(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 12
+def initialize project
+  @project = project
+  @repo = project.repo
+  @ref_cache = {}
+
+  @commits = collect_commits
+  @days = index_commits
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + to_json(*args) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 21
+def to_json(*args)
+  {
+    days: @days.compact.map { |d| [d.day, d.strftime("%b")] },
+    commits: @commits.map(&:to_graph_hash)
+  }.to_json(*args)
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + base_space(leaves, map) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 148
+def base_space(leaves, map)
+  parents = []
+  leaves.each do |l|
+    parents.concat l.parents.collect.select{|p| map.include? p.id and map[p.id].space.nonzero?}
+  end
+
+  space = parents.map{|p| map[p.id].space}.max || 0
+  space += 1
+end
+
+
+ +
+ +
+
+ + collect_commits() + + +
+ + +
+

Get commits from repository

+
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 32
+def collect_commits
+  @commits = Grit::Commit.find_all(repo, nil, {max_count: self.class.max_count}).dup
+
+  # Decorate with app/models/commit.rb
+  @commits.map! { |commit| ::Commit.new(commit) }
+
+  # Decorate with lib/gitlab/graph/commit.rb
+  @commits.map! { |commit| Gitlab::Graph::Commit.new(commit) }
+
+  # add refs to each commit
+  @commits.each { |commit| commit.add_refs(ref_cache, repo) }
+
+  @commits
+end
+
+
+ +
+ +
+
+ + find_free_space(leaves, map) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 135
+def find_free_space(leaves, map)
+  time_range = leaves.last.time..leaves.first.time
+  reserved = []
+  for day in time_range
+    reserved += @_reserved[day]
+  end
+  space = base_space(leaves, map)
+  while reserved.include? space do
+    space += 1
+  end
+  space
+end
+
+
+ +
+ +
+
+ + index_commits() + + +
+ + +
+

Method is adding time and space on the list of commits. As well as returns +date list corelated with time set on commits.

+ +

@param [Array<Graph::Commit>] comits to index

+ +

@return [Array<TimeDate>] list of commit dates corelated with time on +commits

+
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 54
+def index_commits
+  days, heads = [], []
+  map = {}
+
+  commits.reverse.each_with_index do |c,i|
+    c.time = i
+    days[i] = c.committed_date
+    map[c.id] = c
+    heads += c.refs unless c.refs.nil?
+  end
+
+  heads.select!{|h| h.is_a? Grit::Head or h.is_a? Grit::Remote}
+  # sort heads so the master is top and current branches are closer
+  heads.sort! do |a,b|
+    if a.name == "master"
+      -1
+    elsif b.name == "master"
+      1
+    else
+      b.commit.committed_date <=> a.commit.committed_date
+    end
+  end
+
+  @_reserved = {}
+  days.each_index do |i|
+    @_reserved[i] = []
+  end
+
+  heads.each do |h|
+    if map.include? h.commit.id then
+      place_chain(map[h.commit.id], map)
+    end
+  end
+
+  days
+end
+
+
+ +
+ +
+
+ + mark_reserved(time_range, space) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 129
+def mark_reserved(time_range, space)
+  for day in time_range
+    @_reserved[day].push(space)
+  end
+end
+
+
+ +
+ +
+
+ + place_chain(commit, map, parent_time = nil) + + +
+ + +
+

Add space mark on commit and its parents

+ +

@param [Graph::Commit] the commit object. @param +[Hash<String,Graph::Commit>] map of commits

+
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 95
+def place_chain(commit, map, parent_time = nil)
+  leaves = take_left_leaves(commit, map)
+  if leaves.empty?
+    return
+  end
+  space = find_free_space(leaves, map)
+  leaves.each{|l| l.space = space}
+  # and mark it as reserved
+  min_time = leaves.last.time
+  parents = leaves.last.parents.collect
+  parents.each do |p|
+    if map.include? p.id
+      parent = map[p.id]
+      if parent.time < min_time
+        min_time = parent.time
+      end
+    end
+  end
+  if parent_time.nil?
+    max_time = leaves.first.time
+  else
+    max_time = parent_time - 1
+  end
+  mark_reserved(min_time..max_time, space)
+
+  # Visit branching chains
+  leaves.each do |l|
+    parents = l.parents.collect.select{|p| map.include? p.id and map[p.id].space.zero?}
+    for p in parents
+      place_chain(map[p.id], map, l.time)
+    end
+  end
+end
+
+
+ +
+ +
+
+ + take_left_leaves(commit, map) + + +
+ + +
+

Takes most left subtree branch of commits which don’t have space mark yet.

+ +

@param [Graph::Commit] the commit object. @param +[Hash<String,Graph::Commit>] map of commits

+ +

@return [Array<Graph::Commit>] list of branch commits

+
+ + + + + + +
+ + +
+
# File lib/gitlab/graph/json_builder.rb, line 165
+def take_left_leaves(commit, map)
+  leaves = []
+  leaves.push(commit) if commit.space.zero?
+
+  while true
+    return leaves if commit.parents.count.zero?
+    return leaves unless map.include? commit.parents.first.id
+
+    commit = map[commit.parents.first.id]
+
+    return leaves unless commit.space.zero?
+
+    leaves.push(commit)
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/InlineDiff.html b/doc/code/classes/Gitlab/InlineDiff.html new file mode 100644 index 00000000000..cd04b7d018d --- /dev/null +++ b/doc/code/classes/Gitlab/InlineDiff.html @@ -0,0 +1,299 @@ + + + + + Gitlab::InlineDiff + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
#
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
START="#!idiff-start!#"
 
FINISH="#!idiff-finish!#"
 
+ + + + + + + + +
Class Public methods
+ +
+
+ + _indexes_of_changed_lines(diff_arr) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/inline_diff.rb, line 42
+def _indexes_of_changed_lines diff_arr
+  chain_of_first_symbols = ""
+  diff_arr.each_with_index do |line, i|
+    chain_of_first_symbols += line[0]
+  end
+  chain_of_first_symbols.gsub!(%r[^\-\+]/, "#")
+
+  offset = 0
+  indexes = []
+  while index = chain_of_first_symbols.index("#-+#", offset)
+    indexes << index
+    offset = index + 1
+  end
+  indexes
+end
+
+
+ +
+ +
+
+ + processing(diff_arr) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/inline_diff.rb, line 8
+def processing diff_arr
+  indexes = _indexes_of_changed_lines diff_arr
+
+  indexes.each do |index|
+    first_line = diff_arr[index+1]
+    second_line = diff_arr[index+2]
+    max_length = [first_line.size, second_line.size].max
+
+    first_the_same_symbols = 0
+    (0..max_length + 1).each do |i|
+      first_the_same_symbols = i - 1
+      if first_line[i] != second_line[i] && i > 0
+        break
+      end
+    end
+    first_token = first_line[0..first_the_same_symbols][1..-1]
+    diff_arr[index+1].sub!(first_token, first_token + START)
+    diff_arr[index+2].sub!(first_token, first_token + START)
+    last_the_same_symbols = 0
+    (1..max_length + 1).each do |i|
+      last_the_same_symbols = -i
+      shortest_line = second_line.size > first_line.size ? first_line : second_line
+      if ( first_line[-i] != second_line[-i] ) || "#{first_token}#{START}".size == shortest_line[1..-i].size
+        break
+      end
+    end
+    last_the_same_symbols += 1
+    last_token = first_line[last_the_same_symbols..-1]
+    diff_arr[index+1].sub!(%r#{Regexp.escape(last_token)}$/, FINISH + last_token)
+    diff_arr[index+2].sub!(%r#{Regexp.escape(last_token)}$/, FINISH + last_token)
+  end
+  diff_arr
+end
+
+
+ +
+ +
+
+ + replace_markers(line) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/inline_diff.rb, line 58
+def replace_markers line
+  line.gsub!(START, "<span class='idiff'>")
+  line.gsub!(FINISH, "</span>")
+  line
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Issues.html b/doc/code/classes/Gitlab/Issues.html new file mode 100644 index 00000000000..91c6dead2a6 --- /dev/null +++ b/doc/code/classes/Gitlab/Issues.html @@ -0,0 +1,82 @@ + + + + + Gitlab::Issues + + + + + + + + + + + + + +
+
+ +
+ +

Issues API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Logger.html b/doc/code/classes/Gitlab/Logger.html new file mode 100644 index 00000000000..2c523c19219 --- /dev/null +++ b/doc/code/classes/Gitlab/Logger.html @@ -0,0 +1,315 @@ + + + + + Gitlab::Logger + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
E
+
+ +
+ +
I
+
+
    + + +
  • + info +
  • + +
+
+ +
R
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + build() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/logger.rb, line 22
+def self.build
+  new(Rails.root.join("log", file_name))
+end
+
+
+ +
+ +
+
+ + error(message) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/logger.rb, line 3
+def self.error(message)
+  build.error(message)
+end
+
+
+ +
+ +
+
+ + info(message) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/logger.rb, line 7
+def self.info(message)
+  build.info(message)
+end
+
+
+ +
+ +
+
+ + read_latest() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/logger.rb, line 11
+def self.read_latest
+  path = Rails.root.join("log", file_name)
+  self.build unless File.exist?(path)
+  logs = %xtail -n 2000 #{path}`.split("\n")
+end
+
+
+ +
+ +
+
+ + read_latest_for(filename) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/logger.rb, line 17
+def self.read_latest_for filename
+  path = Rails.root.join("log", filename)
+  logs = %xtail -n 2000 #{path}`.split("\n")
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Markdown.html b/doc/code/classes/Gitlab/Markdown.html new file mode 100644 index 00000000000..45d853f3684 --- /dev/null +++ b/doc/code/classes/Gitlab/Markdown.html @@ -0,0 +1,258 @@ + + + + + Gitlab::Markdown + + + + + + + + + + + + + +
+
+ +
+ +

Custom parser for GitLab-flavored Markdown

+ +

It replaces references in the text with links to the appropriate items in +GitLab.

+ +

Supported reference formats are:

+ +
* @foo for team members
+* #123 for issues
+* !123 for merge requests
+* $123 for snippets
+* 123456 for commits
+ +

It also parses Emoji codes to insert images. See www.emoji-cheat-sheet.com/ for +a list of the supported icons.

+ +

Examples

+ +
>> gfm("Hey @david, can you fix this?")
+=> "Hey <a href="/gitlab/team_members/1">@david</a>, can you fix this?"
+
+>> gfm("Commit 35d5f7c closes #1234")
+=> "Commit <a href="/gitlab/commits/35d5f7c">35d5f7c</a> closes <a href="/gitlab/issues/1234">#1234</a>"
+
+>> gfm(":trollface:")
+=> "<img alt=\":trollface:\" class=\"emoji\" src=\"/images/trollface.png" title=\":trollface:\" />
+
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
G
+
+
    + + +
  • + gfm +
  • + +
+
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
REFERENCE_PATTERN=%r{ +(?<prefix>\W)? # Prefix +( # Reference +@(?<user>[a-zA-Z][a-zA-Z0-9_\-\.]*) # User name +|\#(?<issue>\d+) # Issue ID +|!(?<merge_request>\d+) # MR ID +|\$(?<snippet>\d+) # Snippet ID +|(?<commit>[\h]{6,40}) # Commit ID +) +(?<suffix>\W)? # Suffix +}x.freeze
 
TYPES=[:user, :issue, :merge_request, :snippet, :commit].freeze
 
EMOJI_PATTERN=%r{(:(\S+):)}.freeze
 
+ + + + + +
Attributes
+ + + + + + + + +
+ [R] + html_options
+ + + + + +
Instance Public methods
+ +
+
+ + gfm(text, html_options = {}) + + +
+ + +
+

Public: Parse the provided text with GitLab-Flavored Markdown

+ +

text - the source text #html_options - extra +options for the reference links as given to link_to

+ +

Note: reference links will only be generated if @project is set

+
+ + + + + + +
+ + +
+
# File lib/gitlab/markdown.rb, line 52
+def gfm(text, html_options = {})
+  return text if text.nil?
+
+  # Duplicate the string so we don't alter the original, then call to_str
+  # to cast it back to a String instead of a SafeBuffer. This is required
+  # for gsub calls to work as we need them to.
+  text = text.dup.to_str
+
+  @html_options = html_options
+
+  # Extract pre blocks so they are not altered
+  # from http://github.github.com/github-flavored-markdown/
+  extractions = {}
+  text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}) do |match|
+    md5 = Digest::MD5.hexdigest(match)
+    extractions[md5] = match
+    "{gfm-extraction-#{md5}}"
+  end
+
+  # TODO: add popups with additional information
+
+  text = parse(text)
+
+  # Insert pre block extractions
+  text.gsub!(%r\{gfm-extraction-(\h{32})\}/) do
+    extractions[$1]
+  end
+
+  sanitize text.html_safe, attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/MergeRequests.html b/doc/code/classes/Gitlab/MergeRequests.html new file mode 100644 index 00000000000..556f2b01604 --- /dev/null +++ b/doc/code/classes/Gitlab/MergeRequests.html @@ -0,0 +1,82 @@ + + + + + Gitlab::MergeRequests + + + + + + + + + + + + + +
+
+ +
+ +

MergeRequest API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Milestones.html b/doc/code/classes/Gitlab/Milestones.html new file mode 100644 index 00000000000..4226dab3d56 --- /dev/null +++ b/doc/code/classes/Gitlab/Milestones.html @@ -0,0 +1,82 @@ + + + + + Gitlab::Milestones + + + + + + + + + + + + + +
+
+ +
+ +

Milestones API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Notes.html b/doc/code/classes/Gitlab/Notes.html new file mode 100644 index 00000000000..90d3e7af53a --- /dev/null +++ b/doc/code/classes/Gitlab/Notes.html @@ -0,0 +1,100 @@ + + + + + Gitlab::Notes + + + + + + + + + + + + + +
+
+ +
+ +

Notes API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + +
NOTEABLE_TYPES=[Issue, Snippet]
 
+ + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/ProjectMover.html b/doc/code/classes/Gitlab/ProjectMover.html new file mode 100644 index 00000000000..d13cf13d375 --- /dev/null +++ b/doc/code/classes/Gitlab/ProjectMover.html @@ -0,0 +1,290 @@ + + + + + Gitlab::ProjectMover + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
E
+
+ +
+ +
L
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + +
+ [R] + new_dir
+ [R] + old_dir
+ [R] + project
+ + + + + +
Class Public methods
+ +
+
+ + new(project, old_dir, new_dir) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/project_mover.rb, line 10
+def initialize(project, old_dir, new_dir)
+  @project = project
+  @old_dir = old_dir
+  @new_dir = new_dir
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/project_mover.rb, line 16
+def execute
+  # Create new dir if missing
+  new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir)
+  system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path)
+
+  old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
+  new_path = File.join(new_dir_path, "#{project.path}.git")
+
+  if File.exists? new_path
+    raise ProjectMoveError.new("Destination #{new_path} already exists")
+  end
+
+  if system("mv #{old_path} #{new_path}")
+    log_info "Project #{project.name} was moved from #{old_path} to #{new_path}"
+    true
+  else
+    message = "Project #{project.name} cannot be moved from #{old_path} to #{new_path}"
+    log_info "Error! #{message}"
+    raise ProjectMoveError.new(message)
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + log_info(message) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/project_mover.rb, line 40
+def log_info message
+  Gitlab::AppLogger.info message
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/ProjectMover/ProjectMoveError.html b/doc/code/classes/Gitlab/ProjectMover/ProjectMoveError.html new file mode 100644 index 00000000000..0071ba0c636 --- /dev/null +++ b/doc/code/classes/Gitlab/ProjectMover/ProjectMoveError.html @@ -0,0 +1,76 @@ + + + + + Gitlab::ProjectMover::ProjectMoveError + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Projects.html b/doc/code/classes/Gitlab/Projects.html new file mode 100644 index 00000000000..9005134ee6c --- /dev/null +++ b/doc/code/classes/Gitlab/Projects.html @@ -0,0 +1,82 @@ + + + + + Gitlab::Projects + + + + + + + + + + + + + +
+
+ +
+ +

Projects API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Regex.html b/doc/code/classes/Gitlab/Regex.html new file mode 100644 index 00000000000..674df3227af --- /dev/null +++ b/doc/code/classes/Gitlab/Regex.html @@ -0,0 +1,261 @@ + + + + + Gitlab::Regex + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
P
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + path_regex() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/regex.rb, line 13
+def path_regex
+  default_regex
+end
+
+
+ +
+ +
+
+ + project_name_regex() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/regex.rb, line 9
+def project_name_regex
+  %r\A[a-zA-Z][a-zA-Z0-9_\-\. ]*\z/
+end
+
+
+ +
+ +
+
+ + username_regex() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/regex.rb, line 5
+def username_regex
+  default_regex
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + default_regex() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/regex.rb, line 19
+def default_regex
+  %r\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Satellite.html b/doc/code/classes/Gitlab/Satellite.html new file mode 100644 index 00000000000..943bbf8eeab --- /dev/null +++ b/doc/code/classes/Gitlab/Satellite.html @@ -0,0 +1,102 @@ + + + + + Gitlab::Satellite + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Satellite/Action.html b/doc/code/classes/Gitlab/Satellite/Action.html new file mode 100644 index 00000000000..abe7411ef1f --- /dev/null +++ b/doc/code/classes/Gitlab/Satellite/Action.html @@ -0,0 +1,305 @@ + + + + + Gitlab::Satellite::Action + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + +
DEFAULT_OPTIONS={ git_timeout: 30.seconds }
 
+ + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + +
+ [RW] + options
+ [RW] + project
+ [RW] + user
+ + + + + +
Class Public methods
+ +
+
+ + new(user, project, options = {}) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/action.rb, line 8
+def initialize(user, project, options = {})
+  @options = DEFAULT_OPTIONS.merge(options)
+  @project = project
+  @user = user
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + in_locked_and_timed_satellite() + + +
+ + +
+
  • +

    Sets a 30s timeout for Git

    +
  • +

    Locks the satellite repo

    +
  • +

    Yields the prepared satellite repo

    +
+
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/action.rb, line 19
+def in_locked_and_timed_satellite
+  Grit::Git.with_timeout(options[:git_timeout]) do
+    project.satellite.lock do
+      return yield project.satellite.repo
+    end
+  end
+rescue Errno::ENOMEM => ex
+  Gitlab::GitLogger.error(ex.message)
+  return false
+rescue Grit::Git::GitTimeout => ex
+  Gitlab::GitLogger.error(ex.message)
+  return false
+end
+
+
+ +
+ +
+
+ + prepare_satellite!(repo) + + +
+ + +
+
  • +

    Clears the satellite

    +
  • +

    Updates the satellite from Gitolite

    +
  • +

    Sets up Git variables for the user

    +
+ +

Note: use this within in_locked_and_timed_satellite

+
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/action.rb, line 38
+def prepare_satellite!(repo)
+  project.satellite.clear_and_update!
+
+  repo.git.config({}, "user.name", user.name)
+  repo.git.config({}, "user.email", user.email)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Satellite/EditFileAction.html b/doc/code/classes/Gitlab/Satellite/EditFileAction.html new file mode 100644 index 00000000000..3a35aa22632 --- /dev/null +++ b/doc/code/classes/Gitlab/Satellite/EditFileAction.html @@ -0,0 +1,284 @@ + + + + + Gitlab::Satellite::EditFileAction + + + + + + + + + + + + + +
+
+ +
+ +

GitLab server-side file update and commit

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [RW] + file_path
+ [RW] + ref
+ + + + + +
Class Public methods
+ +
+
+ + new(user, project, ref, file_path) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/edit_file_action.rb, line 7
+def initialize(user, project, ref, file_path)
+  super user, project, git_timeout: 10.seconds
+  @file_path = file_path
+  @ref = ref
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + commit!(content, commit_message, last_commit) + + +
+ + +
+

Updates the files content and creates a new commit for it

+ +

Returns false if the ref has been updated while editing the file Returns +false if commiting the change fails Returns false if pushing from the +satellite to Gitolite failed or was rejected +Returns true otherwise

+
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/edit_file_action.rb, line 19
+def commit!(content, commit_message, last_commit)
+  return false unless can_edit?(last_commit)
+
+  in_locked_and_timed_satellite do |repo|
+    prepare_satellite!(repo)
+
+    # create target branch in satellite at the corresponding commit from Gitolite
+    repo.git.checkout({raise: true, timeout: true, b: true}, ref, "origin/#{ref}")
+
+    # update the file in the satellite's working dir
+    file_path_in_satellite = File.join(repo.working_dir, file_path)
+    File.open(file_path_in_satellite, 'w') { |f| f.write(content) }
+
+    # commit the changes
+    # will raise CommandFailed when commit fails
+    repo.git.commit(raise: true, timeout: true, a: true, m: commit_message)
+
+
+    # push commit back to Gitolite
+    # will raise CommandFailed when push fails
+    repo.git.push({raise: true, timeout: true}, :origin, ref)
+
+    # everything worked
+    true
+  end
+rescue Grit::Git::CommandFailed => ex
+  Gitlab::GitLogger.error(ex.message)
+  false
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + can_edit?(last_commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/edit_file_action.rb, line 51
+def can_edit?(last_commit)
+  current_last_commit = @project.last_commit_for(ref, file_path).sha
+  last_commit == current_last_commit
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Satellite/MergeAction.html b/doc/code/classes/Gitlab/Satellite/MergeAction.html new file mode 100644 index 00000000000..064c4f06e60 --- /dev/null +++ b/doc/code/classes/Gitlab/Satellite/MergeAction.html @@ -0,0 +1,274 @@ + + + + + Gitlab::Satellite::MergeAction + + + + + + + + + + + + + +
+
+ +
+ +

GitLab server-side merge

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + merge_request
+ + + + + +
Class Public methods
+ +
+
+ + new(user, merge_request) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/merge_action.rb, line 7
+def initialize(user, merge_request)
+  super user, merge_request.project
+  @merge_request = merge_request
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + can_be_merged?() + + +
+ + +
+

Checks if a merge request can be executed without user interaction

+
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/merge_action.rb, line 13
+def can_be_merged?
+  in_locked_and_timed_satellite do |merge_repo|
+    merge_in_satellite!(merge_repo)
+  end
+end
+
+
+ +
+ +
+
+ + merge!() + + +
+ + +
+

Merges the source branch into the target branch in the satellite and pushes +it back to Gitolite. It also removes the +source branch if requested in the merge request.

+ +

Returns false if the merge produced conflicts Returns false if pushing from +the satellite to Gitolite failed or was +rejected Returns true otherwise

+
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/merge_action.rb, line 26
+def merge!
+  in_locked_and_timed_satellite do |merge_repo|
+    if merge_in_satellite!(merge_repo)
+      # push merge back to Gitolite
+      # will raise CommandFailed when push fails
+      merge_repo.git.push({raise: true, timeout: true}, :origin, merge_request.target_branch)
+
+      # remove source branch
+      if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)
+        # will raise CommandFailed when push fails
+        merge_repo.git.push({raise: true, timeout: true}, :origin, ":#{merge_request.source_branch}")
+      end
+
+      # merge, push and branch removal successful
+      true
+    end
+  end
+rescue Grit::Git::CommandFailed => ex
+  Gitlab::GitLogger.error(ex.message)
+  false
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Satellite/Satellite.html b/doc/code/classes/Gitlab/Satellite/Satellite.html new file mode 100644 index 00000000000..86d82e6ab33 --- /dev/null +++ b/doc/code/classes/Gitlab/Satellite/Satellite.html @@ -0,0 +1,506 @@ + + + + + Gitlab::Satellite::Satellite + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
E
+
+ +
+ +
L
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+
    + + +
  • + path +
  • + +
+
+ +
R
+
+
    + + +
  • + repo +
  • + +
+
+ +
+ + + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + +
PARKING_BRANCH="__parking_branch"
 
+ + + + + +
Attributes
+ + + + + + + + +
+ [RW] + project
+ + + + + +
Class Public methods
+ +
+
+ + new(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 8
+def initialize(project)
+  @project = project
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + clear_and_update!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 12
+def clear_and_update!
+  raise "Satellite doesn't exist" unless exists?
+
+  delete_heads!
+  clear_working_dir!
+  update_from_source!
+end
+
+
+ +
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 20
+def create
+  create_cmd = "git clone #{project.url_to_repo} #{path}"
+  if system(create_cmd)
+    true
+  else
+    Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}")
+    false
+  end
+end
+
+
+ +
+ +
+
+ + exists?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 30
+def exists?
+  File.exists? path
+end
+
+
+ +
+ +
+
+ + lock() + + +
+ + +
+
  • +

    Locks the satellite

    +
  • +

    Changes the current directory to the satellite’s working dir

    +
  • +

    Yields

    +
+
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 37
+def lock
+  raise "Satellite doesn't exist" unless exists?
+
+  File.open(lock_file, "w+") do |f|
+    f.flock(File::LOCK_EX)
+
+    Dir.chdir(path) do
+      return yield
+    end
+  end
+end
+
+
+ +
+ +
+
+ + lock_file() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 49
+def lock_file
+  Rails.root.join("tmp", "satellite_#{project.id}.lock")
+end
+
+
+ +
+ +
+
+ + path() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 53
+def path
+  Rails.root.join("tmp", "repo_satellites", project.path_with_namespace)
+end
+
+
+ +
+ +
+
+ + repo() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/satellite/satellite.rb, line 57
+def repo
+  raise "Satellite doesn't exist" unless exists?
+
+  @repo ||= Grit::Repo.new(path)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Seeder.html b/doc/code/classes/Gitlab/Seeder.html new file mode 100644 index 00000000000..a62c96a5526 --- /dev/null +++ b/doc/code/classes/Gitlab/Seeder.html @@ -0,0 +1,134 @@ + + + + + Gitlab::Seeder + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
Q
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + quiet() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/seeder.rb, line 3
+def self.quiet
+  SeedFu.quiet = true
+  yield
+  SeedFu.quiet = false
+  puts "\nOK".green
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Session.html b/doc/code/classes/Gitlab/Session.html new file mode 100644 index 00000000000..ad14adc0d50 --- /dev/null +++ b/doc/code/classes/Gitlab/Session.html @@ -0,0 +1,82 @@ + + + + + Gitlab::Session + + + + + + + + + + + + + +
+
+ +
+ +

Users API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Theme.html b/doc/code/classes/Gitlab/Theme.html new file mode 100644 index 00000000000..8f918b35ce4 --- /dev/null +++ b/doc/code/classes/Gitlab/Theme.html @@ -0,0 +1,141 @@ + + + + + Gitlab::Theme + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + css_class_by_id(id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/theme.rb, line 3
+def self.css_class_by_id(id)
+  themes = {
+    1 => "ui_basic",
+    2 => "ui_mars",
+    3 => "ui_modern",
+    4 => "ui_gray",
+    5 => "ui_color"
+  }
+
+  id ||= 1
+
+  return themes[id]
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Gitlab/Users.html b/doc/code/classes/Gitlab/Users.html new file mode 100644 index 00000000000..50ba3131240 --- /dev/null +++ b/doc/code/classes/Gitlab/Users.html @@ -0,0 +1,82 @@ + + + + + Gitlab::Users + + + + + + + + + + + + + +
+
+ +
+ +

Users API

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/GitlabCiService.html b/doc/code/classes/GitlabCiService.html new file mode 100644 index 00000000000..a56f614f772 --- /dev/null +++ b/doc/code/classes/GitlabCiService.html @@ -0,0 +1,371 @@ + + + + + GitlabCiService + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: services

+ +
id          :integer          not null, primary key
+type        :string(255)
+title       :string(255)
+token       :string(255)
+project_id  :integer          not null
+created_at  :datetime         not null
+updated_at  :datetime         not null
+active      :boolean          default(FALSE), not null
+project_url :string(255)
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + activated?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/gitlab_ci_service.rb, line 26
+def activated?
+  active
+end
+
+
+ +
+ +
+
+ + build_page(sha) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/gitlab_ci_service.rb, line 54
+def build_page sha
+  project_url + "/builds/#{sha}"
+end
+
+
+ +
+ +
+
+ + commit_badge_path(sha) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/gitlab_ci_service.rb, line 36
+def commit_badge_path sha
+  project_url + "/status?sha=#{sha}"
+end
+
+
+ +
+ +
+
+ + commit_status(sha) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/gitlab_ci_service.rb, line 44
+def commit_status sha
+  response = HTTParty.get(commit_status_path(sha))
+
+  if response.code == 200 and response["status"]
+    response["status"]
+  else
+    :error
+  end
+end
+
+
+ +
+ +
+
+ + commit_status_path(sha) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/gitlab_ci_service.rb, line 40
+def commit_status_path sha
+  project_url + "/builds/#{sha}/status.json?token=#{token}"
+end
+
+
+ +
+ +
+
+ + compose_service_hook() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/gitlab_ci_service.rb, line 30
+def compose_service_hook
+  hook = service_hook || build_service_hook
+  hook.url = [project_url, "/build", "?token=#{token}"].join("")
+  hook.save
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/GitlabMarkdownHelper.html b/doc/code/classes/GitlabMarkdownHelper.html new file mode 100644 index 00000000000..32ae5f822b5 --- /dev/null +++ b/doc/code/classes/GitlabMarkdownHelper.html @@ -0,0 +1,222 @@ + + + + + GitlabMarkdownHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
L
+
+ +
+ +
M
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+ + + +
+

Use this in places where you would normally use link_to(gfm(…), …).

+ +

It solves a problem occurring with nested links (i.e. “<a>outer text +<a>gfm ref</a> more outer text</a>”). This will not be +interpreted as intended. Browsers will parse something like “<a>outer +text </a><a>gfm ref</a> more outer text” (notice the last +part is not linked any more). #link_to_gfm +corrects that. It wraps all parts to explicitly produce the correct linking +behavior (i.e. “<a>outer text </a><a>gfm +ref</a><a> more outer text</a>”).

+
+ + + + + + +
+ + + +
+ +
+ +
+
+ + markdown(text) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/gitlab_markdown_helper.rb, line 25
+def markdown(text)
+  unless @markdown
+    gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
+                        # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch-
+                        filter_html: true,
+                        with_toc_data: true,
+                        hard_wrap: true)
+    @markdown = Redcarpet::Markdown.new(gitlab_renderer,
+                    # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
+                    no_intra_emphasis: true,
+                    tables: true,
+                    fenced_code_blocks: true,
+                    autolink: true,
+                    strikethrough: true,
+                    lax_html_blocks: true,
+                    space_after_headers: true,
+                    superscript: true)
+  end
+
+  @markdown.render(text).html_safe
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Grack.html b/doc/code/classes/Grack.html new file mode 100644 index 00000000000..9261c356602 --- /dev/null +++ b/doc/code/classes/Grack.html @@ -0,0 +1,81 @@ + + + + + Grack + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Grack/Auth.html b/doc/code/classes/Grack/Auth.html new file mode 100644 index 00000000000..a1350e2fa26 --- /dev/null +++ b/doc/code/classes/Grack/Auth.html @@ -0,0 +1,419 @@ + + + + + Grack::Auth + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
V
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [RW] + project
+ [RW] + user
+ + + + + +
Instance Public methods
+ +
+
+ + can?(object, action, subject) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/grack_auth.rb, line 56
+def can?(object, action, subject)
+  abilities.allowed?(object, action, subject)
+end
+
+
+ +
+ +
+
+ + current_ref() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/grack_auth.rb, line 60
+def current_ref
+  if @env["HTTP_CONTENT_ENCODING"] =~ %rgzip/
+    input = Zlib::GzipReader.new(@request.body).read
+  else
+    input = @request.body.read
+  end
+  # Need to reset seek point
+  @request.body.rewind
+  %rrefs\/heads\/([\w\.-]+)/.match(input).to_a.first
+end
+
+
+ +
+ +
+
+ + valid?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/grack_auth.rb, line 5
+def valid?
+  # Authentication with username and password
+  login, password = @auth.credentials
+
+  self.user = User.find_by_email(login) || User.find_by_username(login)
+
+  return false unless user.try(:valid_password?, password)
+
+  email = user.email
+
+  # Set GL_USER env variable
+  ENV['GL_USER'] = email
+  # Pass Gitolite update hook
+  ENV['GL_BYPASS_UPDATE_HOOK'] = "true"
+
+  # Find project by PATH_INFO from env
+  if m = %r^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a
+    self.project = Project.find_with_namespace(m.last)
+    return false unless project
+  end
+
+  # Git upload and receive
+  if @request.get?
+    validate_get_request
+  elsif @request.post?
+    validate_post_request
+  else
+    false
+  end
+end
+
+
+ +
+ +
+
+ + validate_get_request() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/grack_auth.rb, line 36
+def validate_get_request
+  can?(user, :download_code, project)
+end
+
+
+ +
+ +
+
+ + validate_post_request() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/grack_auth.rb, line 40
+def validate_post_request
+  if @request.path_info.end_with?('git-upload-pack')
+    can?(user, :download_code, project)
+  elsif @request.path_info.end_with?('git-receive-pack')
+    action = if project.protected_branch?(current_ref)
+               :push_code_to_protected_branches
+             else
+               :push_code
+             end
+
+    can?(user, action, project)
+  else
+    false
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + abilities() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/gitlab/backend/grack_auth.rb, line 73
+def abilities
+  @abilities ||= begin
+                   abilities = Six.new
+                   abilities << Ability
+                   abilities
+                 end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Group.html b/doc/code/classes/Group.html new file mode 100644 index 00000000000..cf61c3ea354 --- /dev/null +++ b/doc/code/classes/Group.html @@ -0,0 +1,294 @@ + + + + + Group + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: namespaces

+ +
id         :integer          not null, primary key
+name       :string(255)      not null
+path       :string(255)      not null
+owner_id   :integer          not null
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
H
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + add_users_to_project_teams(user_ids, project_access) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/group.rb, line 15
+def add_users_to_project_teams(user_ids, project_access)
+  UsersProject.add_users_into_projects(
+    projects.map(&:id),
+    user_ids,
+    project_access
+  )
+end
+
+
+ +
+ +
+
+ + human_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/group.rb, line 29
+def human_name
+  name
+end
+
+
+ +
+ +
+
+ + truncate_teams() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/group.rb, line 33
+def truncate_teams
+  UsersProject.truncate_teams(project_ids)
+end
+
+
+ +
+ +
+
+ + users() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/group.rb, line 23
+def users
+  users = User.joins(:users_projects).where(users_projects: {project_id: project_ids})
+  users = users << owner
+  users.uniq
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/GroupsController.html b/doc/code/classes/GroupsController.html new file mode 100644 index 00000000000..dbca1708bf0 --- /dev/null +++ b/doc/code/classes/GroupsController.html @@ -0,0 +1,566 @@ + + + + + GroupsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
G
+
+ +
+ +
I
+
+ +
+ +
M
+
+ +
+ +
P
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + issues() + + +
+ + +
+

Get only assigned issues

+
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 29
+def issues
+  @user   = current_user
+  @issues = current_user.assigned_issues.opened
+  @issues = @issues.of_group(@group).recent.page(params[:page]).per(20)
+  @issues = @issues.includes(:author, :project)
+
+  respond_to do |format|
+    format.html
+    format.atom { render layout: false }
+  end
+end
+
+
+ +
+ +
+
+ + merge_requests() + + +
+ + +
+

Get authored or assigned open merge requests

+
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 23
+def merge_requests
+  @merge_requests = current_user.cared_merge_requests.opened
+  @merge_requests = @merge_requests.of_group(@group).recent.page(params[:page]).per(20)
+end
+
+
+ +
+ +
+
+ + people() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 49
+def people
+  @project = group.projects.find(params[:project_id]) if params[:project_id]
+  @users = @project ? @project.users : group.users
+  @users.sort_by!(&:name)
+
+  if @project
+    @team_member = @project.users_projects.new
+  else
+    @team_member = UsersProject.new
+  end
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 41
+def search
+  result = SearchContext.new(project_ids, params).execute
+
+  @projects       = result[:projects]
+  @merge_requests = result[:merge_requests]
+  @issues         = result[:issues]
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 11
+def show
+  @events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0)
+  @last_push = current_user.recent_push
+
+  respond_to do |format|
+    format.html
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+
+ +
+ +
+
+ + team_members() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 61
+def team_members
+  @group.add_users_to_project_teams(params[:user_ids], params[:project_access])
+  redirect_to people_group_path(@group), notice: 'Users was successfully added.'
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + authorize_read_group!() + + +
+ + +
+

Dont allow unauthorized access to group

+
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 81
+def authorize_read_group!
+  unless projects.present? or can?(current_user, :manage_group, @group)
+    return render_404
+  end
+end
+
+
+ +
+ +
+
+ + group() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 68
+def group
+  @group ||= Group.find_by_path(params[:id])
+end
+
+
+ +
+ +
+
+ + project_ids() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 76
+def project_ids
+  projects.map(&:id)
+end
+
+
+ +
+ +
+
+ + projects() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/groups_controller.rb, line 72
+def projects
+  @projects ||= group.projects.authorized_for(current_user).sorted_by_activity
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/HelpController.html b/doc/code/classes/HelpController.html new file mode 100644 index 00000000000..fbb76563389 --- /dev/null +++ b/doc/code/classes/HelpController.html @@ -0,0 +1,130 @@ + + + + + HelpController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
I
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/help_controller.rb, line 2
+def index
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/HooksController.html b/doc/code/classes/HooksController.html new file mode 100644 index 00000000000..511e05f0da9 --- /dev/null +++ b/doc/code/classes/HooksController.html @@ -0,0 +1,286 @@ + + + + + HooksController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
T
+
+
    + + +
  • + test +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/hooks_controller.rb, line 13
+def create
+  @hook = @project.hooks.new(params[:hook])
+  @hook.save
+
+  if @hook.valid?
+    redirect_to project_hooks_path(@project)
+  else
+    @hooks = @project.hooks.all
+    render :index
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/hooks_controller.rb, line 31
+def destroy
+  @hook = @project.hooks.find(params[:id])
+  @hook.destroy
+
+  redirect_to project_hooks_path(@project)
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/hooks_controller.rb, line 8
+def index
+  @hooks = @project.hooks.all
+  @hook = ProjectHook.new
+end
+
+
+ +
+ +
+
+ + test() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/hooks_controller.rb, line 25
+def test
+  TestHookContext.new(project, current_user, params).execute
+
+  redirect_to :back
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Issue.html b/doc/code/classes/Issue.html new file mode 100644 index 00000000000..6f71ea72eb4 --- /dev/null +++ b/doc/code/classes/Issue.html @@ -0,0 +1,174 @@ + + + + + Issue + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: issues

+ +
id           :integer          not null, primary key
+title        :string(255)
+assignee_id  :integer
+author_id    :integer
+project_id   :integer
+created_at   :datetime         not null
+updated_at   :datetime         not null
+closed       :boolean          default(FALSE), not null
+position     :integer          default(0)
+branch_name  :string(255)
+description  :text
+milestone_id :integer
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
O
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + open_for(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/issue.rb, line 30
+def self.open_for(user)
+  opened.assigned(user)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssueCommonality.html b/doc/code/classes/IssueCommonality.html new file mode 100644 index 00000000000..7398308a176 --- /dev/null +++ b/doc/code/classes/IssueCommonality.html @@ -0,0 +1,356 @@ + + + + + IssueCommonality + + + + + + + + + + + + + +
+
+ +
+ +

Contains common functionality shared between Issues and MergeRequests

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new? +
  • + +
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + is_assigned?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 51
+def is_assigned?
+  !!assignee_id
+end
+
+
+ +
+ +
+
+ + is_being_closed?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 59
+def is_being_closed?
+  closed_changed? && closed
+end
+
+
+ +
+ +
+
+ + is_being_reassigned?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 55
+def is_being_reassigned?
+  assignee_id_changed?
+end
+
+
+ +
+ +
+
+ + is_being_reopened?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 63
+def is_being_reopened?
+  closed_changed? && !closed
+end
+
+
+ +
+ +
+
+ + new?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 47
+def new?
+  today? && created_at == updated_at
+end
+
+
+ +
+ +
+
+ + today?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 43
+def today?
+  Date.today == created_at.to_date
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssueCommonality/ClassMethods.html b/doc/code/classes/IssueCommonality/ClassMethods.html new file mode 100644 index 00000000000..5c3ca9b2add --- /dev/null +++ b/doc/code/classes/IssueCommonality/ClassMethods.html @@ -0,0 +1,125 @@ + + + + + IssueCommonality::ClassMethods + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/issue_commonality.rb, line 38
+def search(query)
+  where("title like :query", query: "%#{query}%")
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssueObserver.html b/doc/code/classes/IssueObserver.html new file mode 100644 index 00000000000..1600c0f08ac --- /dev/null +++ b/doc/code/classes/IssueObserver.html @@ -0,0 +1,236 @@ + + + + + IssueObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(issue) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/issue_observer.rb, line 4
+def after_create(issue)
+  if issue.assignee && issue.assignee != current_user
+    Notify.new_issue_email(issue.id).deliver
+  end
+end
+
+
+ +
+ +
+
+ + after_update(issue) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/issue_observer.rb, line 10
+def after_update(issue)
+  send_reassigned_email(issue) if issue.is_being_reassigned?
+
+  status = nil
+  status = 'closed' if issue.is_being_closed?
+  status = 'reopened' if issue.is_being_reopened?
+  if status
+    Note.create_status_change_note(issue, current_user, status)
+    [issue.author, issue.assignee].compact.each do |recipient|
+      Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user.id).deliver
+    end
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + send_reassigned_email(issue) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/issue_observer.rb, line 26
+def send_reassigned_email(issue)
+  recipient_ids = [issue.assignee_id, issue.assignee_id_was].keep_if {|id| id && id != current_user.id }
+
+  recipient_ids.each do |recipient_id|
+    Notify.reassigned_issue_email(recipient_id, issue.id, issue.assignee_id_was).deliver
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssuesBulkUpdateContext.html b/doc/code/classes/IssuesBulkUpdateContext.html new file mode 100644 index 00000000000..0214d217e19 --- /dev/null +++ b/doc/code/classes/IssuesBulkUpdateContext.html @@ -0,0 +1,149 @@ + + + + + IssuesBulkUpdateContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/issues_bulk_update_context.rb, line 2
+def execute
+  update_data = params[:update]
+
+  issues_ids   = update_data[:issues_ids].split(",")
+  milestone_id = update_data[:milestone_id]
+  assignee_id  = update_data[:assignee_id]
+  status       = update_data[:status]
+
+  opts = {} 
+  opts[:milestone_id] = milestone_id if milestone_id.present?
+  opts[:assignee_id] = assignee_id if assignee_id.present?
+  opts[:closed] = (status == "closed") if status.present?
+
+  issues = Issue.where(id: issues_ids).all
+  issues = issues.select { |issue| can?(current_user, :modify_issue, issue) }
+  issues.each { |issue| issue.update_attributes(opts) }
+  { 
+    count: issues.count,
+    success: !issues.count.zero?
+  }
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssuesController.html b/doc/code/classes/IssuesController.html new file mode 100644 index 00000000000..1e18d7a8826 --- /dev/null +++ b/doc/code/classes/IssuesController.html @@ -0,0 +1,761 @@ + + + + + IssuesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + bulk_update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 99
+def bulk_update
+  result = IssuesBulkUpdateContext.new(project, current_user, params).execute
+  redirect_to :back, notice: "#{result[:count]} issues updated"
+end
+
+
+ +
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 45
+def create
+  @issue = @project.issues.new(params[:issue])
+  @issue.author = current_user
+  @issue.save
+
+  respond_to do |format|
+    format.html do
+      if @issue.valid?
+        redirect_to project_issue_path(@project, @issue)
+      else
+        render :new
+      end
+    end
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 32
+def edit
+  respond_with(@issue)
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 16
+def index
+  @issues = issues_filtered
+  @issues = @issues.page(params[:page]).per(20)
+
+  respond_to do |format|
+    format.html # index.html.erb
+    format.js
+    format.atom { render layout: false }
+  end
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 27
+def new
+  @issue = @project.issues.new(params[:issue])
+  respond_with(@issue)
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 89
+def search
+  terms = params['terms']
+
+  @issues = issues_filtered
+  @issues = @issues.where("title LIKE ?", "%#{terms}%") unless terms.blank?
+  @issues = @issues.page(params[:page]).per(100)
+
+  render partial: 'issues'
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 36
+def show
+  @note = @project.notes.new(noteable: @issue)
+
+  respond_to do |format|
+    format.html
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + sort() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 77
+def sort
+  return render_404 unless can?(current_user, :admin_issue, @project)
+
+  @issues = @project.issues.where(id: params['issue'])
+  @issues.each do |issue|
+    issue.position = params['issue'].index(issue.id.to_s) + 1
+    issue.save
+  end
+
+  render nothing: true
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 62
+def update
+  @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))
+
+  respond_to do |format|
+    format.js
+    format.html do
+      if @issue.valid?
+        redirect_to [@project, @issue]
+      else
+        render :edit
+      end
+    end
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + authorize_admin_issue!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 114
+def authorize_admin_issue!
+  return render_404 unless can?(current_user, :admin_issue, @issue)
+end
+
+
+ +
+ +
+
+ + authorize_modify_issue!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 110
+def authorize_modify_issue!
+  return render_404 unless can?(current_user, :modify_issue, @issue)
+end
+
+
+ +
+ +
+
+ + issue() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 106
+def issue
+  @issue ||= @project.issues.find(params[:id])
+end
+
+
+ +
+ +
+
+ + issues_filtered() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 122
+def issues_filtered
+  @issues = IssuesListContext.new(project, current_user, params).execute
+end
+
+
+ +
+ +
+
+ + module_enabled() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/issues_controller.rb, line 118
+def module_enabled
+  return render_404 unless @project.issues_enabled
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssuesHelper.html b/doc/code/classes/IssuesHelper.html new file mode 100644 index 00000000000..7b7510451b1 --- /dev/null +++ b/doc/code/classes/IssuesHelper.html @@ -0,0 +1,401 @@ + + + + + IssuesHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
I
+
+ +
+ +
L
+
+ +
+ +
P
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + issue_css_classes(issue) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 7
+def issue_css_classes issue
+  classes = "issue"
+  classes << " closed" if issue.closed
+  classes << " today" if issue.today?
+  classes
+end
+
+
+ +
+ +
+
+ + issue_tags() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 14
+def issue_tags
+  @project.issues.tag_counts_on(:labels).map(&:name)
+end
+
+
+ +
+ +
+
+ + issues_active_milestones() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 40
+def issues_active_milestones
+  @project.milestones.active.order("id desc").all
+end
+
+
+ +
+ +
+
+ + issues_filter() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 25
+def issues_filter
+  {
+    all: "all",
+    closed: "closed",
+    to_me: "assigned-to-me",
+    open: "open"
+  }
+end
+
+
+ +
+ +
+
+ + labels_autocomplete_source() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 34
+def labels_autocomplete_source
+  labels = @project.issues_labels.order('count DESC')
+  labels = labels.map{ |l| { label: l.name, value: l.name } }
+  labels.to_json
+end
+
+
+ +
+ +
+
+ + project_issues_filter_path(project, params = {}) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 2
+def project_issues_filter_path project, params = {}
+  params[:f] ||= cookies['issue_filter']
+  project_issues_path project, params
+end
+
+
+ +
+ +
+
+ + unassigned_filter() + + +
+ + +
+

Returns an OpenStruct object suitable for use by +options_from_collection_for_select to allow filtering issues +by an unassigned User or Milestone

+
+ + + + + + +
+ + +
+
# File app/helpers/issues_helper.rb, line 20
+def unassigned_filter
+  # Milestone uses :title, Issue uses :name
+  OpenStruct.new(id: 0, title: 'Unspecified', name: 'Unassigned')
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/IssuesListContext.html b/doc/code/classes/IssuesListContext.html new file mode 100644 index 00000000000..0298ec75f13 --- /dev/null +++ b/doc/code/classes/IssuesListContext.html @@ -0,0 +1,179 @@ + + + + + IssuesListContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + issues
+ + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/issues_list_context.rb, line 6
+def execute
+  @issues = case params[:f]
+            when issues_filter[:all] then @project.issues
+            when issues_filter[:closed] then @project.issues.closed
+            when issues_filter[:to_me] then @project.issues.opened.assigned(current_user)
+            else @project.issues.opened
+            end
+
+  @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
+  @issues = @issues.includes(:author, :project).order("updated_at")
+
+  # Filter by specific assignee_id (or lack thereof)?
+  if params[:assignee_id].present?
+    @issues = @issues.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
+  end
+
+  # Filter by specific milestone_id (or lack thereof)?
+  if params[:milestone_id].present?
+    @issues = @issues.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
+  end
+
+  @issues
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Key.html b/doc/code/classes/Key.html new file mode 100644 index 00000000000..0935e4862ef --- /dev/null +++ b/doc/code/classes/Key.html @@ -0,0 +1,429 @@ + + + + + Key + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
F
+
+ +
+ +
I
+
+ +
+ +
L
+
+ +
+ +
P
+
+ +
+ +
S
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + fingerprintable_key() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 44
+def fingerprintable_key
+  return true unless key # Don't test if there is no key.
+  # `ssh-keygen -lf /dev/stdin <<< "#{key}"` errors with: redirection unexpected
+  file = Tempfile.new('key_file')
+  begin
+    file.puts key
+    file.rewind
+    fingerprint_output = %xssh-keygen -lf #{file.path} 2>&1` # Catch stderr.
+  ensure
+    file.close
+    file.unlink # deletes the temp file
+  end
+  errors.add(:key, "can't be fingerprinted") if fingerprint_output.match("failed")
+end
+
+
+ +
+ +
+
+ + is_deploy_key() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 67
+def is_deploy_key
+  true if project_id
+end
+
+
+ +
+ +
+
+ + last_deploy?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 80
+def last_deploy?
+  Key.where(identifier: identifier).count == 0
+end
+
+
+ +
+ +
+
+ + projects() + + +
+ + +
+

projects that has this key

+
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 72
+def projects
+  if is_deploy_key
+    [project]
+  else
+    user.projects
+  end
+end
+
+
+ +
+ +
+
+ + set_identifier() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 59
+def set_identifier
+  if is_deploy_key
+    self.identifier = "deploy_#{Digest::MD5.hexdigest(key)}"
+  else
+    self.identifier = "#{user.identifier}_#{Time.now.to_i}"
+  end
+end
+
+
+ +
+ +
+
+ + strip_white_space() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 32
+def strip_white_space
+  self.key = self.key.strip unless self.key.blank?
+end
+
+
+ +
+ +
+
+ + unique_key() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/key.rb, line 36
+def unique_key
+  query = Key.where(key: key)
+  query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
+  if (query.count > 0)
+    errors.add :key, 'already exist.'
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/KeyObserver.html b/doc/code/classes/KeyObserver.html new file mode 100644 index 00000000000..1044ea2f7f9 --- /dev/null +++ b/doc/code/classes/KeyObserver.html @@ -0,0 +1,186 @@ + + + + + KeyObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_destroy(key) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/key_observer.rb, line 8
+def after_destroy(key)
+  return if key.is_deploy_key && !key.last_deploy?
+  git_host.remove_key(key.identifier, key.projects)
+end
+
+
+ +
+ +
+
+ + after_save(key) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/key_observer.rb, line 4
+def after_save(key)
+  git_host.set_key(key.identifier, key.key, key.projects)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/KeysController.html b/doc/code/classes/KeysController.html new file mode 100644 index 00000000000..9caccb753f2 --- /dev/null +++ b/doc/code/classes/KeysController.html @@ -0,0 +1,330 @@ + + + + + KeysController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/keys_controller.rb, line 19
+def create
+  @key = current_user.keys.new(params[:key])
+  @key.save
+
+  respond_with(@key)
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/keys_controller.rb, line 26
+def destroy
+  @key = current_user.keys.find(params[:id])
+  @key.destroy
+
+  respond_to do |format|
+    format.html { redirect_to keys_url }
+    format.js { render nothing: true }
+  end
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/keys_controller.rb, line 5
+def index
+  @keys = current_user.keys.all
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/keys_controller.rb, line 13
+def new
+  @key = current_user.keys.new
+
+  respond_with(@key)
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/keys_controller.rb, line 9
+def show
+  @key = current_user.keys.find(params[:id])
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/LabelsController.html b/doc/code/classes/LabelsController.html new file mode 100644 index 00000000000..53d54c6bbb0 --- /dev/null +++ b/doc/code/classes/LabelsController.html @@ -0,0 +1,180 @@ + + + + + LabelsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
I
+
+ +
+ +
M
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/labels_controller.rb, line 9
+def index
+  @labels = @project.issues_labels.order('count DESC')
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + module_enabled() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/labels_controller.rb, line 15
+def module_enabled
+  return render_404 unless @project.issues_enabled
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/MergeRequest.html b/doc/code/classes/MergeRequest.html new file mode 100644 index 00000000000..cd4046095b0 --- /dev/null +++ b/doc/code/classes/MergeRequest.html @@ -0,0 +1,1569 @@ + + + + + MergeRequest + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
F
+
+ +
+ +
H
+
+ +
+ +
L
+
+ +
+ +
M
+
+ +
+ +
O
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
V
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BROKEN_DIFF="--broken-diff"
 
UNCHECKED=1
 
CAN_BE_MERGED=2
 
CANNOT_BE_MERGED=3
 
+ + + + + +
Attributes
+ + + + + + + + +
+ [RW] + should_remove_source_branch
+ + + + + +
Class Public methods
+ +
+
+ + find_all_by_branch(branch_name) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 47
+def self.find_all_by_branch(branch_name)
+  where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name)
+end
+
+
+ +
+ +
+
+ + find_all_by_milestone(milestone) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 51
+def self.find_all_by_milestone(milestone)
+  where("milestone_id = :milestone_id", milestone_id: milestone)
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + automerge!(current_user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 195
+def automerge!(current_user)
+  if Gitlab::Satellite::MergeAction.new(current_user, self).merge! && self.unmerged_commits.empty?
+    self.merge!(current_user.id)
+    true
+  end
+rescue
+  self.mark_as_unmergable
+  false
+end
+
+
+ +
+ +
+
+ + broken_diffs?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 112
+def broken_diffs?
+  diffs == [BROKEN_DIFF]
+end
+
+
+ +
+ +
+
+ + can_be_merged?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 84
+def can_be_merged?
+  state == CAN_BE_MERGED
+end
+
+
+ +
+ +
+
+ + check_if_can_be_merged() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 88
+def check_if_can_be_merged
+  self.state = if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged?
+                 CAN_BE_MERGED
+               else
+                 CANNOT_BE_MERGED
+               end
+  self.save
+end
+
+
+ +
+ +
+
+ + closed_event() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 140
+def closed_event
+  self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Closed).last
+end
+
+
+ +
+ +
+
+ + commits() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 144
+def commits
+  st_commits || []
+end
+
+
+ +
+ +
+
+ + diffs() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 97
+def diffs
+  st_diffs || []
+end
+
+
+ +
+ +
+
+ + human_state() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 55
+def human_state
+  states = {
+    CAN_BE_MERGED =>  "can_be_merged",
+    CANNOT_BE_MERGED => "cannot_be_merged",
+    UNCHECKED => "unchecked"
+  }
+  states[self.state]
+end
+
+
+ +
+ +
+
+ + last_commit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 128
+def last_commit
+  commits.first
+end
+
+
+ +
+ +
+
+ + last_commit_short_sha() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 224
+def last_commit_short_sha
+  @last_commit_short_sha ||= last_commit.sha[0..10]
+end
+
+
+ +
+ +
+
+ + mark_as_merged!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 157
+def mark_as_merged!
+  self.merged = true
+  self.closed = true
+  save
+end
+
+
+ +
+ +
+
+ + mark_as_unchecked() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 79
+def mark_as_unchecked
+  self.state = UNCHECKED
+  self.save
+end
+
+
+ +
+ +
+
+ + mark_as_unmergable() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 163
+def mark_as_unmergable
+  self.state = CANNOT_BE_MERGED
+  self.save
+end
+
+
+ +
+ +
+
+ + merge!(user_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 184
+def merge!(user_id)
+  self.mark_as_merged!
+  Event.create(
+    project: self.project,
+    action: Event::Merged,
+    target_id: self.id,
+    target_type: "MergeRequest",
+    author_id: user_id
+  )
+end
+
+
+ +
+ +
+
+ + merge_event() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 136
+def merge_event
+  self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Merged).last
+end
+
+
+ +
+ +
+
+ + merged?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 132
+def merged?
+  merged && merge_event
+end
+
+
+ +
+ +
+
+ + mr_and_commit_notes() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 205
+def mr_and_commit_notes
+  commit_ids = commits.map(&:id)
+  Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids)
+end
+
+
+ +
+ +
+
+ + open?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 153
+def open?
+  !closed
+end
+
+
+ +
+ +
+
+ + probably_merged?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 148
+def probably_merged?
+  unmerged_commits.empty? &&
+    commits.any? && open?
+end
+
+
+ +
+ +
+
+ + reload_code() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 70
+def reload_code
+  self.reloaded_commits
+  self.reloaded_diffs
+end
+
+
+ +
+ +
+
+ + reloaded_commits() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 168
+def reloaded_commits
+  if open? && unmerged_commits.any?
+    self.st_commits = unmerged_commits
+    save
+  end
+  commits
+end
+
+
+ +
+ +
+
+ + reloaded_diffs() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 101
+def reloaded_diffs
+  if open? && unmerged_diffs.any?
+    self.st_diffs = unmerged_diffs
+    self.save
+  end
+
+rescue Grit::Git::GitTimeout
+  self.st_diffs = [BROKEN_DIFF]
+  self.save
+end
+
+
+ +
+ +
+
+ + to_diff() + + +
+ + +
+

Returns the raw diff for this merge request

+ +

see “git diff”

+
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 213
+def to_diff
+  project.repo.git.native(:diff, {timeout: 30, raise: true}, "#{target_branch}...#{source_branch}")
+end
+
+
+ +
+ +
+
+ + to_patch() + + +
+ + +
+

Returns the commit as a series of email patches.

+ +

see “git format-patch”

+
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 220
+def to_patch
+  project.repo.git.format_patch({timeout: 30, raise: true, stdout: true}, "#{target_branch}..#{source_branch}")
+end
+
+
+ +
+ +
+
+ + unchecked?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 75
+def unchecked?
+  state == UNCHECKED
+end
+
+
+ +
+ +
+
+ + unmerged_commits() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 176
+def unmerged_commits
+  self.project.repo.
+    commits_between(self.target_branch, self.source_branch).
+    map {|c| Commit.new(c)}.
+    sort_by(&:created_at).
+    reverse
+end
+
+
+ +
+ +
+
+ + unmerged_diffs() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 120
+def unmerged_diffs
+  # Only show what is new in the source branch compared to the target branch, not the other way around.
+  # The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
+  # From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
+  common_commit = project.repo.git.native(:merge_base, {}, [target_branch, source_branch]).strip
+  diffs = project.repo.diff(common_commit, source_branch)
+end
+
+
+ +
+ +
+
+ + valid_diffs?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 116
+def valid_diffs?
+  !broken_diffs?
+end
+
+
+ +
+ +
+
+ + validate_branches() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/merge_request.rb, line 64
+def validate_branches
+  if target_branch == source_branch
+    errors.add :base, "You can not use same branch for source and target branches"
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/MergeRequestObserver.html b/doc/code/classes/MergeRequestObserver.html new file mode 100644 index 00000000000..364e0346134 --- /dev/null +++ b/doc/code/classes/MergeRequestObserver.html @@ -0,0 +1,234 @@ + + + + + MergeRequestObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(merge_request) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/merge_request_observer.rb, line 4
+def after_create(merge_request)
+  if merge_request.assignee && merge_request.assignee != current_user
+    Notify.new_merge_request_email(merge_request.id).deliver
+  end
+end
+
+
+ +
+ +
+
+ + after_update(merge_request) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/merge_request_observer.rb, line 10
+def after_update(merge_request)
+  send_reassigned_email(merge_request) if merge_request.is_being_reassigned?
+
+  status = nil
+  status = 'closed' if merge_request.is_being_closed?
+  status = 'reopened' if merge_request.is_being_reopened?
+  if status
+    Note.create_status_change_note(merge_request, current_user, status)
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + send_reassigned_email(merge_request) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/merge_request_observer.rb, line 23
+def send_reassigned_email(merge_request)
+  recipients_ids = merge_request.assignee_id_was, merge_request.assignee_id
+  recipients_ids.delete current_user.id
+
+  recipients_ids.each do |recipient_id|
+    Notify.reassigned_merge_request_email(recipient_id, merge_request.id, merge_request.assignee_id_was).deliver
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/MergeRequestsController.html b/doc/code/classes/MergeRequestsController.html new file mode 100644 index 00000000000..4cf181fa8d5 --- /dev/null +++ b/doc/code/classes/MergeRequestsController.html @@ -0,0 +1,932 @@ + + + + + MergeRequestsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
U
+
+ +
+ +
V
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + automerge() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 74
+def automerge
+  return access_denied! unless can?(current_user, :accept_mr, @project)
+  if @merge_request.open? && @merge_request.can_be_merged?
+    @merge_request.should_remove_source_branch = params[:should_remove_source_branch]
+    @merge_request.automerge!(current_user)
+    @status = true
+  else
+    @status = false
+  end
+end
+
+
+ +
+ +
+
+ + automerge_check() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 67
+def automerge_check
+  if @merge_request.unchecked?
+    @merge_request.check_if_can_be_merged
+  end
+  render json: {state: @merge_request.human_state}
+end
+
+
+ +
+ +
+
+ + branch_from() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 85
+def branch_from
+  @commit = project.commit(params[:ref])
+  @commit = CommitDecorator.decorate(@commit)
+end
+
+
+ +
+ +
+
+ + branch_to() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 90
+def branch_to
+  @commit = project.commit(params[:ref])
+  @commit = CommitDecorator.decorate(@commit)
+end
+
+
+ +
+ +
+
+ + ci_status() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 95
+def ci_status
+  status = project.gitlab_ci_service.commit_status(merge_request.last_commit.sha)
+  response = { status: status }
+
+  render json: response
+end
+
+
+ +
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 45
+def create
+  @merge_request = @project.merge_requests.new(params[:merge_request])
+  @merge_request.author = current_user
+
+  if @merge_request.save
+    @merge_request.reload_code
+    redirect_to [@project, @merge_request], notice: 'Merge request was successfully created.'
+  else
+    render action: "new"
+  end
+end
+
+
+ +
+ +
+
+ + diffs() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 30
+def diffs
+  @diffs = @merge_request.diffs
+  @commit = @merge_request.last_commit
+
+  @comments_allowed = true
+  @line_notes = @merge_request.notes.where("line_code is not null")
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 42
+def edit
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 16
+def index
+  @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 38
+def new
+  @merge_request = @project.merge_requests.new(params[:merge_request])
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 20
+def show
+  respond_to do |format|
+    format.html
+    format.js
+
+    format.diff  { render text: @merge_request.to_diff }
+    format.patch { render text: @merge_request.to_patch }
+  end
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 57
+def update
+  if @merge_request.update_attributes(params[:merge_request].merge(author_id_of_changes: current_user.id))
+    @merge_request.reload_code
+    @merge_request.mark_as_unchecked
+    redirect_to [@project, @merge_request], notice: 'Merge request was successfully updated.'
+  else
+    render action: "edit"
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + authorize_admin_merge_request!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 112
+def authorize_admin_merge_request!
+  return render_404 unless can?(current_user, :admin_merge_request, @merge_request)
+end
+
+
+ +
+ +
+
+ + authorize_modify_merge_request!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 108
+def authorize_modify_merge_request!
+  return render_404 unless can?(current_user, :modify_merge_request, @merge_request)
+end
+
+
+ +
+ +
+
+ + define_show_vars() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 129
+def define_show_vars
+  # Build a note object for comment form
+  @note = @project.notes.new(noteable: @merge_request)
+
+  # Get commits from repository
+  # or from cache if already merged
+  @commits = @merge_request.commits
+  @commits = CommitDecorator.decorate(@commits)
+end
+
+
+ +
+ +
+
+ + merge_request() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 104
+def merge_request
+  @merge_request ||= @project.merge_requests.find(params[:id])
+end
+
+
+ +
+ +
+
+ + module_enabled() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 116
+def module_enabled
+  return render_404 unless @project.merge_requests_enabled
+end
+
+
+ +
+ +
+
+ + validates_merge_request() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/merge_requests_controller.rb, line 120
+def validates_merge_request
+  # Show git not found page if target branch doesnt exist
+  return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch)
+
+  # Show git not found page if source branch doesnt exist
+  # and there is no saved commits between source & target branch
+  return git_not_found! if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank?
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/MergeRequestsHelper.html b/doc/code/classes/MergeRequestsHelper.html new file mode 100644 index 00000000000..33725cf7ac8 --- /dev/null +++ b/doc/code/classes/MergeRequestsHelper.html @@ -0,0 +1,229 @@ + + + + + MergeRequestsHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
M
+
+ +
+ +
N
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + ci_build_details_path(merge_request) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/merge_requests_helper.rb, line 20
+def ci_build_details_path merge_request
+  merge_request.project.gitlab_ci_service.build_page(merge_request.last_commit.sha)
+end
+
+
+ +
+ +
+
+ + mr_css_classes(mr) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/merge_requests_helper.rb, line 13
+def mr_css_classes mr
+  classes = "merge_request"
+  classes << " closed" if mr.closed
+  classes << " merged" if mr.merged?
+  classes
+end
+
+
+ +
+ +
+
+ + new_mr_path_from_push_event(event) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/merge_requests_helper.rb, line 2
+def new_mr_path_from_push_event(event)
+  new_project_merge_request_path(
+    event.project,
+    merge_request: {
+      source_branch: event.branch_name,
+      target_branch: event.project.root_ref,
+      title: event.branch_name.titleize
+    }
+  )
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/MergeRequestsLoadContext.html b/doc/code/classes/MergeRequestsLoadContext.html new file mode 100644 index 00000000000..5e2501c70b5 --- /dev/null +++ b/doc/code/classes/MergeRequestsLoadContext.html @@ -0,0 +1,162 @@ + + + + + MergeRequestsLoadContext + + + + + + + + + + + + + +
+
+ +
+ +

Build collection of Merge Requests based on filtering passed via params for +@project

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/merge_requests_load_context.rb, line 4
+def execute
+  type = params[:f]
+
+  merge_requests = project.merge_requests
+
+  merge_requests = case type
+                   when 'all' then merge_requests
+                   when 'closed' then merge_requests.closed
+                   when 'assigned-to-me' then merge_requests.opened.assigned(current_user)
+                   else merge_requests.opened
+                   end
+
+  merge_requests = merge_requests.page(params[:page]).per(20)
+  merge_requests = merge_requests.includes(:author, :project).order("closed, created_at desc")
+
+  # Filter by specific assignee_id (or lack thereof)?
+  if params[:assignee_id].present?
+    merge_requests = merge_requests.where(assignee_id: (params[:assignee_id] == '0' ? nil : params[:assignee_id]))
+  end
+
+  # Filter by specific milestone_id (or lack thereof)?
+  if params[:milestone_id].present?
+    merge_requests = merge_requests.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
+  end
+
+  merge_requests
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Milestone.html b/doc/code/classes/Milestone.html new file mode 100644 index 00000000000..5f275210da1 --- /dev/null +++ b/doc/code/classes/Milestone.html @@ -0,0 +1,616 @@ + + + + + Milestone + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: milestones

+ +
id          :integer          not null, primary key
+title       :string(255)      not null
+project_id  :integer          not null
+description :text
+due_date    :date
+closed      :boolean          default(FALSE), not null
+created_at  :datetime         not null
+updated_at  :datetime         not null
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
E
+
+ +
+ +
I
+
+ +
+ +
O
+
+ +
+ +
P
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + author_id_of_changes
+ + + + + +
Instance Public methods
+ +
+
+ + author_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 82
+def author_id
+  author_id_of_changes
+end
+
+
+ +
+ +
+
+ + can_be_closed?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 70
+def can_be_closed?
+  open? && issues.opened.count.zero?
+end
+
+
+ +
+ +
+
+ + closed_items_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 46
+def closed_items_count
+  self.issues.closed.count + self.merge_requests.closed.count
+end
+
+
+ +
+ +
+
+ + expired?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 30
+def expired?
+  if due_date
+    due_date.past?
+  else
+    false
+  end
+end
+
+
+ +
+ +
+
+ + expires_at() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 60
+def expires_at
+  if due_date
+    if due_date.past?
+      "expired at #{due_date.stamp("Aug 21, 2011")}"
+    else
+      "expires at #{due_date.stamp("Aug 21, 2011")}"  
+    end
+  end  
+end
+
+
+ +
+ +
+
+ + is_empty?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 74
+def is_empty?
+  total_items_count.zero?
+end
+
+
+ +
+ +
+
+ + open?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 78
+def open?
+  !closed
+end
+
+
+ +
+ +
+
+ + open_items_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 42
+def open_items_count
+  self.issues.opened.count + self.merge_requests.opened.count
+end
+
+
+ +
+ +
+
+ + participants() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 38
+def participants
+  User.where(id: issues.pluck(:assignee_id))
+end
+
+
+ +
+ +
+
+ + percent_complete() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 54
+def percent_complete
+  ((closed_items_count * 100) / total_items_count).abs
+rescue ZeroDivisionError
+  100
+end
+
+
+ +
+ +
+
+ + total_items_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/milestone.rb, line 50
+def total_items_count
+  self.issues.count + self.merge_requests.count
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/MilestonesController.html b/doc/code/classes/MilestonesController.html new file mode 100644 index 00000000000..48a3beb66a1 --- /dev/null +++ b/doc/code/classes/MilestonesController.html @@ -0,0 +1,589 @@ + + + + + MilestonesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
M
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 44
+def create
+  @milestone = @project.milestones.new(params[:milestone])
+  @milestone.author_id_of_changes = current_user.id
+
+  if @milestone.save
+    redirect_to project_milestone_path(@project, @milestone)
+  else
+    render "new"
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 70
+def destroy
+  return access_denied! unless can?(current_user, :admin_milestone, @milestone)
+
+  @milestone.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_milestones_path }
+    format.js { render nothing: true }
+  end
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 29
+def edit
+  respond_with(@milestone)
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 13
+def index
+  @milestones = case params[:f]
+                when 'all'; @project.milestones.order("closed, due_date DESC")
+                when 'closed'; @project.milestones.closed.order("due_date DESC")
+                else @project.milestones.active.order("due_date ASC")
+                end
+
+  @milestones = @milestones.includes(:project)
+  @milestones = @milestones.page(params[:page]).per(20)
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 24
+def new
+  @milestone = @project.milestones.new
+  respond_with(@milestone)
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 33
+def show
+  @issues = @milestone.issues
+  @users = UserDecorator.decorate(@milestone.participants)
+  @merge_requests = @milestone.merge_requests
+
+  respond_to do |format|
+    format.html
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 55
+def update
+  @milestone.update_attributes(params[:milestone].merge(author_id_of_changes: current_user.id))
+
+  respond_to do |format|
+    format.js
+    format.html do
+      if @milestone.valid?
+        redirect_to [@project, @milestone]
+      else
+        render :edit
+      end
+    end
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + authorize_admin_milestone!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 87
+def authorize_admin_milestone!
+  return render_404 unless can?(current_user, :admin_milestone, @project)
+end
+
+
+ +
+ +
+
+ + milestone() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 83
+def milestone
+  @milestone ||= @project.milestones.find(params[:id])
+end
+
+
+ +
+ +
+
+ + module_enabled() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/milestones_controller.rb, line 91
+def module_enabled
+  return render_404 unless @project.issues_enabled
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Namespace.html b/doc/code/classes/Namespace.html new file mode 100644 index 00000000000..02c9b7e44ed --- /dev/null +++ b/doc/code/classes/Namespace.html @@ -0,0 +1,629 @@ + + + + + Namespace + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: namespaces

+ +
id         :integer          not null, primary key
+name       :string(255)      not null
+path       :string(255)      not null
+owner_id   :integer          not null
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
E
+
+ +
+ +
G
+
+ +
+ +
H
+
+ +
+ +
M
+
+ +
+ +
N
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + global_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 41
+def self.global_id
+  'GLN'
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 37
+def self.search query
+  where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + dir_exists?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 59
+def dir_exists?
+  File.exists?(namespace_full_path)
+end
+
+
+ +
+ +
+
+ + ensure_dir_exist() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 53
+def ensure_dir_exist
+  unless dir_exists?
+    system("mkdir -m 770 #{namespace_full_path}")
+  end
+end
+
+
+ +
+ +
+
+ + human_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 49
+def human_name
+  owner_name
+end
+
+
+ +
+ +
+
+ + move_dir() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 67
+def move_dir
+  if path_changed?
+    old_path = File.join(Gitlab.config.gitolite.repos_path, path_was)
+    new_path = File.join(Gitlab.config.gitolite.repos_path, path)
+    if File.exists?(new_path)
+      raise "Already exists"
+    end
+
+    if system("mv #{old_path} #{new_path}")
+      send_update_instructions
+      @require_update_gitolite = true
+    else
+      raise "Namespace move error #{old_path} #{new_path}"
+    end
+  end
+end
+
+
+ +
+ +
+
+ + namespace_full_path() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 63
+def namespace_full_path
+  @namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
+end
+
+
+ +
+ +
+
+ + rm_dir() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 89
+def rm_dir
+  dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
+  system("rm -rf #{dir_path}")
+end
+
+
+ +
+ +
+
+ + send_update_instructions() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 94
+def send_update_instructions
+  projects.each(&:send_move_instructions)
+end
+
+
+ +
+ +
+
+ + to_param() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 45
+def to_param
+  path
+end
+
+
+ +
+ +
+
+ + update_gitolite() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/namespace.rb, line 84
+def update_gitolite
+  @require_update_gitolite = false
+  projects.each(&:update_repository)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/NamespacedProject.html b/doc/code/classes/NamespacedProject.html new file mode 100644 index 00000000000..976338e8810 --- /dev/null +++ b/doc/code/classes/NamespacedProject.html @@ -0,0 +1,344 @@ + + + + + NamespacedProject + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + chief() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/namespaced_project.rb, line 44
+def chief
+  if namespace
+    namespace_owner
+  else
+    owner
+  end
+end
+
+
+ +
+ +
+
+ + name_with_namespace() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/namespaced_project.rb, line 30
+def name_with_namespace
+  @name_with_namespace ||= begin
+                             if namespace
+                               namespace.human_name + " / " + name
+                             else
+                               name
+                             end
+                           end
+end
+
+
+ +
+ +
+
+ + namespace_owner() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/namespaced_project.rb, line 40
+def namespace_owner
+  namespace.try(:owner)
+end
+
+
+ +
+ +
+
+ + path_with_namespace() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/namespaced_project.rb, line 52
+def path_with_namespace
+  if namespace
+    namespace.path + '/' + path
+  else
+    path
+  end
+end
+
+
+ +
+ +
+
+ + transfer(new_namespace) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/namespaced_project.rb, line 2
+def transfer(new_namespace)
+  Project.transaction do
+    old_namespace = namespace
+    self.namespace = new_namespace
+
+    old_dir = old_namespace.try(:path) || ''
+    new_dir = new_namespace.try(:path) || ''
+
+    old_repo = if old_dir.present?
+                 File.join(old_dir, self.path)
+               else
+                 self.path
+               end
+
+    if Project.where(path: self.path, namespace_id: new_namespace.try(:id)).present?
+      raise TransferError.new("Project with same path in target namespace already exists")
+    end
+
+    Gitlab::ProjectMover.new(self, old_dir, new_dir).execute
+
+    git_host.move_repository(old_repo, self)
+
+    save!
+  end
+rescue Gitlab::ProjectMover::ProjectMoveError => ex
+  raise Project::TransferError.new(ex.message)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/NamespacesHelper.html b/doc/code/classes/NamespacesHelper.html new file mode 100644 index 00000000000..28d485d9ffb --- /dev/null +++ b/doc/code/classes/NamespacesHelper.html @@ -0,0 +1,146 @@ + + + + + NamespacesHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
N
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + namespaces_options(selected = :current_user, scope = :default) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/namespaces_helper.rb, line 2
+def namespaces_options(selected = :current_user, scope = :default)
+  groups = current_user.namespaces.select {|n| n.type == 'Group'}
+
+  users = if scope == :all
+            Namespace.root
+          else
+            current_user.namespaces.reject {|n| n.type == 'Group'}
+          end
+
+  global_opts = ["Global", [['/', Namespace.global_id]] ]
+  group_opts = ["Groups", groups.map {|g| [g.human_name, g.id]} ]
+  users_opts = [ "Users", users.map {|u| [u.human_name, u.id]} ]
+
+  options = []
+  options << global_opts if current_user.admin
+  options << group_opts
+  options << users_opts
+
+  if selected == :current_user && current_user.namespace
+    selected = current_user.namespace.id
+  end
+
+  grouped_options_for_select(options, selected)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Note.html b/doc/code/classes/Note.html new file mode 100644 index 00000000000..4ec1c4dcf79 --- /dev/null +++ b/doc/code/classes/Note.html @@ -0,0 +1,536 @@ + + + + + Note + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
F
+
+ +
+ +
N
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [RW] + notify
+ [RW] + notify_author
+ + + + + +
Class Public methods
+ +
+
+ + create_status_change_note(noteable, author, status) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 53
+def self.create_status_change_note(noteable, author, status)
+  create({
+    noteable: noteable,
+    project: noteable.project,
+    author: author,
+    note: "_Status changed to #{status}_"
+  }, without_protection: true)
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + commit_author() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 109
+def commit_author
+  @commit_author ||=
+    project.users.find_by_email(noteable.author_email) ||
+    project.users.find_by_name(noteable.author_name)
+rescue
+  nil
+end
+
+
+ +
+ +
+
+ + downvote?() + + +
+ + +
+

Returns true if this is a downvote note, otherwise false is returned

+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 125
+def downvote?
+  note.start_with?('-1') || note.start_with?(':-1:')
+end
+
+
+ +
+ +
+
+ + for_commit?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 101
+def for_commit?
+  noteable_type == "Commit"
+end
+
+
+ +
+ +
+
+ + for_diff_line?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 105
+def for_diff_line?
+  line_code.present?
+end
+
+
+ +
+ +
+
+ + noteable() + + +
+ + +
+

override to return commits, which are not active record

+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 71
+def noteable
+  if for_commit?
+    project.commit(commit_id)
+  else
+    super
+  end
+# Temp fix to prevent app crash
+# if note commit id doesnt exist
+rescue
+  nil
+end
+
+
+ +
+ +
+
+ + noteable_type_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 129
+def noteable_type_name
+  if noteable_type.present?
+    noteable_type.downcase
+  else
+    "wall"
+  end
+end
+
+
+ +
+ +
+
+ + notify_only_author?(user) + + +
+ + +
+

Check if we can notify commit author with email about our comment

+ +

If commit author email exist in project and commit author is not passed +user we can send email to him

+ +

params:

+ +
user - current user
+ +

return:

+ +
Boolean
+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 96
+def notify_only_author?(user)
+  for_commit? && commit_author &&
+    commit_author.email != user.email
+end
+
+
+ +
+ +
+
+ + upvote?() + + +
+ + +
+

Returns true if this is an upvote note, otherwise false is returned

+
+ + + + + + +
+ + +
+
# File app/models/note.rb, line 119
+def upvote?
+  note.start_with?('+1') || note.start_with?(':+1:')
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/NoteEvent.html b/doc/code/classes/NoteEvent.html new file mode 100644 index 00000000000..0817d17018a --- /dev/null +++ b/doc/code/classes/NoteEvent.html @@ -0,0 +1,380 @@ + + + + + NoteEvent + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
N
+
+ +
+ +
W
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + note_commit?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 10
+def note_commit?
+  target.noteable_type == "Commit"
+end
+
+
+ +
+ +
+
+ + note_commit_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 2
+def note_commit_id
+  target.commit_id
+end
+
+
+ +
+ +
+
+ + note_short_commit_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 6
+def note_short_commit_id
+  note_commit_id[0..8]
+end
+
+
+ +
+ +
+
+ + note_target() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 14
+def note_target
+  target.noteable
+end
+
+
+ +
+ +
+
+ + note_target_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 18
+def note_target_id
+  if note_commit?
+    target.commit_id
+  else
+    target.noteable_id.to_s
+  end
+end
+
+
+ +
+ +
+
+ + note_target_type() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 30
+def note_target_type
+  if target.noteable_type.present?
+    target.noteable_type.titleize
+  else
+    "Wall"
+  end.downcase
+end
+
+
+ +
+ +
+
+ + wall_note?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/note_event.rb, line 26
+def wall_note?
+  target.noteable_type.blank?
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/NoteObserver.html b/doc/code/classes/NoteObserver.html new file mode 100644 index 00000000000..cc0e5156c44 --- /dev/null +++ b/doc/code/classes/NoteObserver.html @@ -0,0 +1,290 @@ + + + + + NoteObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
N
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(note) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/note_observer.rb, line 3
+def after_create(note)
+  send_notify_mails(note)
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + notify_team(note) + + +
+ + +
+

Notifies the whole team except the author of note

+
+ + + + + + +
+ + +
+
# File app/observers/note_observer.rb, line 22
+def notify_team(note)
+  # Note: wall posts are not "attached" to anything, so fall back to "Wall"
+  noteable_type = note.noteable_type.presence || "Wall"
+  notify_method = "note_#{noteable_type.underscore}_email".to_sym
+
+  if Notify.respond_to? notify_method
+    team_without_note_author(note).map do |u|
+      Notify.send(notify_method, u.id, note.id).deliver
+    end
+  end
+end
+
+
+ +
+ +
+
+ + send_notify_mails(note) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/note_observer.rb, line 9
+def send_notify_mails(note)
+  if note.notify
+    notify_team(note)
+  elsif note.notify_author
+    # Notify only author of resource
+    Notify.note_commit_email(note.commit_author.id, note.id).deliver
+  else
+    # Otherwise ignore it
+    nil
+  end
+end
+
+
+ +
+ +
+
+ + team_without_note_author(note) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/note_observer.rb, line 34
+def team_without_note_author(note)
+  note.project.users.reject { |u| u.id == note.author.id }
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Notes.html b/doc/code/classes/Notes.html new file mode 100644 index 00000000000..19b8dd389e4 --- /dev/null +++ b/doc/code/classes/Notes.html @@ -0,0 +1,88 @@ + + + + + Notes + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Notes/CreateContext.html b/doc/code/classes/Notes/CreateContext.html new file mode 100644 index 00000000000..adb3a46fab5 --- /dev/null +++ b/doc/code/classes/Notes/CreateContext.html @@ -0,0 +1,136 @@ + + + + + Notes::CreateContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/notes/create_context.rb, line 3
+def execute
+  note = project.notes.new(params[:note])
+  note.author = current_user
+  note.notify = true if params[:notify] == '1'
+  note.notify_author = true if params[:notify_author] == '1'
+  note.save
+  note
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Notes/LoadContext.html b/doc/code/classes/Notes/LoadContext.html new file mode 100644 index 00000000000..24731bc4e7d --- /dev/null +++ b/doc/code/classes/Notes/LoadContext.html @@ -0,0 +1,157 @@ + + + + + Notes::LoadContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/notes/load_context.rb, line 3
+def execute
+  target_type = params[:target_type]
+  target_id   = params[:target_id]
+  after_id    = params[:after_id]
+  before_id   = params[:before_id]
+
+
+  @notes = case target_type
+           when "commit"
+             project.commit_notes(project.commit(target_id)).fresh.limit(20)
+           when "issue"
+             project.issues.find(target_id).notes.inc_author.fresh.limit(20)
+           when "merge_request"
+             project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh.limit(20)
+           when "snippet"
+             project.snippets.find(target_id).notes.fresh
+           when "wall"
+             # this is the only case, where the order is DESC
+             project.common_notes.order("created_at DESC, id DESC").limit(50)
+           end
+
+  @notes = if after_id
+             @notes.where("id > ?", after_id)
+           elsif before_id
+             @notes.where("id < ?", before_id)
+           else
+             @notes
+           end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/NotesController.html b/doc/code/classes/NotesController.html new file mode 100644 index 00000000000..12cc98fa06f --- /dev/null +++ b/doc/code/classes/NotesController.html @@ -0,0 +1,338 @@ + + + + + NotesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/notes_controller.rb, line 18
+def create
+  @note = Notes::CreateContext.new(project, current_user, params).execute
+
+  respond_to do |format|
+    format.html {redirect_to :back}
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/notes_controller.rb, line 27
+def destroy
+  @note = @project.notes.find(params[:id])
+  return access_denied! unless can?(current_user, :admin_note, @note)
+  @note.destroy
+
+  respond_to do |format|
+    format.js { render nothing: true }
+  end
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/notes_controller.rb, line 8
+def index
+  notes
+  if params[:target_type] == "merge_request"
+    @mixed_targets = true
+    @main_target_type = params[:target_type].camelize
+  end
+
+  respond_with(@notes)
+end
+
+
+ +
+ +
+
+ + preview() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/notes_controller.rb, line 37
+def preview
+  render text: view_context.markdown(params[:note])
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + notes() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/notes_controller.rb, line 43
+def notes
+  @notes = Notes::LoadContext.new(project, current_user, params).execute
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/NotesHelper.html b/doc/code/classes/NotesHelper.html new file mode 100644 index 00000000000..39ff67948c7 --- /dev/null +++ b/doc/code/classes/NotesHelper.html @@ -0,0 +1,258 @@ + + + + + NotesHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
L
+
+ +
+ +
N
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+ + + +
+ +
+ + + + + + +
+ + + +
+ +
+ +
+
+ + loading_more_notes?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/notes_helper.rb, line 2
+def loading_more_notes?
+  params[:loading_more].present?
+end
+
+
+ +
+ +
+
+ + loading_new_notes?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/notes_helper.rb, line 6
+def loading_new_notes?
+  params[:loading_new].present?
+end
+
+
+ +
+ +
+
+ + note_for_main_target?(note) + + +
+ + +
+

Helps to distinguish e.g. commit notes in mr notes list

+
+ + + + + + +
+ + +
+
# File app/helpers/notes_helper.rb, line 11
+def note_for_main_target?(note)
+  !@mixed_targets || @main_target_type == note.noteable_type
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Notify.html b/doc/code/classes/Notify.html new file mode 100644 index 00000000000..ea7403812a6 --- /dev/null +++ b/doc/code/classes/Notify.html @@ -0,0 +1,639 @@ + + + + + Notify + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
I
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
+ + + + +
Included Modules
+
    + +
  • + + Resque::Mailer + +
  • + +
+ + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 32
+def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id)
+  @issue = Issue.find issue_id
+  @issue_status = status
+  @project = @issue.project
+  @updated_by = User.find updated_by_user_id
+  mail(to: recipient(recipient_id),
+      subject: subject("changed issue ##{@issue.id}", @issue.title))
+end
+
+
+ +
+ +
+
+ + new_issue_email(issue_id) + + +
+ + +
+

Issue

+
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 19
+def new_issue_email(issue_id)
+  @issue = Issue.find(issue_id)
+  @project = @issue.project
+  mail(to: @issue.assignee_email, subject: subject("new issue ##{@issue.id}", @issue.title))
+end
+
+
+ +
+ +
+
+ + new_merge_request_email(merge_request_id) + + +
+ + +
+

Merge Request

+
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 47
+def new_merge_request_email(merge_request_id)
+  @merge_request = MergeRequest.find(merge_request_id)
+  @project = @merge_request.project
+  mail(to: @merge_request.assignee_email, subject: subject("new merge request !#{@merge_request.id}", @merge_request.title))
+end
+
+
+ +
+ +
+
+ + new_user_email(user_id, password) + + +
+ + +
+

User

+
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 118
+def new_user_email(user_id, password)
+  @user = User.find(user_id)
+  @password = password
+  mail(to: @user.email, subject: subject("Account was created for you"))
+end
+
+
+ +
+ +
+
+ + note_commit_email(recipient_id, note_id) + + +
+ + +
+

Note

+
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 66
+def note_commit_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @commit = @note.noteable
+  @commit = CommitDecorator.decorate(@commit)
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for commit #{@commit.short_id}", @commit.title))
+end
+
+
+ +
+ +
+
+ + note_issue_email(recipient_id, note_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 74
+def note_issue_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @issue = @note.noteable
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for issue ##{@issue.id}"))
+end
+
+
+ +
+ +
+
+ + note_merge_request_email(recipient_id, note_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 81
+def note_merge_request_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @merge_request = @note.noteable
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject("note for merge request !#{@merge_request.id}"))
+end
+
+
+ +
+ +
+
+ + note_wall_email(recipient_id, note_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 88
+def note_wall_email(recipient_id, note_id)
+  @note = Note.find(note_id)
+  @project = @note.project
+  mail(to: recipient(recipient_id), subject: subject)
+end
+
+
+ +
+ +
+
+ + project_access_granted_email(user_project_id) + + +
+ + +
+

Project

+
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 99
+def project_access_granted_email(user_project_id)
+  @users_project = UsersProject.find user_project_id
+  @project = @users_project.project
+  mail(to: @users_project.user.email,
+       subject: subject("access to project was granted"))
+end
+
+
+ +
+ +
+
+ + project_was_moved_email(user_project_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 107
+def project_was_moved_email(user_project_id)
+  @users_project = UsersProject.find user_project_id
+  @project = @users_project.project
+  mail(to: @users_project.user.email,
+       subject: subject("project was moved"))
+end
+
+
+ +
+ +
+
+ + reassigned_issue_email(recipient_id, issue_id, previous_assignee_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 25
+def reassigned_issue_email(recipient_id, issue_id, previous_assignee_id)
+  @issue = Issue.find(issue_id)
+  @previous_assignee ||= User.find(previous_assignee_id)
+  @project = @issue.project
+  mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title))
+end
+
+
+ +
+ +
+
+ + reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/mailers/notify.rb, line 53
+def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id)
+  @merge_request = MergeRequest.find(merge_request_id)
+  @previous_assignee ||= User.find(previous_assignee_id)
+  @project = @merge_request.project
+  mail(to: recipient(recipient_id), subject: subject("changed merge request !#{@merge_request.id}", @merge_request.title))
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Object.html b/doc/code/classes/Object.html new file mode 100644 index 00000000000..5ebc2dcde50 --- /dev/null +++ b/doc/code/classes/Object.html @@ -0,0 +1,88 @@ + + + + + Object + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + +
Included Modules
+
    + +
  • + + Linguist::BlobHelper + +
  • + +
+ + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/OmniauthCallbacksController.html b/doc/code/classes/OmniauthCallbacksController.html new file mode 100644 index 00000000000..5f54fc02036 --- /dev/null +++ b/doc/code/classes/OmniauthCallbacksController.html @@ -0,0 +1,188 @@ + + + + + OmniauthCallbacksController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
F
+
+ +
+ +
L
+
+
    + + +
  • + ldap +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + failure_message() + + +
+ + +
+

Extend the standard message generation to accept our custom exception

+
+ + + + + + +
+ + +
+
# File app/controllers/omniauth_callbacks_controller.rb, line 9
+def failure_message
+  exception = env["omniauth.error"]
+  error   = exception.error_reason if exception.respond_to?(:error_reason)
+  error ||= exception.error        if exception.respond_to?(:error)
+  error ||= exception.message      if exception.respond_to?(:message)
+  error ||= env["omniauth.error.type"].to_s
+  error.to_s.humanize if error
+end
+
+
+ +
+ +
+
+ + ldap() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/omniauth_callbacks_controller.rb, line 18
+def ldap
+  # We only find ourselves here if the authentication to LDAP was successful.
+  @user = User.find_for_ldap_auth(request.env["omniauth.auth"], current_user)
+  if @user.persisted?
+    @user.remember_me = true
+  end
+  sign_in_and_redirect @user
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/PostReceive.html b/doc/code/classes/PostReceive.html new file mode 100644 index 00000000000..d078e65eaf3 --- /dev/null +++ b/doc/code/classes/PostReceive.html @@ -0,0 +1,149 @@ + + + + + PostReceive + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + perform(repo_path, oldrev, newrev, ref, identifier) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/workers/post_receive.rb, line 4
+def self.perform(repo_path, oldrev, newrev, ref, identifier)
+  repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
+  repo_path.gsub!(%r.git$/, "")
+  repo_path.gsub!(%r^\//, "")
+
+  project = Project.find_with_namespace(repo_path)
+  return false if project.nil?
+
+  # Ignore push from non-gitlab users
+  user = if identifier.eql? Gitlab.config.gitolite.admin_key
+    email = project.commit(newrev).author.email rescue nil
+    User.find_by_email(email) if email
+  elsif %r^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
+    User.find_by_email(identifier)
+  else
+    Key.find_by_identifier(identifier).try(:user)
+  end
+  return false unless user
+
+  project.trigger_post_receive(oldrev, newrev, ref, user)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProfileHelper.html b/doc/code/classes/ProfileHelper.html new file mode 100644 index 00000000000..edab69523e1 --- /dev/null +++ b/doc/code/classes/ProfileHelper.html @@ -0,0 +1,127 @@ + + + + + ProfileHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
O
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + oauth_active_class(provider) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/profile_helper.rb, line 2
+def oauth_active_class provider
+  if current_user.provider == provider.to_s
+    'active'
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProfilesController.html b/doc/code/classes/ProfilesController.html new file mode 100644 index 00000000000..faf4874ab45 --- /dev/null +++ b/doc/code/classes/ProfilesController.html @@ -0,0 +1,513 @@ + + + + + ProfilesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
D
+
+ +
+ +
H
+
+ +
+ +
R
+
+ +
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + account() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 11
+def account
+end
+
+
+ +
+ +
+
+ + design() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 8
+def design
+end
+
+
+ +
+ +
+
+ + history() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 49
+def history
+  @events = current_user.recent_events.page(params[:page]).per(20)
+end
+
+
+ +
+ +
+
+ + reset_private_token() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 41
+def reset_private_token
+  if current_user.reset_authentication_token!
+    flash[:notice] = "Token was successfully updated"
+  end
+
+  redirect_to account_profile_path
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 5
+def show
+end
+
+
+ +
+ +
+
+ + token() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 27
+def token
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 14
+def update
+  if @user.update_attributes(params[:user])
+    flash[:notice] = "Profile was successfully updated"
+  else
+    flash[:alert] = "Failed to update profile"
+  end
+
+  respond_to do |format|
+    format.html { redirect_to :back }
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + update_password() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 30
+def update_password
+  params[:user].reject!{ |k, v| k != "password" && k != "password_confirmation"}
+
+  if @user.update_attributes(params[:user])
+    flash[:notice] = "Password was successfully updated. Please login with it"
+    redirect_to new_user_session_path
+  else
+    render 'account'
+  end
+end
+
+
+ +
+ +
+
+ + update_username() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/profiles_controller.rb, line 53
+def update_username
+  @user.update_attributes(username: params[:user][:username])
+
+  respond_to do |format|
+    format.js
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Project.html b/doc/code/classes/Project.html new file mode 100644 index 00000000000..004285485a1 --- /dev/null +++ b/doc/code/classes/Project.html @@ -0,0 +1,1392 @@ + + + + + Project + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
F
+
+ +
+ +
G
+
+ +
+ +
I
+
+ +
+ +
L
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
W
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + error_code
+ + + + + +
Class Public methods
+ +
+
+ + access_options() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 163
+def access_options
+  UsersProject.access_roles
+end
+
+
+ +
+ +
+
+ + active() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 96
+def active
+  joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
+end
+
+
+ +
+ +
+
+ + authorized_for(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 91
+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)
+end
+
+
+ +
+ +
+
+ + create_by_user(params, user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 114
+def create_by_user(params, user)
+  namespace_id = params.delete(:namespace_id)
+
+  project = Project.new params
+
+  Project.transaction do
+
+    # Parametrize path for project
+    #
+    # Ex.
+    #  'GitLab HQ'.parameterize => "gitlab-hq"
+    #
+    project.path = project.name.dup.parameterize
+
+    project.owner = user
+
+    # Apply namespace if user has access to it
+    # else fallback to user namespace
+    if namespace_id != Namespace.global_id
+      project.namespace_id = user.namespace_id
+
+      if namespace_id
+        group = Group.find_by_id(namespace_id)
+        if user.can? :manage_group, group
+          project.namespace_id = namespace_id
+        end
+      end
+    end
+
+    project.save!
+
+    # Add user as project master
+    project.users_projects.create!(project_access: UsersProject::MASTER, user: user)
+
+    # when project saved no team member exist so
+    # project repository should be updated after first user add
+    project.update_repository
+  end
+
+  project
+rescue Gitlab::Gitolite::AccessDenied => ex
+  project.error_code = :gitolite
+  project
+rescue => ex
+  project.error_code = :db
+  project.errors.add(:base, "Can't save project. Please try again later")
+  project
+end
+
+
+ +
+ +
+
+ + find_with_namespace(id) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 104
+def find_with_namespace(id)
+  if id.include?("/")
+    id = id.split("/")
+    namespace_id = Namespace.find_by_path(id.first).id
+    where(namespace_id: namespace_id).find_by_path(id.second)
+  else
+    where(path: id, namespace_id: nil).last
+  end
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 100
+def search query
+  where("projects.name LIKE :query OR projects.path LIKE :query", query: "%#{query}%")
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + build_commit_note(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 208
+def build_commit_note(commit)
+  notes.new(commit_id: commit.id, noteable_type: "Commit")
+end
+
+
+ +
+ +
+
+ + check_limit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 176
+def check_limit
+  unless owner.can_create_project?
+    errors[:base] << ("Your own projects limit is #{owner.projects_limit}! Please contact administrator to increase it")
+  end
+rescue
+  errors[:base] << ("Can't check your ability to create project")
+end
+
+
+ +
+ +
+
+ + code() + + +
+ + +
+

For compatibility with old code

+
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 253
+def code
+  path
+end
+
+
+ +
+ +
+
+ + commit_line_notes(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 216
+def commit_line_notes(commit)
+  notes.where(commit_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
+end
+
+
+ +
+ +
+
+ + commit_notes(commit) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 212
+def commit_notes(commit)
+  notes.where(commit_id: commit.id, noteable_type: "Commit", line_code: nil)
+end
+
+
+ +
+ +
+
+ + common_notes() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 204
+def common_notes
+  notes.where(noteable_type: ["", nil]).inc_author_project
+end
+
+
+ +
+ +
+
+ + git_error?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 168
+def git_error?
+  error_code == :gitolite
+end
+
+
+ +
+ +
+
+ + gitlab_ci?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 248
+def gitlab_ci?
+  gitlab_ci_service && gitlab_ci_service.active
+end
+
+
+ +
+ +
+
+ + issues_labels() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 240
+def issues_labels
+  issues.tag_counts_on(:labels)
+end
+
+
+ +
+ +
+
+ + items_for(entity) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 257
+def items_for entity
+  case entity
+  when 'issue' then
+    issues
+  when 'merge_request' then
+    merge_requests
+  end
+end
+
+
+ +
+ +
+
+ + last_activity() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 228
+def last_activity
+  last_event
+end
+
+
+ +
+ +
+
+ + last_activity_date() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 232
+def last_activity_date
+  last_event.try(:created_at) || updated_at
+end
+
+
+ +
+ +
+
+ + private?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 224
+def private?
+  private_flag
+end
+
+
+ +
+ +
+
+ + project_id() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 236
+def project_id
+  self.id
+end
+
+
+ +
+ +
+
+ + public?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 220
+def public?
+  !private_flag
+end
+
+
+ +
+ +
+
+ + repo_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 184
+def repo_name
+  denied_paths = %w(gitolite-admin admin dashboard groups help profile projects search)
+
+  if denied_paths.include?(path)
+    errors.add(:path, "like #{path} is not allowed")
+  end
+end
+
+
+ +
+ +
+
+ + saved?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 172
+def saved?
+  id && valid?
+end
+
+
+ +
+ +
+
+ + send_move_instructions() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 266
+def send_move_instructions
+  self.users_projects.each do |member|
+    Notify.project_was_moved_email(member.id).deliver
+  end
+end
+
+
+ +
+ +
+
+ + services() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 244
+def services
+  [gitlab_ci_service].compact
+end
+
+
+ +
+ +
+
+ + to_param() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 192
+def to_param
+  if namespace
+    namespace.path + "/" + path
+  else
+    path
+  end
+end
+
+
+ +
+ +
+
+ + web_url() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/project.rb, line 200
+def web_url
+  [Gitlab.config.gitlab.url, path_with_namespace].join("/")
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Project/TransferError.html b/doc/code/classes/Project/TransferError.html new file mode 100644 index 00000000000..2d0be3a4a13 --- /dev/null +++ b/doc/code/classes/Project/TransferError.html @@ -0,0 +1,76 @@ + + + + + Project::TransferError + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProjectHook.html b/doc/code/classes/ProjectHook.html new file mode 100644 index 00000000000..3fa9c75921b --- /dev/null +++ b/doc/code/classes/ProjectHook.html @@ -0,0 +1,92 @@ + + + + + ProjectHook + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProjectObserver.html b/doc/code/classes/ProjectObserver.html new file mode 100644 index 00000000000..bf2292a51f4 --- /dev/null +++ b/doc/code/classes/ProjectObserver.html @@ -0,0 +1,262 @@ + + + + + ProjectObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
L
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/project_observer.rb, line 2
+def after_create(project)
+  project.update_repository
+end
+
+
+ +
+ +
+
+ + after_destroy(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/project_observer.rb, line 10
+def after_destroy(project)
+  log_info("Project \"#{project.name}\" was removed")
+
+  project.destroy_repository
+end
+
+
+ +
+ +
+
+ + after_update(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/project_observer.rb, line 6
+def after_update(project)
+  project.send_move_instructions if project.namespace_id_changed?
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + log_info(message) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/project_observer.rb, line 22
+def log_info message
+  Gitlab::AppLogger.info message
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProjectResourceController.html b/doc/code/classes/ProjectResourceController.html new file mode 100644 index 00000000000..757055abbc1 --- /dev/null +++ b/doc/code/classes/ProjectResourceController.html @@ -0,0 +1,76 @@ + + + + + ProjectResourceController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProjectUpdateContext.html b/doc/code/classes/ProjectUpdateContext.html new file mode 100644 index 00000000000..3fe3f4d68f8 --- /dev/null +++ b/doc/code/classes/ProjectUpdateContext.html @@ -0,0 +1,148 @@ + + + + + ProjectUpdateContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute(role = :default) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/project_update_context.rb, line 2
+def execute(role = :default)
+  namespace_id = params[:project].delete(:namespace_id)
+
+  allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin
+
+  if allowed_transfer && namespace_id.present?
+    if namespace_id == Namespace.global_id
+      if project.namespace.present?
+        # Transfer to global namespace from anyone
+        project.transfer(nil)
+      end
+    elsif namespace_id.to_i != project.namespace_id
+      # Transfer to someone namespace
+      namespace = Namespace.find(namespace_id)
+      project.transfer(namespace)
+    end
+  end
+
+  project.update_attributes(params[:project], as: role)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProjectsController.html b/doc/code/classes/ProjectsController.html new file mode 100644 index 00000000000..3cc6dd07a3e --- /dev/null +++ b/doc/code/classes/ProjectsController.html @@ -0,0 +1,566 @@ + + + + + ProjectsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
F
+
+ +
+ +
G
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
U
+
+ +
+ +
W
+
+
    + + +
  • + wall +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 20
+def create
+  @project = Project.create_by_user(params[:project], current_user)
+
+  respond_to do |format|
+    flash[:notice] = 'Project was successfully created.' if @project.saved?
+    format.html do
+      if @project.saved?
+        redirect_to @project
+      else
+        render action: "new"
+      end
+    end
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 99
+def destroy
+  return access_denied! unless can?(current_user, :remove_project, project)
+
+  # Delete team first in order to prevent multiple gitolite calls
+  project.truncate_team
+
+  project.destroy
+
+  respond_to do |format|
+    format.html { redirect_to root_path }
+  end
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 17
+def edit
+end
+
+
+ +
+ +
+
+ + files() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 72
+def files
+  @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100)
+end
+
+
+ +
+ +
+
+ + graph() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 89
+def graph
+  respond_to do |format|
+    format.html
+    format.json do
+      graph = Gitlab::Graph::JsonBuilder.new(project)
+      render :json => graph.to_json
+    end
+  end
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 13
+def new
+  @project = Project.new
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 55
+def show
+  limit = (params[:limit] || 20).to_i
+  @events = @project.events.recent.limit(limit).offset(params[:offset] || 0)
+
+  respond_to do |format|
+    format.html do
+      unless @project.empty_repo?
+        @last_push = current_user.recent_push(@project.id)
+        render :show
+      else
+        render "projects/empty"
+      end
+    end
+    format.js
+  end
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 36
+def update
+  status = ProjectUpdateContext.new(project, current_user, params).execute
+
+  respond_to do |format|
+    if status
+      flash[:notice] = 'Project was successfully updated.'
+      format.html { redirect_to edit_project_path(project), notice: 'Project was successfully updated.' }
+      format.js
+    else
+      format.html { render action: "edit" }
+      format.js
+    end
+  end
+
+rescue Project::TransferError => ex
+  @error = ex
+  render :update_failed
+end
+
+
+ +
+ +
+
+ + wall() + + +
+ + +
+

Wall

+
+ + + + + + +
+ + +
+
# File app/controllers/projects_controller.rb, line 80
+def wall
+  return render_404 unless @project.wall_enabled
+  @note = Note.new
+
+  respond_to do |format|
+    format.html
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProjectsHelper.html b/doc/code/classes/ProjectsHelper.html new file mode 100644 index 00000000000..a2084279d25 --- /dev/null +++ b/doc/code/classes/ProjectsHelper.html @@ -0,0 +1,384 @@ + + + + + ProjectsHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
G
+
+ +
+ +
L
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + grouper_project_members(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/projects_helper.rb, line 2
+def grouper_project_members(project)
+  @project.users_projects.sort_by(&:project_access).reverse.group_by(&:project_access)
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + + +
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + + +
+ +
+ +
+
+ + project_title(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/projects_helper.rb, line 49
+def project_title project
+  if project.group
+    project.name_with_namespace
+  else
+    project.name
+  end
+end
+
+
+ +
+ +
+
+ + remove_from_team_message(project, member) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/projects_helper.rb, line 6
+def remove_from_team_message(project, member)
+  "You are going to remove #{member.user_name} from #{project.name}. Are you sure?"
+end
+
+
+ +
+ +
+
+ + tm_path(team_member) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/projects_helper.rb, line 45
+def tm_path team_member
+  project_team_member_path(@project, team_member)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProtectedBranch.html b/doc/code/classes/ProtectedBranch.html new file mode 100644 index 00000000000..c5399ed48ae --- /dev/null +++ b/doc/code/classes/ProtectedBranch.html @@ -0,0 +1,206 @@ + + + + + ProtectedBranch + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: protected_branches

+ +
id         :integer          not null, primary key
+project_id :integer          not null
+name       :string(255)      not null
+created_at :datetime         not null
+updated_at :datetime         not null
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
U
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + commit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/protected_branch.rb, line 28
+def commit
+  project.commit(self.name)
+end
+
+
+ +
+ +
+
+ + update_repository() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/protected_branch.rb, line 24
+def update_repository
+  git_host.update_repository(project)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ProtectedBranchesController.html b/doc/code/classes/ProtectedBranchesController.html new file mode 100644 index 00000000000..f1175852f39 --- /dev/null +++ b/doc/code/classes/ProtectedBranchesController.html @@ -0,0 +1,232 @@ + + + + + ProtectedBranchesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/protected_branches_controller.rb, line 13
+def create
+  @project.protected_branches.create(params[:protected_branch])
+  redirect_to project_protected_branches_path(@project)
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/protected_branches_controller.rb, line 18
+def destroy
+  @project.protected_branches.find(params[:id]).destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_protected_branches_path }
+    format.js { render nothing: true }
+  end
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/protected_branches_controller.rb, line 8
+def index
+  @branches = @project.protected_branches.all
+  @protected_branch = @project.protected_branches.new
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/PushEvent.html b/doc/code/classes/PushEvent.html new file mode 100644 index 00000000000..8b74ebeea7b --- /dev/null +++ b/doc/code/classes/PushEvent.html @@ -0,0 +1,959 @@ + + + + + PushEvent + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
C
+
+ +
+ +
L
+
+ +
+ +
M
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
T
+
+ +
+ +
V
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + branch?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 12
+def branch?
+  data[:ref]["refs/heads"]
+end
+
+
+ +
+ +
+
+ + branch_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 48
+def branch_name
+  @branch_name ||= data[:ref].gsub("refs/heads/", "")
+end
+
+
+ +
+ +
+
+ + commit_from() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 32
+def commit_from
+  data[:before]
+end
+
+
+ +
+ +
+
+ + commit_to() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 36
+def commit_to
+  data[:after]
+end
+
+
+ +
+ +
+
+ + commits() + + +
+ + +
+

Max 20 commits from push DESC

+
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 57
+def commits
+  @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse
+end
+
+
+ +
+ +
+
+ + commits_count() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 61
+def commits_count 
+  data[:total_commits_count] || commits.count || 0
+end
+
+
+ +
+ +
+
+ + last_commit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 85
+def last_commit
+  project.commit(commit_to)
+rescue => ex
+  nil
+end
+
+
+ +
+ +
+
+ + last_push_to_non_root?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 97
+def last_push_to_non_root?
+  branch? && project.default_branch != branch_name
+end
+
+
+ +
+ +
+
+ + md_ref?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 28
+def md_ref?
+  !(rm_ref? || new_ref?)
+end
+
+
+ +
+ +
+
+ + new_branch?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 16
+def new_branch?
+  commit_from =~ %r^00000/
+end
+
+
+ +
+ +
+
+ + new_ref?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 20
+def new_ref?
+  commit_from =~ %r^00000/
+end
+
+
+ +
+ +
+
+ + parent_commit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 79
+def parent_commit
+  project.commit(commit_from)
+rescue => ex
+  nil
+end
+
+
+ +
+ +
+
+ + push_action_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 69
+def push_action_name
+  if new_ref?
+    "pushed new"
+  elsif rm_ref?
+    "deleted"
+  else
+    "pushed to"
+  end
+end
+
+
+ +
+ +
+
+ + push_with_commits?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 91
+def push_with_commits? 
+  md_ref? && commits.any? && parent_commit && last_commit
+rescue Grit::NoSuchPathError
+  false
+end
+
+
+ +
+ +
+
+ + ref_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 40
+def ref_name
+  if tag?
+    tag_name
+  else
+    branch_name
+  end
+end
+
+
+ +
+ +
+
+ + ref_type() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 65
+def ref_type
+  tag? ? "tag" : "branch"
+end
+
+
+ +
+ +
+
+ + rm_ref?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 24
+def rm_ref?
+  commit_to =~ %r^00000/
+end
+
+
+ +
+ +
+
+ + tag?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 8
+def tag?
+  data[:ref]["refs/tags"]
+end
+
+
+ +
+ +
+
+ + tag_name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 52
+def tag_name
+  @tag_name ||= data[:ref].gsub("refs/tags/", "")
+end
+
+
+ +
+ +
+
+ + valid_push?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_event.rb, line 2
+def valid_push?
+  data[:ref]
+rescue => ex
+  false
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/PushObserver.html b/doc/code/classes/PushObserver.html new file mode 100644 index 00000000000..f747fb4a958 --- /dev/null +++ b/doc/code/classes/PushObserver.html @@ -0,0 +1,512 @@ + + + + + PushObserver + + + + + + + + + + + + + +
+
+ +
+ +

Includes methods for handling Git Push events

+ +

Triggered by PostReceive job

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
O
+
+ +
+ +
P
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute_hooks(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 52
+def execute_hooks(data)
+  hooks.each { |hook| hook.execute(data) }
+end
+
+
+ +
+ +
+
+ + execute_services(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 56
+def execute_services(data)
+  services.each do |service|
+
+    # Call service hook only if it is active
+    service.execute(data) if service.active
+  end
+end
+
+
+ +
+ +
+
+ + observe_push(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 43
+def observe_push(data)
+  Event.create(
+    project: self,
+    action: Event::Pushed,
+    data: data,
+    author_id: data[:user_id]
+  )
+end
+
+
+ +
+ +
+
+ + post_receive_data(oldrev, newrev, ref, user) + + +
+ + +
+

Produce a hash of post-receive data

+ +

data = {

+ +
before: String,
+after: String,
+ref: String,
+user_id: String,
+user_name: String,
+repository: {
+  name: String,
+  url: String,
+  description: String,
+  homepage: String,
+},
+commits: Array,
+total_commits_count: Fixnum
+ +

}

+
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 82
+def post_receive_data(oldrev, newrev, ref, user)
+
+  push_commits = commits_between(oldrev, newrev)
+
+  # Total commits count
+  push_commits_count = push_commits.size
+
+  # Get latest 20 commits ASC
+  push_commits_limited = push_commits.last(20)
+
+  # Hash to be passed as post_receive_data
+  data = {
+    before: oldrev,
+    after: newrev,
+    ref: ref,
+    user_id: user.id,
+    user_name: user.name,
+    repository: {
+      name: name,
+      url: url_to_repo,
+      description: description,
+      homepage: web_url,
+    },
+    commits: [],
+    total_commits_count: push_commits_count
+  }
+
+  # For perfomance purposes maximum 20 latest commits
+  # will be passed as post receive hook data.
+  #
+  push_commits_limited.each do |commit|
+    data[:commits] << {
+      id: commit.id,
+      message: commit.safe_message,
+      timestamp: commit.date.xmlschema,
+      url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{commit.id}",
+      author: {
+        name: commit.author_name,
+        email: commit.author_email
+      }
+    }
+  end
+
+  data
+end
+
+
+ +
+ +
+
+ + push_to_branch?(ref, oldrev) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 36
+def push_to_branch? ref, oldrev
+  ref_parts = ref.split('/')
+
+  # Return if this is not a push to a branch (e.g. new commits)
+  !(ref_parts[1] !~ %rheads/ || oldrev == "00000000000000000000000000000000")
+end
+
+
+ +
+ +
+
+ + trigger_post_receive(oldrev, newrev, ref, user) + + +
+ + +
+

This method will be called after each post receive and only if the provided +user is present in GitLab.

+ +

All callbacks for post receive should be placed here.

+
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 9
+def trigger_post_receive(oldrev, newrev, ref, user)
+  data = post_receive_data(oldrev, newrev, ref, user)
+
+  # Create push event
+  self.observe_push(data)
+
+  if push_to_branch? ref, oldrev
+    # Close merged MR
+    self.update_merge_requests(oldrev, newrev, ref, user)
+
+    # Execute web hooks
+    self.execute_hooks(data.dup)
+
+    # Execute project services
+    self.execute_services(data.dup)
+  end
+
+  # Create satellite
+  self.satellite.create unless self.satellite.exists?
+
+  # Discover the default branch, but only if it hasn't already been set to
+  # something else
+  if default_branch.nil?
+    update_attributes(default_branch: discover_default_branch)
+  end
+end
+
+
+ +
+ +
+
+ + update_merge_requests(oldrev, newrev, ref, user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/push_observer.rb, line 128
+def update_merge_requests(oldrev, newrev, ref, user)
+  return true unless ref =~ %rheads/
+  branch_name = ref.gsub("refs/heads/", "")
+  c_ids = self.commits_between(oldrev, newrev).map(&:id)
+
+  # Update code for merge requests
+  mrs = self.merge_requests.opened.find_all_by_branch(branch_name).all
+  mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
+
+  # Close merge requests
+  mrs = self.merge_requests.opened.where(target_branch: branch_name).all
+  mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
+  mrs.each { |merge_request| merge_request.merge!(user.id) }
+
+  true
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Redcarpet.html b/doc/code/classes/Redcarpet.html new file mode 100644 index 00000000000..e1b53d96fea --- /dev/null +++ b/doc/code/classes/Redcarpet.html @@ -0,0 +1,79 @@ + + + + + Redcarpet + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Redcarpet/Render.html b/doc/code/classes/Redcarpet/Render.html new file mode 100644 index 00000000000..29a763942b5 --- /dev/null +++ b/doc/code/classes/Redcarpet/Render.html @@ -0,0 +1,79 @@ + + + + + Redcarpet::Render + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Redcarpet/Render/GitlabHTML.html b/doc/code/classes/Redcarpet/Render/GitlabHTML.html new file mode 100644 index 00000000000..664207dd196 --- /dev/null +++ b/doc/code/classes/Redcarpet/Render/GitlabHTML.html @@ -0,0 +1,264 @@ + + + + + Redcarpet::Render::GitlabHTML + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [R] + h
+ [R] + template
+ + + + + +
Class Public methods
+ +
+
+ + new(template, options = {}) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/redcarpet/render/gitlab_html.rb, line 6
+def initialize(template, options = {})
+  @template = template
+  @project = @template.instance_variable_get("@project")
+  super options
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + block_code(code, language) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/redcarpet/render/gitlab_html.rb, line 12
+  def block_code(code, language)
+    options = { options: {encoding: 'utf-8'} }
+    options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language)
+
+    # New lines are placed to fix an rendering issue
+    # with code wrapped inside <h1> tag for next case:
+    #
+    # # Title kinda h1
+    #
+    #     ruby code here
+    #
+    "
+       <div class="#{h.user_color_scheme_class}">#{Pygments.highlight(code, options)}</div>
+
+"
+  end
+
+
+ +
+ +
+
+ + postprocess(full_document) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File lib/redcarpet/render/gitlab_html.rb, line 30
+def postprocess(full_document)
+  h.gfm(full_document)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/RefsController.html b/doc/code/classes/RefsController.html new file mode 100644 index 00000000000..971b8fcb9a3 --- /dev/null +++ b/doc/code/classes/RefsController.html @@ -0,0 +1,313 @@ + + + + + RefsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
L
+
+ +
+ +
R
+
+
    + + +
  • + ref +
  • + +
+
+ +
S
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + logs_tree() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/refs_controller.rb, line 30
+def logs_tree
+  contents = @tree.contents
+  @logs = contents.map do |content|
+    file = params[:path] ? File.join(params[:path], content.name) : content.name
+    last_commit = @project.commits(@commit.id, file, 1).last
+    last_commit = CommitDecorator.decorate(last_commit)
+    {
+      file_name: content.name,
+      commit: last_commit
+    }
+  end
+end
+
+
+ +
+ +
+
+ + switch() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/refs_controller.rb, line 11
+def switch
+  respond_to do |format|
+    format.html do
+      new_path = if params[:destination] == "tree"
+                   project_tree_path(@project, @ref)
+                 else
+                   project_commits_path(@project, @ref)
+                 end
+
+      redirect_to new_path
+    end
+    format.js do
+      @ref = params[:ref]
+      define_tree_vars
+      render "tree"
+    end
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + define_tree_vars() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/refs_controller.rb, line 45
+def define_tree_vars
+  params[:path] = nil if params[:path].blank?
+
+  @repo = project.repo
+  @commit = project.commit(@ref)
+  @commit = CommitDecorator.decorate(@commit)
+  @tree = Tree.new(@commit.tree, project, @ref, params[:path])
+  @tree = TreeDecorator.new(@tree)
+  @hex_path = Digest::SHA1.hexdigest(params[:path] || "")
+
+  if params[:path]
+    @logs_path = logs_file_project_ref_path(@project, @ref, params[:path])
+  else
+    @logs_path = logs_tree_project_ref_path(@project, @ref)
+  end
+rescue
+  return render_404
+end
+
+
+ +
+ +
+
+ + ref() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/refs_controller.rb, line 64
+def ref
+  @ref = params[:id] || params[:ref]
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/RepositoriesController.html b/doc/code/classes/RepositoriesController.html new file mode 100644 index 00000000000..cd661646d44 --- /dev/null +++ b/doc/code/classes/RepositoriesController.html @@ -0,0 +1,325 @@ + + + + + RepositoriesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
S
+
+ +
+ +
T
+
+
    + + +
  • + tags +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + archive() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/repositories_controller.rb, line 24
+def archive
+  unless can?(current_user, :download_code, @project)
+    render_404 and return
+  end
+
+
+  file_path = @project.archive_repo(params[:ref])
+
+  if file_path
+    # Send file to user
+    send_file file_path
+  else
+    render_404
+  end
+end
+
+
+ +
+ +
+
+ + branches() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/repositories_controller.rb, line 11
+def branches
+  @branches = @project.branches
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/repositories_controller.rb, line 7
+def show
+  @activities = @project.commits_with_refs(20)
+end
+
+
+ +
+ +
+
+ + stats() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/repositories_controller.rb, line 19
+def stats
+  @stats = Gitlab::GitStats.new(@project.repo, @project.root_ref)
+  @graph = @stats.graph
+end
+
+
+ +
+ +
+
+ + tags() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/repositories_controller.rb, line 15
+def tags
+  @tags = @project.tags
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Repository.html b/doc/code/classes/Repository.html new file mode 100644 index 00000000000..a6266790d88 --- /dev/null +++ b/doc/code/classes/Repository.html @@ -0,0 +1,1737 @@ + + + + + Repository + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+ +
+ +
F
+
+ +
+ +
H
+
+ +
+ +
L
+
+ +
+ +
N
+
+ +
+ +
O
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
V
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + archive_repo(ref) + + +
+ + +
+

Archive Project to .tar.gz

+ +

Already packed repo archives stored at +app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 175
+def archive_repo(ref)
+  ref = ref || self.root_ref
+  commit = self.commit(ref)
+  return nil unless commit
+
+  # Build file path
+  file_name = self.path + "-" + commit.id.to_s + ".tar.gz"
+  storage_path = Rails.root.join("tmp", "repositories", self.path_with_namespace)
+  file_path = File.join(storage_path, file_name)
+
+  # Put files into a directory before archiving
+  prefix = self.path + "/"
+
+  # Create file if not exists
+  unless File.exists?(file_path)
+    FileUtils.mkdir_p storage_path
+    file = self.repo.archive_to_file(ref, prefix,  file_path)
+  end
+
+  file_path
+end
+
+
+ +
+ +
+
+ + branch_names() + + +
+ + +
+

Returns an Array of branch names

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 67
+def branch_names
+  repo.branches.collect(&:name).sort
+end
+
+
+ +
+ +
+
+ + branches() + + +
+ + +
+

Returns an Array of Branches

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 72
+def branches
+  repo.branches.sort_by(&:name)
+end
+
+
+ +
+ +
+
+ + commit(commit_id = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 15
+def commit(commit_id = nil)
+  Commit.find_or_first(repo, commit_id, root_ref)
+end
+
+
+ +
+ +
+
+ + commits(ref, path = nil, limit = nil, offset = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 31
+def commits(ref, path = nil, limit = nil, offset = nil)
+  Commit.commits(repo, ref, path, limit, offset)
+end
+
+
+ +
+ +
+
+ + commits_between(from, to) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 39
+def commits_between(from, to)
+  Commit.commits_between(repo, from, to)
+end
+
+
+ +
+ +
+
+ + commits_since(date) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 27
+def commits_since(date)
+  Commit.commits_since(repo, date)
+end
+
+
+ +
+ +
+
+ + commits_with_refs(n = 20) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 23
+def commits_with_refs(n = 20)
+  Commit.commits_with_refs(repo, n)
+end
+
+
+ +
+ +
+
+ + destroy_repository() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 111
+def destroy_repository
+  git_host.remove_repository(self)
+end
+
+
+ +
+ +
+
+ + discover_default_branch() + + +
+ + +
+

Discovers the default branch based on the repository’s available branches

+
  • +

    If no branches are present, returns nil

    +
  • +

    If one branch is present, returns its name

    +
  • +

    If two or more branches are present, returns the one that has a name +matching #root_ref +(default_branch or ‘master’ if default_branch is nil)

    +
+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 146
+def discover_default_branch
+  if branch_names.length == 0
+    nil
+  elsif branch_names.length == 1
+    branch_names.first
+  else
+    branch_names.select { |v| v == root_ref }.first
+  end
+end
+
+
+ +
+ +
+
+ + empty_repo?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 11
+def empty_repo?
+  !repo_exists? || !has_commits?
+end
+
+
+ +
+ +
+
+ + fresh_commits(n = 10) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 19
+def fresh_commits(n = 10)
+  Commit.fresh_commits(repo, n)
+end
+
+
+ +
+ +
+
+ + has_commits?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 156
+def has_commits?
+  !!commit
+rescue Grit::NoSuchPathError
+  false
+end
+
+
+ +
+ +
+
+ + has_post_receive_file?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 47
+def has_post_receive_file?
+  !!hook_file
+end
+
+
+ +
+ +
+
+ + heads() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 121
+def heads
+  @heads ||= repo.heads
+end
+
+
+ +
+ +
+
+ + hook_file() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 59
+def hook_file
+  @hook_file ||= begin
+                   hook_path = File.join(path_to_repo, 'hooks', 'post-receive')
+                   File.read(hook_path) if File.exists?(hook_path)
+                 end
+end
+
+
+ +
+ +
+
+ + http_url_to_repo() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 201
+def http_url_to_repo
+  http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('')
+end
+
+
+ +
+ +
+
+ + last_commit_for(ref, path = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 35
+def last_commit_for(ref, path = nil)
+  commits(ref, path, 1).first
+end
+
+
+ +
+ +
+
+ + namespace_dir() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 103
+def namespace_dir
+  namespace.try(:path) || ''
+end
+
+
+ +
+ +
+
+ + open_branches() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 131
+def open_branches
+  if protected_branches.empty?
+    self.repo.heads
+  else
+    pnames = protected_branches.map(&:name)
+    self.repo.heads.reject { |h| pnames.include?(h.name) }
+  end.sort_by(&:name)
+end
+
+
+ +
+ +
+
+ + path_to_repo() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 99
+def path_to_repo
+  File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git")
+end
+
+
+ +
+ +
+
+ + protected_branch?(branch_name) + + +
+ + +
+

Check if current branch name is marked as protected in the system

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 206
+def protected_branch? branch_name
+  protected_branches.map(&:name).include?(branch_name)
+end
+
+
+ +
+ +
+
+ + ref_names() + + +
+ + +
+

Returns an Array of branch and tag names

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 87
+def ref_names
+  [branch_names + tag_names].flatten
+end
+
+
+ +
+ +
+
+ + repo() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 91
+def repo
+  @repo ||= Grit::Repo.new(path_to_repo)
+end
+
+
+ +
+ +
+
+ + repo_exists?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 115
+def repo_exists?
+  @repo_exists ||= (repo && !repo.branches.empty?)
+rescue
+  @repo_exists = false
+end
+
+
+ +
+ +
+
+ + root_ref() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 162
+def root_ref
+  default_branch || "master"
+end
+
+
+ +
+ +
+
+ + root_ref?(branch) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 166
+def root_ref?(branch)
+  root_ref == branch
+end
+
+
+ +
+ +
+
+ + satellite() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 43
+def satellite
+  @satellite ||= Gitlab::Satellite::Satellite.new(self)
+end
+
+
+ +
+ +
+
+ + ssh_url_to_repo() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 197
+def ssh_url_to_repo
+  url_to_repo
+end
+
+
+ +
+ +
+
+ + tag_names() + + +
+ + +
+

Returns an Array of tag names

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 77
+def tag_names
+  repo.tags.collect(&:name).sort.reverse
+end
+
+
+ +
+ +
+
+ + tags() + + +
+ + +
+

Returns an Array of Tags

+
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 82
+def tags
+  repo.tags.sort_by(&:name).reverse
+end
+
+
+ +
+ +
+
+ + tree(fcommit, path = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 125
+def tree(fcommit, path = nil)
+  fcommit = commit if fcommit == :head
+  tree = fcommit.tree
+  path ? (tree / path) : tree
+end
+
+
+ +
+ +
+
+ + update_repository() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 107
+def update_repository
+  git_host.update_repository(self)
+end
+
+
+ +
+ +
+
+ + url_to_repo() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 95
+def url_to_repo
+  git_host.url_to_repo(path_with_namespace)
+end
+
+
+ +
+ +
+
+ + valid_hook_file() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 55
+def valid_hook_file
+  @valid_hook_file ||= File.read(Rails.root.join('lib', 'hooks', 'post-receive'))
+end
+
+
+ +
+ +
+
+ + valid_post_receive_file?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 51
+def valid_post_receive_file?
+  valid_hook_file == hook_file
+end
+
+
+ +
+ +
+
+ + valid_repo?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/repository.rb, line 4
+def valid_repo?
+  repo
+rescue
+  errors.add(:path, "Invalid repository path")
+  false
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ResqueAuthentication.html b/doc/code/classes/ResqueAuthentication.html new file mode 100644 index 00000000000..ec3fc9e470f --- /dev/null +++ b/doc/code/classes/ResqueAuthentication.html @@ -0,0 +1,182 @@ + + + + + ResqueAuthentication + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+
    + + +
  • + call +
  • + +
+
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + new(app) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File config/initializers/4_resque.rb, line 14
+def initialize(app)
+  @app = app
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + call(env) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File config/initializers/4_resque.rb, line 18
+def call(env)
+  account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user)
+  raise "Access denied" if !account.admin?
+  @app.call(env)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SearchContext.html b/doc/code/classes/SearchContext.html new file mode 100644 index 00000000000..b8ecb2e716d --- /dev/null +++ b/doc/code/classes/SearchContext.html @@ -0,0 +1,262 @@ + + + + + SearchContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
R
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + +
+ [RW] + params
+ [RW] + project_ids
+ + + + + +
Class Public methods
+ +
+
+ + new(project_ids, params) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/search_context.rb, line 4
+def initialize(project_ids, params)
+  @project_ids, @params = project_ids, params.dup
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/search_context.rb, line 8
+def execute
+  query = params[:search]
+
+  return result unless query.present?
+
+  result[:projects] = Project.where(id: project_ids).search(query).limit(10)
+  result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
+  result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
+  result[:wiki_pages] = Wiki.where(project_id: project_ids).search(query).limit(10)
+  result
+end
+
+
+ +
+ +
+
+ + result() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/search_context.rb, line 20
+def result
+  @result ||= {
+    projects: [],
+    merge_requests: [],
+    issues: [],
+    wiki_pages: []
+  }
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SearchController.html b/doc/code/classes/SearchController.html new file mode 100644 index 00000000000..5f26c934c5a --- /dev/null +++ b/doc/code/classes/SearchController.html @@ -0,0 +1,136 @@ + + + + + SearchController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/search_controller.rb, line 2
+def show
+  result = SearchContext.new(current_user.project_ids, params).execute
+
+  @projects       = result[:projects]
+  @merge_requests = result[:merge_requests]
+  @issues         = result[:issues]
+  @wiki_pages     = result[:wiki_pages]
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Service.html b/doc/code/classes/Service.html new file mode 100644 index 00000000000..f4973cb37f6 --- /dev/null +++ b/doc/code/classes/Service.html @@ -0,0 +1,94 @@ + + + + + Service + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: services

+ +
id          :integer          not null, primary key
+type        :string(255)
+title       :string(255)
+token       :string(255)
+project_id  :integer          not null
+created_at  :datetime         not null
+updated_at  :datetime         not null
+active      :boolean          default(FALSE), not null
+project_url :string(255)
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ServiceHook.html b/doc/code/classes/ServiceHook.html new file mode 100644 index 00000000000..faff9256de2 --- /dev/null +++ b/doc/code/classes/ServiceHook.html @@ -0,0 +1,92 @@ + + + + + ServiceHook + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/ServicesController.html b/doc/code/classes/ServicesController.html new file mode 100644 index 00000000000..c0165b096d7 --- /dev/null +++ b/doc/code/classes/ServicesController.html @@ -0,0 +1,287 @@ + + + + + ServicesController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
T
+
+
    + + +
  • + test +
  • + +
+
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/services_controller.rb, line 11
+def edit
+  @service = @project.gitlab_ci_service
+
+  # Create if missing
+  @service = @project.create_gitlab_ci_service unless @service
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/services_controller.rb, line 7
+def index
+  @gitlab_ci_service = @project.gitlab_ci_service
+end
+
+
+ +
+ +
+
+ + test() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/services_controller.rb, line 28
+def test
+  commits = project.commits(project.default_branch, nil, 3)
+  data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user)
+
+  @service = project.gitlab_ci_service
+  @service.execute(data)
+
+  redirect_to :back
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/services_controller.rb, line 18
+def update
+  @service = @project.gitlab_ci_service
+
+  if @service.update_attributes(params[:service])
+    redirect_to edit_project_service_path(@project, :gitlab_ci)
+  else
+    render 'edit'
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Settings.html b/doc/code/classes/Settings.html new file mode 100644 index 00000000000..05219228dbe --- /dev/null +++ b/doc/code/classes/Settings.html @@ -0,0 +1,131 @@ + + + + + Settings + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
G
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + gitlab_on_non_standard_port?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File config/initializers/1_settings.rb, line 5
+def gitlab_on_non_standard_port?
+  ![443, 80].include?(gitlab.port.to_i)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Snippet.html b/doc/code/classes/Snippet.html new file mode 100644 index 00000000000..a71f13165fc --- /dev/null +++ b/doc/code/classes/Snippet.html @@ -0,0 +1,402 @@ + + + + + Snippet + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: snippets

+ +
id         :integer          not null, primary key
+title      :string(255)
+content    :text
+author_id  :integer          not null
+project_id :integer          not null
+created_at :datetime         not null
+updated_at :datetime         not null
+file_name  :string(255)
+expires_at :datetime
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+
    + + +
  • + data +
  • + +
+
+ +
E
+
+ +
+ +
M
+
+
    + + +
  • + mode +
  • + +
+
+ +
N
+
+
    + + +
  • + name +
  • + +
+
+ +
S
+
+
    + + +
  • + size +
  • + +
+
+ +
+ + + + +
Included Modules
+
    + +
  • + + Linguist::BlobHelper + +
  • + +
+ + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + content_types() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/snippet.rb, line 38
+def self.content_types
+  [
+    ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java",
+    ".haml", ".html", ".sass", ".scss", ".xml", ".php", ".erb",
+    ".js", ".sh", ".coffee", ".yml", ".md"
+  ]
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + data() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/snippet.rb, line 46
+def data
+  content
+end
+
+
+ +
+ +
+
+ + expired?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/snippet.rb, line 62
+def expired?
+  expires_at && expires_at < Time.current
+end
+
+
+ +
+ +
+
+ + mode() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/snippet.rb, line 58
+def mode
+  nil
+end
+
+
+ +
+ +
+
+ + name() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/snippet.rb, line 54
+def name
+  file_name
+end
+
+
+ +
+ +
+
+ + size() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/snippet.rb, line 50
+def size
+  0
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SnippetsController.html b/doc/code/classes/SnippetsController.html new file mode 100644 index 00000000000..fd7e0fe6d19 --- /dev/null +++ b/doc/code/classes/SnippetsController.html @@ -0,0 +1,611 @@ + + + + + SnippetsController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
R
+
+
    + + +
  • + raw +
  • + +
+
+ +
S
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 26
+def create
+  @snippet = @project.snippets.new(params[:snippet])
+  @snippet.author = current_user
+  @snippet.save
+
+  if @snippet.valid?
+    redirect_to [@project, @snippet]
+  else
+    respond_with(@snippet)
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 55
+def destroy
+  return access_denied! unless can?(current_user, :admin_snippet, @snippet)
+
+  @snippet.destroy
+
+  redirect_to project_snippets_path(@project)
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 38
+def edit
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 18
+def index
+  @snippets = @project.snippets.fresh
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 22
+def new
+  @snippet = @project.snippets.new
+end
+
+
+ +
+ +
+
+ + raw() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 63
+def raw
+  send_data(
+    @snippet.content,
+    type: "text/plain",
+    disposition: 'inline',
+    filename: @snippet.file_name
+  )
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 51
+def show
+  @note = @project.notes.new(noteable: @snippet)
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 41
+def update
+  @snippet.update_attributes(params[:snippet])
+
+  if @snippet.valid?
+    redirect_to [@project, @snippet]
+  else
+    respond_with(@snippet)
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + authorize_admin_snippet!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 82
+def authorize_admin_snippet!
+  return render_404 unless can?(current_user, :admin_snippet, @snippet)
+end
+
+
+ +
+ +
+
+ + authorize_modify_snippet!() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 78
+def authorize_modify_snippet!
+  return render_404 unless can?(current_user, :modify_snippet, @snippet)
+end
+
+
+ +
+ +
+
+ + snippet() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/snippets_controller.rb, line 74
+def snippet
+  @snippet ||= @project.snippets.find(params[:id])
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SnippetsHelper.html b/doc/code/classes/SnippetsHelper.html new file mode 100644 index 00000000000..4230a0cce79 --- /dev/null +++ b/doc/code/classes/SnippetsHelper.html @@ -0,0 +1,131 @@ + + + + + SnippetsHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
L
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + lifetime_select_options() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/snippets_helper.rb, line 2
+def lifetime_select_options
+  options = [
+      ['forever', nil],
+      ['1 day',   "#{Date.current + 1.day}"],
+      ['1 week',  "#{Date.current + 1.week}"],
+      ['1 month', "#{Date.current + 1.month}"]
+  ]
+  options_for_select(options)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/StaticModel.html b/doc/code/classes/StaticModel.html new file mode 100644 index 00000000000..46ead77607d --- /dev/null +++ b/doc/code/classes/StaticModel.html @@ -0,0 +1,377 @@ + + + + + StaticModel + + + + + + + + + + + + + +
+
+ +
+ +

Provides an ActiveRecord-like interface to a model whose data is not +persisted to a database.

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + +
Methods
+
+ +
#
+
+
    + + +
  • + ==, +
  • + + +
  • + [] +
  • + +
+
+ +
D
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + ==(other) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 40
+def ==(other)
+  if other.is_a? StaticModel
+    id == other.id
+  else
+    super
+  end
+end
+
+
+ +
+ +
+
+ + [](key) + + +
+ + +
+

Used by AR for fetching attributes

+ +

Pass it along if we respond to it.

+
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 20
+def [](key)
+  send(key) if respond_to?(key)
+end
+
+
+ +
+ +
+
+ + destroyed?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 36
+def destroyed?
+  false
+end
+
+
+ +
+ +
+
+ + new_record?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 28
+def new_record?
+  false
+end
+
+
+ +
+ +
+
+ + persisted?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 32
+def persisted?
+  false
+end
+
+
+ +
+ +
+
+ + to_param() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 24
+def to_param
+  id
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/StaticModel/ClassMethods.html b/doc/code/classes/StaticModel/ClassMethods.html new file mode 100644 index 00000000000..38508f6d91f --- /dev/null +++ b/doc/code/classes/StaticModel/ClassMethods.html @@ -0,0 +1,172 @@ + + + + + StaticModel::ClassMethods + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + base_class() + + +
+ + +
+

Used by ActiveRecord’s polymorphic association to set object_type

+
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 12
+def base_class
+  self
+end
+
+
+ +
+ +
+
+ + primary_key() + + +
+ + +
+

Used by ActiveRecord’s polymorphic association to set object_id

+
+ + + + + + +
+ + +
+
# File app/roles/static_model.rb, line 7
+def primary_key
+  'id'
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SystemHook.html b/doc/code/classes/SystemHook.html new file mode 100644 index 00000000000..4f1ce71fbba --- /dev/null +++ b/doc/code/classes/SystemHook.html @@ -0,0 +1,191 @@ + + + + + SystemHook + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + all_hooks_fire(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/system_hook.rb, line 15
+def self.all_hooks_fire(data)
+  SystemHook.all.each do |sh|
+    sh.async_execute data
+  end
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + async_execute(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/system_hook.rb, line 21
+def async_execute(data)
+  Resque.enqueue(SystemHookWorker, id, data)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SystemHookObserver.html b/doc/code/classes/SystemHookObserver.html new file mode 100644 index 00000000000..24609a5c916 --- /dev/null +++ b/doc/code/classes/SystemHookObserver.html @@ -0,0 +1,227 @@ + + + + + SystemHookObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(model) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/system_hook_observer.rb, line 4
+def after_create(model)
+  if model.kind_of? Project
+    SystemHook.all_hooks_fire({
+      event_name: "project_create",
+      name: model.name,
+      path: model.path,
+      project_id: model.id,
+      owner_name: model.owner.name,
+      owner_email: model.owner.email,
+      created_at: model.created_at
+    })
+  elsif model.kind_of? User 
+    SystemHook.all_hooks_fire({
+      event_name: "user_create",
+      name: model.name,
+      email: model.email,
+      created_at: model.created_at
+    })
+
+  elsif model.kind_of? UsersProject
+    SystemHook.all_hooks_fire({
+      event_name: "user_add_to_team",
+      project_name: model.project.name,
+      project_path: model.project.path,
+      project_id: model.project_id,
+      user_name: model.user.name,
+      user_email: model.user.email,
+      project_access: model.repo_access_human,
+      created_at: model.created_at
+    })
+
+  end
+end
+
+
+ +
+ +
+
+ + after_destroy(model) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/system_hook_observer.rb, line 38
+def after_destroy(model)
+  if model.kind_of? Project
+    SystemHook.all_hooks_fire({
+      event_name: "project_destroy",
+      name: model.name,
+      path: model.path,
+      project_id: model.id,
+      owner_name: model.owner.name,
+      owner_email: model.owner.email,
+    })
+  elsif model.kind_of? User
+    SystemHook.all_hooks_fire({
+      event_name: "user_destroy",
+      name: model.name,
+      email: model.email
+    })
+
+  elsif model.kind_of? UsersProject
+    SystemHook.all_hooks_fire({
+      event_name: "user_remove_from_team",
+      project_name: model.project.name,
+      project_path: model.project.path,
+      project_id: model.project_id,
+      user_name: model.user.name,
+      user_email: model.user.email,
+      project_access: model.repo_access_human
+    })
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/SystemHookWorker.html b/doc/code/classes/SystemHookWorker.html new file mode 100644 index 00000000000..9c114ba6261 --- /dev/null +++ b/doc/code/classes/SystemHookWorker.html @@ -0,0 +1,131 @@ + + + + + SystemHookWorker + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+
+ + perform(hook_id, data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/workers/system_hook_worker.rb, line 4
+def self.perform(hook_id, data)
+  SystemHook.find(hook_id).execute data
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TabHelper.html b/doc/code/classes/TabHelper.html new file mode 100644 index 00000000000..c7b4c7908ab --- /dev/null +++ b/doc/code/classes/TabHelper.html @@ -0,0 +1,346 @@ + + + + + TabHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
N
+
+ +
+ +
P
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + branches_tab_class() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tab_helper.rb, line 80
+def branches_tab_class
+  if current_page?(branches_project_repository_path(@project)) ||
+    current_controller?(:protected_branches) ||
+    current_page?(project_repository_path(@project))
+    'active'
+  end
+end
+
+
+ +
+ +
+ + + +
+

Navigation link helper

+ +

Returns an `li` element with an ‘active’ class if the supplied +controller(s) and/or action(s) are currently active. The content of the +element is the value passed to the block.

+ +

options - The options hash used to determine if the element is “active” +(default: {})

+ +
:controller   - One or more controller names to check (optional).
+:action       - One or more action names to check (optional).
+:path         - A shorthand path, such as 'dashboard#index', to check (optional).
+:html_options - Extra options to be passed to the list element (optional).
+ +

block - An optional block that will become the contents of the returned

+ +
`li` element.
+ +

When both :controller and :action are specified, BOTH must match in order +to be marked as active. When only one is given, either can match.

+ +

Examples

+ +
# Assuming we're on TreeController#show
+
+# Controller matches, but action doesn't
+nav_link(controller: [:tree, :refs], action: :edit) { "Hello" }
+# => '<li>Hello</li>'
+
+# Controller matches
+nav_link(controller: [:tree, :refs]) { "Hello" }
+# => '<li class="active">Hello</li>'
+
+# Shorthand path
+nav_link(path: 'tree#show') { "Hello" }
+# => '<li class="active">Hello</li>'
+
+# Supplying custom options for the list element
+nav_link(controller: :tree, html_options: {class: 'home'}) { "Hello" }
+# => '<li class="home active">Hello</li>'
+
+ +

Returns a list item element String

+
+ + + + + + +
+ + + +
+ +
+ +
+
+ + nav_tab(key, value, &block) + + +
+ + +
+

Use #nav_tab for save +controller/action but different params

+
+ + + + + + +
+ + +
+
# File app/helpers/tab_helper.rb, line 89
+def nav_tab key, value, &block
+  o = {}
+  o[:class] = ""
+  o[:class] << " active" if params[key] == value
+
+  if block_given?
+    content_tag(:li, capture(&block), o)
+  else
+    content_tag(:li, nil, o)
+  end
+end
+
+
+ +
+ +
+
+ + project_tab_class() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tab_helper.rb, line 70
+def project_tab_class
+  [:show, :files, :edit, :update].each do |action|
+    return "active" if current_page?(controller: "projects", action: action, id: @project)
+  end
+
+  if ['snippets', 'services', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name
+   "active"
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TagsHelper.html b/doc/code/classes/TagsHelper.html new file mode 100644 index 00000000000..cf30b011b4a --- /dev/null +++ b/doc/code/classes/TagsHelper.html @@ -0,0 +1,170 @@ + + + + + TagsHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + tag_list(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tags_helper.rb, line 6
+def tag_list project
+  html = ''
+  project.tag_list.each do |tag|
+    html += link_to tag, tag_path(tag)
+  end
+
+  html.html_safe
+end
+
+
+ +
+ +
+
+ + tag_path(tag) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tags_helper.rb, line 2
+def tag_path tag
+  "/tags/#{tag}"
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Team.html b/doc/code/classes/Team.html new file mode 100644 index 00000000000..08d2c07e3c6 --- /dev/null +++ b/doc/code/classes/Team.html @@ -0,0 +1,470 @@ + + + + + Team + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
D
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + add_user_id_to_team(user_id, access_role) + + +
+ + +
+

Add user to project with passed access role by user id

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 26
+def add_user_id_to_team(user_id, access_role)
+  users_projects.create(
+    user_id: user_id,
+    project_access: access_role
+  )
+end
+
+
+ +
+ +
+
+ + add_user_to_team(user, access_role) + + +
+ + +
+

Add user to project with passed access role

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 14
+def add_user_to_team(user, access_role)
+  add_user_id_to_team(user.id, access_role)
+end
+
+
+ +
+ +
+
+ + add_users_ids_to_team(users_ids, access_role) + + +
+ + +
+

Add multiple users to project with same access role by user ids

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 35
+def add_users_ids_to_team(users_ids, access_role)
+  UsersProject.bulk_import(self, users_ids, access_role)
+end
+
+
+ +
+ +
+
+ + add_users_to_team(users, access_role) + + +
+ + +
+

Add multiple users to project with same access role

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 20
+def add_users_to_team(users, access_role)
+  add_users_ids_to_team(users.map(&:id), access_role)
+end
+
+
+ +
+ +
+
+ + delete_users_ids_from_team(users_ids) + + +
+ + +
+

Delete multiple users from project by user ids

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 46
+def delete_users_ids_from_team(users_ids)
+  UsersProject.bulk_delete(self, users_ids)
+end
+
+
+ +
+ +
+
+ + team_member_by_id(user_id) + + +
+ + +
+

Get Team Member record by user id

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 8
+def team_member_by_id(user_id)
+  users_projects.find_by_user_id(user_id)
+end
+
+
+ +
+ +
+
+ + team_member_by_name_or_email(name = nil, email = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 2
+def team_member_by_name_or_email(name = nil, email = nil)
+  user = users.where("name like ? or email like ?", name, email).first
+  users_projects.where(user: user) if user
+end
+
+
+ +
+ +
+
+ + truncate_team() + + +
+ + +
+

Remove all users from project team

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 51
+def truncate_team
+  UsersProject.truncate_team(self)
+end
+
+
+ +
+ +
+
+ + update_users_ids_to_role(users_ids, access_role) + + +
+ + +
+

Update multiple project users to same access role by user ids

+
+ + + + + + +
+ + +
+
# File app/roles/team.rb, line 41
+def update_users_ids_to_role(users_ids, access_role)
+  UsersProject.bulk_update(self, users_ids, access_role)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TeamMembersController.html b/doc/code/classes/TeamMembersController.html new file mode 100644 index 00000000000..f411dfd17ce --- /dev/null +++ b/doc/code/classes/TeamMembersController.html @@ -0,0 +1,438 @@ + + + + + TeamMembersController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
C
+
+ +
+ +
D
+
+ +
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + apply_import() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 51
+def apply_import
+  giver = Project.find(params[:source_project_id])
+  status = UsersProject.import_team(giver, project)
+  notice = status ? "Succesfully imported" : "Import failed"
+
+  redirect_to project_team_members_path(project), notice: notice
+end
+
+
+ +
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 18
+def create
+  @project.add_users_ids_to_team(
+    params[:user_ids],
+    params[:project_access]
+  )
+
+  if params[:redirect_to]
+    redirect_to params[:redirect_to]
+  else
+    redirect_to project_team_index_path(@project)
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 41
+def destroy
+  @team_member = project.users_projects.find(params[:id])
+  @team_member.destroy
+
+  respond_to do |format|
+    format.html { redirect_to project_team_index_path(@project) }
+    format.js { render nothing: true }
+  end
+end
+
+
+ +
+ +
+
+ + index() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 6
+def index
+end
+
+
+ +
+ +
+
+ + new() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 14
+def new
+  @team_member = project.users_projects.new
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 9
+def show
+  @team_member = project.users_projects.find(params[:id])
+  @events = @team_member.user.recent_events.where(:project_id => @project.id).limit(7)
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/team_members_controller.rb, line 31
+def update
+  @team_member = project.users_projects.find(params[:id])
+  @team_member.update_attributes(params[:team_member])
+
+  unless @team_member.valid?
+    flash[:alert] = "User should have at least one role"
+  end
+  redirect_to project_team_index_path(@project)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TestHookContext.html b/doc/code/classes/TestHookContext.html new file mode 100644 index 00000000000..5b9b647858b --- /dev/null +++ b/doc/code/classes/TestHookContext.html @@ -0,0 +1,134 @@ + + + + + TestHookContext + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/contexts/test_hook_context.rb, line 2
+def execute
+  hook = project.hooks.find(params[:id])
+  commits = project.commits(project.default_branch, nil, 3)
+  data = project.post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", current_user)
+  hook.execute(data)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Tree.html b/doc/code/classes/Tree.html new file mode 100644 index 00000000000..e71dfa3ffc4 --- /dev/null +++ b/doc/code/classes/Tree.html @@ -0,0 +1,322 @@ + + + + + Tree + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
I
+
+ +
+ +
N
+
+
    + + +
  • + new +
  • + +
+
+ +
+ + + + +
Included Modules
+
    + +
  • + + Linguist::BlobHelper + +
  • + +
+ + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ [RW] + path
+ [RW] + project
+ [RW] + ref
+ [RW] + tree
+ + + + + +
Class Public methods
+ +
+
+ + new(raw_tree, project, ref = nil, path = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/tree.rb, line 8
+def initialize(raw_tree, project, ref = nil, path = nil)
+  @project, @ref, @path = project, ref, path
+  @tree = if path.present?
+            raw_tree / path
+          else
+            raw_tree
+          end
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + empty?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/tree.rb, line 25
+def empty?
+  data.blank?
+end
+
+
+ +
+ +
+
+ + invalid?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/tree.rb, line 21
+def invalid?
+  tree.nil?
+end
+
+
+ +
+ +
+
+ + is_blob?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/tree.rb, line 17
+def is_blob?
+  tree.is_a?(Grit::Blob)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TreeController.html b/doc/code/classes/TreeController.html new file mode 100644 index 00000000000..35c99bc09e4 --- /dev/null +++ b/doc/code/classes/TreeController.html @@ -0,0 +1,264 @@ + + + + + TreeController + + + + + + + + + + + + + +
+
+ +
+ +

Controller for viewing a repository’s file structure

+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
U
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/tree_controller.rb, line 24
+def edit
+  @last_commit = @project.last_commit_for(@ref, @path).sha
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/tree_controller.rb, line 13
+def show
+  @hex_path  = Digest::SHA1.hexdigest(@path)
+  @logs_path = logs_file_project_ref_path(@project, @ref, @path)
+
+  respond_to do |format|
+    format.html
+    # Disable cache so browser history works
+    format.js { no_cache_headers }
+  end
+end
+
+
+ +
+ +
+
+ + update() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/tree_controller.rb, line 28
+def update
+  edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path)
+  updated_successfully = edit_file_action.commit!(
+    params[:content],
+    params[:commit_message],
+    params[:last_commit]
+  )
+
+  if updated_successfully
+    redirect_to project_tree_path(@project, @id), notice: "Your changes have been successfully commited"
+  else
+    flash[:notice] = "Your changes could not be commited, because the file has been changed"
+    render :edit
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TreeDecorator.html b/doc/code/classes/TreeDecorator.html new file mode 100644 index 00000000000..9b32e1c9381 --- /dev/null +++ b/doc/code/classes/TreeDecorator.html @@ -0,0 +1,281 @@ + + + + + TreeDecorator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
B
+
+ +
+ +
R
+
+ +
+ +
U
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + breadcrumbs(max_links = 2) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/tree_decorator.rb, line 4
+def breadcrumbs(max_links = 2)
+  if path
+    part_path = ""
+    parts = path.split("\/")
+
+    #parts = parts[0...-1] if is_blob?
+
+    yield(h.link_to("..", "#")) if parts.count > max_links
+
+    parts.each do |part|
+      part_path = File.join(part_path, part) unless part_path.empty?
+      part_path = part if part_path.empty?
+
+      next unless parts.last(2).include?(part) if parts.count > max_links
+      yield(h.link_to(h.truncate(part, length: 40), h.project_tree_path(project, h.tree_join(ref, part_path))))
+    end
+  end
+end
+
+
+ +
+ +
+
+ + readme() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/tree_decorator.rb, line 32
+def readme
+  @readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ %r^readme/ }
+end
+
+
+ +
+ +
+
+ + up_dir?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/tree_decorator.rb, line 23
+def up_dir?
+  path.present?
+end
+
+
+ +
+ +
+
+ + up_dir_path() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/tree_decorator.rb, line 27
+def up_dir_path
+  file = File.join(path, "..")
+  h.project_tree_path(project, h.tree_join(ref, file))
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/TreeHelper.html b/doc/code/classes/TreeHelper.html new file mode 100644 index 00000000000..a9ca79494de --- /dev/null +++ b/doc/code/classes/TreeHelper.html @@ -0,0 +1,541 @@ + + + + + TreeHelper + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
G
+
+ +
+ +
M
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + allowed_tree_edit?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 63
+def allowed_tree_edit?
+  if @project.protected_branch? @ref
+    can?(current_user, :push_code_to_protected_branches, @project)
+  else
+    can?(current_user, :push_code, @project)
+  end
+end
+
+
+ +
+ +
+
+ + breadcrumbs() + + +
+ + +
+

Breadcrumb links for a Project and, if +applicable, a tree path

+
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 72
+def breadcrumbs
+  return unless @project && @ref
+
+  # Add the root project link and the arrow icon
+  crumbs = content_tag(:li) do
+    content_tag(:span, nil, class: 'arrow') +
+    link_to(@project.name, project_commits_path(@project, @ref))
+  end
+
+  if @path
+    parts = @path.split('/')
+
+    parts.each_with_index do |part, i|
+      crumbs += content_tag(:span, '/', class: 'divider')
+      crumbs += content_tag(:li) do
+        # The text is just the individual part, but the link needs all the parts before it
+        link_to part, project_commits_path(@project, tree_join(@ref, parts[0..i].join('/')))
+      end
+    end
+  end
+
+  crumbs.html_safe
+end
+
+
+ +
+ +
+
+ + gitlab_markdown?(filename) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 50
+def gitlab_markdown?(filename)
+  filename.end_with?(*%w(.mdown .md .markdown))
+end
+
+
+ +
+ +
+
+ + markup?(filename) + + +
+ + +
+

Public: Determines if a given filename is compatible with GitHub::Markup.

+ +

filename - Filename string to check

+ +

Returns boolean

+
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 45
+def markup?(filename)
+  filename.end_with?(*%w(.textile .rdoc .org .creole
+                         .mediawiki .rst .asciidoc .pod))
+end
+
+
+ +
+ +
+
+ + plain_text_readme?(filename) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 54
+def plain_text_readme? filename
+  filename == 'README'
+end
+
+
+ +
+ +
+
+ + render_tree(contents) + + +
+ + +
+

Sorts a repository’s tree so that folders are before files and renders +their corresponding partials

+ +

contents - A Grit::Tree object for the current tree

+
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 6
+def render_tree(contents)
+  # Render Folders before Files/Submodules
+  folders, files = contents.partition { |v| v.kind_of?(Grit::Tree) }
+
+  tree = ""
+
+  # Render folders if we have any
+  tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
+
+  files.each do |f|
+    if f.respond_to?(:url)
+      # Object is a Submodule
+      tree += render partial: 'tree/submodule_item', object: f
+    else
+      # Object is a Blob
+      tree += render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
+    end
+  end
+
+  tree.html_safe
+end
+
+
+ +
+ +
+
+ + tree_hex_class(content) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 36
+def tree_hex_class(content)
+  "file_#{hexdigest(content.name)}"
+end
+
+
+ +
+ +
+
+ + tree_icon(type) + + +
+ + +
+

Return an image icon depending on the file type

+ +

type - String type of the tree item; either ‘folder’ or ‘file’

+
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 31
+def tree_icon(type)
+  image = type == 'folder' ? 'file_dir.png' : 'file_txt.png'
+  image_tag(image, size: '16x16')
+end
+
+
+ +
+ +
+
+ + tree_join(*args) + + +
+ + +
+

Simple shortcut to File.join

+
+ + + + + + +
+ + +
+
# File app/helpers/tree_helper.rb, line 59
+def tree_join(*args)
+  File.join(*args)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/User.html b/doc/code/classes/User.html new file mode 100644 index 00000000000..661b143ebd1 --- /dev/null +++ b/doc/code/classes/User.html @@ -0,0 +1,566 @@ + + + + + User + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: users

+ +
id                     :integer          not null, primary key
+email                  :string(255)      default(""), not null
+encrypted_password     :string(255)      default(""), not null
+reset_password_token   :string(255)
+reset_password_sent_at :datetime
+remember_created_at    :datetime
+sign_in_count          :integer          default(0)
+current_sign_in_at     :datetime
+last_sign_in_at        :datetime
+current_sign_in_ip     :string(255)
+last_sign_in_ip        :string(255)
+created_at             :datetime         not null
+updated_at             :datetime         not null
+name                   :string(255)
+admin                  :boolean          default(FALSE), not null
+projects_limit         :integer          default(10)
+skype                  :string(255)      default(""), not null
+linkedin               :string(255)      default(""), not null
+twitter                :string(255)      default(""), not null
+authentication_token   :string(255)
+dark_scheme            :boolean          default(FALSE), not null
+theme_id               :integer          default(1), not null
+bio                    :string(255)
+blocked                :boolean          default(FALSE), not null
+failed_attempts        :integer          default(0)
+locked_at              :datetime
+extern_uid             :string(255)
+provider               :string(255)
+username               :string(255)
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
F
+
+ +
+ +
G
+
+ +
+ +
N
+
+ +
+ +
S
+
+ +
+ +
W
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + + + + +
Attributes
+ + + + + + + + +
+ [RW] + force_random_password
+ + + + + +
Class Public methods
+ +
+
+ + create_from_omniauth(auth, ldap = false) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 108
+def create_from_omniauth(auth, ldap = false)
+  gitlab_auth.create_from_omniauth(auth, ldap)
+end
+
+
+ +
+ +
+
+ + filter(filter_name) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 86
+def filter filter_name
+  case filter_name
+  when "admins"; self.admins
+  when "blocked"; self.blocked
+  when "wop"; self.without_projects
+  else
+    self.active
+  end
+end
+
+
+ +
+ +
+
+ + find_for_ldap_auth(auth, signed_in_resource = nil) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 116
+def find_for_ldap_auth(auth, signed_in_resource = nil)
+  gitlab_auth.find_for_ldap_auth(auth, signed_in_resource)
+end
+
+
+ +
+ +
+
+ + find_or_new_for_omniauth(auth) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 112
+def find_or_new_for_omniauth(auth)
+  gitlab_auth.find_or_new_for_omniauth(auth)
+end
+
+
+ +
+ +
+
+ + gitlab_auth() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 120
+def gitlab_auth
+  Gitlab::Auth.new
+end
+
+
+ +
+ +
+
+ + not_in_project(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 96
+def not_in_project(project)
+  if project.users.present?
+    where("id not in (:ids)", ids: project.users.map(&:id) )
+  else
+    scoped
+  end
+end
+
+
+ +
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 124
+def search query
+  where("name LIKE :query or email LIKE :query", query: "%#{query}%")
+end
+
+
+ +
+ +
+
+ + without_projects() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 104
+def without_projects
+  where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)')
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + generate_password() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/user.rb, line 129
+def generate_password
+  if self.force_random_password
+    self.password = self.password_confirmation = Devise.friendly_token.first(8)
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/UserDecorator.html b/doc/code/classes/UserDecorator.html new file mode 100644 index 00000000000..24ce4b76352 --- /dev/null +++ b/doc/code/classes/UserDecorator.html @@ -0,0 +1,178 @@ + + + + + UserDecorator + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + avatar_image(size = 16) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/user_decorator.rb, line 4
+def avatar_image size = 16
+  h.image_tag h.gravatar_icon(self.email, size), class: "avatar #{"s#{size}"}", width: size
+end
+
+
+ +
+ +
+
+ + tm_of(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/decorators/user_decorator.rb, line 8
+def tm_of(project)
+  project.team_member_by_id(self.id)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/UserObserver.html b/doc/code/classes/UserObserver.html new file mode 100644 index 00000000000..6899937afb9 --- /dev/null +++ b/doc/code/classes/UserObserver.html @@ -0,0 +1,268 @@ + + + + + UserObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
L
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_create(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/user_observer.rb, line 2
+def after_create(user)
+  log_info("User \"#{user.name}\" (#{user.email}) was created")
+
+  Notify.new_user_email(user.id, user.password).deliver
+end
+
+
+ +
+ +
+
+ + after_destroy(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/user_observer.rb, line 8
+def after_destroy user
+  log_info("User \"#{user.name}\" (#{user.email})  was removed")
+end
+
+
+ +
+ +
+
+ + after_save(user) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/user_observer.rb, line 12
+def after_save user
+  if user.username_changed?
+    if user.namespace
+      user.namespace.update_attributes(path: user.username)
+    else
+      user.create_namespace!(path: user.username, name: user.username)
+    end
+  end
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + log_info(message) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/user_observer.rb, line 24
+def log_info message
+  Gitlab::AppLogger.info message
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/UsersProject.html b/doc/code/classes/UsersProject.html new file mode 100644 index 00000000000..76ae5125a1d --- /dev/null +++ b/doc/code/classes/UsersProject.html @@ -0,0 +1,871 @@ + + + + + UsersProject + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: users_projects

+ +
id             :integer          not null, primary key
+user_id        :integer          not null
+project_id     :integer          not null
+created_at     :datetime         not null
+updated_at     :datetime         not null
+project_access :integer          default(0), not null
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
B
+
+ +
+ +
I
+
+ +
+ +
P
+
+ +
+ +
R
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
U
+
+ +
+ +
+ + + + +
Included Modules
+ + + + + + + + + + + + + +
Constants
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GUEST=10
 
REPORTER=20
 
DEVELOPER=30
 
MASTER=40
 
+ + + + + +
Attributes
+ + + + + + + + +
+ [RW] + skip_git
+ + + + + +
Class Public methods
+ +
+
+ + access_roles() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 140
+def access_roles
+  {
+    "Guest"     => GUEST,
+    "Reporter"  => REPORTER,
+    "Developer" => DEVELOPER,
+    "Master"    => MASTER
+  }
+end
+
+
+ +
+ +
+
+ + add_users_into_projects(project_ids, user_ids, project_access) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 41
+def add_users_into_projects(project_ids, user_ids, project_access)
+  UsersProject.transaction do
+    project_ids.each do |project_id|
+      user_ids.each do |user_id|
+        users_project = UsersProject.new(project_access: project_access, user_id: user_id)
+        users_project.project_id = project_id
+        users_project.skip_git = true
+        users_project.save
+      end
+    end
+    Gitlab::Gitolite.new.update_repositories(Project.where(id: project_ids))
+  end
+
+  true
+rescue
+  false
+end
+
+
+ +
+ +
+
+ + bulk_delete(project, user_ids) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 108
+def bulk_delete(project, user_ids)
+  UsersProject.transaction do
+    UsersProject.where(user_id: user_ids, project_id: project.id).each do |users_project|
+      users_project.skip_git = true
+      users_project.destroy
+    end
+
+    project.update_repository
+  end
+end
+
+
+ +
+ +
+
+ + bulk_import(project, user_ids, project_access) + + +
+ + +
+

TODO: depreceate in future in favor of ::add_users_into_projects

+
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 131
+def bulk_import(project, user_ids, project_access)
+  add_users_into_projects([project.id], user_ids, project_access)
+end
+
+
+ +
+ +
+
+ + bulk_update(project, user_ids, project_access) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 119
+def bulk_update(project, user_ids, project_access)
+  UsersProject.transaction do
+    UsersProject.where(user_id: user_ids, project_id: project.id).each do |users_project|
+      users_project.project_access = project_access
+      users_project.skip_git = true
+      users_project.save
+    end
+    project.update_repository
+  end
+end
+
+
+ +
+ +
+
+ + import_team(source_project, target_project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 78
+def import_team(source_project, target_project)
+  source_team = source_project.users_projects.all
+  target_team = target_project.users_projects.all
+  target_user_ids = target_team.map(&:user_id)
+
+  source_team.reject! do |tm|
+    # Skip if user already present in team
+    target_user_ids.include?(tm.user_id)
+  end
+
+  source_team.map! do |tm|
+    new_tm = tm.dup
+    new_tm.id = nil
+    new_tm.project_id = target_project.id
+    new_tm.skip_git = true
+    new_tm
+  end
+
+  UsersProject.transaction do
+    source_team.each do |tm|
+      tm.save
+    end
+    target_project.update_repository
+  end
+
+  true
+rescue
+  false
+end
+
+
+ +
+ +
+
+ + truncate_team(project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 74
+def truncate_team project
+  truncate_teams [project.id]
+end
+
+
+ +
+ +
+
+ + truncate_teams(project_ids) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 59
+def truncate_teams(project_ids)
+  UsersProject.transaction do
+    users_projects = UsersProject.where(project_id: project_ids)
+    users_projects.each do |users_project|
+      users_project.skip_git = true
+      users_project.destroy
+    end
+    Gitlab::Gitolite.new.update_repositories(Project.where(id: project_ids))
+  end
+
+  true
+rescue
+  false
+end
+
+
+ +
+ +
+
+ + user_bulk_import(user, project_ids, project_access) + + +
+ + +
+

TODO: depreceate in future in favor of ::add_users_into_projects

+
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 136
+def user_bulk_import(user, project_ids, project_access)
+  add_users_into_projects(project_ids, [user.id], project_access)
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + project_access_human() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 158
+def project_access_human
+  Project.access_options.key(self.project_access)
+end
+
+
+ +
+ +
+
+ + repo_access_human() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 162
+def repo_access_human
+  self.class.access_roles.invert[self.project_access]
+end
+
+
+ +
+ +
+
+ + role_access() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 150
+def role_access
+  project_access
+end
+
+
+ +
+ +
+
+ + skip_git?() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 166
+def skip_git?
+  !!@skip_git
+end
+
+
+ +
+ +
+
+ + update_repository() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/users_project.rb, line 154
+def update_repository
+  git_host.update_repository(project)
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/UsersProjectObserver.html b/doc/code/classes/UsersProjectObserver.html new file mode 100644 index 00000000000..50b02dc75f6 --- /dev/null +++ b/doc/code/classes/UsersProjectObserver.html @@ -0,0 +1,220 @@ + + + + + UsersProjectObserver + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
A
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + after_commit(users_project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/users_project_observer.rb, line 2
+def after_commit(users_project)
+  return if users_project.destroyed?
+  Notify.project_access_granted_email(users_project.id).deliver
+end
+
+
+ +
+ +
+
+ + after_create(users_project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/users_project_observer.rb, line 7
+def after_create(users_project)
+  Event.create(
+    project_id: users_project.project.id,
+    action: Event::Joined,
+    author_id: users_project.user.id
+  )
+end
+
+
+ +
+ +
+
+ + after_destroy(users_project) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/observers/users_project_observer.rb, line 15
+def after_destroy(users_project)
+  Event.create(
+    project_id: users_project.project.id,
+    action: Event::Left,
+    author_id: users_project.user.id
+  )
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Votes.html b/doc/code/classes/Votes.html new file mode 100644 index 00000000000..bb786a79662 --- /dev/null +++ b/doc/code/classes/Votes.html @@ -0,0 +1,307 @@ + + + + + Votes + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
D
+
+ +
+ +
U
+
+ +
+ +
V
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + downvotes() + + +
+ + +
+

Return the number of -1 comments (downvotes)

+
+ + + + + + +
+ + +
+
# File app/roles/votes.rb, line 16
+def downvotes
+  notes.select(&:downvote?).size
+end
+
+
+ +
+ +
+
+ + downvotes_in_percent() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/votes.rb, line 20
+def downvotes_in_percent
+  if votes_count.zero?
+    0
+  else
+    100.0 - upvotes_in_percent
+  end
+end
+
+
+ +
+ +
+
+ + upvotes() + + +
+ + +
+

Return the number of +1 comments (upvotes)

+
+ + + + + + +
+ + +
+
# File app/roles/votes.rb, line 3
+def upvotes
+  notes.select(&:upvote?).size
+end
+
+
+ +
+ +
+
+ + upvotes_in_percent() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/roles/votes.rb, line 7
+def upvotes_in_percent
+  if votes_count.zero?
+    0
+  else
+    100.0 / votes_count * upvotes
+  end
+end
+
+
+ +
+ +
+
+ + votes_count() + + +
+ + +
+

Return the total number of votes

+
+ + + + + + +
+ + +
+
# File app/roles/votes.rb, line 29
+def votes_count
+  upvotes + downvotes
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/WebHook.html b/doc/code/classes/WebHook.html new file mode 100644 index 00000000000..54097dd30e5 --- /dev/null +++ b/doc/code/classes/WebHook.html @@ -0,0 +1,168 @@ + + + + + WebHook + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
E
+
+ +
+ +
+ + + + +
Included Modules
+
    + +
  • + + HTTParty + +
  • + +
+ + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + execute(data) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/web_hook.rb, line 25
+def execute(data)
+  parsed_url = URI.parse(url)
+  if parsed_url.userinfo.blank?
+    WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" })
+  else
+    post_url = url.gsub("#{parsed_url.userinfo}@", "")
+    WebHook.post(post_url,
+                 body: data.to_json,
+                 headers: {"Content-Type" => "application/json"},
+                 basic_auth: {username: parsed_url.user, password: parsed_url.password})
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/Wiki.html b/doc/code/classes/Wiki.html new file mode 100644 index 00000000000..ab0fe9b2444 --- /dev/null +++ b/doc/code/classes/Wiki.html @@ -0,0 +1,294 @@ + + + + + Wiki + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: wikis

+ +
id         :integer          not null, primary key
+title      :string(255)
+content    :text
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+slug       :string(255)
+user_id    :integer
+ +
+ + + + + + + + + + + + + + + +
Methods
+
+ +
R
+
+ +
+ +
S
+
+ +
+ +
T
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Class Public methods
+ +
+ + + +
+ +
+ + + + + + +
+ + +
+
# File app/models/wiki.rb, line 33
+def search(query)
+  where("title like :query OR content like :query", query: "%#{query}%")
+end
+
+
+ +
+ +
Class Protected methods
+ +
+
+ + regenerate_from(wiki) + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/wiki.rb, line 40
+def self.regenerate_from wiki
+  regenerated_field = [:slug, :content, :title]
+
+  new_wiki = Wiki.new
+  regenerated_field.each do |field|
+    new_wiki.send("#{field}=", wiki.send(field))
+  end
+  new_wiki
+end
+
+
+ +
+ +
Instance Public methods
+ +
+
+ + to_param() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/wiki.rb, line 28
+def to_param
+  slug
+end
+
+
+ +
+ +
Instance Protected methods
+ +
+
+ + set_slug() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/models/wiki.rb, line 50
+def set_slug
+  self.slug = self.title.parameterize
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/classes/WikisController.html b/doc/code/classes/WikisController.html new file mode 100644 index 00000000000..3247d4f0fd9 --- /dev/null +++ b/doc/code/classes/WikisController.html @@ -0,0 +1,397 @@ + + + + + WikisController + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
Methods
+
+ +
C
+
+ +
+ +
D
+
+ +
+ +
E
+
+
    + + +
  • + edit +
  • + +
+
+ +
H
+
+ +
+ +
P
+
+ +
+ +
S
+
+
    + + +
  • + show +
  • + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
Instance Public methods
+ +
+
+ + create() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/wikis_controller.rb, line 36
+def create
+  @wiki = @project.wikis.new(params[:wiki])
+  @wiki.user = current_user
+
+  respond_to do |format|
+    if @wiki.save
+      format.html { redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' }
+    else
+      format.html { render action: "edit" }
+    end
+  end
+end
+
+
+ +
+ +
+
+ + destroy() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/wikis_controller.rb, line 53
+def destroy
+  @wikis = @project.wikis.where(slug: params[:id]).delete_all
+
+  respond_to do |format|
+    format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" }
+  end
+end
+
+
+ +
+ +
+
+ + edit() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/wikis_controller.rb, line 31
+def edit
+  @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
+  @wiki = Wiki.regenerate_from @wiki
+end
+
+
+ +
+ +
+
+ + history() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/wikis_controller.rb, line 49
+def history
+  @wikis = @project.wikis.where(slug: params[:id]).order("created_at")
+end
+
+
+ +
+ +
+
+ + pages() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/wikis_controller.rb, line 6
+def pages
+  @wikis = @project.wikis.group(:slug).order("created_at")
+end
+
+
+ +
+ +
+
+ + show() + + +
+ + +
+ +
+ + + + + + +
+ + +
+
# File app/controllers/wikis_controller.rb, line 10
+def show
+  if params[:old_page_id]
+    @wiki = @project.wikis.find(params[:old_page_id])
+  else
+    @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
+  end
+
+  @note = @project.notes.new(noteable: @wiki)
+
+  if @wiki
+    render 'show'
+  else
+    if can?(current_user, :write_wiki, @project)
+      @wiki = @project.wikis.new(slug: params[:id])
+      render 'edit'
+    else
+      render 'empty'
+    end
+  end
+end
+
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/doc/code/created.rid b/doc/code/created.rid new file mode 100644 index 00000000000..3177c0b3b2e --- /dev/null +++ b/doc/code/created.rid @@ -0,0 +1,155 @@ +Sun, 30 Dec 2012 14:41:56 +0200 +app/models/namespace.rb Sun, 30 Dec 2012 12:06:28 +0200 +app/models/ability.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/commit.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/gitlab_ci_service.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/system_hook.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/key.rb Thu, 27 Dec 2012 12:10:59 +0200 +app/models/note.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/project.rb Fri, 28 Dec 2012 09:30:09 +0200 +app/models/tree.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/milestone.rb Thu, 27 Dec 2012 11:32:29 +0200 +app/models/web_hook.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/protected_branch.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/project_hook.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/event.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/service_hook.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/service.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/snippet.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/merge_request.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/models/user.rb Sun, 30 Dec 2012 13:40:45 +0200 +app/models/group.rb Sun, 30 Dec 2012 14:25:46 +0200 +app/models/wiki.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/models/users_project.rb Sun, 30 Dec 2012 14:27:12 +0200 +app/models/issue.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/observers/system_hook_observer.rb Mon, 30 Jul 2012 09:40:22 +0300 +app/observers/note_observer.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/observers/users_project_observer.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/observers/project_observer.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/observers/user_observer.rb Sun, 30 Dec 2012 12:06:28 +0200 +app/observers/merge_request_observer.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/observers/activity_observer.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/observers/key_observer.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/observers/issue_observer.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/labels_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/projects_controller.rb Sun, 30 Dec 2012 13:33:32 +0200 +app/controllers/application_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/keys_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/repositories_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/services_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/hooks_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/compare_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/merge_requests_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/snippets_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/help_controller.rb Wed, 29 Feb 2012 23:28:38 +0200 +app/controllers/omniauth_callbacks_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/errors_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/blob_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/wikis_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/refs_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/notes_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/milestones_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/search_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/admin_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/team_members_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/profiles_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/dashboard_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/admin/projects_controller.rb Sun, 30 Dec 2012 14:08:40 +0200 +app/controllers/admin/hooks_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/admin/resque_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/admin/logs_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/admin/team_members_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/admin/dashboard_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/admin/users_controller.rb Sun, 30 Dec 2012 13:42:44 +0200 +app/controllers/admin/groups_controller.rb Sun, 30 Dec 2012 14:11:24 +0200 +app/controllers/commits_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/tree_controller.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/controllers/deploy_keys_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/blame_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/protected_branches_controller.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/controllers/commit_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/groups_controller.rb Sun, 30 Dec 2012 12:42:35 +0200 +app/controllers/project_resource_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/controllers/issues_controller.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/mailers/notify.rb Sun, 30 Dec 2012 12:06:28 +0200 +app/uploaders/attachment_uploader.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/helpers/snippets_helper.rb Fri, 02 Dec 2011 02:40:22 +0200 +app/helpers/events_helper.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/helpers/merge_requests_helper.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/helpers/tree_helper.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/helpers/namespaces_helper.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/helpers/projects_helper.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/helpers/tags_helper.rb Fri, 02 Dec 2011 02:40:22 +0200 +app/helpers/gitlab_markdown_helper.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/helpers/dashboard_helper.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/helpers/commits_helper.rb Thu, 27 Dec 2012 11:32:29 +0200 +app/helpers/application_helper.rb Sun, 30 Dec 2012 13:49:26 +0200 +app/helpers/issues_helper.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/helpers/tab_helper.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/helpers/profile_helper.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/helpers/notes_helper.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/contexts/project_update_context.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/contexts/test_hook_context.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/contexts/merge_requests_load_context.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/contexts/notes/create_context.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/contexts/notes/load_context.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/contexts/issues_bulk_update_context.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/contexts/issues_list_context.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/contexts/base_context.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/contexts/search_context.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/contexts/commit_load_context.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/roles/note_event.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/roles/push_observer.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/roles/account.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/roles/votes.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/roles/repository.rb Sun, 30 Dec 2012 12:24:50 +0200 +app/roles/git_host.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/roles/team.rb Sun, 30 Dec 2012 14:26:37 +0200 +app/roles/namespaced_project.rb Wed, 26 Dec 2012 10:56:36 +0200 +app/roles/authority.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/roles/push_event.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/roles/static_model.rb Mon, 29 Oct 2012 21:44:39 +0200 +app/roles/issue_commonality.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/decorators/commit_decorator.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/decorators/application_decorator.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/decorators/tree_decorator.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/decorators/event_decorator.rb Mon, 29 Oct 2012 21:33:47 +0200 +app/decorators/user_decorator.rb Sun, 23 Dec 2012 12:16:43 +0200 +app/assets/fonts/OFL.txt Thu, 27 Dec 2012 11:32:29 +0200 +app/workers/post_receive.rb Sun, 23 Dec 2012 14:02:47 +0200 +app/workers/system_hook_worker.rb Mon, 30 Jul 2012 09:40:23 +0300 +lib/extracts_path.rb Thu, 27 Dec 2012 11:32:29 +0200 +lib/file_size_validator.rb Mon, 29 Oct 2012 21:33:47 +0200 +lib/redcarpet/render/gitlab_html.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/auth.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/regex.rb Fri, 28 Dec 2012 09:30:09 +0200 +lib/gitlab/git_logger.rb Mon, 29 Oct 2012 21:33:47 +0200 +lib/gitlab/satellite/merge_action.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/gitlab/satellite/satellite.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/satellite/edit_file_action.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/gitlab/satellite/action.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/gitlab/backend/grack_auth.rb Sun, 30 Dec 2012 12:06:28 +0200 +lib/gitlab/backend/gitolite_config.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/backend/gitolite.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/logger.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/markdown.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/app_logger.rb Mon, 29 Oct 2012 21:33:47 +0200 +lib/gitlab/seeder.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/gitlab/git_stats.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/gitlab/project_mover.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/graph/commit.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/gitlab/graph/json_builder.rb Thu, 27 Dec 2012 11:32:29 +0200 +lib/gitlab/theme.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/gitlab/inline_diff.rb Mon, 29 Oct 2012 21:33:47 +0200 +lib/hooks/post-receive Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/projects.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/merge_requests.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/users.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/session.rb Mon, 29 Oct 2012 21:33:47 +0200 +lib/api/notes.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/helpers.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/entities.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/milestones.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/api/issues.rb Sun, 23 Dec 2012 14:02:47 +0200 +lib/event_filter.rb Sun, 23 Dec 2012 12:16:43 +0200 +lib/api.rb Sun, 23 Dec 2012 14:02:47 +0200 diff --git a/doc/code/css/github.css b/doc/code/css/github.css new file mode 100644 index 00000000000..bd778a76d71 --- /dev/null +++ b/doc/code/css/github.css @@ -0,0 +1,129 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +pre code { + display: block; padding: 0.5em; + color: #000; + background: #f8f8ff +} + +pre .comment, +pre .template_comment, +pre .diff .header, +pre .javadoc { + color: #998; + font-style: italic +} + +pre .keyword, +pre .css .rule .keyword, +pre .winutils, +pre .javascript .title, +pre .lisp .title, +pre .subst { + color: #000; + font-weight: bold +} + +pre .number, +pre .hexcolor { + color: #40a070 +} + +pre .string, +pre .tag .value, +pre .phpdoc, +pre .tex .formula { + color: #d14 +} + +pre .title, +pre .id { + color: #900; + font-weight: bold +} + +pre .javascript .title, +pre .lisp .title, +pre .subst { + font-weight: normal +} + +pre .class .title, +pre .haskell .label, +pre .tex .command { + color: #458; + font-weight: bold +} + +pre .tag, +pre .tag .title, +pre .rules .property, +pre .django .tag .keyword { + color: #000080; + font-weight: normal +} + +pre .attribute, +pre .variable, +pre .instancevar, +pre .lisp .body { + color: #008080 +} + +pre .regexp { + color: #009926 +} + +pre .class { + color: #458; + font-weight: bold +} + +pre .symbol, +pre .ruby .symbol .string, +pre .ruby .symbol .keyword, +pre .ruby .symbol .keymethods, +pre .lisp .keyword, +pre .tex .special, +pre .input_number { + color: #990073 +} + +pre .builtin, +pre .built_in, +pre .lisp .title { + color: #0086b3 +} + +pre .preprocessor, +pre .pi, +pre .doctype, +pre .shebang, +pre .cdata { + color: #999; + font-weight: bold +} + +pre .deletion { + background: #fdd +} + +pre .addition { + background: #dfd +} + +pre .diff .change { + background: #0086b3 +} + +pre .chunk { + color: #aaa +} + +pre .tex .formula { + opacity: 0.5; +} diff --git a/doc/code/css/main.css b/doc/code/css/main.css new file mode 100755 index 00000000000..7d5a913a150 --- /dev/null +++ b/doc/code/css/main.css @@ -0,0 +1,333 @@ +body { + font-family: "Helvetica Neue", Arial, sans-serif; + background: #FFF; + color: #000; + margin: 0px; + font-size: 0.82em; + line-height: 1.25em; +} + +a { + color: #00F; + text-decoration: none; +} + +a:hover { + color: #333; + background: #FE8; +} + +p { + margin-bottom: 1em; +} + +h1 { + font-size: 2.1em; + font-weight: normal; + line-height: 1.2em; + margin: 1.4em 0 0.7em 0; +} + +h2 { + font-size: 1.6em; + margin: 1.8em 0 0.8em 0; + font-weight: normal; + line-height: 1.2em; +} + +h3 { + font-size: 1.4em; + color:#555; + margin: 1.4em 0 0.7em 0; + font-weight: normal; +} + +h4 { + margin: 1.4em 0 0.5em 0; + font-size: 1em; +} + +table +{ + margin-bottom: 1em; +} + +td, th +{ + padding: 0 0.7em 0.3em 0; +} + +th +{ + font-weight: bold; +} + +.clear +{ + clear: both; + width: 0; height: 0; +} + +dt +{ + margin-bottom: 0.3em; + font-weight: bold; +} + +dd +{ + margin-left: 2em; + margin-bottom: 1em; +} + +dd p +{ + margin-top: 0.6em; +} + +li +{ + margin: 0 0 0.5em 2em; +} + +ul li +{ + list-style: disc; +} + +ol li +{ + list-style: decimal; +} + +.banner +{ + background: #EDF3FE; + border-bottom: 1px solid #ccc; + padding: 1em 2em 0.5em 2em; +} +.banner h1 +{ + font-size: 1.2em; + margin: 0; +} + +.banner h1 .type +{ + font-size: 0.833em; + display:block; +} + +.banner h1 .type, +.banner h1 .parent +{ + color: #666; +} + +.banner ul +{ + margin-top: 0.3em; + margin-bottom: 0; + font-size: 0.85em; +} + +.banner li +{ + list-style: none; + margin-left: 0; + margin-bottom: 0; +} + +pre +{ + margin-bottom: 1em; +} + +.methods dt +{ + width: 1em; + font-size: 1.5em; + color:#AAA; + position: absolute; + font-weight: normal; + margin: 0; +} + +.methods dd +{ + margin-left: 2.5em; + min-height: 1.8em; + -height: 1.8em; + padding-bottom: 0.8em; +} + + +.methods ul li +{ + margin-right: 0.7em; + margin-left: 0; + list-style: none; + display: inline; +} + +#content { + margin: 2em; + margin-left: 3.5em; + margin-right: 3.5em; +} + + +.sectiontitle { + margin-top: 2em; + margin-bottom: 1.3em; + margin-left: -1.2em; + font-size: 1.2em; + padding: 0 0 0.25em 0; + font-weight: bold; + border-bottom: 1px solid #000; +} + +.contenttitle { + margin-top: 4em; + margin-bottom: 1.3em; + margin-left: -0.9em; + font-size: 1.6em; + padding: 0 0 0.25em 0; + font-weight: bold; +} + +.attr-rw { + padding-right: 1em; + text-align: center; + color: #055; +} + +.attr-name { + font-weight: bold; + padding-right: 1em; +} + +.attr-desc { +} + +tt { + font-size: 1.15em; +} + +.attr-value { + font-family: monospace; + padding-left: 1em; + font-size: 1.15em; +} + +.dyn-source { + display: none; + background: #fffde8; + color: #000; + border: #ffe0bb dotted 1px; + margin: 0.5em 2em 0.5em 0; + padding: 0.5em; +} + +.dyn-source .cmt { + color: #00F; + font-style: italic; +} + +.dyn-source .kw { + color: #070; + font-weight: bold; +} + +.description pre { + padding: 0.5em; + border: #ffe0bb dotted 1px; + background: #fffde8; +} + +.method { + margin-bottom: 2em; +} +.method .description, +.method .sourcecode +{ + margin-left: 1.2em; +} +.method h4 +{ + border-bottom: 1px dotted #999; + padding: 0 0 0.2em 0; + margin-bottom: 0.8em; + font-size: 1.1em; + color:#333; +} +.method .method-title { + border-bottom: 1px dotted #666; + padding: 0 0 0.15em 0; + margin: 0 0 0.5em 0; + font-size: 1.2em; + line-height: 1.25em; + position: relative; +} + +.method .method-title a.permalink { + position: absolute; + font-size: 0.75em; + right: 0; +} + +.method .sourcecode p.source-link { + text-indent: 0em; + margin-top: 0.5em; +} + +.method .aka { + margin-top: 0.3em; + margin-left: 1em; + font-style: italic; + text-indent: 2em; +} + +.method .source-link +{ + font-size: 0.85em; +} + +.ruby-constant { + color: teal; +} +.ruby-keyword { + color: #000; + font-weight: bold +} +.ruby-title { + color: #900; + font-weight: bold; +} +.ruby-ivar { + color: teal; +} +.ruby-operator { + color: #000; + font-weight: bold +} +.ruby-identifier { + color: #000; +} +.ruby-string, +.ruby-node { + color: #D14; +} +.ruby-comment { + color: #998; + font-style: italic; +} +.ruby-regexp { + color: #009926; +} +.ruby-value { + color: #990073; +} +.ruby-number { + color: #40A070; +} diff --git a/doc/code/css/panel.css b/doc/code/css/panel.css new file mode 100755 index 00000000000..9bd8027b739 --- /dev/null +++ b/doc/code/css/panel.css @@ -0,0 +1,384 @@ +/* Panel (begin) */ + .panel + { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + background: #FFF; + z-index: 2; + font-family: "Helvetica Neue", "Arial", sans-serif; + //zoom: 1; + } + + .panel_tree .results, + .panel_results .tree + { + display: none; + } + + /* Header with search box (begin) */ + .panel .header + { + width: 100%; + height: 29px; + border-bottom: 1px solid #666; + position: relative; + left: 0; top: 0; + background: #e8e8e8; + } + + .panel .header div + { + margin: 0 7px; + } + .panel .header table + { + height: 29px; + width: 100%; + } + + .panel .header table td + { + vertical-align: middle; + text-align: middle; + } + + .panel .header label + { + position: absolute; + font-size: 12px; + line-height: 29px; + margin-left: 3px; + color: #999; + cursor: text; + } + + .panel .header table input + { + width: 100%; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + display: inline-block; + -webkit-appearance: searchfield; + height: 22px; + //height: auto; + } + + /* Header with search box (end) */ + + + /* Results (begin) */ + .panel .result + { + position: absolute; + top: 30px; + bottom: 0; + left: 0; + width: 100%; + //height: expression((this.parentNode.offsetHeight - 31)); + overflow-y: scroll; + overflow-x: hidden; + -overflow-y: hidden; + background: #EDF3FE url(../i/results_bg.png); + z-index: 2; + //zoom:1; + } + + .panel .result ul + { + font-size: 0.8em; + width: 100%; + background: #EDF3FE url(../i/results_bg.png); + //zoom:1; + } + + .panel .result ul li + { + height: 46px; + -height: 50px; + //display: inline; + //width: 100%; + //zoom: 1; + overflow: hidden; + padding: 4px 10px 0 10px; + cursor: pointer; + } + + .panel .result ul li h1 + { + font-size: 13px; + font-weight: normal; + color: #333; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .result ul li p + { + font-size: 11px; + color: #333; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .result ul li h1 i, + .panel .result ul li p.snippet + { + color: #999; + } + + .panel .result ul li b + { + color: #000; + } + + .panel .result ul li.current + { + background: #3875D7; + } + + .panel .result ul li.current h1, + .panel .result ul li.current p + { + color: #DDD; + } + + .panel .result ul li.current h1 i, + .panel .result ul li.current p.snippet + { + color: #AAA; + } + + .panel .result ul li.current b + { + color: #FFF; + } + + + .panel .result ul li:hover, + .panel .result ul li.selected + { + background: #d0d0d0; + } + + .panel .result ul li.current:hover + { + background: #2965C0; + } + + .panel .result ul li .badge + { + margin-right: 0.4em; + margin-left: -0.2em; + padding: 0 0.2em; + color: #000; + border-radius: 3px; + } + + .panel .result ul li .badge_1 + { + background: #ACDBF4; + } + + .panel .result ul li.current .badge_1 + { + background: #97BFD7; + } + + .panel .result ul li .badge_2 + { + background: #ACF3C3; + } + + .panel .result ul li.current .badge_2 + { + background: #98D7AC; + } + + .panel .result ul li .badge_3 + { + background: #E0F3AC; + } + + .panel .result ul li.current .badge_3 + { + background: #C4D798; + } + + .panel .result ul li .badge_4 + { + background: #D7CA98; + } + + .panel .result ul li.current .badge_4 + { + background: #A6B0AC; + } + + .panel .result ul li .badge_5 + { + background: #F3C8AC; + } + + .panel .result ul li.current .badge_5 + { + background: #D7B198; + } + + .panel .result ul li .badge_6 + { + background: #F3ACC3; + } + + .panel .result ul li.current .badge_6 + { + background: #D798AB; + } + + /* Results (end) */ + + /* Tree (begin) */ /**/ + .panel .tree + { + position: absolute; + top: 30px; + bottom: 0; + left: 0; + width: 100%; + //zoom: 1; + //height: expression((this.parentNode.offsetHeight - 31)); + overflow-y: scroll; + overflow-x: hidden; + -overflow-y: hidden; + background: #EDF3FE url(../i/tree_bg.png); + z-index: 30; + } + + .panel .tree ul + { + background: #EDF3FE url(../i/tree_bg.png); + } + + .panel .tree li + { + cursor: pointer; + overflow: hidden; + //height: 23px; + //display: inline; + //zoom: 1; + //width: 100%; + } + + + .panel .tree li .content + { + padding-left: 18px; + padding-top: 5px; + height: 18px; + overflow: hidden; + position: relative; + } + + .panel .tree li .icon + { + width: 10px; + height: 9px; + background: url(../i/arrows.png); + background-position: 0 -9px; + position: absolute; + left: 1px; + top: 8px; + cursor: default; + } + + .panel .tree li.closed .icon + { + background-position: 0 0; + } + + .panel .tree ul li h1 + { + font-size: 13px; + font-weight: normal; + color: #000; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .tree ul li p + { + font-size: 11px; + color: #666; + margin-bottom: 2px; + white-space: nowrap; + } + + .panel .tree ul li h1 i + { + color: #999; + font-style: normal; + } + + .panel .tree ul li.empty + { + cursor: text; + } + + .panel .tree ul li.empty h1, + .panel .tree ul li.empty p + { + color: #666; + font-style: italic; + } + + .panel .tree ul li.current + { + background: #3875D7; + } + + .panel .tree ul li.current .icon + { + background-position: -10px -9px; + } + + .panel .tree ul li.current.closed .icon + { + background-position: -10px 0; + } + + .panel .tree ul li.current h1 + { + color: #FFF; + } + + .panel .tree ul li.current p + { + color: #CCC; + } + + .panel .tree ul li.current.empty h1, + .panel .tree ul li.current.empty p + { + color: #999; + } + + .panel .tree ul li:hover + { + background: #d0d0d0; + } + + .panel .tree ul li.current:hover + { + background: #2965C0; + } + + .panel .tree .stopper + { + display: none; + } + /* Tree (end) */ /**/ + +/* Panel (end) */ \ No newline at end of file diff --git a/doc/code/css/reset.css b/doc/code/css/reset.css new file mode 100755 index 00000000000..da4a2394a86 --- /dev/null +++ b/doc/code/css/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ */ +/* v1.0 | 20080212 */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} \ No newline at end of file diff --git a/doc/code/favicon.ico b/doc/code/favicon.ico new file mode 100644 index 00000000000..e0e80cf8f15 Binary files /dev/null and b/doc/code/favicon.ico differ diff --git a/doc/code/files/app/assets/fonts/OFL_txt.html b/doc/code/files/app/assets/fonts/OFL_txt.html new file mode 100644 index 00000000000..f873d9b2d41 --- /dev/null +++ b/doc/code/files/app/assets/fonts/OFL_txt.html @@ -0,0 +1,158 @@ + + + + + OFL.txt + + + + + + + + + + + + + + +
+
+ +
+ +

Copyright © 2010, Jan Gerner (post@yanone.de) This Font Software is +licensed under the SIL Open Font License, Version 1.1. This license is +copied below, and is also available with a FAQ at: scripts.sil.org/OFL

+
+ +

SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007

+
+ +

PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of +collaborative font projects, to support the font creation efforts of +academic and linguistic communities, and to provide a free and open +framework in which fonts may be shared and improved in partnership with +others.

+ +

The OFL allows the licensed fonts to be used, +studied, modified and redistributed freely as long as they are not sold by +themselves. The fonts, including any derivative works, can be bundled, +embedded, redistributed and/or sold with any software provided that any +reserved names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to any +document created using the fonts or their derivatives.

+ +

DEFINITIONS “Font Software” refers to the set of files released by the +Copyright Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation.

+ +

“Reserved Font Name” refers to any names specified as such after the +copyright statement(s).

+ +

“Original Version” refers to the collection of Font Software components as +distributed by the Copyright Holder(s).

+ +

“Modified Version” refers to any derivative made by adding to, deleting, or +substituting – in part or in whole – any of the components of the Original +Version, by changing formats or by porting the Font Software to a new +environment.

+ +

“Author” refers to any designer, engineer, programmer, technical writer or +other person who contributed to the Font Software.

+ +

PERMISSION & CONDITIONS Permission is hereby granted, free of charge, +to any person obtaining a copy of the Font Software, to use, study, copy, +merge, embed, modify, redistribute, and sell modified and unmodified copies +of the Font Software, subject to the following conditions:

+ +

1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself.

+ +

2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be included +either as stand-alone text files, human-readable headers or in the +appropriate machine-readable metadata fields within text or binary files as +long as those fields can be easily viewed by the user.

+ +

3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users.

+ +

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any Modified +Version, except to acknowledge the contribution(s) of the Copyright +Holder(s) and the Author(s) or with their explicit written permission.

+ +

5) The Font Software, modified or unmodified, in part or in whole, must be +distributed entirely under this license, and must not be distributed under +any other license. The requirement for fonts to remain under this license +does not apply to any document created using the Font Software.

+ +

TERMINATION This license becomes null and void if any of the above +conditions are not met.

+ +

DISCLAIMER THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS +IN THE FONT SOFTWARE.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/base_context_rb.html b/doc/code/files/app/contexts/base_context_rb.html new file mode 100644 index 00000000000..214164305c2 --- /dev/null +++ b/doc/code/files/app/contexts/base_context_rb.html @@ -0,0 +1,79 @@ + + + + + base_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/commit_load_context_rb.html b/doc/code/files/app/contexts/commit_load_context_rb.html new file mode 100644 index 00000000000..c21f5e1b752 --- /dev/null +++ b/doc/code/files/app/contexts/commit_load_context_rb.html @@ -0,0 +1,79 @@ + + + + + commit_load_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/issues_bulk_update_context_rb.html b/doc/code/files/app/contexts/issues_bulk_update_context_rb.html new file mode 100644 index 00000000000..18b89d585c7 --- /dev/null +++ b/doc/code/files/app/contexts/issues_bulk_update_context_rb.html @@ -0,0 +1,79 @@ + + + + + issues_bulk_update_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/issues_list_context_rb.html b/doc/code/files/app/contexts/issues_list_context_rb.html new file mode 100644 index 00000000000..6d83a6b4bb0 --- /dev/null +++ b/doc/code/files/app/contexts/issues_list_context_rb.html @@ -0,0 +1,79 @@ + + + + + issues_list_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/merge_requests_load_context_rb.html b/doc/code/files/app/contexts/merge_requests_load_context_rb.html new file mode 100644 index 00000000000..5f9c54623fd --- /dev/null +++ b/doc/code/files/app/contexts/merge_requests_load_context_rb.html @@ -0,0 +1,86 @@ + + + + + merge_requests_load_context.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Build collection of Merge Requests based on filtering passed via params for +@project

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/notes/create_context_rb.html b/doc/code/files/app/contexts/notes/create_context_rb.html new file mode 100644 index 00000000000..7cf9a67c104 --- /dev/null +++ b/doc/code/files/app/contexts/notes/create_context_rb.html @@ -0,0 +1,84 @@ + + + + + create_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/notes/load_context_rb.html b/doc/code/files/app/contexts/notes/load_context_rb.html new file mode 100644 index 00000000000..84c7f1435aa --- /dev/null +++ b/doc/code/files/app/contexts/notes/load_context_rb.html @@ -0,0 +1,84 @@ + + + + + load_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/project_update_context_rb.html b/doc/code/files/app/contexts/project_update_context_rb.html new file mode 100644 index 00000000000..2712b358f1b --- /dev/null +++ b/doc/code/files/app/contexts/project_update_context_rb.html @@ -0,0 +1,79 @@ + + + + + project_update_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/search_context_rb.html b/doc/code/files/app/contexts/search_context_rb.html new file mode 100644 index 00000000000..85d7cc3060d --- /dev/null +++ b/doc/code/files/app/contexts/search_context_rb.html @@ -0,0 +1,79 @@ + + + + + search_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/contexts/test_hook_context_rb.html b/doc/code/files/app/contexts/test_hook_context_rb.html new file mode 100644 index 00000000000..ebb88998908 --- /dev/null +++ b/doc/code/files/app/contexts/test_hook_context_rb.html @@ -0,0 +1,79 @@ + + + + + test_hook_context.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/dashboard_controller_rb.html b/doc/code/files/app/controllers/admin/dashboard_controller_rb.html new file mode 100644 index 00000000000..1fd4edd0be5 --- /dev/null +++ b/doc/code/files/app/controllers/admin/dashboard_controller_rb.html @@ -0,0 +1,79 @@ + + + + + dashboard_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/groups_controller_rb.html b/doc/code/files/app/controllers/admin/groups_controller_rb.html new file mode 100644 index 00000000000..8fe6fc90a78 --- /dev/null +++ b/doc/code/files/app/controllers/admin/groups_controller_rb.html @@ -0,0 +1,79 @@ + + + + + groups_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/hooks_controller_rb.html b/doc/code/files/app/controllers/admin/hooks_controller_rb.html new file mode 100644 index 00000000000..221091a2c08 --- /dev/null +++ b/doc/code/files/app/controllers/admin/hooks_controller_rb.html @@ -0,0 +1,79 @@ + + + + + hooks_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/logs_controller_rb.html b/doc/code/files/app/controllers/admin/logs_controller_rb.html new file mode 100644 index 00000000000..27957990e95 --- /dev/null +++ b/doc/code/files/app/controllers/admin/logs_controller_rb.html @@ -0,0 +1,79 @@ + + + + + logs_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/projects_controller_rb.html b/doc/code/files/app/controllers/admin/projects_controller_rb.html new file mode 100644 index 00000000000..2d611510991 --- /dev/null +++ b/doc/code/files/app/controllers/admin/projects_controller_rb.html @@ -0,0 +1,79 @@ + + + + + projects_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/resque_controller_rb.html b/doc/code/files/app/controllers/admin/resque_controller_rb.html new file mode 100644 index 00000000000..742a9c7d96a --- /dev/null +++ b/doc/code/files/app/controllers/admin/resque_controller_rb.html @@ -0,0 +1,79 @@ + + + + + resque_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/team_members_controller_rb.html b/doc/code/files/app/controllers/admin/team_members_controller_rb.html new file mode 100644 index 00000000000..b821baffe28 --- /dev/null +++ b/doc/code/files/app/controllers/admin/team_members_controller_rb.html @@ -0,0 +1,79 @@ + + + + + team_members_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin/users_controller_rb.html b/doc/code/files/app/controllers/admin/users_controller_rb.html new file mode 100644 index 00000000000..c8188f7e192 --- /dev/null +++ b/doc/code/files/app/controllers/admin/users_controller_rb.html @@ -0,0 +1,79 @@ + + + + + users_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/admin_controller_rb.html b/doc/code/files/app/controllers/admin_controller_rb.html new file mode 100644 index 00000000000..7837559263f --- /dev/null +++ b/doc/code/files/app/controllers/admin_controller_rb.html @@ -0,0 +1,88 @@ + + + + + admin_controller.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Provides a base class for Admin +controllers to subclass

+ +

Automatically sets the layout and ensures an administrator is logged in

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/application_controller_rb.html b/doc/code/files/app/controllers/application_controller_rb.html new file mode 100644 index 00000000000..f13dba25f5e --- /dev/null +++ b/doc/code/files/app/controllers/application_controller_rb.html @@ -0,0 +1,79 @@ + + + + + application_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/blame_controller_rb.html b/doc/code/files/app/controllers/blame_controller_rb.html new file mode 100644 index 00000000000..f0c34244ee1 --- /dev/null +++ b/doc/code/files/app/controllers/blame_controller_rb.html @@ -0,0 +1,85 @@ + + + + + blame_controller.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Controller for viewing a file’s blame

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/blob_controller_rb.html b/doc/code/files/app/controllers/blob_controller_rb.html new file mode 100644 index 00000000000..a5bdfad1a3f --- /dev/null +++ b/doc/code/files/app/controllers/blob_controller_rb.html @@ -0,0 +1,85 @@ + + + + + blob_controller.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Controller for viewing a file’s blame

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/commit_controller_rb.html b/doc/code/files/app/controllers/commit_controller_rb.html new file mode 100644 index 00000000000..a7189c8604b --- /dev/null +++ b/doc/code/files/app/controllers/commit_controller_rb.html @@ -0,0 +1,89 @@ + + + + + commit_controller.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Controller for a specific Commit

+ +

Not to be confused with CommitsController, +plural.

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/commits_controller_rb.html b/doc/code/files/app/controllers/commits_controller_rb.html new file mode 100644 index 00000000000..989e4cd8639 --- /dev/null +++ b/doc/code/files/app/controllers/commits_controller_rb.html @@ -0,0 +1,87 @@ + + + + + commits_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • base64
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/compare_controller_rb.html b/doc/code/files/app/controllers/compare_controller_rb.html new file mode 100644 index 00000000000..479fa86925b --- /dev/null +++ b/doc/code/files/app/controllers/compare_controller_rb.html @@ -0,0 +1,79 @@ + + + + + compare_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/dashboard_controller_rb.html b/doc/code/files/app/controllers/dashboard_controller_rb.html new file mode 100644 index 00000000000..ac7012f4c1d --- /dev/null +++ b/doc/code/files/app/controllers/dashboard_controller_rb.html @@ -0,0 +1,79 @@ + + + + + dashboard_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/deploy_keys_controller_rb.html b/doc/code/files/app/controllers/deploy_keys_controller_rb.html new file mode 100644 index 00000000000..c0c598a2493 --- /dev/null +++ b/doc/code/files/app/controllers/deploy_keys_controller_rb.html @@ -0,0 +1,79 @@ + + + + + deploy_keys_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/errors_controller_rb.html b/doc/code/files/app/controllers/errors_controller_rb.html new file mode 100644 index 00000000000..bd2da28be6f --- /dev/null +++ b/doc/code/files/app/controllers/errors_controller_rb.html @@ -0,0 +1,79 @@ + + + + + errors_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/groups_controller_rb.html b/doc/code/files/app/controllers/groups_controller_rb.html new file mode 100644 index 00000000000..905f17b39c9 --- /dev/null +++ b/doc/code/files/app/controllers/groups_controller_rb.html @@ -0,0 +1,79 @@ + + + + + groups_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/help_controller_rb.html b/doc/code/files/app/controllers/help_controller_rb.html new file mode 100644 index 00000000000..0c41c81ee05 --- /dev/null +++ b/doc/code/files/app/controllers/help_controller_rb.html @@ -0,0 +1,79 @@ + + + + + help_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/hooks_controller_rb.html b/doc/code/files/app/controllers/hooks_controller_rb.html new file mode 100644 index 00000000000..8182569b8ce --- /dev/null +++ b/doc/code/files/app/controllers/hooks_controller_rb.html @@ -0,0 +1,79 @@ + + + + + hooks_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/issues_controller_rb.html b/doc/code/files/app/controllers/issues_controller_rb.html new file mode 100644 index 00000000000..1c1986952cc --- /dev/null +++ b/doc/code/files/app/controllers/issues_controller_rb.html @@ -0,0 +1,79 @@ + + + + + issues_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/keys_controller_rb.html b/doc/code/files/app/controllers/keys_controller_rb.html new file mode 100644 index 00000000000..d88ed459a62 --- /dev/null +++ b/doc/code/files/app/controllers/keys_controller_rb.html @@ -0,0 +1,79 @@ + + + + + keys_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/labels_controller_rb.html b/doc/code/files/app/controllers/labels_controller_rb.html new file mode 100644 index 00000000000..6b22a056928 --- /dev/null +++ b/doc/code/files/app/controllers/labels_controller_rb.html @@ -0,0 +1,79 @@ + + + + + labels_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/merge_requests_controller_rb.html b/doc/code/files/app/controllers/merge_requests_controller_rb.html new file mode 100644 index 00000000000..5dd462cc37a --- /dev/null +++ b/doc/code/files/app/controllers/merge_requests_controller_rb.html @@ -0,0 +1,79 @@ + + + + + merge_requests_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/milestones_controller_rb.html b/doc/code/files/app/controllers/milestones_controller_rb.html new file mode 100644 index 00000000000..70eb9de7653 --- /dev/null +++ b/doc/code/files/app/controllers/milestones_controller_rb.html @@ -0,0 +1,79 @@ + + + + + milestones_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/notes_controller_rb.html b/doc/code/files/app/controllers/notes_controller_rb.html new file mode 100644 index 00000000000..67e846be25f --- /dev/null +++ b/doc/code/files/app/controllers/notes_controller_rb.html @@ -0,0 +1,79 @@ + + + + + notes_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/omniauth_callbacks_controller_rb.html b/doc/code/files/app/controllers/omniauth_callbacks_controller_rb.html new file mode 100644 index 00000000000..1b5e8fa0d1f --- /dev/null +++ b/doc/code/files/app/controllers/omniauth_callbacks_controller_rb.html @@ -0,0 +1,79 @@ + + + + + omniauth_callbacks_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/profiles_controller_rb.html b/doc/code/files/app/controllers/profiles_controller_rb.html new file mode 100644 index 00000000000..0b085838a32 --- /dev/null +++ b/doc/code/files/app/controllers/profiles_controller_rb.html @@ -0,0 +1,79 @@ + + + + + profiles_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/project_resource_controller_rb.html b/doc/code/files/app/controllers/project_resource_controller_rb.html new file mode 100644 index 00000000000..e17be7ab22e --- /dev/null +++ b/doc/code/files/app/controllers/project_resource_controller_rb.html @@ -0,0 +1,79 @@ + + + + + project_resource_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/projects_controller_rb.html b/doc/code/files/app/controllers/projects_controller_rb.html new file mode 100644 index 00000000000..939eb71e0d8 --- /dev/null +++ b/doc/code/files/app/controllers/projects_controller_rb.html @@ -0,0 +1,79 @@ + + + + + projects_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/protected_branches_controller_rb.html b/doc/code/files/app/controllers/protected_branches_controller_rb.html new file mode 100644 index 00000000000..1fca71347e3 --- /dev/null +++ b/doc/code/files/app/controllers/protected_branches_controller_rb.html @@ -0,0 +1,79 @@ + + + + + protected_branches_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/refs_controller_rb.html b/doc/code/files/app/controllers/refs_controller_rb.html new file mode 100644 index 00000000000..207441f161d --- /dev/null +++ b/doc/code/files/app/controllers/refs_controller_rb.html @@ -0,0 +1,79 @@ + + + + + refs_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/repositories_controller_rb.html b/doc/code/files/app/controllers/repositories_controller_rb.html new file mode 100644 index 00000000000..eab4dd4de8b --- /dev/null +++ b/doc/code/files/app/controllers/repositories_controller_rb.html @@ -0,0 +1,79 @@ + + + + + repositories_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/search_controller_rb.html b/doc/code/files/app/controllers/search_controller_rb.html new file mode 100644 index 00000000000..f47c36644d2 --- /dev/null +++ b/doc/code/files/app/controllers/search_controller_rb.html @@ -0,0 +1,79 @@ + + + + + search_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/services_controller_rb.html b/doc/code/files/app/controllers/services_controller_rb.html new file mode 100644 index 00000000000..de836e79e0a --- /dev/null +++ b/doc/code/files/app/controllers/services_controller_rb.html @@ -0,0 +1,79 @@ + + + + + services_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/snippets_controller_rb.html b/doc/code/files/app/controllers/snippets_controller_rb.html new file mode 100644 index 00000000000..662aef9100c --- /dev/null +++ b/doc/code/files/app/controllers/snippets_controller_rb.html @@ -0,0 +1,79 @@ + + + + + snippets_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/team_members_controller_rb.html b/doc/code/files/app/controllers/team_members_controller_rb.html new file mode 100644 index 00000000000..c4784ecce49 --- /dev/null +++ b/doc/code/files/app/controllers/team_members_controller_rb.html @@ -0,0 +1,79 @@ + + + + + team_members_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/tree_controller_rb.html b/doc/code/files/app/controllers/tree_controller_rb.html new file mode 100644 index 00000000000..1a21f186f19 --- /dev/null +++ b/doc/code/files/app/controllers/tree_controller_rb.html @@ -0,0 +1,85 @@ + + + + + tree_controller.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Controller for viewing a repository’s file structure

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/controllers/wikis_controller_rb.html b/doc/code/files/app/controllers/wikis_controller_rb.html new file mode 100644 index 00000000000..bbebf05fe7b --- /dev/null +++ b/doc/code/files/app/controllers/wikis_controller_rb.html @@ -0,0 +1,79 @@ + + + + + wikis_controller.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/decorators/application_decorator_rb.html b/doc/code/files/app/decorators/application_decorator_rb.html new file mode 100644 index 00000000000..5998d46d215 --- /dev/null +++ b/doc/code/files/app/decorators/application_decorator_rb.html @@ -0,0 +1,79 @@ + + + + + application_decorator.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/decorators/commit_decorator_rb.html b/doc/code/files/app/decorators/commit_decorator_rb.html new file mode 100644 index 00000000000..ef09e71875c --- /dev/null +++ b/doc/code/files/app/decorators/commit_decorator_rb.html @@ -0,0 +1,79 @@ + + + + + commit_decorator.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/decorators/event_decorator_rb.html b/doc/code/files/app/decorators/event_decorator_rb.html new file mode 100644 index 00000000000..156d6008ee9 --- /dev/null +++ b/doc/code/files/app/decorators/event_decorator_rb.html @@ -0,0 +1,79 @@ + + + + + event_decorator.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/decorators/tree_decorator_rb.html b/doc/code/files/app/decorators/tree_decorator_rb.html new file mode 100644 index 00000000000..0ca1f9ee6ed --- /dev/null +++ b/doc/code/files/app/decorators/tree_decorator_rb.html @@ -0,0 +1,79 @@ + + + + + tree_decorator.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/decorators/user_decorator_rb.html b/doc/code/files/app/decorators/user_decorator_rb.html new file mode 100644 index 00000000000..ab659f66ff3 --- /dev/null +++ b/doc/code/files/app/decorators/user_decorator_rb.html @@ -0,0 +1,79 @@ + + + + + user_decorator.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/application_helper_rb.html b/doc/code/files/app/helpers/application_helper_rb.html new file mode 100644 index 00000000000..72447215cb7 --- /dev/null +++ b/doc/code/files/app/helpers/application_helper_rb.html @@ -0,0 +1,89 @@ + + + + + application_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • digest/md5
  • + +
  • uri
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/commits_helper_rb.html b/doc/code/files/app/helpers/commits_helper_rb.html new file mode 100644 index 00000000000..4d78fca9263 --- /dev/null +++ b/doc/code/files/app/helpers/commits_helper_rb.html @@ -0,0 +1,79 @@ + + + + + commits_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/dashboard_helper_rb.html b/doc/code/files/app/helpers/dashboard_helper_rb.html new file mode 100644 index 00000000000..31389328057 --- /dev/null +++ b/doc/code/files/app/helpers/dashboard_helper_rb.html @@ -0,0 +1,79 @@ + + + + + dashboard_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/events_helper_rb.html b/doc/code/files/app/helpers/events_helper_rb.html new file mode 100644 index 00000000000..63903ce07a8 --- /dev/null +++ b/doc/code/files/app/helpers/events_helper_rb.html @@ -0,0 +1,79 @@ + + + + + events_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/gitlab_markdown_helper_rb.html b/doc/code/files/app/helpers/gitlab_markdown_helper_rb.html new file mode 100644 index 00000000000..9aada0e731d --- /dev/null +++ b/doc/code/files/app/helpers/gitlab_markdown_helper_rb.html @@ -0,0 +1,79 @@ + + + + + gitlab_markdown_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/issues_helper_rb.html b/doc/code/files/app/helpers/issues_helper_rb.html new file mode 100644 index 00000000000..1e107ebf56d --- /dev/null +++ b/doc/code/files/app/helpers/issues_helper_rb.html @@ -0,0 +1,79 @@ + + + + + issues_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/merge_requests_helper_rb.html b/doc/code/files/app/helpers/merge_requests_helper_rb.html new file mode 100644 index 00000000000..556caad9848 --- /dev/null +++ b/doc/code/files/app/helpers/merge_requests_helper_rb.html @@ -0,0 +1,79 @@ + + + + + merge_requests_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/namespaces_helper_rb.html b/doc/code/files/app/helpers/namespaces_helper_rb.html new file mode 100644 index 00000000000..2fb5aa1dcd2 --- /dev/null +++ b/doc/code/files/app/helpers/namespaces_helper_rb.html @@ -0,0 +1,79 @@ + + + + + namespaces_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/notes_helper_rb.html b/doc/code/files/app/helpers/notes_helper_rb.html new file mode 100644 index 00000000000..a21a80fe9d7 --- /dev/null +++ b/doc/code/files/app/helpers/notes_helper_rb.html @@ -0,0 +1,79 @@ + + + + + notes_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/profile_helper_rb.html b/doc/code/files/app/helpers/profile_helper_rb.html new file mode 100644 index 00000000000..d87776b949e --- /dev/null +++ b/doc/code/files/app/helpers/profile_helper_rb.html @@ -0,0 +1,79 @@ + + + + + profile_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/projects_helper_rb.html b/doc/code/files/app/helpers/projects_helper_rb.html new file mode 100644 index 00000000000..c388a481cf7 --- /dev/null +++ b/doc/code/files/app/helpers/projects_helper_rb.html @@ -0,0 +1,79 @@ + + + + + projects_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/snippets_helper_rb.html b/doc/code/files/app/helpers/snippets_helper_rb.html new file mode 100644 index 00000000000..697e590e474 --- /dev/null +++ b/doc/code/files/app/helpers/snippets_helper_rb.html @@ -0,0 +1,79 @@ + + + + + snippets_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/tab_helper_rb.html b/doc/code/files/app/helpers/tab_helper_rb.html new file mode 100644 index 00000000000..5bb3d6295a9 --- /dev/null +++ b/doc/code/files/app/helpers/tab_helper_rb.html @@ -0,0 +1,79 @@ + + + + + tab_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/tags_helper_rb.html b/doc/code/files/app/helpers/tags_helper_rb.html new file mode 100644 index 00000000000..074e404cdcf --- /dev/null +++ b/doc/code/files/app/helpers/tags_helper_rb.html @@ -0,0 +1,79 @@ + + + + + tags_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/helpers/tree_helper_rb.html b/doc/code/files/app/helpers/tree_helper_rb.html new file mode 100644 index 00000000000..2d7bac33343 --- /dev/null +++ b/doc/code/files/app/helpers/tree_helper_rb.html @@ -0,0 +1,79 @@ + + + + + tree_helper.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/mailers/notify_rb.html b/doc/code/files/app/mailers/notify_rb.html new file mode 100644 index 00000000000..86e17f0f516 --- /dev/null +++ b/doc/code/files/app/mailers/notify_rb.html @@ -0,0 +1,79 @@ + + + + + notify.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/ability_rb.html b/doc/code/files/app/models/ability_rb.html new file mode 100644 index 00000000000..cf22c56a829 --- /dev/null +++ b/doc/code/files/app/models/ability_rb.html @@ -0,0 +1,79 @@ + + + + + ability.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/commit_rb.html b/doc/code/files/app/models/commit_rb.html new file mode 100644 index 00000000000..f48c8a6cd01 --- /dev/null +++ b/doc/code/files/app/models/commit_rb.html @@ -0,0 +1,79 @@ + + + + + commit.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/event_rb.html b/doc/code/files/app/models/event_rb.html new file mode 100644 index 00000000000..0409518cbec --- /dev/null +++ b/doc/code/files/app/models/event_rb.html @@ -0,0 +1,98 @@ + + + + + event.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: events

+ +
id          :integer          not null, primary key
+target_type :string(255)
+target_id   :integer
+title       :string(255)
+data        :text
+project_id  :integer
+created_at  :datetime         not null
+updated_at  :datetime         not null
+action      :integer
+author_id   :integer
+ +
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Event +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/gitlab_ci_service_rb.html b/doc/code/files/app/models/gitlab_ci_service_rb.html new file mode 100644 index 00000000000..69849529510 --- /dev/null +++ b/doc/code/files/app/models/gitlab_ci_service_rb.html @@ -0,0 +1,97 @@ + + + + + gitlab_ci_service.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: services

+ +
id          :integer          not null, primary key
+type        :string(255)
+title       :string(255)
+token       :string(255)
+project_id  :integer          not null
+created_at  :datetime         not null
+updated_at  :datetime         not null
+active      :boolean          default(FALSE), not null
+project_url :string(255)
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/group_rb.html b/doc/code/files/app/models/group_rb.html new file mode 100644 index 00000000000..9606ee7b5b6 --- /dev/null +++ b/doc/code/files/app/models/group_rb.html @@ -0,0 +1,95 @@ + + + + + group.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: namespaces

+ +
id         :integer          not null, primary key
+name       :string(255)      not null
+path       :string(255)      not null
+owner_id   :integer          not null
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)
+ +
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Group +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/issue_rb.html b/doc/code/files/app/models/issue_rb.html new file mode 100644 index 00000000000..1cf1727ca6f --- /dev/null +++ b/doc/code/files/app/models/issue_rb.html @@ -0,0 +1,100 @@ + + + + + issue.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: issues

+ +
id           :integer          not null, primary key
+title        :string(255)
+assignee_id  :integer
+author_id    :integer
+project_id   :integer
+created_at   :datetime         not null
+updated_at   :datetime         not null
+closed       :boolean          default(FALSE), not null
+position     :integer          default(0)
+branch_name  :string(255)
+description  :text
+milestone_id :integer
+ +
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Issue +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/key_rb.html b/doc/code/files/app/models/key_rb.html new file mode 100644 index 00000000000..8b703afe855 --- /dev/null +++ b/doc/code/files/app/models/key_rb.html @@ -0,0 +1,104 @@ + + + + + key.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: keys

+ +
id         :integer          not null, primary key
+user_id    :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+key        :text
+title      :string(255)
+identifier :string(255)
+project_id :integer
+ +
+ + + + + +
Required Files
+
    + +
  • digest/md5
  • + +
+ + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Key +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/merge_request_rb.html b/doc/code/files/app/models/merge_request_rb.html new file mode 100644 index 00000000000..11fbed2e7f8 --- /dev/null +++ b/doc/code/files/app/models/merge_request_rb.html @@ -0,0 +1,103 @@ + + + + + merge_request.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: merge_requests

+ +
id            :integer          not null, primary key
+target_branch :string(255)      not null
+source_branch :string(255)      not null
+project_id    :integer          not null
+author_id     :integer
+assignee_id   :integer
+title         :string(255)
+closed        :boolean          default(FALSE), not null
+created_at    :datetime         not null
+updated_at    :datetime         not null
+st_commits    :text(2147483647)
+st_diffs      :text(2147483647)
+merged        :boolean          default(FALSE), not null
+state         :integer          default(1), not null
+milestone_id  :integer
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/milestone_rb.html b/doc/code/files/app/models/milestone_rb.html new file mode 100644 index 00000000000..38ec8298c88 --- /dev/null +++ b/doc/code/files/app/models/milestone_rb.html @@ -0,0 +1,96 @@ + + + + + milestone.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: milestones

+ +
id          :integer          not null, primary key
+title       :string(255)      not null
+project_id  :integer          not null
+description :text
+due_date    :date
+closed      :boolean          default(FALSE), not null
+created_at  :datetime         not null
+updated_at  :datetime         not null
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/namespace_rb.html b/doc/code/files/app/models/namespace_rb.html new file mode 100644 index 00000000000..d0e97db615b --- /dev/null +++ b/doc/code/files/app/models/namespace_rb.html @@ -0,0 +1,95 @@ + + + + + namespace.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: namespaces

+ +
id         :integer          not null, primary key
+name       :string(255)      not null
+path       :string(255)      not null
+owner_id   :integer          not null
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/note_rb.html b/doc/code/files/app/models/note_rb.html new file mode 100644 index 00000000000..6c7a6e21487 --- /dev/null +++ b/doc/code/files/app/models/note_rb.html @@ -0,0 +1,108 @@ + + + + + note.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: notes

+ +
id            :integer          not null, primary key
+note          :text
+noteable_id   :string(255)
+noteable_type :string(255)
+author_id     :integer
+created_at    :datetime         not null
+updated_at    :datetime         not null
+project_id    :integer
+attachment    :string(255)
+line_code     :string(255)
+ +
+ + + + + +
Required Files
+
    + +
  • carrierwave/orm/activerecord
  • + +
  • file_size_validator
  • + +
+ + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Note +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/project_hook_rb.html b/doc/code/files/app/models/project_hook_rb.html new file mode 100644 index 00000000000..8756e2a337a --- /dev/null +++ b/doc/code/files/app/models/project_hook_rb.html @@ -0,0 +1,95 @@ + + + + + project_hook.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/project_rb.html b/doc/code/files/app/models/project_rb.html new file mode 100644 index 00000000000..739bb5c71ce --- /dev/null +++ b/doc/code/files/app/models/project_rb.html @@ -0,0 +1,115 @@ + + + + + project.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: projects

+ +
id                     :integer          not null, primary key
+name                   :string(255)
+path                   :string(255)
+description            :text
+created_at             :datetime         not null
+updated_at             :datetime         not null
+private_flag           :boolean          default(TRUE), not null
+owner_id               :integer
+default_branch         :string(255)
+issues_enabled         :boolean          default(TRUE), not null
+wall_enabled           :boolean          default(TRUE), not null
+merge_requests_enabled :boolean          default(TRUE), not null
+wiki_enabled           :boolean          default(TRUE), not null
+namespace_id           :integer
+ +
+ + + + + +
Required Files
+
    + +
  • grit
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/protected_branch_rb.html b/doc/code/files/app/models/protected_branch_rb.html new file mode 100644 index 00000000000..496b4d21f12 --- /dev/null +++ b/doc/code/files/app/models/protected_branch_rb.html @@ -0,0 +1,93 @@ + + + + + protected_branch.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: protected_branches

+ +
id         :integer          not null, primary key
+project_id :integer          not null
+name       :string(255)      not null
+created_at :datetime         not null
+updated_at :datetime         not null
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/service_hook_rb.html b/doc/code/files/app/models/service_hook_rb.html new file mode 100644 index 00000000000..7fa375a26eb --- /dev/null +++ b/doc/code/files/app/models/service_hook_rb.html @@ -0,0 +1,95 @@ + + + + + service_hook.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/service_rb.html b/doc/code/files/app/models/service_rb.html new file mode 100644 index 00000000000..47b0f7fca8f --- /dev/null +++ b/doc/code/files/app/models/service_rb.html @@ -0,0 +1,97 @@ + + + + + service.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: services

+ +
id          :integer          not null, primary key
+type        :string(255)
+title       :string(255)
+token       :string(255)
+project_id  :integer          not null
+created_at  :datetime         not null
+updated_at  :datetime         not null
+active      :boolean          default(FALSE), not null
+project_url :string(255)
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/snippet_rb.html b/doc/code/files/app/models/snippet_rb.html new file mode 100644 index 00000000000..96016354a1f --- /dev/null +++ b/doc/code/files/app/models/snippet_rb.html @@ -0,0 +1,97 @@ + + + + + snippet.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: snippets

+ +
id         :integer          not null, primary key
+title      :string(255)
+content    :text
+author_id  :integer          not null
+project_id :integer          not null
+created_at :datetime         not null
+updated_at :datetime         not null
+file_name  :string(255)
+expires_at :datetime
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/system_hook_rb.html b/doc/code/files/app/models/system_hook_rb.html new file mode 100644 index 00000000000..edccffd9adb --- /dev/null +++ b/doc/code/files/app/models/system_hook_rb.html @@ -0,0 +1,95 @@ + + + + + system_hook.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/tree_rb.html b/doc/code/files/app/models/tree_rb.html new file mode 100644 index 00000000000..89ca7611f15 --- /dev/null +++ b/doc/code/files/app/models/tree_rb.html @@ -0,0 +1,79 @@ + + + + + tree.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Tree +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/user_rb.html b/doc/code/files/app/models/user_rb.html new file mode 100644 index 00000000000..18a35e06b1e --- /dev/null +++ b/doc/code/files/app/models/user_rb.html @@ -0,0 +1,117 @@ + + + + + user.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: users

+ +
id                     :integer          not null, primary key
+email                  :string(255)      default(""), not null
+encrypted_password     :string(255)      default(""), not null
+reset_password_token   :string(255)
+reset_password_sent_at :datetime
+remember_created_at    :datetime
+sign_in_count          :integer          default(0)
+current_sign_in_at     :datetime
+last_sign_in_at        :datetime
+current_sign_in_ip     :string(255)
+last_sign_in_ip        :string(255)
+created_at             :datetime         not null
+updated_at             :datetime         not null
+name                   :string(255)
+admin                  :boolean          default(FALSE), not null
+projects_limit         :integer          default(10)
+skype                  :string(255)      default(""), not null
+linkedin               :string(255)      default(""), not null
+twitter                :string(255)      default(""), not null
+authentication_token   :string(255)
+dark_scheme            :boolean          default(FALSE), not null
+theme_id               :integer          default(1), not null
+bio                    :string(255)
+blocked                :boolean          default(FALSE), not null
+failed_attempts        :integer          default(0)
+locked_at              :datetime
+extern_uid             :string(255)
+provider               :string(255)
+username               :string(255)
+ +
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + CLASS + User +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/users_project_rb.html b/doc/code/files/app/models/users_project_rb.html new file mode 100644 index 00000000000..072ae9050d9 --- /dev/null +++ b/doc/code/files/app/models/users_project_rb.html @@ -0,0 +1,94 @@ + + + + + users_project.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: users_projects

+ +
id             :integer          not null, primary key
+user_id        :integer          not null
+project_id     :integer          not null
+created_at     :datetime         not null
+updated_at     :datetime         not null
+project_access :integer          default(0), not null
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/web_hook_rb.html b/doc/code/files/app/models/web_hook_rb.html new file mode 100644 index 00000000000..0fc974233dc --- /dev/null +++ b/doc/code/files/app/models/web_hook_rb.html @@ -0,0 +1,95 @@ + + + + + web_hook.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: web_hooks

+ +
id         :integer          not null, primary key
+url        :string(255)
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+type       :string(255)      default("ProjectHook")
+service_id :integer
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/models/wiki_rb.html b/doc/code/files/app/models/wiki_rb.html new file mode 100644 index 00000000000..57d5a2a2498 --- /dev/null +++ b/doc/code/files/app/models/wiki_rb.html @@ -0,0 +1,96 @@ + + + + + wiki.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Schema Information

+ +

Table name: wikis

+ +
id         :integer          not null, primary key
+title      :string(255)
+content    :text
+project_id :integer
+created_at :datetime         not null
+updated_at :datetime         not null
+slug       :string(255)
+user_id    :integer
+ +
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + CLASS + Wiki +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/activity_observer_rb.html b/doc/code/files/app/observers/activity_observer_rb.html new file mode 100644 index 00000000000..2a78e1ab520 --- /dev/null +++ b/doc/code/files/app/observers/activity_observer_rb.html @@ -0,0 +1,79 @@ + + + + + activity_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/issue_observer_rb.html b/doc/code/files/app/observers/issue_observer_rb.html new file mode 100644 index 00000000000..7f373bac24c --- /dev/null +++ b/doc/code/files/app/observers/issue_observer_rb.html @@ -0,0 +1,79 @@ + + + + + issue_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/key_observer_rb.html b/doc/code/files/app/observers/key_observer_rb.html new file mode 100644 index 00000000000..9834dfc4cb2 --- /dev/null +++ b/doc/code/files/app/observers/key_observer_rb.html @@ -0,0 +1,79 @@ + + + + + key_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/merge_request_observer_rb.html b/doc/code/files/app/observers/merge_request_observer_rb.html new file mode 100644 index 00000000000..5b779474b42 --- /dev/null +++ b/doc/code/files/app/observers/merge_request_observer_rb.html @@ -0,0 +1,79 @@ + + + + + merge_request_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/note_observer_rb.html b/doc/code/files/app/observers/note_observer_rb.html new file mode 100644 index 00000000000..e5a0e03cc39 --- /dev/null +++ b/doc/code/files/app/observers/note_observer_rb.html @@ -0,0 +1,79 @@ + + + + + note_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/project_observer_rb.html b/doc/code/files/app/observers/project_observer_rb.html new file mode 100644 index 00000000000..0a4b2b511c0 --- /dev/null +++ b/doc/code/files/app/observers/project_observer_rb.html @@ -0,0 +1,79 @@ + + + + + project_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/system_hook_observer_rb.html b/doc/code/files/app/observers/system_hook_observer_rb.html new file mode 100644 index 00000000000..53e351efe7b --- /dev/null +++ b/doc/code/files/app/observers/system_hook_observer_rb.html @@ -0,0 +1,79 @@ + + + + + system_hook_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/user_observer_rb.html b/doc/code/files/app/observers/user_observer_rb.html new file mode 100644 index 00000000000..d17f24099d3 --- /dev/null +++ b/doc/code/files/app/observers/user_observer_rb.html @@ -0,0 +1,79 @@ + + + + + user_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/observers/users_project_observer_rb.html b/doc/code/files/app/observers/users_project_observer_rb.html new file mode 100644 index 00000000000..e427fc5b7dc --- /dev/null +++ b/doc/code/files/app/observers/users_project_observer_rb.html @@ -0,0 +1,79 @@ + + + + + users_project_observer.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/account_rb.html b/doc/code/files/app/roles/account_rb.html new file mode 100644 index 00000000000..9d8821be487 --- /dev/null +++ b/doc/code/files/app/roles/account_rb.html @@ -0,0 +1,79 @@ + + + + + account.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/authority_rb.html b/doc/code/files/app/roles/authority_rb.html new file mode 100644 index 00000000000..d6d0437d900 --- /dev/null +++ b/doc/code/files/app/roles/authority_rb.html @@ -0,0 +1,79 @@ + + + + + authority.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/git_host_rb.html b/doc/code/files/app/roles/git_host_rb.html new file mode 100644 index 00000000000..5a878fc0d69 --- /dev/null +++ b/doc/code/files/app/roles/git_host_rb.html @@ -0,0 +1,79 @@ + + + + + git_host.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/issue_commonality_rb.html b/doc/code/files/app/roles/issue_commonality_rb.html new file mode 100644 index 00000000000..bb7879143e6 --- /dev/null +++ b/doc/code/files/app/roles/issue_commonality_rb.html @@ -0,0 +1,90 @@ + + + + + issue_commonality.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Contains common functionality shared between Issues and MergeRequests

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/namespaced_project_rb.html b/doc/code/files/app/roles/namespaced_project_rb.html new file mode 100644 index 00000000000..d15014b9a6b --- /dev/null +++ b/doc/code/files/app/roles/namespaced_project_rb.html @@ -0,0 +1,79 @@ + + + + + namespaced_project.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/note_event_rb.html b/doc/code/files/app/roles/note_event_rb.html new file mode 100644 index 00000000000..a32a7c94634 --- /dev/null +++ b/doc/code/files/app/roles/note_event_rb.html @@ -0,0 +1,79 @@ + + + + + note_event.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/push_event_rb.html b/doc/code/files/app/roles/push_event_rb.html new file mode 100644 index 00000000000..6b0d320d3a2 --- /dev/null +++ b/doc/code/files/app/roles/push_event_rb.html @@ -0,0 +1,79 @@ + + + + + push_event.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/push_observer_rb.html b/doc/code/files/app/roles/push_observer_rb.html new file mode 100644 index 00000000000..62203df10b8 --- /dev/null +++ b/doc/code/files/app/roles/push_observer_rb.html @@ -0,0 +1,88 @@ + + + + + push_observer.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Includes methods for handling Git Push events

+ +

Triggered by PostReceive +job

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/repository_rb.html b/doc/code/files/app/roles/repository_rb.html new file mode 100644 index 00000000000..f9a847d68c7 --- /dev/null +++ b/doc/code/files/app/roles/repository_rb.html @@ -0,0 +1,79 @@ + + + + + repository.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/static_model_rb.html b/doc/code/files/app/roles/static_model_rb.html new file mode 100644 index 00000000000..c2355819c5b --- /dev/null +++ b/doc/code/files/app/roles/static_model_rb.html @@ -0,0 +1,91 @@ + + + + + static_model.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Provides an ActiveRecord-like interface to a model whose data is not +persisted to a database.

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/team_rb.html b/doc/code/files/app/roles/team_rb.html new file mode 100644 index 00000000000..5517f98dcee --- /dev/null +++ b/doc/code/files/app/roles/team_rb.html @@ -0,0 +1,79 @@ + + + + + team.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + MODULE + Team +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/roles/votes_rb.html b/doc/code/files/app/roles/votes_rb.html new file mode 100644 index 00000000000..a11bf5069fb --- /dev/null +++ b/doc/code/files/app/roles/votes_rb.html @@ -0,0 +1,79 @@ + + + + + votes.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+
    + +
  • + MODULE + Votes +
  • + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/uploaders/attachment_uploader_rb.html b/doc/code/files/app/uploaders/attachment_uploader_rb.html new file mode 100644 index 00000000000..27680fa158e --- /dev/null +++ b/doc/code/files/app/uploaders/attachment_uploader_rb.html @@ -0,0 +1,79 @@ + + + + + attachment_uploader.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/workers/post_receive_rb.html b/doc/code/files/app/workers/post_receive_rb.html new file mode 100644 index 00000000000..fd4e73bfd37 --- /dev/null +++ b/doc/code/files/app/workers/post_receive_rb.html @@ -0,0 +1,79 @@ + + + + + post_receive.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/app/workers/system_hook_worker_rb.html b/doc/code/files/app/workers/system_hook_worker_rb.html new file mode 100644 index 00000000000..e62abde0089 --- /dev/null +++ b/doc/code/files/app/workers/system_hook_worker_rb.html @@ -0,0 +1,79 @@ + + + + + system_hook_worker.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/application_rb.html b/doc/code/files/config/application_rb.html new file mode 100644 index 00000000000..385b7b2f040 --- /dev/null +++ b/doc/code/files/config/application_rb.html @@ -0,0 +1,92 @@ + + + + + application.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • rails/all
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/boot_rb.html b/doc/code/files/config/boot_rb.html new file mode 100644 index 00000000000..94a4a723a71 --- /dev/null +++ b/doc/code/files/config/boot_rb.html @@ -0,0 +1,78 @@ + + + + + boot.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • rubygems
  • + +
  • bundler/setup
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/environment_rb.html b/doc/code/files/config/environment_rb.html new file mode 100644 index 00000000000..2085b87ab11 --- /dev/null +++ b/doc/code/files/config/environment_rb.html @@ -0,0 +1,74 @@ + + + + + environment.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Load the rails application

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/environments/development_rb.html b/doc/code/files/config/environments/development_rb.html new file mode 100644 index 00000000000..392c8250928 --- /dev/null +++ b/doc/code/files/config/environments/development_rb.html @@ -0,0 +1,68 @@ + + + + + development.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/environments/production_rb.html b/doc/code/files/config/environments/production_rb.html new file mode 100644 index 00000000000..6911c7235d0 --- /dev/null +++ b/doc/code/files/config/environments/production_rb.html @@ -0,0 +1,68 @@ + + + + + production.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/environments/test_rb.html b/doc/code/files/config/environments/test_rb.html new file mode 100644 index 00000000000..cfd579333f0 --- /dev/null +++ b/doc/code/files/config/environments/test_rb.html @@ -0,0 +1,68 @@ + + + + + test.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/1_settings_rb.html b/doc/code/files/config/initializers/1_settings_rb.html new file mode 100644 index 00000000000..3e007ff6dd7 --- /dev/null +++ b/doc/code/files/config/initializers/1_settings_rb.html @@ -0,0 +1,79 @@ + + + + + 1_settings.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/2_app_rb.html b/doc/code/files/config/initializers/2_app_rb.html new file mode 100644 index 00000000000..de791415700 --- /dev/null +++ b/doc/code/files/config/initializers/2_app_rb.html @@ -0,0 +1,79 @@ + + + + + 2_app.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/3_grit_ext_rb.html b/doc/code/files/config/initializers/3_grit_ext_rb.html new file mode 100644 index 00000000000..6b42df4cf47 --- /dev/null +++ b/doc/code/files/config/initializers/3_grit_ext_rb.html @@ -0,0 +1,78 @@ + + + + + 3_grit_ext.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • grit
  • + +
  • pygments
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/4_resque_rb.html b/doc/code/files/config/initializers/4_resque_rb.html new file mode 100644 index 00000000000..a96dd91f4ad --- /dev/null +++ b/doc/code/files/config/initializers/4_resque_rb.html @@ -0,0 +1,93 @@ + + + + + 4_resque.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Custom Redis configuration

+ +
+ + + + + +
Required Files
+
    + +
  • resque/server
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/5_backend_rb.html b/doc/code/files/config/initializers/5_backend_rb.html new file mode 100644 index 00000000000..caaaf0dbb02 --- /dev/null +++ b/doc/code/files/config/initializers/5_backend_rb.html @@ -0,0 +1,74 @@ + + + + + 5_backend.rb + + + + + + + + + + + + + + +
+
+ +
+ +

GIT over HTTP

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/backtrace_silencers_rb.html b/doc/code/files/config/initializers/backtrace_silencers_rb.html new file mode 100644 index 00000000000..65215d384d1 --- /dev/null +++ b/doc/code/files/config/initializers/backtrace_silencers_rb.html @@ -0,0 +1,74 @@ + + + + + backtrace_silencers.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Be sure to restart your server when you modify this file.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/carrierwave_rb.html b/doc/code/files/config/initializers/carrierwave_rb.html new file mode 100644 index 00000000000..88aa2eece39 --- /dev/null +++ b/doc/code/files/config/initializers/carrierwave_rb.html @@ -0,0 +1,68 @@ + + + + + carrierwave.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/connection_fix_rb.html b/doc/code/files/config/initializers/connection_fix_rb.html new file mode 100644 index 00000000000..936db6d6f18 --- /dev/null +++ b/doc/code/files/config/initializers/connection_fix_rb.html @@ -0,0 +1,103 @@ + + + + + connection_fix.rb + + + + + + + + + + + + + + +
+
+ +
+ +

from gist.github.com/238999

+ +

If your workers are inactive for a long period of time, they’ll lose their +MySQL connection.

+ +

This hack ensures we re-connect whenever a connection is lost. Because, +really. why not?

+ +

Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or +somewhere similar)

+ +

From:

+ +
http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/devise_rb.html b/doc/code/files/config/initializers/devise_rb.html new file mode 100644 index 00000000000..596c954eb84 --- /dev/null +++ b/doc/code/files/config/initializers/devise_rb.html @@ -0,0 +1,83 @@ + + + + + devise.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Use this hook to configure devise mailer, warden hooks and so forth. The +first four configuration values can also be set straight in your models.

+ +
+ + + + + +
Required Files
+
    + +
  • devise/orm/active_record
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/gemoji_rb.html b/doc/code/files/config/initializers/gemoji_rb.html new file mode 100644 index 00000000000..0a015fb70bc --- /dev/null +++ b/doc/code/files/config/initializers/gemoji_rb.html @@ -0,0 +1,75 @@ + + + + + gemoji.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Workaround for github.com/github/gemoji/pull/18

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/inflections_rb.html b/doc/code/files/config/initializers/inflections_rb.html new file mode 100644 index 00000000000..7e3e29a5fbb --- /dev/null +++ b/doc/code/files/config/initializers/inflections_rb.html @@ -0,0 +1,74 @@ + + + + + inflections.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Be sure to restart your server when you modify this file.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/kaminari_config_rb.html b/doc/code/files/config/initializers/kaminari_config_rb.html new file mode 100644 index 00000000000..6160d25e74c --- /dev/null +++ b/doc/code/files/config/initializers/kaminari_config_rb.html @@ -0,0 +1,68 @@ + + + + + kaminari_config.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/mime_types_rb.html b/doc/code/files/config/initializers/mime_types_rb.html new file mode 100644 index 00000000000..5853380f95e --- /dev/null +++ b/doc/code/files/config/initializers/mime_types_rb.html @@ -0,0 +1,74 @@ + + + + + mime_types.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Be sure to restart your server when you modify this file.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/passenger_fix_rb.html b/doc/code/files/config/initializers/passenger_fix_rb.html new file mode 100644 index 00000000000..de812d9334d --- /dev/null +++ b/doc/code/files/config/initializers/passenger_fix_rb.html @@ -0,0 +1,68 @@ + + + + + passenger_fix.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/postgresql_limit_fix_rb.html b/doc/code/files/config/initializers/postgresql_limit_fix_rb.html new file mode 100644 index 00000000000..e205ecf04c8 --- /dev/null +++ b/doc/code/files/config/initializers/postgresql_limit_fix_rb.html @@ -0,0 +1,84 @@ + + + + + postgresql_limit_fix.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/secret_token_rb.html b/doc/code/files/config/initializers/secret_token_rb.html new file mode 100644 index 00000000000..8e4ed070925 --- /dev/null +++ b/doc/code/files/config/initializers/secret_token_rb.html @@ -0,0 +1,74 @@ + + + + + secret_token.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Be sure to restart your server when you modify this file.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/session_store_rb.html b/doc/code/files/config/initializers/session_store_rb.html new file mode 100644 index 00000000000..7105222d301 --- /dev/null +++ b/doc/code/files/config/initializers/session_store_rb.html @@ -0,0 +1,74 @@ + + + + + session_store.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Be sure to restart your server when you modify this file.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/initializers/wrap_parameters_rb.html b/doc/code/files/config/initializers/wrap_parameters_rb.html new file mode 100644 index 00000000000..704f6f0235e --- /dev/null +++ b/doc/code/files/config/initializers/wrap_parameters_rb.html @@ -0,0 +1,77 @@ + + + + + wrap_parameters.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Be sure to restart your server when you modify this file.

+ +

This file contains settings for ActionController::ParamsWrapper which is +enabled by default.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/routes_rb.html b/doc/code/files/config/routes_rb.html new file mode 100644 index 00000000000..df59e4d7aab --- /dev/null +++ b/doc/code/files/config/routes_rb.html @@ -0,0 +1,78 @@ + + + + + routes.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • api
  • + +
  • resque/server
  • + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/config/unicorn_rb.html b/doc/code/files/config/unicorn_rb.html new file mode 100644 index 00000000000..14da5f0ebfe --- /dev/null +++ b/doc/code/files/config/unicorn_rb.html @@ -0,0 +1,68 @@ + + + + + unicorn.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/entities_rb.html b/doc/code/files/lib/api/entities_rb.html new file mode 100644 index 00000000000..da20f2d3bf0 --- /dev/null +++ b/doc/code/files/lib/api/entities_rb.html @@ -0,0 +1,159 @@ + + + + + entities.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/helpers_rb.html b/doc/code/files/lib/api/helpers_rb.html new file mode 100644 index 00000000000..e8d05b928ee --- /dev/null +++ b/doc/code/files/lib/api/helpers_rb.html @@ -0,0 +1,84 @@ + + + + + helpers.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/issues_rb.html b/doc/code/files/lib/api/issues_rb.html new file mode 100644 index 00000000000..5aac1d3f7ce --- /dev/null +++ b/doc/code/files/lib/api/issues_rb.html @@ -0,0 +1,84 @@ + + + + + issues.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/merge_requests_rb.html b/doc/code/files/lib/api/merge_requests_rb.html new file mode 100644 index 00000000000..3fdcf008483 --- /dev/null +++ b/doc/code/files/lib/api/merge_requests_rb.html @@ -0,0 +1,84 @@ + + + + + merge_requests.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/milestones_rb.html b/doc/code/files/lib/api/milestones_rb.html new file mode 100644 index 00000000000..a37be49c9b3 --- /dev/null +++ b/doc/code/files/lib/api/milestones_rb.html @@ -0,0 +1,84 @@ + + + + + milestones.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/notes_rb.html b/doc/code/files/lib/api/notes_rb.html new file mode 100644 index 00000000000..3c540290b57 --- /dev/null +++ b/doc/code/files/lib/api/notes_rb.html @@ -0,0 +1,84 @@ + + + + + notes.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/projects_rb.html b/doc/code/files/lib/api/projects_rb.html new file mode 100644 index 00000000000..70af8a34824 --- /dev/null +++ b/doc/code/files/lib/api/projects_rb.html @@ -0,0 +1,84 @@ + + + + + projects.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/session_rb.html b/doc/code/files/lib/api/session_rb.html new file mode 100644 index 00000000000..8faa1a53165 --- /dev/null +++ b/doc/code/files/lib/api/session_rb.html @@ -0,0 +1,84 @@ + + + + + session.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api/users_rb.html b/doc/code/files/lib/api/users_rb.html new file mode 100644 index 00000000000..7bf16c733f0 --- /dev/null +++ b/doc/code/files/lib/api/users_rb.html @@ -0,0 +1,84 @@ + + + + + users.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/api_rb.html b/doc/code/files/lib/api_rb.html new file mode 100644 index 00000000000..48b1b65c0ba --- /dev/null +++ b/doc/code/files/lib/api_rb.html @@ -0,0 +1,84 @@ + + + + + api.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/event_filter_rb.html b/doc/code/files/lib/event_filter_rb.html new file mode 100644 index 00000000000..7f54400a4ce --- /dev/null +++ b/doc/code/files/lib/event_filter_rb.html @@ -0,0 +1,79 @@ + + + + + event_filter.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/extracts_path_rb.html b/doc/code/files/lib/extracts_path_rb.html new file mode 100644 index 00000000000..11a0dd2d999 --- /dev/null +++ b/doc/code/files/lib/extracts_path_rb.html @@ -0,0 +1,91 @@ + + + + + extracts_path.rb + + + + + + + + + + + + + + +
+
+ +
+ +

Module providing methods for dealing with separating a tree-ish string and +a file path string when combined in a request parameter

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/file_size_validator_rb.html b/doc/code/files/lib/file_size_validator_rb.html new file mode 100644 index 00000000000..985c23a5628 --- /dev/null +++ b/doc/code/files/lib/file_size_validator_rb.html @@ -0,0 +1,84 @@ + + + + + file_size_validator.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/app_logger_rb.html b/doc/code/files/lib/gitlab/app_logger_rb.html new file mode 100644 index 00000000000..c53c4e86e52 --- /dev/null +++ b/doc/code/files/lib/gitlab/app_logger_rb.html @@ -0,0 +1,84 @@ + + + + + app_logger.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/auth_rb.html b/doc/code/files/lib/gitlab/auth_rb.html new file mode 100644 index 00000000000..651a1268e28 --- /dev/null +++ b/doc/code/files/lib/gitlab/auth_rb.html @@ -0,0 +1,84 @@ + + + + + auth.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/backend/gitolite_config_rb.html b/doc/code/files/lib/gitlab/backend/gitolite_config_rb.html new file mode 100644 index 00000000000..b66613c3cd2 --- /dev/null +++ b/doc/code/files/lib/gitlab/backend/gitolite_config_rb.html @@ -0,0 +1,106 @@ + + + + + gitolite_config.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • gitolite
  • + +
  • timeout
  • + +
  • fileutils
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/backend/gitolite_rb.html b/doc/code/files/lib/gitlab/backend/gitolite_rb.html new file mode 100644 index 00000000000..d1743456a94 --- /dev/null +++ b/doc/code/files/lib/gitlab/backend/gitolite_rb.html @@ -0,0 +1,89 @@ + + + + + gitolite.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/backend/grack_auth_rb.html b/doc/code/files/lib/gitlab/backend/grack_auth_rb.html new file mode 100644 index 00000000000..db7541dd7c6 --- /dev/null +++ b/doc/code/files/lib/gitlab/backend/grack_auth_rb.html @@ -0,0 +1,84 @@ + + + + + grack_auth.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/git_logger_rb.html b/doc/code/files/lib/gitlab/git_logger_rb.html new file mode 100644 index 00000000000..0e8e013f85f --- /dev/null +++ b/doc/code/files/lib/gitlab/git_logger_rb.html @@ -0,0 +1,84 @@ + + + + + git_logger.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/git_stats_rb.html b/doc/code/files/lib/gitlab/git_stats_rb.html new file mode 100644 index 00000000000..405a2c755ec --- /dev/null +++ b/doc/code/files/lib/gitlab/git_stats_rb.html @@ -0,0 +1,84 @@ + + + + + git_stats.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/graph/commit_rb.html b/doc/code/files/lib/gitlab/graph/commit_rb.html new file mode 100644 index 00000000000..1df6b794deb --- /dev/null +++ b/doc/code/files/lib/gitlab/graph/commit_rb.html @@ -0,0 +1,97 @@ + + + + + commit.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • grit
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/graph/json_builder_rb.html b/doc/code/files/lib/gitlab/graph/json_builder_rb.html new file mode 100644 index 00000000000..848bb0a12eb --- /dev/null +++ b/doc/code/files/lib/gitlab/graph/json_builder_rb.html @@ -0,0 +1,97 @@ + + + + + json_builder.rb + + + + + + + + + + + + + + +
+
+ + + + + +
Required Files
+
    + +
  • grit
  • + +
+ + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/inline_diff_rb.html b/doc/code/files/lib/gitlab/inline_diff_rb.html new file mode 100644 index 00000000000..708dcefc974 --- /dev/null +++ b/doc/code/files/lib/gitlab/inline_diff_rb.html @@ -0,0 +1,84 @@ + + + + + inline_diff.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/logger_rb.html b/doc/code/files/lib/gitlab/logger_rb.html new file mode 100644 index 00000000000..8924ca8a170 --- /dev/null +++ b/doc/code/files/lib/gitlab/logger_rb.html @@ -0,0 +1,84 @@ + + + + + logger.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/markdown_rb.html b/doc/code/files/lib/gitlab/markdown_rb.html new file mode 100644 index 00000000000..bd5f5e2ec92 --- /dev/null +++ b/doc/code/files/lib/gitlab/markdown_rb.html @@ -0,0 +1,84 @@ + + + + + markdown.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/project_mover_rb.html b/doc/code/files/lib/gitlab/project_mover_rb.html new file mode 100644 index 00000000000..6acee13f91c --- /dev/null +++ b/doc/code/files/lib/gitlab/project_mover_rb.html @@ -0,0 +1,97 @@ + + + + + project_mover.rb + + + + + + + + + + + + + + +
+
+ +
+ +

ProjectMover class

+ +

Used for moving project repositories from one subdir to another

+ +
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/regex_rb.html b/doc/code/files/lib/gitlab/regex_rb.html new file mode 100644 index 00000000000..dfdab455fef --- /dev/null +++ b/doc/code/files/lib/gitlab/regex_rb.html @@ -0,0 +1,84 @@ + + + + + regex.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/satellite/action_rb.html b/doc/code/files/lib/gitlab/satellite/action_rb.html new file mode 100644 index 00000000000..3c1e84487b7 --- /dev/null +++ b/doc/code/files/lib/gitlab/satellite/action_rb.html @@ -0,0 +1,89 @@ + + + + + action.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/satellite/edit_file_action_rb.html b/doc/code/files/lib/gitlab/satellite/edit_file_action_rb.html new file mode 100644 index 00000000000..e4a473ec76c --- /dev/null +++ b/doc/code/files/lib/gitlab/satellite/edit_file_action_rb.html @@ -0,0 +1,89 @@ + + + + + edit_file_action.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/satellite/merge_action_rb.html b/doc/code/files/lib/gitlab/satellite/merge_action_rb.html new file mode 100644 index 00000000000..6bbc8483203 --- /dev/null +++ b/doc/code/files/lib/gitlab/satellite/merge_action_rb.html @@ -0,0 +1,89 @@ + + + + + merge_action.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/satellite/satellite_rb.html b/doc/code/files/lib/gitlab/satellite/satellite_rb.html new file mode 100644 index 00000000000..54c513f7d6f --- /dev/null +++ b/doc/code/files/lib/gitlab/satellite/satellite_rb.html @@ -0,0 +1,89 @@ + + + + + satellite.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/seeder_rb.html b/doc/code/files/lib/gitlab/seeder_rb.html new file mode 100644 index 00000000000..f02fde65f84 --- /dev/null +++ b/doc/code/files/lib/gitlab/seeder_rb.html @@ -0,0 +1,84 @@ + + + + + seeder.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/gitlab/theme_rb.html b/doc/code/files/lib/gitlab/theme_rb.html new file mode 100644 index 00000000000..97dccfd7110 --- /dev/null +++ b/doc/code/files/lib/gitlab/theme_rb.html @@ -0,0 +1,84 @@ + + + + + theme.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/hooks/post-receive.html b/doc/code/files/lib/hooks/post-receive.html new file mode 100644 index 00000000000..a99c19fac17 --- /dev/null +++ b/doc/code/files/lib/hooks/post-receive.html @@ -0,0 +1,86 @@ + + + + + post-receive + + + + + + + + + + + + + + +
+
+ +
+ +

#!/usr/bin/env bash

+ +

# This file was placed here by GitLab. It makes sure that your pushed +commits # will be processed properly.

+ +

while read oldrev newrev ref do

+ +
# For every branch or tag that was pushed, create a Resque job in redis.
+repo_path=%xpwd`
+env -i redis-cli rpush "resque:gitlab:queue:post_receive" "{\"class\":\"PostReceive\",\"args\":[\"$repo_path\",\"$oldrev\",\"$newrev\",\"$ref\",\"$GL_USER\"]}" > %rdev/ull 2>&1
+
+ +

done

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/files/lib/redcarpet/render/gitlab_html_rb.html b/doc/code/files/lib/redcarpet/render/gitlab_html_rb.html new file mode 100644 index 00000000000..33bb541b3a2 --- /dev/null +++ b/doc/code/files/lib/redcarpet/render/gitlab_html_rb.html @@ -0,0 +1,79 @@ + + + + + gitlab_html.rb + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
Namespace
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/doc/code/i/arrows.png b/doc/code/i/arrows.png new file mode 100755 index 00000000000..e54060f44ce Binary files /dev/null and b/doc/code/i/arrows.png differ diff --git a/doc/code/i/results_bg.png b/doc/code/i/results_bg.png new file mode 100755 index 00000000000..199ba692349 Binary files /dev/null and b/doc/code/i/results_bg.png differ diff --git a/doc/code/i/tree_bg.png b/doc/code/i/tree_bg.png new file mode 100755 index 00000000000..7d236633d72 Binary files /dev/null and b/doc/code/i/tree_bg.png differ diff --git a/doc/code/index.html b/doc/code/index.html new file mode 100644 index 00000000000..c7011386dd7 --- /dev/null +++ b/doc/code/index.html @@ -0,0 +1,13 @@ + + + + + RDoc Documentation + + + + + + diff --git a/doc/code/js/highlight.pack.js b/doc/code/js/highlight.pack.js new file mode 100755 index 00000000000..01b59273464 --- /dev/null +++ b/doc/code/js/highlight.pack.js @@ -0,0 +1 @@ +var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/"}while(x.length||y.length){var u=t().splice(0,1)[0];v+=l(w.substr(q,u.offset-q));q=u.offset;if(u.event=="start"){v+=r(u.node);s.push(u.node)}else{if(u.event=="stop"){var p=s.length;do{p--;var o=s[p];v+=("")}while(o!=u.node);s.splice(p,1);while(p'+l(K[0])+""}else{M+=l(K[0])}O=N.lR.lastIndex;K=N.lR.exec(L)}M+=l(L.substr(O,L.length-O));return M}function J(r,L){if(L.sL&&d[L.sL]){var K=f(L.sL,r);s+=K.keyword_count;return K.value}else{return E(r,L)}}function H(L,r){var K=L.cN?'':"";if(L.rB){p+=K;L.buffer=""}else{if(L.eB){p+=l(r)+K;L.buffer=""}else{p+=K;L.buffer=r}}B.push(L);A+=L.r}function D(N,K,P){var Q=B[B.length-1];if(P){p+=J(Q.buffer+N,Q);return false}var L=y(K,Q);if(L){p+=J(Q.buffer+N,Q);H(L,K);return L.rB}var r=v(B.length-1,K);if(r){var M=Q.cN?"":"";if(Q.rE){p+=J(Q.buffer+N,Q)+M}else{if(Q.eE){p+=J(Q.buffer+N,Q)+M+l(K)}else{p+=J(Q.buffer+N+K,Q)+M}}while(r>1){M=B[B.length-2].cN?"":"";p+=M;r--;B.length--}var O=B[B.length-1];B.length--;B[B.length-1].buffer="";if(O.starts){H(O.starts,"")}return Q.rE}if(w(K,Q)){throw"Illegal"}}var G=d[I];var B=[G.dM];var A=0;var s=0;var p="";try{var u=0;G.dM.buffer="";do{var x=q(C,u);var t=D(x[0],x[1],x[2]);u+=x[0].length;if(!t){u+=x[1].length}}while(!x[2]);if(B.length>1){throw"Illegal"}return{language:I,r:A,keyword_count:s,value:p}}catch(F){if(F=="Illegal"){return{language:null,r:0,keyword_count:0,value:l(C)}}else{throw F}}}function h(){function o(t,s,u){if(t.compiled){return}if(!u){t.bR=c(s,t.b?t.b:"\\B|\\b");if(!t.e&&!t.eW){t.e="\\B|\\b"}if(t.e){t.eR=c(s,t.e)}}if(t.i){t.iR=c(s,t.i)}if(t.r==undefined){t.r=1}if(t.k){t.lR=c(s,t.l||hljs.IR,true)}for(var r in t.k){if(!t.k.hasOwnProperty(r)){continue}if(t.k[r] instanceof Object){t.kG=t.k}else{t.kG={keyword:t.k}}break}if(!t.c){t.c=[]}t.compiled=true;for(var q=0;qx.keyword_count+x.r){x=u}if(u.keyword_count+u.r>w.keyword_count+w.r){x=w;w=u}}}var s=t.className;if(!s.match(w.language)){s=s?(s+" "+w.language):w.language}var o=b(t);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=k(o,b(q),A)}if(y){w.value=w.value.replace(/^((<[^>]+>|\t)+)/gm,function(B,E,D,C){return E.replace(/\t/g,y)})}if(p){w.value=w.value.replace(/\n/g,"
")}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){var q=t.parentNode;var v=document.createElement("div");v.innerHTML="
"+w.value+"
";t=v.firstChild.firstChild;v.firstChild.cN=q.cN;q.parentNode.replaceChild(v.firstChild,q)}else{t.innerHTML=w.value}t.className=s;t.dataset={};t.dataset.result={language:w.language,kw:w.keyword_count,re:w.r};if(x&&x.language){t.dataset.second_best={language:x.language,kw:x.keyword_count,re:x.r}}}function j(){if(j.called){return}j.called=true;e();var q=document.getElementsByTagName("pre");for(var o=0;o|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(o,r){var q={};for(var p in o){q[p]=o[p]}if(r){for(var p in r){q[p]=r[p]}}return q}}();hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/.*?[^\\\\/]/[gim]*"}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@font-face",l:"[a-z-]+",k:{"font-face":1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"",rE:true,sL:"css"}},{cN:"tag",b:"",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.cpp=function(){var b={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};var a={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b.built_in,r:10};a.c=[a];return{dM:{k:b,i:")[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/doc/code/js/jquery-effect.js b/doc/code/js/jquery-effect.js new file mode 100755 index 00000000000..5b25307cc6d --- /dev/null +++ b/doc/code/js/jquery-effect.js @@ -0,0 +1,593 @@ +/* + * jQuery UI Effects 1.6rc6 + * + * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +;(function($) { + +$.effects = $.effects || {}; //Add the 'effects' scope + +$.extend($.effects, { + version: "1.6rc6", + + // Saves a set of properties in a data storage + save: function(element, set) { + for(var i=0; i < set.length; i++) { + if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); + } + }, + + // Restores a set of previously saved properties from a data storage + restore: function(element, set) { + for(var i=0; i < set.length; i++) { + if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); + } + }, + + setMode: function(el, mode) { + if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle + return mode; + }, + + getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value + // this should be a little more flexible in the future to handle a string & hash + var y, x; + switch (origin[0]) { + case 'top': y = 0; break; + case 'middle': y = 0.5; break; + case 'bottom': y = 1; break; + default: y = origin[0] / original.height; + }; + switch (origin[1]) { + case 'left': x = 0; break; + case 'center': x = 0.5; break; + case 'right': x = 1; break; + default: x = origin[1] / original.width; + }; + return {x: x, y: y}; + }, + + // Wraps the element around a wrapper that copies position properties + createWrapper: function(element) { + + //if the element is already wrapped, return it + if (element.parent().is('.ui-effects-wrapper')) + return element.parent(); + + //Cache width,height and float properties of the element, and create a wrapper around it + var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') }; + element.wrap('
'); + var wrapper = element.parent(); + + //Transfer the positioning of the element to the wrapper + if (element.css('position') == 'static') { + wrapper.css({ position: 'relative' }); + element.css({ position: 'relative'} ); + } else { + var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto'; + var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto'; + wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show(); + element.css({position: 'relative', top: 0, left: 0 }); + } + + wrapper.css(props); + return wrapper; + }, + + removeWrapper: function(element) { + if (element.parent().is('.ui-effects-wrapper')) + return element.parent().replaceWith(element); + return element; + }, + + setTransition: function(element, list, factor, value) { + value = value || {}; + $.each(list, function(i, x){ + unit = element.cssUnit(x); + if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; + }); + return value; + }, + + //Base function to animate from one class to another in a seamless transition + animateClass: function(value, duration, easing, callback) { + + var cb = (typeof easing == "function" ? easing : (callback ? callback : null)); + var ea = (typeof easing == "string" ? easing : null); + + return this.each(function() { + + var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || ''; + if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */ + if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; } + + //Let's get a style offset + var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle)); + if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove); + var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle)); + if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove); + + // The main function to form the object for animation + for(var n in newStyle) { + if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */ + && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */ + && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */ + && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */ + && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */ + ) offset[n] = newStyle[n]; + } + + that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object + // Change style attribute back to original. For stupid IE, we need to clear the damn object. + if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr); + if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove); + if(cb) cb.apply(this, arguments); + }); + + }); + } +}); + + +function _normalizeArguments(a, m) { + + var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m; + var speed = a[1] && a[1].constructor != Object ? a[1] : o.duration; //either comes from options.duration or the second argument + speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default; + var callback = o.callback || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] ); + + return [a[0], o, speed, callback]; + +} + +//Extend the methods of jQuery +$.fn.extend({ + + //Save old methods + _show: $.fn.show, + _hide: $.fn.hide, + __toggle: $.fn.toggle, + _addClass: $.fn.addClass, + _removeClass: $.fn.removeClass, + _toggleClass: $.fn.toggleClass, + + // New effect methods + effect: function(fx, options, speed, callback) { + return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null; + }, + + show: function() { + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) + return this._show.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'show')); + } + }, + + hide: function() { + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) + return this._hide.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'hide')); + } + }, + + toggle: function(){ + if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (arguments[0].constructor == Function)) + return this.__toggle.apply(this, arguments); + else { + return this.effect.apply(this, _normalizeArguments(arguments, 'toggle')); + } + }, + + addClass: function(classNames, speed, easing, callback) { + return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); + }, + removeClass: function(classNames,speed,easing,callback) { + return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); + }, + toggleClass: function(classNames,speed,easing,callback) { + return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed); + }, + morph: function(remove,add,speed,easing,callback) { + return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); + }, + switchClass: function() { + return this.morph.apply(this, arguments); + }, + + // helper functions + cssUnit: function(key) { + var style = this.css(key), val = []; + $.each( ['em','px','%','pt'], function(i, unit){ + if(style.indexOf(unit) > 0) + val = [parseFloat(style), unit]; + }); + return val; + } +}); + +/* + * jQuery Color Animations + * Copyright 2007 John Resig + * Released under the MIT and GPL licenses. + */ + +// We override the animation for all of these color styles +$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ + $.fx.step[attr] = function(fx) { + if ( fx.state == 0 ) { + fx.start = getColor( fx.elem, attr ); + fx.end = getRGB( fx.end ); + } + + fx.elem.style[attr] = "rgb(" + [ + Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0), + Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0) + ].join(",") + ")"; + }; +}); + +// Color Conversion functions from highlightFade +// By Blair Mitchelmore +// http://jquery.offput.ca/highlightFade/ + +// Parse strings looking for color tuples [255,255,255] +function getRGB(color) { + var result; + + // Check if we're already dealing with an array of colors + if ( color && color.constructor == Array && color.length == 3 ) + return color; + + // Look for rgb(num,num,num) + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) + return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + + // Look for rgb(num%,num%,num%) + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) + return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + + // Look for #a0b1c2 + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + + // Look for #fff + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + + // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) + return colors['transparent']; + + // Otherwise, we're most likely dealing with a named color + return colors[$.trim(color).toLowerCase()]; +} + +function getColor(elem, attr) { + var color; + + do { + color = $.curCSS(elem, attr); + + // Keep going until we find an element that has color, or we hit the body + if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) + break; + + attr = "backgroundColor"; + } while ( elem = elem.parentNode ); + + return getRGB(color); +}; + +// Some named colors to work with +// From Interface by Stefan Petre +// http://interface.eyecon.ro/ + +var colors = { + aqua:[0,255,255], + azure:[240,255,255], + beige:[245,245,220], + black:[0,0,0], + blue:[0,0,255], + brown:[165,42,42], + cyan:[0,255,255], + darkblue:[0,0,139], + darkcyan:[0,139,139], + darkgrey:[169,169,169], + darkgreen:[0,100,0], + darkkhaki:[189,183,107], + darkmagenta:[139,0,139], + darkolivegreen:[85,107,47], + darkorange:[255,140,0], + darkorchid:[153,50,204], + darkred:[139,0,0], + darksalmon:[233,150,122], + darkviolet:[148,0,211], + fuchsia:[255,0,255], + gold:[255,215,0], + green:[0,128,0], + indigo:[75,0,130], + khaki:[240,230,140], + lightblue:[173,216,230], + lightcyan:[224,255,255], + lightgreen:[144,238,144], + lightgrey:[211,211,211], + lightpink:[255,182,193], + lightyellow:[255,255,224], + lime:[0,255,0], + magenta:[255,0,255], + maroon:[128,0,0], + navy:[0,0,128], + olive:[128,128,0], + orange:[255,165,0], + pink:[255,192,203], + purple:[128,0,128], + violet:[128,0,128], + red:[255,0,0], + silver:[192,192,192], + white:[255,255,255], + yellow:[255,255,0], + transparent: [255,255,255] +}; + +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +$.easing.jswing = $.easing.swing; + +$.extend($.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert($.easing.default); + return $.easing[$.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +})(jQuery); + +/* + * jQuery UI Effects Highlight 1.6rc6 + * + * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ +(function($) { + +$.effects.highlight = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['backgroundImage','backgroundColor','opacity']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode + var color = o.options.color || "#ffff99"; // Default highlight color + var oldColor = el.css("backgroundColor"); + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + el.css({backgroundImage: 'none', backgroundColor: color}); // Shift + + // Animation + var animation = {backgroundColor: oldColor }; + if (mode == "hide") animation['opacity'] = 0; + + // Animate + el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { + if(mode == "hide") el.hide(); + $.effects.restore(el, props); + if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter'); + if(o.callback) o.callback.apply(this, arguments); + el.dequeue(); + }}); + + }); + +}; + +})(jQuery); \ No newline at end of file diff --git a/doc/code/js/main.js b/doc/code/js/main.js new file mode 100755 index 00000000000..859772b91d9 --- /dev/null +++ b/doc/code/js/main.js @@ -0,0 +1,24 @@ +function toggleSource(id) +{ + var src = $('#' + id).toggle(); + var isVisible = src.is(':visible'); + $('#l_' + id).html(isVisible ? 'hide' : 'show'); + if (!src.data('syntax-higlighted')) { + src.data('syntax-higlighted', 1); + hljs.highlightBlock(src[0]); + } +} + +window.highlight = function(url) { + var hash = url.match(/#([^#]+)$/) + if(hash) { + $('a[name=' + hash[1] + ']').parent().effect('highlight', {}, 'slow') + } +} + +$(function() { + highlight('#' + location.hash); + $('.description pre').each(function() { + hljs.highlightBlock(this); + }); +}); diff --git a/doc/app/js/navigation.js b/doc/code/js/navigation.js similarity index 100% rename from doc/app/js/navigation.js rename to doc/code/js/navigation.js diff --git a/doc/code/js/search_index.js b/doc/code/js/search_index.js new file mode 100644 index 00000000000..7fda2f97640 --- /dev/null +++ b/doc/code/js/search_index.js @@ -0,0 +1 @@ +var search_data = {"index":{"searchIndex":["ability","account","activityobserver","admin","dashboardcontroller","groupscontroller","hookscontroller","logscontroller","projectscontroller","resquecontroller","teammemberscontroller","userscontroller","admincontroller","applicationcontroller","applicationdecorator","applicationhelper","attachmentuploader","authority","basecontext","blamecontroller","blobcontroller","commit","commitcontroller","commitdecorator","commitloadcontext","commitscontroller","commitshelper","comparecontroller","dashboardcontroller","dashboardhelper","deploykeyscontroller","errorscontroller","event","eventdecorator","eventfilter","eventshelper","extractspath","invalidpatherror","filesizevalidator","helper","githost","gitlab","api","apihelpers","applogger","auth","entities","hook","issue","mrnote","mergerequest","milestone","note","project","projectmember","projectsnippet","repocommit","repoobject","sshkey","user","userbasic","userlogin","gitlogger","gitstats","gitolite","accessdenied","gitoliteconfig","pullerror","pusherror","graph","commit","jsonbuilder","inlinediff","issues","logger","markdown","mergerequests","milestones","notes","projectmover","projectmoveerror","projects","regex","satellite","action","editfileaction","mergeaction","satellite","seeder","session","theme","users","gitlabciservice","gitlabmarkdownhelper","grack","auth","group","groupscontroller","helpcontroller","hookscontroller","issue","issuecommonality","classmethods","issueobserver","issuesbulkupdatecontext","issuescontroller","issueshelper","issueslistcontext","key","keyobserver","keyscontroller","labelscontroller","mergerequest","mergerequestobserver","mergerequestscontroller","mergerequestshelper","mergerequestsloadcontext","milestone","milestonescontroller","namespace","namespacedproject","namespaceshelper","note","noteevent","noteobserver","notes","createcontext","loadcontext","notescontroller","noteshelper","notify","omniauthcallbackscontroller","postreceive","profilehelper","profilescontroller","project","transfererror","projecthook","projectobserver","projectresourcecontroller","projectupdatecontext","projectscontroller","projectshelper","protectedbranch","protectedbranchescontroller","pushevent","pushobserver","redcarpet","render","gitlabhtml","refscontroller","repositoriescontroller","repository","searchcontext","searchcontroller","service","servicehook","servicescontroller","snippet","snippetscontroller","snippetshelper","staticmodel","classmethods","systemhook","systemhookobserver","systemhookworker","tabhelper","tagshelper","team","teammemberscontroller","testhookcontext","tree","treecontroller","treedecorator","treehelper","user","userdecorator","userobserver","usersproject","usersprojectobserver","votes","webhook","wiki","wikiscontroller","==()","[]()","_indexes_of_changed_lines()","abilities()","abilities()","abilities()","abilities()","access_denied!()","access_options()","access_roles()","account()","action_name()","activated?()","active()","active?()","add_abilities()","add_access()","add_refs()","add_user_id_to_team()","add_user_to_team()","add_users_ids_to_team()","add_users_into_projects()","add_users_to_project_teams()","add_users_to_team()","admin_all_repo()","admin_all_repo!()","after_commit()","after_create()","after_create()","after_create()","after_create()","after_create()","after_create()","after_create()","after_create()","after_destroy()","after_destroy()","after_destroy()","after_destroy()","after_destroy()","after_save()","after_save()","after_save()","after_sign_in_path_for()","after_update()","after_update()","after_update()","all_hooks_fire()","allow_read_for?()","allowed()","allowed_tree_edit?()","app_theme()","apply()","apply_filter()","apply_import()","archive()","archive_repo()","assign_ref_vars()","async_execute()","attributes_for_keys()","authbutton()","authenticate!()","authenticate_admin!()","authenticated_as_admin!()","author()","author_email()","author_id()","author_link()","author_name()","authorize!()","authorize_admin_issue!()","authorize_admin_merge_request!()","authorize_admin_milestone!()","authorize_admin_snippet!()","authorize_code_access!()","authorize_modify_issue!()","authorize_modify_merge_request!()","authorize_modify_snippet!()","authorize_project!()","authorize_read_group!()","authorized_for()","authorized_groups()","authorized_projects()","authors()","authors_count()","automerge()","automerge!()","automerge_check()","avatar_image()","base_class()","base_space()","block()","block()","block_code()","branch?()","branch_from()","branch_name()","branch_names()","branch_to()","branches()","branches()","branches_tab_class()","breadcrumbs()","breadcrumbs()","broken_diffs?()","build()","build_commit_note()","build_graph()","build_line_anchor()","build_page()","bulk_delete()","bulk_import()","bulk_update()","bulk_update()","can?()","can?()","can?()","can?()","can?()","can_be_closed?()","can_be_merged?()","can_be_merged?()","can_create_group?()","can_create_project?()","can_edit?()","cared_merge_requests()","changed_issue?()","changed_merge_request?()","check_if_can_be_merged()","check_limit()","check_validity!()","chief()","ci_build_details_path()","ci_status()","clean_repo()","clear_and_update!()","closed?()","closed_event()","closed_items_count()","code()","collect_authors()","collect_commits()","comments()","commit()","commit()","commit!()","commit_author()","commit_badge_path()","commit_from()","commit_line_notes()","commit_notes()","commit_status()","commit_status_path()","commit_to()","commit_to_html()","commits()","commits()","commits()","commits()","commits_between()","commits_between()","commits_count()","commits_count()","commits_since()","commits_since()","commits_with_refs()","commits_with_refs()","committer_email()","committer_link()","committer_name()","common_notes()","compare()","compose_service_hook()","config()","content_types()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create()","create_by_user()","create_from_omniauth()","create_from_omniauth()","create_repository()","create_status_change_note()","created_at()","css_class_by_id()","current_action?()","current_controller?()","current_ref()","current_user()","dashboard_filter()","dashboard_filter_path()","data()","default_filter()","default_regex()","define_show_vars()","define_tree_vars()","delete_users_ids_from_team()","description()","design()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy()","destroy_project()","destroy_project!()","destroy_repository()","destroyed?()","determine_action()","dev_access_for?()","dev_tools()","diff_line_content()","different_committer?()","diffs()","diffs()","dir_exists?()","discover_default_branch()","downvote?()","downvotes()","downvotes_in_percent()","each_diff_line()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","edit()","emoji_autocomplete_source()","empty?()","empty_repo?()","enable_automerge()","ensure_dir_exist()","entities_per_project()","error()","event_action_name()","event_filter()","event_filter_link()","event_image()","execute()","execute()","execute()","execute()","execute()","execute()","execute()","execute()","execute()","execute()","execute()","execute_hooks()","execute_services()","exists?()","expired?()","expired?()","expires_at()","extract_ref()","failure_message()","feed_summary()","feed_title()","feed_url()","file_name()","file_name()","files()","files_count()","filter()","find_all_by_branch()","find_all_by_milestone()","find_for_ldap_auth()","find_for_ldap_auth()","find_free_space()","find_or_first()","find_or_new_for_omniauth()","find_or_new_for_omniauth()","find_project()","find_with_namespace()","fingerprintable_key()","first_name()","for_commit?()","for_diff_line?()","forbidden!()","format_message()","format_message()","fresh_commits()","fresh_commits()","generate_password()","gfm()","git_error?()","git_host()","git_not_found!()","githost()","gitlab_auth()","gitlab_ci?()","gitlab_markdown?()","global_id()","graph()","graph()","gravatar_icon()","group()","group_abilities()","grouped_options_refs()","grouper_project_members()","guest_access_for?()","has_commits?()","has_post_receive_file?()","heads()","help()","hexdigest()","history()","history()","hook_file()","http_url_to_repo()","human_name()","human_name()","human_state()","identification_type()","identifier()","image_diff_class()","import_team()","in_locked_and_timed_satellite()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index()","index_commits()","info()","invalid?()","is_admin?()","is_assigned?()","is_being_closed?()","is_being_reassigned?()","is_being_reopened?()","is_blob?()","is_deploy_key()","is_empty?()","issue()","issue()","issue?()","issue_css_classes()","issue_status_changed_email()","issue_tags()","issues()","issues()","issues_active_milestones()","issues_filter()","issues_filtered()","issues_labels()","items_for()","joined?()","labels_autocomplete_source()","last_activity()","last_activity_date()","last_activity_project()","last_commit()","last_commit()","last_commit()","last_commit_for()","last_commit_short_sha()","last_deploy?()","last_push_to_non_root?()","ldap()","ldap_enable?()","left?()","lifetime_select_options()","link_title()","link_to_author()","link_to_commit_diff_line_note()","link_to_gfm()","link_to_member()","link_to_project()","loading_more_notes?()","loading_new_notes?()","lock()","lock_file()","log()","log()","log_exception()","log_info()","log_info()","log_info()","logs_tree()","mark_as_merged!()","mark_as_unchecked()","mark_as_unmergable()","mark_reserved()","markdown()","markup?()","master_access_for?()","max_count()","md_ref?()","membership_changed?()","merge!()","merge!()","merge_event()","merge_request()","merge_request()","merge_request?()","merge_requests()","merge_requests()","merged()","merged?()","merged?()","method_missing()","method_missing()","milestone()","milestone?()","mode()","module_enabled()","module_enabled()","module_enabled()","module_enabled()","move_dir()","move_repository()","mr_and_commit_notes()","mr_css_classes()","my_own_projects()","name()","name_with_namespace()","namespace_dir()","namespace_full_path()","namespace_id()","namespace_owner()","namespaces()","namespaces_options()","nav_link()","nav_tab()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new?()","new_branch?()","new_issue?()","new_issue_email()","new_merge_request?()","new_merge_request_email()","new_mr_path_from_push_event()","new_record?()","new_ref?()","new_user_email()","no_cache_headers()","no_commit_message()","not_allowed!()","not_found!()","not_found!()","not_in_project()","note?()","note_commit?()","note_commit_email()","note_commit_id()","note_for_main_target?()","note_issue_email()","note_merge_request_email()","note_short_commit_id()","note_target()","note_target_id()","note_target_type()","note_wall_email()","noteable()","noteable_type_name()","notes()","notify_only_author?()","notify_team()","oauth_active_class()","observe_push()","open?()","open?()","open_branches()","open_for()","open_items_count()","options()","pages()","paginate()","parent_commit()","parents_count()","participants()","path()","path_regex()","path_to_repo()","path_with_namespace()","people()","percent_complete()","perform()","perform()","persisted?()","person_link()","place_chain()","plain_text_readme?()","post_receive_data()","postprocess()","prepare_satellite!()","prev_commit()","prev_commit_id()","preview()","primary_key()","private?()","probably_merged?()","processing()","project()","project()","project_abilities()","project_access_granted_email()","project_access_human()","project_admin_rules()","project_dev_rules()","project_guest_rules()","project_id()","project_ids()","project_ids()","project_issues_filter_path()","project_last_activity()","project_master_rules()","project_name()","project_name_regex()","project_report_rules()","project_tab_class()","project_teams_update()","project_title()","project_update()","project_was_moved_email()","projects()","projects()","projects()","projects_limit_percent()","projects_sorted_by_activity()","proper?()","protected_branch?()","public?()","push()","push?()","push_action_name()","push_to_branch?()","push_with_commits?()","quiet()","raw()","read_latest()","read_latest_for()","readme()","reassigned_issue_email()","reassigned_merge_request_email()","recent_push()","ref()","ref_name()","ref_names()","ref_type()","regenerate_from()","reject_blocked!()","reload_code()","reloaded_commits()","reloaded_diffs()","remove_from_team_message()","remove_key()","remove_project()","remove_repository()","render_403()","render_404()","render_api_error!()","render_tree()","reopened?()","replace_markers()","repo()","repo()","repo_access_human()","repo_exists?()","repo_name()","report_access_for?()","repository_masters()","repository_readers()","repository_writers()","request_protocol()","require_non_empty_project()","require_ssh_key?()","reset_access()","reset_private_token()","result()","rm_dir()","rm_key()","rm_ref?()","role_access()","root_ref()","root_ref?()","safe_message()","satellite()","saved?()","search()","search()","search()","search()","search()","search()","search()","search_autocomplete_source()","send_move_instructions()","send_notify_mails()","send_reassigned_email()","send_reassigned_email()","send_update_instructions()","services()","set_current_user_for_observers()","set_identifier()","set_key()","set_slug()","several_namespaces?()","short_id()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show()","show_last_push_widget?()","size()","skip_git?()","snippet()","sort()","ssh_url_to_repo()","stats()","store_dir()","strip_white_space()","switch()","tag?()","tag_list()","tag_name()","tag_names()","tag_path()","tags()","tags()","take_left_leaves()","target_title()","team()","team_member_by_id()","team_member_by_name_or_email()","team_members()","team_update()","team_update()","team_without_note_author()","test()","test()","test()","title()","tm_of()","tm_path()","to_diff()","to_diff()","to_graph_hash()","to_json()","to_param()","to_param()","to_param()","to_param()","to_patch()","today?()","token()","total_items_count()","transfer()","tree()","tree_hex_class()","tree_icon()","tree_join()","trigger_post_receive()","truncate_team()","truncate_team()","truncate_teams()","truncate_teams()","unassigned_filter()","unauthorized!()","unblock()","unchecked?()","unique_key()","unmerged_commits()","unmerged_diffs()","up_dir?()","up_dir_path()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update()","update_gitolite()","update_merge_requests()","update_password()","update_project()","update_project!()","update_project_config()","update_projects()","update_repositories()","update_repository()","update_repository()","update_repository()","update_repository()","update_username()","update_users_ids_to_role()","upvote?()","upvotes()","upvotes_in_percent()","url_to_repo()","url_to_repo()","user_bulk_import()","user_color_scheme_class()","user_project()","username_regex()","users()","valid?()","valid_diffs?()","valid_hook_file()","valid_post_receive_file?()","valid_push?()","valid_repo?()","validate_branches()","validate_each()","validate_get_request()","validate_post_request()","validates_merge_request()","votes_count()","wall()","wall_note?()","web_app_url()","web_url()","without_projects()","write_key()","ofl","post-receive"],"longSearchIndex":["ability","account","activityobserver","admin","admin::dashboardcontroller","admin::groupscontroller","admin::hookscontroller","admin::logscontroller","admin::projectscontroller","admin::resquecontroller","admin::teammemberscontroller","admin::userscontroller","admincontroller","applicationcontroller","applicationdecorator","applicationhelper","attachmentuploader","authority","basecontext","blamecontroller","blobcontroller","commit","commitcontroller","commitdecorator","commitloadcontext","commitscontroller","commitshelper","comparecontroller","dashboardcontroller","dashboardhelper","deploykeyscontroller","errorscontroller","event","eventdecorator","eventfilter","eventshelper","extractspath","extractspath::invalidpatherror","filesizevalidator","filesizevalidator::helper","githost","gitlab","gitlab::api","gitlab::apihelpers","gitlab::applogger","gitlab::auth","gitlab::entities","gitlab::entities::hook","gitlab::entities::issue","gitlab::entities::mrnote","gitlab::entities::mergerequest","gitlab::entities::milestone","gitlab::entities::note","gitlab::entities::project","gitlab::entities::projectmember","gitlab::entities::projectsnippet","gitlab::entities::repocommit","gitlab::entities::repoobject","gitlab::entities::sshkey","gitlab::entities::user","gitlab::entities::userbasic","gitlab::entities::userlogin","gitlab::gitlogger","gitlab::gitstats","gitlab::gitolite","gitlab::gitolite::accessdenied","gitlab::gitoliteconfig","gitlab::gitoliteconfig::pullerror","gitlab::gitoliteconfig::pusherror","gitlab::graph","gitlab::graph::commit","gitlab::graph::jsonbuilder","gitlab::inlinediff","gitlab::issues","gitlab::logger","gitlab::markdown","gitlab::mergerequests","gitlab::milestones","gitlab::notes","gitlab::projectmover","gitlab::projectmover::projectmoveerror","gitlab::projects","gitlab::regex","gitlab::satellite","gitlab::satellite::action","gitlab::satellite::editfileaction","gitlab::satellite::mergeaction","gitlab::satellite::satellite","gitlab::seeder","gitlab::session","gitlab::theme","gitlab::users","gitlabciservice","gitlabmarkdownhelper","grack","grack::auth","group","groupscontroller","helpcontroller","hookscontroller","issue","issuecommonality","issuecommonality::classmethods","issueobserver","issuesbulkupdatecontext","issuescontroller","issueshelper","issueslistcontext","key","keyobserver","keyscontroller","labelscontroller","mergerequest","mergerequestobserver","mergerequestscontroller","mergerequestshelper","mergerequestsloadcontext","milestone","milestonescontroller","namespace","namespacedproject","namespaceshelper","note","noteevent","noteobserver","notes","notes::createcontext","notes::loadcontext","notescontroller","noteshelper","notify","omniauthcallbackscontroller","postreceive","profilehelper","profilescontroller","project","project::transfererror","projecthook","projectobserver","projectresourcecontroller","projectupdatecontext","projectscontroller","projectshelper","protectedbranch","protectedbranchescontroller","pushevent","pushobserver","redcarpet","redcarpet::render","redcarpet::render::gitlabhtml","refscontroller","repositoriescontroller","repository","searchcontext","searchcontroller","service","servicehook","servicescontroller","snippet","snippetscontroller","snippetshelper","staticmodel","staticmodel::classmethods","systemhook","systemhookobserver","systemhookworker","tabhelper","tagshelper","team","teammemberscontroller","testhookcontext","tree","treecontroller","treedecorator","treehelper","user","userdecorator","userobserver","usersproject","usersprojectobserver","votes","webhook","wiki","wikiscontroller","staticmodel#==()","staticmodel#[]()","gitlab::inlinediff::_indexes_of_changed_lines()","account#abilities()","applicationcontroller#abilities()","basecontext#abilities()","grack::auth#abilities()","applicationcontroller#access_denied!()","project::access_options()","usersproject::access_roles()","profilescontroller#account()","event#action_name()","gitlabciservice#activated?()","project::active()","eventfilter#active?()","applicationcontroller#add_abilities()","authority#add_access()","gitlab::graph::commit#add_refs()","team#add_user_id_to_team()","team#add_user_to_team()","team#add_users_ids_to_team()","usersproject::add_users_into_projects()","group#add_users_to_project_teams()","team#add_users_to_team()","gitlab::gitoliteconfig#admin_all_repo()","gitlab::gitoliteconfig#admin_all_repo!()","usersprojectobserver#after_commit()","activityobserver#after_create()","issueobserver#after_create()","mergerequestobserver#after_create()","noteobserver#after_create()","projectobserver#after_create()","systemhookobserver#after_create()","userobserver#after_create()","usersprojectobserver#after_create()","keyobserver#after_destroy()","projectobserver#after_destroy()","systemhookobserver#after_destroy()","userobserver#after_destroy()","usersprojectobserver#after_destroy()","activityobserver#after_save()","keyobserver#after_save()","userobserver#after_save()","applicationcontroller#after_sign_in_path_for()","issueobserver#after_update()","mergerequestobserver#after_update()","projectobserver#after_update()","systemhook::all_hooks_fire()","authority#allow_read_for?()","ability::allowed()","treehelper#allowed_tree_edit?()","applicationhelper#app_theme()","gitlab::gitoliteconfig#apply()","eventfilter#apply_filter()","teammemberscontroller#apply_import()","repositoriescontroller#archive()","repository#archive_repo()","extractspath#assign_ref_vars()","systemhook#async_execute()","gitlab::apihelpers#attributes_for_keys()","applicationhelper#authbutton()","gitlab::apihelpers#authenticate!()","admincontroller#authenticate_admin!()","gitlab::apihelpers#authenticated_as_admin!()","event#author()","commit#author_email()","milestone#author_id()","commitdecorator#author_link()","commit#author_name()","gitlab::apihelpers#authorize!()","issuescontroller#authorize_admin_issue!()","mergerequestscontroller#authorize_admin_merge_request!()","milestonescontroller#authorize_admin_milestone!()","snippetscontroller#authorize_admin_snippet!()","applicationcontroller#authorize_code_access!()","issuescontroller#authorize_modify_issue!()","mergerequestscontroller#authorize_modify_merge_request!()","snippetscontroller#authorize_modify_snippet!()","applicationcontroller#authorize_project!()","groupscontroller#authorize_read_group!()","project::authorized_for()","account#authorized_groups()","account#authorized_projects()","gitlab::gitstats#authors()","gitlab::gitstats#authors_count()","mergerequestscontroller#automerge()","mergerequest#automerge!()","mergerequestscontroller#automerge_check()","userdecorator#avatar_image()","staticmodel::classmethods#base_class()","gitlab::graph::jsonbuilder#base_space()","account#block()","admin::userscontroller#block()","redcarpet::render::gitlabhtml#block_code()","pushevent#branch?()","mergerequestscontroller#branch_from()","pushevent#branch_name()","repository#branch_names()","mergerequestscontroller#branch_to()","repositoriescontroller#branches()","repository#branches()","tabhelper#branches_tab_class()","treedecorator#breadcrumbs()","treehelper#breadcrumbs()","mergerequest#broken_diffs?()","gitlab::logger::build()","project#build_commit_note()","gitlab::gitstats#build_graph()","commitshelper#build_line_anchor()","gitlabciservice#build_page()","usersproject::bulk_delete()","usersproject::bulk_import()","issuescontroller#bulk_update()","usersproject::bulk_update()","account#can?()","applicationcontroller#can?()","basecontext#can?()","gitlab::apihelpers#can?()","grack::auth#can?()","milestone#can_be_closed?()","gitlab::satellite::mergeaction#can_be_merged?()","mergerequest#can_be_merged?()","account#can_create_group?()","account#can_create_project?()","gitlab::satellite::editfileaction#can_edit?()","account#cared_merge_requests()","event#changed_issue?()","event#changed_merge_request?()","mergerequest#check_if_can_be_merged()","project#check_limit()","filesizevalidator#check_validity!()","namespacedproject#chief()","mergerequestshelper#ci_build_details_path()","mergerequestscontroller#ci_status()","gitlab::gitoliteconfig#clean_repo()","gitlab::satellite::satellite#clear_and_update!()","event#closed?()","mergerequest#closed_event()","milestone#closed_items_count()","project#code()","gitlab::gitstats#collect_authors()","gitlab::graph::jsonbuilder#collect_commits()","eventfilter::comments()","protectedbranch#commit()","repository#commit()","gitlab::satellite::editfileaction#commit!()","note#commit_author()","gitlabciservice#commit_badge_path()","pushevent#commit_from()","project#commit_line_notes()","project#commit_notes()","gitlabciservice#commit_status()","gitlabciservice#commit_status_path()","pushevent#commit_to()","commitshelper#commit_to_html()","commit::commits()","mergerequest#commits()","pushevent#commits()","repository#commits()","commit::commits_between()","repository#commits_between()","gitlab::gitstats#commits_count()","pushevent#commits_count()","commit::commits_since()","repository#commits_since()","commit::commits_with_refs()","repository#commits_with_refs()","commit#committer_email()","commitdecorator#committer_link()","commit#committer_name()","project#common_notes()","commit::compare()","gitlabciservice#compose_service_hook()","gitlab::gitolite#config()","snippet::content_types()","admin::groupscontroller#create()","admin::hookscontroller#create()","admin::userscontroller#create()","comparecontroller#create()","deploykeyscontroller#create()","gitlab::satellite::satellite#create()","hookscontroller#create()","issuescontroller#create()","keyscontroller#create()","mergerequestscontroller#create()","milestonescontroller#create()","notescontroller#create()","projectscontroller#create()","protectedbranchescontroller#create()","snippetscontroller#create()","teammemberscontroller#create()","wikiscontroller#create()","project::create_by_user()","gitlab::auth#create_from_omniauth()","user::create_from_omniauth()","gitlab::gitolite#create_repository()","note::create_status_change_note()","commit#created_at()","gitlab::theme::css_class_by_id()","applicationhelper#current_action?()","applicationhelper#current_controller?()","grack::auth#current_ref()","gitlab::apihelpers#current_user()","dashboardcontroller#dashboard_filter()","dashboardhelper#dashboard_filter_path()","snippet#data()","eventfilter::default_filter()","gitlab::regex#default_regex()","mergerequestscontroller#define_show_vars()","refscontroller#define_tree_vars()","team#delete_users_ids_from_team()","commitdecorator#description()","profilescontroller#design()","admin::groupscontroller#destroy()","admin::hookscontroller#destroy()","admin::projectscontroller#destroy()","admin::teammemberscontroller#destroy()","admin::userscontroller#destroy()","deploykeyscontroller#destroy()","hookscontroller#destroy()","keyscontroller#destroy()","milestonescontroller#destroy()","notescontroller#destroy()","projectscontroller#destroy()","protectedbranchescontroller#destroy()","snippetscontroller#destroy()","teammemberscontroller#destroy()","wikiscontroller#destroy()","gitlab::gitoliteconfig#destroy_project()","gitlab::gitoliteconfig#destroy_project!()","repository#destroy_repository()","staticmodel#destroyed?()","event::determine_action()","authority#dev_access_for?()","applicationcontroller#dev_tools()","commitshelper#diff_line_content()","commit#different_committer?()","mergerequest#diffs()","mergerequestscontroller#diffs()","namespace#dir_exists?()","repository#discover_default_branch()","note#downvote?()","votes#downvotes()","votes#downvotes_in_percent()","commitshelper#each_diff_line()","admin::groupscontroller#edit()","admin::projectscontroller#edit()","admin::teammemberscontroller#edit()","admin::userscontroller#edit()","issuescontroller#edit()","mergerequestscontroller#edit()","milestonescontroller#edit()","projectscontroller#edit()","servicescontroller#edit()","snippetscontroller#edit()","treecontroller#edit()","wikiscontroller#edit()","applicationhelper#emoji_autocomplete_source()","tree#empty?()","repository#empty_repo?()","gitlab::gitolite#enable_automerge()","namespace#ensure_dir_exist()","dashboardhelper#entities_per_project()","gitlab::logger::error()","eventshelper#event_action_name()","dashboardcontroller#event_filter()","eventshelper#event_filter_link()","eventshelper#event_image()","commitloadcontext#execute()","gitlab::projectmover#execute()","issuesbulkupdatecontext#execute()","issueslistcontext#execute()","mergerequestsloadcontext#execute()","notes::createcontext#execute()","notes::loadcontext#execute()","projectupdatecontext#execute()","searchcontext#execute()","testhookcontext#execute()","webhook#execute()","pushobserver#execute_hooks()","pushobserver#execute_services()","gitlab::satellite::satellite#exists?()","milestone#expired?()","snippet#expired?()","milestone#expires_at()","extractspath#extract_ref()","omniauthcallbackscontroller#failure_message()","eventdecorator#feed_summary()","eventdecorator#feed_title()","eventdecorator#feed_url()","gitlab::applogger::file_name()","gitlab::gitlogger::file_name()","projectscontroller#files()","gitlab::gitstats#files_count()","user::filter()","mergerequest::find_all_by_branch()","mergerequest::find_all_by_milestone()","gitlab::auth#find_for_ldap_auth()","user::find_for_ldap_auth()","gitlab::graph::jsonbuilder#find_free_space()","commit::find_or_first()","gitlab::auth#find_or_new_for_omniauth()","user::find_or_new_for_omniauth()","gitlab::apihelpers#find_project()","project::find_with_namespace()","key#fingerprintable_key()","account#first_name()","note#for_commit?()","note#for_diff_line?()","gitlab::apihelpers#forbidden!()","gitlab::applogger#format_message()","gitlab::gitlogger#format_message()","commit::fresh_commits()","repository#fresh_commits()","user#generate_password()","gitlab::markdown#gfm()","project#git_error?()","githost#git_host()","applicationcontroller#git_not_found!()","errorscontroller#githost()","user::gitlab_auth()","project#gitlab_ci?()","treehelper#gitlab_markdown?()","namespace::global_id()","gitlab::gitstats#graph()","projectscontroller#graph()","applicationhelper#gravatar_icon()","groupscontroller#group()","ability::group_abilities()","applicationhelper#grouped_options_refs()","projectshelper#grouper_project_members()","authority#guest_access_for?()","repository#has_commits?()","repository#has_post_receive_file?()","repository#heads()","filesizevalidator#help()","applicationhelper#hexdigest()","profilescontroller#history()","wikiscontroller#history()","repository#hook_file()","repository#http_url_to_repo()","group#human_name()","namespace#human_name()","mergerequest#human_state()","commitshelper#identification_type()","account#identifier()","commitshelper#image_diff_class()","usersproject::import_team()","gitlab::satellite::action#in_locked_and_timed_satellite()","admin::dashboardcontroller#index()","admin::groupscontroller#index()","admin::hookscontroller#index()","admin::projectscontroller#index()","admin::userscontroller#index()","comparecontroller#index()","dashboardcontroller#index()","deploykeyscontroller#index()","helpcontroller#index()","hookscontroller#index()","issuescontroller#index()","keyscontroller#index()","labelscontroller#index()","mergerequestscontroller#index()","milestonescontroller#index()","notescontroller#index()","protectedbranchescontroller#index()","servicescontroller#index()","snippetscontroller#index()","teammemberscontroller#index()","gitlab::graph::jsonbuilder#index_commits()","gitlab::logger::info()","tree#invalid?()","account#is_admin?()","issuecommonality#is_assigned?()","issuecommonality#is_being_closed?()","issuecommonality#is_being_reassigned?()","issuecommonality#is_being_reopened?()","tree#is_blob?()","key#is_deploy_key()","milestone#is_empty?()","event#issue()","issuescontroller#issue()","event#issue?()","issueshelper#issue_css_classes()","notify#issue_status_changed_email()","issueshelper#issue_tags()","dashboardcontroller#issues()","groupscontroller#issues()","issueshelper#issues_active_milestones()","issueshelper#issues_filter()","issuescontroller#issues_filtered()","project#issues_labels()","project#items_for()","event#joined?()","issueshelper#labels_autocomplete_source()","project#last_activity()","project#last_activity_date()","account#last_activity_project()","applicationhelper#last_commit()","mergerequest#last_commit()","pushevent#last_commit()","repository#last_commit_for()","mergerequest#last_commit_short_sha()","key#last_deploy?()","pushevent#last_push_to_non_root?()","omniauthcallbackscontroller#ldap()","applicationhelper#ldap_enable?()","event#left?()","snippetshelper#lifetime_select_options()","commitdecorator#link_title()","eventshelper#link_to_author()","noteshelper#link_to_commit_diff_line_note()","gitlabmarkdownhelper#link_to_gfm()","projectshelper#link_to_member()","projectshelper#link_to_project()","noteshelper#loading_more_notes?()","noteshelper#loading_new_notes?()","gitlab::satellite::satellite#lock()","gitlab::satellite::satellite#lock_file()","gitlab::auth#log()","gitlab::gitoliteconfig#log()","applicationcontroller#log_exception()","gitlab::projectmover#log_info()","projectobserver#log_info()","userobserver#log_info()","refscontroller#logs_tree()","mergerequest#mark_as_merged!()","mergerequest#mark_as_unchecked()","mergerequest#mark_as_unmergable()","gitlab::graph::jsonbuilder#mark_reserved()","gitlabmarkdownhelper#markdown()","treehelper#markup?()","authority#master_access_for?()","gitlab::graph::jsonbuilder::max_count()","pushevent#md_ref?()","event#membership_changed?()","gitlab::satellite::mergeaction#merge!()","mergerequest#merge!()","mergerequest#merge_event()","event#merge_request()","mergerequestscontroller#merge_request()","event#merge_request?()","dashboardcontroller#merge_requests()","groupscontroller#merge_requests()","eventfilter::merged()","event#merged?()","mergerequest#merged?()","applicationcontroller#method_missing()","gitlab::graph::commit#method_missing()","milestonescontroller#milestone()","event#milestone?()","snippet#mode()","issuescontroller#module_enabled()","labelscontroller#module_enabled()","mergerequestscontroller#module_enabled()","milestonescontroller#module_enabled()","namespace#move_dir()","gitlab::gitolite#move_repository()","mergerequest#mr_and_commit_notes()","mergerequestshelper#mr_css_classes()","account#my_own_projects()","snippet#name()","namespacedproject#name_with_namespace()","repository#namespace_dir()","namespace#namespace_full_path()","account#namespace_id()","namespacedproject#namespace_owner()","account#namespaces()","namespaceshelper#namespaces_options()","tabhelper#nav_link()","tabhelper#nav_tab()","admin::groupscontroller#new()","admin::userscontroller#new()","basecontext::new()","commit::new()","deploykeyscontroller#new()","eventfilter::new()","filesizevalidator::new()","gitlab::gitstats::new()","gitlab::graph::commit::new()","gitlab::graph::jsonbuilder::new()","gitlab::projectmover::new()","gitlab::satellite::action::new()","gitlab::satellite::editfileaction::new()","gitlab::satellite::mergeaction::new()","gitlab::satellite::satellite::new()","issuescontroller#new()","keyscontroller#new()","mergerequestscontroller#new()","milestonescontroller#new()","projectscontroller#new()","redcarpet::render::gitlabhtml::new()","searchcontext::new()","snippetscontroller#new()","teammemberscontroller#new()","tree::new()","issuecommonality#new?()","pushevent#new_branch?()","event#new_issue?()","notify#new_issue_email()","event#new_merge_request?()","notify#new_merge_request_email()","mergerequestshelper#new_mr_path_from_push_event()","staticmodel#new_record?()","pushevent#new_ref?()","notify#new_user_email()","applicationcontroller#no_cache_headers()","commitdecorator#no_commit_message()","gitlab::apihelpers#not_allowed!()","applicationcontroller#not_found!()","gitlab::apihelpers#not_found!()","user::not_in_project()","event#note?()","noteevent#note_commit?()","notify#note_commit_email()","noteevent#note_commit_id()","noteshelper#note_for_main_target?()","notify#note_issue_email()","notify#note_merge_request_email()","noteevent#note_short_commit_id()","noteevent#note_target()","noteevent#note_target_id()","noteevent#note_target_type()","notify#note_wall_email()","note#noteable()","note#noteable_type_name()","notescontroller#notes()","note#notify_only_author?()","noteobserver#notify_team()","profilehelper#oauth_active_class()","pushobserver#observe_push()","mergerequest#open?()","milestone#open?()","repository#open_branches()","issue::open_for()","milestone#open_items_count()","eventfilter#options()","wikiscontroller#pages()","gitlab::apihelpers#paginate()","pushevent#parent_commit()","commit#parents_count()","milestone#participants()","gitlab::satellite::satellite#path()","gitlab::regex#path_regex()","repository#path_to_repo()","namespacedproject#path_with_namespace()","groupscontroller#people()","milestone#percent_complete()","postreceive::perform()","systemhookworker::perform()","staticmodel#persisted?()","commitdecorator#person_link()","gitlab::graph::jsonbuilder#place_chain()","treehelper#plain_text_readme?()","pushobserver#post_receive_data()","redcarpet::render::gitlabhtml#postprocess()","gitlab::satellite::action#prepare_satellite!()","commit#prev_commit()","commit#prev_commit_id()","notescontroller#preview()","staticmodel::classmethods#primary_key()","project#private?()","mergerequest#probably_merged?()","gitlab::inlinediff::processing()","admin::projectscontroller#project()","applicationcontroller#project()","ability::project_abilities()","notify#project_access_granted_email()","usersproject#project_access_human()","ability::project_admin_rules()","ability::project_dev_rules()","ability::project_guest_rules()","project#project_id()","account#project_ids()","groupscontroller#project_ids()","issueshelper#project_issues_filter_path()","applicationhelper#project_last_activity()","ability::project_master_rules()","event#project_name()","gitlab::regex#project_name_regex()","ability::project_report_rules()","tabhelper#project_tab_class()","admin::groupscontroller#project_teams_update()","projectshelper#project_title()","admin::groupscontroller#project_update()","notify#project_was_moved_email()","dashboardcontroller#projects()","groupscontroller#projects()","key#projects()","account#projects_limit_percent()","account#projects_sorted_by_activity()","event#proper?()","repository#protected_branch?()","project#public?()","eventfilter::push()","event#push?()","pushevent#push_action_name()","pushobserver#push_to_branch?()","pushevent#push_with_commits?()","gitlab::seeder::quiet()","snippetscontroller#raw()","gitlab::logger::read_latest()","gitlab::logger::read_latest_for()","treedecorator#readme()","notify#reassigned_issue_email()","notify#reassigned_merge_request_email()","account#recent_push()","refscontroller#ref()","pushevent#ref_name()","repository#ref_names()","pushevent#ref_type()","wiki::regenerate_from()","applicationcontroller#reject_blocked!()","mergerequest#reload_code()","mergerequest#reloaded_commits()","mergerequest#reloaded_diffs()","projectshelper#remove_from_team_message()","gitlab::gitolite#remove_key()","admin::groupscontroller#remove_project()","gitlab::gitolite#remove_repository()","applicationcontroller#render_403()","applicationcontroller#render_404()","gitlab::apihelpers#render_api_error!()","treehelper#render_tree()","event#reopened?()","gitlab::inlinediff::replace_markers()","gitlab::satellite::satellite#repo()","repository#repo()","usersproject#repo_access_human()","repository#repo_exists?()","project#repo_name()","authority#report_access_for?()","authority#repository_masters()","authority#repository_readers()","authority#repository_writers()","applicationhelper#request_protocol()","applicationcontroller#require_non_empty_project()","account#require_ssh_key?()","authority#reset_access()","profilescontroller#reset_private_token()","searchcontext#result()","namespace#rm_dir()","gitlab::gitoliteconfig#rm_key()","pushevent#rm_ref?()","usersproject#role_access()","repository#root_ref()","repository#root_ref?()","commit#safe_message()","repository#satellite()","project#saved?()","groupscontroller#search()","issuecommonality::classmethods#search()","issuescontroller#search()","namespace::search()","project::search()","user::search()","wiki::search()","applicationhelper#search_autocomplete_source()","project#send_move_instructions()","noteobserver#send_notify_mails()","issueobserver#send_reassigned_email()","mergerequestobserver#send_reassigned_email()","namespace#send_update_instructions()","project#services()","applicationcontroller#set_current_user_for_observers()","key#set_identifier()","gitlab::gitolite#set_key()","wiki#set_slug()","account#several_namespaces?()","commit#short_id()","admin::groupscontroller#show()","admin::projectscontroller#show()","admin::resquecontroller#show()","admin::userscontroller#show()","blamecontroller#show()","blobcontroller#show()","commitcontroller#show()","commitscontroller#show()","comparecontroller#show()","deploykeyscontroller#show()","groupscontroller#show()","issuescontroller#show()","keyscontroller#show()","mergerequestscontroller#show()","milestonescontroller#show()","profilescontroller#show()","projectscontroller#show()","repositoriescontroller#show()","searchcontroller#show()","snippetscontroller#show()","teammemberscontroller#show()","treecontroller#show()","wikiscontroller#show()","applicationhelper#show_last_push_widget?()","snippet#size()","usersproject#skip_git?()","snippetscontroller#snippet()","issuescontroller#sort()","repository#ssh_url_to_repo()","repositoriescontroller#stats()","attachmentuploader#store_dir()","key#strip_white_space()","refscontroller#switch()","pushevent#tag?()","tagshelper#tag_list()","pushevent#tag_name()","repository#tag_names()","tagshelper#tag_path()","repositoriescontroller#tags()","repository#tags()","gitlab::graph::jsonbuilder#take_left_leaves()","event#target_title()","eventfilter::team()","team#team_member_by_id()","team#team_member_by_name_or_email()","groupscontroller#team_members()","admin::projectscontroller#team_update()","admin::userscontroller#team_update()","noteobserver#team_without_note_author()","admin::hookscontroller#test()","hookscontroller#test()","servicescontroller#test()","commitdecorator#title()","userdecorator#tm_of()","projectshelper#tm_path()","commit#to_diff()","mergerequest#to_diff()","gitlab::graph::commit#to_graph_hash()","gitlab::graph::jsonbuilder#to_json()","namespace#to_param()","project#to_param()","staticmodel#to_param()","wiki#to_param()","mergerequest#to_patch()","issuecommonality#today?()","profilescontroller#token()","milestone#total_items_count()","namespacedproject#transfer()","repository#tree()","treehelper#tree_hex_class()","treehelper#tree_icon()","treehelper#tree_join()","pushobserver#trigger_post_receive()","team#truncate_team()","usersproject::truncate_team()","group#truncate_teams()","usersproject::truncate_teams()","issueshelper#unassigned_filter()","gitlab::apihelpers#unauthorized!()","admin::userscontroller#unblock()","mergerequest#unchecked?()","key#unique_key()","mergerequest#unmerged_commits()","mergerequest#unmerged_diffs()","treedecorator#up_dir?()","treedecorator#up_dir_path()","admin::groupscontroller#update()","admin::projectscontroller#update()","admin::teammemberscontroller#update()","admin::userscontroller#update()","issuescontroller#update()","mergerequestscontroller#update()","milestonescontroller#update()","profilescontroller#update()","projectscontroller#update()","servicescontroller#update()","snippetscontroller#update()","teammemberscontroller#update()","treecontroller#update()","namespace#update_gitolite()","pushobserver#update_merge_requests()","profilescontroller#update_password()","gitlab::gitoliteconfig#update_project()","gitlab::gitoliteconfig#update_project!()","gitlab::gitoliteconfig#update_project_config()","gitlab::gitoliteconfig#update_projects()","gitlab::gitolite#update_repositories()","gitlab::gitolite#update_repository()","protectedbranch#update_repository()","repository#update_repository()","usersproject#update_repository()","profilescontroller#update_username()","team#update_users_ids_to_role()","note#upvote?()","votes#upvotes()","votes#upvotes_in_percent()","gitlab::gitolite#url_to_repo()","repository#url_to_repo()","usersproject::user_bulk_import()","applicationhelper#user_color_scheme_class()","gitlab::apihelpers#user_project()","gitlab::regex#username_regex()","group#users()","grack::auth#valid?()","mergerequest#valid_diffs?()","repository#valid_hook_file()","repository#valid_post_receive_file?()","pushevent#valid_push?()","repository#valid_repo?()","mergerequest#validate_branches()","filesizevalidator#validate_each()","grack::auth#validate_get_request()","grack::auth#validate_post_request()","mergerequestscontroller#validates_merge_request()","votes#votes_count()","projectscontroller#wall()","noteevent#wall_note?()","applicationhelper#web_app_url()","project#web_url()","user::without_projects()","gitlab::gitoliteconfig#write_key()","",""],"info":[["Ability","","classes/Ability.html","",""],["Account","","classes/Account.html","",""],["ActivityObserver","","classes/ActivityObserver.html","",""],["Admin","","classes/Admin.html","",""],["Admin::DashboardController","","classes/Admin/DashboardController.html","",""],["Admin::GroupsController","","classes/Admin/GroupsController.html","",""],["Admin::HooksController","","classes/Admin/HooksController.html","",""],["Admin::LogsController","","classes/Admin/LogsController.html","",""],["Admin::ProjectsController","","classes/Admin/ProjectsController.html","",""],["Admin::ResqueController","","classes/Admin/ResqueController.html","",""],["Admin::TeamMembersController","","classes/Admin/TeamMembersController.html","",""],["Admin::UsersController","","classes/Admin/UsersController.html","",""],["AdminController","","classes/AdminController.html","","

Provides a base class for Admin controllers to subclass\n

Automatically sets the layout and ensures an administrator …\n"],["ApplicationController","","classes/ApplicationController.html","",""],["ApplicationDecorator","","classes/ApplicationDecorator.html","",""],["ApplicationHelper","","classes/ApplicationHelper.html","",""],["AttachmentUploader","","classes/AttachmentUploader.html","",""],["Authority","","classes/Authority.html","",""],["BaseContext","","classes/BaseContext.html","",""],["BlameController","","classes/BlameController.html","","

Controller for viewing a file’s blame\n"],["BlobController","","classes/BlobController.html","","

Controller for viewing a file’s blame\n"],["Commit","","classes/Commit.html","",""],["CommitController","","classes/CommitController.html","","

Controller for a specific Commit\n

Not to be confused with CommitsController, plural.\n"],["CommitDecorator","","classes/CommitDecorator.html","",""],["CommitLoadContext","","classes/CommitLoadContext.html","",""],["CommitsController","","classes/CommitsController.html","",""],["CommitsHelper","","classes/CommitsHelper.html","",""],["CompareController","","classes/CompareController.html","",""],["DashboardController","","classes/DashboardController.html","",""],["DashboardHelper","","classes/DashboardHelper.html","",""],["DeployKeysController","","classes/DeployKeysController.html","",""],["ErrorsController","","classes/ErrorsController.html","",""],["Event","","classes/Event.html","","

Schema Information\n

Table name: events\n\n

id          :integer          not null, primary key\ntarget_type :string(255) ...
\n"],["EventDecorator","","classes/EventDecorator.html","",""],["EventFilter","","classes/EventFilter.html","",""],["EventsHelper","","classes/EventsHelper.html","",""],["ExtractsPath","","classes/ExtractsPath.html","","

Module providing methods for dealing with separating a tree-ish string and\na file path string when combined …\n"],["ExtractsPath::InvalidPathError","","classes/ExtractsPath/InvalidPathError.html","","

Raised when given an invalid file path\n"],["FileSizeValidator","","classes/FileSizeValidator.html","",""],["FileSizeValidator::Helper","","classes/FileSizeValidator/Helper.html","",""],["GitHost","","classes/GitHost.html","",""],["Gitlab","","classes/Gitlab.html","","

ProjectMover class\n

Used for moving project repositories from one subdir to another\n"],["Gitlab::API","","classes/Gitlab/API.html","",""],["Gitlab::APIHelpers","","classes/Gitlab/APIHelpers.html","",""],["Gitlab::AppLogger","","classes/Gitlab/AppLogger.html","",""],["Gitlab::Auth","","classes/Gitlab/Auth.html","",""],["Gitlab::Entities","","classes/Gitlab/Entities.html","",""],["Gitlab::Entities::Hook","","classes/Gitlab/Entities/Hook.html","",""],["Gitlab::Entities::Issue","","classes/Gitlab/Entities/Issue.html","",""],["Gitlab::Entities::MRNote","","classes/Gitlab/Entities/MRNote.html","",""],["Gitlab::Entities::MergeRequest","","classes/Gitlab/Entities/MergeRequest.html","",""],["Gitlab::Entities::Milestone","","classes/Gitlab/Entities/Milestone.html","",""],["Gitlab::Entities::Note","","classes/Gitlab/Entities/Note.html","",""],["Gitlab::Entities::Project","","classes/Gitlab/Entities/Project.html","",""],["Gitlab::Entities::ProjectMember","","classes/Gitlab/Entities/ProjectMember.html","",""],["Gitlab::Entities::ProjectSnippet","","classes/Gitlab/Entities/ProjectSnippet.html","",""],["Gitlab::Entities::RepoCommit","","classes/Gitlab/Entities/RepoCommit.html","",""],["Gitlab::Entities::RepoObject","","classes/Gitlab/Entities/RepoObject.html","",""],["Gitlab::Entities::SSHKey","","classes/Gitlab/Entities/SSHKey.html","",""],["Gitlab::Entities::User","","classes/Gitlab/Entities/User.html","",""],["Gitlab::Entities::UserBasic","","classes/Gitlab/Entities/UserBasic.html","",""],["Gitlab::Entities::UserLogin","","classes/Gitlab/Entities/UserLogin.html","",""],["Gitlab::GitLogger","","classes/Gitlab/GitLogger.html","",""],["Gitlab::GitStats","","classes/Gitlab/GitStats.html","",""],["Gitlab::Gitolite","","classes/Gitlab/Gitolite.html","",""],["Gitlab::Gitolite::AccessDenied","","classes/Gitlab/Gitolite/AccessDenied.html","",""],["Gitlab::GitoliteConfig","","classes/Gitlab/GitoliteConfig.html","",""],["Gitlab::GitoliteConfig::PullError","","classes/Gitlab/GitoliteConfig/PullError.html","",""],["Gitlab::GitoliteConfig::PushError","","classes/Gitlab/GitoliteConfig/PushError.html","",""],["Gitlab::Graph","","classes/Gitlab/Graph.html","",""],["Gitlab::Graph::Commit","","classes/Gitlab/Graph/Commit.html","",""],["Gitlab::Graph::JsonBuilder","","classes/Gitlab/Graph/JsonBuilder.html","",""],["Gitlab::InlineDiff","","classes/Gitlab/InlineDiff.html","",""],["Gitlab::Issues","","classes/Gitlab/Issues.html","","

Issues API\n"],["Gitlab::Logger","","classes/Gitlab/Logger.html","",""],["Gitlab::Markdown","","classes/Gitlab/Markdown.html","","

Custom parser for GitLab-flavored Markdown\n

It replaces references in the text with links to the appropriate …\n"],["Gitlab::MergeRequests","","classes/Gitlab/MergeRequests.html","","

MergeRequest API\n"],["Gitlab::Milestones","","classes/Gitlab/Milestones.html","","

Milestones API\n"],["Gitlab::Notes","","classes/Gitlab/Notes.html","","

Notes API\n"],["Gitlab::ProjectMover","","classes/Gitlab/ProjectMover.html","",""],["Gitlab::ProjectMover::ProjectMoveError","","classes/Gitlab/ProjectMover/ProjectMoveError.html","",""],["Gitlab::Projects","","classes/Gitlab/Projects.html","","

Projects API\n"],["Gitlab::Regex","","classes/Gitlab/Regex.html","",""],["Gitlab::Satellite","","classes/Gitlab/Satellite.html","",""],["Gitlab::Satellite::Action","","classes/Gitlab/Satellite/Action.html","",""],["Gitlab::Satellite::EditFileAction","","classes/Gitlab/Satellite/EditFileAction.html","","

GitLab server-side file update and commit\n"],["Gitlab::Satellite::MergeAction","","classes/Gitlab/Satellite/MergeAction.html","","

GitLab server-side merge\n"],["Gitlab::Satellite::Satellite","","classes/Gitlab/Satellite/Satellite.html","",""],["Gitlab::Seeder","","classes/Gitlab/Seeder.html","",""],["Gitlab::Session","","classes/Gitlab/Session.html","","

Users API\n"],["Gitlab::Theme","","classes/Gitlab/Theme.html","",""],["Gitlab::Users","","classes/Gitlab/Users.html","","

Users API\n"],["GitlabCiService","","classes/GitlabCiService.html","","

Schema Information\n

Table name: services\n\n

id          :integer          not null, primary key\ntype       ...
\n"],["GitlabMarkdownHelper","","classes/GitlabMarkdownHelper.html","",""],["Grack","","classes/Grack.html","",""],["Grack::Auth","","classes/Grack/Auth.html","",""],["Group","","classes/Group.html","","

Schema Information\n

Table name: namespaces\n\n

id         :integer          not null, primary key\nname      ...
\n"],["GroupsController","","classes/GroupsController.html","",""],["HelpController","","classes/HelpController.html","",""],["HooksController","","classes/HooksController.html","",""],["Issue","","classes/Issue.html","","

Schema Information\n

Table name: issues\n\n

id           :integer          not null, primary key\ntitle       ...
\n"],["IssueCommonality","","classes/IssueCommonality.html","","

Contains common functionality shared between Issues and MergeRequests\n"],["IssueCommonality::ClassMethods","","classes/IssueCommonality/ClassMethods.html","",""],["IssueObserver","","classes/IssueObserver.html","",""],["IssuesBulkUpdateContext","","classes/IssuesBulkUpdateContext.html","",""],["IssuesController","","classes/IssuesController.html","",""],["IssuesHelper","","classes/IssuesHelper.html","",""],["IssuesListContext","","classes/IssuesListContext.html","",""],["Key","","classes/Key.html","",""],["KeyObserver","","classes/KeyObserver.html","",""],["KeysController","","classes/KeysController.html","",""],["LabelsController","","classes/LabelsController.html","",""],["MergeRequest","","classes/MergeRequest.html","",""],["MergeRequestObserver","","classes/MergeRequestObserver.html","",""],["MergeRequestsController","","classes/MergeRequestsController.html","",""],["MergeRequestsHelper","","classes/MergeRequestsHelper.html","",""],["MergeRequestsLoadContext","","classes/MergeRequestsLoadContext.html","","

Build collection of Merge Requests based on filtering passed via params for\n@project\n"],["Milestone","","classes/Milestone.html","","

Schema Information\n

Table name: milestones\n\n

id          :integer          not null, primary key\ntitle    ...
\n"],["MilestonesController","","classes/MilestonesController.html","",""],["Namespace","","classes/Namespace.html","","

Schema Information\n

Table name: namespaces\n\n

id         :integer          not null, primary key\nname      ...
\n"],["NamespacedProject","","classes/NamespacedProject.html","",""],["NamespacesHelper","","classes/NamespacesHelper.html","",""],["Note","","classes/Note.html","",""],["NoteEvent","","classes/NoteEvent.html","",""],["NoteObserver","","classes/NoteObserver.html","",""],["Notes","","classes/Notes.html","",""],["Notes::CreateContext","","classes/Notes/CreateContext.html","",""],["Notes::LoadContext","","classes/Notes/LoadContext.html","",""],["NotesController","","classes/NotesController.html","",""],["NotesHelper","","classes/NotesHelper.html","",""],["Notify","","classes/Notify.html","",""],["OmniauthCallbacksController","","classes/OmniauthCallbacksController.html","",""],["PostReceive","","classes/PostReceive.html","",""],["ProfileHelper","","classes/ProfileHelper.html","",""],["ProfilesController","","classes/ProfilesController.html","",""],["Project","","classes/Project.html","",""],["Project::TransferError","","classes/Project/TransferError.html","",""],["ProjectHook","","classes/ProjectHook.html","","

Schema Information\n

Table name: web_hooks\n\n

id         :integer          not null, primary key\nurl        ...
\n"],["ProjectObserver","","classes/ProjectObserver.html","",""],["ProjectResourceController","","classes/ProjectResourceController.html","",""],["ProjectUpdateContext","","classes/ProjectUpdateContext.html","",""],["ProjectsController","","classes/ProjectsController.html","",""],["ProjectsHelper","","classes/ProjectsHelper.html","",""],["ProtectedBranch","","classes/ProtectedBranch.html","","

Schema Information\n

Table name: protected_branches\n\n

id         :integer          not null, primary key\nproject_id ...
\n"],["ProtectedBranchesController","","classes/ProtectedBranchesController.html","",""],["PushEvent","","classes/PushEvent.html","",""],["PushObserver","","classes/PushObserver.html","","

Includes methods for handling Git Push events\n

Triggered by PostReceive job\n"],["Redcarpet","","classes/Redcarpet.html","",""],["Redcarpet::Render","","classes/Redcarpet/Render.html","",""],["Redcarpet::Render::GitlabHTML","","classes/Redcarpet/Render/GitlabHTML.html","",""],["RefsController","","classes/RefsController.html","",""],["RepositoriesController","","classes/RepositoriesController.html","",""],["Repository","","classes/Repository.html","",""],["SearchContext","","classes/SearchContext.html","",""],["SearchController","","classes/SearchController.html","",""],["Service","","classes/Service.html","","

Schema Information\n

Table name: services\n\n

id          :integer          not null, primary key\ntype       ...
\n"],["ServiceHook","","classes/ServiceHook.html","","

Schema Information\n

Table name: web_hooks\n\n

id         :integer          not null, primary key\nurl        ...
\n"],["ServicesController","","classes/ServicesController.html","",""],["Snippet","","classes/Snippet.html","","

Schema Information\n

Table name: snippets\n\n

id         :integer          not null, primary key\ntitle      :string(255) ...
\n"],["SnippetsController","","classes/SnippetsController.html","",""],["SnippetsHelper","","classes/SnippetsHelper.html","",""],["StaticModel","","classes/StaticModel.html","","

Provides an ActiveRecord-like interface to a model whose data is not\npersisted to a database.\n"],["StaticModel::ClassMethods","","classes/StaticModel/ClassMethods.html","",""],["SystemHook","","classes/SystemHook.html","","

Schema Information\n

Table name: web_hooks\n\n

id         :integer          not null, primary key\nurl        ...
\n"],["SystemHookObserver","","classes/SystemHookObserver.html","",""],["SystemHookWorker","","classes/SystemHookWorker.html","",""],["TabHelper","","classes/TabHelper.html","",""],["TagsHelper","","classes/TagsHelper.html","",""],["Team","","classes/Team.html","",""],["TeamMembersController","","classes/TeamMembersController.html","",""],["TestHookContext","","classes/TestHookContext.html","",""],["Tree","","classes/Tree.html","",""],["TreeController","","classes/TreeController.html","","

Controller for viewing a repository’s file structure\n"],["TreeDecorator","","classes/TreeDecorator.html","",""],["TreeHelper","","classes/TreeHelper.html","",""],["User","","classes/User.html","","

Schema Information\n

Table name: users\n\n

id                     :integer          not null, primary key\nemail ...
\n"],["UserDecorator","","classes/UserDecorator.html","",""],["UserObserver","","classes/UserObserver.html","",""],["UsersProject","","classes/UsersProject.html","","

Schema Information\n

Table name: users_projects\n\n

id             :integer          not null, primary key\nuser_id ...
\n"],["UsersProjectObserver","","classes/UsersProjectObserver.html","",""],["Votes","","classes/Votes.html","",""],["WebHook","","classes/WebHook.html","","

Schema Information\n

Table name: web_hooks\n\n

id         :integer          not null, primary key\nurl        ...
\n"],["Wiki","","classes/Wiki.html","","

Schema Information\n

Table name: wikis\n\n

id         :integer          not null, primary key\ntitle      :string(255) ...
\n"],["WikisController","","classes/WikisController.html","",""],["==","StaticModel","classes/StaticModel.html#method-i-3D-3D","(other)",""],["[]","StaticModel","classes/StaticModel.html#method-i-5B-5D","(key)","

Used by AR for fetching attributes\n

Pass it along if we respond to it.\n"],["_indexes_of_changed_lines","Gitlab::InlineDiff","classes/Gitlab/InlineDiff.html#method-c-_indexes_of_changed_lines","(diff_arr)",""],["abilities","Account","classes/Account.html#method-i-abilities","()",""],["abilities","ApplicationController","classes/ApplicationController.html#method-i-abilities","()",""],["abilities","BaseContext","classes/BaseContext.html#method-i-abilities","()",""],["abilities","Grack::Auth","classes/Grack/Auth.html#method-i-abilities","()",""],["access_denied!","ApplicationController","classes/ApplicationController.html#method-i-access_denied-21","()",""],["access_options","Project","classes/Project.html#method-c-access_options","()",""],["access_roles","UsersProject","classes/UsersProject.html#method-c-access_roles","()",""],["account","ProfilesController","classes/ProfilesController.html#method-i-account","()",""],["action_name","Event","classes/Event.html#method-i-action_name","()",""],["activated?","GitlabCiService","classes/GitlabCiService.html#method-i-activated-3F","()",""],["active","Project","classes/Project.html#method-c-active","()",""],["active?","EventFilter","classes/EventFilter.html#method-i-active-3F","(key)",""],["add_abilities","ApplicationController","classes/ApplicationController.html#method-i-add_abilities","()",""],["add_access","Authority","classes/Authority.html#method-i-add_access","(user, *access)","

Compatible with all access rights Should be rewrited for new access rights\n"],["add_refs","Gitlab::Graph::Commit","classes/Gitlab/Graph/Commit.html#method-i-add_refs","(ref_cache, repo)",""],["add_user_id_to_team","Team","classes/Team.html#method-i-add_user_id_to_team","(user_id, access_role)","

Add user to project with passed access role by user id\n"],["add_user_to_team","Team","classes/Team.html#method-i-add_user_to_team","(user, access_role)","

Add user to project with passed access role\n"],["add_users_ids_to_team","Team","classes/Team.html#method-i-add_users_ids_to_team","(users_ids, access_role)","

Add multiple users to project with same access role by user ids\n"],["add_users_into_projects","UsersProject","classes/UsersProject.html#method-c-add_users_into_projects","(project_ids, user_ids, project_access)",""],["add_users_to_project_teams","Group","classes/Group.html#method-i-add_users_to_project_teams","(user_ids, project_access)",""],["add_users_to_team","Team","classes/Team.html#method-i-add_users_to_team","(users, access_role)","

Add multiple users to project with same access role\n"],["admin_all_repo","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-admin_all_repo","()","

Enable access to all repos for gitolite admin. We use it for accept merge\nrequest feature\n"],["admin_all_repo!","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-admin_all_repo-21","()",""],["after_commit","UsersProjectObserver","classes/UsersProjectObserver.html#method-i-after_commit","(users_project)",""],["after_create","ActivityObserver","classes/ActivityObserver.html#method-i-after_create","(record)",""],["after_create","IssueObserver","classes/IssueObserver.html#method-i-after_create","(issue)",""],["after_create","MergeRequestObserver","classes/MergeRequestObserver.html#method-i-after_create","(merge_request)",""],["after_create","NoteObserver","classes/NoteObserver.html#method-i-after_create","(note)",""],["after_create","ProjectObserver","classes/ProjectObserver.html#method-i-after_create","(project)",""],["after_create","SystemHookObserver","classes/SystemHookObserver.html#method-i-after_create","(model)",""],["after_create","UserObserver","classes/UserObserver.html#method-i-after_create","(user)",""],["after_create","UsersProjectObserver","classes/UsersProjectObserver.html#method-i-after_create","(users_project)",""],["after_destroy","KeyObserver","classes/KeyObserver.html#method-i-after_destroy","(key)",""],["after_destroy","ProjectObserver","classes/ProjectObserver.html#method-i-after_destroy","(project)",""],["after_destroy","SystemHookObserver","classes/SystemHookObserver.html#method-i-after_destroy","(model)",""],["after_destroy","UserObserver","classes/UserObserver.html#method-i-after_destroy","(user)",""],["after_destroy","UsersProjectObserver","classes/UsersProjectObserver.html#method-i-after_destroy","(users_project)",""],["after_save","ActivityObserver","classes/ActivityObserver.html#method-i-after_save","(record)",""],["after_save","KeyObserver","classes/KeyObserver.html#method-i-after_save","(key)",""],["after_save","UserObserver","classes/UserObserver.html#method-i-after_save","(user)",""],["after_sign_in_path_for","ApplicationController","classes/ApplicationController.html#method-i-after_sign_in_path_for","(resource)",""],["after_update","IssueObserver","classes/IssueObserver.html#method-i-after_update","(issue)",""],["after_update","MergeRequestObserver","classes/MergeRequestObserver.html#method-i-after_update","(merge_request)",""],["after_update","ProjectObserver","classes/ProjectObserver.html#method-i-after_update","(project)",""],["all_hooks_fire","SystemHook","classes/SystemHook.html#method-c-all_hooks_fire","(data)",""],["allow_read_for?","Authority","classes/Authority.html#method-i-allow_read_for-3F","(user)",""],["allowed","Ability","classes/Ability.html#method-c-allowed","(object, subject)",""],["allowed_tree_edit?","TreeHelper","classes/TreeHelper.html#method-i-allowed_tree_edit-3F","()",""],["app_theme","ApplicationHelper","classes/ApplicationHelper.html#method-i-app_theme","()",""],["apply","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-apply","()",""],["apply_filter","EventFilter","classes/EventFilter.html#method-i-apply_filter","(events)",""],["apply_import","TeamMembersController","classes/TeamMembersController.html#method-i-apply_import","()",""],["archive","RepositoriesController","classes/RepositoriesController.html#method-i-archive","()",""],["archive_repo","Repository","classes/Repository.html#method-i-archive_repo","(ref)","

Archive Project to .tar.gz\n

Already packed repo archives stored at\napp_root/tmp/repositories/project_name/project_name-commit-id.tag.gz …\n"],["assign_ref_vars","ExtractsPath","classes/ExtractsPath.html#method-i-assign_ref_vars","()","

Assigns common instance variables for views working with Git tree-ish\nobjects\n

Assignments are:\n

@id …\n"],["async_execute","SystemHook","classes/SystemHook.html#method-i-async_execute","(data)",""],["attributes_for_keys","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-attributes_for_keys","(keys)",""],["authbutton","ApplicationHelper","classes/ApplicationHelper.html#method-i-authbutton","(provider, size = 64)",""],["authenticate!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-authenticate-21","()",""],["authenticate_admin!","AdminController","classes/AdminController.html#method-i-authenticate_admin-21","()",""],["authenticated_as_admin!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-authenticated_as_admin-21","()",""],["author","Event","classes/Event.html#method-i-author","()",""],["author_email","Commit","classes/Commit.html#method-i-author_email","()",""],["author_id","Milestone","classes/Milestone.html#method-i-author_id","()",""],["author_link","CommitDecorator","classes/CommitDecorator.html#method-i-author_link","(options = {})","

Returns a link to the commit author. If the author has a matching user and\nis a member of the current …\n"],["author_name","Commit","classes/Commit.html#method-i-author_name","()",""],["authorize!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-authorize-21","(action, subject)",""],["authorize_admin_issue!","IssuesController","classes/IssuesController.html#method-i-authorize_admin_issue-21","()",""],["authorize_admin_merge_request!","MergeRequestsController","classes/MergeRequestsController.html#method-i-authorize_admin_merge_request-21","()",""],["authorize_admin_milestone!","MilestonesController","classes/MilestonesController.html#method-i-authorize_admin_milestone-21","()",""],["authorize_admin_snippet!","SnippetsController","classes/SnippetsController.html#method-i-authorize_admin_snippet-21","()",""],["authorize_code_access!","ApplicationController","classes/ApplicationController.html#method-i-authorize_code_access-21","()",""],["authorize_modify_issue!","IssuesController","classes/IssuesController.html#method-i-authorize_modify_issue-21","()",""],["authorize_modify_merge_request!","MergeRequestsController","classes/MergeRequestsController.html#method-i-authorize_modify_merge_request-21","()",""],["authorize_modify_snippet!","SnippetsController","classes/SnippetsController.html#method-i-authorize_modify_snippet-21","()",""],["authorize_project!","ApplicationController","classes/ApplicationController.html#method-i-authorize_project-21","(action)",""],["authorize_read_group!","GroupsController","classes/GroupsController.html#method-i-authorize_read_group-21","()","

Dont allow unauthorized access to group\n"],["authorized_for","Project","classes/Project.html#method-c-authorized_for","(user)",""],["authorized_groups","Account","classes/Account.html#method-i-authorized_groups","()",""],["authorized_projects","Account","classes/Account.html#method-i-authorized_projects","()",""],["authors","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-authors","()",""],["authors_count","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-authors_count","()",""],["automerge","MergeRequestsController","classes/MergeRequestsController.html#method-i-automerge","()",""],["automerge!","MergeRequest","classes/MergeRequest.html#method-i-automerge-21","(current_user)",""],["automerge_check","MergeRequestsController","classes/MergeRequestsController.html#method-i-automerge_check","()",""],["avatar_image","UserDecorator","classes/UserDecorator.html#method-i-avatar_image","(size = 16)",""],["base_class","StaticModel::ClassMethods","classes/StaticModel/ClassMethods.html#method-i-base_class","()","

Used by ActiveRecord’s polymorphic association to set object_type\n"],["base_space","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-base_space","(leaves, map)",""],["block","Account","classes/Account.html#method-i-block","()","

Remove user from all projects and set blocked attribute to true\n"],["block","Admin::UsersController","classes/Admin/UsersController.html#method-i-block","()",""],["block_code","Redcarpet::Render::GitlabHTML","classes/Redcarpet/Render/GitlabHTML.html#method-i-block_code","(code, language)",""],["branch?","PushEvent","classes/PushEvent.html#method-i-branch-3F","()",""],["branch_from","MergeRequestsController","classes/MergeRequestsController.html#method-i-branch_from","()",""],["branch_name","PushEvent","classes/PushEvent.html#method-i-branch_name","()",""],["branch_names","Repository","classes/Repository.html#method-i-branch_names","()","

Returns an Array of branch names\n"],["branch_to","MergeRequestsController","classes/MergeRequestsController.html#method-i-branch_to","()",""],["branches","RepositoriesController","classes/RepositoriesController.html#method-i-branches","()",""],["branches","Repository","classes/Repository.html#method-i-branches","()","

Returns an Array of Branches\n"],["branches_tab_class","TabHelper","classes/TabHelper.html#method-i-branches_tab_class","()",""],["breadcrumbs","TreeDecorator","classes/TreeDecorator.html#method-i-breadcrumbs","(max_links = 2)",""],["breadcrumbs","TreeHelper","classes/TreeHelper.html#method-i-breadcrumbs","()","

Breadcrumb links for a Project and, if applicable, a tree path\n"],["broken_diffs?","MergeRequest","classes/MergeRequest.html#method-i-broken_diffs-3F","()",""],["build","Gitlab::Logger","classes/Gitlab/Logger.html#method-c-build","()",""],["build_commit_note","Project","classes/Project.html#method-i-build_commit_note","(commit)",""],["build_graph","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-build_graph","(n = 4)",""],["build_line_anchor","CommitsHelper","classes/CommitsHelper.html#method-i-build_line_anchor","(index, line_new, line_old)",""],["build_page","GitlabCiService","classes/GitlabCiService.html#method-i-build_page","(sha)",""],["bulk_delete","UsersProject","classes/UsersProject.html#method-c-bulk_delete","(project, user_ids)",""],["bulk_import","UsersProject","classes/UsersProject.html#method-c-bulk_import","(project, user_ids, project_access)","

TODO: depreceate in future in favor of add_users_into_projects\n"],["bulk_update","IssuesController","classes/IssuesController.html#method-i-bulk_update","()",""],["bulk_update","UsersProject","classes/UsersProject.html#method-c-bulk_update","(project, user_ids, project_access)",""],["can?","Account","classes/Account.html#method-i-can-3F","(action, subject)",""],["can?","ApplicationController","classes/ApplicationController.html#method-i-can-3F","(object, action, subject)",""],["can?","BaseContext","classes/BaseContext.html#method-i-can-3F","(object, action, subject)",""],["can?","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-can-3F","(object, action, subject)",""],["can?","Grack::Auth","classes/Grack/Auth.html#method-i-can-3F","(object, action, subject)",""],["can_be_closed?","Milestone","classes/Milestone.html#method-i-can_be_closed-3F","()",""],["can_be_merged?","Gitlab::Satellite::MergeAction","classes/Gitlab/Satellite/MergeAction.html#method-i-can_be_merged-3F","()","

Checks if a merge request can be executed without user interaction\n"],["can_be_merged?","MergeRequest","classes/MergeRequest.html#method-i-can_be_merged-3F","()",""],["can_create_group?","Account","classes/Account.html#method-i-can_create_group-3F","()",""],["can_create_project?","Account","classes/Account.html#method-i-can_create_project-3F","()",""],["can_edit?","Gitlab::Satellite::EditFileAction","classes/Gitlab/Satellite/EditFileAction.html#method-i-can_edit-3F","(last_commit)",""],["cared_merge_requests","Account","classes/Account.html#method-i-cared_merge_requests","()",""],["changed_issue?","Event","classes/Event.html#method-i-changed_issue-3F","()",""],["changed_merge_request?","Event","classes/Event.html#method-i-changed_merge_request-3F","()",""],["check_if_can_be_merged","MergeRequest","classes/MergeRequest.html#method-i-check_if_can_be_merged","()",""],["check_limit","Project","classes/Project.html#method-i-check_limit","()",""],["check_validity!","FileSizeValidator","classes/FileSizeValidator.html#method-i-check_validity-21","()",""],["chief","NamespacedProject","classes/NamespacedProject.html#method-i-chief","()",""],["ci_build_details_path","MergeRequestsHelper","classes/MergeRequestsHelper.html#method-i-ci_build_details_path","(merge_request)",""],["ci_status","MergeRequestsController","classes/MergeRequestsController.html#method-i-ci_status","()",""],["clean_repo","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-clean_repo","(repo_name)",""],["clear_and_update!","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-clear_and_update-21","()",""],["closed?","Event","classes/Event.html#method-i-closed-3F","()",""],["closed_event","MergeRequest","classes/MergeRequest.html#method-i-closed_event","()",""],["closed_items_count","Milestone","classes/Milestone.html#method-i-closed_items_count","()",""],["code","Project","classes/Project.html#method-i-code","()","

For compatibility with old code\n"],["collect_authors","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-collect_authors","()",""],["collect_commits","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-collect_commits","()","

Get commits from repository\n"],["comments","EventFilter","classes/EventFilter.html#method-c-comments","()",""],["commit","ProtectedBranch","classes/ProtectedBranch.html#method-i-commit","()",""],["commit","Repository","classes/Repository.html#method-i-commit","(commit_id = nil)",""],["commit!","Gitlab::Satellite::EditFileAction","classes/Gitlab/Satellite/EditFileAction.html#method-i-commit-21","(content, commit_message, last_commit)","

Updates the files content and creates a new commit for it\n

Returns false if the ref has been updated while …\n"],["commit_author","Note","classes/Note.html#method-i-commit_author","()",""],["commit_badge_path","GitlabCiService","classes/GitlabCiService.html#method-i-commit_badge_path","(sha)",""],["commit_from","PushEvent","classes/PushEvent.html#method-i-commit_from","()",""],["commit_line_notes","Project","classes/Project.html#method-i-commit_line_notes","(commit)",""],["commit_notes","Project","classes/Project.html#method-i-commit_notes","(commit)",""],["commit_status","GitlabCiService","classes/GitlabCiService.html#method-i-commit_status","(sha)",""],["commit_status_path","GitlabCiService","classes/GitlabCiService.html#method-i-commit_status_path","(sha)",""],["commit_to","PushEvent","classes/PushEvent.html#method-i-commit_to","()",""],["commit_to_html","CommitsHelper","classes/CommitsHelper.html#method-i-commit_to_html","(commit)",""],["commits","Commit","classes/Commit.html#method-c-commits","(repo, ref, path = nil, limit = nil, offset = nil)",""],["commits","MergeRequest","classes/MergeRequest.html#method-i-commits","()",""],["commits","PushEvent","classes/PushEvent.html#method-i-commits","()","

Max 20 commits from push DESC\n"],["commits","Repository","classes/Repository.html#method-i-commits","(ref, path = nil, limit = nil, offset = nil)",""],["commits_between","Commit","classes/Commit.html#method-c-commits_between","(repo, from, to)",""],["commits_between","Repository","classes/Repository.html#method-i-commits_between","(from, to)",""],["commits_count","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-commits_count","()",""],["commits_count","PushEvent","classes/PushEvent.html#method-i-commits_count","()",""],["commits_since","Commit","classes/Commit.html#method-c-commits_since","(repo, date)",""],["commits_since","Repository","classes/Repository.html#method-i-commits_since","(date)",""],["commits_with_refs","Commit","classes/Commit.html#method-c-commits_with_refs","(repo, n = 20)",""],["commits_with_refs","Repository","classes/Repository.html#method-i-commits_with_refs","(n = 20)",""],["committer_email","Commit","classes/Commit.html#method-i-committer_email","()",""],["committer_link","CommitDecorator","classes/CommitDecorator.html#method-i-committer_link","(options = {})","

Just like #author_link but for the committer.\n"],["committer_name","Commit","classes/Commit.html#method-i-committer_name","()",""],["common_notes","Project","classes/Project.html#method-i-common_notes","()",""],["compare","Commit","classes/Commit.html#method-c-compare","(project, from, to)",""],["compose_service_hook","GitlabCiService","classes/GitlabCiService.html#method-i-compose_service_hook","()",""],["config","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-config","()",""],["content_types","Snippet","classes/Snippet.html#method-c-content_types","()",""],["create","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-create","()",""],["create","Admin::HooksController","classes/Admin/HooksController.html#method-i-create","()",""],["create","Admin::UsersController","classes/Admin/UsersController.html#method-i-create","()",""],["create","CompareController","classes/CompareController.html#method-i-create","()",""],["create","DeployKeysController","classes/DeployKeysController.html#method-i-create","()",""],["create","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-create","()",""],["create","HooksController","classes/HooksController.html#method-i-create","()",""],["create","IssuesController","classes/IssuesController.html#method-i-create","()",""],["create","KeysController","classes/KeysController.html#method-i-create","()",""],["create","MergeRequestsController","classes/MergeRequestsController.html#method-i-create","()",""],["create","MilestonesController","classes/MilestonesController.html#method-i-create","()",""],["create","NotesController","classes/NotesController.html#method-i-create","()",""],["create","ProjectsController","classes/ProjectsController.html#method-i-create","()",""],["create","ProtectedBranchesController","classes/ProtectedBranchesController.html#method-i-create","()",""],["create","SnippetsController","classes/SnippetsController.html#method-i-create","()",""],["create","TeamMembersController","classes/TeamMembersController.html#method-i-create","()",""],["create","WikisController","classes/WikisController.html#method-i-create","()",""],["create_by_user","Project","classes/Project.html#method-c-create_by_user","(params, user)",""],["create_from_omniauth","Gitlab::Auth","classes/Gitlab/Auth.html#method-i-create_from_omniauth","(auth, ldap = false)",""],["create_from_omniauth","User","classes/User.html#method-c-create_from_omniauth","(auth, ldap = false)",""],["create_repository","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-create_repository","(project)",""],["create_status_change_note","Note","classes/Note.html#method-c-create_status_change_note","(noteable, author, status)",""],["created_at","Commit","classes/Commit.html#method-i-created_at","()",""],["css_class_by_id","Gitlab::Theme","classes/Gitlab/Theme.html#method-c-css_class_by_id","(id)",""],["current_action?","ApplicationHelper","classes/ApplicationHelper.html#method-i-current_action-3F","(*args)","

Check if a partcular action is the current one\n

args - One or more action names to check\n

Examples\n"],["current_controller?","ApplicationHelper","classes/ApplicationHelper.html#method-i-current_controller-3F","(*args)","

Check if a particular controller is the current one\n

args - One or more controller names to check\n

Examples …\n"],["current_ref","Grack::Auth","classes/Grack/Auth.html#method-i-current_ref","()",""],["current_user","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-current_user","()",""],["dashboard_filter","DashboardController","classes/DashboardController.html#method-i-dashboard_filter","(items)",""],["dashboard_filter_path","DashboardHelper","classes/DashboardHelper.html#method-i-dashboard_filter_path","(entity, options={})",""],["data","Snippet","classes/Snippet.html#method-i-data","()",""],["default_filter","EventFilter","classes/EventFilter.html#method-c-default_filter","()",""],["default_regex","Gitlab::Regex","classes/Gitlab/Regex.html#method-i-default_regex","()",""],["define_show_vars","MergeRequestsController","classes/MergeRequestsController.html#method-i-define_show_vars","()",""],["define_tree_vars","RefsController","classes/RefsController.html#method-i-define_tree_vars","()",""],["delete_users_ids_from_team","Team","classes/Team.html#method-i-delete_users_ids_from_team","(users_ids)","

Delete multiple users from project by user ids\n"],["description","CommitDecorator","classes/CommitDecorator.html#method-i-description","()","

Returns the commits description\n

cut off, ellipses (`&hellp;`) are prepended to the commit message. …\n"],["design","ProfilesController","classes/ProfilesController.html#method-i-design","()",""],["destroy","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-destroy","()",""],["destroy","Admin::HooksController","classes/Admin/HooksController.html#method-i-destroy","()",""],["destroy","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-destroy","()",""],["destroy","Admin::TeamMembersController","classes/Admin/TeamMembersController.html#method-i-destroy","()",""],["destroy","Admin::UsersController","classes/Admin/UsersController.html#method-i-destroy","()",""],["destroy","DeployKeysController","classes/DeployKeysController.html#method-i-destroy","()",""],["destroy","HooksController","classes/HooksController.html#method-i-destroy","()",""],["destroy","KeysController","classes/KeysController.html#method-i-destroy","()",""],["destroy","MilestonesController","classes/MilestonesController.html#method-i-destroy","()",""],["destroy","NotesController","classes/NotesController.html#method-i-destroy","()",""],["destroy","ProjectsController","classes/ProjectsController.html#method-i-destroy","()",""],["destroy","ProtectedBranchesController","classes/ProtectedBranchesController.html#method-i-destroy","()",""],["destroy","SnippetsController","classes/SnippetsController.html#method-i-destroy","()",""],["destroy","TeamMembersController","classes/TeamMembersController.html#method-i-destroy","()",""],["destroy","WikisController","classes/WikisController.html#method-i-destroy","()",""],["destroy_project","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-destroy_project","(project)",""],["destroy_project!","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-destroy_project-21","(project)",""],["destroy_repository","Repository","classes/Repository.html#method-i-destroy_repository","()",""],["destroyed?","StaticModel","classes/StaticModel.html#method-i-destroyed-3F","()",""],["determine_action","Event","classes/Event.html#method-c-determine_action","(record)",""],["dev_access_for?","Authority","classes/Authority.html#method-i-dev_access_for-3F","(user)",""],["dev_tools","ApplicationController","classes/ApplicationController.html#method-i-dev_tools","()",""],["diff_line_content","CommitsHelper","classes/CommitsHelper.html#method-i-diff_line_content","(line)",""],["different_committer?","Commit","classes/Commit.html#method-i-different_committer-3F","()","

Was this commit committed by a different person than the original author?\n"],["diffs","MergeRequest","classes/MergeRequest.html#method-i-diffs","()",""],["diffs","MergeRequestsController","classes/MergeRequestsController.html#method-i-diffs","()",""],["dir_exists?","Namespace","classes/Namespace.html#method-i-dir_exists-3F","()",""],["discover_default_branch","Repository","classes/Repository.html#method-i-discover_default_branch","()","

Discovers the default branch based on the repository’s available branches\n

If no branches are present, …\n"],["downvote?","Note","classes/Note.html#method-i-downvote-3F","()","

Returns true if this is a downvote note, otherwise false is returned\n"],["downvotes","Votes","classes/Votes.html#method-i-downvotes","()","

Return the number of -1 comments (downvotes)\n"],["downvotes_in_percent","Votes","classes/Votes.html#method-i-downvotes_in_percent","()",""],["each_diff_line","CommitsHelper","classes/CommitsHelper.html#method-i-each_diff_line","(diff_arr, index)",""],["edit","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-edit","()",""],["edit","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-edit","()",""],["edit","Admin::TeamMembersController","classes/Admin/TeamMembersController.html#method-i-edit","()",""],["edit","Admin::UsersController","classes/Admin/UsersController.html#method-i-edit","()",""],["edit","IssuesController","classes/IssuesController.html#method-i-edit","()",""],["edit","MergeRequestsController","classes/MergeRequestsController.html#method-i-edit","()",""],["edit","MilestonesController","classes/MilestonesController.html#method-i-edit","()",""],["edit","ProjectsController","classes/ProjectsController.html#method-i-edit","()",""],["edit","ServicesController","classes/ServicesController.html#method-i-edit","()",""],["edit","SnippetsController","classes/SnippetsController.html#method-i-edit","()",""],["edit","TreeController","classes/TreeController.html#method-i-edit","()",""],["edit","WikisController","classes/WikisController.html#method-i-edit","()",""],["emoji_autocomplete_source","ApplicationHelper","classes/ApplicationHelper.html#method-i-emoji_autocomplete_source","()",""],["empty?","Tree","classes/Tree.html#method-i-empty-3F","()",""],["empty_repo?","Repository","classes/Repository.html#method-i-empty_repo-3F","()",""],["enable_automerge","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-enable_automerge","()",""],["ensure_dir_exist","Namespace","classes/Namespace.html#method-i-ensure_dir_exist","()",""],["entities_per_project","DashboardHelper","classes/DashboardHelper.html#method-i-entities_per_project","(project, entity)",""],["error","Gitlab::Logger","classes/Gitlab/Logger.html#method-c-error","(message)",""],["event_action_name","EventsHelper","classes/EventsHelper.html#method-i-event_action_name","(event)",""],["event_filter","DashboardController","classes/DashboardController.html#method-i-event_filter","()",""],["event_filter_link","EventsHelper","classes/EventsHelper.html#method-i-event_filter_link","(key, tooltip)",""],["event_image","EventsHelper","classes/EventsHelper.html#method-i-event_image","(event)",""],["execute","CommitLoadContext","classes/CommitLoadContext.html#method-i-execute","()",""],["execute","Gitlab::ProjectMover","classes/Gitlab/ProjectMover.html#method-i-execute","()",""],["execute","IssuesBulkUpdateContext","classes/IssuesBulkUpdateContext.html#method-i-execute","()",""],["execute","IssuesListContext","classes/IssuesListContext.html#method-i-execute","()",""],["execute","MergeRequestsLoadContext","classes/MergeRequestsLoadContext.html#method-i-execute","()",""],["execute","Notes::CreateContext","classes/Notes/CreateContext.html#method-i-execute","()",""],["execute","Notes::LoadContext","classes/Notes/LoadContext.html#method-i-execute","()",""],["execute","ProjectUpdateContext","classes/ProjectUpdateContext.html#method-i-execute","(role = :default)",""],["execute","SearchContext","classes/SearchContext.html#method-i-execute","()",""],["execute","TestHookContext","classes/TestHookContext.html#method-i-execute","()",""],["execute","WebHook","classes/WebHook.html#method-i-execute","(data)",""],["execute_hooks","PushObserver","classes/PushObserver.html#method-i-execute_hooks","(data)",""],["execute_services","PushObserver","classes/PushObserver.html#method-i-execute_services","(data)",""],["exists?","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-exists-3F","()",""],["expired?","Milestone","classes/Milestone.html#method-i-expired-3F","()",""],["expired?","Snippet","classes/Snippet.html#method-i-expired-3F","()",""],["expires_at","Milestone","classes/Milestone.html#method-i-expires_at","()",""],["extract_ref","ExtractsPath","classes/ExtractsPath.html#method-i-extract_ref","(input)","

Given a string containing both a Git tree-ish, such as a branch or tag, and\na filesystem path joined …\n"],["failure_message","OmniauthCallbacksController","classes/OmniauthCallbacksController.html#method-i-failure_message","()","

Extend the standard message generation to accept our custom exception\n"],["feed_summary","EventDecorator","classes/EventDecorator.html#method-i-feed_summary","()",""],["feed_title","EventDecorator","classes/EventDecorator.html#method-i-feed_title","()",""],["feed_url","EventDecorator","classes/EventDecorator.html#method-i-feed_url","()",""],["file_name","Gitlab::AppLogger","classes/Gitlab/AppLogger.html#method-c-file_name","()",""],["file_name","Gitlab::GitLogger","classes/Gitlab/GitLogger.html#method-c-file_name","()",""],["files","ProjectsController","classes/ProjectsController.html#method-i-files","()",""],["files_count","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-files_count","()",""],["filter","User","classes/User.html#method-c-filter","(filter_name)",""],["find_all_by_branch","MergeRequest","classes/MergeRequest.html#method-c-find_all_by_branch","(branch_name)",""],["find_all_by_milestone","MergeRequest","classes/MergeRequest.html#method-c-find_all_by_milestone","(milestone)",""],["find_for_ldap_auth","Gitlab::Auth","classes/Gitlab/Auth.html#method-i-find_for_ldap_auth","(auth, signed_in_resource = nil)",""],["find_for_ldap_auth","User","classes/User.html#method-c-find_for_ldap_auth","(auth, signed_in_resource = nil)",""],["find_free_space","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-find_free_space","(leaves, map)",""],["find_or_first","Commit","classes/Commit.html#method-c-find_or_first","(repo, commit_id = nil, root_ref)",""],["find_or_new_for_omniauth","Gitlab::Auth","classes/Gitlab/Auth.html#method-i-find_or_new_for_omniauth","(auth)",""],["find_or_new_for_omniauth","User","classes/User.html#method-c-find_or_new_for_omniauth","(auth)",""],["find_project","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-find_project","()",""],["find_with_namespace","Project","classes/Project.html#method-c-find_with_namespace","(id)",""],["fingerprintable_key","Key","classes/Key.html#method-i-fingerprintable_key","()",""],["first_name","Account","classes/Account.html#method-i-first_name","()",""],["for_commit?","Note","classes/Note.html#method-i-for_commit-3F","()",""],["for_diff_line?","Note","classes/Note.html#method-i-for_diff_line-3F","()",""],["forbidden!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-forbidden-21","()","

error helpers\n"],["format_message","Gitlab::AppLogger","classes/Gitlab/AppLogger.html#method-i-format_message","(severity, timestamp, progname, msg)",""],["format_message","Gitlab::GitLogger","classes/Gitlab/GitLogger.html#method-i-format_message","(severity, timestamp, progname, msg)",""],["fresh_commits","Commit","classes/Commit.html#method-c-fresh_commits","(repo, n = 10)",""],["fresh_commits","Repository","classes/Repository.html#method-i-fresh_commits","(n = 10)",""],["generate_password","User","classes/User.html#method-i-generate_password","()",""],["gfm","Gitlab::Markdown","classes/Gitlab/Markdown.html#method-i-gfm","(text, html_options = {})","

Public: Parse the provided text with GitLab-Flavored Markdown\n

text - the source text html_options …\n"],["git_error?","Project","classes/Project.html#method-i-git_error-3F","()",""],["git_host","GitHost","classes/GitHost.html#method-i-git_host","()",""],["git_not_found!","ApplicationController","classes/ApplicationController.html#method-i-git_not_found-21","()",""],["githost","ErrorsController","classes/ErrorsController.html#method-i-githost","()",""],["gitlab_auth","User","classes/User.html#method-c-gitlab_auth","()",""],["gitlab_ci?","Project","classes/Project.html#method-i-gitlab_ci-3F","()",""],["gitlab_markdown?","TreeHelper","classes/TreeHelper.html#method-i-gitlab_markdown-3F","(filename)",""],["global_id","Namespace","classes/Namespace.html#method-c-global_id","()",""],["graph","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-i-graph","()",""],["graph","ProjectsController","classes/ProjectsController.html#method-i-graph","()",""],["gravatar_icon","ApplicationHelper","classes/ApplicationHelper.html#method-i-gravatar_icon","(user_email = '', size = nil)",""],["group","GroupsController","classes/GroupsController.html#method-i-group","()",""],["group_abilities","Ability","classes/Ability.html#method-c-group_abilities","(user, group)",""],["grouped_options_refs","ApplicationHelper","classes/ApplicationHelper.html#method-i-grouped_options_refs","(destination = :tree)",""],["grouper_project_members","ProjectsHelper","classes/ProjectsHelper.html#method-i-grouper_project_members","(project)",""],["guest_access_for?","Authority","classes/Authority.html#method-i-guest_access_for-3F","(user)",""],["has_commits?","Repository","classes/Repository.html#method-i-has_commits-3F","()",""],["has_post_receive_file?","Repository","classes/Repository.html#method-i-has_post_receive_file-3F","()",""],["heads","Repository","classes/Repository.html#method-i-heads","()",""],["help","FileSizeValidator","classes/FileSizeValidator.html#method-i-help","()",""],["hexdigest","ApplicationHelper","classes/ApplicationHelper.html#method-i-hexdigest","(string)",""],["history","ProfilesController","classes/ProfilesController.html#method-i-history","()",""],["history","WikisController","classes/WikisController.html#method-i-history","()",""],["hook_file","Repository","classes/Repository.html#method-i-hook_file","()",""],["http_url_to_repo","Repository","classes/Repository.html#method-i-http_url_to_repo","()",""],["human_name","Group","classes/Group.html#method-i-human_name","()",""],["human_name","Namespace","classes/Namespace.html#method-i-human_name","()",""],["human_state","MergeRequest","classes/MergeRequest.html#method-i-human_state","()",""],["identification_type","CommitsHelper","classes/CommitsHelper.html#method-i-identification_type","(line)",""],["identifier","Account","classes/Account.html#method-i-identifier","()","

Returns a string for use as a Gitolite user identifier\n

Note that Gitolite 2.x requires the following pattern …\n"],["image_diff_class","CommitsHelper","classes/CommitsHelper.html#method-i-image_diff_class","(diff)",""],["import_team","UsersProject","classes/UsersProject.html#method-c-import_team","(source_project, target_project)",""],["in_locked_and_timed_satellite","Gitlab::Satellite::Action","classes/Gitlab/Satellite/Action.html#method-i-in_locked_and_timed_satellite","()","

Sets a 30s timeout for Git\n

Locks the satellite repo\n

Yields the prepared satellite repo\n"],["index","Admin::DashboardController","classes/Admin/DashboardController.html#method-i-index","()",""],["index","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-index","()",""],["index","Admin::HooksController","classes/Admin/HooksController.html#method-i-index","()",""],["index","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-index","()",""],["index","Admin::UsersController","classes/Admin/UsersController.html#method-i-index","()",""],["index","CompareController","classes/CompareController.html#method-i-index","()",""],["index","DashboardController","classes/DashboardController.html#method-i-index","()",""],["index","DeployKeysController","classes/DeployKeysController.html#method-i-index","()",""],["index","HelpController","classes/HelpController.html#method-i-index","()",""],["index","HooksController","classes/HooksController.html#method-i-index","()",""],["index","IssuesController","classes/IssuesController.html#method-i-index","()",""],["index","KeysController","classes/KeysController.html#method-i-index","()",""],["index","LabelsController","classes/LabelsController.html#method-i-index","()",""],["index","MergeRequestsController","classes/MergeRequestsController.html#method-i-index","()",""],["index","MilestonesController","classes/MilestonesController.html#method-i-index","()",""],["index","NotesController","classes/NotesController.html#method-i-index","()",""],["index","ProtectedBranchesController","classes/ProtectedBranchesController.html#method-i-index","()",""],["index","ServicesController","classes/ServicesController.html#method-i-index","()",""],["index","SnippetsController","classes/SnippetsController.html#method-i-index","()",""],["index","TeamMembersController","classes/TeamMembersController.html#method-i-index","()",""],["index_commits","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-index_commits","()","

Method is adding time and space on the list of commits. As well as returns\ndate list corelated with time …\n"],["info","Gitlab::Logger","classes/Gitlab/Logger.html#method-c-info","(message)",""],["invalid?","Tree","classes/Tree.html#method-i-invalid-3F","()",""],["is_admin?","Account","classes/Account.html#method-i-is_admin-3F","()",""],["is_assigned?","IssueCommonality","classes/IssueCommonality.html#method-i-is_assigned-3F","()",""],["is_being_closed?","IssueCommonality","classes/IssueCommonality.html#method-i-is_being_closed-3F","()",""],["is_being_reassigned?","IssueCommonality","classes/IssueCommonality.html#method-i-is_being_reassigned-3F","()",""],["is_being_reopened?","IssueCommonality","classes/IssueCommonality.html#method-i-is_being_reopened-3F","()",""],["is_blob?","Tree","classes/Tree.html#method-i-is_blob-3F","()",""],["is_deploy_key","Key","classes/Key.html#method-i-is_deploy_key","()",""],["is_empty?","Milestone","classes/Milestone.html#method-i-is_empty-3F","()",""],["issue","Event","classes/Event.html#method-i-issue","()",""],["issue","IssuesController","classes/IssuesController.html#method-i-issue","()",""],["issue?","Event","classes/Event.html#method-i-issue-3F","()",""],["issue_css_classes","IssuesHelper","classes/IssuesHelper.html#method-i-issue_css_classes","(issue)",""],["issue_status_changed_email","Notify","classes/Notify.html#method-i-issue_status_changed_email","(recipient_id, issue_id, status, updated_by_user_id)",""],["issue_tags","IssuesHelper","classes/IssuesHelper.html#method-i-issue_tags","()",""],["issues","DashboardController","classes/DashboardController.html#method-i-issues","()","

Get only assigned issues\n"],["issues","GroupsController","classes/GroupsController.html#method-i-issues","()","

Get only assigned issues\n"],["issues_active_milestones","IssuesHelper","classes/IssuesHelper.html#method-i-issues_active_milestones","()",""],["issues_filter","IssuesHelper","classes/IssuesHelper.html#method-i-issues_filter","()",""],["issues_filtered","IssuesController","classes/IssuesController.html#method-i-issues_filtered","()",""],["issues_labels","Project","classes/Project.html#method-i-issues_labels","()",""],["items_for","Project","classes/Project.html#method-i-items_for","(entity)",""],["joined?","Event","classes/Event.html#method-i-joined-3F","()",""],["labels_autocomplete_source","IssuesHelper","classes/IssuesHelper.html#method-i-labels_autocomplete_source","()",""],["last_activity","Project","classes/Project.html#method-i-last_activity","()",""],["last_activity_date","Project","classes/Project.html#method-i-last_activity_date","()",""],["last_activity_project","Account","classes/Account.html#method-i-last_activity_project","()",""],["last_commit","ApplicationHelper","classes/ApplicationHelper.html#method-i-last_commit","(project)",""],["last_commit","MergeRequest","classes/MergeRequest.html#method-i-last_commit","()",""],["last_commit","PushEvent","classes/PushEvent.html#method-i-last_commit","()",""],["last_commit_for","Repository","classes/Repository.html#method-i-last_commit_for","(ref, path = nil)",""],["last_commit_short_sha","MergeRequest","classes/MergeRequest.html#method-i-last_commit_short_sha","()",""],["last_deploy?","Key","classes/Key.html#method-i-last_deploy-3F","()",""],["last_push_to_non_root?","PushEvent","classes/PushEvent.html#method-i-last_push_to_non_root-3F","()",""],["ldap","OmniauthCallbacksController","classes/OmniauthCallbacksController.html#method-i-ldap","()",""],["ldap_enable?","ApplicationHelper","classes/ApplicationHelper.html#method-i-ldap_enable-3F","()",""],["left?","Event","classes/Event.html#method-i-left-3F","()",""],["lifetime_select_options","SnippetsHelper","classes/SnippetsHelper.html#method-i-lifetime_select_options","()",""],["link_title","CommitDecorator","classes/CommitDecorator.html#method-i-link_title","()","

Returns a string describing the commit for use in a link title\n

Example\n\n

"Commit: Alex Denisov - Project ...
\n"],["link_to_author","EventsHelper","classes/EventsHelper.html#method-i-link_to_author","(event)",""],["link_to_commit_diff_line_note","NotesHelper","classes/NotesHelper.html#method-i-link_to_commit_diff_line_note","(note)",""],["link_to_gfm","GitlabMarkdownHelper","classes/GitlabMarkdownHelper.html#method-i-link_to_gfm","(body, url, html_options = {})","

Use this in places where you would normally use link_to(gfm(…), …).\n

It solves a problem occurring …\n"],["link_to_member","ProjectsHelper","classes/ProjectsHelper.html#method-i-link_to_member","(project, author)",""],["link_to_project","ProjectsHelper","classes/ProjectsHelper.html#method-i-link_to_project","(project)",""],["loading_more_notes?","NotesHelper","classes/NotesHelper.html#method-i-loading_more_notes-3F","()",""],["loading_new_notes?","NotesHelper","classes/NotesHelper.html#method-i-loading_new_notes-3F","()",""],["lock","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-lock","()","

Locks the satellite\n

Changes the current directory to the satellite’s working dir\n

Yields\n"],["lock_file","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-lock_file","()",""],["log","Gitlab::Auth","classes/Gitlab/Auth.html#method-i-log","()",""],["log","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-log","(message)",""],["log_exception","ApplicationController","classes/ApplicationController.html#method-i-log_exception","(exception)",""],["log_info","Gitlab::ProjectMover","classes/Gitlab/ProjectMover.html#method-i-log_info","(message)",""],["log_info","ProjectObserver","classes/ProjectObserver.html#method-i-log_info","(message)",""],["log_info","UserObserver","classes/UserObserver.html#method-i-log_info","(message)",""],["logs_tree","RefsController","classes/RefsController.html#method-i-logs_tree","()",""],["mark_as_merged!","MergeRequest","classes/MergeRequest.html#method-i-mark_as_merged-21","()",""],["mark_as_unchecked","MergeRequest","classes/MergeRequest.html#method-i-mark_as_unchecked","()",""],["mark_as_unmergable","MergeRequest","classes/MergeRequest.html#method-i-mark_as_unmergable","()",""],["mark_reserved","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-mark_reserved","(time_range, space)",""],["markdown","GitlabMarkdownHelper","classes/GitlabMarkdownHelper.html#method-i-markdown","(text)",""],["markup?","TreeHelper","classes/TreeHelper.html#method-i-markup-3F","(filename)","

Public: Determines if a given filename is compatible with GitHub::Markup.\n

filename - Filename string to …\n"],["master_access_for?","Authority","classes/Authority.html#method-i-master_access_for-3F","(user)",""],["max_count","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-c-max_count","()",""],["md_ref?","PushEvent","classes/PushEvent.html#method-i-md_ref-3F","()",""],["membership_changed?","Event","classes/Event.html#method-i-membership_changed-3F","()",""],["merge!","Gitlab::Satellite::MergeAction","classes/Gitlab/Satellite/MergeAction.html#method-i-merge-21","()","

Merges the source branch into the target branch in the satellite and pushes\nit back to Gitolite. It also …\n"],["merge!","MergeRequest","classes/MergeRequest.html#method-i-merge-21","(user_id)",""],["merge_event","MergeRequest","classes/MergeRequest.html#method-i-merge_event","()",""],["merge_request","Event","classes/Event.html#method-i-merge_request","()",""],["merge_request","MergeRequestsController","classes/MergeRequestsController.html#method-i-merge_request","()",""],["merge_request?","Event","classes/Event.html#method-i-merge_request-3F","()",""],["merge_requests","DashboardController","classes/DashboardController.html#method-i-merge_requests","()","

Get authored or assigned open merge requests\n"],["merge_requests","GroupsController","classes/GroupsController.html#method-i-merge_requests","()","

Get authored or assigned open merge requests\n"],["merged","EventFilter","classes/EventFilter.html#method-c-merged","()",""],["merged?","Event","classes/Event.html#method-i-merged-3F","()",""],["merged?","MergeRequest","classes/MergeRequest.html#method-i-merged-3F","()",""],["method_missing","ApplicationController","classes/ApplicationController.html#method-i-method_missing","(method_sym, *arguments, &block)",""],["method_missing","Gitlab::Graph::Commit","classes/Gitlab/Graph/Commit.html#method-i-method_missing","(m, *args, &block)",""],["milestone","MilestonesController","classes/MilestonesController.html#method-i-milestone","()",""],["milestone?","Event","classes/Event.html#method-i-milestone-3F","()",""],["mode","Snippet","classes/Snippet.html#method-i-mode","()",""],["module_enabled","IssuesController","classes/IssuesController.html#method-i-module_enabled","()",""],["module_enabled","LabelsController","classes/LabelsController.html#method-i-module_enabled","()",""],["module_enabled","MergeRequestsController","classes/MergeRequestsController.html#method-i-module_enabled","()",""],["module_enabled","MilestonesController","classes/MilestonesController.html#method-i-module_enabled","()",""],["move_dir","Namespace","classes/Namespace.html#method-i-move_dir","()",""],["move_repository","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-move_repository","(old_repo, project)",""],["mr_and_commit_notes","MergeRequest","classes/MergeRequest.html#method-i-mr_and_commit_notes","()",""],["mr_css_classes","MergeRequestsHelper","classes/MergeRequestsHelper.html#method-i-mr_css_classes","(mr)",""],["my_own_projects","Account","classes/Account.html#method-i-my_own_projects","()",""],["name","Snippet","classes/Snippet.html#method-i-name","()",""],["name_with_namespace","NamespacedProject","classes/NamespacedProject.html#method-i-name_with_namespace","()",""],["namespace_dir","Repository","classes/Repository.html#method-i-namespace_dir","()",""],["namespace_full_path","Namespace","classes/Namespace.html#method-i-namespace_full_path","()",""],["namespace_id","Account","classes/Account.html#method-i-namespace_id","()",""],["namespace_owner","NamespacedProject","classes/NamespacedProject.html#method-i-namespace_owner","()",""],["namespaces","Account","classes/Account.html#method-i-namespaces","()",""],["namespaces_options","NamespacesHelper","classes/NamespacesHelper.html#method-i-namespaces_options","(selected = :current_user, scope = :default)",""],["nav_link","TabHelper","classes/TabHelper.html#method-i-nav_link","(options = {}, &block)","

Navigation link helper\n

Returns an `li` element with an ‘active’ class if the supplied\ncontroller(s) and/or …\n"],["nav_tab","TabHelper","classes/TabHelper.html#method-i-nav_tab","(key, value, &block)","

Use nav_tab for save controller/action but different params\n"],["new","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-new","()",""],["new","Admin::UsersController","classes/Admin/UsersController.html#method-i-new","()",""],["new","BaseContext","classes/BaseContext.html#method-c-new","(project, user, params)",""],["new","Commit","classes/Commit.html#method-c-new","(raw_commit, head = nil)",""],["new","DeployKeysController","classes/DeployKeysController.html#method-i-new","()",""],["new","EventFilter","classes/EventFilter.html#method-c-new","(params)",""],["new","FileSizeValidator","classes/FileSizeValidator.html#method-c-new","(options)",""],["new","Gitlab::GitStats","classes/Gitlab/GitStats.html#method-c-new","(repo, ref)",""],["new","Gitlab::Graph::Commit","classes/Gitlab/Graph/Commit.html#method-c-new","(commit)",""],["new","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-c-new","(project)",""],["new","Gitlab::ProjectMover","classes/Gitlab/ProjectMover.html#method-c-new","(project, old_dir, new_dir)",""],["new","Gitlab::Satellite::Action","classes/Gitlab/Satellite/Action.html#method-c-new","(user, project, options = {})",""],["new","Gitlab::Satellite::EditFileAction","classes/Gitlab/Satellite/EditFileAction.html#method-c-new","(user, project, ref, file_path)",""],["new","Gitlab::Satellite::MergeAction","classes/Gitlab/Satellite/MergeAction.html#method-c-new","(user, merge_request)",""],["new","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-c-new","(project)",""],["new","IssuesController","classes/IssuesController.html#method-i-new","()",""],["new","KeysController","classes/KeysController.html#method-i-new","()",""],["new","MergeRequestsController","classes/MergeRequestsController.html#method-i-new","()",""],["new","MilestonesController","classes/MilestonesController.html#method-i-new","()",""],["new","ProjectsController","classes/ProjectsController.html#method-i-new","()",""],["new","Redcarpet::Render::GitlabHTML","classes/Redcarpet/Render/GitlabHTML.html#method-c-new","(template, options = {})",""],["new","SearchContext","classes/SearchContext.html#method-c-new","(project_ids, params)",""],["new","SnippetsController","classes/SnippetsController.html#method-i-new","()",""],["new","TeamMembersController","classes/TeamMembersController.html#method-i-new","()",""],["new","Tree","classes/Tree.html#method-c-new","(raw_tree, project, ref = nil, path = nil)",""],["new?","IssueCommonality","classes/IssueCommonality.html#method-i-new-3F","()",""],["new_branch?","PushEvent","classes/PushEvent.html#method-i-new_branch-3F","()",""],["new_issue?","Event","classes/Event.html#method-i-new_issue-3F","()",""],["new_issue_email","Notify","classes/Notify.html#method-i-new_issue_email","(issue_id)","

Issue\n"],["new_merge_request?","Event","classes/Event.html#method-i-new_merge_request-3F","()",""],["new_merge_request_email","Notify","classes/Notify.html#method-i-new_merge_request_email","(merge_request_id)","

Merge Request\n"],["new_mr_path_from_push_event","MergeRequestsHelper","classes/MergeRequestsHelper.html#method-i-new_mr_path_from_push_event","(event)",""],["new_record?","StaticModel","classes/StaticModel.html#method-i-new_record-3F","()",""],["new_ref?","PushEvent","classes/PushEvent.html#method-i-new_ref-3F","()",""],["new_user_email","Notify","classes/Notify.html#method-i-new_user_email","(user_id, password)","

User\n"],["no_cache_headers","ApplicationController","classes/ApplicationController.html#method-i-no_cache_headers","()",""],["no_commit_message","CommitDecorator","classes/CommitDecorator.html#method-i-no_commit_message","()",""],["not_allowed!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-not_allowed-21","()",""],["not_found!","ApplicationController","classes/ApplicationController.html#method-i-not_found-21","()",""],["not_found!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-not_found-21","(resource = nil)",""],["not_in_project","User","classes/User.html#method-c-not_in_project","(project)",""],["note?","Event","classes/Event.html#method-i-note-3F","()",""],["note_commit?","NoteEvent","classes/NoteEvent.html#method-i-note_commit-3F","()",""],["note_commit_email","Notify","classes/Notify.html#method-i-note_commit_email","(recipient_id, note_id)","

Note\n"],["note_commit_id","NoteEvent","classes/NoteEvent.html#method-i-note_commit_id","()",""],["note_for_main_target?","NotesHelper","classes/NotesHelper.html#method-i-note_for_main_target-3F","(note)","

Helps to distinguish e.g. commit notes in mr notes list\n"],["note_issue_email","Notify","classes/Notify.html#method-i-note_issue_email","(recipient_id, note_id)",""],["note_merge_request_email","Notify","classes/Notify.html#method-i-note_merge_request_email","(recipient_id, note_id)",""],["note_short_commit_id","NoteEvent","classes/NoteEvent.html#method-i-note_short_commit_id","()",""],["note_target","NoteEvent","classes/NoteEvent.html#method-i-note_target","()",""],["note_target_id","NoteEvent","classes/NoteEvent.html#method-i-note_target_id","()",""],["note_target_type","NoteEvent","classes/NoteEvent.html#method-i-note_target_type","()",""],["note_wall_email","Notify","classes/Notify.html#method-i-note_wall_email","(recipient_id, note_id)",""],["noteable","Note","classes/Note.html#method-i-noteable","()","

override to return commits, which are not active record\n"],["noteable_type_name","Note","classes/Note.html#method-i-noteable_type_name","()",""],["notes","NotesController","classes/NotesController.html#method-i-notes","()",""],["notify_only_author?","Note","classes/Note.html#method-i-notify_only_author-3F","(user)","

Check if we can notify commit author with email about our comment\n

If commit author email exist in project …\n"],["notify_team","NoteObserver","classes/NoteObserver.html#method-i-notify_team","(note)","

Notifies the whole team except the author of note\n"],["oauth_active_class","ProfileHelper","classes/ProfileHelper.html#method-i-oauth_active_class","(provider)",""],["observe_push","PushObserver","classes/PushObserver.html#method-i-observe_push","(data)",""],["open?","MergeRequest","classes/MergeRequest.html#method-i-open-3F","()",""],["open?","Milestone","classes/Milestone.html#method-i-open-3F","()",""],["open_branches","Repository","classes/Repository.html#method-i-open_branches","()",""],["open_for","Issue","classes/Issue.html#method-c-open_for","(user)",""],["open_items_count","Milestone","classes/Milestone.html#method-i-open_items_count","()",""],["options","EventFilter","classes/EventFilter.html#method-i-options","(key)",""],["pages","WikisController","classes/WikisController.html#method-i-pages","()",""],["paginate","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-paginate","(object)",""],["parent_commit","PushEvent","classes/PushEvent.html#method-i-parent_commit","()",""],["parents_count","Commit","classes/Commit.html#method-i-parents_count","()",""],["participants","Milestone","classes/Milestone.html#method-i-participants","()",""],["path","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-path","()",""],["path_regex","Gitlab::Regex","classes/Gitlab/Regex.html#method-i-path_regex","()",""],["path_to_repo","Repository","classes/Repository.html#method-i-path_to_repo","()",""],["path_with_namespace","NamespacedProject","classes/NamespacedProject.html#method-i-path_with_namespace","()",""],["people","GroupsController","classes/GroupsController.html#method-i-people","()",""],["percent_complete","Milestone","classes/Milestone.html#method-i-percent_complete","()",""],["perform","PostReceive","classes/PostReceive.html#method-c-perform","(repo_path, oldrev, newrev, ref, identifier)",""],["perform","SystemHookWorker","classes/SystemHookWorker.html#method-c-perform","(hook_id, data)",""],["persisted?","StaticModel","classes/StaticModel.html#method-i-persisted-3F","()",""],["person_link","CommitDecorator","classes/CommitDecorator.html#method-i-person_link","(options = {})","

Private: Returns a link to a person. If the person has a matching user and\nis a member of the current …\n"],["place_chain","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-place_chain","(commit, map, parent_time = nil)","

Add space mark on commit and its parents\n

@param [Graph::Commit] the commit object. @param [Hash<String …\n"],["plain_text_readme?","TreeHelper","classes/TreeHelper.html#method-i-plain_text_readme-3F","(filename)",""],["post_receive_data","PushObserver","classes/PushObserver.html#method-i-post_receive_data","(oldrev, newrev, ref, user)","

Produce a hash of post-receive data\n

data = {\n\n

before: String,\nafter: String,\nref: String,\nuser_id: String, ...
\n"],["postprocess","Redcarpet::Render::GitlabHTML","classes/Redcarpet/Render/GitlabHTML.html#method-i-postprocess","(full_document)",""],["prepare_satellite!","Gitlab::Satellite::Action","classes/Gitlab/Satellite/Action.html#method-i-prepare_satellite-21","(repo)","

Clears the satellite\n

Updates the satellite from Gitolite\n

Sets up Git variables for the user\n"],["prev_commit","Commit","classes/Commit.html#method-i-prev_commit","()",""],["prev_commit_id","Commit","classes/Commit.html#method-i-prev_commit_id","()",""],["preview","NotesController","classes/NotesController.html#method-i-preview","()",""],["primary_key","StaticModel::ClassMethods","classes/StaticModel/ClassMethods.html#method-i-primary_key","()","

Used by ActiveRecord’s polymorphic association to set object_id\n"],["private?","Project","classes/Project.html#method-i-private-3F","()",""],["probably_merged?","MergeRequest","classes/MergeRequest.html#method-i-probably_merged-3F","()",""],["processing","Gitlab::InlineDiff","classes/Gitlab/InlineDiff.html#method-c-processing","(diff_arr)",""],["project","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-project","()",""],["project","ApplicationController","classes/ApplicationController.html#method-i-project","()",""],["project_abilities","Ability","classes/Ability.html#method-c-project_abilities","(user, project)",""],["project_access_granted_email","Notify","classes/Notify.html#method-i-project_access_granted_email","(user_project_id)","

Project\n"],["project_access_human","UsersProject","classes/UsersProject.html#method-i-project_access_human","()",""],["project_admin_rules","Ability","classes/Ability.html#method-c-project_admin_rules","()",""],["project_dev_rules","Ability","classes/Ability.html#method-c-project_dev_rules","()",""],["project_guest_rules","Ability","classes/Ability.html#method-c-project_guest_rules","()",""],["project_id","Project","classes/Project.html#method-i-project_id","()",""],["project_ids","Account","classes/Account.html#method-i-project_ids","()",""],["project_ids","GroupsController","classes/GroupsController.html#method-i-project_ids","()",""],["project_issues_filter_path","IssuesHelper","classes/IssuesHelper.html#method-i-project_issues_filter_path","(project, params = {})",""],["project_last_activity","ApplicationHelper","classes/ApplicationHelper.html#method-i-project_last_activity","(project)",""],["project_master_rules","Ability","classes/Ability.html#method-c-project_master_rules","()",""],["project_name","Event","classes/Event.html#method-i-project_name","()",""],["project_name_regex","Gitlab::Regex","classes/Gitlab/Regex.html#method-i-project_name_regex","()",""],["project_report_rules","Ability","classes/Ability.html#method-c-project_report_rules","()",""],["project_tab_class","TabHelper","classes/TabHelper.html#method-i-project_tab_class","()",""],["project_teams_update","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-project_teams_update","()",""],["project_title","ProjectsHelper","classes/ProjectsHelper.html#method-i-project_title","(project)",""],["project_update","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-project_update","()",""],["project_was_moved_email","Notify","classes/Notify.html#method-i-project_was_moved_email","(user_project_id)",""],["projects","DashboardController","classes/DashboardController.html#method-i-projects","()",""],["projects","GroupsController","classes/GroupsController.html#method-i-projects","()",""],["projects","Key","classes/Key.html#method-i-projects","()","

projects that has this key\n"],["projects_limit_percent","Account","classes/Account.html#method-i-projects_limit_percent","()",""],["projects_sorted_by_activity","Account","classes/Account.html#method-i-projects_sorted_by_activity","()",""],["proper?","Event","classes/Event.html#method-i-proper-3F","()",""],["protected_branch?","Repository","classes/Repository.html#method-i-protected_branch-3F","(branch_name)","

Check if current branch name is marked as protected in the system\n"],["public?","Project","classes/Project.html#method-i-public-3F","()",""],["push","EventFilter","classes/EventFilter.html#method-c-push","()",""],["push?","Event","classes/Event.html#method-i-push-3F","()",""],["push_action_name","PushEvent","classes/PushEvent.html#method-i-push_action_name","()",""],["push_to_branch?","PushObserver","classes/PushObserver.html#method-i-push_to_branch-3F","(ref, oldrev)",""],["push_with_commits?","PushEvent","classes/PushEvent.html#method-i-push_with_commits-3F","()",""],["quiet","Gitlab::Seeder","classes/Gitlab/Seeder.html#method-c-quiet","()",""],["raw","SnippetsController","classes/SnippetsController.html#method-i-raw","()",""],["read_latest","Gitlab::Logger","classes/Gitlab/Logger.html#method-c-read_latest","()",""],["read_latest_for","Gitlab::Logger","classes/Gitlab/Logger.html#method-c-read_latest_for","(filename)",""],["readme","TreeDecorator","classes/TreeDecorator.html#method-i-readme","()",""],["reassigned_issue_email","Notify","classes/Notify.html#method-i-reassigned_issue_email","(recipient_id, issue_id, previous_assignee_id)",""],["reassigned_merge_request_email","Notify","classes/Notify.html#method-i-reassigned_merge_request_email","(recipient_id, merge_request_id, previous_assignee_id)",""],["recent_push","Account","classes/Account.html#method-i-recent_push","(project_id = nil)",""],["ref","RefsController","classes/RefsController.html#method-i-ref","()",""],["ref_name","PushEvent","classes/PushEvent.html#method-i-ref_name","()",""],["ref_names","Repository","classes/Repository.html#method-i-ref_names","()","

Returns an Array of branch and tag names\n"],["ref_type","PushEvent","classes/PushEvent.html#method-i-ref_type","()",""],["regenerate_from","Wiki","classes/Wiki.html#method-c-regenerate_from","(wiki)",""],["reject_blocked!","ApplicationController","classes/ApplicationController.html#method-i-reject_blocked-21","()",""],["reload_code","MergeRequest","classes/MergeRequest.html#method-i-reload_code","()",""],["reloaded_commits","MergeRequest","classes/MergeRequest.html#method-i-reloaded_commits","()",""],["reloaded_diffs","MergeRequest","classes/MergeRequest.html#method-i-reloaded_diffs","()",""],["remove_from_team_message","ProjectsHelper","classes/ProjectsHelper.html#method-i-remove_from_team_message","(project, member)",""],["remove_key","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-remove_key","(key_id, projects)",""],["remove_project","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-remove_project","()",""],["remove_repository","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-remove_repository","(project)",""],["render_403","ApplicationController","classes/ApplicationController.html#method-i-render_403","()",""],["render_404","ApplicationController","classes/ApplicationController.html#method-i-render_404","()",""],["render_api_error!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-render_api_error-21","(message, status)",""],["render_tree","TreeHelper","classes/TreeHelper.html#method-i-render_tree","(contents)","

Sorts a repository’s tree so that folders are before files and renders\ntheir corresponding partials\n

contents …\n"],["reopened?","Event","classes/Event.html#method-i-reopened-3F","()",""],["replace_markers","Gitlab::InlineDiff","classes/Gitlab/InlineDiff.html#method-c-replace_markers","(line)",""],["repo","Gitlab::Satellite::Satellite","classes/Gitlab/Satellite/Satellite.html#method-i-repo","()",""],["repo","Repository","classes/Repository.html#method-i-repo","()",""],["repo_access_human","UsersProject","classes/UsersProject.html#method-i-repo_access_human","()",""],["repo_exists?","Repository","classes/Repository.html#method-i-repo_exists-3F","()",""],["repo_name","Project","classes/Project.html#method-i-repo_name","()",""],["report_access_for?","Authority","classes/Authority.html#method-i-report_access_for-3F","(user)",""],["repository_masters","Authority","classes/Authority.html#method-i-repository_masters","()",""],["repository_readers","Authority","classes/Authority.html#method-i-repository_readers","()",""],["repository_writers","Authority","classes/Authority.html#method-i-repository_writers","()",""],["request_protocol","ApplicationHelper","classes/ApplicationHelper.html#method-i-request_protocol","()",""],["require_non_empty_project","ApplicationController","classes/ApplicationController.html#method-i-require_non_empty_project","()",""],["require_ssh_key?","Account","classes/Account.html#method-i-require_ssh_key-3F","()",""],["reset_access","Authority","classes/Authority.html#method-i-reset_access","(user)",""],["reset_private_token","ProfilesController","classes/ProfilesController.html#method-i-reset_private_token","()",""],["result","SearchContext","classes/SearchContext.html#method-i-result","()",""],["rm_dir","Namespace","classes/Namespace.html#method-i-rm_dir","()",""],["rm_key","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-rm_key","(user)",""],["rm_ref?","PushEvent","classes/PushEvent.html#method-i-rm_ref-3F","()",""],["role_access","UsersProject","classes/UsersProject.html#method-i-role_access","()",""],["root_ref","Repository","classes/Repository.html#method-i-root_ref","()",""],["root_ref?","Repository","classes/Repository.html#method-i-root_ref-3F","(branch)",""],["safe_message","Commit","classes/Commit.html#method-i-safe_message","()",""],["satellite","Repository","classes/Repository.html#method-i-satellite","()",""],["saved?","Project","classes/Project.html#method-i-saved-3F","()",""],["search","GroupsController","classes/GroupsController.html#method-i-search","()",""],["search","IssueCommonality::ClassMethods","classes/IssueCommonality/ClassMethods.html#method-i-search","(query)",""],["search","IssuesController","classes/IssuesController.html#method-i-search","()",""],["search","Namespace","classes/Namespace.html#method-c-search","(query)",""],["search","Project","classes/Project.html#method-c-search","(query)",""],["search","User","classes/User.html#method-c-search","(query)",""],["search","Wiki","classes/Wiki.html#method-c-search","(query)",""],["search_autocomplete_source","ApplicationHelper","classes/ApplicationHelper.html#method-i-search_autocomplete_source","()",""],["send_move_instructions","Project","classes/Project.html#method-i-send_move_instructions","()",""],["send_notify_mails","NoteObserver","classes/NoteObserver.html#method-i-send_notify_mails","(note)",""],["send_reassigned_email","IssueObserver","classes/IssueObserver.html#method-i-send_reassigned_email","(issue)",""],["send_reassigned_email","MergeRequestObserver","classes/MergeRequestObserver.html#method-i-send_reassigned_email","(merge_request)",""],["send_update_instructions","Namespace","classes/Namespace.html#method-i-send_update_instructions","()",""],["services","Project","classes/Project.html#method-i-services","()",""],["set_current_user_for_observers","ApplicationController","classes/ApplicationController.html#method-i-set_current_user_for_observers","()",""],["set_identifier","Key","classes/Key.html#method-i-set_identifier","()",""],["set_key","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-set_key","(key_id, key_content, projects)",""],["set_slug","Wiki","classes/Wiki.html#method-i-set_slug","()",""],["several_namespaces?","Account","classes/Account.html#method-i-several_namespaces-3F","()",""],["short_id","Commit","classes/Commit.html#method-i-short_id","(length = 10)",""],["show","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-show","()",""],["show","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-show","()",""],["show","Admin::ResqueController","classes/Admin/ResqueController.html#method-i-show","()",""],["show","Admin::UsersController","classes/Admin/UsersController.html#method-i-show","()",""],["show","BlameController","classes/BlameController.html#method-i-show","()",""],["show","BlobController","classes/BlobController.html#method-i-show","()",""],["show","CommitController","classes/CommitController.html#method-i-show","()",""],["show","CommitsController","classes/CommitsController.html#method-i-show","()",""],["show","CompareController","classes/CompareController.html#method-i-show","()",""],["show","DeployKeysController","classes/DeployKeysController.html#method-i-show","()",""],["show","GroupsController","classes/GroupsController.html#method-i-show","()",""],["show","IssuesController","classes/IssuesController.html#method-i-show","()",""],["show","KeysController","classes/KeysController.html#method-i-show","()",""],["show","MergeRequestsController","classes/MergeRequestsController.html#method-i-show","()",""],["show","MilestonesController","classes/MilestonesController.html#method-i-show","()",""],["show","ProfilesController","classes/ProfilesController.html#method-i-show","()",""],["show","ProjectsController","classes/ProjectsController.html#method-i-show","()",""],["show","RepositoriesController","classes/RepositoriesController.html#method-i-show","()",""],["show","SearchController","classes/SearchController.html#method-i-show","()",""],["show","SnippetsController","classes/SnippetsController.html#method-i-show","()",""],["show","TeamMembersController","classes/TeamMembersController.html#method-i-show","()",""],["show","TreeController","classes/TreeController.html#method-i-show","()",""],["show","WikisController","classes/WikisController.html#method-i-show","()",""],["show_last_push_widget?","ApplicationHelper","classes/ApplicationHelper.html#method-i-show_last_push_widget-3F","(event)",""],["size","Snippet","classes/Snippet.html#method-i-size","()",""],["skip_git?","UsersProject","classes/UsersProject.html#method-i-skip_git-3F","()",""],["snippet","SnippetsController","classes/SnippetsController.html#method-i-snippet","()",""],["sort","IssuesController","classes/IssuesController.html#method-i-sort","()",""],["ssh_url_to_repo","Repository","classes/Repository.html#method-i-ssh_url_to_repo","()",""],["stats","RepositoriesController","classes/RepositoriesController.html#method-i-stats","()",""],["store_dir","AttachmentUploader","classes/AttachmentUploader.html#method-i-store_dir","()","

Override the directory where uploaded files will be stored. This is a\nsensible default for uploaders …\n"],["strip_white_space","Key","classes/Key.html#method-i-strip_white_space","()",""],["switch","RefsController","classes/RefsController.html#method-i-switch","()",""],["tag?","PushEvent","classes/PushEvent.html#method-i-tag-3F","()",""],["tag_list","TagsHelper","classes/TagsHelper.html#method-i-tag_list","(project)",""],["tag_name","PushEvent","classes/PushEvent.html#method-i-tag_name","()",""],["tag_names","Repository","classes/Repository.html#method-i-tag_names","()","

Returns an Array of tag names\n"],["tag_path","TagsHelper","classes/TagsHelper.html#method-i-tag_path","(tag)",""],["tags","RepositoriesController","classes/RepositoriesController.html#method-i-tags","()",""],["tags","Repository","classes/Repository.html#method-i-tags","()","

Returns an Array of Tags\n"],["take_left_leaves","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-take_left_leaves","(commit, map)","

Takes most left subtree branch of commits which don’t have space mark yet.\n

@param [Graph::Commit] the …\n"],["target_title","Event","classes/Event.html#method-i-target_title","()",""],["team","EventFilter","classes/EventFilter.html#method-c-team","()",""],["team_member_by_id","Team","classes/Team.html#method-i-team_member_by_id","(user_id)","

Get Team Member record by user id\n"],["team_member_by_name_or_email","Team","classes/Team.html#method-i-team_member_by_name_or_email","(name = nil, email = nil)",""],["team_members","GroupsController","classes/GroupsController.html#method-i-team_members","()",""],["team_update","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-team_update","()",""],["team_update","Admin::UsersController","classes/Admin/UsersController.html#method-i-team_update","()",""],["team_without_note_author","NoteObserver","classes/NoteObserver.html#method-i-team_without_note_author","(note)",""],["test","Admin::HooksController","classes/Admin/HooksController.html#method-i-test","()",""],["test","HooksController","classes/HooksController.html#method-i-test","()",""],["test","ServicesController","classes/ServicesController.html#method-i-test","()",""],["title","CommitDecorator","classes/CommitDecorator.html#method-i-title","()","

Returns the commits title.\n

Usually, the commit title is the first line of the commit message. In case\n…\n"],["tm_of","UserDecorator","classes/UserDecorator.html#method-i-tm_of","(project)",""],["tm_path","ProjectsHelper","classes/ProjectsHelper.html#method-i-tm_path","(team_member)",""],["to_diff","Commit","classes/Commit.html#method-i-to_diff","()","

Shows the diff between the commit’s parent and the commit.\n

Cuts out the header and stats from #to_patch …\n"],["to_diff","MergeRequest","classes/MergeRequest.html#method-i-to_diff","()","

Returns the raw diff for this merge request\n

see “git diff”\n"],["to_graph_hash","Gitlab::Graph::Commit","classes/Gitlab/Graph/Commit.html#method-i-to_graph_hash","()",""],["to_json","Gitlab::Graph::JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html#method-i-to_json","(*args)",""],["to_param","Namespace","classes/Namespace.html#method-i-to_param","()",""],["to_param","Project","classes/Project.html#method-i-to_param","()",""],["to_param","StaticModel","classes/StaticModel.html#method-i-to_param","()",""],["to_param","Wiki","classes/Wiki.html#method-i-to_param","()",""],["to_patch","MergeRequest","classes/MergeRequest.html#method-i-to_patch","()","

Returns the commit as a series of email patches.\n

see “git format-patch”\n"],["today?","IssueCommonality","classes/IssueCommonality.html#method-i-today-3F","()",""],["token","ProfilesController","classes/ProfilesController.html#method-i-token","()",""],["total_items_count","Milestone","classes/Milestone.html#method-i-total_items_count","()",""],["transfer","NamespacedProject","classes/NamespacedProject.html#method-i-transfer","(new_namespace)",""],["tree","Repository","classes/Repository.html#method-i-tree","(fcommit, path = nil)",""],["tree_hex_class","TreeHelper","classes/TreeHelper.html#method-i-tree_hex_class","(content)",""],["tree_icon","TreeHelper","classes/TreeHelper.html#method-i-tree_icon","(type)","

Return an image icon depending on the file type\n

type - String type of the tree item; either ‘folder’ or …\n"],["tree_join","TreeHelper","classes/TreeHelper.html#method-i-tree_join","(*args)","

Simple shortcut to File.join\n"],["trigger_post_receive","PushObserver","classes/PushObserver.html#method-i-trigger_post_receive","(oldrev, newrev, ref, user)","

This method will be called after each post receive and only if the provided\nuser is present in GitLab …\n"],["truncate_team","Team","classes/Team.html#method-i-truncate_team","()","

Remove all users from project team\n"],["truncate_team","UsersProject","classes/UsersProject.html#method-c-truncate_team","(project)",""],["truncate_teams","Group","classes/Group.html#method-i-truncate_teams","()",""],["truncate_teams","UsersProject","classes/UsersProject.html#method-c-truncate_teams","(project_ids)",""],["unassigned_filter","IssuesHelper","classes/IssuesHelper.html#method-i-unassigned_filter","()","

Returns an OpenStruct object suitable for use by\noptions_from_collection_for_select to allow filtering …\n"],["unauthorized!","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-unauthorized-21","()",""],["unblock","Admin::UsersController","classes/Admin/UsersController.html#method-i-unblock","()",""],["unchecked?","MergeRequest","classes/MergeRequest.html#method-i-unchecked-3F","()",""],["unique_key","Key","classes/Key.html#method-i-unique_key","()",""],["unmerged_commits","MergeRequest","classes/MergeRequest.html#method-i-unmerged_commits","()",""],["unmerged_diffs","MergeRequest","classes/MergeRequest.html#method-i-unmerged_diffs","()",""],["up_dir?","TreeDecorator","classes/TreeDecorator.html#method-i-up_dir-3F","()",""],["up_dir_path","TreeDecorator","classes/TreeDecorator.html#method-i-up_dir_path","()",""],["update","Admin::GroupsController","classes/Admin/GroupsController.html#method-i-update","()",""],["update","Admin::ProjectsController","classes/Admin/ProjectsController.html#method-i-update","()",""],["update","Admin::TeamMembersController","classes/Admin/TeamMembersController.html#method-i-update","()",""],["update","Admin::UsersController","classes/Admin/UsersController.html#method-i-update","()",""],["update","IssuesController","classes/IssuesController.html#method-i-update","()",""],["update","MergeRequestsController","classes/MergeRequestsController.html#method-i-update","()",""],["update","MilestonesController","classes/MilestonesController.html#method-i-update","()",""],["update","ProfilesController","classes/ProfilesController.html#method-i-update","()",""],["update","ProjectsController","classes/ProjectsController.html#method-i-update","()",""],["update","ServicesController","classes/ServicesController.html#method-i-update","()",""],["update","SnippetsController","classes/SnippetsController.html#method-i-update","()",""],["update","TeamMembersController","classes/TeamMembersController.html#method-i-update","()",""],["update","TreeController","classes/TreeController.html#method-i-update","()",""],["update_gitolite","Namespace","classes/Namespace.html#method-i-update_gitolite","()",""],["update_merge_requests","PushObserver","classes/PushObserver.html#method-i-update_merge_requests","(oldrev, newrev, ref, user)",""],["update_password","ProfilesController","classes/ProfilesController.html#method-i-update_password","()",""],["update_project","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-update_project","(project)","

update or create\n"],["update_project!","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-update_project-21","( project)",""],["update_project_config","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-update_project_config","(project, conf)",""],["update_projects","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-update_projects","(projects)","

Updates many projects and uses project.path_with_namespace as the repo path\nAn order of magnitude faster …\n"],["update_repositories","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-update_repositories","(projects)",""],["update_repository","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-update_repository","(project)",""],["update_repository","ProtectedBranch","classes/ProtectedBranch.html#method-i-update_repository","()",""],["update_repository","Repository","classes/Repository.html#method-i-update_repository","()",""],["update_repository","UsersProject","classes/UsersProject.html#method-i-update_repository","()",""],["update_username","ProfilesController","classes/ProfilesController.html#method-i-update_username","()",""],["update_users_ids_to_role","Team","classes/Team.html#method-i-update_users_ids_to_role","(users_ids, access_role)","

Update multiple project users to same access role by user ids\n"],["upvote?","Note","classes/Note.html#method-i-upvote-3F","()","

Returns true if this is an upvote note, otherwise false is returned\n"],["upvotes","Votes","classes/Votes.html#method-i-upvotes","()","

Return the number of +1 comments (upvotes)\n"],["upvotes_in_percent","Votes","classes/Votes.html#method-i-upvotes_in_percent","()",""],["url_to_repo","Gitlab::Gitolite","classes/Gitlab/Gitolite.html#method-i-url_to_repo","(path)",""],["url_to_repo","Repository","classes/Repository.html#method-i-url_to_repo","()",""],["user_bulk_import","UsersProject","classes/UsersProject.html#method-c-user_bulk_import","(user, project_ids, project_access)","

TODO: depreceate in future in favor of add_users_into_projects\n"],["user_color_scheme_class","ApplicationHelper","classes/ApplicationHelper.html#method-i-user_color_scheme_class","()",""],["user_project","Gitlab::APIHelpers","classes/Gitlab/APIHelpers.html#method-i-user_project","()",""],["username_regex","Gitlab::Regex","classes/Gitlab/Regex.html#method-i-username_regex","()",""],["users","Group","classes/Group.html#method-i-users","()",""],["valid?","Grack::Auth","classes/Grack/Auth.html#method-i-valid-3F","()",""],["valid_diffs?","MergeRequest","classes/MergeRequest.html#method-i-valid_diffs-3F","()",""],["valid_hook_file","Repository","classes/Repository.html#method-i-valid_hook_file","()",""],["valid_post_receive_file?","Repository","classes/Repository.html#method-i-valid_post_receive_file-3F","()",""],["valid_push?","PushEvent","classes/PushEvent.html#method-i-valid_push-3F","()",""],["valid_repo?","Repository","classes/Repository.html#method-i-valid_repo-3F","()",""],["validate_branches","MergeRequest","classes/MergeRequest.html#method-i-validate_branches","()",""],["validate_each","FileSizeValidator","classes/FileSizeValidator.html#method-i-validate_each","(record, attribute, value)",""],["validate_get_request","Grack::Auth","classes/Grack/Auth.html#method-i-validate_get_request","()",""],["validate_post_request","Grack::Auth","classes/Grack/Auth.html#method-i-validate_post_request","()",""],["validates_merge_request","MergeRequestsController","classes/MergeRequestsController.html#method-i-validates_merge_request","()",""],["votes_count","Votes","classes/Votes.html#method-i-votes_count","()","

Return the total number of votes\n"],["wall","ProjectsController","classes/ProjectsController.html#method-i-wall","()","

Wall\n"],["wall_note?","NoteEvent","classes/NoteEvent.html#method-i-wall_note-3F","()",""],["web_app_url","ApplicationHelper","classes/ApplicationHelper.html#method-i-web_app_url","()",""],["web_url","Project","classes/Project.html#method-i-web_url","()",""],["without_projects","User","classes/User.html#method-c-without_projects","()",""],["write_key","Gitlab::GitoliteConfig","classes/Gitlab/GitoliteConfig.html#method-i-write_key","(id, key)",""],["OFL","","files/app/assets/fonts/OFL_txt.html","","

Copyright © 2010, Jan Gerner (post@yanone.de) This Font Software is\nlicensed under the SIL Open Font …\n"],["post-receive","","files/lib/hooks/post-receive.html","","

#!/usr/bin/env bash\n

# This file was placed here by GitLab. It makes sure that your pushed\ncommits # will …\n"]]}} \ No newline at end of file diff --git a/doc/code/js/searchdoc.js b/doc/code/js/searchdoc.js new file mode 100755 index 00000000000..77910c4b5fe --- /dev/null +++ b/doc/code/js/searchdoc.js @@ -0,0 +1,449 @@ +Searchdoc = {}; + +// navigation.js ------------------------------------------ + +Searchdoc.Navigation = new function() { + this.initNavigation = function() { + var _this = this; + + $(document).keydown(function(e) { + _this.onkeydown(e); + }).keyup(function(e) { + _this.onkeyup(e); + }); + + this.navigationActive = true; + } + + this.setNavigationActive = function(state) { + this.navigationActive = state; + this.clearMoveTimeout(); + } + + + this.onkeyup = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + case 38: //Event.KEY_UP: + case 39: //Event.KEY_RIGHT: + case 40: //Event.KEY_DOWN: + case 73: // i - qwerty + case 74: // j + case 75: // k + case 76: // l + case 67: // c - dvorak + case 72: // h + case 84: // t + case 78: // n + this.clearMoveTimeout(); + break; + } + } + + this.onkeydown = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + case 74: // j (qwerty) + case 72: // h (dvorak) + if (this.moveLeft()) e.preventDefault(); + break; + case 38: //Event.KEY_UP: + case 73: // i (qwerty) + case 67: // c (dvorak) + if (e.keyCode == 38 || e.ctrlKey) { + if (this.moveUp()) e.preventDefault(); + this.startMoveTimeout(false); + } + break; + case 39: //Event.KEY_RIGHT: + case 76: // l (qwerty) + case 78: // n (dvorak) + if (this.moveRight()) e.preventDefault(); + break; + case 40: //Event.KEY_DOWN: + case 75: // k (qwerty) + case 84: // t (dvorak) + if (e.keyCode == 40 || e.ctrlKey) { + if (this.moveDown()) e.preventDefault(); + this.startMoveTimeout(true); + } + break; + case 9: //Event.KEY_TAB: + case 13: //Event.KEY_RETURN: + if (this.$current) this.select(this.$current); + break; + case 83: // s (qwerty) + case 79: // o (dvorak) + if (e.ctrlKey) { + $('#search').focus(); + e.preventDefault(); + } + break; + } + if (e.ctrlKey && e.shiftKey) this.select(this.$current); + } + + this.clearMoveTimeout = function() { + clearTimeout(this.moveTimeout); + this.moveTimeout = null; + } + + this.startMoveTimeout = function(isDown) { + if (!$.browser.mozilla && !$.browser.opera) return; + if (this.moveTimeout) this.clearMoveTimeout(); + var _this = this; + + var go = function() { + if (!_this.moveTimeout) return; + _this[isDown ? 'moveDown' : 'moveUp'](); + _this.moveTimout = setTimeout(go, 100); + } + this.moveTimeout = setTimeout(go, 200); + } + + this.moveRight = function() { + } + + this.moveLeft = function() { + } + + this.move = function(isDown) { + } + + this.moveUp = function() { + return this.move(false); + } + + this.moveDown = function() { + return this.move(true); + } +} + + +// scrollIntoView.js -------------------------------------- + +function scrollIntoView(element, view) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = view.offsetHeight; + viewScroll = view.scrollTop; + if (offset - viewScroll + height > viewHeight) { + view.scrollTop = offset - viewHeight + height; + } + if (offset < viewScroll) { + view.scrollTop = offset; + } +} + +// panel.js ----------------------------------------------- + +Searchdoc.Panel = function(element, data, tree, frame) { + this.$element = $(element); + this.$input = $('input', element).eq(0); + this.$result = $('.result ul', element).eq(0); + this.frame = frame; + this.$current = null; + this.$view = this.$result.parent(); + this.data = data; + this.searcher = new Searcher(data.index); + + this.tree = new Searchdoc.Tree($('.tree', element), tree, this); + this.init(); +} + +Searchdoc.Panel.prototype = $.extend({}, Searchdoc.Navigation, new function() { + var suid = 1; + + this.init = function() { + var _this = this; + var observer = function() { + _this.search(_this.$input[0].value); + }; + this.$input.keyup(observer); + this.$input.click(observer); // mac's clear field + + this.searcher.ready(function(results, isLast) { + _this.addResults(results, isLast); + }) + + this.$result.click(function(e) { + _this.$current.removeClass('current'); + _this.$current = $(e.target).closest('li').addClass('current'); + _this.select(); + _this.$input.focus(); + }); + + this.initNavigation(); + this.setNavigationActive(false); + } + + this.search = function(value, selectFirstMatch) { + value = jQuery.trim(value).toLowerCase(); + this.selectFirstMatch = selectFirstMatch; + if (value) { + this.$element.removeClass('panel_tree').addClass('panel_results'); + this.tree.setNavigationActive(false); + this.setNavigationActive(true); + } else { + this.$element.addClass('panel_tree').removeClass('panel_results'); + this.tree.setNavigationActive(true); + this.setNavigationActive(false); + } + if (value != this.lastQuery) { + this.lastQuery = value; + this.firstRun = true; + this.searcher.find(value); + } + } + + this.addResults = function(results, isLast) { + var target = this.$result.get(0); + if (this.firstRun && (results.length > 0 || isLast)) { + this.$current = null; + this.$result.empty(); + } + for (var i=0, l = results.length; i < l; i++) { + target.appendChild(renderItem.call(this, results[i])); + }; + if (this.firstRun && results.length > 0) { + this.firstRun = false; + this.$current = $(target.firstChild); + this.$current.addClass('current'); + if (this.selectFirstMatch) this.select(); + scrollIntoView(this.$current[0], this.$view[0]) + } + if (jQuery.browser.msie) this.$element[0].className += ''; + } + + this.open = function(src) { + this.frame.location.href = '../' + src; + if (this.frame.highlight) this.frame.highlight(src); + } + + this.select = function() { + this.open(this.$current.data('path')); + } + + this.move = function(isDown) { + if (!this.$current) return; + var $next = this.$current[isDown ? 'next' : 'prev'](); + if ($next.length) { + this.$current.removeClass('current'); + $next.addClass('current'); + scrollIntoView($next[0], this.$view[0]); + this.$current = $next; + } + return true; + } + + function renderItem(result) { + var li = document.createElement('li'), + html = '', badge = result.badge; + html += '

' + hlt(result.title); + if (result.params) html += '' + result.params + ''; + html += '

'; + html += '

'; + if (typeof badge != 'undefined') { + html += '' + escapeHTML(this.data.badges[badge] || 'unknown') + ''; + } + html += hlt(result.namespace) + '

'; + if (result.snippet) html += '

' + escapeHTML(result.snippet) + '

'; + li.innerHTML = html; + jQuery.data(li, 'path', result.path); + return li; + } + + function hlt(html) { + return escapeHTML(html).replace(/\u0001/g, '').replace(/\u0002/g, '') + } + + function escapeHTML(html) { + return html.replace(/[&<>]/g, function(c) { + return '&#' + c.charCodeAt(0) + ';'; + }); + } + +}); + +// tree.js ------------------------------------------------ + +Searchdoc.Tree = function(element, tree, panel) { + this.$element = $(element); + this.$list = $('ul', element); + this.tree = tree; + this.panel = panel; + this.init(); +} + +Searchdoc.Tree.prototype = $.extend({}, Searchdoc.Navigation, new function() { + this.init = function() { + var stopper = document.createElement('li'); + stopper.className = 'stopper'; + this.$list[0].appendChild(stopper); + for (var i=0, l = this.tree.length; i < l; i++) { + buildAndAppendItem.call(this, this.tree[i], 0, stopper); + }; + var _this = this; + this.$list.click(function(e) { + var $target = $(e.target), + $li = $target.closest('li'); + if ($target.hasClass('icon')) { + _this.toggle($li); + } else { + _this.select($li); + } + }) + + this.initNavigation(); + if (jQuery.browser.msie) document.body.className += ''; + } + + this.select = function($li) { + this.highlight($li); + var path = $li[0].searchdoc_tree_data.path; + if (path) this.panel.open(path); + } + + this.highlight = function($li) { + if (this.$current) this.$current.removeClass('current'); + this.$current = $li.addClass('current'); + } + + this.toggle = function($li) { + var closed = !$li.hasClass('closed'), + children = $li[0].searchdoc_tree_data.children; + $li.toggleClass('closed'); + for (var i=0, l = children.length; i < l; i++) { + toggleVis.call(this, $(children[i].li), !closed); + }; + } + + this.moveRight = function() { + if (!this.$current) { + this.highlight(this.$list.find('li:first')); + return; + } + if (this.$current.hasClass('closed')) { + this.toggle(this.$current); + } + } + + this.moveLeft = function() { + if (!this.$current) { + this.highlight(this.$list.find('li:first')); + return; + } + if (!this.$current.hasClass('closed')) { + this.toggle(this.$current); + } else { + var level = this.$current[0].searchdoc_tree_data.level; + if (level == 0) return; + var $next = this.$current.prevAll('li.level_' + (level - 1) + ':visible:first'); + this.$current.removeClass('current'); + $next.addClass('current'); + scrollIntoView($next[0], this.$element[0]); + this.$current = $next; + } + } + + this.move = function(isDown) { + if (!this.$current) { + this.highlight(this.$list.find('li:first')); + return true; + } + var next = this.$current[0]; + if (isDown) { + do { + next = next.nextSibling; + if (next && next.style && next.style.display != 'none') break; + } while(next); + } else { + do { + next = next.previousSibling; + if (next && next.style && next.style.display != 'none') break; + } while(next); + } + if (next && next.className.indexOf('stopper') == -1) { + this.$current.removeClass('current'); + $(next).addClass('current'); + scrollIntoView(next, this.$element[0]); + this.$current = $(next); + } + return true; + } + + function toggleVis($li, show) { + var closed = $li.hasClass('closed'), + children = $li[0].searchdoc_tree_data.children; + $li.css('display', show ? '' : 'none') + if (!show && this.$current && $li[0] == this.$current[0]) { + this.$current.removeClass('current'); + this.$current = null; + } + for (var i=0, l = children.length; i < l; i++) { + toggleVis.call(this, $(children[i].li), show && !closed); + }; + } + + function buildAndAppendItem(item, level, before) { + var li = renderItem(item, level), + list = this.$list[0]; + item.li = li; + list.insertBefore(li, before); + for (var i=0, l = item[3].length; i < l; i++) { + buildAndAppendItem.call(this, item[3][i], level + 1, before); + }; + return li; + } + + function renderItem(item, level) { + var li = document.createElement('li'), + cnt = document.createElement('div'), + h1 = document.createElement('h1'), + p = document.createElement('p'), + icon, i; + + li.appendChild(cnt); + li.style.paddingLeft = getOffset(level); + cnt.className = 'content'; + if (!item[1]) li.className = 'empty '; + cnt.appendChild(h1); + // cnt.appendChild(p); + h1.appendChild(document.createTextNode(item[0])); + // p.appendChild(document.createTextNode(item[4])); + if (item[2]) { + i = document.createElement('i'); + i.appendChild(document.createTextNode(item[2])); + h1.appendChild(i); + } + if (item[3].length > 0) { + icon = document.createElement('div'); + icon.className = 'icon'; + cnt.appendChild(icon); + } + + // user direct assignement instead of $() + // it's 8x faster + // $(li).data('path', item[1]) + // .data('children', item[3]) + // .data('level', level) + // .css('display', level == 0 ? '' : 'none') + // .addClass('level_' + level) + // .addClass('closed'); + li.searchdoc_tree_data = { + path: item[1], + children: item[3], + level: level + } + li.style.display = level == 0 ? '' : 'none'; + li.className += 'level_' + level + ' closed'; + return li; + } + + function getOffset(level) { + return 5 + 18*level + 'px'; + } +}); diff --git a/doc/app/js/searcher.js b/doc/code/js/searcher.js similarity index 100% rename from doc/app/js/searcher.js rename to doc/code/js/searcher.js diff --git a/doc/code/panel/index.html b/doc/code/panel/index.html new file mode 100755 index 00000000000..f815a113245 --- /dev/null +++ b/doc/code/panel/index.html @@ -0,0 +1,73 @@ + + + + + + search index + + + + + + + + + + +
+
+
+ + + +
+ +
+
+
+
    +
+
+
+
    +
+
+
+ index + + diff --git a/doc/code/panel/links.html b/doc/code/panel/links.html new file mode 100644 index 00000000000..5c356c741a7 --- /dev/null +++ b/doc/code/panel/links.html @@ -0,0 +1,314 @@ + + File index + + + app/assets/fonts/OFL.txt + + app/contexts/base_context.rb + + app/contexts/commit_load_context.rb + + app/contexts/issues_bulk_update_context.rb + + app/contexts/issues_list_context.rb + + app/contexts/merge_requests_load_context.rb + + app/contexts/notes/create_context.rb + + app/contexts/notes/load_context.rb + + app/contexts/project_update_context.rb + + app/contexts/search_context.rb + + app/contexts/test_hook_context.rb + + app/controllers/admin/dashboard_controller.rb + + app/controllers/admin/groups_controller.rb + + app/controllers/admin/hooks_controller.rb + + app/controllers/admin/logs_controller.rb + + app/controllers/admin/projects_controller.rb + + app/controllers/admin/resque_controller.rb + + app/controllers/admin/team_members_controller.rb + + app/controllers/admin/users_controller.rb + + app/controllers/admin_controller.rb + + app/controllers/application_controller.rb + + app/controllers/blame_controller.rb + + app/controllers/blob_controller.rb + + app/controllers/commit_controller.rb + + app/controllers/commits_controller.rb + + app/controllers/compare_controller.rb + + app/controllers/dashboard_controller.rb + + app/controllers/deploy_keys_controller.rb + + app/controllers/errors_controller.rb + + app/controllers/groups_controller.rb + + app/controllers/help_controller.rb + + app/controllers/hooks_controller.rb + + app/controllers/issues_controller.rb + + app/controllers/keys_controller.rb + + app/controllers/labels_controller.rb + + app/controllers/merge_requests_controller.rb + + app/controllers/milestones_controller.rb + + app/controllers/notes_controller.rb + + app/controllers/omniauth_callbacks_controller.rb + + app/controllers/profiles_controller.rb + + app/controllers/project_resource_controller.rb + + app/controllers/projects_controller.rb + + app/controllers/protected_branches_controller.rb + + app/controllers/refs_controller.rb + + app/controllers/repositories_controller.rb + + app/controllers/search_controller.rb + + app/controllers/services_controller.rb + + app/controllers/snippets_controller.rb + + app/controllers/team_members_controller.rb + + app/controllers/tree_controller.rb + + app/controllers/wikis_controller.rb + + app/decorators/application_decorator.rb + + app/decorators/commit_decorator.rb + + app/decorators/event_decorator.rb + + app/decorators/tree_decorator.rb + + app/decorators/user_decorator.rb + + app/helpers/application_helper.rb + + app/helpers/commits_helper.rb + + app/helpers/dashboard_helper.rb + + app/helpers/events_helper.rb + + app/helpers/gitlab_markdown_helper.rb + + app/helpers/issues_helper.rb + + app/helpers/merge_requests_helper.rb + + app/helpers/namespaces_helper.rb + + app/helpers/notes_helper.rb + + app/helpers/profile_helper.rb + + app/helpers/projects_helper.rb + + app/helpers/snippets_helper.rb + + app/helpers/tab_helper.rb + + app/helpers/tags_helper.rb + + app/helpers/tree_helper.rb + + app/mailers/notify.rb + + app/models/ability.rb + + app/models/commit.rb + + app/models/event.rb + + app/models/gitlab_ci_service.rb + + app/models/group.rb + + app/models/issue.rb + + app/models/key.rb + + app/models/merge_request.rb + + app/models/milestone.rb + + app/models/namespace.rb + + app/models/note.rb + + app/models/project.rb + + app/models/project_hook.rb + + app/models/protected_branch.rb + + app/models/service.rb + + app/models/service_hook.rb + + app/models/snippet.rb + + app/models/system_hook.rb + + app/models/tree.rb + + app/models/user.rb + + app/models/users_project.rb + + app/models/web_hook.rb + + app/models/wiki.rb + + app/observers/activity_observer.rb + + app/observers/issue_observer.rb + + app/observers/key_observer.rb + + app/observers/merge_request_observer.rb + + app/observers/note_observer.rb + + app/observers/project_observer.rb + + app/observers/system_hook_observer.rb + + app/observers/user_observer.rb + + app/observers/users_project_observer.rb + + app/roles/account.rb + + app/roles/authority.rb + + app/roles/git_host.rb + + app/roles/issue_commonality.rb + + app/roles/namespaced_project.rb + + app/roles/note_event.rb + + app/roles/push_event.rb + + app/roles/push_observer.rb + + app/roles/repository.rb + + app/roles/static_model.rb + + app/roles/team.rb + + app/roles/votes.rb + + app/uploaders/attachment_uploader.rb + + app/workers/post_receive.rb + + app/workers/system_hook_worker.rb + + lib/api.rb + + lib/api/entities.rb + + lib/api/helpers.rb + + lib/api/issues.rb + + lib/api/merge_requests.rb + + lib/api/milestones.rb + + lib/api/notes.rb + + lib/api/projects.rb + + lib/api/session.rb + + lib/api/users.rb + + lib/event_filter.rb + + lib/extracts_path.rb + + lib/file_size_validator.rb + + lib/gitlab/app_logger.rb + + lib/gitlab/auth.rb + + lib/gitlab/backend/gitolite.rb + + lib/gitlab/backend/gitolite_config.rb + + lib/gitlab/backend/grack_auth.rb + + lib/gitlab/git_logger.rb + + lib/gitlab/git_stats.rb + + lib/gitlab/graph/commit.rb + + lib/gitlab/graph/json_builder.rb + + lib/gitlab/inline_diff.rb + + lib/gitlab/logger.rb + + lib/gitlab/markdown.rb + + lib/gitlab/project_mover.rb + + lib/gitlab/regex.rb + + lib/gitlab/satellite/action.rb + + lib/gitlab/satellite/edit_file_action.rb + + lib/gitlab/satellite/merge_action.rb + + lib/gitlab/satellite/satellite.rb + + lib/gitlab/seeder.rb + + lib/gitlab/theme.rb + + lib/hooks/post-receive + + lib/redcarpet/render/gitlab_html.rb + + + \ No newline at end of file diff --git a/doc/code/panel/tree.js b/doc/code/panel/tree.js new file mode 100644 index 00000000000..eeb049224a8 --- /dev/null +++ b/doc/code/panel/tree.js @@ -0,0 +1 @@ +var tree = [["","","files",[["","","app",[["","","assets",[["","","fonts",[["OFL.txt","files/app/assets/fonts/OFL_txt.html","",[]]]]]],["","","contexts",[["base_context.rb","files/app/contexts/base_context_rb.html","",[]],["commit_load_context.rb","files/app/contexts/commit_load_context_rb.html","",[]],["issues_bulk_update_context.rb","files/app/contexts/issues_bulk_update_context_rb.html","",[]],["issues_list_context.rb","files/app/contexts/issues_list_context_rb.html","",[]],["merge_requests_load_context.rb","files/app/contexts/merge_requests_load_context_rb.html","",[]],["","","notes",[["create_context.rb","files/app/contexts/notes/create_context_rb.html","",[]],["load_context.rb","files/app/contexts/notes/load_context_rb.html","",[]]]],["project_update_context.rb","files/app/contexts/project_update_context_rb.html","",[]],["search_context.rb","files/app/contexts/search_context_rb.html","",[]],["test_hook_context.rb","files/app/contexts/test_hook_context_rb.html","",[]]]],["","","controllers",[["","","admin",[["dashboard_controller.rb","files/app/controllers/admin/dashboard_controller_rb.html","",[]],["groups_controller.rb","files/app/controllers/admin/groups_controller_rb.html","",[]],["hooks_controller.rb","files/app/controllers/admin/hooks_controller_rb.html","",[]],["logs_controller.rb","files/app/controllers/admin/logs_controller_rb.html","",[]],["projects_controller.rb","files/app/controllers/admin/projects_controller_rb.html","",[]],["resque_controller.rb","files/app/controllers/admin/resque_controller_rb.html","",[]],["team_members_controller.rb","files/app/controllers/admin/team_members_controller_rb.html","",[]],["users_controller.rb","files/app/controllers/admin/users_controller_rb.html","",[]]]],["admin_controller.rb","files/app/controllers/admin_controller_rb.html","",[]],["application_controller.rb","files/app/controllers/application_controller_rb.html","",[]],["blame_controller.rb","files/app/controllers/blame_controller_rb.html","",[]],["blob_controller.rb","files/app/controllers/blob_controller_rb.html","",[]],["commit_controller.rb","files/app/controllers/commit_controller_rb.html","",[]],["commits_controller.rb","files/app/controllers/commits_controller_rb.html","",[]],["compare_controller.rb","files/app/controllers/compare_controller_rb.html","",[]],["dashboard_controller.rb","files/app/controllers/dashboard_controller_rb.html","",[]],["deploy_keys_controller.rb","files/app/controllers/deploy_keys_controller_rb.html","",[]],["errors_controller.rb","files/app/controllers/errors_controller_rb.html","",[]],["groups_controller.rb","files/app/controllers/groups_controller_rb.html","",[]],["help_controller.rb","files/app/controllers/help_controller_rb.html","",[]],["hooks_controller.rb","files/app/controllers/hooks_controller_rb.html","",[]],["issues_controller.rb","files/app/controllers/issues_controller_rb.html","",[]],["keys_controller.rb","files/app/controllers/keys_controller_rb.html","",[]],["labels_controller.rb","files/app/controllers/labels_controller_rb.html","",[]],["merge_requests_controller.rb","files/app/controllers/merge_requests_controller_rb.html","",[]],["milestones_controller.rb","files/app/controllers/milestones_controller_rb.html","",[]],["notes_controller.rb","files/app/controllers/notes_controller_rb.html","",[]],["omniauth_callbacks_controller.rb","files/app/controllers/omniauth_callbacks_controller_rb.html","",[]],["profiles_controller.rb","files/app/controllers/profiles_controller_rb.html","",[]],["project_resource_controller.rb","files/app/controllers/project_resource_controller_rb.html","",[]],["projects_controller.rb","files/app/controllers/projects_controller_rb.html","",[]],["protected_branches_controller.rb","files/app/controllers/protected_branches_controller_rb.html","",[]],["refs_controller.rb","files/app/controllers/refs_controller_rb.html","",[]],["repositories_controller.rb","files/app/controllers/repositories_controller_rb.html","",[]],["search_controller.rb","files/app/controllers/search_controller_rb.html","",[]],["services_controller.rb","files/app/controllers/services_controller_rb.html","",[]],["snippets_controller.rb","files/app/controllers/snippets_controller_rb.html","",[]],["team_members_controller.rb","files/app/controllers/team_members_controller_rb.html","",[]],["tree_controller.rb","files/app/controllers/tree_controller_rb.html","",[]],["wikis_controller.rb","files/app/controllers/wikis_controller_rb.html","",[]]]],["","","decorators",[["application_decorator.rb","files/app/decorators/application_decorator_rb.html","",[]],["commit_decorator.rb","files/app/decorators/commit_decorator_rb.html","",[]],["event_decorator.rb","files/app/decorators/event_decorator_rb.html","",[]],["tree_decorator.rb","files/app/decorators/tree_decorator_rb.html","",[]],["user_decorator.rb","files/app/decorators/user_decorator_rb.html","",[]]]],["","","helpers",[["application_helper.rb","files/app/helpers/application_helper_rb.html","",[]],["commits_helper.rb","files/app/helpers/commits_helper_rb.html","",[]],["dashboard_helper.rb","files/app/helpers/dashboard_helper_rb.html","",[]],["events_helper.rb","files/app/helpers/events_helper_rb.html","",[]],["gitlab_markdown_helper.rb","files/app/helpers/gitlab_markdown_helper_rb.html","",[]],["issues_helper.rb","files/app/helpers/issues_helper_rb.html","",[]],["merge_requests_helper.rb","files/app/helpers/merge_requests_helper_rb.html","",[]],["namespaces_helper.rb","files/app/helpers/namespaces_helper_rb.html","",[]],["notes_helper.rb","files/app/helpers/notes_helper_rb.html","",[]],["profile_helper.rb","files/app/helpers/profile_helper_rb.html","",[]],["projects_helper.rb","files/app/helpers/projects_helper_rb.html","",[]],["snippets_helper.rb","files/app/helpers/snippets_helper_rb.html","",[]],["tab_helper.rb","files/app/helpers/tab_helper_rb.html","",[]],["tags_helper.rb","files/app/helpers/tags_helper_rb.html","",[]],["tree_helper.rb","files/app/helpers/tree_helper_rb.html","",[]]]],["","","mailers",[["notify.rb","files/app/mailers/notify_rb.html","",[]]]],["","","models",[["ability.rb","files/app/models/ability_rb.html","",[]],["commit.rb","files/app/models/commit_rb.html","",[]],["event.rb","files/app/models/event_rb.html","",[]],["gitlab_ci_service.rb","files/app/models/gitlab_ci_service_rb.html","",[]],["group.rb","files/app/models/group_rb.html","",[]],["issue.rb","files/app/models/issue_rb.html","",[]],["key.rb","files/app/models/key_rb.html","",[]],["merge_request.rb","files/app/models/merge_request_rb.html","",[]],["milestone.rb","files/app/models/milestone_rb.html","",[]],["namespace.rb","files/app/models/namespace_rb.html","",[]],["note.rb","files/app/models/note_rb.html","",[]],["project.rb","files/app/models/project_rb.html","",[]],["project_hook.rb","files/app/models/project_hook_rb.html","",[]],["protected_branch.rb","files/app/models/protected_branch_rb.html","",[]],["service.rb","files/app/models/service_rb.html","",[]],["service_hook.rb","files/app/models/service_hook_rb.html","",[]],["snippet.rb","files/app/models/snippet_rb.html","",[]],["system_hook.rb","files/app/models/system_hook_rb.html","",[]],["tree.rb","files/app/models/tree_rb.html","",[]],["user.rb","files/app/models/user_rb.html","",[]],["users_project.rb","files/app/models/users_project_rb.html","",[]],["web_hook.rb","files/app/models/web_hook_rb.html","",[]],["wiki.rb","files/app/models/wiki_rb.html","",[]]]],["","","observers",[["activity_observer.rb","files/app/observers/activity_observer_rb.html","",[]],["issue_observer.rb","files/app/observers/issue_observer_rb.html","",[]],["key_observer.rb","files/app/observers/key_observer_rb.html","",[]],["merge_request_observer.rb","files/app/observers/merge_request_observer_rb.html","",[]],["note_observer.rb","files/app/observers/note_observer_rb.html","",[]],["project_observer.rb","files/app/observers/project_observer_rb.html","",[]],["system_hook_observer.rb","files/app/observers/system_hook_observer_rb.html","",[]],["user_observer.rb","files/app/observers/user_observer_rb.html","",[]],["users_project_observer.rb","files/app/observers/users_project_observer_rb.html","",[]]]],["","","roles",[["account.rb","files/app/roles/account_rb.html","",[]],["authority.rb","files/app/roles/authority_rb.html","",[]],["git_host.rb","files/app/roles/git_host_rb.html","",[]],["issue_commonality.rb","files/app/roles/issue_commonality_rb.html","",[]],["namespaced_project.rb","files/app/roles/namespaced_project_rb.html","",[]],["note_event.rb","files/app/roles/note_event_rb.html","",[]],["push_event.rb","files/app/roles/push_event_rb.html","",[]],["push_observer.rb","files/app/roles/push_observer_rb.html","",[]],["repository.rb","files/app/roles/repository_rb.html","",[]],["static_model.rb","files/app/roles/static_model_rb.html","",[]],["team.rb","files/app/roles/team_rb.html","",[]],["votes.rb","files/app/roles/votes_rb.html","",[]]]],["","","uploaders",[["attachment_uploader.rb","files/app/uploaders/attachment_uploader_rb.html","",[]]]],["","","workers",[["post_receive.rb","files/app/workers/post_receive_rb.html","",[]],["system_hook_worker.rb","files/app/workers/system_hook_worker_rb.html","",[]]]]]],["","","lib",[["","","api",[["entities.rb","files/lib/api/entities_rb.html","",[]],["helpers.rb","files/lib/api/helpers_rb.html","",[]],["issues.rb","files/lib/api/issues_rb.html","",[]],["merge_requests.rb","files/lib/api/merge_requests_rb.html","",[]],["milestones.rb","files/lib/api/milestones_rb.html","",[]],["notes.rb","files/lib/api/notes_rb.html","",[]],["projects.rb","files/lib/api/projects_rb.html","",[]],["session.rb","files/lib/api/session_rb.html","",[]],["users.rb","files/lib/api/users_rb.html","",[]]]],["api.rb","files/lib/api_rb.html","",[]],["event_filter.rb","files/lib/event_filter_rb.html","",[]],["extracts_path.rb","files/lib/extracts_path_rb.html","",[]],["file_size_validator.rb","files/lib/file_size_validator_rb.html","",[]],["","","gitlab",[["app_logger.rb","files/lib/gitlab/app_logger_rb.html","",[]],["auth.rb","files/lib/gitlab/auth_rb.html","",[]],["","","backend",[["gitolite.rb","files/lib/gitlab/backend/gitolite_rb.html","",[]],["gitolite_config.rb","files/lib/gitlab/backend/gitolite_config_rb.html","",[]],["grack_auth.rb","files/lib/gitlab/backend/grack_auth_rb.html","",[]]]],["git_logger.rb","files/lib/gitlab/git_logger_rb.html","",[]],["git_stats.rb","files/lib/gitlab/git_stats_rb.html","",[]],["","","graph",[["commit.rb","files/lib/gitlab/graph/commit_rb.html","",[]],["json_builder.rb","files/lib/gitlab/graph/json_builder_rb.html","",[]]]],["inline_diff.rb","files/lib/gitlab/inline_diff_rb.html","",[]],["logger.rb","files/lib/gitlab/logger_rb.html","",[]],["markdown.rb","files/lib/gitlab/markdown_rb.html","",[]],["project_mover.rb","files/lib/gitlab/project_mover_rb.html","",[]],["regex.rb","files/lib/gitlab/regex_rb.html","",[]],["","","satellite",[["action.rb","files/lib/gitlab/satellite/action_rb.html","",[]],["edit_file_action.rb","files/lib/gitlab/satellite/edit_file_action_rb.html","",[]],["merge_action.rb","files/lib/gitlab/satellite/merge_action_rb.html","",[]],["satellite.rb","files/lib/gitlab/satellite/satellite_rb.html","",[]]]],["seeder.rb","files/lib/gitlab/seeder_rb.html","",[]],["theme.rb","files/lib/gitlab/theme_rb.html","",[]]]],["","","hooks",[["post-receive","files/lib/hooks/post-receive.html","",[]]]],["","","redcarpet",[["","","render",[["gitlab_html.rb","files/lib/redcarpet/render/gitlab_html_rb.html","",[]]]]]]]]]],["Ability","classes/Ability.html"," < Object",[]],["Account","classes/Account.html","",[]],["ActivityObserver","classes/ActivityObserver.html"," < ActiveRecord::Observer",[]],["Admin","classes/Admin.html","",[["DashboardController","classes/Admin/DashboardController.html"," < AdminController",[]],["GroupsController","classes/Admin/GroupsController.html"," < AdminController",[]],["HooksController","classes/Admin/HooksController.html"," < AdminController",[]],["LogsController","classes/Admin/LogsController.html"," < AdminController",[]],["ProjectsController","classes/Admin/ProjectsController.html"," < AdminController",[]],["ResqueController","classes/Admin/ResqueController.html"," < AdminController",[]],["TeamMembersController","classes/Admin/TeamMembersController.html"," < AdminController",[]],["UsersController","classes/Admin/UsersController.html"," < AdminController",[]]]],["AdminController","classes/AdminController.html"," < ApplicationController",[]],["ApplicationController","classes/ApplicationController.html"," < ActionController::Base",[]],["ApplicationDecorator","classes/ApplicationDecorator.html"," < Draper::Base",[]],["ApplicationHelper","classes/ApplicationHelper.html","",[]],["AttachmentUploader","classes/AttachmentUploader.html"," < CarrierWave::Uploader::Base",[]],["Authority","classes/Authority.html","",[]],["BaseContext","classes/BaseContext.html"," < Object",[]],["BlameController","classes/BlameController.html"," < ProjectResourceController",[]],["BlobController","classes/BlobController.html"," < ProjectResourceController",[]],["Commit","classes/Commit.html"," < Object",[]],["CommitController","classes/CommitController.html"," < ProjectResourceController",[]],["CommitDecorator","classes/CommitDecorator.html"," < ApplicationDecorator",[]],["CommitLoadContext","classes/CommitLoadContext.html"," < BaseContext",[]],["CommitsController","classes/CommitsController.html"," < ProjectResourceController",[]],["CommitsHelper","classes/CommitsHelper.html","",[]],["CompareController","classes/CompareController.html"," < ProjectResourceController",[]],["DashboardController","classes/DashboardController.html"," < ApplicationController",[]],["DashboardHelper","classes/DashboardHelper.html","",[]],["DeployKeysController","classes/DeployKeysController.html"," < ProjectResourceController",[]],["ErrorsController","classes/ErrorsController.html"," < ApplicationController",[]],["Event","classes/Event.html"," < ActiveRecord::Base",[]],["EventDecorator","classes/EventDecorator.html"," < ApplicationDecorator",[]],["EventFilter","classes/EventFilter.html"," < Object",[]],["EventsHelper","classes/EventsHelper.html","",[]],["ExtractsPath","classes/ExtractsPath.html","",[["InvalidPathError","classes/ExtractsPath/InvalidPathError.html"," < StandardError",[]]]],["FileSizeValidator","classes/FileSizeValidator.html"," < ActiveModel::EachValidator",[["Helper","classes/FileSizeValidator/Helper.html"," < Object",[]]]],["GitHost","classes/GitHost.html","",[]],["Gitlab","classes/Gitlab.html","",[["API","classes/Gitlab/API.html"," < Grape::API",[]],["APIHelpers","classes/Gitlab/APIHelpers.html","",[]],["AppLogger","classes/Gitlab/AppLogger.html"," < Gitlab::Logger",[]],["Auth","classes/Gitlab/Auth.html"," < Object",[]],["Entities","classes/Gitlab/Entities.html","",[["Hook","classes/Gitlab/Entities/Hook.html"," < Grape::Entity",[]],["Issue","classes/Gitlab/Entities/Issue.html"," < Grape::Entity",[]],["MRNote","classes/Gitlab/Entities/MRNote.html"," < Grape::Entity",[]],["MergeRequest","classes/Gitlab/Entities/MergeRequest.html"," < Grape::Entity",[]],["Milestone","classes/Gitlab/Entities/Milestone.html"," < Grape::Entity",[]],["Note","classes/Gitlab/Entities/Note.html"," < Grape::Entity",[]],["Project","classes/Gitlab/Entities/Project.html"," < Grape::Entity",[]],["ProjectMember","classes/Gitlab/Entities/ProjectMember.html"," < Gitlab::Entities::UserBasic",[]],["ProjectSnippet","classes/Gitlab/Entities/ProjectSnippet.html"," < Grape::Entity",[]],["RepoCommit","classes/Gitlab/Entities/RepoCommit.html"," < Grape::Entity",[]],["RepoObject","classes/Gitlab/Entities/RepoObject.html"," < Grape::Entity",[]],["SSHKey","classes/Gitlab/Entities/SSHKey.html"," < Grape::Entity",[]],["User","classes/Gitlab/Entities/User.html"," < Grape::Entity",[]],["UserBasic","classes/Gitlab/Entities/UserBasic.html"," < Grape::Entity",[]],["UserLogin","classes/Gitlab/Entities/UserLogin.html"," < Gitlab::Entities::UserBasic",[]]]],["GitLogger","classes/Gitlab/GitLogger.html"," < Gitlab::Logger",[]],["GitStats","classes/Gitlab/GitStats.html"," < Object",[]],["Gitolite","classes/Gitlab/Gitolite.html"," < Object",[["AccessDenied","classes/Gitlab/Gitolite/AccessDenied.html"," < StandardError",[]]]],["GitoliteConfig","classes/Gitlab/GitoliteConfig.html"," < Object",[["PullError","classes/Gitlab/GitoliteConfig/PullError.html"," < StandardError",[]],["PushError","classes/Gitlab/GitoliteConfig/PushError.html"," < StandardError",[]]]],["Graph","classes/Gitlab/Graph.html","",[["Commit","classes/Gitlab/Graph/Commit.html"," < Object",[]],["JsonBuilder","classes/Gitlab/Graph/JsonBuilder.html"," < Object",[]]]],["InlineDiff","classes/Gitlab/InlineDiff.html"," < Object",[]],["Issues","classes/Gitlab/Issues.html"," < Grape::API",[]],["Logger","classes/Gitlab/Logger.html"," < Logger",[]],["Markdown","classes/Gitlab/Markdown.html","",[]],["MergeRequests","classes/Gitlab/MergeRequests.html"," < Grape::API",[]],["Milestones","classes/Gitlab/Milestones.html"," < Grape::API",[]],["Notes","classes/Gitlab/Notes.html"," < Grape::API",[]],["ProjectMover","classes/Gitlab/ProjectMover.html"," < Object",[["ProjectMoveError","classes/Gitlab/ProjectMover/ProjectMoveError.html"," < StandardError",[]]]],["Projects","classes/Gitlab/Projects.html"," < Grape::API",[]],["Regex","classes/Gitlab/Regex.html","",[]],["Satellite","classes/Gitlab/Satellite.html","",[["Action","classes/Gitlab/Satellite/Action.html"," < Object",[]],["EditFileAction","classes/Gitlab/Satellite/EditFileAction.html"," < Action",[]],["MergeAction","classes/Gitlab/Satellite/MergeAction.html"," < Action",[]],["Satellite","classes/Gitlab/Satellite/Satellite.html"," < Object",[]]]],["Seeder","classes/Gitlab/Seeder.html"," < Object",[]],["Session","classes/Gitlab/Session.html"," < Grape::API",[]],["Theme","classes/Gitlab/Theme.html"," < Object",[]],["Users","classes/Gitlab/Users.html"," < Grape::API",[]]]],["GitlabCiService","classes/GitlabCiService.html"," < Service",[]],["GitlabMarkdownHelper","classes/GitlabMarkdownHelper.html","",[]],["Grack","classes/Grack.html","",[["Auth","classes/Grack/Auth.html"," < Rack::Auth::Basic",[]]]],["Group","classes/Group.html"," < Namespace",[]],["GroupsController","classes/GroupsController.html"," < ApplicationController",[]],["HelpController","classes/HelpController.html"," < ApplicationController",[]],["HooksController","classes/HooksController.html"," < ProjectResourceController",[]],["Issue","classes/Issue.html"," < ActiveRecord::Base",[]],["IssueCommonality","classes/IssueCommonality.html","",[["ClassMethods","classes/IssueCommonality/ClassMethods.html","",[]]]],["IssueObserver","classes/IssueObserver.html"," < ActiveRecord::Observer",[]],["IssuesBulkUpdateContext","classes/IssuesBulkUpdateContext.html"," < BaseContext",[]],["IssuesController","classes/IssuesController.html"," < ProjectResourceController",[]],["IssuesHelper","classes/IssuesHelper.html","",[]],["IssuesListContext","classes/IssuesListContext.html"," < BaseContext",[]],["Key","classes/Key.html"," < ActiveRecord::Base",[]],["KeyObserver","classes/KeyObserver.html"," < ActiveRecord::Observer",[]],["KeysController","classes/KeysController.html"," < ApplicationController",[]],["LabelsController","classes/LabelsController.html"," < ProjectResourceController",[]],["MergeRequest","classes/MergeRequest.html"," < ActiveRecord::Base",[]],["MergeRequestObserver","classes/MergeRequestObserver.html"," < ActiveRecord::Observer",[]],["MergeRequestsController","classes/MergeRequestsController.html"," < ProjectResourceController",[]],["MergeRequestsHelper","classes/MergeRequestsHelper.html","",[]],["MergeRequestsLoadContext","classes/MergeRequestsLoadContext.html"," < BaseContext",[]],["Milestone","classes/Milestone.html"," < ActiveRecord::Base",[]],["MilestonesController","classes/MilestonesController.html"," < ProjectResourceController",[]],["Namespace","classes/Namespace.html"," < ActiveRecord::Base",[]],["NamespacedProject","classes/NamespacedProject.html","",[]],["NamespacesHelper","classes/NamespacesHelper.html","",[]],["Note","classes/Note.html"," < ActiveRecord::Base",[]],["NoteEvent","classes/NoteEvent.html","",[]],["NoteObserver","classes/NoteObserver.html"," < ActiveRecord::Observer",[]],["Notes","classes/Notes.html","",[["CreateContext","classes/Notes/CreateContext.html"," < BaseContext",[]],["LoadContext","classes/Notes/LoadContext.html"," < BaseContext",[]]]],["NotesController","classes/NotesController.html"," < ProjectResourceController",[]],["NotesHelper","classes/NotesHelper.html","",[]],["Notify","classes/Notify.html"," < ActionMailer::Base",[]],["OmniauthCallbacksController","classes/OmniauthCallbacksController.html"," < Devise::OmniauthCallbacksController",[]],["PostReceive","classes/PostReceive.html"," < Object",[]],["ProfileHelper","classes/ProfileHelper.html","",[]],["ProfilesController","classes/ProfilesController.html"," < ApplicationController",[]],["Project","classes/Project.html"," < ActiveRecord::Base",[["TransferError","classes/Project/TransferError.html"," < StandardError",[]]]],["ProjectHook","classes/ProjectHook.html"," < WebHook",[]],["ProjectObserver","classes/ProjectObserver.html"," < ActiveRecord::Observer",[]],["ProjectResourceController","classes/ProjectResourceController.html"," < ApplicationController",[]],["ProjectUpdateContext","classes/ProjectUpdateContext.html"," < BaseContext",[]],["ProjectsController","classes/ProjectsController.html"," < ProjectResourceController",[]],["ProjectsHelper","classes/ProjectsHelper.html","",[]],["ProtectedBranch","classes/ProtectedBranch.html"," < ActiveRecord::Base",[]],["ProtectedBranchesController","classes/ProtectedBranchesController.html"," < ProjectResourceController",[]],["PushEvent","classes/PushEvent.html","",[]],["PushObserver","classes/PushObserver.html","",[]],["Redcarpet","classes/Redcarpet.html","",[["Render","classes/Redcarpet/Render.html","",[["GitlabHTML","classes/Redcarpet/Render/GitlabHTML.html"," < Redcarpet::Render::HTML",[]]]]]],["RefsController","classes/RefsController.html"," < ProjectResourceController",[]],["RepositoriesController","classes/RepositoriesController.html"," < ProjectResourceController",[]],["Repository","classes/Repository.html","",[]],["SearchContext","classes/SearchContext.html"," < Object",[]],["SearchController","classes/SearchController.html"," < ApplicationController",[]],["Service","classes/Service.html"," < ActiveRecord::Base",[]],["ServiceHook","classes/ServiceHook.html"," < WebHook",[]],["ServicesController","classes/ServicesController.html"," < ProjectResourceController",[]],["Snippet","classes/Snippet.html"," < ActiveRecord::Base",[]],["SnippetsController","classes/SnippetsController.html"," < ProjectResourceController",[]],["SnippetsHelper","classes/SnippetsHelper.html","",[]],["StaticModel","classes/StaticModel.html","",[["ClassMethods","classes/StaticModel/ClassMethods.html","",[]]]],["SystemHook","classes/SystemHook.html"," < WebHook",[]],["SystemHookObserver","classes/SystemHookObserver.html"," < ActiveRecord::Observer",[]],["SystemHookWorker","classes/SystemHookWorker.html"," < Object",[]],["TabHelper","classes/TabHelper.html","",[]],["TagsHelper","classes/TagsHelper.html","",[]],["Team","classes/Team.html","",[]],["TeamMembersController","classes/TeamMembersController.html"," < ProjectResourceController",[]],["TestHookContext","classes/TestHookContext.html"," < BaseContext",[]],["Tree","classes/Tree.html"," < Object",[]],["TreeController","classes/TreeController.html"," < ProjectResourceController",[]],["TreeDecorator","classes/TreeDecorator.html"," < ApplicationDecorator",[]],["TreeHelper","classes/TreeHelper.html","",[]],["User","classes/User.html"," < ActiveRecord::Base",[]],["UserDecorator","classes/UserDecorator.html"," < ApplicationDecorator",[]],["UserObserver","classes/UserObserver.html"," < ActiveRecord::Observer",[]],["UsersProject","classes/UsersProject.html"," < ActiveRecord::Base",[]],["UsersProjectObserver","classes/UsersProjectObserver.html"," < ActiveRecord::Observer",[]],["Votes","classes/Votes.html","",[]],["WebHook","classes/WebHook.html"," < ActiveRecord::Base",[]],["Wiki","classes/Wiki.html"," < ActiveRecord::Base",[]],["WikisController","classes/WikisController.html"," < ProjectResourceController",[]]] \ No newline at end of file diff --git a/doc/install/installation.md b/doc/install/installation.md index b872ceaf2bd..7fb5e48cdc9 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -19,7 +19,7 @@ following the contribution guide (see `CONTRIBUTING.md`). # Overview -The GitLab installation consists of setting up th following components: +The GitLab installation consists of setting up the following components: 1. Packages / Dependencies 2. Ruby @@ -149,6 +149,23 @@ Fix the directory permissions for the repositories: sudo chmod -R ug+rwXs,o-rwx /home/git/repositories/ sudo chown -R git:git /home/git/repositories/ + +## Disable StrictHostKeyChecking for localhost and your domain + + echo "Host localhost + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config + + echo "Host YOUR_DOMAIN_NAME + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config + + # If gitolite domain differs + echo "Host YOUR_GITOLITE_DOMAIN + StrictHostKeyChecking no + UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config + + ## Test if everything works so far # Clone the admin repo so SSH adds localhost to known_hosts ... @@ -176,11 +193,17 @@ See `doc/install/databases.md` ## Clone the Source - # Clone the latest stable release - sudo -u gitlab -H git clone -b stable https://github.com/gitlabhq/gitlabhq.git gitlab + # Clone GitLab repository + sudo -u gitlab -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab + + # Go to gitlab dir + cd /home/gitlab/gitlab + + # Checkout to stable release + sudo -u gitlab -H git checkout 4-0-stable **Note:** -You can change `stable` to `master` if you want the *bleeding edge* version, but +You can change `4-0-stable` to `master` if you want the *bleeding edge* version, but do so with caution! ## Configure it diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index bbfeeb716fa..9b42afa7ca0 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -4,7 +4,7 @@ Creates a backup archive of the database and all repositories. This archive will The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup. ``` -bundle exec rake gitlab:backup:create +bundle exec rake gitlab:backup:create RAILS_ENV=production ``` Example output: @@ -40,7 +40,7 @@ Deleting old backups... [SKIPPING] ### Restore a previously created backup ``` -bundle exec rake gitlab:backup:restore +bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` Options: diff --git a/doc/raketasks/cleanup.md b/doc/raketasks/cleanup.md new file mode 100644 index 00000000000..ad9e5a613b0 --- /dev/null +++ b/doc/raketasks/cleanup.md @@ -0,0 +1,20 @@ +### Remove grabage from gitolite config and filesystem. Important! Data loss! + +Remove projects from gitolite config if they dont exist in GitLab database + +``` +bundle exec rake gitlab:cleanup:config RAILS_ENV=production +``` + +Remove namespaces(dirs) from /home/git/repositories if they dont exist in GitLab database + +``` +bundle exec rake gitlab:cleanup:dirs RAILS_ENV=production +``` + +Remove repositories (global only for now) from /home/git/repositories if they dont exist in GitLab database + +``` +bundle exec rake gitlab:cleanup:repos RAILS_ENV=production +``` + diff --git a/doc/raketasks/features.md b/doc/raketasks/features.md index 7a2a4b668bd..7f7daaf046c 100644 --- a/doc/raketasks/features.md +++ b/doc/raketasks/features.md @@ -13,7 +13,7 @@ Old path: `git@example.org:myrepo.git` New path: `git@example.org:username/myrepo.git` or `git@example.org:groupname/myrepo.git` ``` -bundle exec rake gitlab:enable_namespaces +bundle exec rake gitlab:enable_namespaces RAILS_ENV=production ``` @@ -22,7 +22,7 @@ bundle exec rake gitlab:enable_namespaces This command will enable the auto merge feature. After this you will be able to **merge a merge request** via GitLab and use the **online editor**. ``` -bundle exec rake gitlab:enable_automerge +bundle exec rake gitlab:enable_automerge RAILS_ENV=production ``` Example output: diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index bb8e1ed29f7..758580b6832 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -7,7 +7,7 @@ Runs the following rake tasks: * gitlab:app:enable_automerge (see "Features") ``` -bundle exec rake gitlab:app:setup +bundle exec rake gitlab:app:setup RAILS_ENV=production ``` @@ -17,7 +17,7 @@ This command gathers information about your GitLab installation and the System it runs on. These may be useful when asking for help or reporting issues. ``` -bundle exec rake gitlab:env:info +bundle exec rake gitlab:env:info RAILS_ENV=production ``` Example output: @@ -68,7 +68,7 @@ It will check that each component was setup according to the installation guide You may also have a look at our [Trouble Shooting Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide). ``` -bundle exec rake gitlab:check +bundle exec rake gitlab:check RAILS_ENV=production ``` Example output: @@ -145,7 +145,7 @@ This will create satellite repos for all your projects. If necessary, remove the `tmp/repo_satellites` directory and rerun the command below. ``` -bundle exec rake gitlab:satellites:create +bundle exec rake gitlab:satellites:create RAILS_ENV=production ``` @@ -154,7 +154,7 @@ bundle exec rake gitlab:satellites:create This will send all users ssh public keys to gitolite and grant them access (based on their permission) to their projects. ``` -bundle exec rake gitlab:gitolite:update_keys +bundle exec rake gitlab:gitolite:update_keys RAILS_ENV=production ``` @@ -163,7 +163,7 @@ bundle exec rake gitlab:gitolite:update_keys This makes sure that all projects are present in gitolite and can be accessed. ``` -bundle exec rake gitlab:gitolite:update_repos +bundle exec rake gitlab:gitolite:update_repos RAILS_ENV=production ``` ### Import bare repositories into GitLab project instance diff --git a/features/admin/groups.feature b/features/admin/groups.feature index e5eab8e6ecb..28f35e3a831 100644 --- a/features/admin/groups.feature +++ b/features/admin/groups.feature @@ -1,6 +1,8 @@ Feature: Admin Groups Background: Given I sign in as an admin + And I have group with projects + And Create gitlab user "John" And I visit admin groups page Scenario: Create a group @@ -8,3 +10,8 @@ Feature: Admin Groups And submit form with new group info Then I should be redirected to group page And I should see newly created group + + Scenario: Add user into projects in group + When I visit admin group page + When I select user "John" from user list as "Reporter" + Then I should see "John" in team list in every project as "Reporter" diff --git a/features/admin/logs.feature b/features/admin/logs.feature new file mode 100644 index 00000000000..d07f0048080 --- /dev/null +++ b/features/admin/logs.feature @@ -0,0 +1,7 @@ +Feature: Admin Logs + Background: + Given I sign in as an admin + + Scenario: On Admin Logs + Given I visit admin logs page + Then I should see tabs with available logs diff --git a/features/admin/projects.feature b/features/admin/projects.feature new file mode 100644 index 00000000000..4a4ee1c11e0 --- /dev/null +++ b/features/admin/projects.feature @@ -0,0 +1,13 @@ +Feature: Admin Projects + Background: + Given I sign in as an admin + And there are projects in system + + Scenario: Projects list + When I visit admin projects page + Then I should see all projects + + Scenario: Projects show + When I visit admin projects page + And I click on first project + Then I should see project details diff --git a/features/admin/users.feature b/features/admin/users.feature new file mode 100644 index 00000000000..03ac86a367b --- /dev/null +++ b/features/admin/users.feature @@ -0,0 +1,8 @@ +Feature: Admin Users + Background: + Given I sign in as an admin + And system has users + + Scenario: On Admin Users + Given I visit admin users page + Then I should see all users diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index 972f8e36609..759843692b8 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -5,6 +5,7 @@ Feature: Dashboard And project "Shop" has push event And I visit dashboard page + @javascript Scenario: I should see projects list Then I should see "New Project" link Then I should see "Shop" project link @@ -26,11 +27,13 @@ Feature: Dashboard And I click "Create Merge Request" link Then I see prefilled new Merge Request page + @javascript Scenario: I should see User joined Project event Given user with name "John Doe" joined project "Shop" When I visit dashboard page Then I should see "John Doe joined project at Shop" event + @javascript Scenario: I should see User left Project event Given user with name "John Doe" joined project "Shop" And user with name "John Doe" left project "Shop" diff --git a/features/dashboard/event_filters.feature b/features/dashboard/event_filters.feature new file mode 100644 index 00000000000..e0c6b84b008 --- /dev/null +++ b/features/dashboard/event_filters.feature @@ -0,0 +1,51 @@ +Feature: Event filters + Background: + Given I sign in as a user + And I own a project + And this project has push event + And this project has new member event + And this project has merge request event + And I visit dashboard page + + @javascript + Scenario: I should see all events + Then I should see push event + And I should see new member event + And I should see merge request event + + @javascript + Scenario: I should see only pushed events + When I click "push" event filter + Then I should see push event + And I should not see new member event + And I should not see merge request event + + @javascript + Scenario: I should see only joined events + When I click "team" event filter + Then I should see new member event + And I should not see push event + And I should not see merge request event + + @javascript + Scenario: I should see only merged events + When I click "merge" event filter + Then I should see merge request event + And I should not see push event + And I should not see new member event + + @javascript + Scenario: I should see only selected events while page reloaded + When I click "push" event filter + And I visit dashboard page + Then I should see push event + And I should not see new member event + When I click "team" event filter + And I visit dashboard page + Then I should see push event + And I should see new member event + And I should not see merge request event + When I click "push" event filter + Then I should not see push event + And I should see new member event + And I should not see merge request event diff --git a/features/group/group.feature b/features/group/group.feature index 07308112270..a4a55a7fc26 100644 --- a/features/group/group.feature +++ b/features/group/group.feature @@ -3,6 +3,7 @@ Feature: Groups Given I sign in as a user And I have group with projects + @javascript Scenario: I should see group dashboard list When I visit group page Then I should see projects list @@ -17,3 +18,9 @@ Feature: Groups Given project from group has merge requests assigned to me When I visit group merge requests page Then I should see merge requests from this group assigned to me + + Scenario: I should add user to projects in Group + Given I have new user "John" + When I visit group people page + And I select user "John" from list with role "Reporter" + Then I should see user "John" in team list diff --git a/features/project/project.feature b/features/project/project.feature index 1c9f201df50..ad3d06bb41f 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -1,14 +1,23 @@ Feature: Projects Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" + And project "Shop" has push event And I visit project "Shop" page - # @wip - # Scenario: I should see project activity + Scenario: I should see project activity + When I visit project "Shop" page + Then I should see project "Shop" activity feed - # @wip - # Scenario: I edit project + Scenario: I visit edit project + When I visit edit project "Shop" page + Then I should see project settings + + Scenario: I edit project + When I visit edit project "Shop" page + And change project settings + And I save project + Then I should see project with new settings # @wip # Scenario: I visit attachments diff --git a/features/project/service.feature b/features/project/service.feature new file mode 100644 index 00000000000..ca8a4756056 --- /dev/null +++ b/features/project/service.feature @@ -0,0 +1,14 @@ +Feature: Project Services + Background: + Given I sign in as a user + And I own project "Shop" + + Scenario: I should see project services + When I visit project "Shop" services page + Then I should see list of available services + + Scenario: Activate gitlab-ci service + When I visit project "Shop" services page + And I click gitlab-ci service link + And I fill gitlab-ci settings + Then I should see service settings saved diff --git a/features/steps/admin/admin_active_tab.rb b/features/steps/admin/admin_active_tab.rb index 05a9a686e01..48ec7bac0d6 100644 --- a/features/steps/admin/admin_active_tab.rb +++ b/features/steps/admin/admin_active_tab.rb @@ -28,6 +28,6 @@ class AdminActiveTab < Spinach::FeatureSteps end Then 'the active main tab should be Resque' do - ensure_active_main_tab('Resque') + ensure_active_main_tab('Background Jobs') end end diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb index 5386f473320..cbca2daa701 100644 --- a/features/steps/admin/admin_groups.rb +++ b/features/steps/admin/admin_groups.rb @@ -3,10 +3,26 @@ class AdminGroups < Spinach::FeatureSteps include SharedPaths include SharedActiveTab + When 'I visit admin group page' do + visit admin_group_path(current_group) + end + When 'I click new group link' do click_link "New Group" end + And 'I have group with projects' do + @group = create(:group) + @project = create(:project, group: @group) + @event = create(:closed_issue_event, project: @project) + + @project.team << [current_user, :master] + end + + And 'Create gitlab user "John"' do + create(:user, :name => "John") + end + And 'submit form with new group info' do fill_in 'group_name', :with => 'gitlab' click_button "Create group" @@ -19,5 +35,25 @@ class AdminGroups < Spinach::FeatureSteps Then 'I should be redirected to group page' do current_path.should == admin_group_path(Group.last) end -end + When 'I select user "John" from user list as "Reporter"' do + user = User.find_by_name("John") + within "#new_team_member" do + select user.name, :from => "user_ids" + select "Reporter", :from => "project_access" + end + click_button "Add user to projects in group" + end + + Then 'I should see "John" in team list in every project as "Reporter"' do + user = User.find_by_name("John") + projects_with_access = find(".user_#{user.id} .projects_access") + projects_with_access.should have_link("Reporter") + end + + protected + + def current_group + @group ||= Group.first + end +end diff --git a/features/steps/admin/admin_logs.rb b/features/steps/admin/admin_logs.rb new file mode 100644 index 00000000000..83958545c4d --- /dev/null +++ b/features/steps/admin/admin_logs.rb @@ -0,0 +1,11 @@ +class AdminLogs < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + Then 'I should see tabs with available logs' do + page.should have_content 'production.log' + page.should have_content 'githost.log' + page.should have_content 'application.log' + end +end diff --git a/features/steps/admin/admin_projects.rb b/features/steps/admin/admin_projects.rb new file mode 100644 index 00000000000..dd6b4e9810b --- /dev/null +++ b/features/steps/admin/admin_projects.rb @@ -0,0 +1,24 @@ +class AdminProjects < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + And 'I should see all projects' do + Project.all.each do |p| + page.should have_content p.name_with_namespace + end + end + + And 'I click on first project' do + click_link Project.first.name_with_namespace + end + + Then 'I should see project details' do + project = Project.first + current_path.should == admin_project_path(project) + + page.should have_content(project.name_with_namespace) + page.should have_content(project.creator.name) + page.should have_content('Add new team member') + end +end diff --git a/features/steps/admin/admin_users.rb b/features/steps/admin/admin_users.rb new file mode 100644 index 00000000000..1828ae705ce --- /dev/null +++ b/features/steps/admin/admin_users.rb @@ -0,0 +1,11 @@ +class AdminUsers < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedAdmin + + Then 'I should see all users' do + User.all.each do |user| + page.should have_content user.name + end + end +end diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index 775a721f1a4..4bcefba76de 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -1,6 +1,7 @@ class Dashboard < Spinach::FeatureSteps include SharedAuthentication include SharedPaths + include SharedProject Then 'I should see "New Project" link' do page.should have_link "New Project" @@ -10,11 +11,6 @@ class Dashboard < Spinach::FeatureSteps page.should have_link "Shop" end - Then 'I should see project "Shop" activity feed' do - project = Project.find_by_name("Shop") - page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" - end - Then 'I should see last push widget' do page.should have_content "You pushed to new_design" page.should have_link "Create Merge Request" @@ -59,43 +55,12 @@ class Dashboard < Spinach::FeatureSteps page.should have_content "John Doe left project at Shop" end - And 'I own project "Shop"' do - @project = create :project, name: 'Shop' - @project.add_access(@user, :admin) - end - And 'I have group with projects' do @group = create(:group) @project = create(:project, group: @group) @event = create(:closed_issue_event, project: @project) - @project.add_access current_user, :admin - end - - And 'project "Shop" has push event' do - @project = Project.find_by_name("Shop") - - data = { - before: "0000000000000000000000000000000000000000", - after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - ref: "refs/heads/new_design", - user_id: @user.id, - user_name: @user.name, - repository: { - name: @project.name, - url: "localhost/rubinius", - description: "", - homepage: "localhost/rubinius", - private: true - } - } - - @event = Event.create( - project: @project, - action: Event::Pushed, - data: data, - author_id: @user.id - ) + @project.team << [current_user, :master] end Then 'I should see groups list' do @@ -112,5 +77,4 @@ class Dashboard < Spinach::FeatureSteps Then 'I should see 1 project at group list' do page.find('span.last_activity/span').should have_content('1') end - end diff --git a/features/steps/dashboard/dashboard_event_filters.rb b/features/steps/dashboard/dashboard_event_filters.rb new file mode 100644 index 00000000000..bfc053631ab --- /dev/null +++ b/features/steps/dashboard/dashboard_event_filters.rb @@ -0,0 +1,87 @@ +class EventFilters < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Then 'I should see push event' do + page.should have_selector('span.pushed') + end + + Then 'I should not see push event' do + page.should_not have_selector('span.pushed') + end + + Then 'I should see new member event' do + page.should have_selector('span.joined') + end + + And 'I should not see new member event' do + page.should_not have_selector('span.joined') + end + + Then 'I should see merge request event' do + page.should have_selector('span.merged') + end + + And 'I should not see merge request event' do + page.should_not have_selector('span.merged') + end + + And 'this project has push event' do + data = { + before: "0000000000000000000000000000000000000000", + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + ref: "refs/heads/new_design", + user_id: @user.id, + user_name: @user.name, + repository: { + name: @project.name, + url: "localhost/rubinius", + description: "", + homepage: "localhost/rubinius", + private: true + } + } + + @event = Event.create( + project: @project, + action: Event::Pushed, + data: data, + author_id: @user.id + ) + end + + And 'this project has new member event' do + user = create(:user, {name: "John Doe"}) + Event.create( + project: @project, + author_id: user.id, + action: Event::Joined + ) + end + + And 'this project has merge request event' do + merge_request = create :merge_request, author: @user, project: @project + Event.create( + project: @project, + action: Event::Merged, + target_id: merge_request.id, + target_type: "MergeRequest", + author_id: @user.id + ) + end + + When 'I click "push" event filter' do + click_link("push_event_filter") + end + + When 'I click "team" event filter' do + click_link("team_event_filter") + end + + When 'I click "merge" event filter' do + click_link("merged_event_filter") + end + +end + diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb index 5ace88023f0..fcf4296ad11 100644 --- a/features/steps/dashboard/dashboard_issues.rb +++ b/features/steps/dashboard/dashboard_issues.rb @@ -13,7 +13,7 @@ class DashboardIssues < Spinach::FeatureSteps And 'I have assigned issues' do project = create :project - project.add_access(@user, :read, :write) + project.team << [@user, :master] 2.times { create :issue, author: @user, assignee: @user, project: project } end diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb index 485a4ccc113..7cfa8a13ff8 100644 --- a/features/steps/dashboard/dashboard_merge_requests.rb +++ b/features/steps/dashboard/dashboard_merge_requests.rb @@ -14,8 +14,8 @@ class DashboardMergeRequests < Spinach::FeatureSteps project1 = create :project project2 = create :project - project1.add_access(@user, :read, :write) - project2.add_access(@user, :read, :write) + project1.team << [@user, :master] + project2.team << [@user, :master] merge_request1 = create :merge_request, author: @user, project: project1 merge_request2 = create :merge_request, author: @user, project: project2 diff --git a/features/steps/dashboard/dashboard_search.rb b/features/steps/dashboard/dashboard_search.rb index a34c14d0c5f..9c8c879479d 100644 --- a/features/steps/dashboard/dashboard_search.rb +++ b/features/steps/dashboard/dashboard_search.rb @@ -1,6 +1,7 @@ class DashboardSearch < Spinach::FeatureSteps include SharedAuthentication include SharedPaths + include SharedProject Given 'I search for "Sho"' do fill_in "dashboard_search", with: "Sho" @@ -11,11 +12,6 @@ class DashboardSearch < Spinach::FeatureSteps page.should have_link "Shop" end - And 'I own project "Shop"' do - @project = create(:project, :name => "Shop") - @project.add_access(@user, :admin) - end - Given 'I search for "Contibuting"' do fill_in "dashboard_search", with: "Contibuting" click_button "Search" diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 4de260ec33e..04d8c874b3e 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -3,17 +3,17 @@ class Groups < Spinach::FeatureSteps include SharedPaths Then 'I should see projects list' do - current_user.projects.each do |project| + current_user.authorized_projects.each do |project| page.should have_link project.name end end And 'I have group with projects' do - @group = create(:group) + @group = create(:group, owner: current_user) @project = create(:project, group: @group) @event = create(:closed_issue_event, project: @project) - @project.add_access current_user, :admin + @project.team << [current_user, :master] end And 'I should see projects activity feed' do @@ -32,6 +32,24 @@ class Groups < Spinach::FeatureSteps end end + Given 'I have new user "John"' do + create(:user, name: "John") + end + + And 'I select user "John" from list with role "Reporter"' do + user = User.find_by_name("John") + within "#new_team_member" do + select user.name, :from => "user_ids" + select "Reporter", :from => "project_access" + end + click_button "Add" + end + + Then 'I should see user "John" in team list' do + projects_with_access = find(".ui-box .well-list") + projects_with_access.should have_content("John") + end + Given 'project from group has issues assigned to me' do create :issue, project: project, diff --git a/features/steps/project/create_project.rb b/features/steps/project/create_project.rb index b9b4534ed68..0d9727732c7 100644 --- a/features/steps/project/create_project.rb +++ b/features/steps/project/create_project.rb @@ -3,13 +3,13 @@ class CreateProject < Spinach::FeatureSteps include SharedPaths And 'fill project form with valid data' do - fill_in 'project_name', :with => 'NewProject' + fill_in 'project_name', with: 'Empty' click_button "Create project" end Then 'I should see project page' do current_path.should == project_path(Project.last) - page.should have_content "NewProject" + page.should have_content "Empty" end And 'I should see empty project instuctions' do diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index f33f12eb0a8..7a85f57a218 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -2,4 +2,17 @@ class Projects < Spinach::FeatureSteps include SharedAuthentication include SharedProject include SharedPaths + + And 'change project settings' do + fill_in 'project_name', with: 'NewName' + uncheck 'project_issues_enabled' + end + + And 'I save project' do + click_button 'Save' + end + + Then 'I should see project with new settings' do + find_field('project_name').value.should == 'NewName' + end end diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb index 2c03ce14fc1..3433c2ba5f6 100644 --- a/features/steps/project/project_browse_commits.rb +++ b/features/steps/project/project_browse_commits.rb @@ -4,7 +4,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps include SharedPaths Then 'I see project commits' do - commit = @project.commit + commit = @project.repository.commit page.should have_content(@project.name) page.should have_content(commit.message) page.should have_content(commit.id.to_s[0..5]) @@ -15,7 +15,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps end Then 'I see commits atom feed' do - commit = CommitDecorator.decorate(@project.commit) + commit = CommitDecorator.decorate(@project.repository.commit) page.response_headers['Content-Type'].should have_content("application/atom+xml") page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") page.body.should have_selector("author email", :text => commit.author_email) @@ -48,7 +48,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps page.should have_selector('ul.breadcrumb span.divider', count: 3) page.should have_selector('ul.breadcrumb a', count: 4) - find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path}\/commits\/master\z/) + find('ul.breadcrumb li:first a')['href'].should match(/#{@project.path_with_namespace}\/commits\/master\z/) find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z}) end diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb index 5248a5c469c..f5b51737c8c 100644 --- a/features/steps/project/project_merge_requests.rb +++ b/features/steps/project/project_merge_requests.rb @@ -56,10 +56,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps end And 'I submit new merge request "Wiki Feature"' do - fill_in "merge_request_title", with: "Wiki Feature" - select "master", from: "merge_request_source_branch" - select "stable", from: "merge_request_target_branch" - click_button "Save" + fill_in "merge_request_title", :with => "Wiki Feature" + select "master", :from => "merge_request_source_branch" + select "stable", :from => "merge_request_target_branch" + click_button "Submit merge request" end And 'project "Shop" have "Bug NS-04" open merge request' do diff --git a/features/steps/project/project_milestones.rb b/features/steps/project/project_milestones.rb index 1c9ad6da651..1350938ee9a 100644 --- a/features/steps/project/project_milestones.rb +++ b/features/steps/project/project_milestones.rb @@ -50,12 +50,12 @@ class ProjectMilestones < Spinach::FeatureSteps end Then "I should see 3 issues" do - page.should have_selector('.milestone-issue-filter tbody tr', count: 4) - page.should have_selector('.milestone-issue-filter tbody tr.hide', count: 1) + page.should have_selector('.milestone-issue-filter .well-list li', count: 4) + page.should have_selector('.milestone-issue-filter .well-list li.hide', count: 1) end Then "I should see 4 issues" do - page.should have_selector('.milestone-issue-filter tbody tr', count: 4) - page.should_not have_selector('.milestone-issue-filter tbody tr.hide') + page.should have_selector('.milestone-issue-filter .well-list li', count: 4) + page.should_not have_selector('.milestone-issue-filter .well-list li.hide') end end diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb index 6fde532f1a2..77149bfe2c3 100644 --- a/features/steps/project/project_network_graph.rb +++ b/features/steps/project/project_network_graph.rb @@ -6,7 +6,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps page.should have_content "Project Network Graph" within ".graph" do page.should have_content "master" - page.should have_content "scss_refactor..." end end diff --git a/features/steps/project/project_services.rb b/features/steps/project/project_services.rb new file mode 100644 index 00000000000..b1668ff7207 --- /dev/null +++ b/features/steps/project/project_services.rb @@ -0,0 +1,30 @@ +class ProjectServices < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + When 'I visit project "Shop" services page' do + visit project_services_path(@project) + end + + Then 'I should see list of available services' do + page.should have_content 'Services' + page.should have_content 'Jenkins' + page.should have_content 'GitLab CI' + end + + And 'I click gitlab-ci service link' do + click_link 'GitLab CI' + end + + And 'I fill gitlab-ci settings' do + check 'Active' + fill_in 'Project URL', with: 'http://ci.gitlab.org/projects/3' + fill_in 'CI Project token', with: 'verySecret' + click_button 'Save' + end + + Then 'I should see service settings saved' do + find_field('Project URL').value.should == 'http://ci.gitlab.org/projects/3' + end +end diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb index 6bde0b64dfa..91b3ffeee9a 100644 --- a/features/steps/project/project_team_management.rb +++ b/features/steps/project/project_team_management.rb @@ -84,18 +84,18 @@ class ProjectTeamManagement < Spinach::FeatureSteps And '"Sam" is "Shop" developer' do user = User.find_by_name("Sam") project = Project.find_by_name("Shop") - project.add_access(user, :write) + project.team << [user, :developer] end Given 'I own project "Website"' do @project = create(:project, :name => "Website") - @project.add_access(@user, :admin) + @project.team << [@user, :master] end And '"Mike" is "Website" reporter' do user = User.find_by_name("Mike") project = Project.find_by_name("Website") - project.add_access(user, :read) + project.team << [user, :reporter] end And 'I click link "Import team from another project"' do diff --git a/features/steps/shared/admin.rb b/features/steps/shared/admin.rb new file mode 100644 index 00000000000..1b712dc6d04 --- /dev/null +++ b/features/steps/shared/admin.rb @@ -0,0 +1,12 @@ +module SharedAdmin + include Spinach::DSL + + And 'there are projects in system' do + 2.times { create(:project) } + end + + And 'system has users' do + 2.times { create(:user) } + end +end + diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index bf20d5f8442..c046c4e63e6 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -21,6 +21,10 @@ module SharedPaths visit merge_requests_group_path(current_group) end + When 'I visit group people page' do + visit people_group_path(current_group) + end + # ---------------------------------------- # Dashboard # ---------------------------------------- @@ -110,15 +114,15 @@ module SharedPaths end Given "I visit my project's files page" do - visit project_tree_path(@project, @project.root_ref) + visit project_tree_path(@project, root_ref) end Given "I visit my project's commits page" do - visit project_commits_path(@project, @project.root_ref, {limit: 5}) + visit project_commits_path(@project, root_ref, {limit: 5}) end Given "I visit my project's commits page for a specific path" do - visit project_commits_path(@project, @project.root_ref + "/app/models/project.rb", {limit: 5}) + visit project_commits_path(@project, root_ref + "/app/models/project.rb", {limit: 5}) end Given 'I visit my project\'s commits stats page' do @@ -161,6 +165,11 @@ module SharedPaths visit project_path(project) end + When 'I visit edit project "Shop" page' do + project = Project.find_by_name("Shop") + visit edit_project_path(project) + end + Given 'I visit project branches page' do visit branches_project_repository_path(@project) end @@ -170,7 +179,7 @@ module SharedPaths end Given 'I visit project commits page' do - visit project_commits_path(@project, @project.root_ref, {limit: 5}) + visit project_commits_path(@project, root_ref, {limit: 5}) end Given 'I visit project commits page for stable branch' do @@ -178,7 +187,7 @@ module SharedPaths end Given 'I visit project source page' do - visit project_tree_path(@project, @project.root_ref) + visit project_tree_path(@project, root_ref) end Given 'I visit blob file from repo' do @@ -241,4 +250,8 @@ module SharedPaths Given 'I visit project wiki page' do visit project_wiki_path(@project, :index) end + + def root_ref + @project.repository.root_ref + end end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index dfc8ce9d99c..3150be5ef18 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -4,13 +4,51 @@ module SharedProject # Create a project without caring about what it's called And "I own a project" do @project = create(:project) - @project.add_access(@user, :admin) + @project.team << [@user, :master] end # Create a specific project called "Shop" And 'I own project "Shop"' do - @project = create(:project, :name => "Shop") - @project.add_access(@user, :admin) + @project = create(:project, name: "Shop") + @project.team << [@user, :master] + end + + And 'project "Shop" has push event' do + @project = Project.find_by_name("Shop") + + data = { + before: "0000000000000000000000000000000000000000", + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + ref: "refs/heads/new_design", + user_id: @user.id, + user_name: @user.name, + repository: { + name: @project.name, + url: "localhost/rubinius", + description: "", + homepage: "localhost/rubinius", + private: true + } + } + + @event = Event.create( + project: @project, + action: Event::Pushed, + data: data, + author_id: @user.id + ) + end + + Then 'I should see project "Shop" activity feed' do + project = Project.find_by_name("Shop") + page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" + end + + Then 'I should see project settings' do + current_path.should == edit_project_path(@project) + page.should have_content("Project name is") + page.should have_content("Advanced settings:") + page.should have_content("Features:") end def current_project diff --git a/features/support/env.rb b/features/support/env.rb index 500de0f3e20..be10ad1b8b9 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,9 +1,13 @@ +require 'simplecov' unless ENV['CI'] + ENV['RAILS_ENV'] = 'test' require './config/environment' require 'rspec' require 'database_cleaner' require 'spinach/capybara' +require 'sidekiq/testing/inline' + %w(gitolite_stub stubbed_repository valid_commit).each do |f| require Rails.root.join('spec', 'support', f) diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 3be558816b5..4d832fbe593 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -78,6 +78,7 @@ module Gitlab attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :closed] attrs[:label_list] = params[:labels] if params[:labels].present? + IssueObserver.current_user = current_user if @issue.update_attributes attrs present @issue, with: Entities::Issue else diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 4875ac4c03e..4613db54578 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -13,7 +13,7 @@ module Gitlab # Example Request: # GET /projects/:id/notes get ":id/notes" do - @notes = user_project.common_notes + @notes = user_project.notes.common present paginate(@notes), with: Entities::Note end @@ -25,7 +25,7 @@ module Gitlab # Example Request: # GET /projects/:id/notes/:note_id get ":id/notes/:note_id" do - @note = user_project.common_notes.find(params[:note_id]) + @note = user_project.notes.common.find(params[:note_id]) present @note, with: Entities::Note end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index fb01524da39..55c81f3158a 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -9,7 +9,7 @@ module Gitlab # Example Request: # GET /projects get do - @projects = paginate current_user.projects + @projects = paginate current_user.authorized_projects present @projects, with: Entities::Project end @@ -257,7 +257,7 @@ module Gitlab per_page = params[:per_page] || 20 ref = params[:ref_name] || user_project.try(:default_branch) || 'master' - commits = user_project.commits(ref, nil, per_page, page * per_page) + commits = user_project.repository.commits(ref, nil, per_page, page * per_page) present CommitDecorator.decorate(commits), with: Entities::RepoCommit end @@ -375,10 +375,10 @@ module Gitlab ref = params[:sha] - commit = user_project.commit ref + commit = user_project.repository.commit ref not_found! "Commit" unless commit - tree = Tree.new commit.tree, user_project, ref, params[:filepath] + tree = Tree.new commit.tree, ref, params[:filepath] not_found! "File" unless tree.try(:tree) content_type tree.mime_type diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index b60dfd036e1..270a0aaa87a 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -33,6 +33,9 @@ module ExtractsPath # extract_ref("v2.0.0/README.md") # # => ['v2.0.0', 'README.md'] # + # extract_ref('/gitlab/vagrant/tree/master/app/models/project.rb') + # # => ['master', 'app/models/project.rb'] + # # extract_ref('issues/1234/app/models/project.rb') # # => ['issues/1234', 'app/models/project.rb'] # @@ -47,6 +50,13 @@ module ExtractsPath return pair unless @project + # Remove project, actions and all other staff from path + input.gsub!(/^\/#{Regexp.escape(@project.path_with_namespace)}/, "") + input.gsub!(/^\/(tree|commits|blame|blob|refs)\//, "") # remove actions + input.gsub!(/\?.*$/, "") # remove stamps suffix + input.gsub!(/.atom$/, "") # remove rss feed + input.gsub!(/\/edit$/, "") # remove edit route part + if input.match(/^([[:alnum:]]{40})(.+)/) # If the ref appears to be a SHA, we're done, just split the string pair = $~.captures @@ -58,7 +68,7 @@ module ExtractsPath id = input id += '/' unless id.ends_with?('/') - valid_refs = @project.ref_names + valid_refs = @project.repository.ref_names valid_refs.select! { |v| id.start_with?("#{v}/") } if valid_refs.length != 1 @@ -98,13 +108,15 @@ module ExtractsPath request.format = :atom end - @ref, @path = extract_ref(params[:id]) + path = CGI::unescape(request.fullpath.dup) + + @ref, @path = extract_ref(path) @id = File.join(@ref, @path) - @commit = CommitDecorator.decorate(@project.commit(@ref)) + @commit = CommitDecorator.decorate(@project.repository.commit(@ref)) - @tree = Tree.new(@commit.tree, @project, @ref, @path) + @tree = Tree.new(@commit.tree, @ref, @path) @tree = TreeDecorator.new(@tree) raise InvalidPathError if @tree.invalid? diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index a2bc4ca8d74..10e527eac73 100644 --- a/lib/gitlab/backend/gitolite_config.rb +++ b/lib/gitlab/backend/gitolite_config.rb @@ -82,7 +82,7 @@ module Gitlab end def destroy_project(project) - FileUtils.rm_rf(project.path_to_repo) + FileUtils.rm_rf(project.repository.path_to_repo) conf.rm_repo(project.path_with_namespace) end @@ -138,9 +138,9 @@ module Gitlab ::Gitolite::Config::Repo.new(repo_name) end - name_readers = project.repository_readers - name_writers = project.repository_writers - name_masters = project.repository_masters + name_readers = project.team.repository_readers + name_writers = project.team.repository_writers + name_masters = project.team.repository_masters pr_br = project.protected_branches.map(&:name).join("$ ") diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index 7c31117f01d..cfad532a06c 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -17,10 +17,6 @@ module Grack # Pass Gitolite update hook ENV['GL_BYPASS_UPDATE_HOOK'] = "true" - # Need this patch due to the rails mount - @env['PATH_INFO'] = @request.path - @env['SCRIPT_NAME'] = "" - # Find project by PATH_INFO from env if m = /^\/([\w\.\/-]+)\.git/.match(@request.path_info).to_a self.project = Project.find_with_namespace(m.last) diff --git a/lib/gitlab/graph/commit.rb b/lib/gitlab/graph/commit.rb index 3d82c34432f..a6bf23a2381 100644 --- a/lib/gitlab/graph/commit.rb +++ b/lib/gitlab/graph/commit.rb @@ -22,14 +22,16 @@ module Gitlab h[:parents] = self.parents.collect do |p| [p.id,0,0] end - h[:author] = author.name + h[:author] = { + name: author.name, + email: author.email + } h[:time] = time h[:space] = space h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil? h[:id] = sha h[:date] = date h[:message] = message - h[:login] = author.email h end diff --git a/lib/gitlab/graph/json_builder.rb b/lib/gitlab/graph/json_builder.rb index a5914363393..4a48b3b5675 100644 --- a/lib/gitlab/graph/json_builder.rb +++ b/lib/gitlab/graph/json_builder.rb @@ -17,14 +17,14 @@ module Gitlab @commits = collect_commits @days = index_commits end - + def to_json(*args) { days: @days.compact.map { |d| [d.day, d.strftime("%b")] }, commits: @commits.map(&:to_graph_hash) }.to_json(*args) end - + protected # Get commits from repository @@ -97,7 +97,7 @@ module Gitlab if leaves.empty? return end - space = find_free_space(leaves.last.time..leaves.first.time) + space = find_free_space(leaves, map) leaves.each{|l| l.space = space} # and mark it as reserved min_time = leaves.last.time @@ -119,7 +119,7 @@ module Gitlab # Visit branching chains leaves.each do |l| - parents = l.parents.collect.select{|p| map.include? p.id and map[p.id].space == 0} + parents = l.parents.collect.select{|p| map.include? p.id and map[p.id].space.zero?} for p in parents place_chain(map[p.id], map, l.time) end @@ -132,18 +132,29 @@ module Gitlab end end - def find_free_space(time_range) + def find_free_space(leaves, map) + time_range = leaves.last.time..leaves.first.time reserved = [] for day in time_range reserved += @_reserved[day] end - space = 1 + space = base_space(leaves, map) while reserved.include? space do space += 1 end space end + def base_space(leaves, map) + parents = [] + leaves.each do |l| + parents.concat l.parents.collect.select{|p| map.include? p.id and map[p.id].space.nonzero?} + end + + space = parents.map{|p| map[p.id].space}.max || 0 + space += 1 + end + # Takes most left subtree branch of commits # which don't have space mark yet. # @@ -156,13 +167,13 @@ module Gitlab leaves.push(commit) if commit.space.zero? while true - parent = commit.parents.collect.select do |p| - map.include? p.id and map[p.id].space == 0 - end + return leaves if commit.parents.count.zero? + return leaves unless map.include? commit.parents.first.id - return leaves if parent.count.zero? + commit = map[commit.parents.first.id] + + return leaves unless commit.space.zero? - commit = map[parent.first.id] leaves.push(commit) end end diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index c947e69aa4c..d3f678cfcbc 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -170,7 +170,7 @@ module Gitlab end def reference_commit(identifier) - if @project.valid_repo? && commit = @project.commit(identifier) + if @project.valid_repo? && commit = @project.repository.commit(identifier) link_to(identifier, project_commit_path(@project, commit), html_options.merge(title: CommitDecorator.new(commit).link_title, class: "gfm gfm-commit #{html_options[:class]}")) end end diff --git a/lib/gitlab/project_mover.rb b/lib/gitlab/project_mover.rb index def6e90001b..207e585f572 100644 --- a/lib/gitlab/project_mover.rb +++ b/lib/gitlab/project_mover.rb @@ -16,7 +16,7 @@ module Gitlab def execute # Create new dir if missing new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir) - system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path) + FileUtils.mkdir( new_dir_path, mode: 0770 ) unless File.exists?(new_dir_path) old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git") new_path = File.join(new_dir_path, "#{project.path}.git") @@ -25,17 +25,18 @@ module Gitlab raise ProjectMoveError.new("Destination #{new_path} already exists") end - if system("mv #{old_path} #{new_path}") + begin + FileUtils.mv( old_path, new_path ) log_info "Project #{project.name} was moved from #{old_path} to #{new_path}" true - else + rescue Exception => e message = "Project #{project.name} cannot be moved from #{old_path} to #{new_path}" - log_info "Error! #{message}" + log_info "Error! #{message} (#{e.message})" raise ProjectMoveError.new(message) end end - protected + protected def log_info message Gitlab::AppLogger.info message diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index a3f38b1c360..483042205ea 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -6,6 +6,10 @@ module Gitlab default_regex end + def project_name_regex + /\A[a-zA-Z][a-zA-Z0-9_\-\. ]*\z/ + end + def path_regex default_regex end diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 832db6621c4..556a1e2d52f 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -31,7 +31,7 @@ module Gitlab merge_repo.git.push({raise: true, timeout: true}, :origin, merge_request.target_branch) # remove source branch - if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch) + if merge_request.should_remove_source_branch && !project.repository.root_ref?(merge_request.source_branch) # will raise CommandFailed when push fails merge_repo.git.push({raise: true, timeout: true}, :origin, ":#{merge_request.source_branch}") end diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index 91c83d81029..a0abf1918ca 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -1,4 +1,6 @@ module Gitlab + class SatelliteNotExistError < StandardError; end + module Satellite class Satellite PARKING_BRANCH = "__parking_branch" @@ -9,8 +11,12 @@ module Gitlab @project = project end + def raise_no_satellite + raise SatelliteNotExistError.new("Satellite doesn't exist") + end + def clear_and_update! - raise "Satellite doesn't exist" unless exists? + raise_no_satellite unless exists? delete_heads! clear_working_dir! @@ -18,7 +24,13 @@ module Gitlab end def create - `git clone #{project.url_to_repo} #{path}` + create_cmd = "git clone #{project.url_to_repo} #{path}" + if system(create_cmd) + true + else + Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}") + false + end end def exists? @@ -29,7 +41,7 @@ module Gitlab # * Changes the current directory to the satellite's working dir # * Yields def lock - raise "Satellite doesn't exist" unless exists? + raise_no_satellite unless exists? File.open(lock_file, "w+") do |f| f.flock(File::LOCK_EX) @@ -49,7 +61,7 @@ module Gitlab end def repo - raise "Satellite doesn't exist" unless exists? + raise_no_satellite unless exists? @repo ||= Grit::Repo.new(path) end diff --git a/lib/gitolited.rb b/lib/gitolited.rb new file mode 100644 index 00000000000..68b9b625525 --- /dev/null +++ b/lib/gitolited.rb @@ -0,0 +1,11 @@ +# == Gitolited mixin +# +# Provide a shortcut to Gitlab::Gitolite instance by gitolite +# +# Used by Project, UsersProject, etc +# +module Gitolited + def gitolite + Gitlab::Gitolite.new + end +end diff --git a/lib/hooks/post-receive b/lib/hooks/post-receive index ebd9e1a028a..6944d3e3f72 100755 --- a/lib/hooks/post-receive +++ b/lib/hooks/post-receive @@ -1,5 +1,6 @@ #!/usr/bin/env bash +# Version 4.1 # This file was placed here by GitLab. It makes sure that your pushed commits # will be processed properly. diff --git a/app/roles/static_model.rb b/lib/static_model.rb similarity index 95% rename from app/roles/static_model.rb rename to lib/static_model.rb index 5b64be1f041..185921d8fbe 100644 --- a/app/roles/static_model.rb +++ b/lib/static_model.rb @@ -38,7 +38,7 @@ module StaticModel end def ==(other) - if other.is_a? StaticModel + if other.is_a? ::StaticModel id == other.id else super diff --git a/lib/support/rewrite-hooks.sh b/lib/support/rewrite-hooks.sh index 6688785a179..b8fd36b9a1e 100755 --- a/lib/support/rewrite-hooks.sh +++ b/lib/support/rewrite-hooks.sh @@ -11,9 +11,22 @@ do continue fi - project_hook="$src/$dir/hooks/post-receive" - gitolite_hook="/home/git/.gitolite/hooks/common/post-receive" + if [[ "$dir" =~ ^.*.git$ ]] + then + project_hook="$src/$dir/hooks/post-receive" + gitolite_hook="/home/git/.gitolite/hooks/common/post-receive" - ln -s -f $gitolite_hook $project_hook + ln -s -f $gitolite_hook $project_hook + else + for subdir in `ls "$src/$dir/"` + do + if [ -d "$src/$dir/$subdir" ] && [[ "$subdir" =~ ^.*.git$ ]]; then + project_hook="$src/$dir/$subdir/hooks/post-receive" + gitolite_hook="/home/git/.gitolite/hooks/common/post-receive" + + ln -s -f $gitolite_hook $project_hook + fi + done + fi fi done diff --git a/lib/support/truncate_repositories.sh b/lib/support/truncate_repositories.sh new file mode 100755 index 00000000000..3b14e2ee362 --- /dev/null +++ b/lib/support/truncate_repositories.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "Danger!!! Data Loss" +while true; do + read -p "Do you wish to all directories except gitolite-admin.git from /home/git/repositories/ (y/n) ?: " yn + case $yn in + [Yy]* ) sh -c "find /home/git/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs sudo rm -rf"; break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index 44da6d671e0..ae2b1bb793f 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -5,6 +5,8 @@ namespace :gitlab do # Create backup of GitLab system desc "GITLAB | Create a backup of the GitLab system" task :create => :environment do + warn_user_is_not_gitlab + Rake::Task["gitlab:backup:db:create"].invoke Rake::Task["gitlab:backup:repo:create"].invoke @@ -22,23 +24,23 @@ namespace :gitlab do end # create archive - print "Creating backup archive: #{Time.now.to_i}_gitlab_backup.tar " + print "Creating backup archive: #{Time.now.to_i}_gitlab_backup.tar ... " if Kernel.system("tar -cf #{Time.now.to_i}_gitlab_backup.tar repositories/ db/ backup_information.yml") - puts "[DONE]".green + puts "done".green else - puts "[FAILED]".red + puts "failed".red end # cleanup: remove tmp files - print "Deleting tmp directories..." + print "Deleting tmp directories ... " if Kernel.system("rm -rf repositories/ db/ backup_information.yml") - puts "[DONE]".green + puts "done".green else - puts "[FAILED]".red + puts "failed".red end # delete backups - print "Deleting old backups... " + print "Deleting old backups ... " if Gitlab.config.backup.keep_time > 0 file_list = Dir.glob("*_gitlab_backup.tar").map { |f| f.split(/_/).first.to_i } file_list.sort.each do |timestamp| @@ -46,15 +48,17 @@ namespace :gitlab do %x{rm #{timestamp}_gitlab_backup.tar} end end - puts "[DONE]".green + puts "done".green else - puts "[SKIPPING]".yellow + puts "skipping".yellow end end # Restore backup of GitLab system desc "GITLAB | Restore a previously created backup" task :restore => :environment do + warn_user_is_not_gitlab + Dir.chdir(Gitlab.config.backup.path) # check for existing backups in the backup dir @@ -63,22 +67,22 @@ namespace :gitlab do if file_list.count > 1 && ENV["BACKUP"].nil? puts "Found more than one backup, please specify which one you want to restore:" puts "rake gitlab:backup:restore BACKUP=timestamp_of_backup" - exit 1; + exit 1 end tar_file = ENV["BACKUP"].nil? ? File.join("#{file_list.first}_gitlab_backup.tar") : File.join(ENV["BACKUP"] + "_gitlab_backup.tar") unless File.exists?(tar_file) puts "The specified backup doesn't exist!" - exit 1; + exit 1 end - print "Unpacking backup... " + print "Unpacking backup ... " unless Kernel.system("tar -xf #{tar_file}") - puts "[FAILED]".red + puts "failed".red exit 1 else - puts "[DONE]".green + puts "done".green end settings = YAML.load_file("backup_information.yml") @@ -86,7 +90,7 @@ namespace :gitlab do # restoring mismatching backups can lead to unexpected problems if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/,"") - puts "gitlab_version mismatch:".red + puts "GitLab version mismatch:".red puts " Your current HEAD differs from the HEAD in the backup!".red puts " Please switch to the following revision and try again:".red puts " revision: #{settings[:gitlab_version]}".red @@ -97,11 +101,11 @@ namespace :gitlab do Rake::Task["gitlab:backup:repo:restore"].invoke # cleanup: remove tmp files - print "Deleting tmp directories..." + print "Deleting tmp directories ... " if Kernel.system("rm -rf repositories/ db/ backup_information.yml") - puts "[DONE]".green + puts "done".green else - puts "[FAILED]".red + puts "failed".red end end @@ -114,12 +118,23 @@ namespace :gitlab do task :create => :environment do backup_path_repo = File.join(Gitlab.config.backup.path, "repositories") FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo) - puts "Dumping repositories:" - project = Project.all.map { |n| [n.path, n.path_to_repo] } - project << ["gitolite-admin.git", File.join(Gitlab.config.git_base_path, "gitolite-admin.git")] - project.each do |project| - print "- Dumping repository #{project.first}... " - if Kernel.system("cd #{project.second} > /dev/null 2>&1 && git bundle create #{backup_path_repo}/#{project.first}.bundle --all > /dev/null 2>&1") + puts "Dumping repositories ...".blue + + Project.find_each(:batch_size => 1000) do |project| + print " * #{project.path_with_namespace} ... " + + if project.empty_repo? + puts "[SKIPPED]".cyan + next + end + + # Create namespace dir if missing + FileUtils.mkdir_p(File.join(backup_path_repo, project.namespace.path)) if project.namespace + + # Build a destination path for backup + path_to_bundle = File.join(backup_path_repo, project.path_with_namespace + ".bundle") + + if Kernel.system("cd #{project.repository.path_to_repo} > /dev/null 2>&1 && git bundle create #{path_to_bundle} --all > /dev/null 2>&1") puts "[DONE]".green else puts "[FAILED]".red @@ -129,18 +144,21 @@ namespace :gitlab do task :restore => :environment do backup_path_repo = File.join(Gitlab.config.backup.path, "repositories") - puts "Restoring repositories:" - project = Project.all.map { |n| [n.path, n.path_to_repo] } - project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")] - project.each do |project| - print "- Restoring repository #{project.first}... " - FileUtils.rm_rf(project.second) if File.dirname(project.second) # delete old stuff - if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1") - permission_commands = [ - "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", - "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}" - ] - permission_commands.each { |command| Kernel.system(command) } + repos_path = Gitlab.config.gitolite.repos_path + + puts "Restoring repositories ... " + + Project.find_each(:batch_size => 1000) do |project| + print "#{project.path_with_namespace} ... " + + if project.namespace + project.namespace.ensure_dir_exist + end + + # Build a backup path + path_to_bundle = File.join(backup_path_repo, project.path_with_namespace + ".bundle") + + if Kernel.system("git clone --bare #{path_to_bundle} #{project.repository.path_to_repo} > /dev/null 2>&1") puts "[DONE]".green else puts "[FAILED]".red @@ -156,9 +174,9 @@ namespace :gitlab do backup_path_db = File.join(Gitlab.config.backup.path, "db") FileUtils.mkdir_p(backup_path_db) unless Dir.exists?(backup_path_db) - puts "Dumping database tables:" + puts "Dumping database tables ... ".blue ActiveRecord::Base.connection.tables.each do |tbl| - print "- Dumping table #{tbl}... " + print " * #{tbl.yellow} ... " count = 1 File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file| ActiveRecord::Base.connection.select_all("SELECT * FROM `#{tbl}`").each do |line| @@ -167,25 +185,25 @@ namespace :gitlab do file << output.to_yaml.gsub(/^---\n/,'') + "\n" count += 1 end - puts "[DONE]".green + puts "done".green end end end - task :restore=> :environment do + task :restore => :environment do backup_path_db = File.join(Gitlab.config.backup.path, "db") - puts "Restoring database tables:" + puts "Restoring database tables (loading fixtures) ... " Rake::Task["db:reset"].invoke Dir.glob(File.join(backup_path_db, "*.yml") ).each do |dir| fixture_file = File.basename(dir, ".*" ) - print "- Loading fixture #{fixture_file}..." + print "#{fixture_file.yellow} ... " if File.size(dir) > 0 ActiveRecord::Fixtures.create_fixtures(backup_path_db, fixture_file) - puts "[DONE]".green + puts "done".green else - puts "[SKIPPING]".yellow + puts "skipping".yellow end end end diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index baa706d2bee..5d850a17fe3 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -48,24 +48,24 @@ namespace :gitlab do see_database_guide, "http://guides.rubyonrails.org/getting_started.html#configuring-a-database" ) - check_failed + fix_and_rerun end end def check_database_is_not_sqlite - print "Database is not SQLite ... " + print "Database is SQLite ... " database_config_file = Rails.root.join("config", "database.yml") - unless File.read(database_config_file) =~ /sqlite/ - puts "yes".green + unless File.read(database_config_file) =~ /adapter:\s+sqlite/ + puts "no".green else - puts "no".red + puts "yes".red for_more_information( "https://github.com/gitlabhq/gitlabhq/wiki/Migrate-from-SQLite-to-MySQL", see_database_guide ) - check_failed + fix_and_rerun end end @@ -85,7 +85,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "GitLab" ) - check_failed + fix_and_rerun end end @@ -98,7 +98,7 @@ namespace :gitlab do end # omniauth or ldap could have been deleted from the file - unless Gitlab.config.pre_40_config + unless Gitlab.config['git_host'] puts "no".green else puts "yes".red @@ -110,7 +110,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "GitLab" ) - check_failed + fix_and_rerun end end @@ -129,7 +129,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Install Init Script" ) - check_failed + fix_and_rerun end end @@ -155,7 +155,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Install Init Script" ) - check_failed + fix_and_rerun end end @@ -171,7 +171,7 @@ namespace :gitlab do try_fixing_it( "sudo -u gitlab -H bundle exec rake db:migrate" ) - check_failed + fix_and_rerun end end @@ -189,6 +189,8 @@ namespace :gitlab do if project.satellite.exists? puts "yes".green + elsif project.empty_repo? + puts "can't create, repository is empty".magenta else puts "no".red try_fixing_it( @@ -199,7 +201,7 @@ namespace :gitlab do for_more_information( "doc/raketasks/maintenance.md " ) - check_failed + fix_and_rerun end end end @@ -220,7 +222,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "GitLab" ) - check_failed + fix_and_rerun end end @@ -240,7 +242,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "GitLab" ) - check_failed + fix_and_rerun end end end @@ -254,7 +256,7 @@ namespace :gitlab do start_checking "Environment" check_gitlab_in_git_group - check_issue_1056_shell_profile_error + check_issue_1059_shell_profile_error check_gitlab_git_config check_python2_exists check_python2_version @@ -288,7 +290,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "GitLab" ) - check_failed + fix_and_rerun end end @@ -306,16 +308,16 @@ namespace :gitlab do for_more_information( see_installation_guide_section "System Users" ) - check_failed + fix_and_rerun end end # see https://github.com/gitlabhq/gitlabhq/issues/1059 - def check_issue_1056_shell_profile_error + def check_issue_1059_shell_profile_error gitolite_ssh_user = Gitlab.config.gitolite.ssh_user print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... " - profile_file = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.profile") + profile_file = File.join(gitolite_home, ".profile") unless File.read(profile_file) =~ /^-e PATH/ puts "yes".green @@ -330,7 +332,7 @@ namespace :gitlab do see_installation_guide_section("Gitolite"), "https://github.com/gitlabhq/gitlabhq/issues/1059" ) - check_failed + fix_and_rerun end end @@ -350,7 +352,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Packages / Dependencies" ) - check_failed + fix_and_rerun end end @@ -376,7 +378,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Packages / Dependencies" ) - check_failed + fix_and_rerun end end end @@ -396,6 +398,7 @@ namespace :gitlab do check_dot_gitolite_user_and_group check_dot_gitolite_permissions check_repo_base_exists + check_repo_base_is_not_symlink check_repo_base_user_and_group check_repo_base_permissions check_can_clone_gitolite_admin @@ -432,7 +435,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end # assumes #check_can_clone_gitolite_admin has been run before @@ -464,7 +467,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun ensure FileUtils.rm_rf("/tmp/gitolite_gitlab_test") end @@ -472,7 +475,7 @@ namespace :gitlab do def check_dot_gitolite_exists print "Config directory exists? ... " - gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite") + gitolite_config_path = File.join(gitolite_home, ".gitolite") if File.directory?(gitolite_config_path) puts "yes".green @@ -486,14 +489,14 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end def check_dot_gitolite_permissions print "Config directory access is drwxr-x---? ... " - gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite") + gitolite_config_path = File.join(gitolite_home, ".gitolite") unless File.exists?(gitolite_config_path) puts "can't check because of previous errors".magenta return @@ -503,14 +506,13 @@ namespace :gitlab do puts "yes".green else puts "no".red - puts "#{gitolite_config_path} is not writable".red try_fixing_it( "sudo chmod 750 #{gitolite_config_path}" ) for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end @@ -518,7 +520,7 @@ namespace :gitlab do gitolite_ssh_user = Gitlab.config.gitolite.ssh_user print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... " - gitolite_config_path = File.expand_path("~#{gitolite_ssh_user}/.gitolite") + gitolite_config_path = File.join(gitolite_home, ".gitolite") unless File.exists?(gitolite_config_path) puts "can't check because of previous errors".magenta return @@ -536,13 +538,13 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end 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?, "v3.2") puts "yes".green else puts "no".red @@ -581,7 +583,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end @@ -610,7 +612,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end @@ -634,7 +636,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Setup GitLab Hooks" ) - check_failed + fix_and_rerun end end @@ -644,7 +646,6 @@ namespace :gitlab do hook_file = "post-receive" gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) - gitolite_hook_content = File.read(gitolite_hook_file) gitolite_ssh_user = Gitlab.config.gitolite.ssh_user unless File.exists?(gitolite_hook_file) @@ -652,6 +653,7 @@ namespace :gitlab do return end + gitolite_hook_content = File.read(gitolite_hook_file) gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file) gitlab_hook_content = File.read(gitlab_hook_file) @@ -665,7 +667,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Setup GitLab Hooks" ) - check_failed + fix_and_rerun end end @@ -687,7 +689,27 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun + end + end + + def check_repo_base_is_not_symlink + print "Repo base directory is a symlink? ... " + + repo_base_path = Gitlab.config.gitolite.repos_path + unless File.exists?(repo_base_path) + puts "can't check because of previous errors".magenta + return + end + + unless File.symlink?(repo_base_path) + puts "no".green + else + puts "yes".red + try_fixing_it( + "Make sure it's set to the real directory in config/gitlab.yml" + ) + fix_and_rerun end end @@ -711,7 +733,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end @@ -737,7 +759,7 @@ namespace :gitlab do for_more_information( see_installation_guide_section "Gitolite" ) - check_failed + fix_and_rerun end end @@ -758,7 +780,7 @@ namespace :gitlab do print "#{project.name_with_namespace.yellow} ... " correct_options = options.map do |name, value| - run("git --git-dir=\"#{project.path_to_repo}\" config --get #{name}").try(:chomp) == value + run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value end if correct_options.all? @@ -771,7 +793,7 @@ namespace :gitlab do for_more_information( "doc/raketasks/maintenance.md" ) - check_failed + fix_and_rerun end end end @@ -797,7 +819,7 @@ namespace :gitlab do Project.find_each(batch_size: 100) do |project| print "#{project.name_with_namespace.yellow} ... " - project_hook_file = File.join(project.path_to_repo, "hooks", hook_file) + project_hook_file = File.join(project.repository.path_to_repo, "hooks", hook_file) unless File.exists?(project_hook_file) puts "missing".red @@ -807,7 +829,7 @@ namespace :gitlab do for_more_information( "lib/support/rewrite-hooks.sh" ) - check_failed + fix_and_rerun next end @@ -821,7 +843,7 @@ namespace :gitlab do for_more_information( "lib/support/rewrite-hooks.sh" ) - check_failed + fix_and_rerun end end end @@ -849,7 +871,7 @@ namespace :gitlab do namespace :resque do - desc "GITLAB | Check the configuration of Resque" + desc "GITLAB | Check the configuration of Sidekiq" task check: :environment do warn_user_is_not_gitlab start_checking "Resque" @@ -866,7 +888,7 @@ namespace :gitlab do def check_resque_running print "Running? ... " - if run_and_match("ps aux | grep -i resque", /resque-[\d\.]+:.+$/) + if run_and_match("ps aux | grep -i sidekiq", /sidekiq \d\.\d\.\d.+$/) puts "yes".green else puts "no".red @@ -877,9 +899,9 @@ namespace :gitlab do ) for_more_information( see_installation_guide_section("Install Init Script"), - "see log/resque.log for possible errors" + "see log/sidekiq.log for possible errors" ) - check_failed + fix_and_rerun end end end @@ -888,7 +910,7 @@ namespace :gitlab do # Helper methods ########################## - def check_failed + def fix_and_rerun puts " Please #{"fix the error above"} and rerun the checks.".red end @@ -907,29 +929,6 @@ namespace :gitlab do puts "" end - # Runs the given command - # - # Returns nil if the command was not found - # Returns the output of the command otherwise - # - # see also #run_and_match - def run(command) - unless `#{command} 2>/dev/null`.blank? - `#{command}` - end - end - - # Runs the given command and matches the output agains the given pattern - # - # Returns nil if nothing matched - # Retunrs the MatchData if the pattern matched - # - # see also #run - # see also String#match - def run_and_match(command, pattern) - run(command).try(:match, pattern) - end - def see_database_guide "doc/install/databases.md" end @@ -951,18 +950,4 @@ namespace :gitlab do puts " #{step}" end end - - def warn_user_is_not_gitlab - unless @warned_user_not_gitlab - current_user = run("whoami").chomp - unless current_user == "gitlab" - puts "#{Colored.color(:black)+Colored.color(:on_yellow)} Warning #{Colored.extra(:clear)}" - puts " You are running as user #{current_user.magenta}, we hope you know what you are doing." - puts " Some tests may pass\/fail for the wrong reason." - puts " For meaningful results you should run this as user #{"gitlab".magenta}." - puts "" - end - @warned_user_not_gitlab = true - end - end end diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake new file mode 100644 index 00000000000..2a0ffe0f4bd --- /dev/null +++ b/lib/tasks/gitlab/cleanup.rake @@ -0,0 +1,128 @@ +namespace :gitlab do + namespace :cleanup do + desc "GITLAB | Cleanup | Clean gitolite config" + task :config => :environment do + warn_user_is_not_gitlab + + real_repos = Project.all.map(&:path_with_namespace) + real_repos << "gitolite-admin" + real_repos << "@all" + + remove_flag = ENV['REMOVE'] + + puts "Looking for repositories to remove... " + Gitlab::GitoliteConfig.new.apply do |config| + all_repos = [] + garbage_repos = [] + + all_repos = config.conf.repos.keys + garbage_repos = all_repos - real_repos + + garbage_repos.each do |repo_name| + if remove_flag + config.conf.rm_repo(repo_name) + print "to remove...".red + end + + puts repo_name.red + end + end + + unless remove_flag + puts "To cleanup repositories run this command with REMOVE=true".yellow + end + end + + desc "GITLAB | Cleanup | Clean namespaces" + task :dirs => :environment do + warn_user_is_not_gitlab + remove_flag = ENV['REMOVE'] + + + namespaces = Namespace.pluck(:path) + git_base_path = Gitlab.config.gitolite.repos_path + all_dirs = Dir.glob(git_base_path + '/*') + + puts git_base_path.yellow + puts "Looking for directories to remove... " + + all_dirs.reject! do |dir| + # skip if git repo + dir =~ /.git$/ + end + + all_dirs.reject! do |dir| + dir_name = File.basename dir + + # skip if namespace present + namespaces.include?(dir_name) + end + + all_dirs.each do |dir_path| + + if remove_flag + if FileUtils.rm_rf dir_path + puts "Removed...#{dir_path}".red + else + puts "Cannot remove #{dir_path}".red + end + else + puts "Can be removed: #{dir_path}".red + end + end + + unless remove_flag + puts "To cleanup this directories run this command with REMOVE=true".yellow + end + end + + desc "GITLAB | Cleanup | Clean respositories" + task :repos => :environment do + warn_user_is_not_gitlab + remove_flag = ENV['REMOVE'] + + git_base_path = Gitlab.config.gitolite.repos_path + all_dirs = Dir.glob(git_base_path + '/*') + + global_projects = Project.where(namespace_id: nil).pluck(:path) + + puts git_base_path.yellow + puts "Looking for global repos to remove... " + + # skip non git repo + all_dirs.select! do |dir| + dir =~ /.git$/ + end + + # skip existing repos + all_dirs.reject! do |dir| + repo_name = File.basename dir + path = repo_name.gsub(/\.git$/, "") + global_projects.include?(path) + end + + # skip gitolite admin + all_dirs.reject! do |dir| + repo_name = File.basename dir + repo_name == 'gitolite-admin.git' + end + + + all_dirs.each do |dir_path| + if remove_flag + if FileUtils.rm_rf dir_path + puts "Removed...#{dir_path}".red + else + puts "Cannot remove #{dir_path}".red + end + else + puts "Can be removed: #{dir_path}".red + end + end + + unless remove_flag + puts "To cleanup this directories run this command with REMOVE=true".yellow + end + end + end +end diff --git a/lib/tasks/gitlab/enable_automerge.rake b/lib/tasks/gitlab/enable_automerge.rake index ed3d6368a99..e92da81021f 100644 --- a/lib/tasks/gitlab/enable_automerge.rake +++ b/lib/tasks/gitlab/enable_automerge.rake @@ -1,16 +1,42 @@ namespace :gitlab do desc "GITLAB | Enable auto merge" task :enable_automerge => :environment do - Gitlab::Gitolite.new.enable_automerge + warn_user_is_not_gitlab - Project.find_each do |project| - if project.repo_exists? && !project.satellite.exists? - puts "Creating satellite for #{project.name}...".green + puts "Updating repo permissions ..." + Gitlab::Gitolite.new.enable_automerge + puts "... #{"done".green}" + puts "" + + print "Creating satellites for ..." + unless Project.count > 0 + puts "skipping, because you have no projects".magenta + next + end + puts "" + + Project.find_each(batch_size: 100) do |project| + print "#{project.name_with_namespace.yellow} ... " + + unless project.repo_exists? + puts "skipping, because the repo is empty".magenta + next + end + + if project.satellite.exists? + puts "exists already".green + else + puts "" project.satellite.create + + print "... " + if $?.success? + puts "created".green + else + puts "error".red + end end end - - puts "Done!".green end namespace :satellites do diff --git a/lib/tasks/gitlab/enable_namespaces.rake b/lib/tasks/gitlab/enable_namespaces.rake index 1be9ba6469d..aa76a2f7d83 100644 --- a/lib/tasks/gitlab/enable_namespaces.rake +++ b/lib/tasks/gitlab/enable_namespaces.rake @@ -1,67 +1,116 @@ namespace :gitlab do desc "GITLAB | Enable usernames and namespaces for user projects" task enable_namespaces: :environment do - print "\nUsernames for users:".yellow + warn_user_is_not_gitlab + migrate_user_namespaces + migrate_groups + migrate_projects + + puts "Rebuild Gitolite ... " + gitolite = Gitlab::Gitolite.new + gitolite.update_repositories(Project.where('namespace_id IS NOT NULL')) + puts "... #{"done".green}" + end + + def migrate_user_namespaces + puts "\nGenerate usernames for users without one: ".blue User.find_each(batch_size: 500) do |user| - next if user.namespace - - User.transaction do - username = user.email.match(/^[^@]*/)[0] - if user.update_attributes!(username: username) - print '.'.green - else - print 'F'.red - end + if user.namespace + print '-'.cyan + next end - end - print "\n\nDirs for groups:".yellow + username = if user.username.present? + # if user already has username filled + user.username + else + build_username(user) + end - Group.find_each(batch_size: 500) do |group| - if group.ensure_dir_exist - print '.'.green - else + begin + User.transaction do + user.update_attributes!(username: username) + print '.'.green + end + rescue print 'F'.red end end + puts "\nDone" + end - print "\n\nMove projects from groups under groups dirs:".yellow + def build_username(user) + username = nil + + # generate username + username = user.email.match(/^[^@]*/)[0] + username.gsub!("+", ".") + + # return username if no mathes + return username unless User.find_by_username(username) + + # look for same username + (1..10).each do |i| + suffixed_username = "#{username}#{i}" + + return suffixed_username unless User.find_by_username(suffixed_username) + end + end + + def migrate_groups + puts "\nCreate directories for groups: ".blue + + Group.find_each(batch_size: 500) do |group| + begin + if group.dir_exists? + print '-'.cyan + else + if group.ensure_dir_exist + print '.'.green + else + print 'F'.red + end + end + rescue + print 'F'.red + end + end + puts "\nDone" + end + + def migrate_projects git_path = Gitlab.config.gitolite.repos_path - + puts "\nMove projects in groups into respective directories ... ".blue Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project| next unless project.group group = project.group - puts "\n" - print " * #{project.name}: " + print "#{project.name_with_namespace.yellow} ... " new_path = File.join(git_path, project.path_with_namespace + '.git') if File.exists?(new_path) - print "ok. already at #{new_path}".cyan + puts "already at #{new_path}".green next end old_path = File.join(git_path, project.path + '.git') unless File.exists?(old_path) - print "missing. not found at #{old_path}".red + puts "couldn't find it at #{old_path}".red next end begin Gitlab::ProjectMover.new(project, '', group.path).execute - print "ok. Moved to #{new_path}".green + puts "moved to #{new_path}".green rescue - print "Failed moving to #{new_path}".red + puts "failed moving to #{new_path}".red end end - print "\n\nRebuild gitolite:".yellow - gitolite = Gitlab::Gitolite.new - gitolite.update_repositories(Project.where('namespace_id IS NOT NULL')) - puts "\n" + puts "\nDone" end end diff --git a/lib/tasks/gitlab/generate_docs.rake b/lib/tasks/gitlab/generate_docs.rake new file mode 100644 index 00000000000..58795fac4af --- /dev/null +++ b/lib/tasks/gitlab/generate_docs.rake @@ -0,0 +1,7 @@ +namespace :gitlab do + desc "GITLAB | Generate sdocs for project" + task generate_docs: :environment do + system("bundle exec sdoc -o doc/code app lib") + end +end + diff --git a/lib/tasks/gitlab/gitolite_rebuild.rake b/lib/tasks/gitlab/gitolite_rebuild.rake index fce10eb5b69..af2a2127ee2 100644 --- a/lib/tasks/gitlab/gitolite_rebuild.rake +++ b/lib/tasks/gitlab/gitolite_rebuild.rake @@ -1,24 +1,27 @@ namespace :gitlab do namespace :gitolite do - desc "GITLAB | Rebuild each project at gitolite config" + desc "GITLAB | Rebuild each project in Gitolite config" task :update_repos => :environment do - puts "Starting Projects" + warn_user_is_not_gitlab + + puts "Rebuilding projects ... " Project.find_each(:batch_size => 100) do |project| - puts "\n=== #{project.name}" + puts "#{project.name_with_namespace.yellow} ... " project.update_repository - puts + puts "... #{"done".green}" end - puts "Done with projects" end - desc "GITLAB | Rebuild each key at gitolite config" + desc "GITLAB | Rebuild each user key in Gitolite config" task :update_keys => :environment do - puts "Starting Key" + warn_user_is_not_gitlab + + puts "Rebuilding keys ... " Key.find_each(:batch_size => 100) do |key| + puts "#{key.identifier.yellow} ... " Gitlab::Gitolite.new.set_key(key.identifier, key.key, key.projects) - print '.' + puts "... #{"done".green}" end - puts "Done with keys" end end end diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 81f66e2e406..4bf9110508e 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -15,15 +15,23 @@ namespace :gitlab do git_base_path = Gitlab.config.gitolite.repos_path repos_to_import = Dir.glob(git_base_path + '/*') + namespaces = Namespace.pluck(:path) + repos_to_import.each do |repo_path| repo_name = File.basename repo_path + # Skip if group or user + next if namespaces.include?(repo_name) + + # skip if not git repo + next unless repo_name =~ /.git$/ + # skip gitolite admin next if repo_name == 'gitolite-admin.git' path = repo_name.sub(/\.git$/, '') - project = Project.find_by_path(path) + project = Project.find_with_namespace(path) puts "Processing #{repo_name}".yellow @@ -34,8 +42,6 @@ namespace :gitlab do project_params = { :name => path, - :code => path, - :path => path, } project = Project.create_by_user(project_params, user) diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake index 85458fe2c43..fd3e83e8338 100644 --- a/lib/tasks/gitlab/info.rake +++ b/lib/tasks/gitlab/info.rake @@ -12,7 +12,10 @@ namespace :gitlab do debian_version = File.read('/etc/debian_version') "Debian #{debian_version}" end - os_name.squish! + os_name ||= if File.readable?('/etc/SuSE-release') + File.read('/etc/SuSE-release') + end + os_name.try(:squish!) # check if there is an RVM environment rvm_version = run_and_match("rvm --version", /[\d\.]+/).try(:to_s) @@ -80,31 +83,5 @@ namespace :gitlab do puts "Git:\t\t#{Gitlab.config.git.bin_path}" end - - - # Helper methods - - # Runs the given command and matches the output agains the given pattern - # - # Returns nil if nothing matched - # Retunrs the MatchData if the pattern matched - # - # see also #run - # see also String#match - def run_and_match(command, regexp) - run(command).try(:match, regexp) - end - - # Runs the given command - # - # Returns nil if the command was not found - # Returns the output of the command otherwise - # - # see also #run_and_match - def run(command) - unless `#{command} 2>/dev/null`.blank? - `#{command}` - end - end end end diff --git a/lib/tasks/gitlab/task_helpers.rake b/lib/tasks/gitlab/task_helpers.rake new file mode 100644 index 00000000000..c9635f058ee --- /dev/null +++ b/lib/tasks/gitlab/task_helpers.rake @@ -0,0 +1,39 @@ +namespace :gitlab do + + # Runs the given command and matches the output agains the given pattern + # + # Returns nil if nothing matched + # Retunrs the MatchData if the pattern matched + # + # see also #run + # see also String#match + def run_and_match(command, regexp) + run(command).try(:match, regexp) + end + + # Runs the given command + # + # Returns nil if the command was not found + # Returns the output of the command otherwise + # + # see also #run_and_match + def run(command) + unless `#{command} 2>/dev/null`.blank? + `#{command}` + end + end + + def warn_user_is_not_gitlab + unless @warned_user_not_gitlab + current_user = run("whoami").chomp + unless current_user == "gitlab" + puts "#{Colored.color(:black)+Colored.color(:on_yellow)} Warning #{Colored.extra(:clear)}" + puts " You are running as user #{current_user.magenta}, we hope you know what you are doing." + puts " Things may work\/fail for the wrong reasons." + puts " For correct results you should run this as user #{"gitlab".magenta}." + puts "" + end + @warned_user_not_gitlab = true + end + end +end diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake deleted file mode 100644 index 0825324a424..00000000000 --- a/lib/tasks/resque.rake +++ /dev/null @@ -1,10 +0,0 @@ -require 'resque/tasks' - -task "resque:setup" => :environment do - Resque.after_fork do - Resque.redis.client.reconnect - end -end - -desc "Alias for resque:work (To run workers on Heroku)" -task "jobs:work" => "resque:work" diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake new file mode 100644 index 00000000000..6bbcb3da4bc --- /dev/null +++ b/lib/tasks/sidekiq.rake @@ -0,0 +1,23 @@ +namespace :sidekiq do + desc "GITLAB | Stop sidekiq" + task :stop do + run "bundle exec sidekiqctl stop #{pidfile}" + end + + desc "GITLAB | Start sidekiq" + task :start do + run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{rails_env} -P #{pidfile} >> #{root_path}/log/sidekiq.log 2>&1 &" + end + + def root_path + @root_path ||= File.join(File.expand_path(File.dirname(__FILE__)), "../..") + end + + def pidfile + "#{root_path}/tmp/pids/sidekiq.pid" + end + + def rails_env + ENV['RAILS_ENV'] || "production" + end +end diff --git a/lib/tasks/travis.rake b/lib/tasks/travis.rake index e04bfbaf1c0..6b434830803 100644 --- a/lib/tasks/travis.rake +++ b/lib/tasks/travis.rake @@ -1,7 +1,5 @@ -task :travis do - ["rake spinach", "rake spec"].each do |cmd| - puts "Starting to run #{cmd}..." - system("export DISPLAY=:99.0 && bundle exec #{cmd}") - raise "#{cmd} failed!" unless $?.exitstatus == 0 - end -end +desc "Travis run tests" +task :travis => [ + :spinach, + :spec +] diff --git a/resque.sh b/resque.sh deleted file mode 100755 index 0ebf319efc1..00000000000 --- a/resque.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir -p tmp/pids -nohup bundle exec rake environment resque:work QUEUE=post_receive,mailer,system_hook RAILS_ENV=production PIDFILE=tmp/pids/resque_worker.pid > ./log/resque.log & diff --git a/resque_dev.sh b/resque_dev.sh deleted file mode 100755 index b250caa9aee..00000000000 --- a/resque_dev.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir -p tmp/pids -nohup bundle exec rake environment resque:work QUEUE=post_receive,mailer,system_hook VVERBOSE=1 RAILS_ENV=development PIDFILE=tmp/pids/resque_worker.pid > ./log/resque.log & diff --git a/script/check b/script/check new file mode 100755 index 00000000000..d2eb4a2f6d8 --- /dev/null +++ b/script/check @@ -0,0 +1,2 @@ +#!/bin/sh +sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production diff --git a/spec/controllers/commit_controller_spec.rb b/spec/controllers/commit_controller_spec.rb index 5aef4c676ee..7bf13822829 100644 --- a/spec/controllers/commit_controller_spec.rb +++ b/spec/controllers/commit_controller_spec.rb @@ -3,12 +3,12 @@ require 'spec_helper' describe CommitController do let(:project) { create(:project) } let(:user) { create(:user) } - let(:commit) { project.last_commit_for("master") } + let(:commit) { project.repository.last_commit_for("master") } before do sign_in(user) - project.add_access(user, :read, :admin) + project.team << [user, :master] end describe "#show" do diff --git a/spec/controllers/commits_controller_spec.rb b/spec/controllers/commits_controller_spec.rb index da33fd8a2b5..1d5d99df802 100644 --- a/spec/controllers/commits_controller_spec.rb +++ b/spec/controllers/commits_controller_spec.rb @@ -7,7 +7,7 @@ describe CommitsController do before do sign_in(user) - project.add_access(user, :read, :admin) + project.team << [user, :master] end describe "GET show" do diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb index 7aebe06cf0c..8478bb3adff 100644 --- a/spec/controllers/merge_requests_controller_spec.rb +++ b/spec/controllers/merge_requests_controller_spec.rb @@ -7,7 +7,7 @@ describe MergeRequestsController do before do sign_in(user) - project.add_access(user, :read, :admin) + project.team << [user, :master] MergeRequestsController.any_instance.stub(validates_merge_request: true) end diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb index b9295537d01..81c7656d07a 100644 --- a/spec/controllers/tree_controller_spec.rb +++ b/spec/controllers/tree_controller_spec.rb @@ -7,7 +7,7 @@ describe TreeController do before do sign_in(user) - project.add_access(user, :read, :admin) + project.team << [user, :master] project.stub(:branches).and_return(['master', 'foo/bar/baz']) project.stub(:tags).and_return(['v1.0.0', 'v2.0.0']) diff --git a/spec/factories.rb b/spec/factories.rb index ca75e507077..593b8350fda 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -9,7 +9,7 @@ FactoryGirl.define do sequence(:url) { Faker::Internet.uri('http') } - factory :user, aliases: [:author, :assignee, :owner] do + factory :user, aliases: [:author, :assignee, :owner, :creator] do email { Faker::Internet.email } name username { Faker::Internet.user_name } @@ -26,7 +26,7 @@ FactoryGirl.define do factory :project do sequence(:name) { |n| "project#{n}" } path { name.downcase.gsub(/\s/, '_') } - owner + creator end factory :group do @@ -37,7 +37,7 @@ FactoryGirl.define do end factory :namespace do - sequence(:name) { |n| "group#{n}" } + sequence(:name) { |n| "namespace#{n}" } path { name.downcase.gsub(/\s/, '_') } owner end diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index b792e0c86f6..497a5f17846 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -4,7 +4,7 @@ describe GitlabMarkdownHelper do let!(:project) { create(:project) } let(:user) { create(:user, username: 'gfm') } - let(:commit) { CommitDecorator.decorate(project.commit) } + let(:commit) { CommitDecorator.decorate(project.repository.commit) } let(:issue) { create(:issue, project: project) } let(:merge_request) { create(:merge_request, project: project) } let(:snippet) { create(:snippet, project: project) } @@ -85,7 +85,7 @@ describe GitlabMarkdownHelper do let(:expected) { project_team_member_path(project, member) } before do - project.add_access(user, :admin) + project.team << [user, :master] end it "should link using a simple name" do @@ -314,7 +314,7 @@ describe GitlabMarkdownHelper do end it "should handle references in lists" do - project.add_access(user, :admin) + project.team << [user, :master] actual = "\n* dark: ##{issue.id}\n* light by @#{member.user.username}" diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb index cf4220175a7..deb6499e008 100644 --- a/spec/lib/extracts_path_spec.rb +++ b/spec/lib/extracts_path_spec.rb @@ -7,7 +7,8 @@ describe ExtractsPath do before do @project = project - project.stub(:ref_names).and_return(['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0']) + project.stub(repository: stub(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0'])) + project.stub(path_with_namespace: 'gitlab/gitlab-ci') end describe '#extract_ref' do @@ -53,5 +54,24 @@ describe ExtractsPath do extract_ref('stable/CHANGELOG').should == ['stable', 'CHANGELOG'] end end + + context "with a fullpath" do + it "extracts a valid branch" do + extract_ref('/gitlab/gitlab-ci/tree/foo/bar/baz/CHANGELOG').should == ['foo/bar/baz', 'CHANGELOG'] + end + + it "extracts a valid tag" do + extract_ref('/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG').should == ['v2.0.0', 'CHANGELOG'] + end + + it "extracts a valid commit SHA" do + extract_ref('/gitlab/gitlab-ci/tree/f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG').should == + ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG'] + end + + it "extracts a timestamp" do + extract_ref('/gitlab/gitlab-ci/tree/v2.0.0/CHANGELOG?_=12354435').should == ['v2.0.0', 'CHANGELOG'] + end + end end end diff --git a/spec/lib/project_mover_spec.rb b/spec/lib/project_mover_spec.rb index 2362bc2667b..28323b24ef6 100644 --- a/spec/lib/project_mover_spec.rb +++ b/spec/lib/project_mover_spec.rb @@ -5,6 +5,7 @@ describe Gitlab::ProjectMover do before do FileUtils.rm_rf base_path if File.exists? base_path + FileUtils.mkdir_p base_path Gitlab.config.gitolite.stub(repos_path: base_path) diff --git a/spec/roles/votes_spec.rb b/spec/lib/votes_spec.rb similarity index 100% rename from spec/roles/votes_spec.rb rename to spec/lib/votes_spec.rb diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 58698eec9f4..e5b4cdaf330 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -60,7 +60,7 @@ describe Notify do it_behaves_like 'an assignee email' it 'has the correct subject' do - should have_subject /new issue ##{issue.id} \| #{issue.title} \| #{project.name}/ + should have_subject /#{project.name} \| new issue ##{issue.id} \| #{issue.title}/ end it 'contains a link to the new issue' do diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index e4bc1936839..91301029e89 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Commit do - let(:commit) { create(:project).commit } + let(:commit) { create(:project).repository.commit } describe CommitDecorator do let(:decorator) { CommitDecorator.new(commit) } @@ -34,4 +34,65 @@ describe Commit do end end end + + describe "Commit info" do + before do + @committer = double( + email: 'mike@smith.com', + name: 'Mike Smith' + ) + + @author = double( + email: 'john@smith.com', + name: 'John Smith' + ) + + @raw_commit = double( + id: "bcf03b5de6abcf03b5de6c", + author: @author, + committer: @committer, + committed_date: Date.yesterday, + message: 'Refactoring specs' + ) + + @commit = Commit.new(@raw_commit) + end + + it { @commit.short_id.should == "bcf03b5de6a" } + it { @commit.safe_message.should == @raw_commit.message } + it { @commit.created_at.should == @raw_commit.committed_date } + it { @commit.author_email.should == @author.email } + it { @commit.author_name.should == @author.name } + it { @commit.committer_name.should == @committer.name } + it { @commit.committer_email.should == @committer.email } + it { @commit.different_committer?.should be_true } + end + + describe "Class methods" do + subject { Commit } + + it { should respond_to(:find_or_first) } + it { should respond_to(:fresh_commits) } + it { should respond_to(:commits_with_refs) } + it { should respond_to(:commits_since) } + it { should respond_to(:commits_between) } + it { should respond_to(:commits) } + it { should respond_to(:compare) } + end + + describe "delegation" do + subject { commit } + + it { should respond_to(:message) } + it { should respond_to(:authored_date) } + it { should respond_to(:committed_date) } + it { should respond_to(:parents) } + it { should respond_to(:date) } + it { should respond_to(:committer) } + it { should respond_to(:author) } + it { should respond_to(:diffs) } + it { should respond_to(:tree) } + it { should respond_to(:id) } + it { should respond_to(:to_patch) } + end end diff --git a/spec/roles/issue_commonality_spec.rb b/spec/models/concerns/issuable_spec.rb similarity index 98% rename from spec/roles/issue_commonality_spec.rb rename to spec/models/concerns/issuable_spec.rb index 11f278dea10..b5d4bd7b406 100644 --- a/spec/roles/issue_commonality_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Issue, "IssueCommonality" do +describe Issue, "Issuable" do let(:issue) { create(:issue) } describe "Associations" do diff --git a/spec/models/gitlab_ci_service_spec.rb b/spec/models/gitlab_ci_service_spec.rb new file mode 100644 index 00000000000..b86588af1ac --- /dev/null +++ b/spec/models/gitlab_ci_service_spec.rb @@ -0,0 +1,46 @@ +# == Schema Information +# +# Table name: services +# +# id :integer not null, primary key +# type :string(255) +# title :string(255) +# token :string(255) +# project_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# active :boolean default(FALSE), not null +# project_url :string(255) +# + +require 'spec_helper' + +describe GitlabCiService do + describe "Associations" do + it { should belong_to :project } + it { should have_one :service_hook } + end + + describe "Mass assignment" do + it { should_not allow_mass_assignment_of(:project_id) } + end + + describe 'commits methods' do + before do + @service = GitlabCiService.new + @service.stub( + service_hook: true, + project_url: 'http://ci.gitlab.org/projects/2', + token: 'verySecret' + ) + end + + describe :commit_status_path do + it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"} + end + + describe :build_page do + it { @service.build_page("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c"} + end + end +end diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 4c52a094386..b4fb9cd8fdd 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -33,8 +33,7 @@ describe Issue do end describe 'modules' do - it { should include_module(IssueCommonality) } - it { should include_module(Votes) } + it { should include_module(Issuable) } end subject { create(:issue) } diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index a0849401254..41f4ede5d89 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -33,15 +33,14 @@ describe MergeRequest do end describe 'modules' do - it { should include_module(IssueCommonality) } - it { should include_module(Votes) } + it { should include_module(Issuable) } end describe "#mr_and_commit_notes" do let!(:merge_request) { create(:merge_request) } before do - merge_request.stub(:commits) { [merge_request.project.commit] } + merge_request.stub(:commits) { [merge_request.project.repository.commit] } create(:note, commit_id: merge_request.commits.first.id, noteable_type: 'Commit') create(:note, noteable: merge_request) end diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 431985d0d46..2ea2c56a6f7 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -40,6 +40,7 @@ describe Milestone do end it "should count closed issues" do + IssueObserver.current_user = issue.author issue.update_attributes(closed: true) milestone.issues << issue milestone.percent_complete.should == 100 @@ -62,4 +63,54 @@ describe Milestone do milestone.expires_at.should be_present end end + + describe :expired? do + context "expired" do + before do + milestone.stub(due_date: Date.today.prev_year) + end + + it { milestone.expired?.should be_true } + end + + context "not expired" do + before do + milestone.stub(due_date: Date.today.next_year) + end + + it { milestone.expired?.should be_false } + end + end + + describe :percent_complete do + before do + milestone.stub( + closed_items_count: 3, + total_items_count: 4 + ) + end + + it { milestone.percent_complete.should == 75 } + end + + describe :items_count do + before do + milestone.issues << create(:issue) + milestone.issues << create(:issue, closed: true) + milestone.merge_requests << create(:merge_request) + end + + it { milestone.closed_items_count.should == 1 } + it { milestone.open_items_count.should == 2 } + it { milestone.total_items_count.should == 3 } + it { milestone.is_empty?.should be_false } + end + + describe :can_be_closed? do + it { milestone.can_be_closed?.should be_true } + end + + describe :open? do + it { milestone.open?.should be_true } + end end diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 34683e4196a..66450b244c1 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -4,7 +4,6 @@ # # id :integer not null, primary key # note :text -# noteable_id :string(255) # noteable_type :string(255) # author_id :integer # created_at :datetime not null @@ -12,6 +11,8 @@ # project_id :integer # attachment :string(255) # line_code :string(255) +# commit_id :string(255) +# noteable_id :integer # require 'spec_helper' @@ -33,12 +34,6 @@ describe Note do it { should validate_presence_of(:project) } end - describe "Scopes" do - it "should have a today named scope that returns ..." do - Note.today.where_values.should == ["created_at >= '#{Date.today}'"] - end - end - describe "Voting score" do let(:project) { create(:project) } @@ -75,6 +70,9 @@ describe Note do end end + let(:project) { create(:project) } + let(:commit) { project.repository.commit } + describe "Commit notes" do let!(:note) { create(:note_on_commit, note: "+1 from me") } let!(:commit) { note.noteable } diff --git a/spec/models/project_hooks_spec.rb b/spec/models/project_hooks_spec.rb index df6a3831e30..60457e20c51 100644 --- a/spec/models/project_hooks_spec.rb +++ b/spec/models/project_hooks_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe Project, "Hooks" do let(:project) { create(:project) } + before do @key = create(:key, user: project.owner) @user = @key.user @@ -70,8 +71,9 @@ describe Project, "Hooks" do context "when gathering commit data" do before do - @oldrev, @newrev, @ref = project.fresh_commits(2).last.sha, project.fresh_commits(2).first.sha, 'refs/heads/master' - @commit = project.fresh_commits(2).first + @oldrev, @newrev, @ref = project.repository.fresh_commits(2).last.sha, + project.repository.fresh_commits(2).first.sha, 'refs/heads/master' + @commit = project.repository.fresh_commits(2).first # Fill nil/empty attributes project.description = "This is a description" @@ -91,7 +93,7 @@ describe Project, "Hooks" do subject { @data[:repository] } it { should include(name: project.name) } - it { should include(url: project.web_url) } + it { should include(url: project.url_to_repo) } it { should include(description: project.description) } it { should include(homepage: project.web_url) } end diff --git a/spec/models/project_security_spec.rb b/spec/models/project_security_spec.rb index 92c6bce08f6..1f2bd7a56ff 100644 --- a/spec/models/project_security_spec.rb +++ b/spec/models/project_security_spec.rb @@ -8,7 +8,7 @@ describe Project do @u1 = create(:user) @u2 = create(:user) @u3 = create(:user) - @u4 = @p1.chief + @u4 = @p1.owner @abilities = Six.new @abilities << Ability diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 83a76976098..223b9d48c01 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -9,7 +9,7 @@ # created_at :datetime not null # updated_at :datetime not null # private_flag :boolean default(TRUE), not null -# owner_id :integer +# creator_id :integer # default_branch :string(255) # issues_enabled :boolean default(TRUE), not null # wall_enabled :boolean default(TRUE), not null @@ -24,7 +24,7 @@ describe Project do describe "Associations" do it { should belong_to(:group) } it { should belong_to(:namespace) } - it { should belong_to(:owner).class_name('User') } + it { should belong_to(:creator).class_name('User') } it { should have_many(:users) } it { should have_many(:events).dependent(:destroy) } it { should have_many(:merge_requests).dependent(:destroy) } @@ -41,7 +41,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(:creator_id) } it { should_not allow_mass_assignment_of(:private_flag) } end @@ -55,20 +55,15 @@ describe Project do it { should validate_presence_of(:path) } it { should validate_uniqueness_of(:path) } it { should ensure_length_of(:path).is_within(0..255) } - # TODO: Formats - it { should ensure_length_of(:description).is_within(0..2000) } - - # TODO: Formats - - it { should validate_presence_of(:owner) } + it { should validate_presence_of(:creator) } it { should ensure_inclusion_of(:issues_enabled).in_array([true, false]) } it { should ensure_inclusion_of(:wall_enabled).in_array([true, false]) } it { should ensure_inclusion_of(:merge_requests_enabled).in_array([true, false]) } it { should ensure_inclusion_of(:wiki_enabled).in_array([true, false]) } it "should not allow new projects beyond user limits" do - project.stub(:owner).and_return(double(can_create_project?: false, projects_limit: 1)) + project.stub(:creator).and_return(double(can_create_project?: false, projects_limit: 1)) project.should_not be_valid project.errors[:base].first.should match(/Your own projects limit is 1/) end @@ -80,82 +75,28 @@ describe Project do end describe "Respond to" do - it { should respond_to(:public?) } - it { should respond_to(:private?) } it { should respond_to(:url_to_repo) } - it { should respond_to(:path_to_repo) } - it { should respond_to(:valid_repo?) } it { should respond_to(:repo_exists?) } - - # Repository Role - it { should respond_to(:tree) } - it { should respond_to(:root_ref) } - it { should respond_to(:repo) } - it { should respond_to(:tags) } - it { should respond_to(:commit) } - it { should respond_to(:commits) } - it { should respond_to(:commits_between) } - it { should respond_to(:commits_with_refs) } - it { should respond_to(:commits_since) } - it { should respond_to(:commits_between) } it { should respond_to(:satellite) } it { should respond_to(:update_repository) } it { should respond_to(:destroy_repository) } - it { should respond_to(:archive_repo) } - - # Authority Role - it { should respond_to(:add_access) } - it { should respond_to(:reset_access) } - it { should respond_to(:repository_writers) } - it { should respond_to(:repository_masters) } - it { should respond_to(:repository_readers) } - it { should respond_to(:allow_read_for?) } - it { should respond_to(:guest_access_for?) } - it { should respond_to(:report_access_for?) } - it { should respond_to(:dev_access_for?) } - it { should respond_to(:master_access_for?) } - - # Team Role - it { should respond_to(:team_member_by_name_or_email) } - it { should respond_to(:team_member_by_id) } - it { should respond_to(:add_user_to_team) } - it { should respond_to(:add_users_to_team) } - it { should respond_to(:add_user_id_to_team) } - it { should respond_to(:add_users_ids_to_team) } - - # Project Push Role it { should respond_to(:observe_push) } it { should respond_to(:update_merge_requests) } it { should respond_to(:execute_hooks) } it { should respond_to(:post_receive_data) } it { should respond_to(:trigger_post_receive) } - - # Namespaced Project Role it { should respond_to(:transfer) } it { should respond_to(:name_with_namespace) } it { should respond_to(:namespace_owner) } - it { should respond_to(:chief) } + it { should respond_to(:owner) } it { should respond_to(:path_with_namespace) } end - describe 'modules' do - it { should include_module(Repository) } - it { should include_module(PushObserver) } - it { should include_module(Authority) } - it { should include_module(Team) } - it { should include_module(NamespacedProject) } - end - it "should return valid url to repo" do project = Project.new(path: "somewhere") project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git" end - it "should return path to repo" do - project = Project.new(path: "somewhere") - project.path_to_repo.should == Rails.root.join("tmp", "repositories", "somewhere") - end - it "returns the full web URL for this repo" do project = Project.new(path: "somewhere") project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere" @@ -211,4 +152,87 @@ describe Project do @merge_request.last_commit.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" end end + + describe :create_by_user do + before do + @user = create :user + @opts = { + name: "GitLab" + } + end + + context 'user namespace' do + before do + @project = Project.create_by_user(@opts, @user) + end + + it { @project.should be_valid } + it { @project.owner.should == @user } + it { @project.namespace.should == @user.namespace } + end + + context 'user namespace' do + before do + @group = create :group, owner: @user + @opts.merge!(namespace_id: @group.id) + @project = Project.create_by_user(@opts, @user) + end + + it { @project.should be_valid } + it { @project.owner.should == @user } + it { @project.namespace.should == @group } + end + end + + describe :find_with_namespace do + context 'with namespace' do + before do + @group = create :group, name: 'gitlab' + @project = create(:project, name: 'gitlab-ci', namespace: @group) + end + + it { Project.find_with_namespace('gitlab/gitlab-ci').should == @project } + it { Project.find_with_namespace('gitlab-ci').should be_nil } + end + + context 'w/o namespace' do + before do + @project = create(:project, name: 'gitlab-ci') + end + + it { Project.find_with_namespace('gitlab-ci').should == @project } + it { Project.find_with_namespace('gitlab/gitlab-ci').should be_nil } + end + end + + describe :to_param do + context 'with namespace' do + before do + @group = create :group, name: 'gitlab' + @project = create(:project, name: 'gitlab-ci', namespace: @group) + end + + it { @project.to_param.should == "gitlab/gitlab-ci" } + end + + context 'w/o namespace' do + before do + @project = create(:project, name: 'gitlab-ci') + end + + it { @project.to_param.should == "gitlab-ci" } + end + end + + describe :repository do + let(:project) { create(:project) } + + it "should return valid repo" do + project.repository.should be_kind_of(Repository) + end + + it "should return nil" do + Project.new(path: "empty").repository.should be_nil + end + end end diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index 7340ce50ced..c4d2e2f49f5 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -39,13 +39,4 @@ describe ProtectedBranch do branch.destroy end end - - describe '#commit' do - let(:branch) { create(:protected_branch) } - - it 'commits itself to its project' do - branch.project.should_receive(:commit).with(branch.name) - branch.commit - end - end end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb new file mode 100644 index 00000000000..71f9b964e70 --- /dev/null +++ b/spec/models/repository_spec.rb @@ -0,0 +1,105 @@ +require "spec_helper" + +describe Repository do + let(:project) { create(:project) } + let(:repository) { project.repository } + + describe "Respond to" do + subject { repository } + + it { should respond_to(:repo) } + it { should respond_to(:tree) } + it { should respond_to(:root_ref) } + it { should respond_to(:tags) } + it { should respond_to(:commit) } + it { should respond_to(:commits) } + it { should respond_to(:commits_between) } + it { should respond_to(:commits_with_refs) } + it { should respond_to(:commits_since) } + it { should respond_to(:commits_between) } + end + + + describe "#discover_default_branch" do + let(:master) { 'master' } + let(:stable) { 'stable' } + + it "returns 'master' when master exists" do + repository.should_receive(:branch_names).at_least(:once).and_return([stable, master]) + repository.discover_default_branch.should == 'master' + end + + it "returns non-master when master exists but default branch is set to something else" do + repository.root_ref = 'stable' + repository.should_receive(:branch_names).at_least(:once).and_return([stable, master]) + repository.discover_default_branch.should == 'stable' + end + + it "returns a non-master branch when only one exists" do + repository.should_receive(:branch_names).at_least(:once).and_return([stable]) + repository.discover_default_branch.should == 'stable' + end + + it "returns nil when no branch exists" do + repository.should_receive(:branch_names).at_least(:once).and_return([]) + repository.discover_default_branch.should be_nil + end + end + + describe :commit do + it "should return first head commit if without params" do + repository.commit.id.should == repository.repo.commits.first.id + end + + it "should return valid commit" do + repository.commit(ValidCommit::ID).should be_valid_commit + end + + it "should return nil" do + repository.commit("+123_4532530XYZ").should be_nil + end + end + + describe :tree do + before do + @commit = repository.commit(ValidCommit::ID) + end + + it "should raise error w/o arguments" do + lambda { repository.tree }.should raise_error + end + + it "should return root tree for commit" do + tree = repository.tree(@commit) + tree.contents.size.should == ValidCommit::FILES_COUNT + tree.contents.map(&:name).should == ValidCommit::FILES + end + + it "should return root tree for commit with correct path" do + tree = repository.tree(@commit, ValidCommit::C_FILE_PATH) + tree.contents.map(&:name).should == ValidCommit::C_FILES + end + + it "should return root tree for commit with incorrect path" do + repository.tree(@commit, "invalid_path").should be_nil + end + end + + describe "fresh commits" do + it { repository.fresh_commits(3).count.should == 3 } + it { repository.fresh_commits.first.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" } + it { repository.fresh_commits.last.id.should == "f403da73f5e62794a0447aca879360494b08f678" } + end + + describe "commits_between" do + subject do + commits = repository.commits_between("3a4b4fb4cde7809f033822a171b9feae19d41fff", + "8470d70da67355c9c009e4401746b1d5410af2e3") + commits.map { |c| c.id } + end + + it { should have(3).elements } + it { should include("f0f14c8eaba69ebddd766498a9d0b0e79becd633") } + it { should_not include("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } + end +end diff --git a/spec/models/system_hook_spec.rb b/spec/models/system_hook_spec.rb index 7ae483a4003..a9ed6a5fa7c 100644 --- a/spec/models/system_hook_spec.rb +++ b/spec/models/system_hook_spec.rb @@ -23,53 +23,40 @@ describe SystemHook do end it "project_create hook" do - with_resque do - project = create(:project) - end + project = create(:project) WebMock.should have_requested(:post, @system_hook.url).with(body: /project_create/).once end it "project_destroy hook" do project = create(:project) - with_resque do - project.destroy - end + project.destroy WebMock.should have_requested(:post, @system_hook.url).with(body: /project_destroy/).once end it "user_create hook" do - with_resque do - create(:user) - end + create(:user) WebMock.should have_requested(:post, @system_hook.url).with(body: /user_create/).once end it "user_destroy hook" do user = create(:user) - with_resque do - user.destroy - end + user.destroy WebMock.should have_requested(:post, @system_hook.url).with(body: /user_destroy/).once end it "project_create hook" do user = create(:user) project = create(:project) - with_resque do - project.add_access(user, :admin) - end + project.team << [user, :master] WebMock.should have_requested(:post, @system_hook.url).with(body: /user_add_to_team/).once end it "project_destroy hook" do user = create(:user) project = create(:project) - project.add_access(user, :admin) - with_resque do - project.users_projects.clear - end + project.team << [user, :master] + project.users_projects.clear WebMock.should have_requested(:post, @system_hook.url).with(body: /user_remove_from_team/).once end end - end diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb new file mode 100644 index 00000000000..65ffe13b490 --- /dev/null +++ b/spec/models/team_spec.rb @@ -0,0 +1,18 @@ +require "spec_helper" + +describe Team do + let(:team) { create(:project).team } + + describe "Respond to" do + subject { team } + + it { should respond_to(:developers) } + it { should respond_to(:masters) } + it { should respond_to(:reporters) } + it { should respond_to(:guests) } + it { should respond_to(:repository_writers) } + it { should respond_to(:repository_masters) } + it { should respond_to(:repository_readers) } + end +end + diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d09484f8fe0..f19c40b5fa6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -39,7 +39,6 @@ describe User do describe "Associations" do it { should have_one(:namespace) } it { should have_many(:users_projects).dependent(:destroy) } - it { should have_many(:projects) } it { should have_many(:groups) } it { should have_many(:keys).dependent(:destroy) } it { should have_many(:events).class_name('Event').dependent(:destroy) } @@ -66,10 +65,6 @@ describe User do it { should ensure_length_of(:bio).is_within(0..255) } end - describe 'modules' do - it { should include_module(Account) } - end - describe "Respond to" do it { should respond_to(:is_admin?) } it { should respond_to(:identifier) } @@ -119,4 +114,83 @@ describe User do user.authentication_token.should_not be_blank end end + + describe 'projects' do + before do + ActiveRecord::Base.observers.enable(:user_observer) + @user = create :user + @project = create :project, namespace: @user.namespace + end + + it { @user.authorized_projects.should include(@project) } + it { @user.owned_projects.should include(@project) } + it { @user.personal_projects.should include(@project) } + end + + describe 'groups' do + before do + ActiveRecord::Base.observers.enable(:user_observer) + @user = create :user + @group = create :group, owner: @user + end + + it { @user.several_namespaces?.should be_true } + it { @user.namespaces.should == [@user.namespace, @group] } + it { @user.authorized_groups.should == [@group] } + it { @user.owned_groups.should == [@group] } + end + + describe 'namespaced' do + before do + ActiveRecord::Base.observers.enable(:user_observer) + @user = create :user + @project = create :project, namespace: @user.namespace + end + + it { @user.several_namespaces?.should be_false } + it { @user.namespaces.should == [@user.namespace] } + end + + describe 'blocking user' do + let(:user) { create(:user, name: 'John Smith') } + + it "should block user" do + user.block + user.blocked.should be_true + end + end + + describe 'filter' do + before do + User.delete_all + @user = create :user + @admin = create :user, admin: true + @blocked = create :user, blocked: true + end + + it { User.filter("admins").should == [@admin] } + it { User.filter("blocked").should == [@blocked] } + it { User.filter("wop").should == [@user, @admin, @blocked] } + it { User.filter(nil).should == [@user, @admin] } + end + + describe :not_in_project do + before do + User.delete_all + @user = create :user + @project = create :project + end + + it { User.not_in_project(@project).should == [@user, @project.owner] } + end + + describe 'normal user' do + let(:user) { create(:user, name: 'John Smith') } + + it { user.is_admin?.should be_false } + it { user.require_ssh_key?.should be_true } + it { user.can_create_group?.should be_false } + it { user.can_create_project?.should be_true } + it { user.first_name.should == 'John' } + end end diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb index a9a1857eb69..e8f5b647ce0 100644 --- a/spec/models/users_project_spec.rb +++ b/spec/models/users_project_spec.rb @@ -48,10 +48,10 @@ describe UsersProject do @user_1 = create :user @user_2 = create :user - @project_1.add_access @user_1, :write - @project_2.add_access @user_2, :read + @project_1.team << [ @user_1, :developer ] + @project_2.team << [ @user_2, :reporter ] - @status = UsersProject.import_team(@project_1, @project_2) + @status = @project_2.team.import(@project_1) end it { @status.should be_true } @@ -69,4 +69,45 @@ describe UsersProject do it { @project_1.users.should_not include(@user_2) } end end + + describe :add_users_into_projects do + before do + @project_1 = create :project + @project_2 = create :project + + @user_1 = create :user + @user_2 = create :user + + UsersProject.add_users_into_projects( + [@project_1.id, @project_2.id], + [@user_1.id, @user_2.id], + UsersProject::MASTER + ) + end + + it { @project_1.users.should include(@user_1) } + it { @project_1.users.should include(@user_2) } + + + it { @project_2.users.should include(@user_1) } + it { @project_2.users.should include(@user_2) } + end + + describe :truncate_teams do + before do + @project_1 = create :project + @project_2 = create :project + + @user_1 = create :user + @user_2 = create :user + + @project_1.team << [ @user_1, :developer] + @project_2.team << [ @user_2, :reporter] + + UsersProject.truncate_teams([@project_1.id, @project_2.id]) + end + + it { @project_1.users.should be_empty } + it { @project_2.users.should be_empty } + end end diff --git a/spec/observers/issue_observer_spec.rb b/spec/observers/issue_observer_spec.rb index bbffbd342db..700c9a3a69b 100644 --- a/spec/observers/issue_observer_spec.rb +++ b/spec/observers/issue_observer_spec.rb @@ -21,8 +21,7 @@ describe IssueObserver do end it 'sends an email to the assignee' do - Notify.should_receive(:new_issue_email).with(issue.id). - and_return(double(deliver: true)) + Notify.should_receive(:new_issue_email).with(issue.id) subject.after_create(issue) end @@ -71,6 +70,7 @@ describe IssueObserver do context 'a status "closed"' do it 'note is created if the issue is being closed' do issue.should_receive(:is_being_closed?).and_return(true) + Notify.should_receive(:issue_status_changed_email).twice Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed') subject.after_update(issue) @@ -85,7 +85,7 @@ describe IssueObserver do it 'notification is delivered if the issue being closed' do issue.stub(:is_being_closed?).and_return(true) - Notify.should_receive(:issue_status_changed_email).twice.and_return(stub(deliver: true)) + Notify.should_receive(:issue_status_changed_email).twice Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed') subject.after_update(issue) @@ -104,7 +104,7 @@ describe IssueObserver do issue_without_assignee.stub(:is_being_reassigned?).and_return(false) issue_without_assignee.stub(:is_being_closed?).and_return(true) issue_without_assignee.stub(:is_being_reopened?).and_return(false) - Notify.should_receive(:issue_status_changed_email).once.and_return(stub(deliver: true)) + Notify.should_receive(:issue_status_changed_email).once Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'closed') subject.after_update(issue_without_assignee) @@ -113,6 +113,7 @@ describe IssueObserver do context 'a status "reopened"' do it 'note is created if the issue is being reopened' do + Notify.should_receive(:issue_status_changed_email).twice issue.should_receive(:is_being_reopened?).and_return(true) Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened') @@ -128,7 +129,7 @@ describe IssueObserver do it 'notification is delivered if the issue being reopened' do issue.stub(:is_being_reopened?).and_return(true) - Notify.should_receive(:issue_status_changed_email).twice.and_return(stub(deliver: true)) + Notify.should_receive(:issue_status_changed_email).twice Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened') subject.after_update(issue) @@ -147,7 +148,7 @@ describe IssueObserver do issue_without_assignee.stub(:is_being_reassigned?).and_return(false) issue_without_assignee.stub(:is_being_closed?).and_return(false) issue_without_assignee.stub(:is_being_reopened?).and_return(true) - Notify.should_receive(:issue_status_changed_email).once.and_return(stub(deliver: true)) + Notify.should_receive(:issue_status_changed_email).once Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'reopened') subject.after_update(issue_without_assignee) @@ -164,8 +165,7 @@ describe IssueObserver do end def it_sends_a_reassigned_email_to(recipient) - Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id). - and_return(double(deliver: true)) + Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id) end def it_does_not_send_a_reassigned_email_to(recipient) diff --git a/spec/observers/key_observer_spec.rb b/spec/observers/key_observer_spec.rb index 7f2a76a320c..ae7b0f73e57 100644 --- a/spec/observers/key_observer_spec.rb +++ b/spec/observers/key_observer_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe KeyObserver do - before do + before do @key = double('Key', identifier: 'admin_654654', key: '== a vaild ssh key', @@ -15,7 +15,7 @@ describe KeyObserver do ) @observer = KeyObserver.instance - @observer.stub(:git_host => @gitolite) + @observer.stub(gitolite: @gitolite) end context :after_save do @@ -25,7 +25,7 @@ describe KeyObserver do end end - context :after_destroy do + context :after_destroy do it do @gitolite.should_receive(:remove_key).with(@key.identifier, @key.projects) @observer.after_destroy(@key) diff --git a/spec/observers/merge_request_observer_spec.rb b/spec/observers/merge_request_observer_spec.rb index 6b15be96630..4841bf88fc5 100644 --- a/spec/observers/merge_request_observer_spec.rb +++ b/spec/observers/merge_request_observer_spec.rb @@ -21,9 +21,7 @@ describe MergeRequestObserver do end it 'sends an email to the assignee' do - Notify.should_receive(:new_merge_request_email).with(mr.id). - and_return(double(deliver: true)) - + Notify.should_receive(:new_merge_request_email).with(mr.id) subject.after_create(mr) end @@ -158,8 +156,7 @@ describe MergeRequestObserver do end def it_sends_a_reassigned_email_to(recipient) - Notify.should_receive(:reassigned_merge_request_email).with(recipient, mr.id, previous_assignee.id). - and_return(double(deliver: true)) + Notify.should_receive(:reassigned_merge_request_email).with(recipient, mr.id, previous_assignee.id) end def it_does_not_send_a_reassigned_email_to(recipient) diff --git a/spec/observers/note_observer_spec.rb b/spec/observers/note_observer_spec.rb index 7dfa9f772e9..73da2e146cb 100644 --- a/spec/observers/note_observer_spec.rb +++ b/spec/observers/note_observer_spec.rb @@ -4,7 +4,6 @@ describe NoteObserver do subject { NoteObserver.instance } let(:team_without_author) { (1..2).map { |n| double :user, id: n } } - let(:delivery_success) { double deliver: true } describe '#after_create' do let(:note) { double :note } @@ -45,13 +44,13 @@ describe NoteObserver do note.stub(:id).and_return(42) author = double :user, id: 1 note.stub(:commit_author).and_return(author) - Notify.should_receive(:note_commit_email).and_return(delivery_success) + Notify.should_receive(:note_commit_email) subject.after_create(note) end it 'does not notify the author of a commit when not flagged to notify the author' do - Notify.should_not_receive(:note_commit_email) + notify.should_not_receive(:note_commit_email) subject.after_create(note) end @@ -71,28 +70,28 @@ describe NoteObserver do context 'notifies team of a new note on' do it 'a commit' do note.stub(:noteable_type).and_return('Commit') - Notify.should_receive(:note_commit_email).twice.and_return(delivery_success) + notify.should_receive(:note_commit_email).twice subject.send(:notify_team, note) end it 'an issue' do note.stub(:noteable_type).and_return('Issue') - Notify.should_receive(:note_issue_email).twice.and_return(delivery_success) + notify.should_receive(:note_issue_email).twice subject.send(:notify_team, note) end it 'a wiki page' do note.stub(:noteable_type).and_return('Wiki') - Notify.should_receive(:note_wiki_email).twice.and_return(delivery_success) + notify.should_receive(:note_wiki_email).twice subject.send(:notify_team, note) end it 'a merge request' do note.stub(:noteable_type).and_return('MergeRequest') - Notify.should_receive(:note_merge_request_email).twice.and_return(delivery_success) + notify.should_receive(:note_merge_request_email).twice subject.send(:notify_team, note) end @@ -100,16 +99,16 @@ describe NoteObserver do it 'a wall' do # Note: wall posts have #noteable_type of nil note.stub(:noteable_type).and_return(nil) - Notify.should_receive(:note_wall_email).twice.and_return(delivery_success) + notify.should_receive(:note_wall_email).twice subject.send(:notify_team, note) end end it 'does nothing for a new note on a snippet' do - note.stub(:noteable_type).and_return('Snippet') + note.stub(:noteable_type).and_return('Snippet') - subject.send(:notify_team, note).should be_nil + subject.send(:notify_team, note).should be_nil end end @@ -125,4 +124,8 @@ describe NoteObserver do subject.send(:team_without_note_author, note).should == team_without_author end end + + def notify + Notify + end end diff --git a/spec/observers/user_observer_spec.rb b/spec/observers/user_observer_spec.rb index 4ba0f05df5d..bffa5fcfd69 100644 --- a/spec/observers/user_observer_spec.rb +++ b/spec/observers/user_observer_spec.rb @@ -6,31 +6,18 @@ describe UserObserver do it 'calls #after_create when new users are created' do new_user = build(:user) subject.should_receive(:after_create).with(new_user) - - User.observers.enable :user_observer do - new_user.save - end + new_user.save end context 'when a new user is created' do - let(:user) { double(:user, id: 42, - password: 'P@ssword!', - name: 'John', - email: 'u@mail.local', - username: 'root', - create_namespace: true) } - let(:notification) { double :notification } - it 'sends an email' do - notification.should_receive(:deliver) - Notify.should_receive(:new_user_email).with(user.id, user.password).and_return(notification) - - subject.after_create(user) + Notify.should_receive(:new_user_email) + create(:user) end it 'trigger logger' do Gitlab::AppLogger.should_receive(:info) - subject.after_create(user) + create(:user) end end end diff --git a/spec/observers/users_project_observer_spec.rb b/spec/observers/users_project_observer_spec.rb index 548f1893848..068688b0d1d 100644 --- a/spec/observers/users_project_observer_spec.rb +++ b/spec/observers/users_project_observer_spec.rb @@ -3,72 +3,62 @@ require 'spec_helper' describe UsersProjectObserver do let(:user) { create(:user) } let(:project) { create(:project) } - let(:users_project) { create(:users_project, - project: project, - user: user )} subject { UsersProjectObserver.instance } describe "#after_commit" do it "should called when UsersProject created" do - subject.should_receive(:after_commit).once - UsersProject.observers.enable :users_project_observer do - create(:users_project) - end + subject.should_receive(:after_commit) + create(:users_project) end it "should send email to user" do - Notify.should_receive(:project_access_granted_email).with(users_project.id).and_return(double(deliver: true)) - subject.after_commit(users_project) + Notify.should_receive(:project_access_granted_email).and_return(double(deliver: true)) Event.stub(:create => true) + + create(:users_project) end it "should create new event" do - Event.should_receive(:create).with( - project_id: users_project.project.id, - action: Event::Joined, - author_id: users_project.user.id - ) + Event.should_receive(:create) - subject.after_create(users_project) + create(:users_project) end end describe "#after_update" do + before do + @users_project = create :users_project + end + it "should called when UsersProject updated" do - subject.should_receive(:after_commit).once - UsersProject.observers.enable :users_project_observer do - create(:users_project).update_attribute(:project_access, UsersProject::MASTER) - end + subject.should_receive(:after_commit) + @users_project.update_attribute(:project_access, UsersProject::MASTER) end it "should send email to user" do - Notify.should_receive(:project_access_granted_email).with(users_project.id).and_return(double(deliver: true)) - subject.after_commit(users_project) + Notify.should_receive(:project_access_granted_email) + @users_project.update_attribute(:project_access, UsersProject::MASTER) end + it "should not called after UsersProject destroyed" do subject.should_not_receive(:after_commit) - UsersProject.observers.enable :users_project_observer do - users_project.destroy - end + @users_project.destroy end end describe "#after_destroy" do + before do + @users_project = create :users_project + end + it "should called when UsersProject destroyed" do subject.should_receive(:after_destroy) - - UsersProject.observers.enable :users_project_observer do - create(:users_project).destroy - end + @users_project.destroy end it "should create new event" do - Event.should_receive(:create).with( - project_id: users_project.project.id, - action: Event::Left, - author_id: users_project.user.id - ) - subject.after_destroy(users_project) + Event.should_receive(:create) + @users_project.destroy end end end diff --git a/spec/requests/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb index ca134c2d4f7..a66e85a34f9 100644 --- a/spec/requests/admin/admin_users_spec.rb +++ b/spec/requests/admin/admin_users_spec.rb @@ -41,7 +41,7 @@ describe "Admin::Users" do end it "should call send mail" do - Notify.should_receive(:new_user_email).and_return(stub(deliver: true)) + Notify.should_receive(:new_user_email) User.observers.enable :user_observer do click_button "Save" @@ -50,9 +50,7 @@ describe "Admin::Users" do it "should send valid email to user with email & password" do User.observers.enable :user_observer do - with_resque do - click_button "Save" - end + click_button "Save" user = User.last email = ActionMailer::Base.deliveries.last email.subject.should have_content("Account was created") diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 1850ecb95cc..781ebab026b 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -4,9 +4,9 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:issue) { create(:issue, author: user, assignee: user, project: project) } - before { project.add_access(user, :read) } + before { project.team << [user, :reporter] } describe "GET /issues" do context "when unauthenticated" do @@ -28,7 +28,7 @@ describe Gitlab::API do describe "GET /projects/:id/issues" do it "should return project issues" do - get api("/projects/#{project.path}/issues", user) + get api("/projects/#{project.id}/issues", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == issue.title @@ -37,7 +37,7 @@ describe Gitlab::API do describe "GET /projects/:id/issues/:issue_id" do it "should return a project issue by id" do - get api("/projects/#{project.path}/issues/#{issue.id}", user) + get api("/projects/#{project.id}/issues/#{issue.id}", user) response.status.should == 200 json_response['title'].should == issue.title end @@ -45,7 +45,7 @@ describe Gitlab::API do describe "POST /projects/:id/issues" do it "should create a new project issue" do - post api("/projects/#{project.path}/issues", user), + post api("/projects/#{project.id}/issues", user), title: 'new issue', labels: 'label, label2' response.status.should == 201 json_response['title'].should == 'new issue' @@ -56,7 +56,7 @@ describe Gitlab::API do describe "PUT /projects/:id/issues/:issue_id" do it "should update a project issue" do - put api("/projects/#{project.path}/issues/#{issue.id}", user), + put api("/projects/#{project.id}/issues/#{issue.id}", user), title: 'updated title', labels: 'label2', closed: 1 response.status.should == 200 json_response['title'].should == 'updated title' @@ -67,7 +67,7 @@ describe Gitlab::API do describe "DELETE /projects/:id/issues/:issue_id" do it "should delete a project issue" do - delete api("/projects/#{project.path}/issues/#{issue.id}", user) + delete api("/projects/#{project.id}/issues/#{issue.id}", user) response.status.should == 405 end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 43931aedcda..5da54154a81 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -4,21 +4,21 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user ) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:merge_request) { create(:merge_request, author: user, assignee: user, project: project, title: "Test") } - before { project.add_access(user, :read) } + before { project.team << [user, :reporters] } describe "GET /projects/:id/merge_requests" do context "when unauthenticated" do it "should return authentication error" do - get api("/projects/#{project.path}/merge_requests") + get api("/projects/#{project.id}/merge_requests") response.status.should == 401 end end context "when authenticated" do it "should return an array of merge_requests" do - get api("/projects/#{project.path}/merge_requests", user) + get api("/projects/#{project.id}/merge_requests", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == merge_request.title @@ -28,7 +28,7 @@ describe Gitlab::API do describe "GET /projects/:id/merge_request/:merge_request_id" do it "should return merge_request" do - get api("/projects/#{project.path}/merge_request/#{merge_request.id}", user) + get api("/projects/#{project.id}/merge_request/#{merge_request.id}", user) response.status.should == 200 json_response['title'].should == merge_request.title end @@ -36,7 +36,7 @@ describe Gitlab::API do describe "POST /projects/:id/merge_requests" do it "should return merge_request" do - post api("/projects/#{project.path}/merge_requests", user), + post api("/projects/#{project.id}/merge_requests", user), title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user response.status.should == 201 json_response['title'].should == 'Test merge_request' @@ -45,7 +45,7 @@ describe Gitlab::API do describe "PUT /projects/:id/merge_request/:merge_request_id" do it "should return merge_request" do - put api("/projects/#{project.path}/merge_request/#{merge_request.id}", user), title: "New title" + put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), title: "New title" response.status.should == 200 json_response['title'].should == 'New title' end @@ -53,7 +53,7 @@ describe Gitlab::API do describe "POST /projects/:id/merge_request/:merge_request_id/comments" do it "should return comment" do - post api("/projects/#{project.path}/merge_request/#{merge_request.id}/comments", user), note: "My comment" + post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user), note: "My comment" response.status.should == 201 json_response['note'].should == 'My comment' end diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index dc96d46d894..80696671462 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -4,14 +4,14 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:milestone) { create(:milestone, project: project) } - before { project.add_access(user, :read) } + before { project.team << [user, :developer] } describe "GET /projects/:id/milestones" do it "should return project milestones" do - get api("/projects/#{project.path}/milestones", user) + get api("/projects/#{project.id}/milestones", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == milestone.title @@ -20,7 +20,7 @@ describe Gitlab::API do describe "GET /projects/:id/milestones/:milestone_id" do it "should return a project milestone by id" do - get api("/projects/#{project.path}/milestones/#{milestone.id}", user) + get api("/projects/#{project.id}/milestones/#{milestone.id}", user) response.status.should == 200 json_response['title'].should == milestone.title end @@ -28,7 +28,7 @@ describe Gitlab::API do describe "POST /projects/:id/milestones" do it "should create a new project milestone" do - post api("/projects/#{project.path}/milestones", user), + post api("/projects/#{project.id}/milestones", user), title: 'new milestone' response.status.should == 201 json_response['title'].should == 'new milestone' @@ -38,7 +38,7 @@ describe Gitlab::API do describe "PUT /projects/:id/milestones/:milestone_id" do it "should update a project milestone" do - put api("/projects/#{project.path}/milestones/#{milestone.id}", user), + put api("/projects/#{project.id}/milestones/#{milestone.id}", user), title: 'updated title' response.status.should == 200 json_response['title'].should == 'updated title' diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 681ba01558e..ae4fc111f63 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -4,13 +4,13 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:issue) { create(:issue, project: project, author: user) } let!(:snippet) { create(:snippet, project: project, author: user) } let!(:issue_note) { create(:note, noteable: issue, project: project, author: user) } let!(:snippet_note) { create(:note, noteable: snippet, project: project, author: user) } let!(:wall_note) { create(:note, project: project, author: user) } - before { project.add_access(user, :read) } + before { project.team << [user, :reporter] } describe "GET /projects/:id/notes" do context "when unauthenticated" do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index a396516438d..c2244210bcf 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -7,11 +7,11 @@ describe Gitlab::API do let(:user2) { create(:user) } let(:user3) { create(:user) } let!(:hook) { create(:project_hook, project: project, url: "http://example.com") } - let!(:project) { create(:project, owner: user ) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:snippet) { create(:snippet, author: user, project: project, title: 'example') } let!(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) } let!(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) } - before { project.add_access(user, :read) } + before { project.team << [user, :reporter] } describe "GET /projects" do context "when unauthenticated" do @@ -64,6 +64,7 @@ describe Gitlab::API do post api("/projects", user), project project.each_pair do |k,v| + next if k == :path json_response[k.to_s].should == v end end @@ -78,7 +79,7 @@ describe Gitlab::API do end it "should return a project by path name" do - get api("/projects/#{project.path}", user) + get api("/projects/#{project.id}", user) response.status.should == 200 json_response['name'].should == project.name end @@ -92,7 +93,7 @@ describe Gitlab::API do describe "GET /projects/:id/repository/branches" do it "should return an array of project branches" do - get api("/projects/#{project.path}/repository/branches", user) + get api("/projects/#{project.id}/repository/branches", user) response.status.should == 200 json_response.should be_an Array json_response.first['name'].should == project.repo.heads.sort_by(&:name).first.name @@ -101,7 +102,7 @@ describe Gitlab::API do describe "GET /projects/:id/repository/branches/:branch" do it "should return the branch information for a single branch" do - get api("/projects/#{project.path}/repository/branches/new_design", user) + get api("/projects/#{project.id}/repository/branches/new_design", user) response.status.should == 200 json_response['name'].should == 'new_design' @@ -111,7 +112,7 @@ describe Gitlab::API do describe "GET /projects/:id/members" do it "should return project team members" do - get api("/projects/#{project.path}/members", user) + get api("/projects/#{project.id}/members", user) response.status.should == 200 json_response.should be_an Array json_response.count.should == 2 @@ -119,7 +120,7 @@ describe Gitlab::API do end it "finds team members with query string" do - get api("/projects/#{project.path}/members", user), query: user.username + get api("/projects/#{project.id}/members", user), query: user.username response.status.should == 200 json_response.should be_an Array json_response.count.should == 1 @@ -129,7 +130,7 @@ describe Gitlab::API do describe "GET /projects/:id/members/:user_id" do it "should return project team member" do - get api("/projects/#{project.path}/members/#{user.id}", user) + get api("/projects/#{project.id}/members/#{user.id}", user) response.status.should == 200 json_response['email'].should == user.email json_response['access_level'].should == UsersProject::MASTER @@ -139,7 +140,7 @@ describe Gitlab::API do describe "POST /projects/:id/members" do it "should add user to project team" do expect { - post api("/projects/#{project.path}/members", user), user_id: user2.id, + post api("/projects/#{project.id}/members", user), user_id: user2.id, access_level: UsersProject::DEVELOPER }.to change { UsersProject.count }.by(1) @@ -151,7 +152,7 @@ describe Gitlab::API do describe "PUT /projects/:id/members/:user_id" do it "should update project team member" do - put api("/projects/#{project.path}/members/#{user3.id}", user), access_level: UsersProject::MASTER + put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER response.status.should == 200 json_response['email'].should == user3.email json_response['access_level'].should == UsersProject::MASTER @@ -161,14 +162,14 @@ describe Gitlab::API do describe "DELETE /projects/:id/members/:user_id" do it "should remove user from project team" do expect { - delete api("/projects/#{project.path}/members/#{user3.id}", user) + delete api("/projects/#{project.id}/members/#{user3.id}", user) }.to change { UsersProject.count }.by(-1) end end describe "GET /projects/:id/hooks" do it "should return project hooks" do - get api("/projects/#{project.path}/hooks", user) + get api("/projects/#{project.id}/hooks", user) response.status.should == 200 @@ -180,7 +181,7 @@ describe Gitlab::API do describe "GET /projects/:id/hooks/:hook_id" do it "should return a project hook" do - get api("/projects/#{project.path}/hooks/#{hook.id}", user) + get api("/projects/#{project.id}/hooks/#{hook.id}", user) response.status.should == 200 json_response['url'].should == hook.url end @@ -189,7 +190,7 @@ describe Gitlab::API do describe "POST /projects/:id/hooks" do it "should add hook to project" do expect { - post api("/projects/#{project.path}/hooks", user), + post api("/projects/#{project.id}/hooks", user), "url" => "http://example.com" }.to change {project.hooks.count}.by(1) end @@ -197,7 +198,7 @@ describe Gitlab::API do describe "PUT /projects/:id/hooks/:hook_id" do it "should update an existing project hook" do - put api("/projects/#{project.path}/hooks/#{hook.id}", user), + put api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'http://example.org' response.status.should == 200 json_response['url'].should == 'http://example.org' @@ -208,7 +209,7 @@ describe Gitlab::API do describe "DELETE /projects/:id/hooks" do it "should delete hook from project" do expect { - delete api("/projects/#{project.path}/hooks", user), + delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id }.to change {project.hooks.count}.by(-1) end @@ -216,7 +217,7 @@ describe Gitlab::API do describe "GET /projects/:id/repository/tags" do it "should return an array of project tags" do - get api("/projects/#{project.path}/repository/tags", user) + get api("/projects/#{project.id}/repository/tags", user) response.status.should == 200 json_response.should be_an Array json_response.first['name'].should == project.repo.tags.sort_by(&:name).reverse.first.name @@ -225,20 +226,20 @@ describe Gitlab::API do describe "GET /projects/:id/repository/commits" do context "authorized user" do - before { project.add_access(user2, :read) } + before { project.team << [user2, :reporter] } it "should return project commits" do - get api("/projects/#{project.path}/repository/commits", user) + get api("/projects/#{project.id}/repository/commits", user) response.status.should == 200 json_response.should be_an Array - json_response.first['id'].should == project.commit.id + json_response.first['id'].should == project.repository.commit.id end end context "unauthorized user" do it "should not return project commits" do - get api("/projects/#{project.path}/repository/commits") + get api("/projects/#{project.id}/repository/commits") response.status.should == 401 end end @@ -246,7 +247,7 @@ describe Gitlab::API do describe "GET /projects/:id/snippets" do it "should return an array of project snippets" do - get api("/projects/#{project.path}/snippets", user) + get api("/projects/#{project.id}/snippets", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == snippet.title @@ -255,7 +256,7 @@ describe Gitlab::API do describe "GET /projects/:id/snippets/:snippet_id" do it "should return a project snippet" do - get api("/projects/#{project.path}/snippets/#{snippet.id}", user) + get api("/projects/#{project.id}/snippets/#{snippet.id}", user) response.status.should == 200 json_response['title'].should == snippet.title end @@ -263,7 +264,7 @@ describe Gitlab::API do describe "POST /projects/:id/snippets" do it "should create a new project snippet" do - post api("/projects/#{project.path}/snippets", user), + post api("/projects/#{project.id}/snippets", user), title: 'api test', file_name: 'sample.rb', code: 'test' response.status.should == 201 json_response['title'].should == 'api test' @@ -272,7 +273,7 @@ describe Gitlab::API do describe "PUT /projects/:id/snippets/:shippet_id" do it "should update an existing project snippet" do - put api("/projects/#{project.path}/snippets/#{snippet.id}", user), + put api("/projects/#{project.id}/snippets/#{snippet.id}", user), code: 'updated code' response.status.should == 200 json_response['title'].should == 'example' @@ -283,31 +284,31 @@ describe Gitlab::API do describe "DELETE /projects/:id/snippets/:snippet_id" do it "should delete existing project snippet" do expect { - delete api("/projects/#{project.path}/snippets/#{snippet.id}", user) + delete api("/projects/#{project.id}/snippets/#{snippet.id}", user) }.to change { Snippet.count }.by(-1) end end describe "GET /projects/:id/snippets/:snippet_id/raw" do it "should get a raw project snippet" do - get api("/projects/#{project.path}/snippets/#{snippet.id}/raw", user) + get api("/projects/#{project.id}/snippets/#{snippet.id}/raw", user) response.status.should == 200 end end describe "GET /projects/:id/:sha/blob" do it "should get the raw file contents" do - get api("/projects/#{project.path}/repository/commits/master/blob?filepath=README.md", user) + get api("/projects/#{project.id}/repository/commits/master/blob?filepath=README.md", user) response.status.should == 200 end it "should return 404 for invalid branch_name" do - get api("/projects/#{project.path}/repository/commits/invalid_branch_name/blob?filepath=README.md", user) + get api("/projects/#{project.id}/repository/commits/invalid_branch_name/blob?filepath=README.md", user) response.status.should == 404 end it "should return 404 for invalid file" do - get api("/projects/#{project.path}/repository/commits/master/blob?filepath=README.invalid", user) + get api("/projects/#{project.id}/repository/commits/master/blob?filepath=README.invalid", user) response.status.should == 404 end end diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb index 29f88f3f1c3..0488c1f2266 100644 --- a/spec/requests/atom/issues_spec.rb +++ b/spec/requests/atom/issues_spec.rb @@ -3,10 +3,10 @@ require 'spec_helper' describe "Issues Feed" do describe "GET /issues" do let!(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace) } let!(:issue) { create(:issue, author: user, project: project) } - before { project.add_access(user, :read, :write) } + before { project.team << [user, :developer] } context "when authenticated" do it "should render atom feed" do diff --git a/spec/requests/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb index 7f61c6aaa73..78b8c0c513f 100644 --- a/spec/requests/gitlab_flavored_markdown_spec.rb +++ b/spec/requests/gitlab_flavored_markdown_spec.rb @@ -6,7 +6,7 @@ describe "Gitlab Flavored Markdown" do let(:merge_request) { create(:merge_request, project: project) } let(:fred) do u = create(:user, name: "fred") - project.add_access(u, :admin) + project.team << [u, :master] u end @@ -33,11 +33,11 @@ describe "Gitlab Flavored Markdown" do project.repo.gc_auto end - let(:commit) { project.commits(@branch_name).first } + let(:commit) { project.repository.commits(@branch_name).first } before do login_as :user - project.add_access(@user, :read, :write) + project.team << [@user, :developer] end describe "for commits" do diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 0814108523b..2e94ffd0020 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -7,8 +7,7 @@ describe "Issues" do login_as :user user2 = create(:user) - project.add_access(@user, :read, :write) - project.add_access(user2, :read, :write) + project.team << [[@user, user2], :developer] end describe "Edit issue" do diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb index 35323f556f9..25b1da9ebd8 100644 --- a/spec/requests/projects_deploy_keys_spec.rb +++ b/spec/requests/projects_deploy_keys_spec.rb @@ -5,7 +5,7 @@ describe "Projects", "DeployKeys" do before do login_as :user - project.add_access(@user, :read, :write, :admin) + project.team << [@user, :master] end describe "GET /keys" do diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index e097f0805fc..7bc48260935 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -3,63 +3,10 @@ require 'spec_helper' describe "Projects" do before { login_as :user } - describe "GET /projects/show" do - before do - @project = create(:project, owner: @user) - @project.add_access(@user, :read) - - visit project_path(@project) - end - - it "should be correct path" do - current_path.should == project_path(@project) - end - end - - describe "GET /projects/:id/edit" do - before do - @project = create(:project) - @project.add_access(@user, :admin, :read) - - visit edit_project_path(@project) - end - - it "should be correct path" do - current_path.should == edit_project_path(@project) - end - - it "should have labels for new project" do - page.should have_content("Project name is") - page.should have_content("Advanced settings:") - page.should have_content("Features:") - end - end - - describe "PUT /projects/:id" do - before do - @project = create(:project, owner: @user) - @project.add_access(@user, :admin, :read) - - visit edit_project_path(@project) - - fill_in 'project_name', with: 'Awesome' - click_button "Save" - @project = @project.reload - end - - it "should be correct path" do - current_path.should == edit_project_path(@project) - end - - it "should show project" do - page.should have_content("Awesome") - end - end - describe "DELETE /projects/:id" do before do - @project = create(:project, owner: @user) - @project.add_access(@user, :read, :admin) + @project = create(:project, namespace: @user.namespace) + @project.team << [@user, :master] visit edit_project_path(@project) end diff --git a/spec/requests/search_spec.rb b/spec/requests/search_spec.rb index 17cc0d39946..e338f359f88 100644 --- a/spec/requests/search_spec.rb +++ b/spec/requests/search_spec.rb @@ -4,7 +4,7 @@ describe "Search" do before do login_as :user @project = create(:project) - @project.add_access(@user, :read) + @project.team << [@user, :reporter] visit search_path fill_in "search", with: @project.name[0..3] click_button "Search" diff --git a/spec/requests/security/project_access_spec.rb b/spec/requests/security/project_access_spec.rb index 060a276b740..a35175102ec 100644 --- a/spec/requests/security/project_access_spec.rb +++ b/spec/requests/security/project_access_spec.rb @@ -22,10 +22,10 @@ describe "Application access" do before do # full access - project.users_projects.create(user: master, project_access: UsersProject::MASTER) + project.team << [master, :master] # readonly - project.users_projects.create(user: reporter, project_access: UsersProject::REPORTER) + project.team << [reporter, :reporter] end describe "GET /project_code" do @@ -40,7 +40,7 @@ describe "Application access" do end describe "GET /project_code/tree/master" do - subject { project_tree_path(project, project.root_ref) } + subject { project_tree_path(project, project.repository.root_ref) } it { should be_allowed_for master } it { should be_allowed_for reporter } @@ -51,7 +51,7 @@ describe "Application access" do end describe "GET /project_code/commits/master" do - subject { project_commits_path(project, project.root_ref, limit: 1) } + subject { project_commits_path(project, project.repository.root_ref, limit: 1) } it { should be_allowed_for master } it { should be_allowed_for reporter } @@ -62,7 +62,7 @@ describe "Application access" do end describe "GET /project_code/commit/:sha" do - subject { project_commit_path(project, project.commit) } + subject { project_commit_path(project, project.repository.commit) } it { should be_allowed_for master } it { should be_allowed_for reporter } @@ -107,7 +107,7 @@ describe "Application access" do describe "GET /project_code/blob" do before do - commit = project.commit + commit = project.repository.commit path = commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name @blob_path = project_blob_path(project, File.join(commit.id, path)) end diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb index b231b940a84..770e34dc07c 100644 --- a/spec/requests/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -5,7 +5,7 @@ describe "Snippets" do before do login_as :user - project.add_access(@user, :read, :write) + project.team << [@user, :developer] end describe "GET /snippets" do @@ -26,7 +26,7 @@ describe "Snippets" do before do # admin access to remove snippet @user.users_projects.destroy_all - project.add_access(@user, :read, :write, :admin) + project.team << [@user, :master] visit edit_project_snippet_path(project, @snippet) end diff --git a/spec/roles/account_role_spec.rb b/spec/roles/account_role_spec.rb deleted file mode 100644 index 4b214551453..00000000000 --- a/spec/roles/account_role_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'spec_helper' - -describe User, "Account" do - describe 'normal user' do - let(:user) { create(:user, name: 'John Smith') } - - it { user.is_admin?.should be_false } - it { user.require_ssh_key?.should be_true } - it { user.can_create_group?.should be_false } - it { user.can_create_project?.should be_true } - it { user.first_name.should == 'John' } - end - - describe 'blocking user' do - let(:user) { create(:user, name: 'John Smith') } - - it "should block user" do - user.block - user.blocked.should be_true - end - end - - describe 'projects' do - before do - ActiveRecord::Base.observers.enable(:user_observer) - @user = create :user - @project = create :project, namespace: @user.namespace - end - - it { @user.authorized_projects.should include(@project) } - it { @user.my_own_projects.should include(@project) } - end - - describe 'namespaced' do - before do - ActiveRecord::Base.observers.enable(:user_observer) - @user = create :user - @project = create :project, namespace: @user.namespace - end - - it { @user.several_namespaces?.should be_false } - it { @user.namespaces.should == [@user.namespace] } - end -end diff --git a/spec/roles/repository_spec.rb b/spec/roles/repository_spec.rb deleted file mode 100644 index e1d01cbfeaf..00000000000 --- a/spec/roles/repository_spec.rb +++ /dev/null @@ -1,159 +0,0 @@ -require 'spec_helper' - -describe Project, "Repository" do - let(:project) { create(:project) } - - describe "#empty_repo?" do - it "should return true if the repo doesn't exist" do - project.stub(repo_exists?: false, has_commits?: true) - project.should be_empty_repo - end - - it "should return true if the repo has commits" do - project.stub(repo_exists?: true, has_commits?: false) - project.should be_empty_repo - end - - it "should return false if the repo exists and has commits" do - project.stub(repo_exists?: true, has_commits?: true) - project.should_not be_empty_repo - end - end - - describe "#discover_default_branch" do - let(:master) { 'master' } - let(:stable) { 'stable' } - - it "returns 'master' when master exists" do - project.should_receive(:branch_names).at_least(:once).and_return([stable, master]) - project.discover_default_branch.should == 'master' - end - - it "returns non-master when master exists but default branch is set to something else" do - project.default_branch = 'stable' - project.should_receive(:branch_names).at_least(:once).and_return([stable, master]) - project.discover_default_branch.should == 'stable' - end - - it "returns a non-master branch when only one exists" do - project.should_receive(:branch_names).at_least(:once).and_return([stable]) - project.discover_default_branch.should == 'stable' - end - - it "returns nil when no branch exists" do - project.should_receive(:branch_names).at_least(:once).and_return([]) - project.discover_default_branch.should be_nil - end - end - - describe "#root_ref" do - it "returns default_branch when set" do - project.default_branch = 'stable' - project.root_ref.should == 'stable' - end - - it "returns 'master' when default_branch is nil" do - project.default_branch = nil - project.root_ref.should == 'master' - end - end - - describe "#root_ref?" do - it "returns true when branch is root_ref" do - project.default_branch = 'stable' - project.root_ref?('stable').should be_true - end - - it "returns false when branch is not root_ref" do - project.default_branch = nil - project.root_ref?('stable').should be_false - end - end - - describe :repo do - it "should return valid repo" do - project.repo.should be_kind_of(Grit::Repo) - end - - it "should return nil" do - lambda { Project.new(path: "invalid").repo }.should raise_error(Grit::NoSuchPathError) - end - - it "should return nil" do - lambda { Project.new.repo }.should raise_error(TypeError) - end - end - - describe :commit do - it "should return first head commit if without params" do - project.commit.id.should == project.repo.commits.first.id - end - - it "should return valid commit" do - project.commit(ValidCommit::ID).should be_valid_commit - end - - it "should return nil" do - project.commit("+123_4532530XYZ").should be_nil - end - end - - describe :tree do - before do - @commit = project.commit(ValidCommit::ID) - end - - it "should raise error w/o arguments" do - lambda { project.tree }.should raise_error - end - - it "should return root tree for commit" do - tree = project.tree(@commit) - tree.contents.size.should == ValidCommit::FILES_COUNT - tree.contents.map(&:name).should == ValidCommit::FILES - end - - it "should return root tree for commit with correct path" do - tree = project.tree(@commit, ValidCommit::C_FILE_PATH) - tree.contents.map(&:name).should == ValidCommit::C_FILES - end - - it "should return root tree for commit with incorrect path" do - project.tree(@commit, "invalid_path").should be_nil - end - end - - describe "fresh commits" do - let(:project) { create(:project) } - - it { project.fresh_commits(3).count.should == 3 } - it { project.fresh_commits.first.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" } - it { project.fresh_commits.last.id.should == "f403da73f5e62794a0447aca879360494b08f678" } - end - - describe "commits_between" do - let(:project) { create(:project) } - - subject do - commits = project.commits_between("3a4b4fb4cde7809f033822a171b9feae19d41fff", - "8470d70da67355c9c009e4401746b1d5410af2e3") - commits.map { |c| c.id } - end - - it { should have(3).elements } - it { should include("f0f14c8eaba69ebddd766498a9d0b0e79becd633") } - it { should_not include("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } - end - - describe :valid_repo? do - it "should be valid repo" do - project = create(:project) - project.valid_repo?.should be_true - end - - it "should be invalid repo" do - project = Project.new(name: "ok_name", path: "/INVALID_PATH/", path: "NEOK") - project.valid_repo?.should be_false - end - end -end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 09e11588164..6171141648c 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -191,17 +191,17 @@ describe ProtectedBranchesController, "routing" do end end -# switch_project_refs GET /:project_id/switch(.:format) refs#switch -# logs_tree_project_ref GET /:project_id/:id/logs_tree(.:format) refs#logs_tree -# logs_file_project_ref GET /:project_id/:id/logs_tree/:path(.:format) refs#logs_tree +# switch_project_refs GET /:project_id/refs/switch(.:format) refs#switch +# logs_tree_project_ref GET /:project_id/refs/:id/logs_tree(.:format) refs#logs_tree +# logs_file_project_ref GET /:project_id/refs/:id/logs_tree/:path(.:format) refs#logs_tree describe RefsController, "routing" do it "to #switch" do - get("/gitlabhq/switch").should route_to('refs#switch', project_id: 'gitlabhq') + get("/gitlabhq/refs/switch").should route_to('refs#switch', project_id: 'gitlabhq') end it "to #logs_tree" do - get("/gitlabhq/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') - get("/gitlabhq/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') + get("/gitlabhq/refs/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') + get("/gitlabhq/refs/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9f066c0e7f3..dbac3c54901 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,5 @@ -unless ENV['CI'] - require 'simplecov' - SimpleCov.start 'rails' -end +require 'simplecov' unless ENV['CI'] + # This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' @@ -11,6 +9,7 @@ require 'capybara/rails' require 'capybara/rspec' require 'webmock/rspec' require 'email_spec' +require 'sidekiq/testing/inline' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -37,13 +36,10 @@ RSpec.configure do |config| config.before do stub_gitolite! - # !!! Observers disabled by default in tests - ActiveRecord::Base.observers.disable(:all) - # ActiveRecord::Base.observers.enable(:all) - # Use tmp dir for FS manipulations - Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path')) - FileUtils.rm_rf Gitlab.config.gitolite.repos_path - FileUtils.mkdir_p Gitlab.config.gitolite.repos_path + temp_repos_path = Rails.root.join('tmp', 'test-git-base-path') + Gitlab.config.gitolite.stub(repos_path: temp_repos_path) + FileUtils.rm_rf temp_repos_path + FileUtils.mkdir_p temp_repos_path end end diff --git a/spec/support/stubbed_repository.rb b/spec/support/stubbed_repository.rb index 5bf3ea46099..e6e194d70f5 100644 --- a/spec/support/stubbed_repository.rb +++ b/spec/support/stubbed_repository.rb @@ -1,15 +1,14 @@ +require "repository" +require "project" + # Stubs out all Git repository access done by models so that specs can run # against fake repositories without Grit complaining that they don't exist. -module StubbedRepository - def path_to_repo - if new_record? || path == 'newproject' - # There are a couple Project specs and features that expect the Project's - # path to be in the returned path, so let's patronize them. - Rails.root.join('tmp', 'repositories', path) +class Project + def repository + if path == "empty" || !path + nil else - # For everything else, just give it the path to one of our real seeded - # repos. - Rails.root.join('tmp', 'repositories', 'gitlabhq') + GitLabTestRepo.new(path_with_namespace) end end @@ -28,4 +27,8 @@ module StubbedRepository end end -Project.send(:include, StubbedRepository) +class GitLabTestRepo < Repository + def repo + @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq')) + end +end diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb index b17521e0148..babbf2916f8 100644 --- a/spec/tasks/gitlab/backup_rake_spec.rb +++ b/spec/tasks/gitlab/backup_rake_spec.rb @@ -3,6 +3,7 @@ require 'rake' describe 'gitlab:app namespace rake task' do before :all do + Rake.application.rake_require "tasks/gitlab/task_helpers" Rake.application.rake_require "tasks/gitlab/backup" # empty task as env is already loaded Rake::Task.define_task :environment diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 26b461c3825..f408c89afdd 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -4,7 +4,7 @@ describe PostReceive do context "as a resque worker" do it "reponds to #perform" do - PostReceive.should respond_to(:perform) + PostReceive.new.should respond_to(:perform) end end @@ -15,7 +15,7 @@ describe PostReceive do it "fetches the correct project" do Project.should_receive(:find_with_namespace).with(project.path_with_namespace).and_return(project) - PostReceive.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) + PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) end it "does not run if the author is not in the project" do @@ -24,7 +24,7 @@ describe PostReceive do project.should_not_receive(:observe_push) project.should_not_receive(:execute_hooks) - PostReceive.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false + PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false end it "asks the project to trigger all hooks" do @@ -34,7 +34,7 @@ describe PostReceive do project.should_receive(:update_merge_requests) project.should_receive(:observe_push) - PostReceive.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) + PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) end end diff --git a/vendor/assets/javascripts/branch-graph.js b/vendor/assets/javascripts/branch-graph.js index a7e1e152bd2..805423bc70d 100644 --- a/vendor/assets/javascripts/branch-graph.js +++ b/vendor/assets/javascripts/branch-graph.js @@ -57,7 +57,9 @@ BranchGraph.prototype.collectColors = function(){ for (var k = 0; k < this.mspace; k++) { - this.colors.push(Raphael.getColor()); + this.colors.push(Raphael.getColor(.8)); + // Skipping a few colors in the spectrum to get more contrast between colors + Raphael.getColor();Raphael.getColor(); } }; @@ -83,7 +85,7 @@ if(cuday != this.days[mm][0]){ // Dates r.text(offsetX + mm * 20, 31, this.days[mm][0]).attr({ - font: "12px Monaco, Arial", + font: "12px Monaco, monospace", fill: "#DDD" }); cuday = this.days[mm][0]; @@ -91,7 +93,7 @@ if(cumonth != this.days[mm][1]){ // Months r.text(offsetX + mm * 20, 11, this.days[mm][1]).attr({ - font: "12px Monaco, Arial", + font: "12px Monaco, monospace", fill: "#EEE" }); cumonth = this.days[mm][1]; @@ -101,29 +103,16 @@ for (i = 0; i < this.commitCount; i++) { var x = offsetX + 20 * this.commits[i].time - , y = offsetY + 20 * this.commits[i].space; + , y = offsetY + 20 * this.commits[i].space + , c; + + // Draw dot r.circle(x, y, 3).attr({ fill: this.colors[this.commits[i].space], stroke: "none" }); - if (this.commits[i].refs != null && this.commits[i].refs != "") { - var longrefs = this.commits[i].refs - , shortrefs = this.commits[i].refs; - if (shortrefs.length > 15){ - shortrefs = shortrefs.substr(0,13) + "..."; - } - var t = r.text(x+5, y+8, shortrefs).attr({ - font: "12px Monaco, Arial", - fill: "#666", - title: longrefs, - cursor: "pointer", - rotation: "90" - }); - - var textbox = t.getBBox(); - t.translate(textbox.height/-4, textbox.width/2); - } - var c; + + // Draw lines for (var j = 0, jj = this.commits[i].parents.length; j < jj; j++) { c = this.preparedCommits[this.commits[i].parents[j][0]]; if (c) { @@ -153,6 +142,11 @@ } } } + + if (this.commits[i].refs) { + this.appendLabel(x, y, this.commits[i].refs); + } + this.appendAnchor(top, this.commits[i], x, y); } top.toFront(); @@ -206,7 +200,57 @@ }); }; - BranchGraph.prototype.appendAnchor = function(top, c, x, y) { + BranchGraph.prototype.appendLabel = function(x, y, refs){ + var r = this.raphael + , shortrefs = refs + , text, textbox, rect; + + if (shortrefs.length > 17){ + // Truncate if longer than 15 chars + shortrefs = shortrefs.substr(0,15) + "…"; + } + + text = r.text(x+5, y+8 + 10, shortrefs).attr({ + font: "10px Monaco, monospace", + fill: "#FFF", + title: refs + }); + + textbox = text.getBBox(); + text.transform([ + 't', textbox.height/-4, textbox.width/2 + 5, + 'r90' + ]); + + // Create rectangle based on the size of the textbox + rect = r.rect(x, y, textbox.width + 15, textbox.height + 5, 4).attr({ + "fill": "#000", + "fill-opacity": .7, + "stroke": "none" + }); + + triangle = r.path([ + 'M', x, y + 5, + 'L', x + 4, y + 15, + 'L', x - 4, y + 15, + 'Z' + ]).attr({ + "fill": "#000", + "fill-opacity": .7, + "stroke": "none" + }); + + // Rotate and reposition rectangle over text + rect.transform([ + 'r', 90, x, y, + 't', 15, -9 + ]); + + // Set text to front + text.toFront(); + }; + + BranchGraph.prototype.appendAnchor = function(top, commit, x, y) { var r = this.raphael , options = this.options , anchor; @@ -216,16 +260,13 @@ cursor: "pointer" }) .click(function(){ - window.location = options.commit_url.replace('%s', c.id); + window.location = options.commit_url.replace('%s', commit.id); }) .hover(function(){ - var text = r.text(100, 100, c.author + "\n \n" + c.id + "\n \n" + c.message).attr({ - fill: "#fff" - }); - this.popup = r.tooltip(x, y + 5, text, 0); - top.push(this.popup.insertBefore(this)); + this.tooltip = r.commitTooltip(x, y + 5, commit); + top.push(this.tooltip.insertBefore(this)); }, function(){ - this.popup && this.popup.remove() && delete this.popup; + this.tooltip && this.tooltip.remove() && delete this.tooltip; }); top.push(anchor); }; @@ -233,23 +274,81 @@ this.BranchGraph = BranchGraph; }(this); -Raphael.fn.tooltip = function (x, y, set, dir, size) { - dir = dir == null ? 2 : dir; - size = size || 5; - x = Math.round(x); - y = Math.round(y); - var mmax = Math.max - , bb = set.getBBox() - , w = Math.round(bb.width / 2) - , h = Math.round(bb.height / 2) - , dx = [0, w + size * 2, 0, -w - size * 2] - , dy = [-h * 2 - size * 3, -h - size, 0, -h - size] - , p = ["M", x - dx[dir], y - dy[dir], "l", -size, (dir == 2) * -size, -mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, -size, -size, - "l", 0, -mmax(h - size, 0), (dir == 3) * -size, -size, (dir == 3) * size, -size, 0, -mmax(h - size, 0), "a", size, size, 0, 0, 1, size, -size, - "l", mmax(w - size, 0), 0, size, !dir * -size, size, !dir * size, mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, size, size, - "l", 0, mmax(h - size, 0), (dir == 1) * size, size, (dir == 1) * -size, size, 0, mmax(h - size, 0), "a", size, size, 0, 0, 1, -size, size, - "l", -mmax(w - size, 0), 0, "z"].join(",") - , xy = [{x: x, y: y + size * 2 + h}, {x: x - size * 2 - w, y: y}, {x: x, y: y - size * 2 - h}, {x: x + size * 2 + w, y: y}][dir]; - set.translate(xy.x - w - bb.x, xy.y - h - bb.y); - return this.set(this.path(p).attr({fill: "#234", stroke: "none"}).insertBefore(set.node ? set : set[0]), set); +Raphael.fn.commitTooltip = function(x, y, commit){ + var nameText, idText, messageText + , boxWidth = 300 + , boxHeight = 200; + + nameText = this.text(x, y + 10, commit.author.name); + idText = this.text(x, y + 35, commit.id); + messageText = this.text(x, y + 50, commit.message); + + textSet = this.set(nameText, idText, messageText).attr({ + "text-anchor": "start", + "font": "12px Monaco, monospace" + }); + + nameText.attr({ + "font": "14px Arial", + "font-weight": "bold" + }); + + idText.attr({ + "fill": "#AAA" + }); + + textWrap(messageText, boxWidth - 50); + + var rect = this.rect(x - 10, y - 10, boxWidth, 100, 4).attr({ + "fill": "#FFF", + "stroke": "#000", + "stroke-linecap": "round", + "stroke-width": 2 + }); + var tooltip = this.set(rect, textSet); + + rect.attr({ + "height" : tooltip.getBBox().height + 10, + "width" : tooltip.getBBox().width + 10 + }); + + tooltip.transform([ + 't', 20, 20 + ]); + + return tooltip; }; + +function textWrap(t, width) { + var content = t.attr("text"); + var abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + t.attr({ + "text" : abc + }); + var letterWidth = t.getBBox().width / abc.length; + + t.attr({ + "text" : content + }); + + var words = content.split(" "); + var x = 0, s = []; + for ( var i = 0; i < words.length; i++) { + + var l = words[i].length; + if (x + (l * letterWidth) > width) { + s.push("\n"); + x = 0; + } + x += l * letterWidth; + s.push(words[i] + " "); + } + t.attr({ + "text" : s.join("") + }); + var b = t.getBBox() + , h = Math.abs(b.y2) - Math.abs(b.y) + 1; + t.attr({ + "y": b.y + h + }); +} \ No newline at end of file diff --git a/vendor/assets/javascripts/g.bar-min.js b/vendor/assets/javascripts/g.bar-min.js index 42f452af350..7620dabda74 100644 --- a/vendor/assets/javascripts/g.bar-min.js +++ b/vendor/assets/javascripts/g.bar-min.js @@ -3,5 +3,6 @@ * * Copyright (c) 2009 Dmitry Baranovskiy (http://g.raphaeljs.com) * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. + * From: https://github.com/jhurt/g.raphael/blob/master/g.bar.js */ -(function(){var f=Math.min,a=Math.max;function e(o,m,h,p,j,k,l,i){var s,n={round:"round",sharp:"sharp",soft:"soft",square:"square"};if((j&&!p)||(!j&&!h)){return l?"":i.path()}k=n[k]||"square";p=Math.round(p);h=Math.round(h);o=Math.round(o);m=Math.round(m);switch(k){case"round":if(!j){var g=~~(p/2);if(hf?(m=f,k=["M",c-~~(e/2),d,"l",0,0,"a",~~(e/2),m,0,0,1,e,0,"l",0,0,"z"]):k=["M",c-m,d,"l",0,m-f,"a",m,m,0,1,1,e,0,"l",0,f-m,"z"];else{var m=~~(f/2);m>e?(m=e,k=["M",c+.5,d+.5-~~(f/2),"l",0,0,"a",m,~~(f/2),0,0,1,0,f,"l",0,0,"z"]):k=["M",c+.5,d+.5-m,"l",e-m,0,"a",m,m,0,1,1,0,f,"l",m-e,0,"z"]}break;case"sharp":if(g)n=~~(e/2),k=["M",c+n,d,"l",-e,0,0,-b(f-n,0),n,-a(n,f),n,a(n,f),n,"z"];else{var n=~~(f/2);k=["M",c,d+n,"l",0,-f,b(e-n,0),0,a(n,e),n,-a(n,e),n+(f>2*n),"z"]}break;case"square":k=g?["M",c+~~(e/2),d,"l",1-e,0,0,-f,e-1,0,"z"]:["M",c,d+~~(f/2),"l",0,-f,e,0,0,f,"z"];break;case"soft":g?(m=a(Math.round(e/5),f),k=["M",c-~~(e/2),d,"l",0,m-f,"a",m,m,0,0,1,m,-m,"l",e-2*m,0,"a",m,m,0,0,1,m,m,"l",0,f-m,"z"]):(m=a(e,Math.round(f/5)),k=["M",c+.5,d+.5-~~(f/2),"l",e-m,0,"a",m,m,0,0,1,m,m,"l",0,f-2*m,"a",m,m,0,0,1,-m,m,"l",m-e,0,"z"])}return i?k.join(","):j.path(k)}function d(a,b,d,e,f,g,h){h=h||{};var i=this,j=h.type||"square",k=parseFloat(h.gutter||"20%"),l=a.set(),m=a.set(),n=a.set(),o=a.set(),p=Math.max.apply(Math,g),q=[],r=0,s=h.colors||i.colors,t=g.length;if(Raphael.is(g[0],"array")){p=[],r=t,t=0;for(var u=g.length;u--;)m.push(a.set()),p.push(Math.max.apply(Math,g[u])),t=Math.max(t,g[u].length);if(h.stacked)for(var u=t;u--;){for(var v=0,w=g.length;w--;)v+=+g[w][u]||0;q.push(v)}for(var u=g.length;u--;)if(t>g[u].length)for(var w=t;w--;)g[u].push(0);p=Math.max.apply(Math,h.stacked?q:p)}p=h.to||p;var x=100*(e/(t*(100+k)+k)),y=x*k/100,z=null==h.vgutter?20:h.vgutter,A=[],B=b+y,C=(f-2*z)/p;h.stretch||(y=Math.round(y),x=Math.floor(x)),!h.stacked&&(x/=r||1);for(var u=0;t>u;u++){A=[];for(var w=0;(r||1)>w;w++){var D=Math.round((r?g[w][u]:g[u])*C),E=d+f-z-D,F=c(Math.round(B+x/2),E+D,x,D,!0,j,null,a).attr({stroke:"none",fill:s[r?w:u]});r?m[w].push(F):m.push(F),F.y=E,F.x=Math.round(B+x/2),F.w=x,F.h=D,F.value=r?g[w][u]:g[u],h.stacked?A.push(F):B+=x}if(h.stacked){var G;o.push(G=a.rect(A[0].x-A[0].w/2,d,x,f).attr(i.shim)),G.bars=a.set();for(var H=0,I=A.length;I--;)A[I].toFront();for(var I=0,J=A.length;J>I;I++){var K,F=A[I],D=(H+F.value)*C,L=c(F.x,d+f-z-.5*!!H,x,D,!0,j,1,a);G.bars.push(F),H&&F.attr({path:L}),F.h=D,F.y=d+f-z-.5*!!H-D,n.push(K=a.rect(F.x-F.w/2,F.y,x,F.value*C).attr(i.shim)),K.bar=F,K.value=F.value,H+=F.value}B+=x}B+=y}if(o.toFront(),B=b+y,!h.stacked)for(var u=0;t>u;u++){for(var w=0;(r||1)>w;w++){var K;n.push(K=a.rect(Math.round(B),d+z,x,f-z).attr(i.shim)),K.bar=r?m[w][u]:m[u],K.value=K.bar.value,B+=x}B+=y}return l.label=function(b,c){b=b||[],this.labels=a.set();var e,j=-1/0;if(h.stacked){for(var k=0;t>k;k++)for(var l=0,o=0;(r||1)>o;o++)if(l+=r?g[o][k]:g[k],o==r-1){var q=i.labelise(b[k],l,p);e=a.text(m[o][k].x,d+f-z/2,q).attr(i.txtattr).attr({fill:h.legendcolor||"#000","text-anchor":"start"}).insertBefore(n[k*(r||1)+o]);var s=e.getBBox();j>s.x-7?e.remove():(this.labels.push(e),j=s.x+s.width)}}else for(var k=0;t>k;k++)for(var o=0;(r||1)>o;o++){var q=i.labelise(r?b[o]&&b[o][k]:b[k],r?g[o][k]:g[k],p);e=a.text(m[o][k].x-x/2,c?d+f-z/2:m[o][k].y-10,q).attr(i.txtattr).attr({fill:h.legendcolor||"#000","text-anchor":"start"}).insertBefore(n[k*(r||1)+o]);var s=e.getBBox();e.translate((x-s.width)/2,1),j>s.x-7?e.remove():(this.labels.push(e),j=s.x+s.width)}return this},l.hover=function(a,b){return o.hide(),n.show(),n.mouseover(a).mouseout(b),this},l.hoverColumn=function(a,b){return n.hide(),o.show(),b=b||function(){},o.mouseover(a).mouseout(b),this},l.click=function(a){return o.hide(),n.show(),n.click(a),this},l.each=function(a){if(!Raphael.is(a,"function"))return this;for(var b=n.length;b--;)a.call(n[b]);return this},l.eachColumn=function(a){if(!Raphael.is(a,"function"))return this;for(var b=o.length;b--;)a.call(o[b]);return this},l.clickColumn=function(a){return n.hide(),o.show(),o.click(a),this},l.push(m,n,o),l.bars=m,l.covers=n,l}function e(a,b,d,e,f,g,h){h=h||{};var i=this,j=h.type||"square",k=parseFloat(h.gutter||"20%"),l=a.set(),m=a.set(),n=a.set(),o=a.set(),p=Math.max.apply(Math,g),q=[],r=0,s=h.colors||i.colors,t=g.length;if(Raphael.is(g[0],"array")){p=[],r=t,t=0;for(var u=g.length;u--;)m.push(a.set()),p.push(Math.max.apply(Math,g[u])),t=Math.max(t,g[u].length);if(h.stacked)for(var u=t;u--;){for(var v=0,w=g.length;w--;)v+=+g[w][u]||0;q.push(v)}for(var u=g.length;u--;)if(t>g[u].length)for(var w=t;w--;)g[u].push(0);p=Math.max.apply(Math,h.stacked?q:p)}p=h.to||p;var x=Math.floor(100*(f/(t*(100+k)+k))),y=Math.floor(x*k/100),z=[],A=d+y,B=(e-1)/p;!h.stacked&&(x/=r||1);for(var u=0;t>u;u++){z=[];for(var w=0;(r||1)>w;w++){var C=r?g[w][u]:g[u],D=c(b,A+x/2,Math.round(C*B),x-1,!1,j,null,a).attr({stroke:"none",fill:s[r?w:u]});r?m[w].push(D):m.push(D),D.x=b+Math.round(C*B),D.y=A+x/2,D.w=Math.round(C*B),D.h=x,D.value=+C,h.stacked?z.push(D):A+=x}if(h.stacked){var E=a.rect(b,z[0].y-z[0].h/2,e,x).attr(i.shim);o.push(E),E.bars=a.set();for(var F=0,G=z.length;G--;)z[G].toFront();for(var G=0,H=z.length;H>G;G++){var I,D=z[G],C=Math.round((F+D.value)*B),J=c(b,D.y,C,x-1,!1,j,1,a);E.bars.push(D),F&&D.attr({path:J}),D.w=C,D.x=b+C,n.push(I=a.rect(b+F*B,D.y-D.h/2,D.value*B,x).attr(i.shim)),I.bar=D,F+=D.value}A+=x}A+=y}if(o.toFront(),A=d+y,!h.stacked)for(var u=0;t>u;u++){for(var w=0;(r||1)>w;w++){var I=a.rect(b,A,e,x).attr(i.shim);n.push(I),I.bar=r?m[w][u]:m[u],I.value=I.bar.value,A+=x}A+=y}return l.label=function(c,d){c=c||[],this.labels=a.set();for(var e=0;t>e;e++)for(var f=0;r>f;f++){var o,j=i.labelise(r?c[f]&&c[f][e]:c[e],r?g[f][e]:g[e],p),k=d?m[f][e].x-x/2+3:b+5;this.labels.push(o=a.text(k,m[f][e].y,j).attr(i.txtattr).attr({fill:h.legendcolor||"#000","text-anchor":"start"}).insertBefore(n[0])),b+5>o.getBBox().x?o.attr({x:b+5,"text-anchor":"start"}):m[f][e].label=o}return this},l.hover=function(a,b){return o.hide(),n.show(),b=b||function(){},n.mouseover(a).mouseout(b),this},l.hoverColumn=function(a,b){return n.hide(),o.show(),b=b||function(){},o.mouseover(a).mouseout(b),this},l.each=function(a){if(!Raphael.is(a,"function"))return this;for(var b=n.length;b--;)a.call(n[b]);return this},l.eachColumn=function(a){if(!Raphael.is(a,"function"))return this;for(var b=o.length;b--;)a.call(o[b]);return this},l.click=function(a){return o.hide(),n.show(),n.click(a),this},l.clickColumn=function(a){return n.hide(),o.show(),o.click(a),this},l.push(m,n,o),l.bars=m,l.covers=n,l}var a=Math.min,b=Math.max,f=function(){};f.prototype=Raphael.g,e.prototype=d.prototype=new f,Raphael.fn.hbarchart=function(a,b,c,d,f,g){return new e(this,a,b,c,d,f,g)},Raphael.fn.barchart=function(a,b,c,e,f,g){return new d(this,a,b,c,e,f,g)}})(); \ No newline at end of file diff --git a/vendor/assets/javascripts/g.raphael-min.js b/vendor/assets/javascripts/g.raphael-min.js index 932904f9acf..f8b381c623b 100644 --- a/vendor/assets/javascripts/g.raphael-min.js +++ b/vendor/assets/javascripts/g.raphael-min.js @@ -4,25 +4,4 @@ * Copyright (c) 2009-2012 Dmitry Baranovskiy (http://g.raphaeljs.com) * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. */ -Raphael.el.popup=function(d,a,b,f){var e=this.paper||this[0].paper,c,g,i,h;if(e){switch(this.type){case "text":case "circle":case "ellipse":g=!0;break;default:g=!1}d=null==d?"up":d;a=a||5;c=this.getBBox();b="number"==typeof b?b:g?c.x+c.width/2:c.x;f="number"==typeof f?f:g?c.y+c.height/2:c.y;i=Math.max(c.width/2-a,0);h=Math.max(c.height/2-a,0);this.translate(b-c.x-(g?c.width/2:0),f-c.y-(g?c.height/2:0));c=this.getBBox();b={up:["M",b,f,"l",-a,-a,-i,0,"a",a,a,0,0,1,-a,-a,"l",0,-c.height,"a",a,a,0,0, -1,a,-a,"l",2*a+2*i,0,"a",a,a,0,0,1,a,a,"l",0,c.height,"a",a,a,0,0,1,-a,a,"l",-i,0,"z"].join(),down:["M",b,f,"l",a,a,i,0,"a",a,a,0,0,1,a,a,"l",0,c.height,"a",a,a,0,0,1,-a,a,"l",-(2*a+2*i),0,"a",a,a,0,0,1,-a,-a,"l",0,-c.height,"a",a,a,0,0,1,a,-a,"l",i,0,"z"].join(),left:["M",b,f,"l",-a,a,0,h,"a",a,a,0,0,1,-a,a,"l",-c.width,0,"a",a,a,0,0,1,-a,-a,"l",0,-(2*a+2*h),"a",a,a,0,0,1,a,-a,"l",c.width,0,"a",a,a,0,0,1,a,a,"l",0,h,"z"].join(),right:["M",b,f,"l",a,-a,0,-h,"a",a,a,0,0,1,a,-a,"l",c.width,0,"a",a, -a,0,0,1,a,a,"l",0,2*a+2*h,"a",a,a,0,0,1,-a,a,"l",-c.width,0,"a",a,a,0,0,1,-a,-a,"l",0,-h,"z"].join()};a={up:{x:-!g*(c.width/2),y:2*-a-(g?c.height/2:c.height)},down:{x:-!g*(c.width/2),y:2*a+(g?c.height/2:c.height)},left:{x:2*-a-(g?c.width/2:c.width),y:-!g*(c.height/2)},right:{x:2*a+(g?c.width/2:c.width),y:-!g*(c.height/2)}}[d];this.translate(a.x,a.y);return e.path(b[d]).attr({fill:"#000",stroke:"none"}).insertBefore(this.node?this:this[0])}}; -Raphael.el.tag=function(d,a,b,f){var e=this.paper||this[0].paper;if(e){var e=e.path().attr({fill:"#000",stroke:"#000"}),c=this.getBBox(),g,i,h;switch(this.type){case "text":case "circle":case "ellipse":h=!0;break;default:h=!1}d=d||0;b="number"==typeof b?b:h?c.x+c.width/2:c.x;f="number"==typeof f?f:h?c.y+c.height/2:c.y;a=null==a?5:a;i=0.5522*a;c.height>=2*a?e.attr({path:["M",b,f+a,"a",a,a,0,1,1,0,2*-a,a,a,0,1,1,0,2*a,"m",0,2*-a-3,"a",a+3,a+3,0,1,0,0,2*(a+3),"L",b+a+3,f+c.height/2+3,"l",c.width+6,0, -0,-c.height-6,-c.width-6,0,"L",b,f-a-3].join()}):(g=Math.sqrt(Math.pow(a+3,2)-Math.pow(c.height/2+3,2)),e.attr({path:["M",b,f+a,"c",-i,0,-a,i-a,-a,-a,0,-i,a-i,-a,a,-a,i,0,a,a-i,a,a,0,i,i-a,a,-a,a,"M",b+g,f-c.height/2-3,"a",a+3,a+3,0,1,0,0,c.height+6,"l",a+3-g+c.width+6,0,0,-c.height-6,"L",b+g,f-c.height/2-3].join()}));d=360-d;e.rotate(d,b,f);this.attrs?(this.attr(this.attrs.x?"x":"cx",b+a+3+(!h?"text"==this.type?c.width:0:c.width/2)).attr("y",h?f:f-c.height/2),this.rotate(d,b,f),90d&&this.attr(this.attrs.x? -"x":"cx",b-a-3-(!h?c.width:c.width/2)).rotate(180,b,f)):90d?(this.translate(b-c.x-c.width-a-3,f-c.y-c.height/2),this.rotate(d-180,c.x+c.width+a+3,c.y+c.height/2)):(this.translate(b-c.x+a+3,f-c.y-c.height/2),this.rotate(d,c.x-a-3,c.y+c.height/2));return e.insertBefore(this.node?this:this[0])}}; -Raphael.el.drop=function(d,a,b){var f=this.getBBox(),e=this.paper||this[0].paper,c,g;if(e){switch(this.type){case "text":case "circle":case "ellipse":c=!0;break;default:c=!1}d=d||0;a="number"==typeof a?a:c?f.x+f.width/2:f.x;b="number"==typeof b?b:c?f.y+f.height/2:f.y;g=Math.max(f.width,f.height)+Math.min(f.width,f.height);e=e.path(["M",a,b,"l",g,0,"A",0.4*g,0.4*g,0,1,0,a+0.7*g,b-0.7*g,"z"]).attr({fill:"#000",stroke:"none"}).rotate(22.5-d,a,b);d=(d+90)*Math.PI/180;a=a+g*Math.sin(d)-(c?0:f.width/2); -d=b+g*Math.cos(d)-(c?0:f.height/2);this.attrs?this.attr(this.attrs.x?"x":"cx",a).attr(this.attrs.y?"y":"cy",d):this.translate(a-f.x,d-f.y);return e.insertBefore(this.node?this:this[0])}}; -Raphael.el.flag=function(d,a,b){var f=this.paper||this[0].paper;if(f){var f=f.path().attr({fill:"#000",stroke:"#000"}),e=this.getBBox(),c=e.height/2,g;switch(this.type){case "text":case "circle":case "ellipse":g=!0;break;default:g=!1}d=d||0;a="number"==typeof a?a:g?e.x+e.width/2:e.x;b="number"==typeof b?b:g?e.y+e.height/2:e.y;f.attr({path:["M",a,b,"l",c+3,-c-3,e.width+6,0,0,e.height+6,-e.width-6,0,"z"].join()});d=360-d;f.rotate(d,a,b);this.attrs?(this.attr(this.attrs.x?"x":"cx",a+c+3+(!g?"text"== -this.type?e.width:0:e.width/2)).attr("y",g?b:b-e.height/2),this.rotate(d,a,b),90d&&this.attr(this.attrs.x?"x":"cx",a-c-3-(!g?e.width:e.width/2)).rotate(180,a,b)):90d?(this.translate(a-e.x-e.width-c-3,b-e.y-e.height/2),this.rotate(d-180,e.x+e.width+c+3,e.y+e.height/2)):(this.translate(a-e.x+c+3,b-e.y-e.height/2),this.rotate(d,e.x-c-3,e.y+e.height/2));return f.insertBefore(this.node?this:this[0])}}; -Raphael.el.label=function(){var d=this.getBBox(),a=this.paper||this[0].paper,b=Math.min(20,d.width+10,d.height+10)/2;if(a)return a.rect(d.x-b/2,d.y-b/2,d.width+b,d.height+b,b).attr({stroke:"none",fill:"#000"}).insertBefore(this.node?this:this[0])}; -Raphael.el.blob=function(d,a,b){var f=this.getBBox(),e=Math.PI/180,c=this.paper||this[0].paper,g,i;if(c){switch(this.type){case "text":case "circle":case "ellipse":g=!0;break;default:g=!1}c=c.path().attr({fill:"#000",stroke:"none"});d=(+d+1?d:45)+90;i=Math.min(f.height,f.width);var a="number"==typeof a?a:g?f.x+f.width/2:f.x,b="number"==typeof b?b:g?f.y+f.height/2:f.y,h=Math.max(f.width+i,25*i/12),j=Math.max(f.height+i,25*i/12);g=a+i*Math.sin((d-22.5)*e);var o=b+i*Math.cos((d-22.5)*e),l=a+i*Math.sin((d+ -22.5)*e),d=b+i*Math.cos((d+22.5)*e),e=(l-g)/2;i=(d-o)/2;var h=h/2,j=j/2,n=-Math.sqrt(Math.abs(h*h*j*j-h*h*i*i-j*j*e*e)/(h*h*i*i+j*j*e*e));i=n*h*i/j+(l+g)/2;e=n*-j*e/h+(d+o)/2;c.attr({x:i,y:e,path:["M",a,b,"L",l,d,"A",h,j,0,1,1,g,o,"z"].join()});this.translate(i-f.x-f.width/2,e-f.y-f.height/2);return c.insertBefore(this.node?this:this[0])}};Raphael.fn.label=function(d,a,b){var f=this.set(),b=this.text(d,a,b).attr(Raphael.g.txtattr);return f.push(b.label(),b)}; -Raphael.fn.popup=function(d,a,b,f,e){var c=this.set(),b=this.text(d,a,b).attr(Raphael.g.txtattr);return c.push(b.popup(f,e),b)};Raphael.fn.tag=function(d,a,b,f,e){var c=this.set(),b=this.text(d,a,b).attr(Raphael.g.txtattr);return c.push(b.tag(f,e),b)};Raphael.fn.flag=function(d,a,b,f){var e=this.set(),b=this.text(d,a,b).attr(Raphael.g.txtattr);return e.push(b.flag(f),b)};Raphael.fn.drop=function(d,a,b,f){var e=this.set(),b=this.text(d,a,b).attr(Raphael.g.txtattr);return e.push(b.drop(f),b)}; -Raphael.fn.blob=function(d,a,b,f){var e=this.set(),b=this.text(d,a,b).attr(Raphael.g.txtattr);return e.push(b.blob(f),b)};Raphael.el.lighter=function(d){var d=d||2,a=[this.attrs.fill,this.attrs.stroke];this.fs=this.fs||[a[0],a[1]];a[0]=Raphael.rgb2hsb(Raphael.getRGB(a[0]).hex);a[1]=Raphael.rgb2hsb(Raphael.getRGB(a[1]).hex);a[0].b=Math.min(a[0].b*d,1);a[0].s/=d;a[1].b=Math.min(a[1].b*d,1);a[1].s/=d;this.attr({fill:"hsb("+[a[0].h,a[0].s,a[0].b]+")",stroke:"hsb("+[a[1].h,a[1].s,a[1].b]+")"});return this}; -Raphael.el.darker=function(d){var d=d||2,a=[this.attrs.fill,this.attrs.stroke];this.fs=this.fs||[a[0],a[1]];a[0]=Raphael.rgb2hsb(Raphael.getRGB(a[0]).hex);a[1]=Raphael.rgb2hsb(Raphael.getRGB(a[1]).hex);a[0].s=Math.min(a[0].s*d,1);a[0].b/=d;a[1].s=Math.min(a[1].s*d,1);a[1].b/=d;this.attr({fill:"hsb("+[a[0].h,a[0].s,a[0].b]+")",stroke:"hsb("+[a[1].h,a[1].s,a[1].b]+")"});return this};Raphael.el.resetBrightness=function(){this.fs&&(this.attr({fill:this.fs[0],stroke:this.fs[1]}),delete this.fs);return this}; -(function(){var d=["lighter","darker","resetBrightness"],a="popup tag flag label drop blob".split(" "),b;for(b in a)(function(a){Raphael.st[a]=function(){return Raphael.el[a].apply(this,arguments)}})(a[b]);for(b in d)(function(a){Raphael.st[a]=function(){for(var b=0;bb;b++)bMath.abs(a-0.5)?~~a+0.5:Math.round(a)}var e=d,c=a;if(e==c)return{from:e,to:c,power:0};var e=(c-e)/b,g=c=~~e,b=0;if(c){for(;g;)b--,g=~~(e*Math.pow(10,b))/Math.pow(10,b); -b++}else{if(0==e||!isFinite(e))b=1;else for(;!c;)b=b||1,c=~~(e*Math.pow(10,b))/Math.pow(10,b),b++;b&&b--}c=f(a*Math.pow(10,b))/Math.pow(10,b);c=a-b;)"-"!=h&&" "!=h&&(l=l.concat(["M",d-("+"==h||"|"==h?j:2*!(g-1)*j),m+0.5,"l",2*j+1,0])),n.push(o.text(d+p,m,i&&i[u++]||(Math.round(k)==k?k:+k.toFixed(r))).attr(v).attr({"text-anchor":g-1?"start":"end"})),k+=t,m-=s;Math.round(m+s-(a-b))&&("-"!=h&&" "!=h&&(l=l.concat(["M",d-("+"==h||"|"==h?j:2*!(g-1)*j),a-b+0.5,"l",2*j+1,0])),n.push(o.text(d+ -p,a-b,i&&i[u]||(Math.round(k)==k?k:+k.toFixed(r))).attr(v).attr({"text-anchor":g-1?"start":"end"})))}else{for(var k=p,r=(0=q.x-5?n.pop(n.length-1).remove():w=q.x+q.width,k+=t,m+=s;Math.round(m-s-d-b)&&("-"!=h&&" "!=h&&(l=l.concat(["M",d+b+0.5,a-("+"==h?j:2*!!g*j),"l",0,2*j+1])),n.push(o.text(d+ -b,a+p,i&&i[u]||(Math.round(k)==k?k:+k.toFixed(r))).attr(v)))}l=o.path(l);l.text=n;l.all=o.set([l,n]);l.remove=function(){this.text.remove();this.constructor.prototype.remove.call(this)};return l},labelise:function(d,a,b){return d?(d+"").replace(/(##+(?:\.#+)?)|(%%+(?:\.%+)?)/g,function(d,e,c){if(e)return(+a).toFixed(e.replace(/^#+\.?/g,"").length);if(c)return(100*a/b).toFixed(c.replace(/^%+\.?/g,"").length)+"%"}):(+a).toFixed(0)}}; \ No newline at end of file +Raphael.el.popup=function(a,b,c,d){var f,g,h,i,j,e=this.paper||this[0].paper;if(e){switch(this.type){case"text":case"circle":case"ellipse":h=!0;break;default:h=!1}a=null==a?"up":a,b=b||5,f=this.getBBox(),c="number"==typeof c?c:h?f.x+f.width/2:f.x,d="number"==typeof d?d:h?f.y+f.height/2:f.y,i=Math.max(f.width/2-b,0),j=Math.max(f.height/2-b,0),this.translate(c-f.x-(h?f.width/2:0),d-f.y-(h?f.height/2:0)),f=this.getBBox();var k={up:["M",c,d,"l",-b,-b,-i,0,"a",b,b,0,0,1,-b,-b,"l",0,-f.height,"a",b,b,0,0,1,b,-b,"l",2*b+2*i,0,"a",b,b,0,0,1,b,b,"l",0,f.height,"a",b,b,0,0,1,-b,b,"l",-i,0,"z"].join(","),down:["M",c,d,"l",b,b,i,0,"a",b,b,0,0,1,b,b,"l",0,f.height,"a",b,b,0,0,1,-b,b,"l",-(2*b+2*i),0,"a",b,b,0,0,1,-b,-b,"l",0,-f.height,"a",b,b,0,0,1,b,-b,"l",i,0,"z"].join(","),left:["M",c,d,"l",-b,b,0,j,"a",b,b,0,0,1,-b,b,"l",-f.width,0,"a",b,b,0,0,1,-b,-b,"l",0,-(2*b+2*j),"a",b,b,0,0,1,b,-b,"l",f.width,0,"a",b,b,0,0,1,b,b,"l",0,j,"z"].join(","),right:["M",c,d,"l",b,-b,0,-j,"a",b,b,0,0,1,b,-b,"l",f.width,0,"a",b,b,0,0,1,b,b,"l",0,2*b+2*j,"a",b,b,0,0,1,-b,b,"l",-f.width,0,"a",b,b,0,0,1,-b,-b,"l",0,-j,"z"].join(",")};return g={up:{x:-!h*(f.width/2),y:2*-b-(h?f.height/2:f.height)},down:{x:-!h*(f.width/2),y:2*b+(h?f.height/2:f.height)},left:{x:2*-b-(h?f.width/2:f.width),y:-!h*(f.height/2)},right:{x:2*b+(h?f.width/2:f.width),y:-!h*(f.height/2)}}[a],this.translate(g.x,g.y),e.path(k[a]).attr({fill:"#000",stroke:"none"}).insertBefore(this.node?this:this[0])}},Raphael.el.tag=function(a,b,c,d){var e=3,f=this.paper||this[0].paper;if(f){var i,j,k,g=f.path().attr({fill:"#000",stroke:"#000"}),h=this.getBBox();switch(this.type){case"text":case"circle":case"ellipse":k=!0;break;default:k=!1}return a=a||0,c="number"==typeof c?c:k?h.x+h.width/2:h.x,d="number"==typeof d?d:k?h.y+h.height/2:h.y,b=null==b?5:b,j=.5522*b,h.height>=2*b?g.attr({path:["M",c,d+b,"a",b,b,0,1,1,0,2*-b,b,b,0,1,1,0,2*b,"m",0,2*-b-e,"a",b+e,b+e,0,1,0,0,2*(b+e),"L",c+b+e,d+h.height/2+e,"l",h.width+2*e,0,0,-h.height-2*e,-h.width-2*e,0,"L",c,d-b-e].join(",")}):(i=Math.sqrt(Math.pow(b+e,2)-Math.pow(h.height/2+e,2)),g.attr({path:["M",c,d+b,"c",-j,0,-b,j-b,-b,-b,0,-j,b-j,-b,b,-b,j,0,b,b-j,b,b,0,j,j-b,b,-b,b,"M",c+i,d-h.height/2-e,"a",b+e,b+e,0,1,0,0,h.height+2*e,"l",b+e-i+h.width+2*e,0,0,-h.height-2*e,"L",c+i,d-h.height/2-e].join(",")})),a=360-a,g.rotate(a,c,d),this.attrs?(this.attr(this.attrs.x?"x":"cx",c+b+e+(k?h.width/2:"text"==this.type?h.width:0)).attr("y",k?d:d-h.height/2),this.rotate(a,c,d),a>90&&270>a&&this.attr(this.attrs.x?"x":"cx",c-b-e-(k?h.width/2:h.width)).rotate(180,c,d)):a>90&&270>a?(this.translate(c-h.x-h.width-b-e,d-h.y-h.height/2),this.rotate(a-180,h.x+h.width+b+e,h.y+h.height/2)):(this.translate(c-h.x+b+e,d-h.y-h.height/2),this.rotate(a,h.x-b-e,h.y+h.height/2)),g.insertBefore(this.node?this:this[0])}},Raphael.el.drop=function(a,b,c){var f,g,h,i,j,d=this.getBBox(),e=this.paper||this[0].paper;if(e){switch(this.type){case"text":case"circle":case"ellipse":f=!0;break;default:f=!1}return a=a||0,b="number"==typeof b?b:f?d.x+d.width/2:d.x,c="number"==typeof c?c:f?d.y+d.height/2:d.y,g=Math.max(d.width,d.height)+Math.min(d.width,d.height),h=e.path(["M",b,c,"l",g,0,"A",.4*g,.4*g,0,1,0,b+.7*g,c-.7*g,"z"]).attr({fill:"#000",stroke:"none"}).rotate(22.5-a,b,c),a=(a+90)*Math.PI/180,i=b+g*Math.sin(a)-(f?0:d.width/2),j=c+g*Math.cos(a)-(f?0:d.height/2),this.attrs?this.attr(this.attrs.x?"x":"cx",i).attr(this.attrs.y?"y":"cy",j):this.translate(i-d.x,j-d.y),h.insertBefore(this.node?this:this[0])}},Raphael.el.flag=function(a,b,c){var d=3,e=this.paper||this[0].paper;if(e){var i,f=e.path().attr({fill:"#000",stroke:"#000"}),g=this.getBBox(),h=g.height/2;switch(this.type){case"text":case"circle":case"ellipse":i=!0;break;default:i=!1}return a=a||0,b="number"==typeof b?b:i?g.x+g.width/2:g.x,c="number"==typeof c?c:i?g.y+g.height/2:g.y,f.attr({path:["M",b,c,"l",h+d,-h-d,g.width+2*d,0,0,g.height+2*d,-g.width-2*d,0,"z"].join(",")}),a=360-a,f.rotate(a,b,c),this.attrs?(this.attr(this.attrs.x?"x":"cx",b+h+d+(i?g.width/2:"text"==this.type?g.width:0)).attr("y",i?c:c-g.height/2),this.rotate(a,b,c),a>90&&270>a&&this.attr(this.attrs.x?"x":"cx",b-h-d-(i?g.width/2:g.width)).rotate(180,b,c)):a>90&&270>a?(this.translate(b-g.x-g.width-h-d,c-g.y-g.height/2),this.rotate(a-180,g.x+g.width+h+d,g.y+g.height/2)):(this.translate(b-g.x+h+d,c-g.y-g.height/2),this.rotate(a,g.x-h-d,g.y+g.height/2)),f.insertBefore(this.node?this:this[0])}},Raphael.el.label=function(){var a=this.getBBox(),b=this.paper||this[0].paper,c=Math.min(20,a.width+10,a.height+10)/2;if(b)return b.rect(a.x-c/2,a.y-c/2,a.width+c,a.height+c,c).attr({stroke:"none",fill:"#000"}).insertBefore(this.node?this:this[0])},Raphael.el.blob=function(a,b,c){var g,h,i,d=this.getBBox(),e=Math.PI/180,f=this.paper||this[0].paper;if(f){switch(this.type){case"text":case"circle":case"ellipse":h=!0;break;default:h=!1}g=f.path().attr({fill:"#000",stroke:"none"}),a=(+a+1?a:45)+90,i=Math.min(d.height,d.width),b="number"==typeof b?b:h?d.x+d.width/2:d.x,c="number"==typeof c?c:h?d.y+d.height/2:d.y;var j=Math.max(d.width+i,25*i/12),k=Math.max(d.height+i,25*i/12),l=b+i*Math.sin((a-22.5)*e),m=c+i*Math.cos((a-22.5)*e),n=b+i*Math.sin((a+22.5)*e),o=c+i*Math.cos((a+22.5)*e),p=(n-l)/2,q=(o-m)/2,r=j/2,s=k/2,t=-Math.sqrt(Math.abs(r*r*s*s-r*r*q*q-s*s*p*p)/(r*r*q*q+s*s*p*p)),u=t*r*q/s+(n+l)/2,v=t*-s*p/r+(o+m)/2;return g.attr({x:u,y:v,path:["M",b,c,"L",n,o,"A",r,s,0,1,1,l,m,"z"].join(",")}),this.translate(u-d.x-d.width/2,v-d.y-d.height/2),g.insertBefore(this.node?this:this[0])}},Raphael.fn.label=function(a,b,c){var d=this.set();return c=this.text(a,b,c).attr(Raphael.g.txtattr),d.push(c.label(),c)},Raphael.fn.popup=function(a,b,c,d,e){var f=this.set();return c=this.text(a,b,c).attr(Raphael.g.txtattr),f.push(c.popup(d,e),c)},Raphael.fn.tag=function(a,b,c,d,e){var f=this.set();return c=this.text(a,b,c).attr(Raphael.g.txtattr),f.push(c.tag(d,e),c)},Raphael.fn.flag=function(a,b,c,d){var e=this.set();return c=this.text(a,b,c).attr(Raphael.g.txtattr),e.push(c.flag(d),c)},Raphael.fn.drop=function(a,b,c,d){var e=this.set();return c=this.text(a,b,c).attr(Raphael.g.txtattr),e.push(c.drop(d),c)},Raphael.fn.blob=function(a,b,c,d){var e=this.set();return c=this.text(a,b,c).attr(Raphael.g.txtattr),e.push(c.blob(d),c)},Raphael.el.lighter=function(a){a=a||2;var b=[this.attrs.fill,this.attrs.stroke];return this.fs=this.fs||[b[0],b[1]],b[0]=Raphael.rgb2hsb(Raphael.getRGB(b[0]).hex),b[1]=Raphael.rgb2hsb(Raphael.getRGB(b[1]).hex),b[0].b=Math.min(b[0].b*a,1),b[0].s=b[0].s/a,b[1].b=Math.min(b[1].b*a,1),b[1].s=b[1].s/a,this.attr({fill:"hsb("+[b[0].h,b[0].s,b[0].b]+")",stroke:"hsb("+[b[1].h,b[1].s,b[1].b]+")"}),this},Raphael.el.darker=function(a){a=a||2;var b=[this.attrs.fill,this.attrs.stroke];return this.fs=this.fs||[b[0],b[1]],b[0]=Raphael.rgb2hsb(Raphael.getRGB(b[0]).hex),b[1]=Raphael.rgb2hsb(Raphael.getRGB(b[1]).hex),b[0].s=Math.min(b[0].s*a,1),b[0].b=b[0].b/a,b[1].s=Math.min(b[1].s*a,1),b[1].b=b[1].b/a,this.attr({fill:"hsb("+[b[0].h,b[0].s,b[0].b]+")",stroke:"hsb("+[b[1].h,b[1].s,b[1].b]+")"}),this},Raphael.el.resetBrightness=function(){return this.fs&&(this.attr({fill:this.fs[0],stroke:this.fs[1]}),delete this.fs),this},function(){var a=["lighter","darker","resetBrightness"],b=["popup","tag","flag","label","drop","blob"];for(var c in b)(function(a){Raphael.st[a]=function(){return Raphael.el[a].apply(this,arguments)}})(b[c]);for(var c in a)(function(a){Raphael.st[a]=function(){for(var b=0;this.length>b;b++)this[b][a].apply(this[b],arguments);return this}})(a[c])}(),Raphael.g={shim:{stroke:"none",fill:"#000","fill-opacity":0},txtattr:{font:"12px Arial, sans-serif",fill:"#fff"},colors:function(){for(var a=[.6,.2,.05,.1333,.75,0],b=[],c=0;10>c;c++)a.length>c?b.push("hsb("+a[c]+",.75, .75)"):b.push("hsb("+a[c-a.length]+", 1, .5)");return b}(),snapEnds:function(a,b,c){function f(a){return.25>Math.abs(a-.5)?~~a+.5:Math.round(a)}var d=a,e=b;if(d==e)return{from:d,to:e,power:0};var g=(e-d)/c,h=~~g,i=h,j=0;if(h){for(;i;)j--,i=~~(g*Math.pow(10,j))/Math.pow(10,j);j++}else{if(0!=g&&isFinite(g))for(;!h;)j=j||1,h=~~(g*Math.pow(10,j))/Math.pow(10,j),j++;else j=1;j&&j--}return e=f(b*Math.pow(10,j))/Math.pow(10,j),b>e&&(e=f((b+.5)*Math.pow(10,j))/Math.pow(10,j)),d=f((a-(j>0?0:.5))*Math.pow(10,j))/Math.pow(10,j),{from:d,to:e,power:j}},axis:function(a,b,c,d,e,f,g,h,i,j,k){j=null==j?2:j,i=i||"t",f=f||10,k=arguments[arguments.length-1];var t,l="|"==i||" "==i?["M",a+.5,b,"l",0,.001]:1==g||3==g?["M",a+.5,b,"l",0,-c]:["M",a,b+.5,"l",c,0],m=this.snapEnds(d,e,f),n=m.from,o=m.to,p=m.power,q=0,r={font:"11px 'Fontin Sans', Fontin-Sans, sans-serif"},s=k.set();t=(o-n)/f;var u=n,v=p>0?p:0;if(z=c/f,1==+g||3==+g){for(var w=b,x=(g-1?1:-1)*(j+3+!!(g-1));w>=b-c;)"-"!=i&&" "!=i&&(l=l.concat(["M",a-("+"==i||"|"==i?j:2*!(g-1)*j),w+.5,"l",2*j+1,0])),s.push(k.text(a+x,w,h&&h[q++]||(Math.round(u)==u?u:+u.toFixed(v))).attr(r).attr({"text-anchor":g-1?"start":"end"})),u+=t,w-=z;Math.round(w+z-(b-c))&&("-"!=i&&" "!=i&&(l=l.concat(["M",a-("+"==i||"|"==i?j:2*!(g-1)*j),b-c+.5,"l",2*j+1,0])),s.push(k.text(a+x,b-c,h&&h[q]||(Math.round(u)==u?u:+u.toFixed(v))).attr(r).attr({"text-anchor":g-1?"start":"end"})))}else{u=n,v=(p>0)*p,x=(g?-1:1)*(j+9+!g);for(var y=a,z=c/f,A=0,B=0;a+c>=y;){"-"!=i&&" "!=i&&(l=l.concat(["M",y+.5,b-("+"==i?j:2*!!g*j),"l",0,2*j+1])),s.push(A=k.text(y,b+x,h&&h[q++]||(Math.round(u)==u?u:+u.toFixed(v))).attr(r));var C=A.getBBox();B>=C.x-5?s.pop(s.length-1).remove():B=C.x+C.width,u+=t,y+=z}Math.round(y-z-a-c)&&("-"!=i&&" "!=i&&(l=l.concat(["M",a+c+.5,b-("+"==i?j:2*!!g*j),"l",0,2*j+1])),s.push(k.text(a+c,b+x,h&&h[q]||(Math.round(u)==u?u:+u.toFixed(v))).attr(r)))}var D=k.path(l);return D.text=s,D.all=k.set([D,s]),D.remove=function(){this.text.remove(),this.constructor.prototype.remove.call(this)},D},labelise:function(a,b,c){return a?(a+"").replace(/(##+(?:\.#+)?)|(%%+(?:\.%+)?)/g,function(a,d,e){return d?(+b).toFixed(d.replace(/^#+\.?/g,"").length):e?(100*b/c).toFixed(e.replace(/^%+\.?/g,"").length)+"%":void 0}):(+b).toFixed(0)}}; \ No newline at end of file