diff --git a/.gitignore b/.gitignore index 7e621d26..72abdd52 100644 --- a/.gitignore +++ b/.gitignore @@ -20,11 +20,9 @@ config/database.yml config/initializers/omniauth.rb config/unicorn.rb config/resque.yml -config/aws.yml db/data.yml .idea .DS_Store .chef vendor/bundle/* rails_best_practices_output.html -doc/code/* diff --git a/.rspec b/.rspec index 5902dd3a..53607ea5 100644 --- a/.rspec +++ b/.rspec @@ -1 +1 @@ ---colour --drb +--colour diff --git a/.travis.yml b/.travis.yml index 609f2967..6d39488d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: ruby env: - - DB=mysql TRAVIS=true + - DB=postgresql + - DB=mysql before_install: - sudo apt-get install libicu-dev -y - gem install charlock_holmes -v="0.6.9" @@ -8,7 +9,7 @@ branches: only: - 'master' rvm: - - 1.9.3-p392 + - 1.9.3-p327 services: - mysql - postgresql diff --git a/CHANGELOG b/CHANGELOG index 872661d4..2d05a51e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,54 +1,3 @@ -v 5.1.0 - - You can login with email or username now - - Corrected project transfer rollback when repository cannot be moved - - Move both repo and wiki when project transfer requrested - - Admin area: project editing was removed from admin namespace - - Access: admin user has now access to any project. - -v 5.0.0 - - Replaced gitolite with gitlab-shell - - Removed gitolite-related libraries - - State machine added - - Setup gitlab as git user - - Internal API - - Show team tab for empty projects - - Import repository feature - - Updated rails - - Use lambda for scopes - - Redesign admin area -> users - - Redesign admin area -> user - - Secure link to file attachments - - Add validations for Group and Team names - - Restyle team page for project - - Update capybara, rspec-rails, poltergeist to recent versions - - Wiki on git using Gollum - - Added Solarized Dark theme for code review - - Dont show user emails in autocomplete lists, profile pages - - Added settings tab for group, team, project - - Replace user popup with icons in header - - Handle project moving with gitlab-shell - - Added select2-rails for selectboxes with ajax data load - - Fixed search field on projects page - - Added teams to search autocomplete - - Move groups and teams on dashboard sidebar to sub-tabs - - API: improved return codes and docs. (Felix Gilcher, Sebastian Ziebell) - - Redesign wall to be more like chat - - Snippets, Wall features are disabled by default for new projects - -v 4.2.0 - - Teams - - User show page. Via /u/username - - Show help contents on pages for better navigation - - Async gitolite calls - - added satellites logs - - can_create_group, can_create_team booleans for User - - Process web hooks async - - GFM: Fix images escaped inside links - - Network graph improved - - Switchable branches for network graph - - API: Groups - - Fixed project download - v 4.1.0 - Optional Sign-Up - Discussions @@ -63,7 +12,7 @@ v 4.1.0 - cleanup rake tasks - fix backup/restore - scss cleanup - - show preview for note images + - show preview for note images - improved network-graph - get rid of app/roles/ - added new classes Team, Repository @@ -77,7 +26,7 @@ v 4.1.0 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 + - Fixed backup issue - Reorganized settings - Fixed commits compare - Refactored scss diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f322a81c..00304dd3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,53 +1,26 @@ +# Contact & support + +If you want quick help, head over to our [Support Forum](https://groups.google.com/forum/#!forum/gitlabhq). +Otherwise you can follow our [Issue Submission Guide](https://github.com/gitlabhq/gitlabhq/wiki/Issue-Submission-Guide) for a more systematic and thorough guide to solving your issues. + + + # Contribute to GitLab -This guide details how to use pull requests and the issues to improve GitLab. +## Recipes -## Closing policy for pull requests and issues +We collect user submitted installation scripts and config file templates for platforms we don't support officially. +We believe there is merit in allowing a certain amount of diversity. +You can get and submit your solution to running/configuring GitLab with your favorite OS/distro, database, web server, cloud hoster, configuration management tool, etc. -Pull requests and issues not in line with the guidelines listed in this document will be closed with just a link to this paragraph. GitLab is a popular open source project and the capacity to deal with issues and pull requests is limited. To get support for your problems please use other channels as detailed in [the getting help section of the readme](https://github.com/gitlabhq/gitlabhq#getting-help). Professional [support subscriptions](http://www.gitlab.com/subscription/) and [consulting services](http://www.gitlab.com/consultancy/) are available from [GitLab.com](http://www.gitlab.com/). +Help us improve the collection of [GitLab Recipes](https://github.com/gitlabhq/gitlab-recipes/) -## Pull requests -We welcome pull request with improvements to GitLab code and/or documentation. The issues we would really like a pull request for are listed with the [status 'accepting merge/pull requests' on our feedback forum](http://feedback.gitlab.com/forums/176466-general/status/796455) but other improvements are also welcome. +## Feature suggestions -### Pull request guidelines +Follow the [Issue Submission Guide](https://github.com/gitlabhq/gitlabhq/wiki/Issue-Submission-Guide) and support other peoples ideas or propose your own. - If you can please submit a pull request with the fix including tests. The workflow to make a pull request is as follows: -1. Fork the project on GitHub -1. Create a feature branch -1. Write tests and code -1. If you have multiple commits please combine them into one commit by [squashing them](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) -1. Push the commit to your fork -1. Submit a pull request +## Code -We will accept pull requests if: - -* The code has proper tests and all tests pass -* It can be merged without problems (if not please use: git rebase master) -* It doesn't break any existing functionality -* It's quality code that conforms to the [Rails style guide](https://github.com/bbatsov/rails-style-guide) and best practices -* The description includes a motive for your change and the method you used to achieve it -* It keeps the GitLab code base clean and well structured -* We think other users will need the same functionality -* If it makes changes to the UI the pull request should include screenshots - -For examples of feedback on pull requests please look at already [closed pull requests](https://github.com/gitlabhq/gitlabhq/pulls?direction=desc&page=1&sort=created&state=closed). - -## Issue tracker - -The [issue tracker](https://github.com/gitlabhq/gitlabhq/issues) is only for obvious bugs or misbehavior in the master branch of GitLab. When submitting an issue please conform to the issue submission guidelines listed below. - -Please send a pull request with a tested solution or a pull request with a failing test instead of opening an issue if you can. If you're unsure where to post, post to the [Support Forum](https://groups.google.com/forum/#!forum/gitlabhq) first. There are a lot of helpful GitLab users there who may be able to help you quickly. If your particular issue turns out to be a bug, it will find its way from there. - -### Issue tracker guidelines - -**Search** for similar entries before submitting your own, there's a good chance somebody else had the same issue or idea. Show your support with `:+1:` and/or join the discussion. - -* Summarize your issue in one sentence (what goes wrong, what did you expect to happen) -* Describe your issue in detail -* How can we reproduce the issue on the [GitLab Vagrant virtual machine](https://github.com/gitlabhq/gitlab-vagrant-vm) (start with: vagrant destroy && vagrant up && vagrant ssh) -* Add the last commit sha1 of the GitLab version you used to replicate the issue -* Add logs or screen shots when possible -* Link to the line of code that might be responsible for the problem -* Describe your setup (use relevant parts from `sudo -u gitlab -H bundle exec rake gitlab:env:info`) +Follow our [Developer Guide](https://github.com/gitlabhq/gitlabhq/wiki/Developer-Guide) to set you up for hacking on GitLab. diff --git a/Capfile.example b/Capfile.example deleted file mode 100644 index 8863835d..00000000 --- a/Capfile.example +++ /dev/null @@ -1,4 +0,0 @@ -load 'deploy' -load 'deploy/assets' -require 'bundler/capistrano' -load 'config/deploy' diff --git a/Gemfile b/Gemfile index 01e3b0f2..96b5bb6a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source "https://rubygems.org" +source "http://rubygems.org" def darwin_only(require_as) RUBY_PLATFORM.include?('darwin') && require_as @@ -8,26 +8,23 @@ def linux_only(require_as) RUBY_PLATFORM.include?('linux') && require_as end -gem "rails", "3.2.13" +gem "rails", "3.2.11" # Supported DBs gem "mysql2", group: :mysql gem "pg", group: :postgres # Auth -gem "devise" -gem 'omniauth', "~> 1.1.3" +gem "devise", "~> 2.1.0" +gem 'omniauth', "~> 1.1.1" gem 'omniauth-google-oauth2' gem 'omniauth-twitter' gem 'omniauth-github' -# Extracting information from a git repository -# Since gollum requires grit we cannot use gitlab-grit gem name any more. Use grit instead -gem "grit", '~> 2.5.0', git: 'https://github.com/gitlabhq/grit.git', ref: '42297cdcee16284d2e4eff23d41377f52fc28b9d' -gem 'grit_ext', '~> 0.8.1' - -# Ruby/Rack Git Smart-HTTP Server Handler -gem 'gitlab-grack', '~> 1.0.0', require: 'grack' +# GITLAB patched libs +gem "grit", git: "https://github.com/gitlabhq/grit.git", ref: '7f35cb98ff17d534a07e3ce6ec3d580f67402837' +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" @@ -35,31 +32,30 @@ 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' + # Syntax highlighter -gem "gitlab-pygments.rb", '~> 0.3.2', require: 'pygments.rb' +gem "pygments.rb", git: "https://github.com/gitlabhq/pygments.rb.git", branch: "master" # Language detection gem "github-linguist", "~> 2.3.4" , require: "linguist" # API -gem "grape", "~> 0.3.1" -gem "grape-entity", "~> 0.2.0" +gem "grape", "~> 0.2.1" # Format dates and times # based on human-friendly examples gem "stamp" -# Enumeration fields -gem 'enumerize' - # Pagination gem "kaminari", "~> 0.14.1" # HAML -gem "haml-rails" +gem "haml-rails", "~> 0.3.5" # Files attachments -gem "carrierwave" +gem "carrierwave", "~> 0.7.1" # Authorization gem "six" @@ -75,21 +71,18 @@ gem "redcarpet", "~> 2.2.2" gem "github-markup", "~> 0.7.4", require: 'github/markup' # Servers -gem "unicorn" - -# State machine -gem "state_machine" +gem "unicorn", "~> 4.4.0" # Issue tags gem "acts-as-taggable-on", "2.3.3" # Decorators -gem "draper" +gem "draper", "~> 0.18.0" # Background jobs gem 'slim' -gem 'sinatra', require: nil -gem 'sidekiq' +gem 'sinatra', :require => nil +gem 'sidekiq', '2.6.4' # HTTP requests gem "httparty" @@ -100,20 +93,10 @@ gem "colored" # GitLab settings gem 'settingslogic' -# Wiki -# - Use latest master to resolve Gem dependency with Pygemnts -# github-linquist needs pygments 0.4.2 but Gollum 2.4.11 -# requires pygments 0.3.2. The latest master Gollum has been updated -# to use pygments 0.4.2. Change this after next Gollum release. -gem "gollum", "~> 2.4.0", git: "https://github.com/gollum/gollum.git", ref: "5dcd3c8c8f" - # Misc gem "foreman" gem "git" -# Cache -gem "redis-rails" - group :assets do gem "sass-rails", "~> 3.2.5" gem "coffee-rails", "~> 3.2.2" @@ -121,7 +104,6 @@ group :assets do gem "therubyracer" gem 'chosen-rails', "0.9.8" - gem 'select2-rails' gem 'jquery-atwho-rails', "0.1.7" gem "jquery-rails", "2.1.3" gem "jquery-ui-rails", "2.0.2" @@ -130,7 +112,6 @@ group :assets do gem 'bootstrap-sass', "2.2.1.1" gem "font-awesome-sass-rails", "~> 3.0.0" gem "gemoji", "~> 1.2.1", require: 'emoji/railtie' - gem "gon" end group :development do @@ -152,14 +133,13 @@ group :development do end group :development, :test do - gem 'coveralls', require: false gem 'rails-dev-tweaks' gem 'spinach-rails' gem "rspec-rails" gem "capybara" gem "pry" gem "awesome_print" - gem "database_cleaner" + gem "database_cleaner", ref: "f89c34300e114be99532f14c115b2799a3380ac6", git: "https://github.com/bmabey/database_cleaner.git" gem "launchy" gem 'factory_girl_rails' @@ -173,9 +153,7 @@ group :development, :test do gem 'rb-inotify', require: linux_only('rb-inotify') # PhantomJS driver for Capybara - gem 'poltergeist', '1.1.0' - - gem 'spork', '~> 1.0rc' + gem 'poltergeist', git: 'https://github.com/jonleighton/poltergeist.git', ref: '5c2e092001074a8cf09f332d3714e9ba150bc8ca' end group :test do @@ -187,5 +165,5 @@ group :test do end group :production do - gem "gitlab_meta", '5.0' + gem "gitlab_meta", '4.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 586b7bda..7bf31c95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/bmabey/database_cleaner.git + revision: f89c34300e114be99532f14c115b2799a3380ac6 + ref: f89c34300e114be99532f14c115b2799a3380ac6 + specs: + database_cleaner (0.9.1) + GIT remote: https://github.com/ctran/annotate_models.git revision: be4e26825b521f0b2d86b181e2dff89901aa9b1e @@ -6,16 +13,41 @@ GIT activerecord (>= 2.3.0) rake (>= 0.8.7) +GIT + remote: https://github.com/gitlabhq/grack.git + revision: ba46f3b0845c6a09d488ae6abdce6ede37e227e8 + ref: ba46f3b0845c6a09d488ae6abdce6ede37e227e8 + specs: + grack (1.0.0) + rack (~> 1.4.1) + GIT remote: https://github.com/gitlabhq/grit.git - revision: 42297cdcee16284d2e4eff23d41377f52fc28b9d - ref: 42297cdcee16284d2e4eff23d41377f52fc28b9d + revision: 7f35cb98ff17d534a07e3ce6ec3d580f67402837 + ref: 7f35cb98ff17d534a07e3ce6ec3d580f67402837 specs: grit (2.5.0) diff-lcs (~> 1.1) mime-types (~> 1.15) posix-spawn (~> 0.3.6) +GIT + remote: https://github.com/gitlabhq/grit_ext.git + revision: 8e6afc2da821354774aa4d1ee8a1aa2082f84a3e + ref: 8e6afc2da821354774aa4d1ee8a1aa2082f84a3e + specs: + grit_ext (0.6.1) + charlock_holmes (~> 0.6.9) + +GIT + remote: https://github.com/gitlabhq/pygments.rb.git + revision: db1da0343adf86b49bdc3add04d02d2e80438d38 + branch: master + specs: + pygments.rb (0.3.2) + posix-spawn (~> 0.3.6) + yajl-ruby (~> 1.1.0) + GIT remote: https://github.com/gitlabhq/raphael-rails.git revision: cb2c92a040b9b941a5f1aa1ea866cc26e944fe58 @@ -23,89 +55,84 @@ GIT raphael-rails (2.1.0) GIT - remote: https://github.com/gollum/gollum.git - revision: 5dcd3c8c8f68158e43ff79861279088ee56d0ebe - ref: 5dcd3c8c8f + remote: https://github.com/jonleighton/poltergeist.git + revision: 5c2e092001074a8cf09f332d3714e9ba150bc8ca + ref: 5c2e092001074a8cf09f332d3714e9ba150bc8ca specs: - gollum (2.4.11) - github-markdown (~> 0.5.3) - github-markup (>= 0.7.5, < 1.0.0) - grit (~> 2.5.0) - mustache (>= 0.99.4, < 1.0.0) - nokogiri (~> 1.5.6) - pygments.rb (~> 0.4.2) - sanitize (~> 2.0.3) - sinatra (~> 1.3.5) - stringex (~> 1.5.1) - useragent (~> 0.4.16) + poltergeist (1.0.2) + capybara (~> 1.1) + childprocess (~> 0.3) + faye-websocket (~> 0.4, >= 0.4.4) + http_parser.rb (~> 0.5.3) + multi_json (~> 1.0) GEM - remote: https://rubygems.org/ + remote: http://rubygems.org/ specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) + actionmailer (3.2.11) + actionpack (= 3.2.11) + mail (~> 2.4.4) + actionpack (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) - rack (~> 1.4.5) + rack (~> 1.4.0) rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) + activemodel (3.2.11) + activesupport (= 3.2.11) builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) + activerecord (3.2.11) + activemodel (= 3.2.11) + activesupport (= 3.2.11) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) + 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) rails (~> 3.0) addressable (2.3.2) arel (3.0.2) awesome_print (1.1.0) - backports (2.6.7) + 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.7.1) - debug_inspector (>= 0.0.1) + binding_of_caller (0.6.8) + blankslate (3.1.2) bootstrap-sass (2.2.1.1) sass (~> 3.2) builder (3.0.4) - capybara (2.0.2) + capybara (1.1.3) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) - xpath (~> 1.0.0) - carrierwave (0.8.0) + xpath (~> 0.1.4) + 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.8) - ffi (~> 1.0, >= 1.0.11) + 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.9) + coderay (1.0.8) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -116,53 +143,41 @@ GEM colored (1.2) colorize (0.5.8) connection_pool (1.0.0) - coveralls (0.6.2) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - crack (0.3.2) + crack (0.3.1) daemons (1.1.9) - database_cleaner (0.9.1) - debug_inspector (0.0.2) - descendants_tracker (0.0.1) - devise (2.2.3) + devise (2.1.2) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) railties (~> 3.1) warden (~> 1.2.1) - diff-lcs (1.2.1) - draper (1.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - request_store (~> 1.0.3) + diff-lcs (1.1.3) + draper (0.18.0) + actionpack (~> 3.2) + activesupport (~> 3.2) email_spec (1.4.0) launchy (~> 2.1) mail (~> 2.2) - enumerize (0.5.1) - activesupport (>= 3.2) erubis (2.7.0) escape_utils (0.2.4) eventmachine (1.0.0) execjs (1.4.0) multi_json (~> 1.0) - facter (1.6.18) + facter (1.6.17) factory_girl (4.1.0) activesupport (>= 3.0.0) factory_girl_rails (4.1.0) factory_girl (~> 4.1.0) railties (>= 3.0.0) - faraday (0.8.6) + faraday (0.8.4) multipart-post (~> 1.1) - faye-websocket (0.4.7) + faye-websocket (0.4.6) eventmachine (>= 0.12.0) ffaker (1.15.0) - ffi (1.4.0) + ffi (1.1.5) font-awesome-sass-rails (3.0.0.1) railties (>= 3.1.1) sass-rails (>= 3.1.1) - foreman (0.61.0) + foreman (0.60.2) thor (>= 0.13.6) gemoji (1.2.1) gherkin-ruby (0.2.1) @@ -172,62 +187,54 @@ GEM escape_utils (~> 0.2.3) mime-types (~> 1.19) pygments.rb (>= 0.2.13) - github-markdown (0.5.3) - github-markup (0.7.5) - gitlab-grack (1.0.0) - rack (~> 1.4.1) - gitlab-pygments.rb (0.3.2) - posix-spawn (~> 0.3.6) - yajl-ruby (~> 1.1.0) - gitlab_meta (5.0) + 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) - gon (4.0.2) - grape (0.3.2) + gitolite (1.1.0) + gratr19 (~> 0.4.4.1) + grit (~> 2.5.0) + hashery (~> 1.5.0) + grape (0.2.2) activesupport - builder - hashie (>= 1.2.0) + hashie (~> 1.2) multi_json (>= 1.3.2) - multi_xml (>= 0.5.2) + multi_xml rack rack-accept rack-mount virtus - grape-entity (0.2.0) - activesupport - multi_json (>= 1.3.2) - grit_ext (0.8.1) - charlock_holmes (~> 0.6.9) + gratr19 (0.4.4.1) growl (1.0.3) - guard (1.6.2) - listen (>= 0.6.0) + guard (1.5.4) + listen (>= 0.4.2) lumberjack (>= 1.0.2) pry (>= 0.9.10) - terminal-table (>= 1.4.3) thor (>= 0.14.6) - guard-rspec (2.5.1) + guard-rspec (2.1.2) guard (>= 1.1) rspec (~> 2.11) guard-spinach (0.0.2) guard (>= 1.1) spinach - haml (4.0.0) - tilt - haml-rails (0.4) + haml (3.1.7) + haml-rails (0.3.5) actionpack (>= 3.1, < 4.1) activesupport (>= 3.1, < 4.1) - haml (>= 3.1, < 4.1) + haml (~> 3.1) railties (>= 3.1, < 4.1) + hashery (1.5.0) + blankslate hashie (1.2.0) hike (1.2.1) http_parser.rb (0.5.3) - httparty (0.10.2) + httparty (0.9.0) multi_json (~> 1.0) - multi_xml (>= 0.5.2) + multi_xml httpauth (0.2.0) i18n (0.6.1) journey (1.0.4) @@ -238,46 +245,47 @@ GEM jquery-ui-rails (2.0.2) jquery-rails railties (>= 3.1.0) - json (1.7.7) + json (1.7.6) jwt (0.1.5) multi_json (>= 1.0) kaminari (0.14.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kgio (2.8.0) + kgio (2.7.4) launchy (2.1.2) addressable (~> 2.3) letter_opener (1.0.0) launchy (>= 2.0.4) - libv8 (3.11.8.17) - listen (0.7.3) - lumberjack (1.0.3) - mail (2.5.3) + libv8 (3.3.10.4) + libwebsocket (0.1.6) + websocket + listen (0.5.3) + lumberjack (1.0.2) + mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) method_source (0.8.1) - mime-types (1.21) + mime-types (1.19) modernizr (2.6.2) sprockets (~> 2.0) - multi_json (1.7.2) - multi_xml (0.5.3) + multi_json (1.5.0) + multi_xml (0.5.1) multipart-post (1.1.5) - mustache (0.99.4) mysql2 (0.3.11) net-ldap (0.2.2) - nokogiri (1.5.6) + nokogiri (1.5.5) oauth (0.4.7) - oauth2 (0.8.1) + oauth2 (0.8.0) faraday (~> 0.8) httpauth (~> 0.1) jwt (~> 0.1.4) multi_json (~> 1.0) rack (~> 1.2) - omniauth (1.1.3) + omniauth (1.1.1) hashie (~> 1.2) rack - omniauth-github (1.1.0) + omniauth-github (1.0.3) omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) omniauth-google-oauth2 (0.1.13) @@ -294,23 +302,17 @@ GEM omniauth-oauth (~> 1.0) orm_adapter (0.4.0) pg (0.14.1) - poltergeist (1.1.0) - capybara (~> 2.0, >= 2.0.1) - faye-websocket (~> 0.4, >= 0.4.4) - http_parser.rb (~> 0.5.3) polyglot (0.3.3) posix-spawn (0.3.6) - pry (0.9.12) + progressbar (0.12.0) + pry (0.9.10) coderay (~> 1.0.5) method_source (~> 0.8) - slop (~> 3.4) - pygments.rb (0.4.2) - posix-spawn (~> 0.3.6) - yajl-ruby (~> 1.1.0) + slop (~> 3.3.1) pyu-ruby-sasl (0.0.3.3) quiet_assets (1.0.1) railties (~> 3.1) - rack (1.4.5) + rack (1.4.3) rack-accept (0.4.5) rack (>= 0.4) rack-cache (1.2) @@ -319,91 +321,68 @@ GEM rack (>= 1.1.3) rack-mount (0.8.3) rack (>= 1.0.0) - rack-protection (1.4.0) + rack-protection (1.3.2) rack - rack-ssl (1.3.3) + rack-ssl (1.3.2) rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) + 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.13) + railties (= 3.2.11) rails-dev-tweaks (0.6.1) actionpack (~> 3.1) railties (~> 3.1) - rails_best_practices (1.13.4) + rails_best_practices (1.13.2) activesupport awesome_print code_analyzer colored erubis i18n - ruby-progressbar - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) + 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.4) + rake (10.0.3) rb-fsevent (0.9.2) rb-inotify (0.8.8) ffi (>= 0.5.0) - rdoc (3.12.2) + rdoc (3.12) json (~> 1.4) redcarpet (2.2.2) - redis (3.0.3) - redis-actionpack (3.2.3) - actionpack (~> 3.2.3) - redis-rack (~> 1.4.0) - redis-store (~> 1.1.0) - redis-activesupport (3.2.3) - activesupport (~> 3.2.3) - redis-store (~> 1.1.0) + redis (3.0.2) redis-namespace (1.2.1) redis (~> 3.0.0) - redis-rack (1.4.2) - rack (~> 1.4.1) - redis-store (~> 1.1.0) - redis-rails (3.2.3) - redis-actionpack (~> 3.2.3) - redis-activesupport (~> 3.2.3) - redis-store (~> 1.1.0) - redis-store (1.1.3) - redis (>= 2.2.0) - ref (1.0.4) - request_store (1.0.5) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (2.13.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - rspec-core (2.13.1) - rspec-expectations (2.13.0) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.13.0) - rspec-rails (2.13.0) + rspec (2.12.0) + rspec-core (~> 2.12.0) + rspec-expectations (~> 2.12.0) + rspec-mocks (~> 2.12.0) + rspec-core (2.12.0) + rspec-expectations (2.12.0) + diff-lcs (~> 1.1.3) + rspec-mocks (2.12.0) + rspec-rails (2.12.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.13.0) - rspec-expectations (~> 2.13.0) - rspec-mocks (~> 2.13.0) - ruby-progressbar (1.0.2) + rspec-core (~> 2.12.0) + rspec-expectations (~> 2.12.0) + rspec-mocks (~> 2.12.0) rubyntlm (0.1.1) rubyzip (0.9.9) - sanitize (2.0.3) - nokogiri (>= 1.4.4, < 1.6) - sass (3.2.7) - sass-rails (3.2.6) + sass (3.2.5) + sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) @@ -413,19 +392,16 @@ GEM seed-fu (2.2.0) activerecord (~> 3.1) activesupport (~> 3.1) - select2-rails (3.3.1) - sass-rails (>= 3.2) - thor (~> 0.14) - selenium-webdriver (2.30.0) + selenium-webdriver (2.26.0) childprocess (>= 0.2.5) + libwebsocket (~> 0.1.3) multi_json (~> 1.0) rubyzip - websocket (~> 1.0.4) - settingslogic (2.0.9) - sexp_processor (4.2.0) + settingslogic (2.0.8) + sexp_processor (4.1.3) shoulda-matchers (1.3.0) activesupport (>= 3.0.0) - sidekiq (2.8.0) + sidekiq (2.6.4) celluloid (~> 0.12.0) connection_pool (~> 1.0) multi_json (~> 1) @@ -435,66 +411,59 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.7.1) simplecov-html (0.7.1) - sinatra (1.3.5) - rack (~> 1.4) - rack-protection (~> 1.3) + sinatra (1.3.3) + rack (~> 1.3, >= 1.3.6) + 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.4.4) - spinach (0.7.0) + slop (3.3.3) + spinach (0.5.2) colorize gherkin-ruby (~> 0.2.0) - spinach-rails (0.2.0) - capybara (~> 2.0.0) + spinach-rails (0.1.8) + capybara (~> 1) railties (>= 3) spinach (>= 0.4) - spork (1.0.0rc3) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - stamp (0.5.0) - state_machine (1.1.2) - stringex (1.5.1) + stamp (0.3.0) temple (0.5.5) - terminal-table (1.4.5) test_after_commit (0.0.1) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) - ref + therubyracer (0.10.2) + libv8 (~> 3.3.10) thin (1.5.0) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) - thor (0.18.0) - tilt (1.3.6) - timers (1.1.0) + thor (0.16.0) + tilt (1.3.3) + timers (1.0.2) treetop (1.4.12) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.37) + tzinfo (0.3.35) uglifier (1.3.0) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) - unicorn (4.6.2) + unicorn (4.4.0) kgio (~> 2.6) rack raindrops (~> 0.7) - useragent (0.4.16) - virtus (0.5.4) + virtus (0.5.2) backports (~> 2.6.1) - descendants_tracker (~> 0.0.1) warden (1.2.1) rack (>= 1.0) webmock (1.9.0) addressable (>= 2.2.7) crack (>= 0.1.7) - websocket (1.0.7) - xpath (1.0.0) + websocket (1.0.2) + xpath (0.1.4) nokogiri (~> 1.3) yajl-ruby (1.1.0) @@ -509,16 +478,14 @@ DEPENDENCIES binding_of_caller bootstrap-sass (= 2.2.1.1) capybara - carrierwave + carrierwave (~> 0.7.1) chosen-rails (= 0.9.8) coffee-rails (~> 3.2.2) colored - coveralls - database_cleaner - devise - draper + database_cleaner! + devise (~> 2.1.0) + draper (~> 0.18.0) email_spec - enumerize factory_girl_rails ffaker font-awesome-sass-rails (~> 3.0.0) @@ -527,21 +494,18 @@ DEPENDENCIES git github-linguist (~> 2.3.4) github-markup (~> 0.7.4) - gitlab-grack (~> 1.0.0) - gitlab-pygments.rb (~> 0.3.2) - gitlab_meta (= 5.0) + gitlab_meta (= 4.0) gitlab_omniauth-ldap (= 1.0.2) gitlab_yaml_db (= 1.0.0) - gollum (~> 2.4.0)! - gon - grape (~> 0.3.1) - grape-entity (~> 0.2.0) - grit (~> 2.5.0)! - grit_ext (~> 0.8.1) + gitolite (= 1.1.0) + grack! + grape (~> 0.2.1) + grit! + grit_ext! growl guard-rspec guard-spinach - haml-rails + haml-rails (~> 0.3.5) httparty jquery-atwho-rails (= 0.1.7) jquery-rails (= 2.1.3) @@ -551,42 +515,39 @@ DEPENDENCIES letter_opener modernizr (= 2.6.2) mysql2 - omniauth (~> 1.1.3) + omniauth (~> 1.1.1) omniauth-github omniauth-google-oauth2 omniauth-twitter pg - poltergeist (= 1.1.0) + poltergeist! pry + pygments.rb! quiet_assets (~> 1.0.1) rack-mini-profiler - rails (= 3.2.13) + rails (= 3.2.11) rails-dev-tweaks rails_best_practices raphael-rails! rb-fsevent rb-inotify redcarpet (~> 2.2.2) - redis-rails rspec-rails sass-rails (~> 3.2.5) sdoc seed-fu - select2-rails settingslogic shoulda-matchers (= 1.3.0) - sidekiq + sidekiq (= 2.6.4) simplecov sinatra six slim spinach-rails - spork (~> 1.0rc) stamp - state_machine test_after_commit therubyracer thin uglifier (~> 1.3.0) - unicorn + unicorn (~> 4.4.0) webmock diff --git a/Procfile b/Procfile index 66ca562f..21dfade1 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ web: bundle exec unicorn_rails -p $PORT -worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell +worker: bundle exec sidekiq -q post_receive,mailer,system_hook,common,default diff --git a/README.md b/README.md index 3ab4c051..1a43be13 100644 --- a/README.md +++ b/README.md @@ -1,161 +1,45 @@ -## GitLab: self hosted Git management software +# Welcome to GitLab [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://travis-ci.org/gitlabhq/gitlabhq) [![build status](https://secure.travis-ci.org/gitlabhq/grit.png)](https://travis-ci.org/gitlabhq/grit) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/gitlabhq/gitlabhq) [![Dependency Status](https://gemnasium.com/gitlabhq/gitlabhq.png)](https://gemnasium.com/gitlabhq/gitlabhq) -![logo](https://raw.github.com/gitlabhq/gitlabhq/master/public/gitlab_logo.png) +GitLab is a free project and repository management application -### GitLab allows you to - * keep your code secure on your own server - * manage repositories, users and access permissions - * communicate through issues, line-comments and wiki pages - * perform code review with merge requests +![CI](http://ci.gitlab.org/projects/1/status?ref=master) -### GitLab is +## Application details -* powered by Ruby on Rails -* completely free and open source (MIT license) -* used by more than 10.000 organizations to keep their code secure +* based on Ruby on Rails +* distributed under the MIT License +* works with gitolite -### Code status +## Requirements -* [![build status](http://ci.gitlab.org/projects/1/status?ref=master)](http://ci.gitlab.org/projects/1?ref=master) ci.gitlab.org (master branch) - -* [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://travis-ci.org/gitlabhq/gitlabhq) travis-ci.org (master branch) - -* [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.png)](https://codeclimate.com/github/gitlabhq/gitlabhq) - -* [![Dependency Status](https://gemnasium.com/gitlabhq/gitlabhq.png)](https://gemnasium.com/gitlabhq/gitlabhq) - -* [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) - -### Resources - -* GitLab.org community site: [Homepage](http://gitlab.org) [Screenshots](http://gitlab.org/screenshots/) [Blog](http://blog.gitlab.org/) [Demo](http://demo.gitlabhq.com/users/sign_in) - -* GitLab.com commercial services: [Homepage](http://www.gitlab.com/) [Subscription](http://www.gitlab.com/subscription/) [Consultancy](http://www.gitlab.com/consultancy/) [GitLab Cloud](http://www.gitlab.com/cloud/) [Blog](http://blog.gitlab.com/) - -* GitLab CI: [Readme](https://github.com/gitlabhq/gitlab-ci/blob/master/README.md) of the GitLab open-source continuous integration server - -### Requirements - -* Ubuntu/Debian** -* ruby 1.9.3 +* Ubuntu/Debian +* ruby 1.9.3+ * MySQL * git -* gitlab-shell +* gitolite * redis -** More details are in the [requirements doc](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/requirements.md) +## Install -### Installation +Checkout wiki pages for installation information, migration, etc. -#### Official production installation +## Community -Follow the installation guide for production server. +[Google Group](https://groups.google.com/group/gitlabhq) -* [Installation guide for latest stable release (5.0)](https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md) - **Recommended** +## Contacts -* [Installation guide for the current master branch (5.1)](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md) +Twitter: + * @gitlabhq + * @dzaporozhets -#### Official development installation +Email -If you want to contribute, please first read our [Contributing Guidelines](https://github.com/gitlabhq/gitlabhq/blob/master/CONTRIBUTING.md) and then we suggest you to use the Vagrant virtual machine project to get an environment working with all dependencies. + * m@gitlabhq.com -* [Vagrant virtual machine](https://github.com/gitlabhq/gitlab-vagrant-vm) +## Contribute - -#### Unsupported production installation - -* [GitLab recipes](https://github.com/gitlabhq/gitlab-recipes) for setup on different platforms - -* [Unofficial installation guides](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Unofficial-Installation-Guides) - -* [BitNami one-click installers](http://bitnami.com/stack/gitlab) - -* [TurnKey Linux virtual appliance](http://www.turnkeylinux.org/gitlab) - - -### New versions and upgrading - -Each month on the 22th a new version is released together with an upgrade guide. - -* [Upgrade guides](https://github.com/gitlabhq/gitlabhq/wiki) - -* [Changelog](https://github.com/gitlabhq/gitlabhq/blob/master/CHANGELOG) - -* [Roadmap](https://github.com/gitlabhq/gitlabhq/blob/master/ROADMAP.md) - - -### Getting started - -1. The Installation guide contains instructions to download an init script and run that on boot. With the init script you can also start GitLab - - sudo service gitlab start - - or - - sudo /etc/init.d/gitlab restart - -2. Start it with [Foreman](https://github.com/ddollar/foreman) in development mode - - bundle exec foreman start -p 3000 - - or start it manually - - bundle exec rails s - bundle exec rake sidekiq:start - -### Running the tests - -* Seed the database - - bundle exec rake db:setup RAILS_ENV=test - bundle exec rake db:seed_fu RAILS_ENV=test - -* Run all tests - - bundle exec rake gitlab:test - -* Rspec unit and functional tests - - bundle exec rake spec - -* Spinach integration tests - - bundle exec rake spinach - - -### GitLab interfaces - -* [GitLab API](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/README.md) - -* [Rake tasks](https://github.com/gitlabhq/gitlabhq/tree/master/doc/raketasks) - -* [Directory structure](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/structure.md) - -* [Databases](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/databases.md) - - -### Getting help - -* [Troubleshooting guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide) contains solutions to common problems. - -* [Support forum](https://groups.google.com/forum/#!forum/gitlabhq) is the best place to ask questions. For example you can use it if you have questions about: permission denied errors, invisible repos, can't clone/pull/push or with web hooks that don't fire. Please search for similar issues before posting your own, there's a good chance somebody else had the same issue you have now and had it resolved. There are a lot of helpful GitLab users there who may be able to help you quickly. If your particular issue turns out to be a bug, it will find its way from there to a fix. - -* [Feedback and suggestions forum](http://gitlab.uservoice.com/forums/176466-general) is the place to propose and discuss new features for GitLab. - -* [Support subscription](http://www.gitlab.com/subscription/) connect you to the knowledge of GitLab experts that will resolve your issues and answer your questions. - -* [Consultancy](http://www.gitlab.com/consultancy/) allows you hire GitLab exports for installations, upgrades and customizations. - -* [Contributing guide](https://github.com/gitlabhq/gitlabhq/blob/master/CONTRIBUTING.md) describes how to submit pull requests and issues. Pull requests and issues not in line with the guidelines in this document will be closed without comment. - - -### Getting in touch - -* [Core team](https://github.com/gitlabhq?tab=members) - -* [Contributors](https://github.com/gitlabhq/gitlabhq/graphs/contributors) - -* [Leader](https://github.com/randx) - -* [Contact page](http://gitlab.org/contact/) +[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/ROADMAP.md b/ROADMAP.md index 9c4bd2db..acfd2ede 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,5 +1,13 @@ ## GitLab Roadmap -### v5.1 April 22 +### v4.3 March 22 + +* Jenkins CI integration service +* Usability improvements +* Notification improvements + +### v4.2 February 22 + +* Campfire integration service +* Teams -* Not decided yet. diff --git a/VERSION b/VERSION index 52df2a23..ee74734a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.1.0pre +4.1.0 diff --git a/app/assets/fonts/OFL.txt b/app/assets/fonts/OFL.txt new file mode 100644 index 00000000..3ce219f0 --- /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 00000000..5026d3bd Binary files /dev/null and b/app/assets/fonts/YanoneKaffeesatz-Light.ttf differ diff --git a/app/assets/images/home_icon.PNG b/app/assets/images/home_icon.PNG new file mode 100644 index 00000000..b1d60d59 Binary files /dev/null and b/app/assets/images/home_icon.PNG differ diff --git a/app/assets/images/icon-attachment.png b/app/assets/images/icon-attachment.png new file mode 100644 index 00000000..168ad8dc Binary files /dev/null and b/app/assets/images/icon-attachment.png differ diff --git a/app/assets/images/logo-black.png b/app/assets/images/logo-black.png deleted file mode 100644 index 6567f2e5..00000000 Binary files a/app/assets/images/logo-black.png and /dev/null differ diff --git a/app/assets/images/logo-white.png b/app/assets/images/logo-white.png deleted file mode 100644 index ecec2405..00000000 Binary files a/app/assets/images/logo-white.png and /dev/null differ diff --git a/app/assets/images/logo_dark.png b/app/assets/images/logo_dark.png new file mode 100644 index 00000000..4a3e3391 Binary files /dev/null and b/app/assets/images/logo_dark.png differ diff --git a/app/assets/images/logo_white.png b/app/assets/images/logo_white.png new file mode 100644 index 00000000..e3415816 Binary files /dev/null and b/app/assets/images/logo_white.png differ diff --git a/app/assets/images/onion_skin_sprites.gif b/app/assets/images/onion_skin_sprites.gif deleted file mode 100644 index 85d20260..00000000 Binary files a/app/assets/images/onion_skin_sprites.gif and /dev/null differ diff --git a/app/assets/images/solarized_dark.png b/app/assets/images/solarized_dark.png deleted file mode 100644 index 728964bc..00000000 Binary files a/app/assets/images/solarized_dark.png and /dev/null differ diff --git a/app/assets/images/swipemode_sprites.gif b/app/assets/images/swipemode_sprites.gif deleted file mode 100644 index 327b3c31..00000000 Binary files a/app/assets/images/swipemode_sprites.gif and /dev/null differ diff --git a/app/assets/javascripts/api.js.coffee b/app/assets/javascripts/api.js.coffee deleted file mode 100644 index ca721517..00000000 --- a/app/assets/javascripts/api.js.coffee +++ /dev/null @@ -1,53 +0,0 @@ -@Api = - users_path: "/api/:version/users.json" - user_path: "/api/:version/users/:id.json" - notes_path: "/api/:version/projects/:id/notes.json" - - # Get 20 (depends on api) recent notes - # and sort the ascending from oldest to newest - notes: (project_id, callback) -> - url = Api.buildUrl(Api.notes_path) - url = url.replace(':id', project_id) - - $.ajax( - url: url, - data: - private_token: gon.api_token - gfm: true - recent: true - dataType: "json" - ).done (notes) -> - notes.sort (a, b) -> - return a.id - b.id - callback(notes) - - user: (user_id, callback) -> - url = Api.buildUrl(Api.user_path) - url = url.replace(':id', user_id) - - $.ajax( - url: url - data: - private_token: gon.api_token - dataType: "json" - ).done (user) -> - callback(user) - - # Return users list. Filtered by query - # Only active users retrieved - users: (query, callback) -> - url = Api.buildUrl(Api.users_path) - - $.ajax( - url: url - data: - private_token: gon.api_token - search: query - per_page: 20 - active: true - dataType: "json" - ).done (users) -> - callback(users) - - buildUrl: (url) -> - return url.replace(':version', gon.api_version) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index adb4009f..49effdf9 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,7 +17,6 @@ //= require bootstrap //= require modernizr //= require chosen-jquery -//= require select2 //= require raphael //= require g.raphael-min //= require g.bar-min diff --git a/app/assets/javascripts/behaviors/toggler_behavior.coffee b/app/assets/javascripts/behaviors/toggler_behavior.coffee index d2181e7b..3fefbf8e 100644 --- a/app/assets/javascripts/behaviors/toggler_behavior.coffee +++ b/app/assets/javascripts/behaviors/toggler_behavior.coffee @@ -3,11 +3,3 @@ $ -> container = $(@).closest(".js-toggler-container") container.toggleClass("on") - - $("body").on "click", ".js-toggle-visibility-link", (e) -> - $(@).find('i'). - toggleClass('icon-chevron-down'). - toggleClass('icon-chevron-up') - container = $(".js-toggle-visibility-container") - container.toggleClass("hide") - e.preventDefault() diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee deleted file mode 100644 index 2a668de2..00000000 --- a/app/assets/javascripts/branch-graph.js.coffee +++ /dev/null @@ -1,309 +0,0 @@ -class BranchGraph - constructor: (@element, @options) -> - @preparedCommits = {} - @mtime = 0 - @mspace = 0 - @parents = {} - @colors = ["#000"] - @offsetX = 120 - @offsetY = 20 - @unitTime = 30 - @unitSpace = 10 - @load() - - load: -> - $.ajax - url: @options.url - method: "get" - dataType: "json" - success: $.proxy((data) -> - $(".loading", @element).hide() - @prepareData data.days, data.commits - @buildGraph() - , this) - - prepareData: (@days, @commits) -> - @collectParents() - - for c in @commits - c.isParent = true if c.id of @parents - @preparedCommits[c.id] = c - - @collectColors() - - collectParents: -> - for c in @commits - @mtime = Math.max(@mtime, c.time) - @mspace = Math.max(@mspace, c.space) - for p in c.parents - @parents[p[0]] = true - @mspace = Math.max(@mspace, p[1]) - - collectColors: -> - k = 0 - while k < @mspace - @colors.push Raphael.getColor(.8) - # Skipping a few colors in the spectrum to get more contrast between colors - Raphael.getColor() - Raphael.getColor() - k++ - - buildGraph: -> - graphHeight = $(@element).height() - graphWidth = $(@element).width() - ch = Math.max(graphHeight, @offsetY + @unitTime * @mtime + 150) - cw = Math.max(graphWidth, @offsetX + @unitSpace * @mspace + 300) - @r = r = Raphael(@element.get(0), cw, ch) - top = r.set() - cuday = 0 - cumonth = "" - barHeight = Math.max(graphHeight, @unitTime * @days.length + 320) - - r.rect(0, 0, 26, barHeight).attr fill: "#222" - r.rect(26, 0, 20, barHeight).attr fill: "#444" - - for day, mm in @days - if cuday isnt day[0] - # Dates - r.text(36, @offsetY + @unitTime * mm, day[0]) - .attr( - font: "12px Monaco, monospace" - fill: "#DDD" - ) - cuday = day[0] - - if cumonth isnt day[1] - # Months - r.text(13, @offsetY + @unitTime * mm, day[1]) - .attr( - font: "12px Monaco, monospace" - fill: "#EEE" - ) - cumonth = day[1] - - for commit in @commits - x = @offsetX + @unitSpace * (@mspace - commit.space) - y = @offsetY + @unitTime * commit.time - - @drawDot(x, y, commit) - - @drawLines(x, y, commit) - - @appendLabel(x, y, commit.refs) if commit.refs - - @appendAnchor(top, commit, x, y) - - @markCommit(x, y, commit, graphHeight) - - top.toFront() - @bindEvents() - - bindEvents: -> - drag = {} - element = @element - dragger = (event) -> - element.scrollLeft drag.sl - (event.clientX - drag.x) - element.scrollTop drag.st - (event.clientY - drag.y) - - element.on mousedown: (event) -> - drag = - x: event.clientX - y: event.clientY - st: element.scrollTop() - sl: element.scrollLeft() - $(window).on "mousemove", dragger - - $(window).on - mouseup: -> - $(window).off "mousemove", dragger - keydown: (event) -> - # left - element.scrollLeft element.scrollLeft() - 50 if event.keyCode is 37 - # top - element.scrollTop element.scrollTop() - 50 if event.keyCode is 38 - # right - element.scrollLeft element.scrollLeft() + 50 if event.keyCode is 39 - # bottom - element.scrollTop element.scrollTop() + 50 if event.keyCode is 40 - - appendLabel: (x, y, refs) -> - r = @r - shortrefs = refs - # Truncate if longer than 15 chars - shortrefs = shortrefs.substr(0, 15) + "…" if shortrefs.length > 17 - text = r.text(x + 4, y, shortrefs).attr( - "text-anchor": "start" - font: "10px Monaco, monospace" - fill: "#FFF" - title: refs - ) - textbox = text.getBBox() - # Create rectangle based on the size of the textbox - rect = r.rect(x, y - 7, textbox.width + 5, textbox.height + 5, 4).attr( - fill: "#000" - "fill-opacity": .5 - stroke: "none" - ) - triangle = r.path(["M", x - 5, y, "L", x - 15, y - 4, "L", x - 15, y + 4, "Z"]).attr( - fill: "#000" - "fill-opacity": .5 - stroke: "none" - ) - - label = r.set(rect, text) - label.transform(["t", -rect.getBBox().width - 15, 0]) - - # Set text to front - text.toFront() - - appendAnchor: (top, commit, x, y) -> - r = @r - options = @options - anchor = r.circle(x, y, 10).attr( - fill: "#000" - opacity: 0 - cursor: "pointer" - ).click(-> - window.open options.commit_url.replace("%s", commit.id), "_blank" - ).hover(-> - @tooltip = r.commitTooltip(x + 5, y, commit) - top.push @tooltip.insertBefore(this) - , -> - @tooltip and @tooltip.remove() and delete @tooltip - ) - top.push anchor - - drawDot: (x, y, commit) -> - r = @r - r.circle(x, y, 3).attr( - fill: @colors[commit.space] - stroke: "none" - ) - r.rect(@offsetX + @unitSpace * @mspace + 10, y - 10, 20, 20).attr( - fill: "url(#{commit.author.icon})" - stroke: @colors[commit.space] - "stroke-width": 2 - ) - r.text(@offsetX + @unitSpace * @mspace + 35, y, commit.message.split("\n")[0]).attr( - "text-anchor": "start" - font: "14px Monaco, monospace" - ) - - drawLines: (x, y, commit) -> - r = @r - for parent, i in commit.parents - parentCommit = @preparedCommits[parent[0]] - parentY = @offsetY + @unitTime * parentCommit.time - parentX1 = @offsetX + @unitSpace * (@mspace - parentCommit.space) - parentX2 = @offsetX + @unitSpace * (@mspace - parent[1]) - - # Set line color - if parentCommit.space <= commit.space - color = @colors[commit.space] - - else - color = @colors[parentCommit.space] - - # Build line shape - if parent[1] is commit.space - offset = [0, 5] - arrow = "l-2,5,4,0,-2,-5,0,5" - - else if parent[1] < commit.space - offset = [3, 3] - arrow = "l5,0,-2,4,-3,-4,4,2" - - else - offset = [-3, 3] - arrow = "l-5,0,2,4,3,-4,-4,2" - - # Start point - route = ["M", x + offset[0], y + offset[1]] - - # Add arrow if not first parent - if i > 0 - route.push(arrow) - - # Circumvent if overlap - if commit.space isnt parentCommit.space or commit.space isnt parent[1] - route.push( - "L", parentX2, y + 10, - "L", parentX2, parentY - 5, - ) - - # End point - route.push("L", parentX1, parentY) - - r - .path(route) - .attr( - stroke: color - "stroke-width": 2) - - markCommit: (x, y, commit, graphHeight) -> - if commit.id is @options.commit_id - r = @r - r.path(["M", x + 5, y, "L", x + 15, y + 4, "L", x + 15, y - 4, "Z"]).attr( - fill: "#000" - "fill-opacity": .5 - stroke: "none" - ) - # Displayed in the center - @element.scrollTop(y - graphHeight / 2) - -Raphael::commitTooltip = (x, y, commit) -> - boxWidth = 300 - boxHeight = 200 - icon = @image(commit.author.icon, x, y, 20, 20) - nameText = @text(x + 25, y + 10, commit.author.name) - idText = @text(x, y + 35, commit.id) - messageText = @text(x, y + 50, commit.message) - textSet = @set(icon, 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 - rect = @rect(x - 10, y - 10, boxWidth, 100, 4).attr( - fill: "#FFF" - stroke: "#000" - "stroke-linecap": "round" - "stroke-width": 2 - ) - tooltip = @set(rect, textSet) - rect.attr( - height: tooltip.getBBox().height + 10 - width: tooltip.getBBox().width + 10 - ) - - tooltip.transform ["t", 20, 20] - tooltip - -Raphael::textWrap = (t, width) -> - content = t.attr("text") - abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - t.attr text: abc - letterWidth = t.getBBox().width / abc.length - t.attr text: content - words = content.split(" ") - x = 0 - s = [] - - for word in words - if x + (word.length * letterWidth) > width - s.push "\n" - x = 0 - x += word.length * letterWidth - s.push word + " " - - t.attr text: s.join("") - b = t.getBBox() - h = Math.abs(b.y2) - Math.abs(b.y) + 1 - t.attr y: b.y + h - -@BranchGraph = BranchGraph diff --git a/app/assets/javascripts/commit/file.js.coffee b/app/assets/javascripts/commit/file.js.coffee deleted file mode 100644 index a45ee58d..00000000 --- a/app/assets/javascripts/commit/file.js.coffee +++ /dev/null @@ -1,7 +0,0 @@ -class CommitFile - - constructor: (file) -> - if $('.image', file).length - new ImageFile(file) - -this.CommitFile = CommitFile \ No newline at end of file diff --git a/app/assets/javascripts/commit/image-file.js.coffee b/app/assets/javascripts/commit/image-file.js.coffee deleted file mode 100644 index f901a9e2..00000000 --- a/app/assets/javascripts/commit/image-file.js.coffee +++ /dev/null @@ -1,128 +0,0 @@ -class ImageFile - - # Width where images must fits in, for 2-up this gets divided by 2 - @availWidth = 900 - @viewModes = ['two-up', 'swipe'] - - constructor: (@file) -> - # Determine if old and new file has same dimensions, if not show 'two-up' view - this.requestImageInfo $('.two-up.view .frame.deleted img', @file), (deletedWidth, deletedHeight) => - this.requestImageInfo $('.two-up.view .frame.added img', @file), (width, height) => - if width == deletedWidth && height == deletedHeight - this.initViewModes() - else - this.initView('two-up') - - initViewModes: -> - viewMode = ImageFile.viewModes[0] - - $('.view-modes', @file).removeClass 'hide' - $('.view-modes-menu', @file).on 'click', 'li', (event) => - unless $(event.currentTarget).hasClass('active') - this.activateViewMode(event.currentTarget.className) - - this.activateViewMode(viewMode) - - activateViewMode: (viewMode) -> - $('.view-modes-menu li', @file) - .removeClass('active') - .filter(".#{viewMode}").addClass 'active' - $(".view:visible:not(.#{viewMode})", @file).fadeOut 200, => - $(".view.#{viewMode}", @file).fadeIn(200) - this.initView viewMode - - initView: (viewMode) -> - this.views[viewMode].call(this) - - prepareFrames = (view) -> - maxWidth = 0 - maxHeight = 0 - $('.frame', view).each (index, frame) => - width = $(frame).width() - height = $(frame).height() - maxWidth = if width > maxWidth then width else maxWidth - maxHeight = if height > maxHeight then height else maxHeight - .css - width: maxWidth - height: maxHeight - - [maxWidth, maxHeight] - - views: - 'two-up': -> - $('.two-up.view .wrap', @file).each (index, wrap) => - $('img', wrap).each -> - currentWidth = $(this).width() - if currentWidth > ImageFile.availWidth / 2 - $(this).width ImageFile.availWidth / 2 - - this.requestImageInfo $('img', wrap), (width, height) -> - $('.image-info .meta-width', wrap).text "#{width}px" - $('.image-info .meta-height', wrap).text "#{height}px" - $('.image-info', wrap).removeClass('hide') - - 'swipe': -> - maxWidth = 0 - maxHeight = 0 - - $('.swipe.view', @file).each (index, view) => - - [maxWidth, maxHeight] = prepareFrames(view) - - $('.swipe-frame', view).css - width: maxWidth + 16 - height: maxHeight + 28 - - $('.swipe-wrap', view).css - width: maxWidth + 1 - height: maxHeight + 2 - - $('.swipe-bar', view).css - left: 0 - .draggable - axis: 'x' - containment: 'parent' - drag: (event) -> - $('.swipe-wrap', view).width (maxWidth + 1) - $(this).position().left - stop: (event) -> - $('.swipe-wrap', view).width (maxWidth + 1) - $(this).position().left - - 'onion-skin': -> - maxWidth = 0 - maxHeight = 0 - - dragTrackWidth = $('.drag-track', @file).width() - $('.dragger', @file).width() - - $('.onion-skin.view', @file).each (index, view) => - - [maxWidth, maxHeight] = prepareFrames(view) - - $('.onion-skin-frame', view).css - width: maxWidth + 16 - height: maxHeight + 28 - - $('.swipe-wrap', view).css - width: maxWidth + 1 - height: maxHeight + 2 - - $('.dragger', view).css - left: dragTrackWidth - .draggable - axis: 'x' - containment: 'parent' - drag: (event) -> - $('.frame.added', view).css('opacity', $(this).position().left / dragTrackWidth) - stop: (event) -> - $('.frame.added', view).css('opacity', $(this).position().left / dragTrackWidth) - - - - requestImageInfo: (img, callback) -> - domImg = img.get(0) - if domImg.complete - callback.call(this, domImg.naturalWidth, domImg.naturalHeight) - else - img.on 'load', => - callback.call(this, domImg.naturalWidth, domImg.naturalHeight) - -this.ImageFile = ImageFile \ No newline at end of file diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js new file mode 100644 index 00000000..b31fe485 --- /dev/null +++ b/app/assets/javascripts/commits.js @@ -0,0 +1,59 @@ +var CommitsList = { + ref:null, + limit:0, + offset:0, + disable:false, + + init: + function(ref, limit) { + $(".day-commits-table li.commit").live('click', function(e){ + if(e.target.nodeName != "A") { + location.href = $(this).attr("url"); + e.stopPropagation(); + return false; + } + }); + + this.ref=ref; + this.limit=limit; + this.offset=limit; + this.initLoadMore(); + $('.loading').show(); + }, + + getOld: + function() { + $('.loading').show(); + $.ajax({ + type: "GET", + url: location.href, + data: "limit=" + this.limit + "&offset=" + this.offset + "&ref=" + this.ref, + complete: function(){ $('.loading').hide()}, + dataType: "script"}); + }, + + append: + function(count, html) { + $("#commits_list").append(html); + if(count > 0) { + this.offset += count; + } else { + this.disable = true; + } + }, + + initLoadMore: + function() { + $(document).endlessScroll({ + bottomPixels: 400, + fireDelay: 1000, + fireOnce:true, + ceaseFire: function() { + return CommitsList.disable; + }, + callback: function(i) { + CommitsList.getOld(); + } + }); + } +} diff --git a/app/assets/javascripts/commits.js.coffee b/app/assets/javascripts/commits.js.coffee deleted file mode 100644 index 47d6fcf8..00000000 --- a/app/assets/javascripts/commits.js.coffee +++ /dev/null @@ -1,54 +0,0 @@ -class CommitsList - @data = - ref: null - limit: 0 - offset: 0 - @disable = false - - @showProgress: -> - $('.loading').show() - - @hideProgress: -> - $('.loading').hide() - - @init: (ref, limit) -> - $(".day-commits-table li.commit").live 'click', (event) -> - if event.target.nodeName != "A" - location.href = $(this).attr("url") - e.stopPropagation() - return false - - @data.ref = ref - @data.limit = limit - @data.offset = limit - - this.initLoadMore() - this.showProgress(); - - @getOld: -> - this.showProgress() - $.ajax - type: "GET" - url: location.href - data: @data - complete: this.hideProgress - dataType: "script" - - @append: (count, html) -> - $("#commits-list").append(html) - if count > 0 - @data.offset += count - else - @disable = true - - @initLoadMore: -> - $(document).endlessScroll - bottomPixels: 400 - fireDelay: 1000 - fireOnce: true - ceaseFire: => - @disable - callback: => - this.getOld() - -this.CommitsList = CommitsList \ No newline at end of file diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee index 4189c90b..f15d09dd 100644 --- a/app/assets/javascripts/dashboard.js.coffee +++ b/app/assets/javascripts/dashboard.js.coffee @@ -1,15 +1,14 @@ window.dashboardPage = -> Pager.init 20, true - initSidebarTab() $(".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") @@ -18,22 +17,11 @@ toggleFilter = (sender) -> 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(",") - -initSidebarTab = -> - key = "dashboard_sidebar_filter" - - # store selection in cookie - $('.dash-sidebar-tabs a').on 'click', (e) -> - $.cookie(key, $(e.target).attr('id')) - - # show tab from cookie - sidebar_filter = $.cookie(key) - $("#" + sidebar_filter).tab('show') if sidebar_filter diff --git a/app/assets/javascripts/extensions/jquery.js.coffee b/app/assets/javascripts/extensions/jquery.js.coffee deleted file mode 100644 index 8a997fe3..00000000 --- a/app/assets/javascripts/extensions/jquery.js.coffee +++ /dev/null @@ -1,9 +0,0 @@ -$.fn.showAndHide = -> - $(@).show(). - delay(3000). - fadeOut() - -$.fn.enableButton = -> - $(@).removeAttr('disabled'). - removeClass('disabled') - diff --git a/app/assets/javascripts/lib/jquery.timeago.js b/app/assets/javascripts/lib/jquery.timeago.js deleted file mode 100644 index cc17aa7d..00000000 --- a/app/assets/javascripts/lib/jquery.timeago.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Timeago is a jQuery plugin that makes it easy to support automatically - * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). - * - * @name timeago - * @version 1.1.0 - * @requires jQuery v1.2.3+ - * @author Ryan McGeary - * @license MIT License - http://www.opensource.org/licenses/mit-license.php - * - * For usage and examples, visit: - * http://timeago.yarp.com/ - * - * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) - */ - -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['jquery'], factory); - } else { - // Browser globals - factory(jQuery); - } -}(function ($) { - $.timeago = function(timestamp) { - if (timestamp instanceof Date) { - return inWords(timestamp); - } else if (typeof timestamp === "string") { - return inWords($.timeago.parse(timestamp)); - } else if (typeof timestamp === "number") { - return inWords(new Date(timestamp)); - } else { - return inWords($.timeago.datetime(timestamp)); - } - }; - var $t = $.timeago; - - $.extend($.timeago, { - settings: { - refreshMillis: 60000, - allowFuture: false, - strings: { - prefixAgo: null, - prefixFromNow: null, - suffixAgo: "ago", - suffixFromNow: "from now", - seconds: "less than a minute", - minute: "about a minute", - minutes: "%d minutes", - hour: "about an hour", - hours: "about %d hours", - day: "a day", - days: "%d days", - month: "about a month", - months: "%d months", - year: "about a year", - years: "%d years", - wordSeparator: " ", - numbers: [] - } - }, - inWords: function(distanceMillis) { - var $l = this.settings.strings; - var prefix = $l.prefixAgo; - var suffix = $l.suffixAgo; - if (this.settings.allowFuture) { - if (distanceMillis < 0) { - prefix = $l.prefixFromNow; - suffix = $l.suffixFromNow; - } - } - - var seconds = Math.abs(distanceMillis) / 1000; - var minutes = seconds / 60; - var hours = minutes / 60; - var days = hours / 24; - var years = days / 365; - - function substitute(stringOrFunction, number) { - var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; - var value = ($l.numbers && $l.numbers[number]) || number; - return string.replace(/%d/i, value); - } - - var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || - seconds < 90 && substitute($l.minute, 1) || - minutes < 45 && substitute($l.minutes, Math.round(minutes)) || - minutes < 90 && substitute($l.hour, 1) || - hours < 24 && substitute($l.hours, Math.round(hours)) || - hours < 42 && substitute($l.day, 1) || - days < 30 && substitute($l.days, Math.round(days)) || - days < 45 && substitute($l.month, 1) || - days < 365 && substitute($l.months, Math.round(days / 30)) || - years < 1.5 && substitute($l.year, 1) || - substitute($l.years, Math.round(years)); - - var separator = $l.wordSeparator || ""; - if ($l.wordSeparator === undefined) { separator = " "; } - return $.trim([prefix, words, suffix].join(separator)); - }, - parse: function(iso8601) { - var s = $.trim(iso8601); - s = s.replace(/\.\d+/,""); // remove milliseconds - s = s.replace(/-/,"/").replace(/-/,"/"); - s = s.replace(/T/," ").replace(/Z/," UTC"); - s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 - return new Date(s); - }, - datetime: function(elem) { - var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); - return $t.parse(iso8601); - }, - isTime: function(elem) { - // jQuery's `is()` doesn't play well with HTML5 in IE - return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); - } - }); - - // functions that can be called via $(el).timeago('action') - // init is default when no action is given - // functions are called with context of a single element - var functions = { - init: function(){ - var refresh_el = $.proxy(refresh, this); - refresh_el(); - var $s = $t.settings; - if ($s.refreshMillis > 0) { - setInterval(refresh_el, $s.refreshMillis); - } - }, - update: function(time){ - $(this).data('timeago', { datetime: $t.parse(time) }); - refresh.apply(this); - } - }; - - $.fn.timeago = function(action, options) { - var fn = action ? functions[action] : functions.init; - if(!fn){ - throw new Error("Unknown function name '"+ action +"' for timeago"); - } - // each over objects here and call the requested function - this.each(function(){ - fn.call(this, options); - }); - return this; - }; - - function refresh() { - var data = prepareData(this); - if (!isNaN(data.datetime)) { - $(this).text(inWords(data.datetime)); - } - return this; - } - - function prepareData(element) { - element = $(element); - if (!element.data("timeago")) { - element.data("timeago", { datetime: $t.datetime(element) }); - var text = $.trim(element.text()); - if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { - element.attr("title", text); - } - } - return element.data("timeago"); - } - - function inWords(date) { - return $t.inWords(distance(date)); - } - - function distance(date) { - return (new Date().getTime() - date.getTime()); - } - - // fix for IE6 suckage - document.createElement("abbr"); - document.createElement("time"); -})); diff --git a/app/assets/javascripts/lib/md5.js b/app/assets/javascripts/lib/md5.js deleted file mode 100644 index b63716ea..00000000 --- a/app/assets/javascripts/lib/md5.js +++ /dev/null @@ -1,211 +0,0 @@ -function md5 (str) { - // http://kevin.vanzonneveld.net - // + original by: Webtoolkit.info (http://www.webtoolkit.info/) - // + namespaced by: Michael White (http://getsprink.com) - // + tweaked by: Jack - // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // + input by: Brett Zamir (http://brett-zamir.me) - // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // - depends on: utf8_encode - // * example 1: md5('Kevin van Zonneveld'); - // * returns 1: '6e658d4bfcb59cc13f96c14450ac40b9' - var xl; - - var rotateLeft = function (lValue, iShiftBits) { - return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); - }; - - var addUnsigned = function (lX, lY) { - var lX4, lY4, lX8, lY8, lResult; - lX8 = (lX & 0x80000000); - lY8 = (lY & 0x80000000); - lX4 = (lX & 0x40000000); - lY4 = (lY & 0x40000000); - lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); - if (lX4 & lY4) { - return (lResult ^ 0x80000000 ^ lX8 ^ lY8); - } - if (lX4 | lY4) { - if (lResult & 0x40000000) { - return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); - } else { - return (lResult ^ 0x40000000 ^ lX8 ^ lY8); - } - } else { - return (lResult ^ lX8 ^ lY8); - } - }; - - var _F = function (x, y, z) { - return (x & y) | ((~x) & z); - }; - var _G = function (x, y, z) { - return (x & z) | (y & (~z)); - }; - var _H = function (x, y, z) { - return (x ^ y ^ z); - }; - var _I = function (x, y, z) { - return (y ^ (x | (~z))); - }; - - var _FF = function (a, b, c, d, x, s, ac) { - a = addUnsigned(a, addUnsigned(addUnsigned(_F(b, c, d), x), ac)); - return addUnsigned(rotateLeft(a, s), b); - }; - - var _GG = function (a, b, c, d, x, s, ac) { - a = addUnsigned(a, addUnsigned(addUnsigned(_G(b, c, d), x), ac)); - return addUnsigned(rotateLeft(a, s), b); - }; - - var _HH = function (a, b, c, d, x, s, ac) { - a = addUnsigned(a, addUnsigned(addUnsigned(_H(b, c, d), x), ac)); - return addUnsigned(rotateLeft(a, s), b); - }; - - var _II = function (a, b, c, d, x, s, ac) { - a = addUnsigned(a, addUnsigned(addUnsigned(_I(b, c, d), x), ac)); - return addUnsigned(rotateLeft(a, s), b); - }; - - var convertToWordArray = function (str) { - var lWordCount; - var lMessageLength = str.length; - var lNumberOfWords_temp1 = lMessageLength + 8; - var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64; - var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16; - var lWordArray = new Array(lNumberOfWords - 1); - var lBytePosition = 0; - var lByteCount = 0; - while (lByteCount < lMessageLength) { - lWordCount = (lByteCount - (lByteCount % 4)) / 4; - lBytePosition = (lByteCount % 4) * 8; - lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount) << lBytePosition)); - lByteCount++; - } - lWordCount = (lByteCount - (lByteCount % 4)) / 4; - lBytePosition = (lByteCount % 4) * 8; - lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); - lWordArray[lNumberOfWords - 2] = lMessageLength << 3; - lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; - return lWordArray; - }; - - var wordToHex = function (lValue) { - var wordToHexValue = "", - wordToHexValue_temp = "", - lByte, lCount; - for (lCount = 0; lCount <= 3; lCount++) { - lByte = (lValue >>> (lCount * 8)) & 255; - wordToHexValue_temp = "0" + lByte.toString(16); - wordToHexValue = wordToHexValue + wordToHexValue_temp.substr(wordToHexValue_temp.length - 2, 2); - } - return wordToHexValue; - }; - - var x = [], - k, AA, BB, CC, DD, a, b, c, d, S11 = 7, - S12 = 12, - S13 = 17, - S14 = 22, - S21 = 5, - S22 = 9, - S23 = 14, - S24 = 20, - S31 = 4, - S32 = 11, - S33 = 16, - S34 = 23, - S41 = 6, - S42 = 10, - S43 = 15, - S44 = 21; - - str = this.utf8_encode(str); - x = convertToWordArray(str); - a = 0x67452301; - b = 0xEFCDAB89; - c = 0x98BADCFE; - d = 0x10325476; - - xl = x.length; - for (k = 0; k < xl; k += 16) { - AA = a; - BB = b; - CC = c; - DD = d; - a = _FF(a, b, c, d, x[k + 0], S11, 0xD76AA478); - d = _FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756); - c = _FF(c, d, a, b, x[k + 2], S13, 0x242070DB); - b = _FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE); - a = _FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF); - d = _FF(d, a, b, c, x[k + 5], S12, 0x4787C62A); - c = _FF(c, d, a, b, x[k + 6], S13, 0xA8304613); - b = _FF(b, c, d, a, x[k + 7], S14, 0xFD469501); - a = _FF(a, b, c, d, x[k + 8], S11, 0x698098D8); - d = _FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF); - c = _FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1); - b = _FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE); - a = _FF(a, b, c, d, x[k + 12], S11, 0x6B901122); - d = _FF(d, a, b, c, x[k + 13], S12, 0xFD987193); - c = _FF(c, d, a, b, x[k + 14], S13, 0xA679438E); - b = _FF(b, c, d, a, x[k + 15], S14, 0x49B40821); - a = _GG(a, b, c, d, x[k + 1], S21, 0xF61E2562); - d = _GG(d, a, b, c, x[k + 6], S22, 0xC040B340); - c = _GG(c, d, a, b, x[k + 11], S23, 0x265E5A51); - b = _GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA); - a = _GG(a, b, c, d, x[k + 5], S21, 0xD62F105D); - d = _GG(d, a, b, c, x[k + 10], S22, 0x2441453); - c = _GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681); - b = _GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8); - a = _GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6); - d = _GG(d, a, b, c, x[k + 14], S22, 0xC33707D6); - c = _GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87); - b = _GG(b, c, d, a, x[k + 8], S24, 0x455A14ED); - a = _GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905); - d = _GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8); - c = _GG(c, d, a, b, x[k + 7], S23, 0x676F02D9); - b = _GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A); - a = _HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942); - d = _HH(d, a, b, c, x[k + 8], S32, 0x8771F681); - c = _HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122); - b = _HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C); - a = _HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44); - d = _HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9); - c = _HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60); - b = _HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70); - a = _HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6); - d = _HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA); - c = _HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085); - b = _HH(b, c, d, a, x[k + 6], S34, 0x4881D05); - a = _HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039); - d = _HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5); - c = _HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8); - b = _HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665); - a = _II(a, b, c, d, x[k + 0], S41, 0xF4292244); - d = _II(d, a, b, c, x[k + 7], S42, 0x432AFF97); - c = _II(c, d, a, b, x[k + 14], S43, 0xAB9423A7); - b = _II(b, c, d, a, x[k + 5], S44, 0xFC93A039); - a = _II(a, b, c, d, x[k + 12], S41, 0x655B59C3); - d = _II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92); - c = _II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D); - b = _II(b, c, d, a, x[k + 1], S44, 0x85845DD1); - a = _II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F); - d = _II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0); - c = _II(c, d, a, b, x[k + 6], S43, 0xA3014314); - b = _II(b, c, d, a, x[k + 13], S44, 0x4E0811A1); - a = _II(a, b, c, d, x[k + 4], S41, 0xF7537E82); - d = _II(d, a, b, c, x[k + 11], S42, 0xBD3AF235); - c = _II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB); - b = _II(b, c, d, a, x[k + 9], S44, 0xEB86D391); - a = addUnsigned(a, AA); - b = addUnsigned(b, BB); - c = addUnsigned(c, CC); - d = addUnsigned(d, DD); - } - - var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); - - return temp.toLowerCase(); -} diff --git a/app/assets/javascripts/lib/utf8_encode.js b/app/assets/javascripts/lib/utf8_encode.js deleted file mode 100644 index 39ffe44d..00000000 --- a/app/assets/javascripts/lib/utf8_encode.js +++ /dev/null @@ -1,70 +0,0 @@ -function utf8_encode (argString) { - // http://kevin.vanzonneveld.net - // + original by: Webtoolkit.info (http://www.webtoolkit.info/) - // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // + improved by: sowberry - // + tweaked by: Jack - // + bugfixed by: Onno Marsman - // + improved by: Yves Sucaet - // + bugfixed by: Onno Marsman - // + bugfixed by: Ulrich - // + bugfixed by: Rafal Kukawski - // + improved by: kirilloid - // + bugfixed by: kirilloid - // * example 1: utf8_encode('Kevin van Zonneveld'); - // * returns 1: 'Kevin van Zonneveld' - - if (argString === null || typeof argString === "undefined") { - return ""; - } - - var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n"); - var utftext = '', - start, end, stringl = 0; - - start = end = 0; - stringl = string.length; - for (var n = 0; n < stringl; n++) { - var c1 = string.charCodeAt(n); - var enc = null; - - if (c1 < 128) { - end++; - } else if (c1 > 127 && c1 < 2048) { - enc = String.fromCharCode( - (c1 >> 6) | 192, - ( c1 & 63) | 128 - ); - } else if (c1 & 0xF800 != 0xD800) { - enc = String.fromCharCode( - (c1 >> 12) | 224, - ((c1 >> 6) & 63) | 128, - ( c1 & 63) | 128 - ); - } else { // surrogate pairs - if (c1 & 0xFC00 != 0xD800) { throw new RangeError("Unmatched trail surrogate at " + n); } - var c2 = string.charCodeAt(++n); - if (c2 & 0xFC00 != 0xDC00) { throw new RangeError("Unmatched lead surrogate at " + (n-1)); } - c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000; - enc = String.fromCharCode( - (c1 >> 18) | 240, - ((c1 >> 12) & 63) | 128, - ((c1 >> 6) & 63) | 128, - ( c1 & 63) | 128 - ); - } - if (enc !== null) { - if (end > start) { - utftext += string.slice(start, end); - } - utftext += enc; - start = end = n + 1; - } - } - - if (end > start) { - utftext += string.slice(start, stringl); - } - - return utftext; -} diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index 39ec86e6..f6c398c0 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -7,8 +7,6 @@ window.slugify = (text) -> window.ajaxGet = (url) -> $.ajax({type: "GET", url: url, dataType: "script"}) -window.showAndHide = (selector) -> - window.errorMessage = (message) -> ehtml = $("

") ehtml.addClass("error_message") @@ -34,22 +32,10 @@ window.disableButtonIfEmptyField = (field_selector, button_selector) -> else closest_submit.enable() -window.sanitize = (str) -> - return str.replace(/<(?:.|\n)*?>/gm, '') - -window.linkify = (str) -> - exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig - return str.replace(exp,"$1") - - $ -> # Click a .one_click_select field, select the contents $(".one_click_select").on 'click', -> $(@).select() - # Click a .appear-link, appear-data fadeout - $(".appear-link").on 'click', -> - $('.appear-data').fadeIn() - # Initialize chosen selects $('select.chosen').chosen() @@ -59,17 +45,11 @@ $ -> # Bottom tooltip $('.has_bottom_tooltip').tooltip(placement: 'bottom') - # Form submitter - $('.trigger-submit').on 'change', -> - $(@).parents('form').submit() - - $("abbr.timeago").timeago() - # Flash - if (flash = $(".flash-container")).length > 0 - flash.click -> $(@).fadeOut() - flash.show() - setTimeout (-> flash.fadeOut()), 3000 + if (flash = $("#flash-container")).length > 0 + flash.click -> $(@).slideUp("slow") + flash.slideDown "slow" + setTimeout (-> flash.slideUp("slow")), 3000 # Disable form buttons while a form is submitting $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) -> diff --git a/app/assets/javascripts/merge_requests.js.coffee b/app/assets/javascripts/merge_requests.js.coffee index 890ca400..9c9cc613 100644 --- a/app/assets/javascripts/merge_requests.js.coffee +++ b/app/assets/javascripts/merge_requests.js.coffee @@ -1,6 +1,6 @@ # # * Filter merge requests -# +# @merge_requestsPage = -> $('#assignee_id').chosen() $('#milestone_id').chosen() @@ -8,16 +8,16 @@ $(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() @@ -27,11 +27,11 @@ class MergeRequest this.$el.find(selector) initMergeWidget: -> - this.showState( @opts.current_status ) - + this.showState( @opts.current_state ) + if this.$('.automerge_widget').length and @opts.check_enable $.get @opts.url_to_automerge_check, (data) => - this.showState( data.merge_status ) + this.showState( data.state ) , 'json' if @opts.ci_enable @@ -42,12 +42,12 @@ class MergeRequest 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')) diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index f5005ec2..8a7e08dd 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -4,15 +4,31 @@ var NoteList = { target_params: null, target_id: 0, target_type: null, + top_id: 0, + bottom_id: 0, + loading_more_disabled: false, + reversed: false, init: function(tid, tt, path) { NoteList.notes_path = path + ".js"; NoteList.target_id = tid; NoteList.target_type = tt; + NoteList.reversed = $("#notes-list").is(".reversed"); NoteList.target_params = "target_type=" + NoteList.target_type + "&target_id=" + NoteList.target_id; NoteList.setupMainTargetNoteForm(); + if(NoteList.reversed) { + var form = $(".js-main-target-form"); + form.find(".buttons, .note_options").hide(); + var textarea = form.find(".js-note-text"); + textarea.css("height", "40px"); + textarea.on("focus", function(){ + textarea.css("height", "80px"); + form.find(".buttons, .note_options").show(); + }); + } + // get initial set of notes NoteList.getContent(); @@ -311,7 +327,7 @@ var NoteList = { /** - * Gets an initial set of notes. + * Gets an inital set of notes. */ getContent: function() { $.ajax({ @@ -328,10 +344,127 @@ var NoteList = { * Replaces the content of #notes-list with the given html. */ setContent: function(newNoteIds, html) { + NoteList.top_id = newNoteIds.first(); + NoteList.bottom_id = newNoteIds.last(); $("#notes-list").html(html); + + // for the wall + if (NoteList.reversed) { + // init infinite scrolling + NoteList.initLoadMore(); + + // init getting new notes + NoteList.initRefreshNew(); + } }, + /** + * Handle loading more notes when scrolling to the bottom of the page. + * The id of the last note in the list is in NoteList.bottom_id. + * + * Set up refreshing only new notes after all notes have been loaded. + */ + + + /** + * Initializes loading more notes when scrolling to the bottom of the page. + */ + initLoadMore: function() { + $(document).endlessScroll({ + bottomPixels: 400, + fireDelay: 1000, + fireOnce:true, + ceaseFire: function() { + return NoteList.loading_more_disabled; + }, + callback: function(i) { + NoteList.getMore(); + } + }); + }, + + /** + * Gets an additional set of notes. + */ + getMore: function() { + // only load more notes if there are no "new" notes + $('.loading').show(); + $.ajax({ + url: NoteList.notes_path, + data: NoteList.target_params + "&loading_more=1&" + (NoteList.reversed ? "before_id" : "after_id") + "=" + NoteList.bottom_id, + complete: function(){ $('.js-notes-busy').removeClass("loading")}, + beforeSend: function() { $('.js-notes-busy').addClass("loading") }, + dataType: "script" + }); + }, + + /** + * Called in response to getMore(). + * Append notes to #notes-list. + */ + appendMoreNotes: function(newNoteIds, html) { + var lastNewNoteId = newNoteIds.last(); + if(lastNewNoteId != NoteList.bottom_id) { + NoteList.bottom_id = lastNewNoteId; + $("#notes-list").append(html); + } + }, + + /** + * Called in response to getMore(). + * Disables loading more notes when scrolling to the bottom of the page. + */ + finishedLoadingMore: function() { + NoteList.loading_more_disabled = true; + + // make sure we are up to date + NoteList.updateVotes(); + }, + + + /** + * Handle refreshing and adding of new notes. + * + * New notes are all notes that are created after the site has been loaded. + * The "old" notes are in #notes-list the "new" ones will be in #new-notes-list. + * The id of the last "old" note is in NoteList.bottom_id. + */ + + + /** + * Initializes getting new notes every n seconds. + * + * Note: only used on wall. + */ + initRefreshNew: function() { + setInterval("NoteList.getNew()", 10000); + }, + + /** + * Gets the new set of notes. + * + * Note: only used on wall. + */ + getNew: function() { + $.ajax({ + url: NoteList.notes_path, + data: NoteList.target_params + "&loading_new=1&after_id=" + (NoteList.reversed ? NoteList.top_id : NoteList.bottom_id), + dataType: "script" + }); + }, + + /** + * Called in response to getNew(). + * Replaces the content of #new-notes-list with the given html. + * + * Note: only used on wall. + */ + replaceNewNotes: function(newNoteIds, html) { + $("#new-notes-list").html(html); + NoteList.updateVotes(); + }, + /** * Adds a single common note to #notes-list. */ @@ -364,6 +497,15 @@ var NoteList = { $.proxy(NoteList.removeDiscussionNoteForm, form).call(); }, + /** + * Adds a single wall note to #new-notes-list. + * + * Note: only used on wall. + */ + appendNewWallNote: function(id, html) { + $("#new-notes-list").prepend(html); + }, + /** * Called in response the main target form has been successfully submitted. * diff --git a/app/assets/javascripts/pager.js b/app/assets/javascripts/pager.js new file mode 100644 index 00000000..7edd6bd6 --- /dev/null +++ b/app/assets/javascripts/pager.js @@ -0,0 +1,56 @@ +var Pager = { + limit:0, + offset:0, + disable:false, + + init: + function(limit, preload) { + this.limit=limit; + + if(preload) { + this.offset = 0; + this.getOld(); + } else { + this.offset = limit; + } + + this.initLoadMore(); + }, + + getOld: + function() { + $('.loading').show(); + $.ajax({ + type: "GET", + url: location.href, + data: "limit=" + this.limit + "&offset=" + this.offset, + complete: function(){ $('.loading').hide()}, + dataType: "script"}); + }, + + append: + function(count, html) { + $(".content_list").append(html); + if(count > 0) { + this.offset += count; + } else { + this.disable = true; + } + }, + + initLoadMore: + function() { + $(document).endlessScroll({ + bottomPixels: 400, + fireDelay: 1000, + fireOnce:true, + ceaseFire: function() { + return Pager.disable; + }, + callback: function(i) { + $('.loading').show(); + Pager.getOld(); + } + }); + } +} diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee deleted file mode 100644 index 5f606acd..00000000 --- a/app/assets/javascripts/pager.js.coffee +++ /dev/null @@ -1,42 +0,0 @@ -@Pager = - limit: 0 - offset: 0 - disable: false - init: (limit, preload) -> - @limit = limit - if preload - @offset = 0 - @getOld() - else - @offset = limit - @initLoadMore() - - getOld: -> - $(".loading").show() - $.ajax - type: "GET" - url: location.href - data: "limit=" + @limit + "&offset=" + @offset - complete: -> - $(".loading").hide() - - dataType: "script" - - append: (count, html) -> - $(".content_list").append html - if count > 0 - @offset += count - else - @disable = true - - initLoadMore: -> - $(document).endlessScroll - bottomPixels: 400 - fireDelay: 1000 - fireOnce: true - ceaseFire: -> - Pager.disable - - callback: (i) -> - $(".loading").show() - Pager.getOld() diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee index 213133bc..42207a39 100644 --- a/app/assets/javascripts/profile.js.coffee +++ b/app/assets/javascripts/profile.js.coffee @@ -15,8 +15,6 @@ $ -> $(this).find('.update-failed').hide() $('.update-username form').on 'ajax:complete', -> - $(this).find('.btn-save').enableButton() + $(this).find('.save-btn').removeAttr('disabled') + $(this).find('.save-btn').removeClass('disabled') $(this).find('.loading-gif').hide() - - $('.update-notifications').on 'ajax:complete', -> - $(this).find('.btn-save').enableButton() diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee index 24106c61..d03a487c 100644 --- a/app/assets/javascripts/projects.js.coffee +++ b/app/assets/javascripts/projects.js.coffee @@ -18,18 +18,3 @@ $ -> # Ref switcher $('.project-refs-select').on 'change', -> $(@).parents('form').submit() - - $('#project_issues_enabled').change -> - if ($(this).is(':checked') == true) - $('#project_issues_tracker').removeAttr('disabled') - else - $('#project_issues_tracker').attr('disabled', 'disabled') - - $('#project_issues_tracker').change() - - $('#project_issues_tracker').change -> - if ($(this).val() == gon.default_issues_tracker || $(this).is(':disabled')) - $('#project_issues_tracker_id').attr('disabled', 'disabled') - else - $('#project_issues_tracker_id').removeAttr('disabled') - diff --git a/app/assets/javascripts/tree.js.coffee b/app/assets/javascripts/tree.js.coffee index 10d0df70..5003f9b0 100644 --- a/app/assets/javascripts/tree.js.coffee +++ b/app/assets/javascripts/tree.js.coffee @@ -6,12 +6,17 @@ $ -> $('span.log_loading:first').removeClass('hide') $('#tree-slider .tree-item-file-name a, .breadcrumb li > a').live "click", -> - $("#tree-content-holder").hide("slide", { direction: "left" }, 400) + $("#tree-content-holder").hide("slide", { direction: "left" }, 150) # Make the entire tree-item row clickable, but not if clicking another link (like a commit message) $("#tree-slider .tree-item").live 'click', (e) -> $('.tree-item-file-name a', this).trigger('click') if (e.target.nodeName != "A") - + + # Show/Hide the loading spinner + $('#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form').live + "ajax:beforeSend": -> $('.tree_progress').addClass("loading") + "ajax:complete": -> $('.tree_progress').removeClass("loading") + # Maintain forward/back history while browsing the file tree ((window) -> History = window.History @@ -28,12 +33,7 @@ $ -> History.Adapter.bind window, 'statechange', -> state = History.getState() - $.ajax({ - url: state.url, - dataType: 'script', - beforeSend: -> $('.tree_progress').addClass("loading"), - complete: -> $('.tree_progress').removeClass("loading") - }) + window.ajaxGet(state.url) )(window) # See if there are lines selected diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee deleted file mode 100644 index f9e523ea..00000000 --- a/app/assets/javascripts/users_select.js.coffee +++ /dev/null @@ -1,36 +0,0 @@ -$ -> - userFormatResult = (user) -> - avatar = gon.gravatar_url - avatar = avatar.replace('%{hash}', md5(user.email)) - avatar = avatar.replace('%{size}', '24') - - markup = "

" - markup += "
" - markup += "
" + user.name + "
" - markup += "
" + user.username + "
" - markup += "
" - markup - - userFormatSelection = (user) -> - user.name - - $('.ajax-users-select').select2 - placeholder: "Search for a user" - multiple: $('.ajax-users-select').hasClass('multiselect') - minimumInputLength: 0 - query: (query) -> - Api.users query.term, (users) -> - data = { results: users } - query.callback(data) - - initSelection: (element, callback) -> - id = $(element).val() - if id isnt "" - Api.user(id, callback) - - - formatResult: userFormatResult - formatSelection: userFormatSelection - dropdownCssClass: "ajax-users-dropdown" - escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results - m diff --git a/app/assets/javascripts/wall.js.coffee b/app/assets/javascripts/wall.js.coffee deleted file mode 100644 index e2fca3dd..00000000 --- a/app/assets/javascripts/wall.js.coffee +++ /dev/null @@ -1,83 +0,0 @@ -@Wall = - note_ids: [] - project_id: null - - init: (project_id) -> - Wall.project_id = project_id - Wall.getContent() - Wall.initRefresh() - Wall.initForm() - - # - # Gets an initial set of notes. - # - getContent: -> - Api.notes Wall.project_id, (notes) -> - $.each notes, (i, note) -> - # render note if it not present in loaded list - # or skip if rendered - if $.inArray(note.id, Wall.note_ids) == -1 - Wall.note_ids.push(note.id) - Wall.renderNote(note) - Wall.scrollDown() - $("abbr.timeago").timeago() - - initRefresh: -> - setInterval("Wall.refresh()", 10000) - - refresh: -> - Wall.getContent() - - scrollDown: -> - notes = $('ul.notes') - $('body, html').scrollTop(notes.height()) - - initForm: -> - form = $('.wall-note-form') - form.find("#target_type").val('wall') - - form.on 'ajax:success', -> - Wall.refresh() - form.find(".js-note-text").val("").trigger("input") - - form.on 'ajax:complete', -> - form.find(".js-comment-button").removeAttr('disabled') - form.find(".js-comment-button").removeClass('disabled') - - form.on "click", ".js-choose-note-attachment-button", -> - form.find(".js-note-attachment-input").click() - - form.on "change", ".js-note-attachment-input", -> - filename = $(this).val().replace(/^.*[\\\/]/, '') - form.find(".js-attachment-filename").text(filename) - - form.find('.note_text').keydown (e) -> - if e.ctrlKey && e.keyCode == 13 - form.find('.js-comment-button').submit() - - form.show() - - renderNote: (note) -> - template = Wall.noteTemplate() - template = template.replace('{{author_name}}', note.author.name) - template = template.replace('{{created_at}}', note.created_at) - template = template.replace('{{text}}', linkify(sanitize(note.body))) - - if note.attachment - file = '' + note.attachment + '' - else - file = '' - template = template.replace('{{file}}', file) - - - $('ul.notes').append(template) - - noteTemplate: -> - return '
  • - {{author_name}} - - {{text}} - {{file}} - - {{created_at}} -
  • ' diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index fd15d5c6..6b500b88 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -5,7 +5,6 @@ *= require jquery.ui.gitlab *= require jquery.atwho *= require chosen - *= require select2 *= require_self */ @@ -15,7 +14,7 @@ @import "gitlab_bootstrap.scss"; @import "common.scss"; -@import "selects.scss"; +@import "ref_select.scss"; @import "sections/header.scss"; @import "sections/nav.scss"; @@ -34,12 +33,9 @@ @import "sections/login.scss"; @import "sections/editor.scss"; @import "sections/admin.scss"; -@import "sections/wiki.scss"; -@import "sections/wall.scss"; @import "highlight/white.scss"; @import "highlight/dark.scss"; -@import "highlight/solarized_dark.scss"; /** * UI themes: diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 4e7aa968..db077048 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1,5 +1,5 @@ html { - overflow-y: scroll; + overflow-y: scroll; } /** LAYOUT **/ @@ -67,17 +67,27 @@ table a code { } /** FLASH message **/ -.flash-container { +#flash-container { + height: 50px; + position: fixed; + z-index: 10001; + top: 0px; + width: 100%; + margin-bottom: 15px; + overflow: hidden; + background: white; + cursor: pointer; + border-bottom: 1px solid #ccc; + text-align: center; display: none; - .alert { - cursor: pointer; - margin: 0; - text-align: center; - border-radius: 0; - span { - font-size: 14px; - } + h4 { + color: #666; + font-size: 18px; + line-height: 38px; + padding-top: 5px; + margin: 2px; + font-weight: normal; } } @@ -173,6 +183,17 @@ ul.breadcrumb { font-weight: bold; font-size: 14px; } + + .arrow { + background: url("images.png") no-repeat -85px -77px; + width: 19px; + height: 16px; + float: left; + position: relative; + left: -10px; + padding: 0; + margin: 0; + } } input[type=text] { @@ -182,6 +203,10 @@ input[type=text] { } } +input.git_clone_url { + width: 325px; +} + .merge-request-form-holder { select { width: 300px; @@ -252,20 +277,8 @@ p.time { } } -.search-holder { - label, input { - height: 30px; - padding: 0; - font-size: 14px; - } - label { - line-height: 30px; - color: #666; - } -} - .highlight_word { - border-bottom: 2px solid #F90; + background: #EEDC94; } .status_info { @@ -313,6 +326,10 @@ li.note { li { border-bottom:none !important; } + .file { + padding-left: 20px; + background:url("icon-attachment.png") no-repeat left center; + } } } @@ -539,19 +556,3 @@ img.emoji { vertical-align: middle; width: 20px; } - -.appear-data { - display: none; -} - -.label-branch { - @include border-radius(4px); - padding: 2px 4px; - border: none; - font-size: 14px; - background: #474D57; - color: #fff; - font-family: $monospace_font; - text-shadow: 0 1px 1px #111; - font-weight: normal; -} diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index 2ad1bf94..f53e0e50 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -17,8 +17,6 @@ $baseLineHeight: 18px !default; @import "gitlab_bootstrap/variables.scss"; @import "gitlab_bootstrap/fonts.scss"; @import "gitlab_bootstrap/mixins.scss"; -@import "gitlab_bootstrap/avatar.scss"; -@import "gitlab_bootstrap/nav.scss"; @import "gitlab_bootstrap/common.scss"; @import "gitlab_bootstrap/typography.scss"; @import "gitlab_bootstrap/buttons.scss"; diff --git a/app/assets/stylesheets/gitlab_bootstrap/avatar.scss b/app/assets/stylesheets/gitlab_bootstrap/avatar.scss deleted file mode 100644 index de1fb155..00000000 --- a/app/assets/stylesheets/gitlab_bootstrap/avatar.scss +++ /dev/null @@ -1,8 +0,0 @@ -/** AVATARS **/ -img.avatar { float: left; margin-right: 12px; width: 40px; border: 1px solid #ddd; padding: 1px; } -img.avatar.s16 { width: 16px; height: 16px; margin-right: 6px; } -img.avatar.s24 { width: 24px; height: 24px; margin-right: 8px; } -img.avatar.s32 { width: 32px; height: 32px; margin-right: 10px; } -img.avatar.s90 { width: 90px; height: 90px; margin-right: 15px; } -img.lil_av { padding-left: 4px; padding-right: 3px; } -img.small { width: 80px; } diff --git a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss index 842e7a08..8cb1c045 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss @@ -20,15 +20,6 @@ background: #FFF; } - &.ui-box-danger { - .title { - @include linear-gradient(#F26E5E, #bd362f); - color: #fff; - text-shadow: 0 1px 1px #900; - font-weight: bold; - } - } - img { max-width: 100%; } pre { @@ -43,6 +34,13 @@ padding: 15px; word-wrap: break-word; + pre { + background: none !important; + margin: 0; + border: none; + padding: 0; + } + .clearfix { margin: 0; } @@ -97,12 +95,7 @@ form { margin-bottom: 0; - margin-top: 0; - } - - .btn { - position: relative; - top: -2px; + margin-top: 3px; } .nav-pills { @@ -151,23 +144,4 @@ text-decoration: underline; } } - - .form-holder { - padding-top: 20px; - form { - margin-bottom: 0; - legend { - text-indent: 10px; - } - .form-actions { - margin-bottom: 0; - } - } - } -} - -.tab-pane { - .ui-box { - margin: 3px 3px 25px 3px; - } } diff --git a/app/assets/stylesheets/gitlab_bootstrap/buttons.scss b/app/assets/stylesheets/gitlab_bootstrap/buttons.scss index 03497e32..674481e2 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/buttons.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/buttons.scss @@ -1,16 +1,17 @@ .btn { - @include linear-gradient(#f1f1f1, #e1e1e1); - text-shadow: 0 1px 1px #FFF; + @include linear-gradient(#f7f7f7, #d5d5d5); border-color: #BBB; - &:hover { - background: #f1f1f1; - @include linear-gradient(#fAfAfA, #f1f1f1); - border-color: #AAA; + @include bg-gray-gradient; + border-color: #bbb; color: #333; } - &.btn-primary { + &.btn-white { + background: #FFF; + } + + &.primary { background: #2a79A3; @include linear-gradient(#47A7b7, #2585b5); border-color: #2A79A3; @@ -57,18 +58,21 @@ } } - &.btn-create { + &.save-btn { @extend .wide; - @extend .success; + @extend .primary; } - &.btn-save { - @extend .wide; - @extend .btn-primary; + &.cancel-btn { + float: right; } - &.btn-close, - &.btn-remove { + &.wide { + padding-left: 30px; + padding-right: 30px; + } + + &.danger { @extend .btn-danger; border-color: #BD362F; @@ -78,13 +82,8 @@ } } - &.btn-cancel { - float: right; - } - - &.wide { - padding-left: 20px; - padding-right: 20px; + &.danger { + @extend .btn-danger; } &.small { @@ -96,7 +95,7 @@ background-color: #ccc; } - &.btn-tiny { + &.very_small { font-size: 11px; padding: 2px 6px; line-height: 16px; diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index 6bdd1652..2b3d14ab 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -2,7 +2,6 @@ .cgray { color:gray } .cred { color:#D12F19 } .cgreen { color:#4a2 } -.cblue { color:#29A } .cblack { color:#111 } .cdark { color:#444 } .cwhite { color:#fff!important } @@ -10,6 +9,7 @@ /** COMMON CLASSES **/ .left { float:left } +.right { float:right!important } .append-bottom-10 { margin-bottom:10px } .append-bottom-20 { margin-bottom:20px } .prepend-top-10 { margin-top:10px } @@ -21,17 +21,80 @@ .hint { font-style: italic; color: #999; } .light { color: #888 } .tiny { font-weight: normal } -.vtop { vertical-align: top; } +/** PILLS & TABS**/ +.nav-pills { + .active a { + background: $primary_color; + } -/** ALERT MESSAGES **/ -.alert.alert-disabled { - background: #EEE; - color: #777; - border-color: #DDD; + > 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; + } + } } -.well { padding: 15px; } +.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 { + > a { + padding: 8px 20px; + margin-right: 7px; + line-height: 20px; + border-color: #EEE; + color: #888; + border-bottom: 1px solid #ddd; + .badge { + background-color: #eee; + color: #888; + text-shadow: 0 1px 1px #fff; + } + i[class^="icon-"] { + line-height: 14px; + } + } + &.active { + > a { + border-color: #CCC; + border-bottom: 1px solid #fff; + color: #333; + } + } + } +} + +/** ALERT MESSAGES **/ +.alert-message { @extend .alert; } +.alert-messag.success { @extend .alert-success; } +.alert-message.error { @extend .alert-error; } + +/** AVATARS **/ +img.avatar { float: left; margin-right: 12px; width: 40px; border: 1px solid #ddd; padding: 1px; } +img.avatar.s16 { width: 16px; height: 16px; margin-right: 6px; } +img.avatar.s24 { width: 24px; height: 24px; margin-right: 8px; } +img.avatar.s32 { width: 32px; height: 32px; margin-right: 10px; } +img.lil_av { padding-left: 4px; padding-right: 3px; } +img.small { width: 80px; } /** HELPERS **/ .nothing_here_message { @@ -73,7 +136,3 @@ fieldset legend { font-size: 17px; } border-bottom: 2px solid $style_color; } } - -.tab-content { - overflow: visible; -} diff --git a/app/assets/stylesheets/gitlab_bootstrap/files.scss b/app/assets/stylesheets/gitlab_bootstrap/files.scss index d0bf3bdd..865a10e1 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/files.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/files.scss @@ -135,7 +135,7 @@ pre { border: none; border-radius: 0; - font-family: $monospace_font; + font-family: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono','lucida console',monospace; font-size: 12px !important; line-height: 16px !important; margin: 0; @@ -162,7 +162,6 @@ color: #666; padding: 10px 6px 10px 0; text-align: right; - background: #EEE; a { color: #666; diff --git a/app/assets/stylesheets/gitlab_bootstrap/fonts.scss b/app/assets/stylesheets/gitlab_bootstrap/fonts.scss index 8cc99864..b4217fa9 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/fonts.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/fonts.scss @@ -1,2 +1,7 @@ +@font-face{ + font-family: Yanone; + src: font-url('YanoneKaffeesatz-Light.ttf'); +} + /** Typo **/ -$monospace_font: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono', 'lucida console', monospace; +$monospace: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono', 'lucida console', monospace; diff --git a/app/assets/stylesheets/gitlab_bootstrap/mixins.scss b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss index 2f83ca0c..9b1e2f2c 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/mixins.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss @@ -24,14 +24,6 @@ background-image: -o-linear-gradient($from, $to); } -@mixin transition($transition) { - -webkit-transition: $transition; - -moz-transition: $transition; - -ms-transition: $transition; - -o-transition: $transition; - transition: $transition; -} - /** * Prefilled mixins * Mixins with fixed values @@ -70,19 +62,8 @@ @mixin header-font { color: $style_color; text-shadow: 0 1px 1px #FFF; - font-size: 18px; - line-height: 40px; + font-family: 'Yanone', sans-serif; + font-size: 26px; + line-height: 42px; font-weight: normal; - letter-spacing: -1px; -} - -@mixin md-typography { - code { padding: 0 4px; } - p { font-size: 13px; } - h1 { font-size: 26px; line-height: 40px; margin: 10px 0;} - h2 { font-size: 22px; line-height: 40px; margin: 10px 0;} - h3 { font-size: 18px; line-height: 40px; margin: 10px 0;} - h4 { font-size: 16px; line-height: 20px; margin: 10px 0;} - h5 { font-size: 14px; line-height: 20px; margin: 10px 0;} - h6 { font-size: 12px; line-height: 20px; margin: 10px 0;} } diff --git a/app/assets/stylesheets/gitlab_bootstrap/nav.scss b/app/assets/stylesheets/gitlab_bootstrap/nav.scss deleted file mode 100644 index 2eaef61c..00000000 --- a/app/assets/stylesheets/gitlab_bootstrap/nav.scss +++ /dev/null @@ -1,65 +0,0 @@ -/** - * nav-pills - * - */ -.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 { - > a { - padding: 8px 20px; - margin-right: 7px; - line-height: 20px; - border-color: #EEE; - color: #888; - border-bottom: 1px solid #ddd; - .badge { - background-color: #eee; - color: #888; - text-shadow: 0 1px 1px #fff; - } - i[class^="icon-"] { - line-height: 14px; - } - } - &.active { - > a { - border-color: #CCC; - border-bottom: 1px solid #fff; - color: #333; - } - } - } - - &.nav-small-tabs > li > a { padding: 6px 9px; } -} diff --git a/app/assets/stylesheets/gitlab_bootstrap/tables.scss b/app/assets/stylesheets/gitlab_bootstrap/tables.scss index f46ae91b..7a9eac82 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/tables.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/tables.scss @@ -11,12 +11,6 @@ table { } } - &.headless { - tr:first-child td{ - border-top: 1px solid #CCC; - } - } - th { font-weight: bold; vertical-align: middle; diff --git a/app/assets/stylesheets/gitlab_bootstrap/typography.scss b/app/assets/stylesheets/gitlab_bootstrap/typography.scss index 1f0c4802..e74a0de1 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/typography.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/typography.scss @@ -21,7 +21,7 @@ h6 { /** CODE **/ pre { - font-family: $monospace_font; + font-family:'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono','lucida console',monospace; &.dark { background: #333; @@ -79,7 +79,7 @@ a:focus { } .monospace { - font-family: $monospace_font; + font-family: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono','lucida console',monospace; } /** @@ -87,15 +87,16 @@ a:focus { * */ .wiki { - @include md-typography; - font-size: 13px; - line-height: 20px; + code { padding: 0 4px; } + p { font-size: 13px; } + h1 { font-size: 32px; line-height: 40px; margin: 10px 0;} + h2 { font-size: 26px; line-height: 40px; margin: 10px 0;} + h3 { font-size: 22px; line-height: 40px; margin: 10px 0;} + h4 { font-size: 18px; line-height: 20px; margin: 10px 0;} + h5 { font-size: 14px; line-height: 20px; margin: 10px 0;} + h6 { font-size: 12px; line-height: 20px; margin: 10px 0;} .white .highlight pre { background: #f5f5f5; } ul { margin: 0 0 9px 25px !important; } } - -.md { - @include md-typography; -} diff --git a/app/assets/stylesheets/gitlab_bootstrap/variables.scss b/app/assets/stylesheets/gitlab_bootstrap/variables.scss index aeabe7ad..869eb168 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/variables.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/variables.scss @@ -1,13 +1,5 @@ -/** - * General Colors - */ +/** Colors **/ $primary_color: #2FA0BB; $link_color: #3A89A3; $style_color: #474D57; $hover: #D9EDF7; - -/** - * Commit Diff Colors - */ -$added: #63c363; -$deleted: #f77; diff --git a/app/assets/stylesheets/highlight/dark.scss b/app/assets/stylesheets/highlight/dark.scss index 4196ea7a..6018ff70 100644 --- a/app/assets/stylesheets/highlight/dark.scss +++ b/app/assets/stylesheets/highlight/dark.scss @@ -1,7 +1,8 @@ .black .highlight { + background-color: #333; pre { - background-color: #333; color: #eee; + background: inherit; } .hll { display: block; background-color: darken($hover, 65%) } diff --git a/app/assets/stylesheets/highlight/solarized_dark.scss b/app/assets/stylesheets/highlight/solarized_dark.scss deleted file mode 100644 index 3f215b4e..00000000 --- a/app/assets/stylesheets/highlight/solarized_dark.scss +++ /dev/null @@ -1,77 +0,0 @@ -.solarized-dark .highlight { - pre { - background-color: #002B36; - color: #eee; - } - - .hll { background-color: #073642 } - .c { color: #586E75 } /* Comment */ - .err { color: #93A1A1 } /* Error */ - .g { color: #93A1A1 } /* Generic */ - .k { color: #859900 } /* Keyword */ - .l { color: #93A1A1 } /* Literal */ - .n { color: #93A1A1 } /* Name */ - .o { color: #859900 } /* Operator */ - .x { color: #CB4B16 } /* Other */ - .p { color: #93A1A1 } /* Punctuation */ - .cm { color: #586E75 } /* Comment.Multiline */ - .cp { color: #859900 } /* Comment.Preproc */ - .c1 { color: #586E75 } /* Comment.Single */ - .cs { color: #859900 } /* Comment.Special */ - .gd { color: #2AA198 } /* Generic.Deleted */ - .ge { color: #93A1A1; font-style: italic } /* Generic.Emph */ - .gr { color: #DC322F } /* Generic.Error */ - .gh { color: #CB4B16 } /* Generic.Heading */ - .gi { color: #859900 } /* Generic.Inserted */ - .go { color: #93A1A1 } /* Generic.Output */ - .gp { color: #93A1A1 } /* Generic.Prompt */ - .gs { color: #93A1A1; font-weight: bold } /* Generic.Strong */ - .gu { color: #CB4B16 } /* Generic.Subheading */ - .gt { color: #93A1A1 } /* Generic.Traceback */ - .kc { color: #CB4B16 } /* Keyword.Constant */ - .kd { color: #268BD2 } /* Keyword.Declaration */ - .kn { color: #859900 } /* Keyword.Namespace */ - .kp { color: #859900 } /* Keyword.Pseudo */ - .kr { color: #268BD2 } /* Keyword.Reserved */ - .kt { color: #DC322F } /* Keyword.Type */ - .ld { color: #93A1A1 } /* Literal.Date */ - .m { color: #2AA198 } /* Literal.Number */ - .s { color: #2AA198 } /* Literal.String */ - .na { color: #93A1A1 } /* Name.Attribute */ - .nb { color: #B58900 } /* Name.Builtin */ - .nc { color: #268BD2 } /* Name.Class */ - .no { color: #CB4B16 } /* Name.Constant */ - .nd { color: #268BD2 } /* Name.Decorator */ - .ni { color: #CB4B16 } /* Name.Entity */ - .ne { color: #CB4B16 } /* Name.Exception */ - .nf { color: #268BD2 } /* Name.Function */ - .nl { color: #93A1A1 } /* Name.Label */ - .nn { color: #93A1A1 } /* Name.Namespace */ - .nx { color: #93A1A1 } /* Name.Other */ - .py { color: #93A1A1 } /* Name.Property */ - .nt { color: #268BD2 } /* Name.Tag */ - .nv { color: #268BD2 } /* Name.Variable */ - .ow { color: #859900 } /* Operator.Word */ - .w { color: #93A1A1 } /* Text.Whitespace */ - .mf { color: #2AA198 } /* Literal.Number.Float */ - .mh { color: #2AA198 } /* Literal.Number.Hex */ - .mi { color: #2AA198 } /* Literal.Number.Integer */ - .mo { color: #2AA198 } /* Literal.Number.Oct */ - .sb { color: #586E75 } /* Literal.String.Backtick */ - .sc { color: #2AA198 } /* Literal.String.Char */ - .sd { color: #93A1A1 } /* Literal.String.Doc */ - .s2 { color: #2AA198 } /* Literal.String.Double */ - .se { color: #CB4B16 } /* Literal.String.Escape */ - .sh { color: #93A1A1 } /* Literal.String.Heredoc */ - .si { color: #2AA198 } /* Literal.String.Interpol */ - .sx { color: #2AA198 } /* Literal.String.Other */ - .sr { color: #DC322F } /* Literal.String.Regex */ - .s1 { color: #2AA198 } /* Literal.String.Single */ - .ss { color: #2AA198 } /* Literal.String.Symbol */ - .bp { color: #268BD2 } /* Name.Builtin.Pseudo */ - .vc { color: #268BD2 } /* Name.Variable.Class */ - .vg { color: #268BD2 } /* Name.Variable.Global */ - .vi { color: #268BD2 } /* Name.Variable.Instance */ - .il { color: #2AA198 } /* Literal.Number.Integer.Long */ -} - diff --git a/app/assets/stylesheets/selects.scss b/app/assets/stylesheets/ref_select.scss similarity index 67% rename from app/assets/stylesheets/selects.scss rename to app/assets/stylesheets/ref_select.scss index 07f7db75..284d1c32 100644 --- a/app/assets/stylesheets/selects.scss +++ b/app/assets/stylesheets/ref_select.scss @@ -1,18 +1,3 @@ -.ajax-users-select { - width: 400px; -} - -.user-result { - .user-image { - float: left; - } - .user-name { - } - .user-username { - color: #999; - } -} - /** Branch/tag selector **/ .project-refs-form { margin: 0; @@ -103,26 +88,3 @@ } } } - -/** Select2 styling **/ -.select2-container .select2-choice { - background: #f1f1f1; - background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, whitesmoke), to(#e1e1e1)); - background-image: -webkit-linear-gradient(whitesmoke 6.6%, #e1e1e1); - background-image: -moz-linear-gradient(whitesmoke 6.6%, #e1e1e1); - background-image: -o-linear-gradient(whitesmoke 6.6%, #e1e1e1); -} - -.select2-container .select2-choice div { - border: none; - background: none; -} - -.select2-drop { - padding-top: 8px; -} - -.select2-no-results, .select2-searching { - padding: 7px; - color: #666; -} diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index 1e564188..c60aae49 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -1,5 +1,7 @@ /** - * Commit file + * + * COMMIT SHOw + * */ .commit-committer-link, .commit-author-link { @@ -10,11 +12,11 @@ } } -.file { +.diff_file { border: 1px solid #CCC; margin-bottom: 1em; - .header { + .diff_file_header { @extend .clearfix; padding: 5px 5px 5px 10px; color: #555; @@ -26,35 +28,32 @@ background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); - a{ - color: $style_color; - } - > span { - font-family: $monospace_font; + font-family: $monospace; font-size: 14px; line-height: 30px; } - a.view-file{ + a.view-commit{ font-weight: bold; } .commit-short-id{ - font-family: $monospace_font; + font-family: $monospace; font-size: smaller; } .file-mode{ - font-family: $monospace_font; + font-family: $monospace; } } - .content { + .diff_file_content { overflow: auto; overflow-y: hidden; - background: #FFF; + background: #fff; color: #333; font-size: 12px; + font-family: $monospace; .old{ span.idiff{ background-color: #FAA; @@ -67,277 +66,117 @@ } table { - font-family: $monospace_font; - border: none; - margin: 0px; - padding: 0px; td { line-height: 18px; + } + } + } + .diff_file_content_image { + background: #eee; + text-align: center; + .image { + display: inline-block; + margin: 50px; + max-width: 400px; + + img{ + background: url('trans_bg.gif'); + } + + &.diff_removed { + img{ + border: 1px solid #C00; + } + } + + &.diff_added { + img{ + border: 1px solid #0C0; + } + } + + .image-info{ + margin: 5px 0 0 0; + } + } + + &.img_compared { + .image { + max-width: 300px; + } + } + } +} + +.diff_file_content{ + table { + border: none; + margin: 0px; + padding: 0px; + tr { + td { font-size: 12px; } } - .old_line, .new_line { - margin: 0px; - padding: 0px; - border: none; - background: #EEE; - color: #666; - padding: 0px 5px; - border-right: 1px solid #ccc; - text-align: right; - min-width: 35px; - max-width: 35px; + } + .new_line, + .old_line, + .notes_line { + margin:0px; + padding:0px; + border:none; + background:#EEE; + color:#666; + padding: 0px 5px; + border-right: 1px solid #ccc; + text-align: right; + min-width: 35px; + max-width: 35px; + width: 35px; + moz-user-select: none; + -khtml-user-select: none; + user-select: none; + + a { + float: left; width: 35px; - @include user-select(none); - a { - float: left; - width: 35px; - font-weight: normal; - color: #666; - &:hover { - text-decoration: underline; - } - } - } - .line_content { - display: block; - white-space: pre; - height: 18px; - margin: 0px; - padding: 0px; - border: none; - &.new { - background: #CFD; - } - &.old { - background: #FDD; - } - &.matched { - color: #ccc; - background: #fafafa; - } - } - } - .image { - background: #ddd; - text-align: center; - padding: 30px; - .wrap{ - display: inline-block; - } - - .frame { - display: inline-block; - background-color: #fff; - line-height: 0; - img{ - border: 1px solid #FFF; - background: url('trans_bg.gif'); - } - &.deleted { - border: 1px solid $deleted; - } - - &.added { - border: 1px solid $added; - } - } - .image-info{ - font-size: 12px; - margin: 5px 0 0 0; - color: grey; - } - - .view.swipe{ - position: relative; - - .swipe-frame{ - display: block; - margin: auto; - position: relative; - } - .swipe-wrap{ - overflow: hidden; - border-left: 1px solid #999; - position: absolute; - display: block; - top: 13px; - right: 7px; - } - .frame{ - top: 0; - right: 0; - position: absolute; - &.deleted{ - margin: 0; - display: block; - top: 13px; - right: 7px; - } - } - .swipe-bar{ - display: block; - height: 100%; - width: 15px; - z-index: 100; - position: absolute; - cursor: pointer; - &:hover{ - .top-handle{ - background-position: -15px 3px; - } - .bottom-handle{ - background-position: -15px -11px; - } - }; - .top-handle{ - display: block; - height: 14px; - width: 15px; - position: absolute; - top: 0px; - background: url('swipemode_sprites.gif') 0 3px no-repeat; - } - .bottom-handle{ - display: block; - height: 14px; - width: 15px; - position: absolute; - bottom: 0px; - background: url('swipemode_sprites.gif') 0 -11px no-repeat; - } - } - } //.view.swipe - .view.onion-skin{ - .onion-skin-frame{ - display: block; - margin: auto; - position: relative; - } - .frame.added, .frame.deleted { - position: absolute; - display: block; - top: 0px; - left: 0px; - } - .controls{ - display: block; - height: 14px; - width: 300px; - z-index: 100; - position: absolute; - bottom: 0px; - left: 50%; - margin-left: -150px; - - .drag-track{ - display: block; - position: absolute; - left: 12px; - height: 10px; - width: 276px; - background: url('onion_skin_sprites.gif') -4px -20px repeat-x; - } - - .dragger { - display: block; - position: absolute; - left: 0px; - top: 0px; - height: 14px; - width: 14px; - background: url('onion_skin_sprites.gif') 0px -34px repeat-x; - cursor: pointer; - } - - .transparent { - display: block; - position: absolute; - top: 2px; - right: 0px; - height: 10px; - width: 10px; - background: url('onion_skin_sprites.gif') -2px 0px no-repeat; - } - - .opaque { - display: block; - position: absolute; - top: 2px; - left: 0px; - height: 10px; - width: 10px; - background: url('onion_skin_sprites.gif') -2px -10px no-repeat; - } - } - } //.view.onion-skin - } - .view-modes{ - - padding: 10px; - text-align: center; - - background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf)); - background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); - - ul, li{ - list-style: none; - margin: 0; - padding: 0; - display: inline-block; - } - - li{ - color: grey; - border-left: 1px solid #c1c1c1; - padding: 0 12px 0 16px; - cursor: pointer; - &:first-child{ - border-left: none; - } - &:hover{ + font-weight: normal; + color: #666; + &:hover { text-decoration: underline; } - &.active{ - &:hover{ - text-decoration: none; - } - cursor: default; - color: #333; - } - &.disabled{ - display: none; - } + } + } + .line_content { + white-space: pre; + height: 14px; + margin: 0px; + padding: 0px; + border: none; + &.new { + background: #CFD; + } + &.old { + background: #FDD; + } + &.matched { + color: #ccc; + background: #fafafa; } } } /** COMMIT BLOCK **/ -.commit-title{ - display: block; -} -.commit-title{ - margin-bottom: 10px; -} -.commit-author, .commit-committer{ - display: block; - color: #999; - font-weight: normal; - font-style: italic; -} -.commit-author strong, .commit-committer strong{ - font-weight: bold; - font-style: normal; -} +.commit-title{display: block;} +.commit-title{margin-bottom: 10px} +.commit-author, .commit-committer{display: block;color: #999; font-weight: normal; font-style: italic;} +.commit-author strong, .commit-committer strong{font-weight: bold; font-style: normal;} -/** - * COMMIT ROW - */ +/** COMMIT ROW **/ .commit { .browse_code_link_holder { + @extend .span2; float: right; } @@ -360,10 +199,11 @@ float: left; @extend .lined; min-width: 65px; - font-family: $monospace_font; + font-family: $monospace; } } +.diff_file_header a, .file-stats a { color: $style_color; } @@ -397,7 +237,7 @@ font-size: 13px; background: #474D57; color: #fff; - font-family: $monospace_font; + font-family: $monospace; } @@ -413,9 +253,3 @@ padding: 4px; background-color: #EEE; } - -.commit-description { - background: none; - border: none; - margin: 0; -} diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index 94e1d0b6..7472cb09 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -48,24 +48,17 @@ color: #666; } .event-note { + padding-top: 5px; + padding-left: 5px; + display: inline-block; color: #555; - margin-top: 5px; - margin-left: 40px; - - .note-file-attach { - .note-image-attach { - margin-top: 4px; - margin-left: 0px; - max-width: 200px; - } - } } .event-note-icon { color: #777; float: left; font-size: 16px; - line-height: 16px; - margin-right: 5px; + line-height: 18px; + margin: 5px; } } .avatar { @@ -134,7 +127,7 @@ .btn-new-mr { @extend .btn-info; @extend .small; - @extend .pull-right; + @extend .right; margin: -3px; } } diff --git a/app/assets/stylesheets/sections/graph.scss b/app/assets/stylesheets/sections/graph.scss index 7da00719..5800098a 100644 --- a/app/assets/stylesheets/sections/graph.scss +++ b/app/assets/stylesheets/sections/graph.scss @@ -12,7 +12,7 @@ .graph { background: #f1f1f1; cursor: move; - height: 500px; + height: 70%; overflow: hidden; } } diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss index 14e4cef0..048a3ffc 100644 --- a/app/assets/stylesheets/sections/header.scss +++ b/app/assets/stylesheets/sections/header.scss @@ -5,16 +5,15 @@ header { &.navbar-gitlab { .navbar-inner { - height: 40px; - padding: 3px; + height: 45px; + padding: 5px; background: #F1F1F1; - filter: none; .nav > li > a { color: $style_color; text-shadow: 0 1px 0 #fff; - font-size: 16px; - padding: 10px; + font-size: 18px; + padding: 11px; } /** NAV block with links and profile **/ @@ -26,6 +25,7 @@ header { } z-index: 10; + /*height: 60px;*/ /** * @@ -34,7 +34,7 @@ header { */ .app_logo { float: left; - margin-right: 9px; + margin-right: 15px; position: relative; top: -5px; padding-top: 5px; @@ -42,11 +42,10 @@ header { a { float: left; padding: 0px; - margin: 0 6px; + margin: 0 10px; h1 { - background: url('logo-black.png') no-repeat center 1px; - background-size: 38px; + background: url('logo_dark.png') no-repeat 0px 2px; float: left; height: 40px; width: 40px; @@ -68,27 +67,19 @@ header { position: relative; float: left; margin: 0; - margin-left: 10px; + margin-left: 15px; @include header-font; } - .profile-pic { - position: relative; - top: -4px; - img { - width: 26px; - @include border-radius(4px); - } - } - /** * * Search box * */ .search { - margin-right: 10px; + margin-right: 45px; margin-left: 10px; + margin-top: 2px; .search-input { @extend .span2; @@ -100,13 +91,121 @@ header { @include border-radius(3px); border: 1px solid #c6c6c6; box-shadow: none; - @include transition(all 0.15s ease-in 0s); &:focus { @extend .span3; } } } + /** + * + * Account box + * + */ + .account-box { + position: absolute; + right: 0; + top: 6px; + z-index: 10000; + width: 128px; + font-size: 11px; + float: right; + display: block; + cursor: pointer; + img { + @include border-radius(3px); + right: 5px; + position: absolute; + width: 28px; + height: 28px; + display: block; + top: 1px; + &:after { + content: " "; + display: block; + position: absolute; + top: 0; + right: 0; + left: 0; + bottom: 0; + float: right; + @include border-radius(5px); + border: 1px solid rgba(255, 255, 255, 0.1); + border-bottom: 0; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255, 255, 255, 0.15)), to(rgba(0, 0, 0, 0.25))), + -webkit-gradient(linear, left top, right bottom, color-stop(0, rgba(255, 255, 255, 0)), color-stop(0.5, rgba(255, 255, 255, 0.1)), color-stop(0.501, rgba(255, 255, 255, 0)), color-stop(1, rgba(255, 255, 255, 0))); + background: -moz-linear-gradient(top, rgba(255, 255, 255, 0.15), rgba(0, 0, 0, 0.25)), + -moz-linear-gradient(left top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0)); + background: linear-gradient(top, rgba(255, 255, 255, 0.15), rgba(0, 0, 0, 0.25)), + linear-gradient(left top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0)); + -webkit-background-origin: border-box; + -moz-background-origin: border; + background-origin: border-box; } } } + + .account-box { + &.hover { + height: 138px; } + &:hover > .account-links { + display: block; } } + + .account-links { + @include border-radius(5px); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); + position: relative; + &:before { + content: "."; + width: 0; + height: 0; + position: absolute; + border: 5px solid transparent; + border-color: rgba(255, 255, 255, 0); + border-bottom-color: #555; + text-indent: -9999px; + top: -10px; + line-height: 0; + right: 10px; + z-index: 10; } + background: #555; + display: none; + z-index: 100000; + @include border-radius(4px); + width: 130px; + position: absolute; + right: 5px; + top: 38px; + margin-top: 0; + float: right; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); + a { + color: #fff; + padding: 12px 15px; + display: block; + text-shadow: none; + border-bottom: 1px solid #666; + font-size: 12px; + &:hover { + color: #fff; + background: #333; + } + } + } + + .account-box.hover .arrow-up { + top: 41px; + right: 6px; + position: absolute; } + + .account-links a { + &:first-child { + @include border-radius(5px 5px 0 0); + } + &:last-child { + @include border-radius(0 0 5px 5px); + border-bottom: 0; + } + } + + /* * Dark header @@ -129,7 +228,6 @@ header { .search-input { background-color: #D2D5DA; background-color: rgba(255, 255, 255, 0.5); - border: 1px solid #AAA; &:focus { background-color: white; @@ -142,17 +240,13 @@ header { .app_logo { a { h1 { - background: url('logo-white.png') no-repeat center 1px; - background-size: 38px; + background: url('logo_white.png') no-repeat center center; color: #fff; text-shadow: 0 1px 1px #111; } } } .project_name { - a { - color: #FFF; - } color: #fff; text-shadow: 0 1px 1px #111; } @@ -167,11 +261,11 @@ header { .separator { float: left; - height: 46px; + height: 60px; width: 1px; background: white; border-left: 1px solid #DDD; - margin-top: -3px; + margin-top: -10px; margin-left: 10px; margin-right: 10px; } diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss index e3fe0b43..7536abff 100644 --- a/app/assets/stylesheets/sections/login.scss +++ b/app/assets/stylesheets/sections/login.scss @@ -1,7 +1,7 @@ /* Login Page */ -body.login-page{ - background: #EEE; - .container .content { padding-top: 5%; } +body.login-page{ + padding-top: 10%; + background: #f1f1f1; } .login-box{ diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index 4cca0083..5225a242 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -70,6 +70,16 @@ li.merge_request { @extend .append-bottom-10; } +.label_branch { + @include border-radius(4px); + padding: 2px 4px; + border: none; + font-size: 14px; + background: #474D57; + color: #fff; + font-family: 'Menlo', 'Liberation Mono', 'Consolas', 'Courier New', 'andale mono','lucida console',monospace; +} + .mr_source_commit, .mr_target_commit { .commit { diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss index 514b0b7c..bc19bc75 100644 --- a/app/assets/stylesheets/sections/nav.scss +++ b/app/assets/stylesheets/sections/nav.scss @@ -1,64 +1,70 @@ -.main-nav { +/* + * Main Menu of Application + * + */ +ul.main_menu { + margin: auto; margin: 30px 0; margin-top: 10px; - border-bottom: 1px solid #E1E1E1; - - ul { - margin: auto; - height: 39px; + border-bottom: 1px solid #DDD; + height: 37px; + position: relative; + overflow: hidden; + .count { position: relative; - top: 3px; - overflow: hidden; - .count { - position: relative; - top: -1px; - display: inline-block; - height: 15px; - margin: 0 0 0 5px; - padding: 0 8px 1px 8px; - height: auto; - font-size: 0.82em; - line-height: 14px; - text-align: center; - color: #777; - } - .label { - background: $hover; - text-shadow: none; - color: $style_color; - } - li { - list-style-type: none; - margin: 0; - display: table-cell; - width: 1%; - &.active { - border-bottom: 3px solid #777; - a { - color: $style_color; - font-weight: bolder; - } + top: -1px; + display: inline-block; + height: 15px; + margin: 0 0 0 5px; + padding: 0 8px 1px 8px; + height: auto; + font-size: 0.82em; + line-height: 14px; + text-align: center; + color: #777; + } + .label { + background: $hover; + text-shadow: none; + color: $style_color; + } + li { + list-style-type: none; + margin: 0; + display: table-cell; + width: 1%; + &.active { + border-bottom: 2px solid #474D57; + a { + color: $style_color; } + } - &.home { - a { - i { - font-size: 20px; - position: relative; - top: 4px; - } + &.home { + a { + background: url(home_icon.PNG) no-repeat center center; + text-indent:-9999px; + min-width: 20px; + img { + position: relative; + top: 4px; } } } - a { - display: block; - text-align: center; - font-weight: normal; - height: 36px; - line-height: 34px; - color: #777; - text-shadow: 0 1px 1px white; - padding: 0 10px; - } + } + a { + display: block; + text-align: center; + font-weight: normal; + height: 35px; + line-height: 36px; + color: #777; + text-shadow: 0 1px 1px white; + padding: 0 10px; } } +/* + * End of Main Menu + * + */ + diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index a8628fc5..a7fadd4f 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -40,13 +40,13 @@ ul.notes { .discussion-body { margin-left: 50px; - .file, + .diff_file, .discussion-hidden, .notes { @extend .borders; background-color: #F9F9F9; } - .file .notes { + .diff_file .notes { /* reset */ background: inherit; border: none; @@ -81,9 +81,16 @@ ul.notes { .attachment { font-size: 14px; margin-top: -20px; + + .icon-attachment { + @extend .icon-paper-clip; + font-size: 24px; + position: relative; + text-align: right; + top: 6px; + } } .note-body { - @include md-typography; margin-left: 45px; } .note-header { @@ -102,7 +109,7 @@ ul.notes { } } -.file .notes_holder { +.diff_file .notes_holder { font-family: $sansFontFamily; font-size: 13px; line-height: 18px; @@ -127,6 +134,8 @@ ul.notes { } } + + /** * Actions for Discussions/Notes */ @@ -162,7 +171,7 @@ ul.notes { } } } -.file .note .note-actions { +.diff_file .note .note-actions { right: 0; top: 0; } @@ -173,7 +182,7 @@ ul.notes { * Line note button on the side of diffs */ -.file tr.line_holder { +.diff_file tr.line_holder { .add-diff-note { background: url("diff_note_add.png") no-repeat left 0; height: 22px; @@ -192,7 +201,7 @@ ul.notes { } } - // "show" the icon also if we just hover somewhere over the line + // "show" the icon also if we just hover somwhere over the line &:hover > td { background: $hover !important; @@ -203,25 +212,25 @@ ul.notes { } } + + /** * Note Form */ -.comment-btn { - @extend .btn-create; -} +.comment-btn, .reply-btn { - @extend .btn-primary; + @extend .save-btn; } -.file .content tr.line_holder:hover > td { background: $hover !important; } -.file .content tr.line_holder:hover > td .line_note_link { - opacity: 1.0; - filter: alpha(opacity=100); -} -.file, +.diff_file, .discussion { .new_note { margin: 8px 5px 8px 0; + + .note_options { + // because of the smaller width and the extra "cancel" button + margin-top: 8px; + } } } .new_note { @@ -234,6 +243,37 @@ ul.notes { .clearfix { margin-bottom: 0; } + .note_options { + h6 { + @extend .left; + line-height: 20px; + padding-right: 16px; + padding-bottom: 16px; + } + label { + padding: 0; + } + + .attachment { + @extend .right; + position: relative; + width: 350px; + height: 50px; + margin:0 0 5px !important; + + // hide the actual file field + input { + display: none; + } + + .choose-btn { + float: right; + } + } + .notify_options { + @extend .right; + } + } .note_text_and_preview { // makes the "absolute" position for links relative to this position: relative; @@ -272,30 +312,3 @@ ul.notes { @extend .thumbnail; margin-left: 45px; } - - -.common-note-form { - margin: 0; - height: 140px; - background: #F9F9F9; - padding: 3px; - padding-bottom: 25px; - border: 1px solid #DDD; -} - - -.note-form-actions { - background: #F9F9F9; - height: 45px; - padding: 0 5px; - - .note-form-option { - margin-top: 10px; - margin-left: 30px; - @extend .pull-left; - } - - .js-notify-commit-author { - float: left; - } -} diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index b6b1423e..4bdc56d2 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -4,10 +4,10 @@ } .side { - @extend .pull-right; + @extend .right; - .ui-box { - margin: 3px; + .groups_box, + .projects_box { > .title { padding: 2px 15px; } @@ -81,7 +81,6 @@ border: 1px solid #BBB; box-shadow: none; margin-left: -1px; - background: #FFF; } } @@ -117,20 +116,3 @@ ul.nav.nav-projects-tabs { } } } - -.team_member_row form { - margin: 0px; -} - -.public-projects { - li { - margin-top: 8px; - margin-bottom: 5px; - border-bottom: 1px solid #eee; - - .description { - margin-left: 22px; - color: #aaa; - } - } -} diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss index def440c7..0ba68e50 100644 --- a/app/assets/stylesheets/sections/tree.scss +++ b/app/assets/stylesheets/sections/tree.scss @@ -102,7 +102,3 @@ } } -.tree-ref-holder { - float: left; - margin-top: 5px; -} diff --git a/app/assets/stylesheets/sections/wall.scss b/app/assets/stylesheets/sections/wall.scss deleted file mode 100644 index d6ac08fc..00000000 --- a/app/assets/stylesheets/sections/wall.scss +++ /dev/null @@ -1,55 +0,0 @@ -.wall-page { - .wall-note-form { - @extend .span12; - - margin: 0; - height: 140px; - background: #F9F9F9; - position: fixed; - bottom: 0px; - padding: 3px; - padding-bottom: 25px; - border: 1px solid #DDD; - } - - .notes { - margin-bottom: 160px; - background: #FFE; - border: 1px solid #EED; - - > li { - @extend .clearfix; - border-bottom: 1px solid #EED; - padding: 10px; - } - - .wall-author { - color: #666; - float: left; - font-size: 12px; - width: 120px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - } - - .wall-text { - border-left: 1px solid #CCC; - margin-left: 10px; - padding-left: 10px; - float: left; - width: 75%; - } - - .wall-file { - margin-left: 8px; - background: #EEE; - } - - abbr { - float: right; - color: #AAA; - border: none; - } - } -} diff --git a/app/assets/stylesheets/sections/wiki.scss b/app/assets/stylesheets/sections/wiki.scss deleted file mode 100644 index 175911d7..00000000 --- a/app/assets/stylesheets/sections/wiki.scss +++ /dev/null @@ -1,6 +0,0 @@ -h3.page_title .edit-wiki-header { - width: 780px; - margin-left: auto; - margin-right: auto; - padding-right: 7px; -} diff --git a/app/assets/stylesheets/themes/ui_mars.scss b/app/assets/stylesheets/themes/ui_mars.scss index a2b8c21e..0a78c5c0 100644 --- a/app/assets/stylesheets/themes/ui_mars.scss +++ b/app/assets/stylesheets/themes/ui_mars.scss @@ -8,27 +8,66 @@ * */ .ui_mars { + /* * Application Header * */ header { - @extend .header-dark; + &.navbar-gitlab { .navbar-inner { - background: #474D57; - border-bottom: 1px solid #373D47; - .app_logo { - &:hover { - background-color: #373D47; - } + background: #474D57 url('bg-header.png') repeat-x bottom; + border-bottom: 1px solid #444; + + .nav > li > a { + color: #eee; + text-shadow: 0 1px 0 #444; } } } - .separator { - background: #31363E; - border-left: 1px solid #666; + .search { + float: right; + margin-right: 45px; + .search-input { + border: 1px solid rgba(0, 0, 0, 0.7); + background-color: #D2D5DA; + background-color: rgba(255, 255, 255, 0.5); + + &:focus { + background-color: white; + } + } + } + .search-input::-webkit-input-placeholder { + color: #666; + } + .app_logo { + a { + h1 { + background: url('logo_white.png') no-repeat center center; + color: #eee; + text-shadow: 0 1px 1px #111; + } + } + &: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/contexts/commit_load_context.rb b/app/contexts/commit_load_context.rb index 2cf5420d..1f23f633 100644 --- a/app/contexts/commit_load_context.rb +++ b/app/contexts/commit_load_context.rb @@ -12,6 +12,7 @@ class CommitLoadContext < BaseContext commit = project.repository.commit(params[:id]) if commit + commit = CommitDecorator.decorate(commit) line_notes = project.notes.for_commit_id(commit.id).inline result[:commit] = commit diff --git a/app/contexts/issues_list_context.rb b/app/contexts/issues_list_context.rb index 0765b30c..0cc73f99 100644 --- a/app/contexts/issues_list_context.rb +++ b/app/contexts/issues_list_context.rb @@ -7,13 +7,12 @@ class IssuesListContext < BaseContext @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.assigned(current_user) - when issues_filter[:by_me] then @project.issues.authored(current_user) + 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) + @issues = @issues.includes(:author, :project).order("updated_at") # Filter by specific assignee_id (or lack thereof)? if params[:assignee_id].present? diff --git a/app/contexts/merge_requests_load_context.rb b/app/contexts/merge_requests_load_context.rb index fde04085..4ec66cd9 100644 --- a/app/contexts/merge_requests_load_context.rb +++ b/app/contexts/merge_requests_load_context.rb @@ -14,7 +14,7 @@ class MergeRequestsLoadContext < BaseContext end merge_requests = merge_requests.page(params[:page]).per(20) - merge_requests = merge_requests.includes(:author, :project).order("created_at desc") + 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? diff --git a/app/contexts/notes/create_context.rb b/app/contexts/notes/create_context.rb index 36ea76ff..1367dff4 100644 --- a/app/contexts/notes/create_context.rb +++ b/app/contexts/notes/create_context.rb @@ -3,6 +3,8 @@ module Notes def execute note = project.notes.new(params[:note]) note.author = current_user + note.notify = params[:notify].present? + note.notify_author = params[:notify_author].present? note.save note end diff --git a/app/contexts/notes/load_context.rb b/app/contexts/notes/load_context.rb index 234e9ac3..e3875e1d 100644 --- a/app/contexts/notes/load_context.rb +++ b/app/contexts/notes/load_context.rb @@ -3,6 +3,8 @@ module Notes 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 @@ -14,6 +16,17 @@ module Notes project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh when "snippet" project.snippets.find(target_id).notes.fresh + when "wall" + # this is the only case, where the order is DESC + project.notes.common.inc_author_project.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 end diff --git a/app/contexts/projects/create_context.rb b/app/contexts/projects/create_context.rb index 56c4e1c5..e644d89a 100644 --- a/app/contexts/projects/create_context.rb +++ b/app/contexts/projects/create_context.rb @@ -32,26 +32,16 @@ module Projects @project.namespace_id = current_user.namespace_id end - # Disable less important features by default - @project.wall_enabled = false - @project.snippets_enabled = false + Project.transaction do + @project.creator = current_user + @project.save! - @project.creator = current_user + # Add user as project master + @project.users_projects.create!(project_access: UsersProject::MASTER, user: current_user) - # Import project from cloneable resource - if @project.valid? && @project.import_url.present? - shell = Gitlab::Shell.new - if shell.import_repository(@project.path_with_namespace, @project.import_url) - # We should create satellite for imported repo - @project.satellite.create unless @project.satellite.exists? - true - else - @project.errors.add(:import_url, 'cannot clone repo') - end - end - - if @project.save - @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user) + # when project saved no team member exist so + # project repository should be updated after first user add + @project.update_repository end @project diff --git a/app/contexts/projects/transfer_context.rb b/app/contexts/projects/transfer_context.rb deleted file mode 100644 index aed396a5..00000000 --- a/app/contexts/projects/transfer_context.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Projects - class TransferContext < BaseContext - 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 - - rescue ProjectTransferService::TransferError => ex - project.reload - project.errors.add(:namespace_id, ex.message) - false - end - end -end - diff --git a/app/contexts/projects/update_context.rb b/app/contexts/projects/update_context.rb index 40385fa6..e5d09b7d 100644 --- a/app/contexts/projects/update_context.rb +++ b/app/contexts/projects/update_context.rb @@ -1,8 +1,24 @@ module Projects class UpdateContext < BaseContext def execute(role = :default) - params[:project].delete(:namespace_id) + namespace_id = params[:project].delete(:namespace_id) params[:project].delete(:public) unless can?(current_user, :change_public_mode, project) + + 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 end diff --git a/app/contexts/test_hook_context.rb b/app/contexts/test_hook_context.rb index 63eda6c7..d2d82a52 100644 --- a/app/contexts/test_hook_context.rb +++ b/app/contexts/test_hook_context.rb @@ -1,7 +1,8 @@ class TestHookContext < BaseContext def execute hook = project.hooks.find(params[:id]) - data = GitPushService.new.sample_data(project, current_user) + 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 end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 3c27b861..f97c56b0 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -1,4 +1,4 @@ -class Admin::DashboardController < Admin::ApplicationController +class Admin::DashboardController < AdminController def index @projects = Project.order("created_at DESC").limit(10) @users = User.order("created_at DESC").limit(10) diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index f552fb59..90dbda3e 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -1,4 +1,4 @@ -class Admin::GroupsController < Admin::ApplicationController +class Admin::GroupsController < AdminController before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :project_teams_update] def index diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb index c5bf76f8..91a1d633 100644 --- a/app/controllers/admin/hooks_controller.rb +++ b/app/controllers/admin/hooks_controller.rb @@ -1,4 +1,4 @@ -class Admin::HooksController < Admin::ApplicationController +class Admin::HooksController < AdminController def index @hooks = SystemHook.all @hook = SystemHook.new diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb index b999018d..28c321a9 100644 --- a/app/controllers/admin/logs_controller.rb +++ b/app/controllers/admin/logs_controller.rb @@ -1,2 +1,2 @@ -class Admin::LogsController < Admin::ApplicationController +class Admin::LogsController < AdminController end diff --git a/app/controllers/admin/projects/application_controller.rb b/app/controllers/admin/projects/application_controller.rb deleted file mode 100644 index b3f1539f..00000000 --- a/app/controllers/admin/projects/application_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Provides a base class for Admin controllers to subclass -# -# Automatically sets the layout and ensures an administrator is logged in -class Admin::Projects::ApplicationController < Admin::ApplicationController - - protected - - def project - @project ||= Project.find_with_namespace(params[:project_id]) - end -end diff --git a/app/controllers/admin/projects/members_controller.rb b/app/controllers/admin/projects/members_controller.rb deleted file mode 100644 index d9c0d572..00000000 --- a/app/controllers/admin/projects/members_controller.rb +++ /dev/null @@ -1,32 +0,0 @@ -class Admin::Projects::MembersController < Admin::Projects::ApplicationController - def edit - @member = team_member - @project = project - @team_member_relation = team_member_relation - end - - def update - if team_member_relation.update_attributes(params[:team_member]) - redirect_to [:admin, project], notice: 'Project Access was successfully updated.' - else - render action: "edit" - end - end - - def destroy - team_member_relation.destroy - - redirect_to :back - end - - private - - def team_member - @member ||= project.users.find_by_username(params[:id]) - end - - def team_member_relation - team_member.users_projects.find_by_project_id(project) - end - -end diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index bbb80cbb..fc2793a7 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -1,4 +1,4 @@ -class Admin::ProjectsController < Admin::ApplicationController +class Admin::ProjectsController < AdminController before_filter :project, only: [:edit, :show, :update, :destroy, :team_update] def index @@ -19,6 +19,34 @@ class Admin::ProjectsController < Admin::ApplicationController @users = @users.all end + def edit + end + + def team_update + @project.team.add_users_ids(params[:user_ids], params[:project_access]) + + redirect_to [:admin, @project], notice: 'Project was successfully updated.' + end + + def update + status = Projects::UpdateContext.new(project, current_user, params).execute(:admin) + + if status + redirect_to [:admin, @project], notice: 'Project was successfully updated.' + else + render action: "edit" + end + 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.' + end + protected def project diff --git a/app/controllers/admin/resque_controller.rb b/app/controllers/admin/resque_controller.rb index 7d489ab4..9d8e7e30 100644 --- a/app/controllers/admin/resque_controller.rb +++ b/app/controllers/admin/resque_controller.rb @@ -1,4 +1,4 @@ -class Admin::ResqueController < Admin::ApplicationController +class Admin::ResqueController < AdminController def show end end diff --git a/app/controllers/admin/team_members_controller.rb b/app/controllers/admin/team_members_controller.rb new file mode 100644 index 00000000..07320805 --- /dev/null +++ b/app/controllers/admin/team_members_controller.rb @@ -0,0 +1,22 @@ +class Admin::TeamMembersController < AdminController + def edit + @admin_team_member = UsersProject.find(params[:id]) + end + + 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 + + def destroy + @admin_team_member = UsersProject.find(params[:id]) + @admin_team_member.destroy + + redirect_to :back + end +end diff --git a/app/controllers/admin/teams/application_controller.rb b/app/controllers/admin/teams/application_controller.rb deleted file mode 100644 index 87108214..00000000 --- a/app/controllers/admin/teams/application_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Provides a base class for Admin controllers to subclass -# -# Automatically sets the layout and ensures an administrator is logged in -class Admin::Teams::ApplicationController < Admin::ApplicationController - - private - - def user_team - @team = UserTeam.find_by_path(params[:team_id]) - end -end diff --git a/app/controllers/admin/teams/members_controller.rb b/app/controllers/admin/teams/members_controller.rb deleted file mode 100644 index e6469874..00000000 --- a/app/controllers/admin/teams/members_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Admin::Teams::MembersController < Admin::Teams::ApplicationController - def new - @users = User.potential_team_members(user_team) - @users = UserDecorator.decorate_collection @users - end - - def create - unless params[:user_ids].blank? - user_ids = params[:user_ids] - access = params[:default_project_access] - is_admin = params[:group_admin] - user_team.add_members(user_ids, access, is_admin) - end - - redirect_to admin_team_path(user_team), notice: 'Members was successfully added into Team of users.' - end - - def edit - team_member - end - - def update - options = {default_projects_access: params[:default_project_access], group_admin: params[:group_admin]} - if user_team.update_membership(team_member, options) - redirect_to admin_team_path(user_team), notice: "Membership for #{team_member.name} was successfully updated in Team of users." - else - render :edit - end - end - - def destroy - user_team.remove_member(team_member) - redirect_to admin_team_path(user_team), notice: "Member #{team_member.name} was successfully removed from Team of users." - end - - protected - - def team_member - @member ||= user_team.members.find_by_username(params[:id]) - end -end diff --git a/app/controllers/admin/teams/projects_controller.rb b/app/controllers/admin/teams/projects_controller.rb deleted file mode 100644 index 8584a188..00000000 --- a/app/controllers/admin/teams/projects_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Admin::Teams::ProjectsController < Admin::Teams::ApplicationController - def new - @projects = Project.scoped - @projects = @projects.without_team(user_team) if user_team.projects.any? - #@projects.reject!(&:empty_repo?) - end - - def create - unless params[:project_ids].blank? - project_ids = params[:project_ids] - access = params[:greatest_project_access] - user_team.assign_to_projects(project_ids, access) - end - - redirect_to admin_team_path(user_team), notice: 'Team of users was successfully assgned to projects.' - end - - def edit - team_project - end - - def update - if user_team.update_project_access(team_project, params[:greatest_project_access]) - redirect_to admin_team_path(user_team), notice: 'Access was successfully updated.' - else - render :edit - end - end - - def destroy - user_team.resign_from_project(team_project) - redirect_to admin_team_path(user_team), notice: 'Team of users was successfully reassigned from project.' - end - - protected - - def team_project - @project ||= user_team.projects.find_with_namespace(params[:id]) - end - -end diff --git a/app/controllers/admin/teams_controller.rb b/app/controllers/admin/teams_controller.rb deleted file mode 100644 index 786957cb..00000000 --- a/app/controllers/admin/teams_controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Admin::TeamsController < Admin::ApplicationController - def index - @teams = UserTeam.order('name ASC') - @teams = @teams.search(params[:name]) if params[:name].present? - @teams = @teams.page(params[:page]).per(20) - end - - def show - user_team - end - - def new - @team = UserTeam.new - end - - def edit - user_team - end - - def create - @team = UserTeam.new(params[:user_team]) - @team.path = @team.name.dup.parameterize if @team.name - @team.owner = current_user - - if @team.save - redirect_to admin_team_path(@team), notice: 'Team of users was successfully created.' - else - render action: "new" - end - end - - def update - user_team_params = params[:user_team].dup - owner_id = user_team_params.delete(:owner_id) - - if owner_id - user_team.owner = User.find(owner_id) - end - - if user_team.update_attributes(user_team_params) - redirect_to admin_team_path(user_team), notice: 'Team of users was successfully updated.' - else - render action: "edit" - end - end - - def destroy - user_team.destroy - - redirect_to admin_teams_path, notice: 'Team of users was successfully deleted.' - end - - protected - - def user_team - @team ||= UserTeam.find_by_path(params[:id]) - end - -end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 20cb13e7..8669f5d1 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,6 +1,4 @@ -class Admin::UsersController < Admin::ApplicationController - before_filter :admin_user, only: [:show, :edit, :update, :destroy] - +class Admin::UsersController < AdminController def index @admin_users = User.scoped @admin_users = @admin_users.filter(params[:filter]) @@ -9,22 +7,25 @@ class Admin::UsersController < Admin::ApplicationController end def show - # Projects user can be added to - @not_in_projects = Project.scoped - @not_in_projects = @not_in_projects.without_user(admin_user) if admin_user.authorized_projects.present? + @admin_user = User.find(params[:id]) - # Projects he already own or joined - @projects = admin_user.authorized_projects.where('projects.id in (?)', admin_user.authorized_projects.map(&:id)) + @projects = if @admin_user.authorized_projects.empty? + Project + else + Project.without_user(@admin_user) + end.all end def team_update + @admin_user = User.find(params[:id]) + UsersProject.add_users_into_projects( params[:project_ids], - [admin_user.id], + [@admin_user.id], params[:project_access] ) - redirect_to [:admin, admin_user], notice: 'Teams were successfully updated.' + redirect_to [:admin, @admin_user], notice: 'Teams were successfully updated.' end @@ -33,11 +34,13 @@ class Admin::UsersController < Admin::ApplicationController end def edit - admin_user + @admin_user = User.find(params[:id]) end def block - if admin_user.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" @@ -45,7 +48,9 @@ class Admin::UsersController < Admin::ApplicationController end def unblock - if admin_user.activate + @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" @@ -77,36 +82,30 @@ class Admin::UsersController < Admin::ApplicationController params[:user].delete(:password_confirmation) end - admin_user.admin = (admin && admin.to_i > 0) + @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.' } + 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 - # restore username to keep form action url. - admin_user.username = params[:id] format.html { render action: "edit" } - format.json { render json: admin_user.errors, status: :unprocessable_entity } + format.json { render json: @admin_user.errors, status: :unprocessable_entity } end end end def destroy - if admin_user.personal_projects.count > 0 + @admin_user = User.find(params[:id]) + 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 + @admin_user.destroy respond_to do |format| - format.html { redirect_to admin_users_path } + format.html { redirect_to admin_users_url } format.json { head :ok } end end - - protected - - def admin_user - @admin_user ||= User.find_by_username!(params[:id]) - end end diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin_controller.rb similarity index 82% rename from app/controllers/admin/application_controller.rb rename to app/controllers/admin_controller.rb index 6a8f20f6..bce9f692 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,7 +1,7 @@ # Provides a base class for Admin controllers to subclass # # Automatically sets the layout and ensures an administrator is logged in -class Admin::ApplicationController < ApplicationController +class AdminController < ApplicationController layout 'admin' before_filter :authenticate_admin! diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32b12466..3457a1ab 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,13 +4,16 @@ class ApplicationController < ActionController::Base before_filter :set_current_user_for_observers before_filter :add_abilities before_filter :dev_tools if Rails.env == 'development' - before_filter :default_headers - before_filter :add_gon_variables protect_from_forgery helper_method :abilities, :can? + rescue_from Gitlab::Gitolite::AccessDenied do |exception| + log_exception(exception) + render "errors/gitolite", layout: "errors", status: 500 + end + rescue_from Encoding::CompatibilityError do |exception| log_exception(exception) render "errors/encoding", layout: "errors", status: 500 @@ -30,7 +33,7 @@ class ApplicationController < ActionController::Base end def reject_blocked! - if current_user && current_user.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 @@ -38,7 +41,7 @@ class ApplicationController < ActionController::Base end def after_sign_in_path_for resource - if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked? + 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 @@ -91,18 +94,6 @@ class ApplicationController < ActionController::Base return access_denied! unless can?(current_user, :download_code, project) end - def authorize_create_team! - return access_denied! unless can?(current_user, :create_team, nil) - end - - def authorize_manage_user_team! - return access_denied! unless user_team.present? && can?(current_user, :manage_user_team, user_team) - end - - def authorize_admin_user_team! - return access_denied! unless user_team.present? && can?(current_user, :admin_user_team, user_team) - end - def access_denied! render "errors/access_denied", layout: "errors", status: 404 end @@ -144,16 +135,4 @@ class ApplicationController < ActionController::Base def dev_tools Rack::MiniProfiler.authorize_request end - - def default_headers - headers['X-Frame-Options'] = 'DENY' - headers['X-XSS-Protection'] = '1; mode=block' - end - - def add_gon_variables - gon.default_issues_tracker = Project.issues_tracker.default_value - gon.api_version = Gitlab::API.version - gon.api_token = current_user.private_token if current_user - gon.gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url - end end diff --git a/app/controllers/blame_controller.rb b/app/controllers/blame_controller.rb index 310b567c..37d7245c 100644 --- a/app/controllers/blame_controller.rb +++ b/app/controllers/blame_controller.rb @@ -7,7 +7,10 @@ class BlameController < ProjectResourceController before_filter :authorize_code_access! before_filter :require_non_empty_project + before_filter :assign_ref_vars + def show - @blame = Gitlab::Git::Blame.new(project.repository, @commit.id, @path) + @repo = @project.repo + @blame = Grit::Blob.blame(@repo, @commit.id, @path) end end diff --git a/app/controllers/blob_controller.rb b/app/controllers/blob_controller.rb index 530b72fe..d4a45d95 100644 --- a/app/controllers/blob_controller.rb +++ b/app/controllers/blob_controller.rb @@ -7,6 +7,8 @@ class BlobController < ProjectResourceController before_filter :authorize_code_access! before_filter :require_non_empty_project + before_filter :assign_ref_vars + def show if @tree.is_blob? send_data( diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index cde1f459..534ae1ed 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -13,6 +13,7 @@ class CommitsController < ProjectResourceController @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) @commits = @repo.commits(@ref, @path, @limit, @offset) + @commits = CommitDecorator.decorate(@commits) respond_to do |format| format.html # index.html.erb diff --git a/app/controllers/compare_controller.rb b/app/controllers/compare_controller.rb index 750e9c23..ae20f9c0 100644 --- a/app/controllers/compare_controller.rb +++ b/app/controllers/compare_controller.rb @@ -8,13 +8,15 @@ class CompareController < ProjectResourceController end def show - compare = Gitlab::Git::Compare.new(project.repository, params[:from], params[:to]) + result = Commit.compare(project, params[:from], params[:to]) - @commits = compare.commits - @commit = compare.commit - @diffs = compare.diffs - @refs_are_same = compare.same + @commits = result[:commits] + @commit = result[:commit] + @diffs = result[:diffs] + @refs_are_same = result[:same] @line_notes = [] + + @commits = CommitDecorator.decorate(@commits) end def create diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 91a67985..c0ec4708 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,15 +1,24 @@ class DashboardController < ApplicationController respond_to :html - before_filter :load_projects - before_filter :event_filter, only: :show + before_filter :projects + before_filter :event_filter, only: :index + + def index + @groups = current_user.authorized_groups - def show - @groups = current_user.authorized_groups.sort_by(&:human_name) @has_authorized_projects = @projects.count > 0 - @teams = current_user.authorized_teams - @projects_count = @projects.count - @projects = @projects.limit(20) + + @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.authorized_projects.pluck(:id)) @events = @event_filter.apply_filter(@events) @@ -24,20 +33,6 @@ class DashboardController < ApplicationController end end - def projects - @projects = case params[:scope] - when 'personal' then - @projects.personal(current_user) - when 'joined' then - @projects.joined(current_user) - else - @projects - end - - @projects = @projects.search(params[:search]) if params[:search].present? - @projects = @projects.page(params[:page]).per(30) - end - # Get authored or assigned open merge requests def merge_requests @merge_requests = current_user.cared_merge_requests @@ -60,7 +55,7 @@ class DashboardController < ApplicationController protected - def load_projects + def projects @projects = current_user.authorized_projects.sorted_by_activity end diff --git a/app/controllers/edit_tree_controller.rb b/app/controllers/edit_tree_controller.rb deleted file mode 100644 index aae983aa..00000000 --- a/app/controllers/edit_tree_controller.rb +++ /dev/null @@ -1,47 +0,0 @@ -# Controller for edit a repository's file -class EditTreeController < ProjectResourceController - include ExtractsPath - - # Authorize - before_filter :authorize_read_project! - before_filter :authorize_code_access! - before_filter :require_non_empty_project - - before_filter :edit_requirements, only: [:edit, :update] - - def show - @last_commit = @project.repository.last_commit_for(@ref, @path).sha - end - - 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 - - private - - def edit_requirements - unless @tree.is_blob? && @tree.text? - redirect_to project_tree_path(@project, @id), notice: "You can only edit text files" - end - - allowed = if project.protected_branch? @ref - can?(current_user, :push_code_to_protected_branches, project) - else - can?(current_user, :push_code, project) - end - - return access_denied! unless allowed - end -end diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index a0c8a000..e998d723 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,2 +1,5 @@ class ErrorsController < ApplicationController + def githost + render "errors/gitolite" + end end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb deleted file mode 100644 index 3cd2e773..00000000 --- a/app/controllers/files_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class FilesController < ApplicationController - def download - note = Note.find(params[:id]) - - if can?(current_user, :read_project, note.project) - uploader = note.attachment - send_file uploader.file.path, disposition: 'attachment' - else - not_found! - end - end -end - diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb deleted file mode 100644 index b4bf9565..00000000 --- a/app/controllers/graph_controller.rb +++ /dev/null @@ -1,29 +0,0 @@ -class GraphController < ProjectResourceController - include ExtractsPath - include ApplicationHelper - - # Authorize - before_filter :authorize_read_project! - before_filter :authorize_code_access! - before_filter :require_non_empty_project - - def show - if params.has_key?(:q) - if params[:q].blank? - redirect_to project_graph_path(@project, params[:id]) - return - end - - @q = params[:q] - @commit = @project.repository.commit(@q) || @commit - end - - respond_to do |format| - format.html - - format.json do - @graph = Network::Graph.new(project, @ref, @commit) - end - end - end -end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index bdf3567f..c25fc32a 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,32 +1,12 @@ class GroupsController < ApplicationController respond_to :html - layout 'group', except: [:new, :create] + layout 'group' - before_filter :group, except: [:new, :create] + before_filter :group + before_filter :projects # Authorize - before_filter :authorize_read_group!, except: [:new, :create] - before_filter :authorize_admin_group!, only: [:edit, :update, :destroy] - before_filter :authorize_create_group!, only: [:new, :create] - - # Load group projects - before_filter :projects, except: [:new, :create] - - def new - @group = Group.new - end - - 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 @group, notice: 'Group was successfully created.' - else - render action: "new" - end - end + before_filter :authorize_read_group! def show @events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0) @@ -59,6 +39,15 @@ class GroupsController < ApplicationController end end + def search + result = SearchContext.new(project_ids, params).execute + + @projects = result[:projects] + @merge_requests = result[:merge_requests] + @issues = result[:issues] + @wiki_pages = result[:wiki_pages] + end + def people @project = group.projects.find(params[:project_id]) if params[:project_id] @users = @project ? @project.users : group.users @@ -76,32 +65,6 @@ class GroupsController < ApplicationController redirect_to people_group_path(@group), notice: 'Users was successfully added.' end - def edit - end - - def update - group_params = params[:group].dup - owner_id =group_params.delete(:owner_id) - - if owner_id - @group.owner = User.find(owner_id) - @group.save - end - - if @group.update_attributes(group_params) - redirect_to @group, notice: 'Group was successfully updated.' - else - render action: "edit" - end - end - - def destroy - @group.truncate_teams - @group.destroy - - redirect_to root_path, notice: 'Group was removed.' - end - protected def group @@ -122,16 +85,4 @@ class GroupsController < ApplicationController return render_404 end end - - def authorize_create_group! - unless can?(current_user, :create_group, nil) - return render_404 - end - end - - def authorize_admin_group! - unless can?(current_user, :manage_group, group) - return render_404 - end - end end diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb index 1950ebb2..ab6bf595 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/merge_requests_controller.rb @@ -1,5 +1,3 @@ -require 'gitlab/satellite/satellite' - class MergeRequestsController < ProjectResourceController before_filter :module_enabled before_filter :merge_request, only: [:edit, :update, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status] @@ -75,15 +73,14 @@ class MergeRequestsController < ProjectResourceController if @merge_request.unchecked? @merge_request.check_if_can_be_merged end - render json: {merge_status: @merge_request.merge_status_name} + render json: {state: @merge_request.human_state} rescue Gitlab::SatelliteNotExistError - render json: {merge_status: :no_satellite} + render json: {state: :no_satellite} end def automerge - return access_denied! unless allowed_to_merge? - - if @merge_request.opened? && @merge_request.can_be_merged? + 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 @@ -94,10 +91,12 @@ class MergeRequestsController < ProjectResourceController def branch_from @commit = @repository.commit(params[:ref]) + @commit = CommitDecorator.decorate(@commit) end def branch_to @commit = @repository.commit(params[:ref]) + @commit = CommitDecorator.decorate(@commit) end def ci_status @@ -126,12 +125,12 @@ class MergeRequestsController < ProjectResourceController end def validates_merge_request - # Show git not found page if target branch doesn't exist - return invalid_mr unless @project.repository.branch_names.include?(@merge_request.target_branch) + # 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 doesn't exist + # Show git not found page if source branch doesnt exist # and there is no saved commits between source & target branch - return invalid_mr if !@project.repository.branch_names.include?(@merge_request.source_branch) && @merge_request.commits.blank? + return git_not_found! if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank? end def define_show_vars @@ -141,23 +140,6 @@ class MergeRequestsController < ProjectResourceController # Get commits from repository # or from cache if already merged @commits = @merge_request.commits - - @allowed_to_merge = allowed_to_merge? - @show_merge_controls = @merge_request.opened? && @commits.any? && @allowed_to_merge - end - - def allowed_to_merge? - action = if project.protected_branch?(@merge_request.target_branch) - :push_code_to_protected_branches - else - :push_code - end - - can?(current_user, action, @project) - end - - def invalid_mr - # Render special view for MR with removed source or target branch - render 'invalid' + @commits = CommitDecorator.decorate(@commits) end end diff --git a/app/controllers/milestones_controller.rb b/app/controllers/milestones_controller.rb index cdac28c1..a0c824e8 100644 --- a/app/controllers/milestones_controller.rb +++ b/app/controllers/milestones_controller.rb @@ -12,7 +12,7 @@ class MilestonesController < ProjectResourceController def index @milestones = case params[:f] - when 'all'; @project.milestones.order("state, due_date DESC") + 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 @@ -32,7 +32,7 @@ class MilestonesController < ProjectResourceController def show @issues = @milestone.issues - @users = UserDecorator.decorate_collection(@milestone.participants) + @users = UserDecorator.decorate(@milestone.participants) @merge_requests = @milestone.merge_requests respond_to do |format| diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb deleted file mode 100644 index e44e0aa8..00000000 --- a/app/controllers/notifications_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class NotificationsController < ApplicationController - layout 'profile' - - def show - @notification = current_user.notification - @projects = current_user.authorized_projects - end - - def update - current_user.notification_level = params[:notification_level] - @saved = current_user.save - end -end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 6fa114a4..051a6664 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -1,6 +1,4 @@ class ProfilesController < ApplicationController - include ActionView::Helpers::SanitizeHelper - before_filter :user layout 'profile' @@ -14,7 +12,7 @@ class ProfilesController < ApplicationController end def update - if @user.update_attributes(user_attributes) + if @user.update_attributes(params[:user]) flash[:notice] = "Profile was successfully updated" else flash[:alert] = "Failed to update profile" @@ -67,17 +65,4 @@ class ProfilesController < ApplicationController def user @user = current_user end - - def user_attributes - user_attributes = params[:user] - - # Sanitize user input because we dont have strict - # validation for this fields - %w(name skype linkedin twitter bio).each do |attr| - value = user_attributes[attr] - user_attributes[attr] = sanitize(value) if value.present? - end - - user_attributes - end end diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb deleted file mode 100644 index 7e4776d2..00000000 --- a/app/controllers/projects/application_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Projects::ApplicationController < ApplicationController - - before_filter :authorize_admin_team_member! - - protected - - def user_team - @team ||= UserTeam.find_by_path(params[:id]) - end - -end diff --git a/app/controllers/projects/teams_controller.rb b/app/controllers/projects/teams_controller.rb deleted file mode 100644 index 17e73673..00000000 --- a/app/controllers/projects/teams_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -class Projects::TeamsController < Projects::ApplicationController - - def available - @teams = current_user.is_admin? ? UserTeam.scoped : current_user.user_teams - @teams = @teams.without_project(project) - unless @teams.any? - redirect_to project_team_index_path(project), notice: "No available teams for assigment." - end - end - - def assign - unless params[:team_id].blank? - team = UserTeam.find(params[:team_id]) - access = params[:greatest_project_access] - team.assign_to_project(project, access) - end - redirect_to project_team_index_path(project) - end - - def resign - team = project.user_teams.find_by_path(params[:id]) - team.resign_from_project(project) - - redirect_to project_team_index_path(project) - end - -end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 8e55aa01..368737d1 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,10 +1,12 @@ +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] - before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer] + before_filter :authorize_admin_project!, only: [:edit, :update, :destroy] before_filter :require_non_empty_project, only: [:blob, :tree, :graph] layout 'application', only: [:new, :create] @@ -17,7 +19,7 @@ class ProjectsController < ProjectResourceController end def create - @project = ::Projects::CreateContext.new(current_user, params[:project]).execute + @project = Projects::CreateContext.new(current_user, params[:project]).execute respond_to do |format| flash[:notice] = 'Project was successfully created.' if @project.saved? @@ -33,7 +35,7 @@ class ProjectsController < ProjectResourceController end def update - status = ::Projects::UpdateContext.new(project, current_user, params).execute + status = Projects::UpdateContext.new(project, current_user, params).execute respond_to do |format| if status @@ -45,10 +47,10 @@ class ProjectsController < ProjectResourceController format.js end end - end - def transfer - ::Projects::TransferContext.new(project, current_user, params).execute + rescue Project::TransferError => ex + @error = ex + render :update_failed end def show @@ -57,21 +59,53 @@ class ProjectsController < ProjectResourceController respond_to do |format| format.html do - if @project.empty_repo? - render "projects/empty" - else + if @project.repository && !@project.repository.empty? @last_push = current_user.recent_push(@project.id) render :show + else + render "projects/empty" end end format.js end end + def files + @notes = @project.notes.where("attachment != 'NULL'").order("created_at DESC").limit(100) + end + + # + # Wall + # + + def wall + return render_404 unless @project.wall_enabled + + @target_type = :wall + @target_id = nil + @note = @project.notes.new + + respond_to do |format| + format.html + end + end + + 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 + def destroy return access_denied! unless can?(current_user, :remove_project, project) + # Delete team first in order to prevent multiple gitolite calls project.team.truncate + project.destroy respond_to do |format| diff --git a/app/controllers/public/projects_controller.rb b/app/controllers/public/projects_controller.rb index b929b23e..4108fe5f 100644 --- a/app/controllers/public/projects_controller.rb +++ b/app/controllers/public/projects_controller.rb @@ -6,7 +6,7 @@ class Public::ProjectsController < ApplicationController layout 'public' def index - @projects = Project.public_only + @projects = Project.public @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) end end diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index eb8d1e19..09d9eb51 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -13,8 +13,6 @@ class RefsController < ProjectResourceController format.html do new_path = if params[:destination] == "tree" project_tree_path(@project, (@ref + "/" + params[:path])) - elsif params[:destination] == "graph" - project_graph_path(@project, @ref) else project_commits_path(@project, @ref) end @@ -34,6 +32,7 @@ class RefsController < ProjectResourceController @logs = contents.map do |content| file = params[:path] ? File.join(params[:path], content.name) : content.name last_commit = @repo.commits(@commit.id, file, 1).last + last_commit = CommitDecorator.decorate(last_commit) { file_name: content.name, commit: last_commit @@ -48,7 +47,9 @@ class RefsController < ProjectResourceController @repo = project.repository @commit = @repo.commit(@ref) + @commit = CommitDecorator.decorate(@commit) @tree = Tree.new(@commit.tree, @ref, params[:path]) + @tree = TreeDecorator.new(@tree) @hex_path = Digest::SHA1.hexdigest(params[:path] || "") if params[:path] diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 507a5c20..cbac7613 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,28 +1,9 @@ class RegistrationsController < Devise::RegistrationsController before_filter :signup_enabled? - def destroy - if current_user.owned_projects.count > 0 - redirect_to account_profile_path, alert: "Remove projects and groups before removing account." and return - end - current_user.destroy - - respond_to do |format| - format.html { redirect_to new_user_session_path, notice: "Account successfully removed." } - end - end - - protected - - def build_resource(hash=nil) - super - self.resource.projects_limit = Gitlab.config.gitlab.default_projects_limit - self.resource - end - private def signup_enabled? redirect_to new_user_session_path unless Gitlab.config.gitlab.signup_enabled end -end +end \ No newline at end of file diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index bbd67df6..a2329239 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,18 +1,6 @@ class SearchController < ApplicationController def show - project_id = params[:project_id] - group_id = params[:group_id] - - project_ids = current_user.authorized_projects.map(&:id) - - if group_id.present? - group_project_ids = Group.find(group_id).projects.map(&:id) - project_ids.select! { |id| group_project_ids.include?(id)} - elsif project_id.present? - project_ids.select! { |id| id == project_id.to_i} - end - - result = SearchContext.new(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 25a06501..d0df469b 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -26,7 +26,8 @@ class ServicesController < ProjectResourceController end def test - data = GitPushService.new.sample_data(project, current_user) + 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 @service.execute(data) diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index a2e22a67..26898abf 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -1,5 +1,4 @@ class SnippetsController < ProjectResourceController - before_filter :module_enabled before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] # Allow read any snippet @@ -85,8 +84,4 @@ class SnippetsController < ProjectResourceController def authorize_admin_snippet! return render_404 unless can?(current_user, :admin_snippet, @snippet) end - - def module_enabled - return render_404 unless @project.snippets_enabled - end end diff --git a/app/controllers/team_members_controller.rb b/app/controllers/team_members_controller.rb index ba55648a..8378a845 100644 --- a/app/controllers/team_members_controller.rb +++ b/app/controllers/team_members_controller.rb @@ -4,19 +4,19 @@ class TeamMembersController < ProjectResourceController before_filter :authorize_admin_project!, except: [:index, :show] def index - @team = @project.users_projects.scoped - @team = @team.send(params[:type]) if %w(masters developers reporters guests).include?(params[:type]) - @team = @team.sort_by(&:project_access).reverse.group_by(&:project_access) + end - @assigned_teams = @project.user_team_project_relationships + def show + @team_member = project.users_projects.find(params[:id]) + @events = @team_member.user.recent_events.where(:project_id => @project.id).limit(7) end def new - @user_project_relation = project.users_projects.new + @team_member = project.users_projects.new end def create - users = User.where(id: params[:user_ids].split(',')) + users = User.where(id: params[:user_ids]) @project.team << [users, params[:project_access]] @@ -28,18 +28,18 @@ class TeamMembersController < ProjectResourceController end def update - @user_project_relation = project.users_projects.find_by_user_id(member) - @user_project_relation.update_attributes(params[:team_member]) + @team_member = project.users_projects.find(params[:id]) + @team_member.update_attributes(params[:team_member]) - unless @user_project_relation.valid? + unless @team_member.valid? flash[:alert] = "User should have at least one role" end redirect_to project_team_index_path(@project) end def destroy - @user_project_relation = project.users_projects.find_by_user_id(member) - @user_project_relation.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) } @@ -54,10 +54,4 @@ class TeamMembersController < ProjectResourceController redirect_to project_team_members_path(project), notice: notice end - - protected - - def member - @member ||= User.find_by_username(params[:id]) - end end diff --git a/app/controllers/teams/application_controller.rb b/app/controllers/teams/application_controller.rb deleted file mode 100644 index fc232026..00000000 --- a/app/controllers/teams/application_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Teams::ApplicationController < ApplicationController - - layout 'user_team' - - before_filter :authorize_manage_user_team! - - protected - - def user_team - @team ||= UserTeam.find_by_path(params[:team_id]) - end - -end diff --git a/app/controllers/teams/members_controller.rb b/app/controllers/teams/members_controller.rb deleted file mode 100644 index f87d422f..00000000 --- a/app/controllers/teams/members_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class Teams::MembersController < Teams::ApplicationController - - skip_before_filter :authorize_manage_user_team!, only: [:index] - - def index - @members = user_team.members - end - - def new - @users = User.potential_team_members(user_team) - @users = UserDecorator.decorate_collection @users - end - - def create - unless params[:user_ids].blank? - user_ids = params[:user_ids].split(',') - access = params[:default_project_access] - is_admin = params[:group_admin] - user_team.add_members(user_ids, access, is_admin) - end - - redirect_to team_members_path(user_team), notice: 'Members was successfully added into Team of users.' - end - - def edit - team_member - end - - def update - member_params = params[:team_member] - - options = { - default_projects_access: member_params[:permission], - group_admin: member_params[:group_admin] - } - - if user_team.update_membership(team_member, options) - redirect_to team_members_path(user_team), notice: "Membership for #{team_member.name} was successfully updated in Team of users." - else - render :edit - end - end - - def destroy - user_team.remove_member(team_member) - redirect_to team_path(user_team), notice: "Member #{team_member.name} was successfully removed from Team of users." - end - - protected - - def team_member - @member ||= user_team.members.find_by_username(params[:id]) - end -end diff --git a/app/controllers/teams/projects_controller.rb b/app/controllers/teams/projects_controller.rb deleted file mode 100644 index 81ffa238..00000000 --- a/app/controllers/teams/projects_controller.rb +++ /dev/null @@ -1,40 +0,0 @@ -class Teams::ProjectsController < Teams::ApplicationController - def create - redirect_to :back if params[:project_ids].blank? - - project_ids = params[:project_ids] - access = params[:greatest_project_access] - - # Reject non-allowed projects - allowed_project_ids = current_user.owned_projects.map(&:id) - project_ids.select! { |id| allowed_project_ids.include?(id.to_i) } - - # Assign projects to team - user_team.assign_to_projects(project_ids, access) - - redirect_to edit_team_path(user_team), notice: 'Team of users was successfully assigned to projects.' - end - - def edit - team_project - end - - def update - if user_team.update_project_access(team_project, params[:greatest_project_access]) - redirect_to edit_team_path(user_team), notice: 'Access was successfully updated.' - else - render :edit - end - end - - def destroy - user_team.resign_from_project(team_project) - redirect_to team_projects_path(user_team), notice: 'Team of users was successfully reassigned from project.' - end - - private - - def team_project - @project ||= user_team.projects.find_with_namespace(params[:id]) - end -end diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb deleted file mode 100644 index 26c1d84f..00000000 --- a/app/controllers/teams_controller.rb +++ /dev/null @@ -1,79 +0,0 @@ -class TeamsController < ApplicationController - # Authorize - before_filter :authorize_create_team!, only: [:new, :create] - before_filter :authorize_manage_user_team!, only: [:edit, :update] - before_filter :authorize_admin_user_team!, only: [:destroy] - - before_filter :user_team, except: [:new, :create] - - layout 'user_team', except: [:new, :create] - - def show - projects - @events = Event.in_projects(user_team.project_ids).limit(20).offset(params[:offset] || 0) - end - - def edit - projects - @avaliable_projects = current_user.admin? ? Project.without_team(user_team) : current_user.owned_projects.without_team(user_team) - end - - def update - if user_team.update_attributes(params[:user_team]) - redirect_to team_path(user_team) - else - render action: :edit - end - end - - def destroy - user_team.destroy - redirect_to dashboard_path - end - - def new - @team = UserTeam.new - end - - def create - @team = UserTeam.new(params[:user_team]) - @team.owner = current_user unless params[:owner] - @team.path = @team.name.dup.parameterize if @team.name - - if @team.save - # Add current user as Master to the team - @team.add_members([current_user.id], UsersProject::MASTER, true) - - redirect_to team_path(@team) - else - render action: :new - end - end - - # Get authored or assigned open merge requests - def merge_requests - projects - @merge_requests = MergeRequest.of_user_team(user_team) - @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 - projects - @issues = Issue.of_user_team(user_team) - @issues = FilterContext.new(@issues, params).execute - @issues = @issues.recent.page(params[:page]).per(20) - @issues = @issues.includes(:author, :project) - end - - protected - - def projects - @projects ||= user_team.projects.sorted_by_activity - end - - def user_team - @team ||= current_user.authorized_teams.find_by_path(params[:id]) - end -end diff --git a/app/controllers/tree_controller.rb b/app/controllers/tree_controller.rb index a03ea3ff..2151bd7c 100644 --- a/app/controllers/tree_controller.rb +++ b/app/controllers/tree_controller.rb @@ -7,6 +7,9 @@ class TreeController < ProjectResourceController before_filter :authorize_code_access! before_filter :require_non_empty_project + before_filter :assign_ref_vars + before_filter :edit_requirements, only: [:edit, :update] + def show @hex_path = Digest::SHA1.hexdigest(@path) @logs_path = logs_file_project_ref_path(@project, @ref, @path) @@ -17,4 +20,40 @@ class TreeController < ProjectResourceController format.js { no_cache_headers } end end + + def edit + @last_commit = @project.repository.last_commit_for(@ref, @path).sha + end + + 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 + + private + + def edit_requirements + unless @tree.is_blob? && @tree.text? + redirect_to project_tree_path(@project, @id), notice: "You can only edit text files" + end + + allowed = if project.protected_branch? @ref + can?(current_user, :push_code_to_protected_branches, project) + else + can?(current_user, :push_code, project) + end + + return access_denied! unless allowed + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb deleted file mode 100644 index e027057f..00000000 --- a/app/controllers/users_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -class UsersController < ApplicationController - def show - @user = User.find_by_username!(params[:username]) - @projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id)) - @events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20) - end -end diff --git a/app/controllers/walls_controller.rb b/app/controllers/walls_controller.rb deleted file mode 100644 index 5993a5e2..00000000 --- a/app/controllers/walls_controller.rb +++ /dev/null @@ -1,20 +0,0 @@ -class WallsController < ProjectResourceController - before_filter :module_enabled - - respond_to :js, :html - - def show - @note = @project.notes.new - - respond_to do |format| - format.html - end - end - - protected - - def module_enabled - return render_404 unless @project.wall_enabled - end -end - diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index 940b1e97..69280291 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -2,94 +2,58 @@ class WikisController < ProjectResourceController before_filter :authorize_read_wiki! before_filter :authorize_write_wiki!, only: [:edit, :create, :history] before_filter :authorize_admin_wiki!, only: :destroy - before_filter :load_gollum_wiki def pages - @wiki_pages = @gollum_wiki.pages + @wiki_pages = @project.wikis.group(:slug).ordered end def show - @wiki = @gollum_wiki.find_page(params[:id], params[:version_id]) + @most_recent_wiki = @project.wikis.where(slug: params[:id]).ordered.first + if params[:version_id] + @wiki = @project.wikis.find(params[:version_id]) + else + @wiki = @most_recent_wiki + end if @wiki render 'show' else - return render('empty') unless can?(current_user, :write_wiki, @project) - @wiki = WikiPage.new(@gollum_wiki) - @wiki.title = params[:id] - - render 'edit' + if can?(current_user, :write_wiki, @project) + @wiki = @project.wikis.new(slug: params[:id]) + render 'edit' + else + render 'empty' + end end end def edit - @wiki = @gollum_wiki.find_page(params[:id]) - end - - def update - @wiki = @gollum_wiki.find_page(params[:id]) - - return render('empty') unless can?(current_user, :write_wiki, @project) - - if @wiki.update(content, format, message) - redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' - else - render 'edit' - end + @wiki = @project.wikis.where(slug: params[:id]).ordered.first + @wiki = Wiki.regenerate_from @wiki end def create - @wiki = WikiPage.new(@gollum_wiki) + @wiki = @project.wikis.new(params[:wiki]) + @wiki.user = current_user - if @wiki.create(wiki_params) - redirect_to project_wiki_path(@project, @wiki), notice: 'Wiki was successfully updated.' - else - render action: "edit" + 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 def history - unless @wiki = @gollum_wiki.find_page(params[:id]) - redirect_to project_wiki_path(@project, :home), notice: "Page not found" - end + @wiki_pages = @project.wikis.where(slug: params[:id]).ordered end def destroy - @wiki = @gollum_wiki.find_page(params[:id]) - @wiki.delete if @wiki - redirect_to project_wiki_path(@project, :home), notice: "Page was successfully deleted" + @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 - - def git_access - end - - private - - def load_gollum_wiki - @gollum_wiki = GollumWiki.new(@project, current_user) - - # Call #wiki to make sure the Wiki Repo is initialized - @gollum_wiki.wiki - rescue GollumWiki::CouldNotCreateWikiError => ex - flash[:notice] = "Could not create Wiki Repository at this time. Please try again later." - redirect_to @project - return false - end - - def wiki_params - params[:wiki].slice(:title, :content, :format, :message) - end - - def content - params[:wiki][:content] - end - - def format - params[:wiki][:format] - end - - def message - params[:wiki][:message] - end - end diff --git a/app/decorators/application_decorator.rb b/app/decorators/application_decorator.rb index b805b347..3023699e 100644 --- a/app/decorators/application_decorator.rb +++ b/app/decorators/application_decorator.rb @@ -1,28 +1,27 @@ -class ApplicationDecorator < Draper::Decorator - delegate_all +class ApplicationDecorator < Draper::Base # Lazy Helpers # PRO: Call Rails helpers without the h. proxy # ex: number_to_currency(model.price) # CON: Add a bazillion methods into your decorator's namespace # and probably sacrifice performance/memory - # + # # Enable them by uncommenting this line: # lazy_helpers # Shared Decorations # Consider defining shared methods common to all your models. - # + # # Example: standardize the formatting of timestamps # # def formatted_timestamp(time) - # h.content_tag :span, time.strftime("%a %m/%d/%y"), - # class: 'timestamp' + # h.content_tag :span, time.strftime("%a %m/%d/%y"), + # class: 'timestamp' # end - # + # # def created_at # formatted_timestamp(model.created_at) # end - # + # # def updated_at # formatted_timestamp(model.updated_at) # end diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb new file mode 100644 index 00000000..a066b2e4 --- /dev/null +++ b/app/decorators/commit_decorator.rb @@ -0,0 +1,92 @@ +class CommitDecorator < ApplicationDecorator + decorates :commit + + # Returns a string describing the commit for use in a link title + # + # Example + # + # "Commit: Alex Denisov - Project git clone panel" + def link_title + "Commit: #{author_name} - #{title}" + end + + # 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. + def title + title = safe_message + + return no_commit_message if title.blank? + + title_end = title.index(/\n/) + if (!title_end && title.length > 80) || (title_end && title_end > 80) + title[0..69] << "…".html_safe + else + title.split(/\n/, 2).first + end + end + + # Returns the commits description + # + # cut off, ellipses (`&hellp;`) are prepended to the commit message. + def description + description = safe_message + + title_end = description.index(/\n/) + if (!title_end && description.length > 80) || (title_end && title_end > 80) + "…".html_safe << description[70..-1] + else + description.split(/\n/, 2)[1].try(:chomp) + end + end + + # 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 + def author_link(options = {}) + person_link(options.merge source: :author) + end + + # Just like #author_link but for the committer. + def committer_link(options = {}) + person_link(options.merge source: :committer) + end + + protected + + 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 + def person_link(options = {}) + source_name = send "#{options[:source]}_name".to_sym + source_email = send "#{options[:source]}_email".to_sym + text = if options[:avatar] + avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "" + %Q{#{avatar} #{source_name}} + else + source_name + end + team_member = @project.try(:team_member_by_name_or_email, source_name, source_email) + + if team_member.nil? + h.mail_to source_email, text.html_safe, class: "commit-#{options[:source]}-link" + else + h.link_to text, h.project_team_member_path(@project, team_member), class: "commit-#{options[:source]}-link" + end + end +end diff --git a/app/decorators/tree_decorator.rb b/app/decorators/tree_decorator.rb new file mode 100644 index 00000000..0e760f97 --- /dev/null +++ b/app/decorators/tree_decorator.rb @@ -0,0 +1,33 @@ +class TreeDecorator < ApplicationDecorator + decorates :tree + + def breadcrumbs(max_links = 2) + if path + part_path = "" + parts = path.split("\/") + + 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(part, h.tree_join(ref, part_path)) + end + end + end + + def up_dir? + path.present? + end + + def up_dir_path + file = File.join(path, "..") + h.tree_join(ref, file) + end + + def readme + @readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i } + end +end diff --git a/app/helpers/admin/teams/members_helper.rb b/app/helpers/admin/teams/members_helper.rb deleted file mode 100644 index 58b9f189..00000000 --- a/app/helpers/admin/teams/members_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin::Teams::MembersHelper - def member_since(team, member) - team.user_team_user_relationships.find_by_user_id(member).created_at - end -end diff --git a/app/helpers/admin/teams/projects_helper.rb b/app/helpers/admin/teams/projects_helper.rb deleted file mode 100644 index b97cc403..00000000 --- a/app/helpers/admin/teams/projects_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Admin::Teams::ProjectsHelper - def assigned_since(team, project) - team.user_team_project_relationships.find_by_project_id(project).created_at - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cb9cb1a3..6478982c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -72,9 +72,8 @@ module ApplicationHelper end def search_autocomplete_source - projects = current_user.authorized_projects.map { |p| { label: "project: #{simple_sanitize(p.name_with_namespace)}", url: project_path(p) } } - groups = current_user.authorized_groups.map { |group| { label: "group: #{simple_sanitize(group.name)}", url: group_path(group) } } - teams = current_user.authorized_teams.map { |team| { label: "team: #{simple_sanitize(team.name)}", url: team_path(team) } } + 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 }, @@ -84,33 +83,33 @@ module ApplicationHelper ] help_nav = [ - { label: "help: API Help", url: help_api_path }, - { label: "help: Markdown Help", url: help_markdown_path }, - { label: "help: Permissions Help", url: help_permissions_path }, - { label: "help: Public Access Help", url: help_public_access_path }, - { label: "help: Rake Tasks Help", url: help_raketasks_path }, - { label: "help: SSH Keys Help", url: help_ssh_path }, - { label: "help: System Hooks Help", url: help_system_hooks_path }, - { label: "help: Web Hooks Help", url: help_web_hooks_path }, - { label: "help: Workflow Help", url: help_workflow_path }, + { label: "API Help", url: help_api_path }, + { label: "Markdown Help", url: help_markdown_path }, + { label: "Permissions Help", url: help_permissions_path }, + { label: "Public Access Help", url: help_public_access_path }, + { label: "Rake Tasks Help", url: help_raketasks_path }, + { label: "SSH Keys Help", url: help_ssh_path }, + { label: "System Hooks Help", url: help_system_hooks_path }, + { label: "Web Hooks Help", url: help_web_hooks_path }, + { label: "Workflow Help", url: help_workflow_path }, ] project_nav = [] - if @project && @project.repository.exists? && @project.repository.root_ref + if @project && @project.repository && @project.repository.root_ref project_nav = [ - { label: "#{simple_sanitize(@project.name_with_namespace)} - Issues", url: project_issues_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Commits", url: project_commits_path(@project, @ref || @project.repository.root_ref) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Merge Requests", url: project_merge_requests_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Milestones", url: project_milestones_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Snippets", url: project_snippets_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Team", url: project_team_index_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Tree", url: project_tree_path(@project, @ref || @project.repository.root_ref) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Wall", url: project_wall_path(@project) }, - { label: "#{simple_sanitize(@project.name_with_namespace)} - Wiki", url: project_wikis_path(@project) }, + { label: "#{@project.name} Issues", url: project_issues_path(@project) }, + { 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.repository.root_ref) }, + { label: "#{@project.name} Wall", url: wall_project_path(@project) }, + { label: "#{@project.name} Wiki", url: project_wikis_path(@project) }, ] end - [groups, teams, 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 @@ -128,13 +127,7 @@ module ApplicationHelper end def user_color_scheme_class - case current_user.color_scheme_id - when 1 then 'white' - when 2 then 'black' - when 3 then 'solarized-dark' - else - 'white' - end + current_user.dark_scheme ? :black : :white end def show_last_push_widget?(event) @@ -165,20 +158,8 @@ module ApplicationHelper alt: "Sign in with #{provider.to_s.titleize}") end - def simple_sanitize str - sanitize(str, tags: %w(a span)) - end - def image_url(source) - # prevent relative_root_path being added twice (it's part of root_url and path_to_image) - root_url.sub(/#{root_path}$/, path_to_image(source)) + root_url + path_to_image(source) end - alias_method :url_to_image, :image_url - - def users_select_tag(id, opts = {}) - css_class = "ajax-users-select" - css_class << " multiselect" if opts[:multiple] - hidden_field_tag(id, '', class: css_class) - end end diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 95ca294c..4b5d8bd9 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -1,20 +1,4 @@ module CommitsHelper - # 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 - def commit_author_link(commit, options = {}) - commit_person_link(commit, options.merge(source: :author)) - end - - # Just like #author_link but for the committer. - def commit_committer_link(commit, options = {}) - commit_person_link(commit, options.merge(source: :committer)) - end - def identification_type(line) if line[0] == "+" "new" @@ -73,43 +57,20 @@ module CommitsHelper end end - def each_diff_line_near(diff, index, expected_line_code) - max_number_of_lines = 16 - - prev_match_line = nil - prev_lines = [] - - each_diff_line(diff, index) do |full_line, type, line_code, line_new, line_old| - line = [full_line, type, line_code, line_new, line_old] - if line_code != expected_line_code - if type == "match" - prev_lines.clear - prev_match_line = line - else - prev_lines.push(line) - prev_lines.shift if prev_lines.length >= max_number_of_lines - end - else - yield(prev_match_line) if !prev_match_line.nil? - prev_lines.each { |ln| yield(ln) } - yield(line) - break - end - end - end - def image_diff_class(diff) if diff.deleted_file - "deleted" + "diff_removed" elsif diff.new_file - "added" + "diff_added" else nil end end def commit_to_html commit - escape_javascript(render 'commits/commit', commit: commit) + if commit.model + escape_javascript(render 'commits/commit', commit: commit) + end end def diff_line_content(line) @@ -119,58 +80,4 @@ module CommitsHelper line end end - - # Breadcrumb links for a Project and, if applicable, a tree path - def commits_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 - - protected - - # 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 - def commit_person_link(commit, options = {}) - source_name = commit.send "#{options[:source]}_name".to_sym - source_email = commit.send "#{options[:source]}_email".to_sym - text = if options[:avatar] - avatar = image_tag(gravatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") - %Q{#{avatar} #{source_name}} - else - source_name - end - - user = User.where('name like ? or email like ?', source_name, source_email).first - - if user.nil? - mail_to(source_email, text.html_safe, class: "commit-#{options[:source]}-link") - else - link_to(text.html_safe, user_path(user), class: "commit-#{options[:source]}-link") - end - end end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index e3be07c9..0baa5b41 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -9,9 +9,9 @@ module DashboardHelper case entity when 'issue' then - issues_dashboard_path(options) + dashboard_issues_path(options) when 'merge_request' - merge_requests_dashboard_path(options) + dashboard_merge_requests_path(options) end end @@ -27,6 +27,6 @@ module DashboardHelper items.opened end - items.cared(current_user).count + items.where(assignee_id: current_user.id).count end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 38374e33..f4d9b17b 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -1,9 +1,10 @@ module EventsHelper def link_to_author(event) - author = event.author + project = event.project + tm = project.team_member_by_id(event.author_id) if project - if author - link_to author.name, user_path(author.username) + if tm + link_to event.author_name, project_team_member_path(project, tm) else event.author_name end diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 375f8861..111982e9 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -13,13 +13,7 @@ module GitlabMarkdownHelper def link_to_gfm(body, url, html_options = {}) return "" if body.blank? - escaped_body = if body =~ /^\.*?}m) do |match| "#{match}#{link_to("", url, html_options)[0..-5]}" # "".length +1 @@ -49,12 +43,4 @@ module GitlabMarkdownHelper @markdown.render(text).html_safe end - - def render_wiki_content(wiki_page) - if wiki_page.format == :markdown - markdown(wiki_page.content) - else - wiki_page.formatted_content.html_safe - end - end end diff --git a/app/helpers/graph_helper.rb b/app/helpers/graph_helper.rb deleted file mode 100644 index ca7d823a..00000000 --- a/app/helpers/graph_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -module GraphHelper - def get_refs(commit) - refs = "" - refs += commit.refs.collect{|r|r.name}.join(" ") if commit.refs - - # append note count - notes = @project.notes.for_commit_id(commit.id) - refs += "[#{notes.count}]" if notes.any? - - refs - end - - def parents_zip_spaces(parents, parent_spaces) - ids = parents.map { |p| p.id } - ids.zip(parent_spaces) - end -end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 70ebbdd3..2825787f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -6,7 +6,7 @@ module IssuesHelper def issue_css_classes issue classes = "issue" - classes << " closed" if issue.closed? + classes << " closed" if issue.closed classes << " today" if issue.today? classes end @@ -27,7 +27,6 @@ module IssuesHelper all: "all", closed: "closed", to_me: "assigned-to-me", - by_me: "created-by-me", open: "open" } end @@ -41,51 +40,4 @@ module IssuesHelper def issues_active_milestones @project.milestones.active.order("id desc").all end - - def url_for_project_issues - return "" if @project.nil? - - if @project.used_default_issues_tracker? - project_issues_filter_path(@project) - else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["project_url"] - url.gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) - end - end - - def url_for_new_issue - return "" if @project.nil? - - if @project.used_default_issues_tracker? - url = new_project_issue_path project_id: @project - else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["new_issue_url"] - url.gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) - end - end - - def url_for_issue(issue_id) - return "" if @project.nil? - - if @project.used_default_issues_tracker? - url = project_issue_url project_id: @project, id: issue_id - else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["issues_url"] - url.gsub(':id', issue_id.to_s) - .gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) - end - end - - def title_for_issue(issue_id) - return "" if @project.nil? - - if @project.used_default_issues_tracker? && issue = @project.issues.where(id: issue_id).first - issue.title - else - "" - end - end end diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 155d03d1..ca0a89c3 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -12,7 +12,7 @@ module MergeRequestsHelper def mr_css_classes mr classes = "merge_request" - classes << " closed" if mr.closed? + classes << " closed" if mr.closed classes << " merged" if mr.merged? classes end diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index a9a6c786..6d0c6c98 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -10,8 +10,8 @@ module NamespacesHelper global_opts = ["Global", [['/', Namespace.global_id]] ] - group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [g.human_name, g.id]} ] - users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [u.human_name, u.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 diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index fbd0f01e..7a0ed251 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -1,7 +1,8 @@ module NotesHelper # Helps to distinguish e.g. commit notes in mr notes list def note_for_main_target?(note) - (@target_type.camelize == note.noteable_type && !note.for_diff_line?) + note.for_wall? || + (@target_type.camelize == note.noteable_type && !note.for_diff_line?) end def note_target_fields diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb deleted file mode 100644 index 7342393a..00000000 --- a/app/helpers/notifications_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module NotificationsHelper -end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index e6427ea8..158925ba 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,6 +1,10 @@ module ProjectsHelper - def remove_from_project_team_message(project, user) - "You are going to remove #{user.name} from #{project.name} project team. Are you sure?" + def grouper_project_members(project) + @project.users_projects.sort_by(&:project_access).reverse.group_by(&:project_access) + end + + def remove_from_team_message(project, member) + "You are going to remove #{member.user_name} from #{project.name}. Are you sure?" end def link_to_project project @@ -32,14 +36,22 @@ module ProjectsHelper author_html = author_html.html_safe - link_to(author_html, user_path(author), class: "author_link").html_safe + tm = project.team_member_by_id(author) + + if tm + link_to author_html, project_team_member_path(project, tm), class: "author_link" + else + author_html + end.html_safe + end + + def tm_path team_member + project_team_member_path(@project, team_member) end def project_title project if project.group - content_tag :span do - link_to(simple_sanitize(project.group.name), group_path(project.group)) + " / " + project.name - end + project.name_with_namespace else project.name end diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index d2be4b1a..d52d8af6 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -39,12 +39,7 @@ module TabHelper # Returns a list item element String def nav_link(options = {}, &block) if path = options.delete(:path) - if path.respond_to?(:each) - c = path.map { |p| p.split('#').first } - a = path.map { |p| p.split('#').last } - else - c, a, _ = path.split('#') - end + c, a, _ = path.split('#') else c = options.delete(:controller) a = options.delete(:action) @@ -73,9 +68,11 @@ module TabHelper end def project_tab_class - return "active" if current_page?(controller: "projects", action: :edit, id: @project) + [:show, :files, :edit, :update].each do |action| + return "active" if current_page?(controller: "projects", action: action, id: @project) + end - if ['services', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name + if ['snippets', 'services', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name "active" end end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 1cba9476..0f2b695e 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -13,15 +13,13 @@ module TreeHelper tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present? files.each do |f| - html = if f.respond_to?(:url) - # Object is a Submodule - render partial: 'tree/submodule_item', object: f - else - # Object is a Blob - render partial: 'tree/tree_item', object: f, locals: {type: 'file'} - end - - tree += html if html.present? + 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 @@ -70,26 +68,28 @@ module TreeHelper end end - def tree_breadcrumbs(tree, max_links = 2) - if tree.path - part_path = "" - parts = tree.path.split("\/") + # Breadcrumb links for a Project and, if applicable, a tree path + def breadcrumbs + return unless @project && @ref - yield('..', nil) if parts.count > max_links + # 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 - parts.each do |part| - part_path = File.join(part_path, part) unless part_path.empty? - part_path = part if part_path.empty? + if @path + parts = @path.split('/') - next unless parts.last(2).include?(part) if parts.count > max_links - yield(part, tree_join(tree.ref, part_path)) + 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 - end - def up_dir_path tree - file = File.join(tree.path, "..") - tree_join(tree.ref, file) + crumbs.html_safe end - end diff --git a/app/helpers/user_teams_helper.rb b/app/helpers/user_teams_helper.rb deleted file mode 100644 index 2055bb3c..00000000 --- a/app/helpers/user_teams_helper.rb +++ /dev/null @@ -1,26 +0,0 @@ -module UserTeamsHelper - def team_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_team_path(@team, options) - when 'merge_request' - merge_requests_team_path(@team, options) - end - end - - def grouped_user_team_members(team) - team.user_team_user_relationships.sort_by(&:permission).reverse.group_by(&:permission) - end - - def remove_from_user_team_message(team, member) - "You are going to remove #{member.name} from #{team.name}. Are you sure?" - end - -end diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb deleted file mode 100644 index 79731b60..00000000 --- a/app/mailers/emails/issues.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Emails - module Issues - def new_issue_email(recipient_id, issue_id) - @issue = Issue.find(issue_id) - @project = @issue.project - mail(to: recipient(recipient_id), subject: subject("new issue ##{@issue.id}", @issue.title)) - end - - 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 - - def closed_issue_email(recipient_id, issue_id, updated_by_user_id) - @issue = Issue.find issue_id - @project = @issue.project - @updated_by = User.find updated_by_user_id - mail(to: recipient(recipient_id), - subject: subject("Closed issue ##{@issue.id}", @issue.title)) - end - - 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 - end -end diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb deleted file mode 100644 index 806f1b01..00000000 --- a/app/mailers/emails/merge_requests.rb +++ /dev/null @@ -1,29 +0,0 @@ -module Emails - module MergeRequests - def new_merge_request_email(recipient_id, merge_request_id) - @merge_request = MergeRequest.find(merge_request_id) - @project = @merge_request.project - mail(to: recipient(recipient_id), subject: subject("new merge request !#{@merge_request.id}", @merge_request.title)) - end - - 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 - - def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) - @merge_request = MergeRequest.find(merge_request_id) - @project = @merge_request.project - @updated_by = User.find updated_by_user_id - mail(to: recipient(recipient_id), subject: subject("Closed merge request !#{@merge_request.id}", @merge_request.title)) - end - - def merged_merge_request_email(recipient_id, merge_request_id) - @merge_request = MergeRequest.find(merge_request_id) - @project = @merge_request.project - mail(to: recipient(recipient_id), subject: subject("Accepted merge request !#{@merge_request.id}", @merge_request.title)) - end - end -end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb deleted file mode 100644 index 769b6e0b..00000000 --- a/app/mailers/emails/notes.rb +++ /dev/null @@ -1,30 +0,0 @@ -module Emails - module Notes - def note_commit_email(recipient_id, note_id) - @note = Note.find(note_id) - @commit = @note.noteable - @project = @note.project - mail(to: recipient(recipient_id), subject: subject("note for commit #{@commit.short_id}", @commit.title)) - end - - 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 - - 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 - - def note_wall_email(recipient_id, note_id) - @note = Note.find(note_id) - @project = @note.project - mail(to: recipient(recipient_id), subject: subject("note on wall")) - end - end -end diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb deleted file mode 100644 index dcd894bb..00000000 --- a/app/mailers/emails/projects.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Emails - module Projects - 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 - - - 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 - end -end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index a5aa97ab..c672940a 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -1,8 +1,4 @@ class Notify < ActionMailer::Base - include Emails::Issues - include Emails::MergeRequests - include Emails::Notes - include Emails::Projects add_template_helper ApplicationHelper add_template_helper GitlabMarkdownHelper @@ -14,22 +10,117 @@ class Notify < ActionMailer::Base default from: Gitlab.config.gitlab.email_from - # Just send email with 3 seconds delay - def self.delay - delay_for(2.seconds) + + + # + # Issue + # + + 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 + 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 + + 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 + + + + # + # Merge Request + # + + 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 + + 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 + + + + # + # Note + # + + 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 + + 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 + + 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 + + def note_wall_email(recipient_id, note_id) + @note = Note.find(note_id) + @project = @note.project + mail(to: recipient(recipient_id), subject: subject("note on wall")) + end + + + # + # Project + # + + 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 + + + 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 + + # + # User + # + 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 - def new_ssh_key_email(key_id) - @key = Key.find(key_id) - @user = @key.user - mail(to: @user.email, subject: subject("SSH key was added to your account")) - end private diff --git a/app/models/ability.rb b/app/models/ability.rb index 5b49104d..9d33501f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -1,25 +1,15 @@ class Ability class << self - def allowed(user, subject) - return [] unless user.kind_of?(User) - + def allowed(object, subject) case subject.class.name - when "Project" then project_abilities(user, subject) - when "Issue" then issue_abilities(user, subject) - when "Note" then note_abilities(user, subject) - when "Snippet" then snippet_abilities(user, subject) - when "MergeRequest" then merge_request_abilities(user, subject) - when "Group", "Namespace" then group_abilities(user, subject) - when "UserTeam" then user_team_abilities(user, subject) + 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", "Namespace" then group_abilities(object, subject) else [] - end.concat(global_abilities(user)) - end - - def global_abilities(user) - rules = [] - rules << :create_group if user.can_create_group - rules << :create_team if user.can_create_team - rules + end end def project_abilities(user, project) @@ -41,7 +31,7 @@ class Ability rules << project_guest_rules end - if project.owner == user || user.admin? + if project.owner == user rules << project_admin_rules end @@ -91,6 +81,7 @@ class Ability :admin_team_member, :admin_merge_request, :admin_note, + :accept_mr, :admin_wiki, :admin_project ] @@ -119,22 +110,6 @@ class Ability rules.flatten end - def user_team_abilities user, team - rules = [] - - # Only group owner and administrators can manage team - if team.owner == user || team.admin?(user) || user.admin? - rules << [ :manage_user_team ] - end - - if team.owner == user || user.admin? - rules << [ :admin_user_team ] - end - - rules.flatten - end - - [:issue, :note, :snippet, :merge_request].each do |name| define_method "#{name}_abilities" do |user, subject| if subject.author == user diff --git a/app/models/commit.rb b/app/models/commit.rb index e3363350..17d41f27 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -8,70 +8,161 @@ class Commit # DIFF_SAFE_SIZE = 100 - def self.decorate(commits) - commits.map { |c| self.new(c) } + attr_accessor :commit, :head, :refs + + delegate :message, :authored_date, :committed_date, :parents, :sha, + :date, :committer, :author, :diffs, :tree, :id, :stats, + :to_patch, to: :commit + + class << self + 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 + + 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 + + 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 + + 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 + + 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 + + def commits_between(repo, from, to) + repo.commits_between(from, to).map { |c| Commit.new(c) } + end + + def compare(project, from, to) + result = { + commits: [], + diffs: [], + commit: nil, + same: false + } + + return result unless from && to + + first = project.repository.commit(to.try(:strip)) + last = project.repository.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 end - attr_accessor :raw - - def initialize(raw_commit) + def initialize(raw_commit, head = nil) raise "Nil as raw commit passed" unless raw_commit - @raw = raw_commit + @commit = raw_commit + @head = head end - def id - @raw.id + def short_id(length = 10) + id.to_s[0..length] end - # Returns a string describing the commit for use in a link title - # - # Example - # - # "Commit: Alex Denisov - Project git clone panel" - def link_title - "Commit: #{author_name} - #{title}" + def safe_message + @safe_message ||= message end - # Returns the commits title. + def created_at + committed_date + end + + def author_email + author.email + end + + def author_name + author.name + end + + # Was this commit committed by a different person than the original author? + def different_committer? + author_name != committer_name || author_email != committer_email + end + + def committer_name + committer.name + end + + def committer_email + committer.email + end + + def prev_commit + @prev_commit ||= if parents.present? + Commit.new(parents.first) + else + nil + end + end + + def prev_commit_id + prev_commit.try :id + end + + # Shows the diff between the commit's parent and the commit. # - # 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. - def title - title = safe_message + # Cuts out the header and stats from #to_patch and returns only the diff. + def to_diff + # see Grit::Commit#show + patch = to_patch - return no_commit_message if title.blank? - - title_end = title.index(/\n/) - if (!title_end && title.length > 80) || (title_end && title_end > 80) - title[0..69] << "…".html_safe - else - title.split(/\n/, 2).first + # discard lines before the diff + lines = patch.split("\n") + while !lines.first.start_with?("diff --git") do + lines.shift end - end - - # Returns the commits description - # - # cut off, ellipses (`&hellp;`) are prepended to the commit message. - def description - description = safe_message - - title_end = description.index(/\n/) - if (!title_end && description.length > 80) || (title_end && title_end > 80) - "…".html_safe << description[70..-1] - else - description.split(/\n/, 2)[1].try(:chomp) - end - end - - def method_missing(m, *args, &block) - @raw.send(m, *args, &block) - end - - def respond_to?(method) - return true if @raw.respond_to?(method) - - super + lines.pop if lines.last =~ /^[\d.]+$/ # Git version + lines.pop if lines.last == "-- " # end of diff + lines.join("\n") end end diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 85337583..d1717d3b 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -17,13 +17,13 @@ module Issuable validates :project, presence: true validates :author, presence: true validates :title, presence: true, length: { within: 0..255 } + validates :closed, inclusion: { in: [true, false] } - scope :opened, -> { with_state(:opened) } - scope :closed, -> { with_state(:closed) } + scope :opened, where(closed: false) + scope :closed, where(closed: true) scope :of_group, ->(group) { where(project_id: group.project_ids) } - scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } scope :assigned, ->(u) { where(assignee_id: u.id)} - scope :recent, -> { order("created_at DESC") } + scope :recent, order("created_at DESC") delegate :name, :email, @@ -61,6 +61,14 @@ module Issuable assignee_id_changed? end + def is_being_closed? + closed_changed? && closed + end + + def is_being_reopened? + closed_changed? && !closed + end + # # Votes # diff --git a/app/models/event.rb b/app/models/event.rb index ae14454c..d0ba6154 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -20,15 +20,15 @@ class Event < ActiveRecord::Base default_scope where("author_id IS NOT NULL") - CREATED = 1 - UPDATED = 2 - CLOSED = 3 - REOPENED = 4 - PUSHED = 5 - COMMENTED = 6 - MERGED = 7 - JOINED = 8 # User joined project - LEFT = 9 # User left project + Created = 1 + Updated = 2 + Closed = 3 + Reopened = 4 + Pushed = 5 + Commented = 6 + Merged = 7 + Joined = 8 # User joined project + Left = 9 # User left project delegate :name, :email, to: :author, prefix: true, allow_nil: true delegate :title, to: :issue, prefix: true, allow_nil: true @@ -42,16 +42,16 @@ class Event < ActiveRecord::Base serialize :data # Scopes - scope :recent, -> { order("created_at DESC") } - scope :code_push, -> { where(action: PUSHED) } + scope :recent, order("created_at DESC") + scope :code_push, where(action: Pushed) scope :in_projects, ->(project_ids) { where(project_id: project_ids).recent } class << self def determine_action(record) if [Issue, MergeRequest].include? record.class - Event::CREATED + Event::Created elsif record.kind_of? Note - Event::COMMENTED + Event::Commented end end end @@ -79,19 +79,19 @@ class Event < ActiveRecord::Base end def push? - action == self.class::PUSHED && valid_push? + action == self.class::Pushed && valid_push? end def merged? - action == self.class::MERGED + action == self.class::Merged end def closed? - action == self.class::CLOSED + action == self.class::Closed end def reopened? - action == self.class::REOPENED + action == self.class::Reopened end def milestone? @@ -111,11 +111,11 @@ class Event < ActiveRecord::Base end def joined? - action == JOINED + action == Joined end def left? - action == LEFT + action == Left end def membership_changed? @@ -130,6 +130,10 @@ class Event < ActiveRecord::Base target if target_type == "MergeRequest" end + def author + @author ||= User.find(author_id) + end + def action_name if closed? "closed" diff --git a/app/models/gollum_wiki.rb b/app/models/gollum_wiki.rb deleted file mode 100644 index 16e801c1..00000000 --- a/app/models/gollum_wiki.rb +++ /dev/null @@ -1,121 +0,0 @@ -class GollumWiki - - MARKUPS = { - "Markdown" => :markdown, - "RDoc" => :rdoc - } - - class CouldNotCreateWikiError < StandardError; end - - # Returns a string describing what went wrong after - # an operation fails. - attr_reader :error_message - - def initialize(project, user = nil) - @project = project - @user = user - end - - def path_with_namespace - @project.path_with_namespace + ".wiki" - end - - def url_to_repo - gitlab_shell.url_to_repo(path_with_namespace) - 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 - - # Returns the Gollum::Wiki object. - def wiki - @wiki ||= begin - Gollum::Wiki.new(path_to_repo) - rescue Grit::NoSuchPathError - create_repo! - end - end - - # Returns an Array of Gitlab WikiPage instances or an - # empty Array if this Wiki has no pages. - def pages - wiki.pages.map { |page| WikiPage.new(self, page, true) } - end - - # Returns the last 30 Commit objects across the entire - # repository. - def recent_history - Gitlab::Git::Commit.fresh_commits(wiki.repo, 30) - end - - # Finds a page within the repository based on a tile - # or slug. - # - # title - The human readable or parameterized title of - # the page. - # - # Returns an initialized WikiPage instance or nil - def find_page(title, version = nil) - if page = wiki.page(title, version) - WikiPage.new(self, page, true) - else - nil - end - end - - def create_page(title, content, format = :markdown, message = nil) - commit = commit_details(:created, message, title) - - wiki.write_page(title, format, content, commit) - rescue Gollum::DuplicatePageError => e - @error_message = "Duplicate page: #{e.message}" - return false - end - - def update_page(page, content, format = :markdown, message = nil) - commit = commit_details(:updated, message, page.title) - - wiki.update_page(page, page.name, format, content, commit) - end - - def delete_page(page, message = nil) - wiki.delete_page(page, commit_details(:deleted, message, page.title)) - end - - private - - def create_repo! - if init_repo(path_with_namespace) - Gollum::Wiki.new(path_to_repo) - else - raise CouldNotCreateWikiError - end - end - - def init_repo(path_with_namespace) - gitlab_shell.add_repository(path_with_namespace) - end - - def commit_details(action, message = nil, title = nil) - commit_message = message || default_message(action, title) - - {email: @user.email, name: @user.name, message: commit_message} - end - - def default_message(action, title) - "#{@user.username} #{action} page: #{title}" - end - - def gitlab_shell - @gitlab_shell ||= Gitlab::Shell.new - end - - def path_to_repo - @path_to_repo ||= File.join(Gitlab.config.gitlab_shell.repos_path, "#{path_with_namespace}.git") - end -end diff --git a/app/models/group.rb b/app/models/group.rb index 5d838d2b..8ba92980 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -2,14 +2,13 @@ # # 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) -# description :string(255) default(""), not null +# 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) # class Group < Namespace diff --git a/app/models/issue.rb b/app/models/issue.rb index 54d9af7e..40a6c015 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -9,49 +9,24 @@ # 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 -# state :string(255) # class Issue < ActiveRecord::Base include Issuable - attr_accessible :title, :assignee_id, :position, :description, - :milestone_id, :label_list, :author_id_of_changes, - :state_event + attr_accessible :title, :assignee_id, :closed, :position, :description, + :milestone_id, :label_list, :author_id_of_changes acts_as_taggable_on :labels - class << self - def cared(user) - where('assignee_id = :user', user: user.id) - end + validates :description, length: { within: 0..10000 } - def authored(user) - where('author_id = :user', user: user.id) - end - - def open_for(user) - opened.assigned(user) - end - end - - state_machine :state, initial: :opened do - event :close do - transition [:reopened, :opened] => :closed - end - - event :reopen do - transition closed: :reopened - end - - state :opened - - state :reopened - - state :closed + def self.open_for(user) + opened.assigned(user) end end diff --git a/app/models/key.rb b/app/models/key.rb index 53eee511..2bf50f56 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -21,10 +21,11 @@ class Key < ActiveRecord::Base attr_accessible :key, :title before_validation :strip_white_space + before_save :set_identifier validates :title, presence: true, length: { within: 0..255 } - validates :key, presence: true, length: { within: 0..5000 }, format: { :with => /ssh-.{3} / }, uniqueness: true - validate :fingerprintable_key + validates :key, presence: true, length: { within: 0..5000 }, format: { :with => /ssh-.{3} / } + validate :unique_key, :fingerprintable_key delegate :name, :email, to: :user, prefix: true @@ -32,9 +33,17 @@ class Key < ActiveRecord::Base self.key = self.key.strip unless self.key.blank? end + 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 + 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 @@ -44,11 +53,19 @@ class Key < ActiveRecord::Base file.close file.unlink # deletes the temp file end - errors.add(:key, "can't be fingerprinted") if $?.exitstatus != 0 + errors.add(:key, "can't be fingerprinted") if fingerprint_output.match("failed") + end + + 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 def is_deploy_key - !!project_id + true if project_id end # projects that has this key @@ -60,7 +77,7 @@ class Key < ActiveRecord::Base end end - def shell_id - "key-#{self.id}" + def last_deploy? + Key.where(identifier: identifier).count == 0 end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 6ce94417..b6ea85f6 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -9,13 +9,14 @@ # 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 -# state :string(255) -# merge_status :string(255) # require Rails.root.join("app/models/commit") @@ -24,74 +25,44 @@ require Rails.root.join("lib/static_model") class MergeRequest < ActiveRecord::Base include Issuable - BROKEN_DIFF = "--broken-diff" - - attr_accessible :title, :assignee_id, :target_branch, :source_branch, :milestone_id, - :author_id_of_changes, :state_event + attr_accessible :title, :assignee_id, :closed, :target_branch, :source_branch, :milestone_id, + :author_id_of_changes attr_accessor :should_remove_source_branch - state_machine :state, initial: :opened do - event :close do - transition [:reopened, :opened] => :closed - end + BROKEN_DIFF = "--broken-diff" - event :merge do - transition [:reopened, :opened] => :merged - end - - event :reopen do - transition closed: :reopened - end - - state :opened - - state :reopened - - state :closed - - state :merged - end - - state_machine :merge_status, initial: :unchecked do - event :mark_as_unchecked do - transition [:can_be_merged, :cannot_be_merged] => :unchecked - end - - event :mark_as_mergeable do - transition unchecked: :can_be_merged - end - - event :mark_as_unmergeable do - transition unchecked: :cannot_be_merged - end - - state :unchecked - - state :can_be_merged - - state :cannot_be_merged - end + UNCHECKED = 1 + CAN_BE_MERGED = 2 + CANNOT_BE_MERGED = 3 serialize :st_commits serialize :st_diffs validates :source_branch, presence: true validates :target_branch, presence: true - validate :validate_branches + validate :validate_branches - scope :merged, -> { with_state(:merged) } - scope :by_branch, ->(branch_name) { where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name) } - scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) } - scope :by_milestone, ->(milestone) { where(milestone_id: milestone) } + def self.find_all_by_branch(branch_name) + where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name) + end - # Closed scope for merge request should return - # both merged and closed mr's - scope :closed, -> { with_states(:closed, :merged) } + def self.find_all_by_milestone(milestone) + where("milestone_id = :milestone_id", milestone_id: milestone) + end + + def human_state + states = { + CAN_BE_MERGED => "can_be_merged", + CANNOT_BE_MERGED => "cannot_be_merged", + UNCHECKED => "unchecked" + } + states[self.state] + end def validate_branches if target_branch == source_branch - errors.add :branch_conflict, "You can not use same branch for source and target branches" + errors.add :base, "You can not use same branch for source and target branches" end end @@ -100,12 +71,26 @@ class MergeRequest < ActiveRecord::Base self.reloaded_diffs end + def unchecked? + state == UNCHECKED + end + + def mark_as_unchecked + self.state = UNCHECKED + self.save + end + + def can_be_merged? + state == CAN_BE_MERGED + end + def check_if_can_be_merged - if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged? - mark_as_mergeable - else - mark_as_unmergeable - end + self.state = if Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged? + CAN_BE_MERGED + else + CANNOT_BE_MERGED + end + self.save end def diffs @@ -113,7 +98,7 @@ class MergeRequest < ActiveRecord::Base end def reloaded_diffs - if opened? && unmerged_diffs.any? + if open? && unmerged_diffs.any? self.st_diffs = unmerged_diffs self.save end @@ -143,41 +128,44 @@ class MergeRequest < ActiveRecord::Base commits.first end + def merged? + merged && merge_event + end + def merge_event - self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::MERGED).last + self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Merged).last end def closed_event - self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::CLOSED).last + self.project.events.where(target_id: self.id, target_type: "MergeRequest", action: Event::Closed).last end def commits - if st_commits.present? - # check if merge request commits are valid - if st_commits.first.respond_to?(:short_id) - st_commits - else - # if commits are invalid - simply reload it from repo - reloaded_commits - end - else - [] - end + st_commits || [] end def probably_merged? unmerged_commits.empty? && - commits.any? && opened? + commits.any? && open? + end + + def open? + !closed + end + + def mark_as_merged! + self.merged = true + self.closed = true + save + end + + def mark_as_unmergable + self.state = CANNOT_BE_MERGED + self.save end def reloaded_commits - if opened? && unmerged_commits.any? - # we need to reset st_commits field first - # in order to prevent internal rails comparison - self.st_commits = [] - save - - # Then we can safely write unmerged commits + if open? && unmerged_commits.any? self.st_commits = unmerged_commits save end @@ -185,15 +173,22 @@ class MergeRequest < ActiveRecord::Base end def unmerged_commits - self.project.repository. + self.project.repo. commits_between(self.target_branch, self.source_branch). + map {|c| Commit.new(c)}. sort_by(&:created_at). reverse end def merge!(user_id) - self.author_id_of_changes = user_id - self.merge + self.mark_as_merged! + Event.create( + project: self.project, + action: Event::Merged, + target_id: self.id, + target_type: "MergeRequest", + author_id: user_id + ) end def automerge!(current_user) @@ -202,7 +197,7 @@ class MergeRequest < ActiveRecord::Base true end rescue - mark_as_unmergeable + self.mark_as_unmergable false end diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 2a9b9e44..8b4c895d 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -7,38 +7,25 @@ # 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 -# state :string(255) # class Milestone < ActiveRecord::Base - attr_accessible :title, :description, :due_date, :state_event, :author_id_of_changes + attr_accessible :title, :description, :due_date, :closed, :author_id_of_changes attr_accessor :author_id_of_changes belongs_to :project has_many :issues has_many :merge_requests - scope :active, -> { with_state(:active) } - scope :closed, -> { with_state(:closed) } + scope :active, where(closed: false) + scope :closed, where(closed: true) validates :title, presence: true validates :project, presence: true - - state_machine :state, initial: :active do - event :close do - transition active: :closed - end - - event :activate do - transition closed: :active - end - - state :closed - - state :active - end + validates :closed, inclusion: { in: [true, false] } def expired? if due_date @@ -81,13 +68,17 @@ class Milestone < ActiveRecord::Base end def can_be_closed? - active? && issues.opened.count.zero? + open? && issues.opened.count.zero? end def is_empty? total_items_count.zero? end + def open? + !closed + end + def author_id author_id_of_changes end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index cb7164ea..ad04d0ef 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -2,41 +2,37 @@ # # 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) -# description :string(255) default(""), not null +# 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) # class Namespace < ActiveRecord::Base - include Gitlab::ShellAdapter - - attr_accessible :name, :description, :path + attr_accessible :name, :path has_many :projects, dependent: :destroy belongs_to :owner, class_name: "User" - validates :owner, presence: true - validates :name, presence: true, uniqueness: true, - length: { within: 0..255 }, - format: { with: Gitlab::Regex.name_regex, - message: "only letters, digits, spaces & '_' '-' '.' allowed." } - validates :description, length: { within: 0..255 } + validates :name, presence: true, uniqueness: true validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, format: { with: Gitlab::Regex.path_regex, message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } + validates :owner, presence: true delegate :name, to: :owner, allow_nil: true, prefix: true after_create :ensure_dir_exist - after_update :move_dir, if: :path_changed? + after_update :move_dir + after_commit :update_gitolite, on: :update, if: :require_update_gitolite after_destroy :rm_dir - scope :root, -> { where('type IS NULL') } + 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}%") @@ -55,34 +51,54 @@ class Namespace < ActiveRecord::Base end def ensure_dir_exist - gitlab_shell.add_namespace(path) + unless dir_exists? + FileUtils.mkdir( namespace_full_path, mode: 0770 ) + end end - def rm_dir - gitlab_shell.rm_namespace(path) + 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 - if gitlab_shell.mv_namespace(path_was, path) - # If repositories moved successfully we need to remove old satellites - # and send update instructions to users. - # However we cannot allow rollback since we moved namespace dir - # So we basically we mute exceptions in next actions - begin - gitlab_shell.rm_satellites(path_was) - send_update_instructions - rescue - # Returning false does not rolback after_* transaction but gives - # us information about failing some of tasks - false + 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 + + + begin + # Remove satellite when moving repo + if path_was.present? + satellites_path = File.join(Gitlab.config.satellites.path, path_was) + FileUtils.rm_r( satellites_path, force: true ) + end + + 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 - else - # if we cannot move namespace directory we should rollback - # db changes in order to prevent out of sync between db and fs - raise Exception.new('namespace directory cannot be moved') 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) + FileUtils.rm_r( dir_path, force: true ) + end + def send_update_instructions projects.each(&:send_move_instructions) end diff --git a/app/models/network/commit.rb b/app/models/network/commit.rb deleted file mode 100644 index 3cd0c015..00000000 --- a/app/models/network/commit.rb +++ /dev/null @@ -1,39 +0,0 @@ -require "grit" - -module Network - class Commit - include ActionView::Helpers::TagHelper - - attr_reader :refs - attr_accessor :time, :spaces, :parent_spaces - - def initialize(raw_commit, refs) - @commit = Gitlab::Git::Commit.new(raw_commit) - @time = -1 - @spaces = [] - @parent_spaces = [] - @refs = refs || [] - end - - def method_missing(m, *args, &block) - @commit.send(m, *args, &block) - end - - def space - if @spaces.size > 0 - @spaces.first - else - 0 - end - end - - def parents(map) - @commit.parents.map do |p| - if map.include?(p.id) - map[p.id] - end - end - .compact - end - end -end diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb deleted file mode 100644 index 2957adbf..00000000 --- a/app/models/network/graph.rb +++ /dev/null @@ -1,286 +0,0 @@ -require "grit" - -module Network - class Graph - attr_reader :days, :commits, :map - - def self.max_count - @max_count ||= 650 - end - - def initialize project, ref, commit - @project = project - @ref = ref - @commit = commit - @repo = project.repo - - @commits = collect_commits - @days = index_commits - end - - protected - - # Get commits from repository - # - def collect_commits - refs_cache = build_refs_cache - - find_commits(count_to_display_commit_in_center) - .map do |commit| - # Decorate with app/model/network/commit.rb - Network::Commit.new(commit, refs_cache[commit.id]) - end - end - - # Method is adding time and space on the - # list of commits. As well as returns date list - # corelated with time set on commits. - # - # @return [Array] list of commit dates corelated with time on commits - def index_commits - days = [] - @map = {} - @reserved = {} - - @commits.each_with_index do |c,i| - c.time = i - days[i] = c.committed_date - @map[c.id] = c - @reserved[i] = [] - end - - commits_sort_by_ref.each do |commit| - place_chain(commit) - end - - # find parent spaces for not overlap lines - @commits.each do |c| - c.parent_spaces.concat(find_free_parent_spaces(c)) - end - - days - end - - # Skip count that the target commit is displayed in center. - def count_to_display_commit_in_center - offset = -1 - skip = 0 - while offset == -1 - tmp_commits = find_commits(skip) - if tmp_commits.size > 0 - index = tmp_commits.index do |c| - c.id == @commit.id - end - - if index - # Find the target commit - offset = index + skip - else - skip += self.class.max_count - end - else - # Cant't find the target commit in the repo. - offset = 0 - end - end - - if self.class.max_count / 2 < offset then - # get max index that commit is displayed in the center. - offset - self.class.max_count / 2 - else - 0 - end - end - - def find_commits(skip = 0) - Grit::Commit.find_all( - @repo, - nil, - { - date_order: true, - max_count: self.class.max_count, - skip: skip - } - ) - end - - def commits_sort_by_ref - @commits.sort do |a,b| - if include_ref?(a) - -1 - elsif include_ref?(b) - 1 - else - b.committed_date <=> a.committed_date - end - end - end - - def include_ref?(commit) - heads = commit.refs.select do |ref| - ref.is_a?(Grit::Head) or ref.is_a?(Grit::Remote) or ref.is_a?(Grit::Tag) - end - - heads.map! do |head| - head.name - end - - heads.include?(@ref) - end - - def find_free_parent_spaces(commit) - spaces = [] - - commit.parents(@map).each do |parent| - range = commit.time..parent.time - - space = if commit.space >= parent.space then - find_free_parent_space(range, parent.space, -1, commit.space) - else - find_free_parent_space(range, commit.space, -1, parent.space) - end - - mark_reserved(range, space) - spaces << space - end - - spaces - end - - def find_free_parent_space(range, space_base, space_step, space_default) - if is_overlap?(range, space_default) then - find_free_space(range, space_step, space_base, space_default) - else - space_default - end - end - - def is_overlap?(range, overlap_space) - range.each do |i| - if i != range.first && - i != range.last && - @commits[i].spaces.include?(overlap_space) then - - return true; - end - end - - false - end - - # Add space mark on commit and its parents - # - # @param [::Commit] the commit object. - def place_chain(commit, parent_time = nil) - leaves = take_left_leaves(commit) - if leaves.empty? - return - end - - time_range = leaves.first.time..leaves.last.time - space_base = get_space_base(leaves) - space = find_free_space(time_range, 2, space_base) - leaves.each do |l| - l.spaces << space - # Also add space to parent - l.parents(@map).each do |parent| - if parent.space > 0 - parent.spaces << space - end - end - end - - # and mark it as reserved - if parent_time.nil? - min_time = leaves.first.time - else - min_time = parent_time + 1 - end - - max_time = leaves.last.time - leaves.last.parents(@map).each do |parent| - if max_time < parent.time - max_time = parent.time - end - end - mark_reserved(min_time..max_time, space) - - # Visit branching chains - leaves.each do |l| - parents = l.parents(@map).select{|p| p.space.zero?} - for p in parents - place_chain(p, l.time) - end - end - end - - def get_space_base(leaves) - space_base = 1 - parents = leaves.last.parents(@map) - if parents.size > 0 - if parents.first.space > 0 - space_base = parents.first.space - end - end - space_base - end - - def mark_reserved(time_range, space) - for day in time_range - @reserved[day].push(space) - end - end - - def find_free_space(time_range, space_step, space_base = 1, space_default = nil) - space_default ||= space_base - - reserved = [] - for day in time_range - reserved += @reserved[day] - end - reserved.uniq! - - space = space_default - while reserved.include?(space) do - space += space_step - if space < space_base then - space_step *= -1 - space = space_base + space_step - end - end - - space - end - - # Takes most left subtree branch of commits - # which don't have space mark yet. - # - # @param [::Commit] the commit object. - # - # @return [Array] list of branch commits - def take_left_leaves(raw_commit) - commit = @map[raw_commit.id] - leaves = [] - leaves.push(commit) if commit.space.zero? - - while true - return leaves if commit.parents(@map).count.zero? - - commit = commit.parents(@map).first - - return leaves unless commit.space.zero? - - leaves.push(commit) - end - end - - def build_refs_cache - refs_cache = {} - @repo.refs.each do |ref| - refs_cache[ref.commit.id] = [] unless refs_cache.include?(ref.commit.id) - refs_cache[ref.commit.id] << ref - end - refs_cache - end - end -end diff --git a/app/models/note.rb b/app/models/note.rb index f26420ca..ded126b4 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -22,6 +22,9 @@ class Note < ActiveRecord::Base attr_accessible :note, :noteable, :noteable_id, :noteable_type, :project_id, :attachment, :line_code, :commit_id + attr_accessor :notify + attr_accessor :notify_author + belongs_to :project belongs_to :noteable, polymorphic: true belongs_to :author, class_name: "User" @@ -40,8 +43,8 @@ class Note < ActiveRecord::Base # Scopes 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 :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") } @@ -135,11 +138,19 @@ class Note < ActiveRecord::Base super end # Temp fix to prevent app crash - # if note commit id doesn't exist + # if note commit id doesnt exist rescue nil end + def notify + @notify ||= false + end + + def notify_author + @notify_author ||= false + end + # Returns true if this is an upvote note, # otherwise false is returned def upvote? diff --git a/app/models/notification.rb b/app/models/notification.rb deleted file mode 100644 index bfd1e2cf..00000000 --- a/app/models/notification.rb +++ /dev/null @@ -1,30 +0,0 @@ -class Notification - # - # Notification levels - # - N_DISABLED = 0 - N_PARTICIPATING = 1 - N_WATCH = 2 - - attr_accessor :user - - def self.notification_levels - [N_DISABLED, N_PARTICIPATING, N_WATCH] - end - - def initialize(user) - @user = user - end - - def disabled? - user.notification_level == N_DISABLED - end - - def participating? - user.notification_level == N_PARTICIPATING - end - - def watch? - user.notification_level == N_WATCH - end -end diff --git a/app/models/project.rb b/app/models/project.rb index 0263ffef..fa38093b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -8,6 +8,7 @@ # description :text # created_at :datetime not null # updated_at :datetime not null +# private_flag :boolean default(TRUE), not null # creator_id :integer # default_branch :string(255) # issues_enabled :boolean default(TRUE), not null @@ -15,51 +16,44 @@ # merge_requests_enabled :boolean default(TRUE), not null # wiki_enabled :boolean default(TRUE), not null # namespace_id :integer -# public :boolean default(FALSE), not null -# issues_tracker :string(255) default("gitlab"), not null -# issues_tracker_id :string(255) -# snippets_enabled :boolean default(TRUE), not null # require "grit" class Project < ActiveRecord::Base - include Gitlab::ShellAdapter - extend Enumerize + include Gitolited - attr_accessible :name, :path, :description, :default_branch, :issues_tracker, - :issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, - :wiki_enabled, :public, :import_url, as: [:default, :admin] + class TransferError < StandardError; end + + attr_accessible :name, :path, :description, :default_branch, :issues_enabled, + :wall_enabled, :merge_requests_enabled, :wiki_enabled, :public, as: [:default, :admin] attr_accessible :namespace_id, :creator_id, as: :admin - attr_accessor :import_url + attr_accessor :error_code # Relations - belongs_to :creator, foreign_key: "creator_id", class_name: "User" - belongs_to :group, foreign_key: "namespace_id", conditions: "type = 'Group'" + belongs_to :group, foreign_key: "namespace_id", conditions: "type = 'Group'" belongs_to :namespace - has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id' - has_one :gitlab_ci_service, dependent: :destroy - - has_many :events, dependent: :destroy - has_many :merge_requests, dependent: :destroy - has_many :issues, dependent: :destroy, order: "state DESC, created_at DESC" - has_many :milestones, dependent: :destroy - has_many :users_projects, dependent: :destroy - has_many :notes, dependent: :destroy - has_many :snippets, dependent: :destroy - has_many :deploy_keys, dependent: :destroy, class_name: "Key", foreign_key: "project_id" - has_many :hooks, dependent: :destroy, class_name: "ProjectHook" - has_many :wikis, dependent: :destroy - has_many :protected_branches, dependent: :destroy - has_many :user_team_project_relationships, dependent: :destroy + belongs_to :creator, + class_name: "User", + foreign_key: "creator_id" has_many :users, through: :users_projects - has_many :user_teams, through: :user_team_project_relationships - has_many :user_team_user_relationships, through: :user_teams - has_many :user_teams_members, through: :user_team_user_relationships + has_many :events, dependent: :destroy + has_many :merge_requests, dependent: :destroy + has_many :issues, dependent: :destroy, order: "closed, created_at DESC" + has_many :milestones, dependent: :destroy + has_many :users_projects, dependent: :destroy + has_many :notes, dependent: :destroy + has_many :snippets, dependent: :destroy + has_many :deploy_keys, dependent: :destroy, foreign_key: "project_id", class_name: "Key" + has_many :hooks, dependent: :destroy, class_name: "ProjectHook" + has_many :wikis, dependent: :destroy + has_many :protected_branches, dependent: :destroy + has_one :last_event, class_name: 'Event', order: 'events.created_at DESC', foreign_key: 'project_id' + has_one :gitlab_ci_service, dependent: :destroy delegate :name, to: :owner, allow_nil: true, prefix: true @@ -74,29 +68,20 @@ class Project < ActiveRecord::Base message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } validates :issues_enabled, :wall_enabled, :merge_requests_enabled, :wiki_enabled, inclusion: { in: [true, false] } - validates :issues_tracker_id, length: { within: 0..255 } validates_uniqueness_of :name, scope: :namespace_id validates_uniqueness_of :path, scope: :namespace_id - validates :import_url, - format: { with: URI::regexp(%w(http https)), message: "should be a valid url" }, - if: :import? - validate :check_limit, :repo_name # Scopes 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 :without_team, ->(team) { team.projects.present? ? where("id NOT IN (:ids)", ids: team.projects.map(&:id)) : scoped } - scope :in_team, ->(team) { where("id IN (:ids)", ids: team.projects.map(&:id)) } 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) } - scope :public_only, -> { where(public: true) } - - enumerize :issues_tracker, :in => (Gitlab.config.issues_tracker.keys).append(:gitlab), :default => :gitlab + scope :public, where(public: true) class << self def abandoned @@ -108,7 +93,7 @@ class Project < ActiveRecord::Base end def with_push - includes(:events).where('events.action = ?', Event::PUSHED) + includes(:events).where('events.action = ?', Event::Pushed) end def active @@ -137,31 +122,37 @@ class Project < ActiveRecord::Base end def team - @team ||= ProjectTeam.new(self) + @team ||= Team.new(self) end def repository - @repository ||= Repository.new(path_with_namespace, default_branch) + 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 def saved? - id && persisted? - end - - def import? - import_url.present? + id && valid? end def check_limit unless creator.can_create_project? - errors[:limit_reached] << ("Your own projects limit is #{creator.projects_limit}! Please contact administrator to increase it") + 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") end def repo_name - denied_paths = %w(admin dashboard groups help profile projects search) + 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") @@ -200,22 +191,6 @@ class Project < ActiveRecord::Base issues.tag_counts_on(:labels) end - def issue_exists?(issue_id) - if used_default_issues_tracker? - self.issues.where(id: issue_id).first.present? - else - true - end - end - - def used_default_issues_tracker? - self.issues_tracker == Project.issues_tracker.default_value - end - - def can_have_issues_tracker_id? - self.issues_enabled && !self.used_default_issues_tracker? - end - def services [gitlab_ci_service].compact end @@ -262,6 +237,34 @@ class Project < ActiveRecord::Base 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 @@ -284,12 +287,55 @@ class Project < ActiveRecord::Base end end - def transfer(new_namespace) - ProjectTransferService.new.transfer(self, new_namespace) + # 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.async_execute(data) } + hooks.each { |hook| hook.execute(data) } end def execute_services(data) @@ -300,12 +346,68 @@ class Project < ActiveRecord::Base end end - def discover_default_branch - # 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) + # 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) @@ -314,7 +416,7 @@ class Project < ActiveRecord::Base c_ids = self.repository.commits_between(oldrev, newrev).map(&:id) # Update code for merge requests - mrs = self.merge_requests.opened.by_branch(branch_name).all + 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 @@ -326,18 +428,14 @@ class Project < ActiveRecord::Base end def valid_repo? - repository.exists? + repo rescue errors.add(:path, "Invalid repository path") false end def empty_repo? - !repository.exists? || repository.empty? - end - - def ensure_satellite_exists - self.satellite.create unless self.satellite.exists? + !repository || repository.empty? end def satellite @@ -349,33 +447,34 @@ class Project < ActiveRecord::Base end def url_to_repo - gitlab_shell.url_to_repo(path_with_namespace) + 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.exists? + @repo_exists ||= (repository && repository.branches.present?) rescue @repo_exists = false end def open_branches - all_branches = repository.branches - - if protected_branches.present? - all_branches.reject! do |branch| - protected_branches_names.include?(branch.name) - end - end - - all_branches - end - - def protected_branches_names - @protected_branches_names ||= protected_branches.map(&:name) + 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) @@ -390,13 +489,8 @@ class Project < ActiveRecord::Base http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('') end - def project_access_human(member) - project_user_relation = self.users_projects.find_by_user_id(member.id) - self.class.access_options.key(project_user_relation.project_access) - end - # Check if current branch name is marked as protected in the system def protected_branch? branch_name - protected_branches_names.include?(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 16379720..3308caf3 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -10,7 +10,7 @@ # class ProtectedBranch < ActiveRecord::Base - include Gitlab::ShellAdapter + include Gitolited attr_accessible :name @@ -18,6 +18,13 @@ class ProtectedBranch < ActiveRecord::Base validates :name, presence: true validates :project, presence: true + after_save :update_repository + after_destroy :update_repository + + def update_repository + gitolite.update_repository(project) + end + def commit project.repository.commit(self.name) end diff --git a/app/models/repository.rb b/app/models/repository.rb index ed600e29..9032905c 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1,45 +1,169 @@ class Repository - attr_accessor :raw_repository + # Repository directory name with namespace direcotry + # Examples: + # gitlab/gitolite + # diaspora + # + attr_accessor :path_with_namespace - def initialize(path_with_namespace, default_branch) - @raw_repository = Gitlab::Git::Repository.new(path_with_namespace, default_branch) - rescue Gitlab::Git::Repository::NoRepository - nil + # 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 end - def exists? - raw_repository + def raw + repo end - def empty? - raw_repository.empty? + def path_to_repo + @path_to_repo ||= File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git") end - def commit(id = nil) - commit = raw_repository.commit(id) - commit = Commit.new(commit) if commit - commit + def repo + @repo ||= Grit::Repo.new(path_to_repo) + end + + def commit(commit_id = nil) + Commit.find_or_first(repo, commit_id, root_ref) + end + + def fresh_commits(n = 10) + Commit.fresh_commits(repo, n) + end + + def commits_with_refs(n = 20) + Commit.commits_with_refs(repo, n) + end + + def commits_since(date) + Commit.commits_since(repo, date) end def commits(ref, path = nil, limit = nil, offset = nil) - commits = raw_repository.commits(ref, path, limit, offset) - commits = Commit.decorate(commits) if commits.present? - commits + Commit.commits(repo, ref, path, limit, offset) end - def commits_between(target, source) - commits = raw_repository.commits_between(target, source) - commits = Commit.decorate(commits) if commits.present? - commits + def last_commit_for(ref, path = nil) + commits(ref, path, 1).first end - def method_missing(m, *args, &block) - raw_repository.send(m, *args, &block) + def commits_between(from, to) + Commit.commits_between(repo, from, to) end - def respond_to?(method) - return true if raw_repository.respond_to?(method) + def has_post_receive_file? + !!hook_file + end - super + def valid_post_receive_file? + valid_hook_file == hook_file + end + + def valid_hook_file + @valid_hook_file ||= File.read(Rails.root.join('lib', 'hooks', 'post-receive')) + end + + 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 + + # Returns an Array of branch names + def branch_names + repo.branches.collect(&:name).sort + end + + # Returns an Array of Branches + def branches + repo.branches.sort_by(&:name) + end + + # Returns an Array of tag names + def tag_names + repo.tags.collect(&:name).sort.reverse + end + + # Returns an Array of Tags + def tags + repo.tags.sort_by(&:name).reverse + end + + # Returns an Array of branch and tag names + def ref_names + [branch_names + tag_names].flatten + end + + def heads + @heads ||= repo.heads + end + + def tree(fcommit, path = nil) + fcommit = commit if fcommit == :head + tree = fcommit.tree + path ? (tree / path) : tree + end + + 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 + # + # - 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) + 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 + + # Archive Project to .tar.gz + # + # Already packed repo archives stored at + # app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz + # + def archive_repo(ref) + ref = ref || self.root_ref + commit = self.commit(ref) + return nil unless commit + + # Build file path + file_name = self.path_with_namespace.gsub("/","_") + "-" + commit.id.to_s + ".tar.gz" + storage_path = Rails.root.join("tmp", "repositories") + file_path = File.join(storage_path, file_name) + + # Put files into a directory before archiving + prefix = self.path_with_namespace + "/" + + # 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 end diff --git a/app/models/snippet.rb b/app/models/snippet.rb index c4ee35e0..8d7eb788 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -28,12 +28,12 @@ class Snippet < ActiveRecord::Base validates :project, presence: true validates :title, presence: true, length: { within: 0..255 } validates :file_name, presence: true, length: { within: 0..255 } - validates :content, presence: true + validates :content, presence: true, length: { within: 0..10000 } # Scopes - scope :fresh, -> { order("created_at DESC") } - scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) } - scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) } + scope :fresh, order("created_at DESC") + scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current]) + scope :expired, where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) def self.content_types [ diff --git a/app/models/system_hook.rb b/app/models/system_hook.rb index 5cdf0466..5f1bd647 100644 --- a/app/models/system_hook.rb +++ b/app/models/system_hook.rb @@ -12,4 +12,13 @@ # class SystemHook < WebHook + def self.all_hooks_fire(data) + SystemHook.all.each do |sh| + sh.async_execute data + end + end + + def async_execute(data) + Sidekiq::Client.enqueue(SystemHookWorker, id, data) + end end diff --git a/app/models/project_team.rb b/app/models/team.rb similarity index 72% rename from app/models/project_team.rb rename to app/models/team.rb index f3e5c0e5..f235d20e 100644 --- a/app/models/project_team.rb +++ b/app/models/team.rb @@ -1,4 +1,4 @@ -class ProjectTeam +class Team attr_accessor :project def initialize(project) @@ -21,10 +21,6 @@ class ProjectTeam end end - def get_tm user_id - project.users_projects.find_by_user_id(user_id) - end - def add_user(user, access) add_users_ids([user.id], access) end @@ -66,6 +62,28 @@ class ProjectTeam 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 @@ -90,6 +108,7 @@ class ProjectTeam source_team.each do |tm| tm.save end + target_project.update_repository end true diff --git a/app/models/tree.rb b/app/models/tree.rb index 4b6c5b13..96395a42 100644 --- a/app/models/tree.rb +++ b/app/models/tree.rb @@ -26,12 +26,4 @@ class Tree def empty? data.blank? end - - def up_dir? - path.present? - end - - def readme - @readme ||= contents.find { |c| c.is_a?(Grit::Blob) and c.name =~ /^readme/i } - end end diff --git a/app/models/user.rb b/app/models/user.rb index dcbf5812..d66ce411 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,18 +22,15 @@ # 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) -# can_create_group :boolean default(TRUE), not null -# can_create_team :boolean default(TRUE), not null -# state :string(255) -# color_scheme_id :integer default(1), not null -# notification_level :integer default(1), not null # class User < ActiveRecord::Base @@ -41,67 +38,27 @@ class User < ActiveRecord::Base :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, - :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, + :skype, :linkedin, :twitter, :dark_scheme, :theme_id, :force_random_password, :extern_uid, :provider, as: [:default, :admin] - attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin + attr_accessible :projects_limit, as: :admin attr_accessor :force_random_password - # Virtual attribute for authenticating by either username or email - attr_accessor :login - - # Add login to attr_accessible - attr_accessible :login - - - # - # Relations - # - # Namespace for personal projects - has_one :namespace, - dependent: :destroy, - foreign_key: :owner_id, - class_name: "Namespace", - conditions: 'type IS NULL' - - # Profile - has_many :keys, dependent: :destroy - - # Groups + has_one :namespace, class_name: "Namespace", foreign_key: :owner_id, conditions: 'type IS NULL', dependent: :destroy has_many :groups, class_name: "Group", foreign_key: :owner_id - # Teams - has_many :own_teams, - class_name: "UserTeam", - foreign_key: :owner_id, - dependent: :destroy + has_many :keys, dependent: :destroy + has_many :users_projects, dependent: :destroy + has_many :issues, foreign_key: :author_id, dependent: :destroy + has_many :notes, foreign_key: :author_id, dependent: :destroy + has_many :merge_requests, foreign_key: :author_id, dependent: :destroy + has_many :events, class_name: "Event", foreign_key: :author_id, dependent: :destroy + has_many :recent_events, class_name: "Event", foreign_key: :author_id, order: "id DESC" + has_many :assigned_issues, class_name: "Issue", foreign_key: :assignee_id, dependent: :destroy + has_many :assigned_merge_requests, class_name: "MergeRequest", foreign_key: :assignee_id, dependent: :destroy - has_many :user_team_user_relationships, dependent: :destroy - has_many :user_teams, through: :user_team_user_relationships - has_many :user_team_project_relationships, through: :user_teams - has_many :team_projects, through: :user_team_project_relationships - - # Projects - has_many :users_projects, dependent: :destroy - has_many :issues, dependent: :destroy, foreign_key: :author_id - has_many :notes, dependent: :destroy, foreign_key: :author_id - has_many :merge_requests, dependent: :destroy, foreign_key: :author_id - has_many :events, dependent: :destroy, foreign_key: :author_id, class_name: "Event" - has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue" - has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest" - has_many :projects, through: :users_projects - - has_many :recent_events, - class_name: "Event", - foreign_key: :author_id, - order: "id DESC" - - # - # Validations - # validates :name, presence: true - validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ } validates :bio, length: { within: 0..255 } validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider} validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0} @@ -109,9 +66,6 @@ class User < ActiveRecord::Base format: { with: Gitlab::Regex.username_regex, message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } - validates :notification_level, - inclusion: { in: Notification.notification_levels }, - presence: true validate :namespace_uniq, if: ->(user) { user.username_changed? } @@ -121,46 +75,16 @@ class User < ActiveRecord::Base delegate :path, to: :namespace, allow_nil: true, prefix: true - state_machine :state, initial: :active do - after_transition any => :blocked do |user, transition| - # Remove user from all projects and - user.users_projects.find_each do |membership| - return false unless membership.destroy - end - end - - event :block do - transition active: :blocked - end - - event :activate do - transition blocked: :active - end - end - # Scopes - scope :admins, -> { where(admin: true) } - scope :blocked, -> { with_state(:blocked) } - scope :active, -> { with_state(:active) } - scope :alphabetically, -> { order('name ASC') } - scope :in_team, ->(team){ where(id: team.member_ids) } - scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) } - scope :potential_team_members, ->(team) { team.members.any? ? active.not_in_team(team) : active } + scope :admins, where(admin: true) + scope :blocked, where(blocked: true) + scope :active, where(blocked: false) + scope :alphabetically, order('name ASC') # # Class methods # class << self - # Devise method overriden to allow sing in with email or username - def find_for_database_authentication(warden_conditions) - conditions = warden_conditions.dup - if login = conditions.delete(:login) - where(conditions).where(["lower(username) = :value OR lower(email) = :value", { value: login.downcase }]).first - else - where(conditions).first - end - end - def filter filter_name case filter_name when "admins"; self.admins @@ -200,22 +124,13 @@ class User < ActiveRecord::Base end def search query - where("name LIKE :query OR email LIKE :query OR username LIKE :query", query: "%#{query}%") + where("name LIKE :query or email LIKE :query", query: "%#{query}%") end end # # Instance methods # - - def to_param - username - end - - def notification - @notification ||= Notification.new(self) - end - def generate_password if self.force_random_password self.password = self.password_confirmation = Devise.friendly_token.first(8) @@ -281,6 +196,17 @@ class User < ActiveRecord::Base UsersProject.where(project_id: authorized_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 @@ -294,11 +220,11 @@ class User < ActiveRecord::Base end def can_create_project? - projects_limit > owned_projects.count + projects_limit > personal_projects.count end def can_create_group? - can?(:create_group, nil) + is_admin? end def abilities @@ -322,7 +248,18 @@ class User < ActiveRecord::Base end def cared_merge_requests - MergeRequest.cared(self) + 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 @@ -350,23 +287,4 @@ class User < ActiveRecord::Base def namespace_id namespace.try :id end - - def authorized_teams - @authorized_teams ||= begin - ids = [] - ids << UserTeam.with_member(self).pluck('user_teams.id') - ids << UserTeam.created_by(self).pluck('user_teams.id') - ids.flatten - - UserTeam.where(id: ids) - end - end - - def owned_teams - UserTeam.where(owner_id: self.id) - end - - def name_with_username - "#{name} (#{username})" - end end diff --git a/app/models/user_team.rb b/app/models/user_team.rb deleted file mode 100644 index 5de2ac6a..00000000 --- a/app/models/user_team.rb +++ /dev/null @@ -1,117 +0,0 @@ -# == Schema Information -# -# Table name: user_teams -# -# id :integer not null, primary key -# name :string(255) -# path :string(255) -# owner_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# description :string(255) default(""), not null -# - -class UserTeam < ActiveRecord::Base - attr_accessible :name, :description, :owner_id, :path - - belongs_to :owner, class_name: User - - has_many :user_team_project_relationships, dependent: :destroy - has_many :user_team_user_relationships, dependent: :destroy - - has_many :projects, through: :user_team_project_relationships - has_many :members, through: :user_team_user_relationships, source: :user - - validates :owner, presence: true - validates :name, presence: true, uniqueness: true, - length: { within: 0..255 }, - format: { with: Gitlab::Regex.name_regex, - message: "only letters, digits, spaces & '_' '-' '.' allowed." } - validates :description, length: { within: 0..255 } - validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, - format: { with: Gitlab::Regex.path_regex, - message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } - - scope :with_member, ->(user){ joins(:user_team_user_relationships).where(user_team_user_relationships: {user_id: user.id}) } - scope :with_project, ->(project){ joins(:user_team_project_relationships).where(user_team_project_relationships: {project_id: project})} - scope :without_project, ->(project){ where("user_teams.id NOT IN (:ids)", ids: (a = with_project(project); a.blank? ? 0 : a))} - scope :created_by, ->(user){ where(owner_id: user) } - - class << self - def search query - where("name LIKE :query OR path LIKE :query", query: "%#{query}%") - end - - def global_id - 'GLN' - end - - def access_roles - UsersProject.access_roles - end - end - - def to_param - path - end - - def assign_to_projects(projects, access) - projects.each do |project| - assign_to_project(project, access) - end - end - - def assign_to_project(project, access) - Gitlab::UserTeamManager.assign(self, project, access) - end - - def resign_from_project(project) - Gitlab::UserTeamManager.resign(self, project) - end - - def add_members(users, access, group_admin) - # reject existing users - users.reject! { |id| member_ids.include?(id.to_i) } - - users.each do |user| - add_member(user, access, group_admin) - end - end - - def add_member(user, access, group_admin) - Gitlab::UserTeamManager.add_member_into_team(self, user, access, group_admin) - end - - def remove_member(user) - Gitlab::UserTeamManager.remove_member_from_team(self, user) - end - - def update_membership(user, options) - Gitlab::UserTeamManager.update_team_user_membership(self, user, options) - end - - def update_project_access(project, permission) - Gitlab::UserTeamManager.update_project_greates_access(self, project, permission) - end - - def max_project_access(project) - user_team_project_relationships.find_by_project_id(project).greatest_access - end - - def human_max_project_access(project) - self.class.access_roles.invert[max_project_access(project)] - end - - def default_projects_access(member) - user_team_user_relationships.find_by_user_id(member).permission - end - - def human_default_projects_access(member) - self.class.access_roles.invert[default_projects_access(member)] - end - - def admin?(member) - user_team_user_relationships.with_user(member).first.group_admin? - end - -end diff --git a/app/models/user_team_project_relationship.rb b/app/models/user_team_project_relationship.rb deleted file mode 100644 index 991510be..00000000 --- a/app/models/user_team_project_relationship.rb +++ /dev/null @@ -1,44 +0,0 @@ -# == Schema Information -# -# Table name: user_team_project_relationships -# -# id :integer not null, primary key -# project_id :integer -# user_team_id :integer -# greatest_access :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -class UserTeamProjectRelationship < ActiveRecord::Base - attr_accessible :greatest_access, :project_id, :user_team_id - - belongs_to :user_team - belongs_to :project - - validates :project, presence: true - validates :user_team, presence: true - validate :check_greatest_access - - scope :with_project, ->(project){ where(project_id: project.id) } - - def team_name - user_team.name - end - - def human_max_access - UserTeam.access_roles.key(greatest_access) - end - - private - - def check_greatest_access - errors.add(:base, :incorrect_access_code) unless correct_access? - end - - def correct_access? - return false if greatest_access.blank? - return true if UsersProject.access_roles.has_value?(greatest_access) - false - end -end diff --git a/app/models/user_team_user_relationship.rb b/app/models/user_team_user_relationship.rb deleted file mode 100644 index 1f7e2625..00000000 --- a/app/models/user_team_user_relationship.rb +++ /dev/null @@ -1,32 +0,0 @@ -# == Schema Information -# -# Table name: user_team_user_relationships -# -# id :integer not null, primary key -# user_id :integer -# user_team_id :integer -# group_admin :boolean -# permission :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -class UserTeamUserRelationship < ActiveRecord::Base - attr_accessible :group_admin, :permission, :user_id, :user_team_id - - belongs_to :user_team - belongs_to :user - - validates :user_team, presence: true - validates :user, presence: true - - scope :with_user, ->(user) { where(user_id: user.id) } - - def user_name - user.name - end - - def access_human - UsersProject.access_roles.invert[permission] - end -end diff --git a/app/models/users_project.rb b/app/models/users_project.rb index c32edf38..79146289 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -11,7 +11,7 @@ # class UsersProject < ActiveRecord::Base - include Gitlab::ShellAdapter + include Gitolited GUEST = 10 REPORTER = 20 @@ -25,21 +25,21 @@ class UsersProject < ActiveRecord::Base 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 :project_access, inclusion: { in: [GUEST, REPORTER, DEVELOPER, MASTER] }, presence: true validates :project, presence: true - delegate :name, :username, :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) } + 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) } - scope :in_projects, ->(projects) { where(project_id: projects.map { |p| p.id }) } - scope :with_user, ->(user) { where(user_id: user.id) } class << self @@ -79,6 +79,7 @@ class UsersProject < ActiveRecord::Base users_project.save end end + Gitlab::Gitolite.new.update_repositories(Project.where(id: project_ids)) end true @@ -93,6 +94,7 @@ class UsersProject < ActiveRecord::Base users_project.skip_git = true users_project.destroy end + Gitlab::Gitolite.new.update_repositories(Project.where(id: project_ids)) end true @@ -123,6 +125,10 @@ class UsersProject < ActiveRecord::Base end end + def update_repository + gitolite.update_repository(project) + end + def project_access_human Project.access_options.key(self.project_access) end diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb index 3f22b108..df58fa93 100644 --- a/app/models/web_hook.rb +++ b/app/models/web_hook.rb @@ -28,18 +28,10 @@ class WebHook < ActiveRecord::Base WebHook.post(url, body: data.to_json, headers: { "Content-Type" => "application/json" }) else post_url = url.gsub("#{parsed_url.userinfo}@", "") - auth = { - username: URI.decode(parsed_url.user), - password: URI.decode(parsed_url.password), - } WebHook.post(post_url, body: data.to_json, headers: {"Content-Type" => "application/json"}, - basic_auth: auth) + basic_auth: {username: parsed_url.user, password: parsed_url.password}) end end - - def async_execute(data) - Sidekiq::Client.enqueue(ProjectWebHookWorker, id, data) - end end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb deleted file mode 100644 index 497d69e8..00000000 --- a/app/models/wiki_page.rb +++ /dev/null @@ -1,181 +0,0 @@ -class WikiPage - include ActiveModel::Validations - include ActiveModel::Conversion - include StaticModel - extend ActiveModel::Naming - - def self.primary_key - 'slug' - end - - def self.model_name - ActiveModel::Name.new(self, nil, 'wiki') - end - - def to_key - [:slug] - end - - validates :title, presence: true - validates :content, presence: true - - # The Gitlab GollumWiki instance. - attr_reader :wiki - - # The raw Gollum::Page instance. - attr_reader :page - - # The attributes Hash used for storing and validating - # new Page values before writing to the Gollum repository. - attr_accessor :attributes - - def initialize(wiki, page = nil, persisted = false) - @wiki = wiki - @page = page - @persisted = persisted - @attributes = {}.with_indifferent_access - - set_attributes if persisted? - end - - # The escaped URL path of this page. - def slug - @attributes[:slug] - end - - alias :to_param :slug - - # The formatted title of this page. - def title - @attributes[:title] || "" - end - - # Sets the title of this page. - def title=(new_title) - @attributes[:title] = new_title - end - - # The raw content of this page. - def content - @attributes[:content] - end - - # The processed/formatted content of this page. - def formatted_content - @attributes[:formatted_content] - end - - # The markup format for the page. - def format - @attributes[:format] || :markdown - end - - # The commit message for this page version. - def message - version.try(:message) - end - - # The Gitlab Commit instance for this page. - def version - return nil unless persisted? - - @version ||= Commit.new(Gitlab::Git::Commit.new(@page.version)) - end - - # Returns an array of Gitlab Commit instances. - def versions - return [] unless persisted? - - @page.versions.map { |v| Commit.new(Gitlab::Git::Commit.new(v)) } - end - - # Returns the Date that this latest version was - # created on. - def created_at - @page.version.date - end - - # Returns boolean True or False if this instance - # is an old version of the page. - def historical? - @page.historical? - end - - # Returns boolean True or False if this instance - # has been fully saved to disk or not. - def persisted? - @persisted == true - end - - # Creates a new Wiki Page. - # - # attr - Hash of attributes to set on the new page. - # :title - The title for the new page. - # :content - The raw markup content. - # :format - Optional symbol representing the - # content format. Can be any type - # listed in the GollumWiki::MARKUPS - # Hash. - # :message - Optional commit message to set on - # the new page. - # - # Returns the String SHA1 of the newly created page - # or False if the save was unsuccessful. - def create(attr = {}) - @attributes.merge!(attr) - - save :create_page, title, content, format, message - end - - # Updates an existing Wiki Page, creating a new version. - # - # new_content - The raw markup content to replace the existing. - # format - Optional symbol representing the content format. - # See GollumWiki::MARKUPS Hash for available formats. - # message - Optional commit message to set on the new version. - # - # Returns the String SHA1 of the newly created page - # or False if the save was unsuccessful. - def update(new_content = "", format = :markdown, message = nil) - @attributes[:content] = new_content - @attributes[:format] = format - - save :update_page, @page, content, format, message - end - - # Destroys the WIki Page. - # - # Returns boolean True or False. - def delete - if wiki.delete_page(@page) - true - else - false - end - end - - private - - def set_attributes - attributes[:slug] = @page.escaped_url_path - attributes[:title] = @page.title - attributes[:content] = @page.raw_data - attributes[:formatted_content] = @page.formatted_data - attributes[:format] = @page.format - end - - def save(method, *args) - if valid? && wiki.send(method, *args) - @page = wiki.wiki.paged(title) - - set_attributes - - @persisted = true - else - errors.add(:base, wiki.error_message) if wiki.error_message - @persisted = false - end - @persisted - end - -end diff --git a/app/observers/activity_observer.rb b/app/observers/activity_observer.rb index ee3e4629..c188e572 100644 --- a/app/observers/activity_observer.rb +++ b/app/observers/activity_observer.rb @@ -1,15 +1,12 @@ -class ActivityObserver < BaseObserver +class ActivityObserver < ActiveRecord::Observer observe :issue, :merge_request, :note, :milestone def after_create(record) event_author_id = record.author_id - if record.kind_of?(Note) - # Skip system status notes like 'status changed to close' - return true if record.note.include?("_Status changed to ") - - # Skip wall notes to prevent spaming of dashboard - return true if record.noteable_type.blank? + # Skip status notes + if record.kind_of?(Note) && record.note.include?("_Status changed to ") + return true end if event_author_id @@ -23,37 +20,15 @@ class ActivityObserver < BaseObserver end end - def after_close(record, transition) - Event.create( - project: record.project, - target_id: record.id, - target_type: record.class.name, - action: Event::CLOSED, - author_id: record.author_id_of_changes - ) - end - - def after_reopen(record, transition) - Event.create( - project: record.project, - target_id: record.id, - target_type: record.class.name, - action: Event::REOPENED, - author_id: record.author_id_of_changes - ) - end - - def after_merge(record, transition) - # Since MR can be merged via sidekiq - # to prevent event duplication do this check - return true if record.merge_event - - Event.create( - project: record.project, - target_id: record.id, - target_type: record.class.name, - action: Event::MERGED, - author_id: record.author_id_of_changes - ) + 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 end diff --git a/app/observers/base_observer.rb b/app/observers/base_observer.rb deleted file mode 100644 index 182d3b7b..00000000 --- a/app/observers/base_observer.rb +++ /dev/null @@ -1,9 +0,0 @@ -class BaseObserver < ActiveRecord::Observer - def notification - NotificationService.new - end - - def log_info message - Gitlab::AppLogger.info message - end -end diff --git a/app/observers/issue_observer.rb b/app/observers/issue_observer.rb index 03ce4b95..262d0f89 100644 --- a/app/observers/issue_observer.rb +++ b/app/observers/issue_observer.rb @@ -1,30 +1,33 @@ -class IssueObserver < BaseObserver +class IssueObserver < ActiveRecord::Observer cattr_accessor :current_user def after_create(issue) - notification.new_issue(issue, current_user) - end - - def after_close(issue, transition) - notification.close_issue(issue, current_user) - - create_note(issue) - end - - def after_reopen(issue, transition) - create_note(issue) + if issue.assignee && issue.assignee != current_user + Notify.delay.new_issue_email(issue.id) + end end def after_update(issue) - if issue.is_being_reassigned? - notification.reassigned_issue(issue, current_user) + 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.delay.issue_status_changed_email(recipient.id, issue.id, status, current_user.id) + end end end protected - # Create issue note with service comment like 'Status changed to closed' - def create_note(issue) - Note.create_status_change_note(issue, current_user, issue.state) + 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.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 28fef55a..bf5fa647 100644 --- a/app/observers/key_observer.rb +++ b/app/observers/key_observer.rb @@ -1,19 +1,12 @@ -class KeyObserver < BaseObserver - def after_save(key) - GitlabShellWorker.perform_async( - :add_key, - key.shell_id, - key.key - ) +class KeyObserver < ActiveRecord::Observer + include Gitolited - notification.new_key(key) + def after_save(key) + gitolite.set_key(key.identifier, key.key, key.projects) end def after_destroy(key) - GitlabShellWorker.perform_async( - :remove_key, - key.shell_id, - key.key, - ) + return if key.is_deploy_key && !key.last_deploy? + 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 d0dfad88..6d3c2bdd 100644 --- a/app/observers/merge_request_observer.rb +++ b/app/observers/merge_request_observer.rb @@ -1,25 +1,31 @@ -class MergeRequestObserver < BaseObserver +class MergeRequestObserver < ActiveRecord::Observer cattr_accessor :current_user def after_create(merge_request) - notification.new_merge_request(merge_request, current_user) - end - - def after_close(merge_request, transition) - Note.create_status_change_note(merge_request, current_user, merge_request.state) - - notification.close_mr(merge_request, current_user) - end - - def after_merge(merge_request, transition) - notification.merge_mr(merge_request) - end - - def after_reopen(merge_request, transition) - Note.create_status_change_note(merge_request, current_user, merge_request.state) + if merge_request.assignee && merge_request.assignee != current_user + Notify.delay.new_merge_request_email(merge_request.id) + end end def after_update(merge_request) - notification.reassigned_merge_request(merge_request, current_user) if merge_request.is_being_reassigned? + 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 + + 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.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 7b79161c..3f6d1dfc 100644 --- a/app/observers/note_observer.rb +++ b/app/observers/note_observer.rb @@ -1,5 +1,37 @@ -class NoteObserver < BaseObserver +class NoteObserver < ActiveRecord::Observer + def after_create(note) - notification.new_note(note) + send_notify_mails(note) + end + + protected + + def send_notify_mails(note) + if note.notify + notify_team(note) + elsif note.notify_author + # Notify only author of resource + Notify.delay.note_commit_email(note.commit_author.id, note.id) + else + # Otherwise ignore it + nil + end + end + + # Notifies the whole team except the author of note + 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.delay.send(notify_method, u.id, note.id) + end + end + end + + def team_without_note_author(note) + note.project.users.reject { |u| u.id == note.author.id } end end diff --git a/app/observers/project_observer.rb b/app/observers/project_observer.rb index 7d7ecdd3..b1c69456 100644 --- a/app/observers/project_observer.rb +++ b/app/observers/project_observer.rb @@ -1,11 +1,6 @@ -class ProjectObserver < BaseObserver +class ProjectObserver < ActiveRecord::Observer def after_create(project) - GitlabShellWorker.perform_async( - :add_repository, - project.path_with_namespace - ) - - log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"") + project.update_repository end def after_update(project) @@ -13,18 +8,18 @@ class ProjectObserver < BaseObserver end def after_destroy(project) - GitlabShellWorker.perform_async( - :remove_repository, - project.path_with_namespace - ) - - GitlabShellWorker.perform_async( - :remove_repository, - project.path_with_namespace + ".wiki" - ) - - project.satellite.destroy - log_info("Project \"#{project.name}\" was removed") + + project.destroy_repository + end + + def after_create project + log_info("#{project.owner.name} created a new project \"#{project.name}\"") + end + + protected + + def log_info message + Gitlab::AppLogger.info message end end diff --git a/app/observers/system_hook_observer.rb b/app/observers/system_hook_observer.rb index 3a649fd5..312cd2b3 100644 --- a/app/observers/system_hook_observer.rb +++ b/app/observers/system_hook_observer.rb @@ -1,11 +1,67 @@ -class SystemHookObserver < BaseObserver +class SystemHookObserver < ActiveRecord::Observer observe :user, :project, :users_project - + def after_create(model) - SystemHooksService.execute_hooks_for(model, :create) + 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 def after_destroy(model) - SystemHooksService.execute_hooks_for(model, :destroy) + 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 end diff --git a/app/observers/user_observer.rb b/app/observers/user_observer.rb index 6bb3c471..c1179ed7 100644 --- a/app/observers/user_observer.rb +++ b/app/observers/user_observer.rb @@ -1,8 +1,8 @@ -class UserObserver < BaseObserver +class UserObserver < ActiveRecord::Observer def after_create(user) log_info("User \"#{user.name}\" (#{user.email}) was created") - notification.new_user(user) + Notify.delay.new_user_email(user.id, user.password) end def after_destroy user @@ -18,4 +18,10 @@ class UserObserver < BaseObserver end end end + + protected + + def log_info message + Gitlab::AppLogger.info message + end end diff --git a/app/observers/users_project_observer.rb b/app/observers/users_project_observer.rb index ca9649c7..b969d6a1 100644 --- a/app/observers/users_project_observer.rb +++ b/app/observers/users_project_observer.rb @@ -1,26 +1,21 @@ -class UsersProjectObserver < BaseObserver +class UsersProjectObserver < ActiveRecord::Observer def after_commit(users_project) return if users_project.destroyed? + Notify.delay.project_access_granted_email(users_project.id) end def after_create(users_project) Event.create( project_id: users_project.project.id, - action: Event::JOINED, + action: Event::Joined, author_id: users_project.user.id ) - - notification.new_team_member(users_project) - end - - def after_update(users_project) - notification.update_team_member(users_project) end def after_destroy(users_project) Event.create( project_id: users_project.project.id, - action: Event::LEFT, + action: Event::Left, author_id: users_project.user.id ) end diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb deleted file mode 100644 index 383e6398..00000000 --- a/app/services/git_push_service.rb +++ /dev/null @@ -1,125 +0,0 @@ -class GitPushService - attr_accessor :project, :user, :push_data - - # This method will be called after each git update - # and only if the provided user and project is present in GitLab. - # - # All callbacks for post receive action should be placed here. - # - # Now this method do next: - # 1. Ensure project satellite exists - # 2. Update merge requests - # 3. Execute project web hooks - # 4. Execute project services - # 5. Create Push Event - # - def execute(project, user, oldrev, newrev, ref) - @project, @user = project, user - - # Collect data for this git push - @push_data = post_receive_data(oldrev, newrev, ref) - - create_push_event - - project.ensure_satellite_exists - project.discover_default_branch - project.repository.expire_cache - - if push_to_branch?(ref, oldrev) - project.update_merge_requests(oldrev, newrev, ref, @user) - project.execute_hooks(@push_data.dup) - project.execute_services(@push_data.dup) - end - end - - # This method provide a sample data - # generated with post_receive_data method - # for given project - # - def sample_data(project, user) - @project, @user = project, user - commits = project.repository.commits(project.default_branch, nil, 3) - post_receive_data(commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}") - end - - protected - - def create_push_event - Event.create( - project: project, - action: Event::PUSHED, - data: push_data, - author_id: push_data[:user_id] - ) - 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) - push_commits = project.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: project.name, - url: project.url_to_repo, - description: project.description, - homepage: project.web_url, - }, - commits: [], - total_commits_count: push_commits_count - } - - # For performance 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}/#{project.path_with_namespace}/commit/#{commit.id}", - author: { - name: commit.author_name, - email: commit.author_email - } - } - end - - data - 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 -end diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb deleted file mode 100644 index f8779fd5..00000000 --- a/app/services/notification_service.rb +++ /dev/null @@ -1,197 +0,0 @@ -# NotificationService class -# -# Used for notifing users with emails about different events -# -# Ex. -# NotificationService.new.new_issue(issue, current_user) -# -class NotificationService - # Always notify user about ssh key added - # only if ssh key is not deploy key - # - # This is security email so it will be sent - # even if user disabled notifications - def new_key(key) - if key.user - Notify.delay.new_ssh_key_email(key.id) - end - end - - # When create an issue we should send next emails: - # - # * issue assignee if his notification level is not Disabled - # * project team members with notification level higher then Participating - # - def new_issue(issue, current_user) - new_resource_email(issue, 'new_issue_email') - end - - # When we close an issue we should send next emails: - # - # * issue author if his notification level is not Disabled - # * issue assignee if his notification level is not Disabled - # * project team members with notification level higher then Participating - # - def close_issue(issue, current_user) - close_resource_email(issue, current_user, 'closed_issue_email') - end - - # When we reassign an issue we should send next emails: - # - # * issue old assignee if his notification level is not Disabled - # * issue new assignee if his notification level is not Disabled - # - def reassigned_issue(issue, current_user) - reassign_resource_email(issue, current_user, 'reassigned_issue_email') - end - - - # When create a merge request we should send next emails: - # - # * mr assignee if his notification level is not Disabled - # - def new_merge_request(merge_request, current_user) - new_resource_email(merge_request, 'new_merge_request_email') - end - - # When we reassign a merge_request we should send next emails: - # - # * merge_request old assignee if his notification level is not Disabled - # * merge_request assignee if his notification level is not Disabled - # - def reassigned_merge_request(merge_request, current_user) - reassign_resource_email(merge_request, current_user, 'reassigned_merge_request_email') - end - - # When we close a merge request we should send next emails: - # - # * merge_request author if his notification level is not Disabled - # * merge_request assignee if his notification level is not Disabled - # * project team members with notification level higher then Participating - # - def close_mr(merge_request, current_user) - close_resource_email(merge_request, current_user, 'closed_merge_request_email') - end - - # When we merge a merge request we should send next emails: - # - # * merge_request author if his notification level is not Disabled - # * merge_request assignee if his notification level is not Disabled - # * project team members with notification level higher then Participating - # - def merge_mr(merge_request) - recipients = reject_muted_users([merge_request.author, merge_request.assignee]) - recipients = recipients.concat(project_watchers(merge_request.project)).uniq - - recipients.each do |recipient| - Notify.delay.merged_merge_request_email(recipient.id, merge_request.id) - end - end - - # Notify new user with email after creation - def new_user(user) - # Dont email omniauth created users - Notify.delay.new_user_email(user.id, user.password) unless user.extern_uid? - end - - # Notify users on new note in system - # - # TODO: split on methods and refactor - # - def new_note(note) - # ignore wall messages - return true unless note.noteable_type.present? - - opts = { noteable_type: note.noteable_type, project_id: note.project_id } - - if note.commit_id.present? - opts.merge!(commit_id: note.commit_id) - recipients = [note.commit_author] - else - opts.merge!(noteable_id: note.noteable_id) - target = note.noteable - recipients = [] - recipients << target.assignee if target.respond_to?(:assignee) - recipients << target.author if target.respond_to?(:author) - end - - # Get users who left comment in thread - recipients = recipients.concat(User.where(id: Note.where(opts).pluck(:author_id))) - - # Merge project watchers - recipients = recipients.concat(project_watchers(note.project)).compact.uniq - - # Reject mutes users - recipients = reject_muted_users(recipients) - - # Reject author - recipients.delete(note.author) - - # build notify method like 'note_commit_email' - notify_method = "note_#{note.noteable_type.underscore}_email".to_sym - - recipients.each do |recipient| - Notify.delay.send(notify_method, recipient.id, note.id) - end - end - - def new_team_member(users_project) - Notify.delay.project_access_granted_email(users_project.id) - end - - def update_team_member(users_project) - Notify.delay.project_access_granted_email(users_project.id) - end - - protected - - # Get project users with WATCH notification level - def project_watchers(project) - project.users.where(notification_level: Notification::N_WATCH) - end - - # Remove users with disabled notifications from array - # Also remove duplications and nil recipients - def reject_muted_users(users) - users.compact.uniq.reject do |user| - user.notification.disabled? - end - end - - def new_resource_email(target, method) - recipients = reject_muted_users([target.assignee]) - recipients = recipients.concat(project_watchers(target.project)).uniq - recipients.delete(target.author) - - recipients.each do |recipient| - Notify.delay.send(method, recipient.id, target.id) - end - end - - def close_resource_email(target, current_user, method) - recipients = reject_muted_users([target.author, target.assignee]) - recipients = recipients.concat(project_watchers(target.project)).uniq - recipients.delete(current_user) - - recipients.each do |recipient| - Notify.delay.send(method, recipient.id, target.id, current_user.id) - end - end - - def reassign_resource_email(target, current_user, method) - recipients = User.where(id: [target.assignee_id, target.assignee_id_was]) - - # Add watchers to email list - recipients = recipients.concat(project_watchers(target.project)) - - # reject users with disabled notifications - recipients = reject_muted_users(recipients) - - # Reject me from recipients if I reassign an item - recipients.delete(current_user) - - recipients.each do |recipient| - Notify.delay.send(method, recipient.id, target.id, target.assignee_id_was) - end - end -end diff --git a/app/services/project_transfer_service.rb b/app/services/project_transfer_service.rb deleted file mode 100644 index 3b8c4847..00000000 --- a/app/services/project_transfer_service.rb +++ /dev/null @@ -1,36 +0,0 @@ -# ProjectTransferService class -# -# Used for transfer project to another namespace -# -class ProjectTransferService - include Gitlab::ShellAdapter - - class TransferError < StandardError; end - - attr_accessor :project - - def transfer(project, new_namespace) - Project.transaction do - old_path = project.path_with_namespace - new_path = File.join(new_namespace.try(:path) || '', project.path) - - if Project.where(path: project.path, namespace_id: new_namespace.try(:id)).present? - raise TransferError.new("Project with same path in target namespace already exists") - end - - project.namespace = new_namespace - project.save! - - # Move main repository - unless gitlab_shell.mv_repository(old_path, new_path) - raise TransferError.new('Cannot move project') - end - - # Move wiki repo also if present - gitlab_shell.mv_repository("#{old_path}.wiki", "#{new_path}.wiki") - - true - end - end -end - diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb deleted file mode 100644 index 132bb14a..00000000 --- a/app/services/system_hooks_service.rb +++ /dev/null @@ -1,59 +0,0 @@ -class SystemHooksService - def self.execute_hooks_for(model, event) - execute_hooks(build_event_data(model, event)) - end - - private - - def self.execute_hooks(data) - SystemHook.all.each do |sh| - async_execute_hook sh, data - end - end - - def self.async_execute_hook(hook, data) - Sidekiq::Client.enqueue(SystemHookWorker, hook.id, data) - end - - def self.build_event_data(model, event) - data = { - event_name: build_event_name(model, event), - created_at: model.created_at - } - - case model - when Project - data.merge!({ - name: model.name, - path: model.path, - project_id: model.id, - owner_name: model.owner.name, - owner_email: model.owner.email - }) - when User - data.merge!({ - name: model.name, - email: model.email - }) - when UsersProject - data.merge!({ - 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 - - def self.build_event_name(model, event) - case model - when UsersProject - return "user_add_to_team" if event == :create - return "user_remove_from_team" if event == :destroy - else - "#{model.class.name.downcase}_#{event.to_s}" - end - end -end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index 200700b8..391731d9 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -8,23 +8,6 @@ class AttachmentUploader < CarrierWave::Uploader::Base end def image? - img_ext = %w(png jpg jpeg) - if file.respond_to?(:extension) - img_ext.include?(file.extension) - else - # Not all CarrierWave storages respond to :extension - ext = file.path.split('.').last - img_ext.include?(ext) - end - rescue - false - end - - def secure_url - if self.class.storage == CarrierWave::Storage::File - "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}" - else - url - end + %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 46a87629..9a5e7ede 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -6,7 +6,7 @@ = link_to admin_projects_path do %h1= Project.count %hr - = link_to 'New Project', new_project_path, class: "btn btn-small" + = link_to 'New Project', new_project_path, class: "btn small" .span4 .ui-box %h5.title Groups @@ -14,7 +14,7 @@ = link_to admin_groups_path do %h1= Group.count %hr - = link_to 'New Group', new_admin_group_path, class: "btn btn-small" + = link_to 'New Group', new_admin_group_path, class: "btn small" .span4 .ui-box %h5.title Users @@ -22,7 +22,7 @@ = link_to admin_users_path do %h1= User.count %hr - = link_to 'New User', new_admin_user_path, class: "btn btn-small" + = link_to 'New User', new_admin_user_path, class: "btn small" .row .span4 @@ -31,7 +31,7 @@ - @projects.each do |project| %p = link_to project.name_with_namespace, [:admin, project] - %span.light.pull-right + %span.light.right = time_ago_in_words project.created_at ago @@ -42,7 +42,7 @@ %p = link_to [:admin, user] do = user.name - %span.light.pull-right + %span.light.right = time_ago_in_words user.created_at ago @@ -51,25 +51,25 @@ %hr %p Issues - %span.light.pull-right + %span.light.right = Issue.count %p Merge Requests - %span.light.pull-right + %span.light.right = MergeRequest.count %p Notes - %span.light.pull-right + %span.light.right = Note.count %p Snippets - %span.light.pull-right + %span.light.right = Snippet.count %p SSH Keys - %span.light.pull-right + %span.light.right = Key.count %p Milestones - %span.light.pull-right + %span.light.right = Milestone.count diff --git a/app/views/admin/groups/edit.html.haml b/app/views/admin/groups/edit.html.haml index bb1398f6..901d07e7 100644 --- a/app/views/admin/groups/edit.html.haml +++ b/app/views/admin/groups/edit.html.haml @@ -1,8 +1,8 @@ -%h3.page_title Edit Group +%h3.page_title Rename Group %hr = form_for [:admin, @group] do |f| - if @group.errors.any? - .alert.alert-error + .alert-message.block-message.error %span= @group.errors.full_messages.first .clearfix.group_name_holder = f.label :name do @@ -10,10 +10,7 @@ .input = f.text_field :name, placeholder: "Example Group", class: "xxlarge" - .clearfix.group-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 + .clearfix.group_name_holder = f.label :path do @@ -27,5 +24,5 @@ %li It will change the git path to repositories under this group. .form-actions - = f.submit 'Edit group', class: "btn btn-remove" - = link_to 'Cancel', admin_groups_path, class: "btn btn-cancel" + = f.submit 'Rename group', class: "btn danger" + = link_to 'Cancel', admin_groups_path, class: "btn cancel-btn" diff --git a/app/views/admin/groups/index.html.haml b/app/views/admin/groups/index.html.haml index 0029cc78..49acedc8 100644 --- a/app/views/admin/groups/index.html.haml +++ b/app/views/admin/groups/index.html.haml @@ -4,11 +4,11 @@ allows you to keep projects organized. Use groups for uniting related projects. - = link_to 'New Group', new_admin_group_path, class: "btn btn-small pull-right" + = link_to 'New Group', new_admin_group_path, class: "btn small right" %br = form_tag admin_groups_path, method: :get, class: 'form-inline' do = text_field_tag :name, params[:name], class: "xlarge" - = submit_tag "Search", class: "btn submit btn-primary" + = submit_tag "Search", class: "btn submit primary" %table %thead @@ -16,7 +16,6 @@ %th Name %i.icon-sort-down - %th Description %th Path %th Projects %th Owner @@ -26,12 +25,11 @@ %tr %td %strong= link_to group.name, [:admin, group] - %td= truncate group.description %td= group.path %td= group.projects.count %td - = link_to group.owner_name, admin_user_path(group.owner) + = link_to group.owner_name, admin_user_path(group.owner_id) %td.bgred - = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small" - = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" + = link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small" + = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger" = paginate @groups, theme: "admin" diff --git a/app/views/admin/groups/new.html.haml b/app/views/admin/groups/new.html.haml index 3fa63e1b..6ff0e781 100644 --- a/app/views/admin/groups/new.html.haml +++ b/app/views/admin/groups/new.html.haml @@ -2,21 +2,15 @@ %hr = form_for [:admin, @group] do |f| - if @group.errors.any? - .alert.alert-error + .alert-message.block-message.error %span= @group.errors.full_messages.first .clearfix = f.label :name do Group name is .input = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" - .clearfix.group-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Create group', class: "btn btn-primary" - +   + = f.submit 'Create group', class: "btn primary" %hr .padded %ul diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 63ea78fd..0a25b125 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -14,28 +14,22 @@ %td = @group.name   - = link_to edit_admin_group_path(@group), class: "btn btn-small pull-right" do + = link_to edit_admin_group_path(@group), class: "btn btn-small right" do %i.icon-edit - Edit - %tr - %td - %b - Description: - %td - = @group.description + Rename %tr %td %b Path: %td - %span.monospace= File.join(Gitlab.config.gitlab_shell.repos_path, @group.path) + %span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path) %tr %td %b Owner: %td = @group.owner_name - .pull-right + .right = link_to "#", class: "btn btn-small change-owner-link" do %i.icon-edit Change owner @@ -48,7 +42,7 @@ = form_for [:admin, @group] do |f| = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} %div - = f.submit 'Change Owner', class: "btn btn-remove" + = f.submit 'Change Owner', class: "btn danger" = link_to "Cancel", "#", class: "btn change-owner-cancel-link" - if @group.projects.any? @@ -69,7 +63,7 @@ %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 btn-remove small" + = 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 @@ -78,23 +72,22 @@ %th Users %th Project Access: - - @group.users.each do |user| - - next unless user - %tr{class: "user_#{user.id}"} - %td.name= link_to user.name, admin_user_path(user) + - @group.users.each do |u| + %tr{class: "user_#{u.id}"} + %td.name= link_to u.name, admin_user_path(u) %td.projects_access - - user.authorized_projects.in_namespace(@group).each do |project| - - u_p = user.users_projects.in_project(project).first + - 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_with_namespace - = link_to "(#{ u_p.project_access_human })", edit_admin_project_member_path(project, user) + = 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 btn-primary" + %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" @@ -116,7 +109,7 @@ .input = select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' .form-actions - = submit_tag 'Add', class: "btn btn-primary" + = submit_tag 'Add', class: "btn primary" :javascript $(function(){ diff --git a/app/views/admin/hooks/index.html.haml b/app/views/admin/hooks/index.html.haml index acbf7a10..f17355fb 100644 --- a/app/views/admin/hooks/index.html.haml +++ b/app/views/admin/hooks/index.html.haml @@ -7,7 +7,7 @@ = form_for @hook, as: :hook, url: admin_hooks_path, html: { class: 'form-inline' } do |f| -if @hook.errors.any? - .alert.alert-error + .alert-message.block-message.error - @hook.errors.full_messages.each do |msg| %p= msg .clearfix @@ -15,7 +15,7 @@ .input = f.text_field :url, class: "text_field xxlarge"   - = f.submit "Add System Hook", class: "btn btn-primary" + = f.submit "Add System Hook", class: "btn primary" %hr -if @hooks.any? @@ -33,7 +33,7 @@ %td = link_to admin_hook_path(hook) do %strong= hook.url - = link_to 'Test Hook', admin_hook_test_path(hook), class: "btn btn-small pull-right" + = link_to 'Test Hook', admin_hook_test_path(hook), class: "btn small right" %td POST %td - = link_to 'Remove', admin_hook_path(hook), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove btn-small pull-right" + = link_to 'Remove', admin_hook_path(hook), confirm: 'Are you sure?', method: :delete, class: "danger btn small right" diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml index fef72186..c8be2ffa 100644 --- a/app/views/admin/logs/show.html.haml +++ b/app/views/admin/logs/show.html.haml @@ -8,14 +8,14 @@ %li = link_to "sidekiq.log", "#sidekiq", 'data-toggle' => 'tab' -%p.light To prevent performance issues admin logs output the last 2000 lines +%p.light To prevent perfomance issues admin logs output the last 2000 lines .tab-content .tab-pane.active#githost .file_holder#README .file_title %i.icon-file githost.log - .pull-right + .right = link_to '#', class: 'log-bottom' do %i.icon-arrow-down Scroll down @@ -29,7 +29,7 @@ .file_title %i.icon-file application.log - .pull-right + .right = link_to '#', class: 'log-bottom' do %i.icon-arrow-down Scroll down @@ -43,7 +43,7 @@ .file_title %i.icon-file production.log - .pull-right + .right = link_to '#', class: 'log-bottom' do %i.icon-arrow-down Scroll down @@ -57,7 +57,7 @@ .file_title %i.icon-file sidekiq.log - .pull-right + .right = link_to '#', class: 'log-bottom' do %i.icon-arrow-down Scroll down diff --git a/app/views/admin/projects/_form.html.haml b/app/views/admin/projects/_form.html.haml new file mode 100644 index 00000000..0c7cf68e --- /dev/null +++ b/app/views/admin/projects/_form.html.haml @@ -0,0 +1,77 @@ += form_for [:admin, project] do |f| + -if project.errors.any? + .alert-message.block-message.error + %ul + - project.errors.full_messages.each do |msg| + %li= msg + + .clearfix.project_name_holder + = f.label :name do + Project name is + .input + = f.text_field :name, placeholder: "Example Project", class: "xxlarge" + + - 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 + + .clearfix + = f.label :default_branch, "Default Branch" + .input= f.select(:default_branch, @project.repository.heads.map(&:name), {}, style: "width:210px;") + + %fieldset.adv_settings + %legend Features: + + .clearfix + = f.label :issues_enabled, "Issues" + .input= f.check_box :issues_enabled + + .clearfix + = f.label :merge_requests_enabled, "Merge Requests" + .input= f.check_box :merge_requests_enabled + + .clearfix + = f.label :wall_enabled, "Wall" + .input= f.check_box :wall_enabled + + .clearfix + = f.label :wiki_enabled, "Wiki" + .input= f.check_box :wiki_enabled + + %fieldset.features + %legend Public mode: + .clearfix + = f.label :public do + %span Allow public http clone + .input= f.check_box :public + + %fieldset.features + %legend Transfer: + .control-group + = f.label :namespace_id do + %span Namespace + .controls + = f.select :namespace_id, namespaces_options(@project.namespace_id, :all), {}, {class: 'chosen'} + %br + %ul.prepend-top-10.cred + %li Be careful. Changing project namespace can have unintended side effects + %li You can transfer project only to namespaces you can manage + %li You will need to update your local repositories to point to the new location. + + + .actions + = f.submit 'Save Project', class: "btn save-btn" + = link_to 'Cancel', admin_projects_path, class: "btn cancel-btn" + + + +:javascript + $(function(){ + new Projects(); + }) + diff --git a/app/views/admin/projects/edit.html.haml b/app/views/admin/projects/edit.html.haml new file mode 100644 index 00000000..7b59a0cc --- /dev/null +++ b/app/views/admin/projects/edit.html.haml @@ -0,0 +1,3 @@ +%h3.page_title #{@project.name} → Edit project +%hr += render 'form', project: @project diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 82d5fdcd..e47cda76 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -1,6 +1,6 @@ %h3.page_title Projects - = link_to 'New Project', new_project_path, class: "btn btn-small pull-right" + = link_to 'New Project', new_project_path, class: "btn small right" %hr @@ -37,7 +37,7 @@ .form-actions - = submit_tag "Search", class: "btn submit btn-primary" + = submit_tag "Search", class: "btn submit primary" = link_to "Reset", admin_projects_path, class: "btn" .span8 .ui-box @@ -51,9 +51,9 @@ - else %i.icon-lock.cgreen = link_to project.name_with_namespace, [:admin, project] - .pull-right - = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" + .right + = link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn small" + = link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn small danger" - if @projects.blank? %p.nothing_here_message 0 projects matches - else diff --git a/app/views/admin/projects/members/_form.html.haml b/app/views/admin/projects/members/_form.html.haml deleted file mode 100644 index 80412029..00000000 --- a/app/views/admin/projects/members/_form.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_for @team_member_relation, as: :team_member, url: admin_project_member_path(@project, @member) do |f| - -if @team_member_relation.errors.any? - .alert.alert-error - %ul - - @team_member_relation.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Project Access: - .input - = f.select :project_access, options_for_select(Project.access_options, @team_member_relation.project_access), {}, class: "project-access-select chosen span3" - - %br - .actions - = f.submit 'Save', class: "btn btn-primary" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/projects/members/edit.html.haml b/app/views/admin/projects/members/edit.html.haml deleted file mode 100644 index 2d76deb2..00000000 --- a/app/views/admin/projects/members/edit.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%p.slead - Edit access for - = link_to @member.name, admin_user_path(@member) - in - = link_to @project.name_with_namespace, admin_project_path(@project) - -%hr -= render 'form' diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 92b89601..8e0d8232 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -1,90 +1,153 @@ %h3.page_title Project: #{@project.name_with_namespace} - = link_to edit_project_path(@project), class: "btn pull-right" do + = link_to edit_admin_project_path(@project), class: "btn right" do %i.icon-edit Edit -%hr -.row - .span6 - .ui-box - %h5.title - Project info: - %ul.well-list - %li - %span.light Name: - %strong= @project.name - %li - %span.light Namespace: - %strong - - if @project.namespace - = link_to @project.namespace.human_name, [:admin, @project.group || @project.owner] - - else - Global - %li - %span.light Owned by: - %strong - - if @project.owner - = link_to @project.owner_name, admin_user_path(@project.owner) - - else - (deleted) - %li - %span.light Created by: - %strong - = @project.creator.try(:name) || '(deleted)' +- 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 !@repository.valid_post_receive_file? + %br + .alert.alert-error + %span + %strong Project has invalid post-receive file. + %br + 1. Make sure your gitolite instace has latest post-receive file. + %br + 2. Make a link of post-receive hook file from gitolite to project repository - %li - %span.light Created at: - %strong - = @project.created_at.stamp("March 1, 1999") - %li - %span.light http: - %strong - = link_to @project.http_url_to_repo - %li - %span.light ssh: - %strong - = link_to @project.ssh_url_to_repo - - if @project.repository.exists? - %li - %span.light fs: - %strong - = @repository.path_to_repo +%br +%table.zebra-striped + %thead + %tr + %th Project + %th + %tr + %td + %b + Name: + %td + = @project.name + %tr + %td + %b + Namespace: + %td + - if @project.namespace + = @project.namespace.human_name + - else + Global + %tr + %td + %b + Owned by: + %td + - if @project.owner + = link_to @project.owner_name, admin_user_path(@project.owner) + - else + (deleted) + %tr + %td + %b + Created by: + %td + = @project.creator.try(:name) || '(deleted)' + %tr + %td + %b + Created at: + %td + = @project.created_at.stamp("March 1, 1999") + %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 + - if @project.public + %tr.bgred + %td + %b + Public Read-Only Code access: + %td + = check_box_tag 'public', nil, @project.public - %li - %span.light last commit: - %strong - = last_commit(@project) - - else - %li - %span.light repository: - %strong.cred - does not exist +- 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 - %li - %span.light access: - %strong - - if @project.public - %span.cblue - %i.icon-share - Public - - else - %span.cgreen - %i.icon-lock - Private - .span6 - .ui-box - %h5.title - Team - %small - (#{@project.users.count}) - = link_to project_team_index_path(@project), class: "btn btn-tiny" do - %i.icon-edit - Edit Team - %ul.well-list.team_members - - @project.users.each do |tm| - %li - %strong - = link_to tm.name, admin_user_path(tm) - %span.pull-right.light= @project.project_access_human(tm) +%br +%h5 + Team + %small + (#{@project.users_projects.count}) +%br +%table.zebra-striped + %thead + %tr + %th Name + %th Project Access + %th Repository Access + %th + + - @project.users_projects.each do |tm| + %tr + %td + = link_to tm.user_name, admin_user_path(tm.user) + %td= tm.project_access_human + %td= link_to 'Edit Access', edit_admin_team_member_path(tm), class: "btn small" + %td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn danger small" + +%br +%h5 Add new team member +%br += form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do + %table.zebra-striped + %thead + %tr + %th Users + %th Project Access: + + %tr + %td= 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', class: "btn primary" + %td + Read more about project permissions + %strong= link_to "here", help_permissions_path, class: "vlink" diff --git a/app/views/admin/projects/team.html.haml b/app/views/admin/projects/team.html.haml new file mode 100644 index 00000000..e69de29b diff --git a/app/views/admin/team_members/_form.html.haml b/app/views/admin/team_members/_form.html.haml new file mode 100644 index 00000000..9cd94fdd --- /dev/null +++ b/app/views/admin/team_members/_form.html.haml @@ -0,0 +1,16 @@ += form_for @admin_team_member, as: :team_member, url: admin_team_member_path(@admin_team_member) do |f| + -if @admin_team_member.errors.any? + .alert-message.block-message.error + %ul + - @admin_team_member.errors.full_messages.each do |msg| + %li= msg + + .clearfix + %label Project Access: + .input + = f.select :project_access, options_for_select(Project.access_options, @admin_team_member.project_access), {}, class: "project-access-select chosen span3" + + %br + .actions + = f.submit 'Save', class: "btn primary" + = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/team_members/edit.html.haml b/app/views/admin/team_members/edit.html.haml new file mode 100644 index 00000000..aea9bd70 --- /dev/null +++ b/app/views/admin/team_members/edit.html.haml @@ -0,0 +1,8 @@ +%p.slead + Edit access for + = link_to @admin_team_member.user_name, admin_user_path(@admin_team_member) + in + = link_to @admin_team_member.project.name_with_namespace, admin_project_path(@admin_team_member) + +%hr += render 'form' diff --git a/app/views/admin/teams/edit.html.haml b/app/views/admin/teams/edit.html.haml deleted file mode 100644 index 0a3d993b..00000000 --- a/app/views/admin/teams/edit.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%h3.page_title Edit Team -%hr -= form_for @team, url: admin_team_path(@team), method: :put do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix.team_name_holder - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Example Team", class: "xxlarge" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .clearfix.team_name_holder - = f.label :path do - %span.cred Team path is - .input - = f.text_field :path, placeholder: "example-team", class: "xxlarge danger" - %ul.cred - %li It will change web url for access team and team projects. - - .form-actions - = f.submit 'Edit team', class: "btn btn-remove" - = link_to 'Cancel', admin_teams_path, class: "btn btn-cancel" diff --git a/app/views/admin/teams/index.html.haml b/app/views/admin/teams/index.html.haml deleted file mode 100644 index 3690d6d9..00000000 --- a/app/views/admin/teams/index.html.haml +++ /dev/null @@ -1,43 +0,0 @@ -%h3.page_title - Teams - %small - simple Teams description - - = link_to 'New Team', new_admin_team_path, class: "btn btn-small pull-right" - %br - -= form_tag admin_teams_path, method: :get, class: 'form-inline' do - = text_field_tag :name, params[:name], class: "xlarge" - = submit_tag "Search", class: "btn submit btn-primary" - -%table - %thead - %tr - %th - Name - %i.icon-sort-down - %th Description - %th Path - %th Projects - %th Members - %th Owner - %th.cred Danger Zone! - - - @teams.each do |team| - %tr - %td - %strong= link_to team.name, admin_team_path(team) - %td= truncate team.description - %td= team.path - %td= team.projects.count - %td= team.members.count - %td - - if team.owner - = link_to team.owner.name, admin_user_path(team.owner) - - else - (deleted) - %td.bgred - = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small" - = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" - -= paginate @teams, theme: "admin" diff --git a/app/views/admin/teams/members/_form.html.haml b/app/views/admin/teams/members/_form.html.haml deleted file mode 100644 index f1388aab..00000000 --- a/app/views/admin/teams/members/_form.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -= form_tag admin_team_member_path(@team, @member), method: :put do - -if @member.errors.any? - .alert.alert-error - %ul - - @member.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Default access for Team projects: - .input - = select_tag :default_project_access, options_for_select(UserTeam.access_roles, @team.default_projects_access(@member)), class: "project-access-select chosen span3" - .clearfix - %label Team admin? - .input - = check_box_tag :group_admin, true, @team.admin?(@member) - - %br - .actions - = submit_tag 'Save', class: "btn btn-primary" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/teams/members/edit.html.haml b/app/views/admin/teams/members/edit.html.haml deleted file mode 100644 index a82847ee..00000000 --- a/app/views/admin/teams/members/edit.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3 - Edit access #{@member.name} in #{@team.name} team - -%hr -%table.zebra-striped - %tr - %td User: - %td= @member.name - %tr - %td Team: - %td= @team.name - %tr - %td Since: - %td= member_since(@team, @member).stamp("Nov 11, 2010") - -= render 'form' diff --git a/app/views/admin/teams/members/new.html.haml b/app/views/admin/teams/members/new.html.haml deleted file mode 100644 index d3929cb7..00000000 --- a/app/views/admin/teams/members/new.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -%h3.page_title - Team: #{@team.name} - -%fieldset - %legend Members (#{@team.members.count}) - = form_tag admin_team_members_path(@team), id: "team_members", class: "bulk_import", method: :post do - %table#members_list - %thead - %tr - %th User name - %th Default project access - %th Team access - %th - - @team.members.each do |member| - %tr.member - %td - = link_to [:admin, member] do - = member.name - %small= "(#{member.email})" - %td= @team.human_default_projects_access(member) - %td= @team.admin?(member) ? "Admin" : "Member" - %td - %tr - %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name_with_username), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5' - %td= select_tag :default_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } - %td - %span= check_box_tag :group_admin - %span Admin? - %td= submit_tag 'Add', class: "btn btn-primary", id: :add_members_to_team diff --git a/app/views/admin/teams/new.html.haml b/app/views/admin/teams/new.html.haml deleted file mode 100644 index 1c90cb20..00000000 --- a/app/views/admin/teams/new.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h3.page_title New Team -%hr -= form_for @team, url: admin_teams_path do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Create team', class: "btn btn-primary" - - %hr - .padded - %ul - %li All created teams are public (users can view who enter into team and which project are assigned for this team) - %li People within a team see only projects they have access to - %li You will be able to assign existing projects for team diff --git a/app/views/admin/teams/projects/_form.html.haml b/app/views/admin/teams/projects/_form.html.haml deleted file mode 100644 index 5b79d518..00000000 --- a/app/views/admin/teams/projects/_form.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_tag admin_team_project_path(@team, @project), method: :put do - -if @project.errors.any? - .alert.alert-error - %ul - - @project.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Max access for Team members: - .input - = select_tag :greatest_project_access, options_for_select(UserTeam.access_roles, @team.max_project_access(@project)), class: "project-access-select chosen span3" - - %br - .actions - = submit_tag 'Save', class: "btn btn-primary" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/admin/teams/projects/edit.html.haml b/app/views/admin/teams/projects/edit.html.haml deleted file mode 100644 index b91a4982..00000000 --- a/app/views/admin/teams/projects/edit.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3 - Edit max access in #{@project.name} for #{@team.name} team - -%hr -%table.zebra-striped - %tr - %td Project: - %td= @project.name - %tr - %td Team: - %td= @team.name - %tr - %td Since: - %td= assigned_since(@team, @project).stamp("Nov 11, 2010") - -= render 'form' diff --git a/app/views/admin/teams/projects/new.html.haml b/app/views/admin/teams/projects/new.html.haml deleted file mode 100644 index b60dad35..00000000 --- a/app/views/admin/teams/projects/new.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h3.page_title - Team: #{@team.name} - -%fieldset - %legend Projects (#{@team.projects.count}) - = form_tag admin_team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do - %table#projects_list - %thead - %tr - %th Project name - %th Max access - %th - - @team.projects.each do |project| - %tr.project - %td - = link_to project.name_with_namespace, [:admin, project] - %td - %span= @team.human_max_project_access(project) - %td - %tr - %td= select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' - %td= select_tag :greatest_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } - %td= submit_tag 'Add', class: "btn btn-primary", id: :assign_projects_to_team diff --git a/app/views/admin/teams/show.html.haml b/app/views/admin/teams/show.html.haml deleted file mode 100644 index abdfada8..00000000 --- a/app/views/admin/teams/show.html.haml +++ /dev/null @@ -1,107 +0,0 @@ -%h3.page_title - Team: #{@team.name} - -%br -%table.zebra-striped - %thead - %tr - %th Team - %th - %tr - %td - %b - Name: - %td - = @team.name -   - = link_to edit_admin_team_path(@team), class: "btn btn-small pull-right" do - %i.icon-edit - Edit - %tr - %td - %b - Description: - %td - = @team.description - %tr - %td - %b - Owner: - %td - = @team.owner.name - .pull-right - = link_to "#", class: "btn btn-small change-owner-link" do - %i.icon-edit - Change owner - - %tr.change-owner-holder.hide - %td.bgred - %b.cred - New Owner: - %td.bgred - = form_for @team, url: admin_team_path(@team) do |f| - = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} - %div - = f.submit 'Change Owner', class: "btn btn-remove" - = link_to "Cancel", "#", class: "btn change-owner-cancel-link" - -%fieldset - %legend - Members (#{@team.members.count}) - %span= link_to 'Add members', new_admin_team_member_path(@team), class: "btn btn-primary btn-small pull-right", id: :add_members_to_team - - if @team.members.any? - %table#members_list - %thead - %tr - %th User name - %th Default project access - %th Team access - %th.cred.span3 Danger Zone! - - @team.members.each do |member| - %tr.member{ class: "user_#{member.id}"} - %td - = link_to [:admin, member] do - = member.name - %small= "(#{member.email})" - %td= @team.human_default_projects_access(member) - %td= @team.admin?(member) ? "Admin" : "Member" - %td.bgred - = link_to 'Edit', edit_admin_team_member_path(@team, member), class: "btn btn-small" -   - = link_to 'Remove', admin_team_member_path(@team, member), confirm: 'Remove member from team. Are you sure?', method: :delete, class: "btn btn-remove btn-small", id: "remove_member_#{member.id}" - -%fieldset - %legend - Projects (#{@team.projects.count}) - %span= link_to 'Add projects', new_admin_team_project_path(@team), class: "btn btn-primary btn-small pull-right", id: :assign_projects_to_team - - if @team.projects.any? - %table#projects_list - %thead - %tr - %th Project name - %th Max access - %th.cred.span3 Danger Zone! - - @team.projects.each do |project| - %tr.project - %td - = link_to project.name_with_namespace, [:admin, project] - %td - %span= @team.human_max_project_access(project) - %td.bgred - = link_to 'Edit', edit_admin_team_project_path(@team, project), class: "btn btn-small" -   - = link_to 'Relegate', admin_team_project_path(@team, project), confirm: 'Remove project from team. Are you sure?', method: :delete, class: "btn btn-remove small", id: "relegate_project_#{project.id}" - -:javascript - $(function(){ - var modal = $('.change-owner-holder'); - $('.change-owner-link').bind("click", function(){ - $(this).hide(); - modal.show(); - }); - $('.change-owner-cancel-link').bind("click", function(){ - modal.hide(); - $('.change-owner-link').show(); - }) - }) - diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index 1d1fe341..45195152 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -11,17 +11,17 @@ .clearfix = f.label :name .input - = f.text_field :name, required: true, autocomplete: "off" + = f.text_field :name, required: true %span.help-inline * required .clearfix = f.label :username .input - = f.text_field :username, required: true, autocomplete: "off" + = f.text_field :username, required: true %span.help-inline * required .clearfix = f.label :email .input - = f.text_field :email, required: true, autocomplete: "off" + = f.text_field :email, required: true %span.help-inline * required %fieldset @@ -46,14 +46,6 @@ = f.label :projects_limit .input= f.number_field :projects_limit - .clearfix - = f.label :can_create_group - .input= f.check_box :can_create_group - - .clearfix - = f.label :can_create_team - .input= f.check_box :can_create_team - .clearfix = f.label :admin do %strong.cred Administrator @@ -61,12 +53,12 @@ .span4 - unless @admin_user.new_record? .alert.alert-error - - if @admin_user.blocked? + - if @admin_user.blocked %p This user is blocked and is not able to login to GitLab - = link_to 'Unblock User', unblock_admin_user_path(@admin_user), method: :put, class: "btn btn-small" + = link_to 'Unblock User', unblock_admin_user_path(@admin_user), method: :put, class: "btn small" - else %p Blocked users will be removed from all projects & will not be able to login to GitLab. - = link_to 'Block User', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" + = link_to 'Block User', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small danger" %fieldset %legend Profile .clearfix @@ -80,8 +72,8 @@ .input= f.text_field :twitter .actions - = f.submit 'Save', class: "btn btn-save" + = f.submit 'Save', class: "btn save-btn" - if @admin_user.new_record? - = link_to 'Cancel', admin_users_path, class: "btn btn-cancel" + = link_to 'Cancel', admin_users_path, class: "btn cancel-btn" - else - = link_to 'Cancel', admin_user_path(@admin_user), class: "btn btn-cancel" + = link_to 'Cancel', admin_user_path(@admin_user), class: "btn cancel-btn" diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 9da2871e..87290abe 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -1,62 +1,58 @@ %h3.page_title Users - = link_to 'New User', new_admin_user_path, class: "btn btn-small pull-right" + = link_to 'New User', new_admin_user_path, class: "btn small right" %br -.row - .span3 - .admin-filter - = form_tag admin_users_path, method: :get, class: 'form-inline' do - = search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'search-text-input span2' - = button_tag type: 'submit', class: 'btn' do - %i.icon-search - %ul.nav.nav-pills.nav-stacked - %li{class: "#{'active' unless params[:filter]}"} - = link_to admin_users_path do - Active - %small.pull-right= User.active.count - %li{class: "#{'active' if params[:filter] == "admins"}"} - = link_to admin_users_path(filter: "admins") do - Admins - %small.pull-right= User.admins.count - %li{class: "#{'active' if params[:filter] == "blocked"}"} - = link_to admin_users_path(filter: "blocked") do - Blocked - %small.pull-right= User.blocked.count - %li{class: "#{'active' if params[:filter] == "wop"}"} - = link_to admin_users_path(filter: "wop") do - Without projects - %small.pull-right= User.without_projects.count - %hr - = link_to 'Reset', admin_users_path, class: "btn btn-cancel" += form_tag admin_users_path, method: :get, class: 'form-inline' do + = text_field_tag :name, params[:name], class: "xlarge" + = submit_tag "Search", class: "btn submit primary" +%ul.nav.nav-tabs + %li{class: "#{'active' unless params[:filter]}"} + = 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 - .span9 - .ui-box - %h5.title - Users (#{@admin_users.total_count}) - %ul.well-list - - @admin_users.each do |user| - %li - - if user.blocked? - %i.icon-lock.cred - - else - %i.icon-user.cgreen - = link_to user.name, [:admin, user] - - if user.admin? - %strong.cred (Admin) - - if user == current_user - %span.cred It's you! - .pull-right - %span.light - %i.icon-envelope - = mail_to user.email, user.email, class: 'light' -   - = link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-small" - - unless user == current_user - - if user.blocked? - = link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn btn-small success" - - else - = link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" - = link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove" - %li.bottom - = paginate @admin_users, theme: "gitlab" +%table + %thead + %tr + %th Admin + %th + Name + %i.icon-sort-down + %th Username + %th Email + %th Projects + %th Edit + %th.cred Danger Zone! + + - @admin_users.each do |user| + %tr + %td= check_box_tag "admin", 1, user.admin, disabled: :disabled + %td= link_to user.name, [:admin, user] + %td= user.username + %td= user.email + %td= user.users_projects.count + %td= link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn small" + %td.bgred + - if user == current_user + %span.cred It's you! + - else + - if user.blocked + = link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn small success" + - else + = link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small danger" + = link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn small danger" + += paginate @admin_users, theme: "admin" diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index b813f859..a3be6614 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -1,94 +1,127 @@ -.row - .span6 - %h3.page_title - = image_tag gravatar_icon(@admin_user.email, 90), class: "avatar s90" - = @admin_user.name - - if @admin_user.blocked? - %span.cred (Blocked) - - if @admin_user.admin - %span.cred (Admin) - .pull-right - = link_to edit_admin_user_path(@admin_user), class: "btn pull-right" do - %i.icon-edit - Edit - %br - %small @#{@admin_user.username} - %br - %small member since #{@admin_user.created_at.stamp("Nov 12, 2031")} - .clearfix - %hr - %p - %span.btn.btn-small - %i.icon-envelope - = mail_to @admin_user.email - - unless @admin_user == current_user - - if @admin_user.blocked? - = link_to 'Unblock', unblock_admin_user_path(@admin_user), method: :put, class: "btn btn-small success" - - else - = link_to 'Block', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove" - = link_to 'Destroy', [:admin, @admin_user], confirm: "USER #{@admin_user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove" - %hr - %h5 - Add User to Projects - %small +%h3.page_title + User: #{@admin_user.name} + - if @admin_user.blocked + %small Blocked + - if @admin_user.admin + %small Administrator + = link_to edit_admin_user_path(@admin_user), class: "btn right" do + %i.icon-edit + Edit + +%br + +%table.zebra-striped + %thead + %tr + %th Profile + %th + %tr + %td + %b + Email: + %td + = @admin_user.email + %tr + %td + %b + Username: + %td + = @admin_user.username + %tr + %td + %b + Admin: + %td= check_box_tag "admin", 1, @admin_user.admin, disabled: :disabled + %tr + %td + %b + Blocked: + %td= check_box_tag "blocked", 1, @admin_user.blocked, disabled: :disabled + %tr + %td + %b + Created at: + %td + = @admin_user.created_at.stamp("March 1, 1999") + %tr + %td + %b + Projects limit: + %td + = @admin_user.projects_limit + - unless @admin_user.skype.empty? + %tr + %td + %b + Skype: + %td + = @admin_user.skype + - unless @admin_user.linkedin.empty? + %tr + %td + %b + Linkedin: + %td + = @admin_user.linkedin + - unless @admin_user.twitter.empty? + %tr + %td + %b + Twitter: + %td + = @admin_user.twitter + +%br +%h5 Add User to Projects +%br += form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do + %table + %thead + %tr + %th Projects + %th Project Access: + + %tr + %td= select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, 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', class: "btn primary" + %td Read more about project permissions %strong= link_to "here", help_permissions_path, class: "vlink" - %br - = form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do - .control-group - = label_tag :project_ids, "Projects", class: 'control-label' - .controls - = select_tag :project_ids, options_from_collection_for_select(@not_in_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span3' - .control-group - = label_tag :project_access, "Project Access", class: 'control-label' - .controls - = select_tag :project_access, options_for_select(Project.access_options), class: "project-access-select chosen span3" +%br - .form-actions - = submit_tag 'Add', class: "btn btn-create" - .pull-right - %br +- if @admin_user.groups.present? + %h5 Owner of groups: + %br - - if @admin_user.owned_groups.present? - .ui-box - %h5.title Owned groups: - %ul.well-list - - @admin_user.groups.each do |group| - %li - %strong= link_to group.name, admin_group_path(group) + %table.zebra-striped + %thead + %tr + %th Name - - if @admin_user.owned_teams.present? - .ui-box - %h5.title Owned teams: - %ul.well-list - - @admin_user.owned_teams.each do |team| - %li - %strong= link_to team.name, admin_team_path(team) + - @admin_user.groups.each do |group| + %tr + %td= link_to group.name, admin_group_path(group) - .span6 - = render 'users/profile', user: @admin_user - .ui-box - %h5.title Projects (#{@projects.count}) - %ul.well-list - - @projects.each do |project| - %li - = link_to admin_project_path(project), class: dom_class(project) do - - if project.namespace - = project.namespace.human_name - \/ - %strong.well-title - = truncate(project.name, length: 45) - %span.pull-right.light - - if project.owner == @admin_user - %i.icon-wrench - - tm = project.team.get_tm(@admin_user.id) - - if tm - = tm.project_access_human - = link_to edit_admin_project_member_path(project, tm.user), class: "btn btn-small" do - %i.icon-edit - = link_to admin_project_member_path(project, tm.user), confirm: 'Are you sure?', method: :delete, class: "btn btn-small btn-remove" do - %i.icon-remove - %p.light - %i.icon-wrench - – user is a project owner +- if @admin_user.authorized_projects.present? + %h5 Authorized Projects: + %br + + %table.zebra-striped + %thead + %tr + %th Name + %th Project Access + %th + %th + + - @admin_user.tm_in_authorized_projects.each do |tm| + - project = tm.project + %tr + %td= link_to project.name_with_namespace, admin_project_path(project) + %td= tm.project_access_human + %td= link_to 'Edit Access', edit_admin_team_member_path(tm), class: "btn small" + %td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn small danger" diff --git a/app/views/blame/_head.html.haml b/app/views/blame/_head.html.haml index 3a883829..85da1805 100644 --- a/app/views/blame/_head.html.haml +++ b/app/views/blame/_head.html.haml @@ -1,2 +1,7 @@ -%div.tree-ref-holder - = render 'shared/ref_switcher', destination: 'tree', path: params[:path] +%ul.nav.nav-tabs + %li + = render partial: 'shared/ref_switcher', locals: {destination: 'tree', path: params[:path]} + = nav_link(controller: :refs) do + = link_to 'Source', project_tree_path(@project, @ref) + %li.right + = render "shared/clone_panel" diff --git a/app/views/blame/show.html.haml b/app/views/blame/show.html.haml index 96d153e6..36d81e6a 100644 --- a/app/views/blame/show.html.haml +++ b/app/views/blame/show.html.haml @@ -3,10 +3,10 @@ #tree-holder.tree-holder %ul.breadcrumb %li - %i.icon-angle-right + %span.arrow = link_to project_tree_path(@project, @ref) do = @project.name - - tree_breadcrumbs(@tree, 6) do |link| + - @tree.breadcrumbs(6) do |link| \/ %li= link .clear @@ -22,13 +22,13 @@ %table - current_line = 1 - @blame.each do |commit, lines| - - commit = Commit.new(commit) + - commit = CommitDecorator.decorate(Commit.new(commit)) %tr %td.blame-commit %span.commit = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id"   - = commit_author_link(commit, avatar: true, size: 16) + = commit.author_link avatar: true, size: 16   = link_to_gfm truncate(commit.title, length: 20), project_commit_path(@project, commit.id), class: "row_title" %td.lines.blame-numbers @@ -39,10 +39,8 @@ - else - lines.each do |line| = current_line - \ - current_line += 1 %td.lines %pre - lines.each do |line| = line - \ diff --git a/app/views/commit/huge_commit.html.haml b/app/views/commit/huge_commit.html.haml index 7f0bcf38..ba97a7c5 100644 --- a/app/views/commit/huge_commit.html.haml +++ b/app/views/commit/huge_commit.html.haml @@ -1,3 +1,3 @@ = render "commits/commit_box" -.alert.alert-error +.alert-message.block-message.error %h4 Commit diffs are too big to be displayed diff --git a/app/views/commit/show.html.haml b/app/views/commit/show.html.haml index 48fb44a9..f920534e 100644 --- a/app/views/commit/show.html.haml +++ b/app/views/commit/show.html.haml @@ -1,18 +1,29 @@ -= render "commit_box" += render "commits/commit_box" -- unless @commit.has_zero_stats? - %p.pull-right.cgray - This commit has - %span.cgreen #{@commit.stats.additions} additions - and - %span.cred #{@commit.stats.deletions} deletions +%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" :javascript $(function(){ - $('.files .file').each(function(){ - new CommitFile(this); + var w, h; + $('.diff_file').each(function(){ + $('.image.diff_removed img', this).on('load', $.proxy(function(event){ + var w = event.currentTarget.naturalWidth + , h = event.currentTarget.naturalHeight; + $('.image.diff_removed .image-info', this).append(' | W: ' + w + 'px | H: ' + h + 'px'); + }, this)); + $('.image.diff_added img', this).on('load', $.proxy(function(event){ + var w = event.currentTarget.naturalWidth + , 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 65d92030..eb0312d0 100644 --- a/app/views/commits/_commit.html.haml +++ b/app/views/commits/_commit.html.haml @@ -4,11 +4,11 @@ %strong= link_to "Browse Code »", project_tree_path(@project, commit), class: "right" %p = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id" - = commit_author_link(commit, avatar: true, size: 24) + = commit.author_link avatar: true, size: 24   - = link_to_gfm truncate(commit.title, length: 70), project_commit_path(@project, commit.id), class: "row_title" + = link_to_gfm truncate(commit.title, length: 50), project_commit_path(@project, commit.id), class: "row_title" - %time.committed_ago{ datetime: commit.committed_date, title: commit.committed_date.stamp("Aug 21, 2011 9:23pm") } + %span.committed_ago = time_ago_in_words(commit.committed_date) ago   diff --git a/app/views/commit/_commit_box.html.haml b/app/views/commits/_commit_box.html.haml similarity index 91% rename from app/views/commit/_commit_box.html.haml rename to app/views/commits/_commit_box.html.haml index 64679177..0544a1d1 100644 --- a/app/views/commit/_commit_box.html.haml +++ b/app/views/commits/_commit_box.html.haml @@ -1,6 +1,6 @@ .ui-box.ui-box-show .ui-box-head - .pull-right + .right - if @notes_count > 0 %span.btn.disabled.grouped %i.icon-comment @@ -13,7 +13,7 @@ %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: "btn btn-primary grouped" do + = 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) @@ -24,14 +24,14 @@ .row .span5 .author - = commit_author_link(@commit, avatar: true, size: 32) + = @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 → - = commit_committer_link(@commit) + = @commit.committer_link committed %time{title: @commit.committed_date.stamp("Aug 21, 2011 9:23pm")} #{time_ago_in_words(@commit.committed_date)} ago diff --git a/app/views/commits/_commits.html.haml b/app/views/commits/_commits.html.haml index 869d1f9c..0dc6664c 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 }.sort.reverse.each do |day, commits| +- @commits.group_by { |c| c.committed_date.to_date }.each do |day, commits| %div.ui-box %h5.title %i.icon-calendar - %span= day.stamp("28 Aug, 2010") + = day.stamp("28 Aug, 2010") %ul.well-list= render commits diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index b2da4796..7fe45aa2 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -1,7 +1,7 @@ - if @suppress_diff - .alert.alert-block + .alert-message.block-message %p - %strong Warning! Large commit with more than #{Commit::DIFF_SAFE_SIZE} files changed. + %strong Warning! Large commit with more then #{Commit::DIFF_SAFE_SIZE} files changed. %p To prevent performance issue we rejected diff information. %p But if you still want to see diff @@ -12,38 +12,50 @@ .file-stats = render "commits/diff_head", diffs: diffs -.files - - unless @suppress_diff - - diffs.each_with_index do |diff, i| - - next if diff.diff.empty? - - file = (@commit.tree / diff.new_path) - - file = (@commit.prev_commit.tree / diff.old_path) unless file - - next unless file - .file{id: "diff-#{i}"} - .header - - if diff.deleted_file - %span= diff.old_path +- unless @suppress_diff + - diffs.each_with_index do |diff, i| + - next if diff.diff.empty? + - file = (@commit.tree / diff.new_path) + - file = (@commit.prev_commit.tree / diff.old_path) unless file + - next unless file + .diff_file{id: "diff-#{i}"} + .diff_file_header + - if diff.deleted_file + %span= diff.old_path - - if @commit.prev_commit - = link_to project_tree_path(@project, tree_join(@commit.prev_commit_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do - View file @ - %span.commit-short-id= @commit.short_id(6) - - else - %span= diff.new_path - - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" - - = link_to project_tree_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do + - if @commit.prev_commit + = link_to project_tree_path(@project, tree_join(@commit.prev_commit_id, diff.new_path)), {:class => 'btn right view-commit'} do View file @ %span.commit-short-id= @commit.short_id(6) + - else + %span= diff.new_path + - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode + %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" - .content - -# Skipp all non non-supported blobs - - next unless file.respond_to?('text?') - - if file.text? - = render "commits/text_file", diff: diff, index: i - - elsif file.image? - - old_file = (@commit.prev_commit.tree / diff.old_path) if !@commit.prev_commit.nil? - = render "commits/image", diff: diff, old_file: old_file, file: file, index: i + = link_to project_tree_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn very_small right view-commit'} do + View file @ + %span.commit-short-id= @commit.short_id(6) + + %br/ + .diff_file_content + -# Skip all non-supported blobs + - next unless file.respond_to?('text?') + - if file.text? + = render "commits/text_diff", diff: diff, index: i + - elsif file.image? + - old_file = (@commit.prev_commit.tree / diff.old_path) if !@commit.prev_commit.nil? + - if diff.renamed_file || diff.new_file || diff.deleted_file + .diff_file_content_image + .image{class: image_diff_class(diff)} + %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + %div.image-info= "#{number_to_human_size file.size}" - else - %p.nothing_here_message No preview for this file type + .diff_file_content_image.img_compared + .image.diff_removed + %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"} + %div.image-info= "#{number_to_human_size file.size}" + .image.diff_added + %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + %div.image-info= "#{number_to_human_size file.size}" + - else + %p.nothing_here_message No preview for this file type diff --git a/app/views/commits/_head.html.haml b/app/views/commits/_head.html.haml index 20b9195c..a5f3fdf5 100644 --- a/app/views/commits/_head.html.haml +++ b/app/views/commits/_head.html.haml @@ -22,6 +22,7 @@ - if current_controller?(:commits) && current_user.private_token - %li.pull-right - = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do - %i.icon-rss + %li.right + %span.rss-icon + = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do + = image_tag "rss_ui.png", title: "feed" diff --git a/app/views/commits/_image.html.haml b/app/views/commits/_image.html.haml deleted file mode 100644 index db02fa33..00000000 --- a/app/views/commits/_image.html.haml +++ /dev/null @@ -1,63 +0,0 @@ -- if diff.renamed_file || diff.new_file || diff.deleted_file - .image - %span.wrap - .frame{class: image_diff_class(diff)} - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - %p.image-info= "#{number_to_human_size file.size}" -- else - .image - %div.two-up.view - %span.wrap - .frame.deleted - %a{href: project_tree_path(@project, tree_join(@commit.id, diff.old_path))} - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} - %p.image-info.hide - %span.meta-filesize= "#{number_to_human_size old_file.size}" - | - %b W: - %span.meta-width - | - %b H: - %span.meta-height - %span.wrap - .frame.added - %a{href: project_tree_path(@project, tree_join(@commit.id, diff.new_path))} - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - %p.image-info.hide - %span.meta-filesize= "#{number_to_human_size file.size}" - | - %b W: - %span.meta-width - | - %b H: - %span.meta-height - - %div.swipe.view.hide - .swipe-frame - .frame.deleted - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} - .swipe-wrap - .frame.added - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - %span.swipe-bar - %span.top-handle - %span.bottom-handle - - %div.onion-skin.view.hide - .onion-skin-frame - .frame.deleted - %img{src: "data:#{old_file.mime_type};base64,#{Base64.encode64(old_file.data)}"} - .frame.added - %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - .controls - .transparent - .drag-track - .dragger{:style => "left: 0px;"} - .opaque - - - .view-modes.hide - %ul.view-modes-menu - %li.two-up{data: {mode: 'two-up'}} 2-up - %li.swipe{data: {mode: 'swipe'}} Swipe - %li.onion-skin{data: {mode: 'onion-skin'}} Onion skin \ No newline at end of file diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_diff.html.haml similarity index 95% rename from app/views/commits/_text_file.html.haml rename to app/views/commits/_text_diff.html.haml index 760fd07e..8afad96b 100644 --- a/app/views/commits/_text_file.html.haml +++ b/app/views/commits/_text_diff.html.haml @@ -2,7 +2,7 @@ - if too_big %a.supp_diff_link Diff suppressed. Click to show -%table.text-file{class: "#{'hide' if too_big}"} +%table{class: "#{'hide' if too_big}"} - each_diff_line(diff, index) do |line, type, line_code, line_new, line_old| %tr.line_holder{ id: line_code } - if type == "match" diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml index 586b21df..9451a038 100644 --- a/app/views/commits/show.html.haml +++ b/app/views/commits/show.html.haml @@ -2,10 +2,10 @@ - if @path.present? %ul.breadcrumb - = commits_breadcrumbs + = breadcrumbs %div{id: dom_id(@project)} - #commits-list= render "commits" + #commits_list= render "commits" .clear .loading{ style: "display:none;"} diff --git a/app/views/compare/_form.html.haml b/app/views/compare/_form.html.haml index ef80cd4a..0915782d 100644 --- a/app/views/compare/_form.html.haml +++ b/app/views/compare/_form.html.haml @@ -2,9 +2,9 @@ - unless params[:to] %p.slead Fill input field with commit id like - %code.label-branch 4eedf23 + %code.label_branch 4eedf23 or branch/tag name like - %code.label-branch master + %code.label_branch master and press compare button for commits list, code diff. %br @@ -19,7 +19,7 @@ = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" .pull-left   - = submit_tag "Compare", class: "btn btn-primary wide commits-compare-btn" + = submit_tag "Compare", class: "btn primary wide commits-compare-btn" - if @refs_are_same .alert %span Refs are the same diff --git a/app/views/compare/show.html.haml b/app/views/compare/show.html.haml index 56c4a113..d8ea3727 100644 --- a/app/views/compare/show.html.haml +++ b/app/views/compare/show.html.haml @@ -6,17 +6,11 @@ = render "form" -- if @commits.size > 100 - .alert.alert-block - %p - %strong Warning! This comparison include 100+ commits. - %p To prevent performance issue we dont show diff information. - - if @commits.present? %div.ui-box %h5.title Commits (#{@commits.count}) - %ul.well-list= render Commit.decorate(@commits) + %ul.well-list= render @commits - unless @diffs.empty? %h4 Diff diff --git a/app/views/dashboard/_filter.html.haml b/app/views/dashboard/_filter.html.haml index df4447cd..4624af79 100644 --- a/app/views/dashboard/_filter.html.haml +++ b/app/views/dashboard/_filter.html.haml @@ -1,6 +1,6 @@ = form_tag dashboard_filter_path(entity), method: 'get' do %fieldset.dashboard-search-filter - = search_field_tag "search", params[:search], { id: 'filter_search', placeholder: 'Search', class: 'search-text-input' } + = search_field_tag "search", params[:search], { placeholder: 'Search', class: 'search-text-input' } = button_tag type: 'submit', class: 'btn' do %i.icon-search @@ -25,9 +25,9 @@ %li{class: ("active" if params[:project_id] == project.id.to_s)} = link_to dashboard_filter_path(entity, project_id: project.id) do = project.name_with_namespace - %small.pull-right= entities_per_project(project, entity) + %small.right= entities_per_project(project, entity) %fieldset %hr - = link_to "Reset", dashboard_filter_path(entity), class: 'btn pull-right' + = link_to "Reset", dashboard_filter_path(entity), class: 'btn right' diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml index 2fedf87a..7f544406 100644 --- a/app/views/dashboard/_groups.html.haml +++ b/app/views/dashboard/_groups.html.haml @@ -1,24 +1,20 @@ -.ui-box +.groups_box %h5.title Groups - %span.light + %small (#{groups.count}) - if current_user.can_create_group? - %span.pull-right - = link_to new_group_path, class: "btn btn-small" do + %span.right + = link_to new_admin_group_path, class: "btn very_small info" do %i.icon-plus New Group %ul.well-list - groups.each do |group| %li = link_to group_path(id: group.path), class: dom_class(group) do - %strong.well-title - = truncate(group.name, length: 35) + %strong.well-title= truncate(group.name, length: 35) %span.arrow → %span.last_activity - %strong Owner: - %span= group.owner_name - - if groups.blank? - %li - %h3.nothing_here_message You have no groups yet. + %strong Projects: + %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 a106e83e..6c1304ee 100644 --- a/app/views/dashboard/_projects.html.haml +++ b/app/views/dashboard/_projects.html.haml @@ -1,13 +1,20 @@ -.ui-box +.projects_box %h5.title Projects - %span.light - (#{@projects_count}) + %small + (#{projects.total_count}) - if current_user.can_create_project? - %span.pull-right - = link_to new_project_path, class: "btn btn-small" do + %span.right + = link_to new_project_path, class: "btn very_small info" do %i.icon-plus New Project + %ul.nav.nav-projects-tabs + = nav_tab :scope, nil do + = link_to "All", dashboard_path + = nav_tab :scope, 'personal' do + = link_to "Personal", dashboard_path(scope: 'personal') + = nav_tab :scope, 'joined' do + = link_to "Joined", dashboard_path(scope: 'joined') %ul.well-list - projects.each do |project| @@ -26,6 +33,4 @@ - if projects.blank? %li %h3.nothing_here_message There are no projects here. - - if @projects_count > 20 - %li.bottom - %strong= link_to "show all projects", projects_dashboard_path + .bottom= paginate projects, theme: "gitlab" diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml index 876a5b61..9830cdf4 100644 --- a/app/views/dashboard/_sidebar.html.haml +++ b/app/views/dashboard/_sidebar.html.haml @@ -1,25 +1,11 @@ -%ul.nav.nav-tabs.dash-sidebar-tabs - %li.active - = link_to 'Projects', '#projects', 'data-toggle' => 'tab', id: 'sidebar-projects-tab' - %li - = link_to 'Groups', '#groups', 'data-toggle' => 'tab', id: 'sidebar-groups-tab' - %li - = link_to 'Teams', '#teams', 'data-toggle' => 'tab', id: 'sidebar-teams-tab' - -.tab-content - .tab-pane.active#projects - = render "projects", projects: @projects - .tab-pane#groups - = render "groups", groups: @groups - .tab-pane#teams - = render "teams", teams: @teams - -.prepend-top-20 +- if @groups.present? + = render "groups", groups: @groups += render "projects", projects: @projects +%div %span.rss-icon = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do - %strong - %i.icon-rss - News Feed + = image_tag "rss_ui.png", title: "feed" + %strong News Feed %hr .gitlab-promo diff --git a/app/views/dashboard/_teams.html.haml b/app/views/dashboard/_teams.html.haml deleted file mode 100644 index 95d87f50..00000000 --- a/app/views/dashboard/_teams.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.ui-box.teams-box - %h5.title - Teams - %span.light - (#{teams.count}) - %span.pull-right - = link_to new_team_path, class: "btn btn-small" do - %i.icon-plus - New Team - %ul.well-list - - teams.each do |team| - %li - = link_to team_path(id: team.path), class: dom_class(team) do - %strong.well-title= truncate(team.name, length: 35) - %span.pull-right.light - - if team.owner == current_user - %i.icon-wrench - - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) - - if tm - = tm.access_human - - if teams.blank? - %li - %h3.nothing_here_message You have no teams yet. diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml index 4b0d0d68..d1676ed1 100644 --- a/app/views/dashboard/_zero_authorized_projects.html.haml +++ b/app/views/dashboard/_zero_authorized_projects.html.haml @@ -6,7 +6,7 @@ = current_user.projects_limit projects. Click on button below to add a new one .link_holder - = link_to new_project_path, class: "btn btn-primary" do + = link_to new_project_path, class: "btn primary" do New Project » - else If you will be added to project - it will be displayed here diff --git a/app/views/dashboard/show.atom.builder b/app/views/dashboard/index.atom.builder similarity index 87% rename from app/views/dashboard/show.atom.builder rename to app/views/dashboard/index.atom.builder index 29b2e4a2..2bb42a65 100644 --- a/app/views/dashboard/show.atom.builder +++ b/app/views/dashboard/index.atom.builder @@ -1,8 +1,8 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}" - xml.link :href => dashboard_url(:atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => dashboard_url, :rel => "alternate", :type => "text/html" + xml.link :href => projects_url(:atom), :rel => "self", :type => "application/atom+xml" + xml.link :href => projects_url, :rel => "alternate", :type => "text/html" xml.id projects_url xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/index.html.haml similarity index 100% rename from app/views/dashboard/show.html.haml rename to app/views/dashboard/index.html.haml diff --git a/app/views/dashboard/show.js.haml b/app/views/dashboard/index.js.haml similarity index 100% rename from app/views/dashboard/show.js.haml rename to app/views/dashboard/index.js.haml diff --git a/app/views/dashboard/issues.atom.builder b/app/views/dashboard/issues.atom.builder index 0f0f3466..28bdc5ed 100644 --- a/app/views/dashboard/issues.atom.builder +++ b/app/views/dashboard/issues.atom.builder @@ -1,9 +1,9 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "#{current_user.name} issues" - xml.link :href => issues_dashboard_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml" - xml.link :href => issues_dashboard_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html" - xml.id issues_dashboard_url(:private_token => current_user.private_token) + xml.link :href => dashboard_issues_url(:atom, :private_token => current_user.private_token), :rel => "self", :type => "application/atom+xml" + xml.link :href => dashboard_issues_url(:private_token => current_user.private_token), :rel => "alternate", :type => "text/html" + xml.id dashboard_issues_url(:private_token => current_user.private_token) xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? @issues.each do |issue| diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 539c5765..307d0d85 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -1,7 +1,7 @@ %h3.page_title Issues %small (assigned to you) - %small.pull-right #{@issues.total_count} issues + %small.right #{@issues.total_count} issues %hr @@ -17,7 +17,7 @@ = link_to_project project %ul.well-list.issues_table - group[1].each do |issue| - = render issue + = render(partial: 'issues/show', locals: {issue: issue}) %hr = paginate @issues, theme: "gitlab" - else diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index a311729d..0c4d6e0a 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -1,7 +1,7 @@ %h3.page_title Merge Requests %small (authored by or assigned to you) - %small.pull-right #{@merge_requests.total_count} merge requests + %small.right #{@merge_requests.total_count} merge requests %hr .row diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml deleted file mode 100644 index 29a16d61..00000000 --- a/app/views/dashboard/projects.html.haml +++ /dev/null @@ -1,63 +0,0 @@ -%h3.page_title - Projects - %span - (#{@projects.total_count}) - - if current_user.can_create_project? - %span.pull-right - = link_to new_project_path, class: "btn btn-tiny info" do - %i.icon-plus - New Project - - -%hr -.row - .span3 - %ul.nav.nav-pills.nav-stacked - = nav_tab :scope, nil do - = link_to "All", projects_dashboard_path - = nav_tab :scope, 'personal' do - = link_to "Personal", projects_dashboard_path(scope: 'personal') - = nav_tab :scope, 'joined' do - = link_to "Joined", projects_dashboard_path(scope: 'joined') - - .span9 - = form_tag projects_dashboard_path, method: 'get' do - %fieldset.dashboard-search-filter - = hidden_field_tag "scope", params[:scope] - = search_field_tag "search", params[:search], { id: 'dashboard_projects_search', placeholder: 'Search', class: 'left input-xxlarge'} - = button_tag type: 'submit', class: 'btn' do - %i.icon-search - - %ul.well-list - - @projects.each do |project| - %li.clearfix - .clearfix - %h5 - = link_to project_path(project), class: dom_class(project) do - - if project.namespace - = project.namespace.human_name - \/ - %strong - = truncate(project.name, length: 45) - .pull-right.light - - if project.owner == current_user - %i.icon-wrench - - tm = project.team.get_tm(current_user.id) - - if tm - %strong= tm.project_access_human - .clearfix - .left - - if project.description.present? - %span.light= project.description - - .pull-right.light - %small.light - Last activity #{project_last_activity(project)} - - - if @projects.blank? - %li - %h3.nothing_here_message There are no projects here. - .bottom - %hr - = paginate @projects, theme: "gitlab" - diff --git a/app/views/deploy_keys/_form.html.haml b/app/views/deploy_keys/_form.html.haml index 5fb83021..6beba562 100644 --- a/app/views/deploy_keys/_form.html.haml +++ b/app/views/deploy_keys/_form.html.haml @@ -1,7 +1,7 @@ %div = form_for [@project, @key], url: project_deploy_keys_path do |f| -if @key.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @key.errors.full_messages.each do |msg| %li= msg @@ -18,6 +18,6 @@ = link_to "here", help_ssh_path .actions - = f.submit 'Save', class: "btn-save btn" - = link_to "Cancel", project_deploy_keys_path(@project), class: "btn btn-cancel" + = f.submit 'Save', class: "save-btn btn" + = link_to "Cancel", project_deploy_keys_path(@project), class: "btn cancel-btn" diff --git a/app/views/deploy_keys/_show.html.haml b/app/views/deploy_keys/_show.html.haml index 63505435..a5314ae9 100644 --- a/app/views/deploy_keys/_show.html.haml +++ b/app/views/deploy_keys/_show.html.haml @@ -8,5 +8,5 @@ = time_ago_in_words(key.created_at) ago %td - = link_to 'Remove', project_deploy_key_path(key.project, key), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key btn-small pull-right" + = link_to 'Remove', project_deploy_key_path(key.project, key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key small right" diff --git a/app/views/deploy_keys/index.html.haml b/app/views/deploy_keys/index.html.haml index 80d30e1c..b9c654a1 100644 --- a/app/views/deploy_keys/index.html.haml +++ b/app/views/deploy_keys/index.html.haml @@ -1,10 +1,10 @@ -= render "projects/settings_nav" += render "repositories/head" %p.slead Deploy keys allow read-only access to repository. It matches perfectly for CI, staging or production servers. - if can? current_user, :admin_project, @project - = link_to new_project_deploy_key_path(@project), class: "btn btn-small", title: "New Deploy Key" do + = link_to new_project_deploy_key_path(@project), class: "btn small", title: "New Deploy Key" do Add Deploy Key - if @keys.any? %table diff --git a/app/views/deploy_keys/new.html.haml b/app/views/deploy_keys/new.html.haml index 0bbea1eb..e973cb7d 100644 --- a/app/views/deploy_keys/new.html.haml +++ b/app/views/deploy_keys/new.html.haml @@ -1,4 +1,4 @@ -= render "projects/settings_nav" += render "repositories/head" %h3.page_title New Deploy key %hr diff --git a/app/views/deploy_keys/show.html.haml b/app/views/deploy_keys/show.html.haml index 0a9f376d..c94cf10d 100644 --- a/app/views/deploy_keys/show.html.haml +++ b/app/views/deploy_keys/show.html.haml @@ -1,5 +1,4 @@ -= render "projects/settings_nav" - += render "repositories/head" %h3.page_title Deploy key: = @key.title @@ -11,5 +10,5 @@ ← To keys list %hr %pre= @key.key -.pull-right - = link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "btn-remove btn delete-key" +.right + = link_to 'Remove', project_deploy_key_path(@key.project, @key), confirm: 'Are you sure?', method: :delete, class: "danger btn delete-key" diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index e5800025..31d35567 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -8,5 +8,5 @@ %div = f.password_field :password_confirmation, class: "text bottom", placeholder: "Confirm new password" %div - = f.submit "Change my password", class: "btn btn-primary" - .pull-right= render partial: "devise/shared/links" + = f.submit "Change my password", class: "btn primary" + .right= render partial: "devise/shared/links" diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 0e39f318..860d67d1 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,9 +1,9 @@ -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { class: "login-box", method: :post }) do |f| %> - <%= image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" %> +<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :class => "login-box", :method => :post }) do |f| %> + <%= image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" %> <%= devise_error_messages! %> - <%= f.email_field :email, placeholder: "Email", class: "text" %> + <%= f.email_field :email, :placeholder => "Email", :class => "text" %>

    - <%= f.submit "Reset password", class: "btn-primary btn" %> -
    <%= link_to "Sign in", new_session_path(resource_name), class: "btn" %>
    + <%= f.submit "Reset password", :class => "primary btn" %> +
    <%= link_to "Sign in", new_session_path(resource_name), :class => "btn" %>
    <% end %> diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 12b04382..81eb2622 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,18 +1,19 @@ -= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "login-box" }) do |f| - = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" += form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => "login-box" }) do |f| + = image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" = devise_error_messages! %div - = f.text_field :name, class: "text top", placeholder: "Name", required: true + = f.text_field :name, :class => "text top", :placeholder => "Name", :required => true %div - = f.text_field :username, class: "text middle", placeholder: "Username", required: true + = f.text_field :username, :class => "text middle", :placeholder => "Username", :required => true %div - = f.email_field :email, class: "text middle", placeholder: "Email", required: true + = f.email_field :email, :class => "text middle", :placeholder => "Email", :required => true %div - = f.password_field :password, class: "text middle", placeholder: "Password", required: true + = f.password_field :password, :class => "text middle", :placeholder => "Password", :required => true %div - = f.password_field :password_confirmation, class: "text bottom", placeholder: "Confirm password", required: true + = f.password_field :password_confirmation, :class => "text bottom", :placeholder => "Confirm password", :required => true %div - = f.submit "Sign up", class: "btn-create btn" + = f.submit "Sign up", :class => "primary btn wide" + %br %hr = link_to "Sign in", new_session_path(resource_name) - = link_to "Forgot your password?", new_password_path(resource_name), class: "pull-right" + = link_to "Forgot your password?", new_password_path(resource_name), :class => "right" diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml index eb8c5194..4233aa61 100644 --- a/app/views/devise/sessions/_new_ldap.html.haml +++ b/app/views/devise/sessions/_new_ldap.html.haml @@ -1,13 +1,13 @@ = form_tag(user_omniauth_callback_path(:ldap), :class => "login-box", :id => 'new_ldap_user' ) do = image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" - = text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login", :autofocus => "autofocus"} + = text_field_tag :username, nil, {:class => "text top", :placeholder => "LDAP Login"} = password_field_tag :password, nil, {:class => "text bottom", :placeholder => "Password"} %br/ - = submit_tag "LDAP Sign in", :class => "btn-primary btn" + = submit_tag "LDAP Sign in", :class => "primary btn" - if devise_mapping.omniauthable? - (resource_class.omniauth_providers - [:ldap]).each do |provider| %hr/ - = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn btn-primary" + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %br/ %hr/ %a#other_form_toggle{:href => "#", :onclick => "javascript:$('#new_user').toggle();"} Other Sign in @@ -24,6 +24,6 @@ = f.check_box :remember_me %span Remember me %br/ - = f.submit "Sign in", :class => "btn-primary btn" - .pull-right + = f.submit "Sign in", :class => "primary btn" + .right = render :partial => "devise/shared/links" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 5e93ab18..0983f315 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,28 +1,28 @@ - if ldap_enable? - = render partial: 'devise/sessions/new_ldap' + = render :partial => 'devise/sessions/new_ldap' - else - = form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "login-box" }) do |f| - = image_tag "login-logo.png", width: "304", height: "66", class: "login-logo", alt: "Login Logo" - = f.text_field :login, class: "text top", placeholder: "Username or Email", autofocus: "autofocus" - = f.password_field :password, class: "text bottom", placeholder: "Password" + = form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "login-box" }) do |f| + = image_tag "login-logo.png", :width => "304", :height => "66", :class => "login-logo", :alt => "Login Logo" + = f.email_field :email, :class => "text top", :placeholder => "Email", :autofocus => "autofocus" + = f.password_field :password, :class => "text bottom", :placeholder => "Password" - if devise_mapping.rememberable? .clearfix.inputs-list - %label.checkbox.remember_me{for: "user_remember_me"} + %label.checkbox.remember_me{:for => "user_remember_me"} = f.check_box :remember_me %span Remember me %br/ - = f.submit "Sign in", class: "btn-create btn" - .pull-right - = link_to "Forgot your password?", new_password_path(resource_name), class: "btn" + = f.submit "Sign in", :class => "primary btn wide" + .right + = link_to "Forgot your password?", new_password_path(resource_name), :class => "btn" + %br/ %br/ - if Gitlab.config.gitlab.signup_enabled %hr/ Don't have an account? = link_to "Sign up", new_registration_path(resource_name) + .clearfix - if devise_mapping.omniauthable? && resource_class.omniauth_providers.present? - %hr %div - %span Sign in with:   - resource_class.omniauth_providers.each do |provider| %span = link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider) diff --git a/app/views/errors/gitolite.html.haml b/app/views/errors/gitolite.html.haml new file mode 100644 index 00000000..33ea8c1a --- /dev/null +++ b/app/views/errors/gitolite.html.haml @@ -0,0 +1,25 @@ +%h1.http_status_code 500 +%h3.page_title GitLab was unable to access your Gitolite system. +%hr + +.git_error_tips + %h4 Tips for Administrator: + %ol + %li + %p + Check git logs in admin area + %li + %p + Check config/gitlab.yml for correct settings. + %li + %p + Diagnostic tool: + %pre + bundle exec rake gitlab:check RAILS_ENV=production + %li + %p + Permissions: + %pre + = preserve do + sudo chown -R git:git #{Gitlab.config.gitolite.repos_path} + sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path} diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index f2f2d47e..ea417aa9 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -1,3 +1,4 @@ +- commit = CommitDecorator.decorate(commit) %li.commit %p = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index e2bf54ea..191aed07 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -1,16 +1,15 @@ - if event.proper? %div.event-item - %span.cgray.pull-right + %span.cgray.right #{time_ago_in_words(event.created_at)} ago. - = cache event do - = image_tag gravatar_icon(event.author_email), class: "avatar s24" + = image_tag gravatar_icon(event.author_email), class: "avatar s24" - - if event.push? - = render "events/event/push", event: event - .clearfix - - elsif event.note? - = render "events/event/note", event: event - - else - = render "events/event/common", event: event + - if event.push? + = render "events/event/push", event: event + .clearfix + - elsif event.note? + = render "events/event/note", event: event + - else + = render "events/event/common", event: event diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index 8bcfa95f..ef5035fc 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -11,7 +11,7 @@ #{event.note_target_type} ##{truncate event.note_target_id} - elsif event.wall_note? - = link_to 'wall', project_wall_path(event.project) + = link_to 'wall', wall_project_path(event.project) - else %strong (deleted) at @@ -21,15 +21,6 @@ = event.project_name .event-body - .event-note - .md - %i.icon-comment-alt.event-note-icon - = sanitize(markdown(truncate(event.target.note, length: 150)), tags: %w(a img b pre p)) - - note = event.target - - if note.attachment.url - = link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do - - if note.attachment.image? - = image_tag note.attachment.url, class: 'note-image-attach' - - else - %i.icon-paper-clip - = note.attachment_identifier + %i.icon-comment-alt.event-note-icon + %span.event-note + = markdown truncate(event.target.note, length: 70) diff --git a/app/views/graph/_head.html.haml b/app/views/graph/_head.html.haml deleted file mode 100644 index fba9a958..00000000 --- a/app/views/graph/_head.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3.page_title Project Network Graph -%hr - -.clearfix - .pull-left - = render partial: 'shared/ref_switcher', locals: {destination: 'graph', path: @path} - - .search.pull-right - = form_tag project_graph_path(@project, params[:id]), method: :get do |f| - .control-group - = label_tag :search , "Looking for commit:", class: 'control-label light' - .controls - = text_field_tag :q, @q, placeholder: "Input SHA", class: "search-input xlarge" - = button_tag type: 'submit', class: 'btn vtop' do - %i.icon-search - diff --git a/app/views/graph/show.json.erb b/app/views/graph/show.json.erb deleted file mode 100644 index 529d5849..00000000 --- a/app/views/graph/show.json.erb +++ /dev/null @@ -1,23 +0,0 @@ -<% self.formats = ["html"] %> - -<%= raw( - { - days: @graph.days.compact.map { |d| [d.day, d.strftime("%b")] }, - commits: @graph.commits.map do |c| - { - parents: parents_zip_spaces(c.parents(@graph.map), c.parent_spaces), - author: { - name: c.author.name, - email: c.author.email, - icon: gravatar_icon(c.author.email, 20) - }, - time: c.time, - space: c.spaces.first, - refs: get_refs(c), - id: c.sha, - date: c.date, - message: c.message, - } - end - }.to_json -) %> diff --git a/app/views/groups/_filter.html.haml b/app/views/groups/_filter.html.haml index 5c66f977..c8b0ad0f 100644 --- a/app/views/groups/_filter.html.haml +++ b/app/views/groups/_filter.html.haml @@ -25,11 +25,9 @@ %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.pull-right= entities_per_project(project, entity) - - if @projects.blank? - %p.nothing_here_message This group has no projects yet + %small.right= entities_per_project(project, entity) %fieldset %hr - = link_to "Reset", group_filter_path(entity), class: 'btn pull-right' + = 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 index 9cdbea60..2d599816 100644 --- a/app/views/groups/_new_group_member.html.haml +++ b/app/views/groups/_new_group_member.html.haml @@ -14,5 +14,5 @@ .form-actions = hidden_field_tag :redirect_to, people_group_path(@group) - = f.submit 'Add', class: "btn btn-save" + = 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 b3424b01..89ac05e7 100644 --- a/app/views/groups/_new_member.html.haml +++ b/app/views/groups/_new_member.html.haml @@ -14,5 +14,5 @@ .form-actions = hidden_field_tag :redirect_to, people_group_path(@group, project_id: @project.id) - = f.submit 'Add', class: "btn btn-save" + = f.submit 'Add', class: "btn save-btn" diff --git a/app/views/groups/_people_filter.html.haml b/app/views/groups/_people_filter.html.haml index ee63743e..79a1b01a 100644 --- a/app/views/groups/_people_filter.html.haml +++ b/app/views/groups/_people_filter.html.haml @@ -6,11 +6,9 @@ %li{class: ("active" if params[:project_id] == project.id.to_s)} = link_to people_group_path(@group, project_id: project.id) do = project.name_with_namespace - %small.pull-right= project.users.count - - if @projects.blank? - %p.nothing_here_message This group has no projects yet + %small.right= project.users.count %fieldset %hr - = link_to "Reset", people_group_path(@group), class: 'btn pull-right' + = link_to "Reset", people_group_path(@group), class: 'btn right' diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml index bf1a624b..040d1ae9 100644 --- a/app/views/groups/_projects.html.haml +++ b/app/views/groups/_projects.html.haml @@ -1,11 +1,11 @@ -.ui-box +.projects_box %h5.title Projects %small (#{projects.count}) - if can? current_user, :manage_group, @group - %span.pull-right - = link_to new_project_path(namespace_id: @group.id), class: "btn btn-tiny info" do + %span.right + = link_to new_project_path(namespace_id: @group.id), class: "btn very_small info" do %i.icon-plus New Project %ul.well-list diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml deleted file mode 100644 index eb4f324b..00000000 --- a/app/views/groups/edit.html.haml +++ /dev/null @@ -1,75 +0,0 @@ -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li.active - = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab' - %li - = link_to 'Edit Group', '#tab-edit', 'data-toggle' => 'tab' - %li - = link_to 'Transfer', '#tab-transfer', 'data-toggle' => 'tab' - %li - = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - - .span9 - .tab-content - .tab-pane.active#tab-projects - .ui-box - %h5.title Projects - %ul.well-list - - @group.projects.each do |project| - %li - - if project.public - %i.icon-share - - else - %i.icon-lock.cgreen - = link_to project.name_with_namespace, project - .pull-right - = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Remove', project, confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" - - if @group.projects.blank? - %p.nothing_here_message This group has no projects yet - - .tab-pane#tab-edit - .ui-box - %h5.title Edit Group - %div.form-holder - = form_for @group do |f| - - if @group.errors.any? - .alert.alert-error - %span= @group.errors.full_messages.first - .clearfix - = f.label :name do - Group name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" - - .clearfix.group-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Save group', class: "btn btn-save" - - .tab-pane#tab-transfer - .ui-box.ui-box-danger - %h5.title Transfer group - .ui-box-body - %p - Transferring group will cause loss of admin control over group and all child projects - = form_for @group do |f| - = users_select_tag(:'group[owner_id]') - %hr - = f.submit 'Transfer group', class: "btn btn-small btn-remove" - - .tab-pane#tab-remove - .ui-box.ui-box-danger - %h5.title Remove group - .ui-box-body - %p - Remove of group will cause removing all child projects and resources. - %p - %strong Removed group can not be restored! - - = link_to 'Remove Group', @group, confirm: 'Removed group can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small" diff --git a/app/views/groups/issues.atom.builder b/app/views/groups/issues.atom.builder index 701747bd..5bd07bcd 100644 --- a/app/views/groups/issues.atom.builder +++ b/app/views/groups/issues.atom.builder @@ -1,9 +1,9 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.title "#{@user.name} issues" - xml.link :href => issues_dashboard_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" - xml.link :href => issues_dashboard_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html" - xml.id issues_dashboard_url(:private_token => @user.private_token) + xml.link :href => dashboard_issues_url(:atom, :private_token => @user.private_token), :rel => "self", :type => "application/atom+xml" + xml.link :href => dashboard_issues_url(:private_token => @user.private_token), :rel => "alternate", :type => "text/html" + xml.id dashboard_issues_url(:private_token => @user.private_token) xml.updated @issues.first.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") if @issues.any? @issues.each do |issue| diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 96aa2a16..9e8642f3 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -1,7 +1,7 @@ %h3.page_title Issues %small (assigned to you) - %small.pull-right #{@issues.total_count} issues + %small.right #{@issues.total_count} issues %hr .row @@ -16,7 +16,7 @@ = link_to_project project %ul.well-list.issues_table - group[1].each do |issue| - = render issue + = render(partial: 'issues/show', locals: {issue: issue}) %hr = paginate @issues, theme: "gitlab" - else diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index a311729d..0c4d6e0a 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -1,7 +1,7 @@ %h3.page_title Merge Requests %small (authored by or assigned to you) - %small.pull-right #{@merge_requests.total_count} merge requests + %small.right #{@merge_requests.total_count} merge requests %hr .row diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml deleted file mode 100644 index 36ee4922..00000000 --- a/app/views/groups/new.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%h3.page_title New Group -%hr -= form_for @group do |f| - - if @group.errors.any? - .alert.alert-error - %span= @group.errors.full_messages.first - .clearfix - = f.label :name do - Group name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" - - .clearfix.group-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Create group', class: "btn btn-create" - - - .padded - %ul - %li Group is kind of directory for several projects - %li All created groups are private - %li People within a group see only projects they have access to - %li All projects of group will be stored in group directory - %li You will be able to move existing projects into group diff --git a/app/views/groups/people.html.haml b/app/views/groups/people.html.haml index 3e4eb082..0bceeaa3 100644 --- a/app/views/groups/people.html.haml +++ b/app/views/groups/people.html.haml @@ -16,5 +16,5 @@ %strong= user.name %span.cgray= user.email - if @group.owner == user - %span.btn.btn-small.disabled.pull-right Group Owner + %span.btn.btn-small.disabled.right Group Owner diff --git a/app/views/groups/search.html.haml b/app/views/groups/search.html.haml new file mode 100644 index 00000000..1ba4707a --- /dev/null +++ b/app/views/groups/search.html.haml @@ -0,0 +1,9 @@ += form_tag search_group_path(@group), method: :get, class: 'form-inline' do |f| + .padded + = label_tag :search do + %strong Looking for + .input + = 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? + = render 'search/result' diff --git a/app/views/groups/show.atom.builder b/app/views/groups/show.atom.builder index 5f2999c3..9aa52ea5 100644 --- a/app/views/groups/show.atom.builder +++ b/app/views/groups/show.atom.builder @@ -1,8 +1,8 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Group feed - #{@group.name}" - xml.link :href => group_path(@group, :atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => group_path(@group), :rel => "alternate", :type => "text/html" + xml.title "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}" + xml.link :href => projects_url(:atom), :rel => "self", :type => "application/atom+xml" + xml.link :href => projects_url, :rel => "alternate", :type => "text/html" xml.id projects_url xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index adf249f6..84dd17c0 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -1,7 +1,7 @@ .projects .activities.span8 = render "events/event_last_push", event: @last_push - = link_to dashboard_path, class: 'btn btn-tiny' do + = link_to dashboard_path, class: 'btn very_small' do ← To dashboard   %span.cgray You will only see events from projects in this group @@ -12,15 +12,12 @@ %p.nothing_here_message Project activity will be displayed here .loading.hide .side.span4 - - if @group.description.present? - .description.well.light - = @group.description = render "projects", projects: @projects - .prepend-top-20 - = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed" do - %strong - %i.icon-rss - News Feed + %div + %span.rss-icon + = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do + = image_tag "rss_ui.png", title: "feed" + %strong News Feed %hr .gitlab-promo diff --git a/app/views/help/_layout.html.haml b/app/views/help/_layout.html.haml deleted file mode 100644 index fa5e3a30..00000000 --- a/app/views/help/_layout.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -.row - .span3{:"data-spy" => 'affix'} - .ui-box - .title - %h5 Help - %ul.well-list - %li - %strong= link_to "Workflow", help_workflow_path - %li - %strong= link_to "SSH keys", help_ssh_path - - %li - %strong= link_to "GitLab Markdown", help_markdown_path - - %li - %strong= link_to "Permissions", help_permissions_path - - %li - %strong= link_to "API", help_api_path - - %li - %strong= link_to "Web Hooks", help_web_hooks_path - - %li - %strong= link_to "Rake Tasks", help_raketasks_path - - %li - %strong= link_to "System Hooks", help_system_hooks_path - - %li - %strong= link_to "Public Access", help_public_access_path - - .span9.pull-right - = yield diff --git a/app/views/help/api.html.haml b/app/views/help/api.html.haml index 0c502ada..3f16637d 100644 --- a/app/views/help/api.html.haml +++ b/app/views/help/api.html.haml @@ -1,116 +1,107 @@ -= render layout: 'help/layout' do - %h3.page_title API - %br +%h3.page_title API +.back_link + = link_to help_path do + ← to index +%br - %ul.nav.nav-tabs.log-tabs.nav-small-tabs - %li.active - = link_to "README", "#README", 'data-toggle' => 'tab' - %li - = link_to "Projects", "#projects", 'data-toggle' => 'tab' - %li - = link_to "Snippets", "#snippets", 'data-toggle' => 'tab' - %li - = link_to "Repositories", "#repositories", 'data-toggle' => 'tab' - %li - = link_to "Users", "#users", 'data-toggle' => 'tab' - %li - = link_to "Session", "#session", 'data-toggle' => 'tab' - %li - = link_to "Issues", "#issues", 'data-toggle' => 'tab' - %li - = link_to "Milestones", "#milestones", 'data-toggle' => 'tab' - %li - = link_to "Notes", "#notes", 'data-toggle' => 'tab' - %li - = link_to "System Hooks", "#system_hooks", 'data-toggle' => 'tab' +%ul.nav.nav-tabs.log-tabs + %li.active + = link_to "README", "#README", 'data-toggle' => 'tab' + %li + = link_to "Projects", "#projects", 'data-toggle' => 'tab' + %li + = link_to "Snippets", "#snippets", 'data-toggle' => 'tab' + %li + = link_to "Repositories", "#repositories", 'data-toggle' => 'tab' + %li + = link_to "Users", "#users", 'data-toggle' => 'tab' + %li + = link_to "Session", "#session", 'data-toggle' => 'tab' + %li + = link_to "Issues", "#issues", 'data-toggle' => 'tab' + %li + = link_to "Milestones", "#milestones", 'data-toggle' => 'tab' + %li + = link_to "Notes", "#notes", 'data-toggle' => 'tab' - .tab-content - .tab-pane.active#README - .file_holder - .file_title - %i.icon-file - README - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "README.md")) +.tab-content + .tab-pane.active#README + .file_holder + .file_title + %i.icon-file + README + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "README.md")) - .tab-pane#projects - .file_holder - .file_title - %i.icon-file - Projects - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "projects.md")) + .tab-pane#projects + .file_holder + .file_title + %i.icon-file + Projects + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "projects.md")) - .tab-pane#snippets - .file_holder - .file_title - %i.icon-file - Projects Snippets - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "snippets.md")) + .tab-pane#snippets + .file_holder + .file_title + %i.icon-file + Projects Snippets + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "snippets.md")) - .tab-pane#repositories - .file_holder - .file_title - %i.icon-file - Projects - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "repositories.md")) + .tab-pane#repositories + .file_holder + .file_title + %i.icon-file + Projects + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "repositories.md")) - .tab-pane#users - .file_holder - .file_title - %i.icon-file - Users - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "users.md")) + .tab-pane#users + .file_holder + .file_title + %i.icon-file + Users + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "users.md")) - .tab-pane#session - .file_holder - .file_title - %i.icon-file - Session - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "session.md")) + .tab-pane#session + .file_holder + .file_title + %i.icon-file + Session + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "session.md")) - .tab-pane#issues - .file_holder - .file_title - %i.icon-file - Issues - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "issues.md")) + .tab-pane#issues + .file_holder + .file_title + %i.icon-file + Issues + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "issues.md")) - .tab-pane#milestones - .file_holder - .file_title - %i.icon-file - Milestones - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "milestones.md")) + .tab-pane#milestones + .file_holder + .file_title + %i.icon-file + Milestones + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "milestones.md")) - .tab-pane#notes - .file_holder - .file_title - %i.icon-file - Notes - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "notes.md")) - - .tab-pane#system_hooks - .file_holder - .file_title - %i.icon-file - System Hooks - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "system_hooks.md")) + .tab-pane#notes + .file_holder + .file_title + %i.icon-file + Notes + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "api", "notes.md")) diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index ffea654d..28791b32 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -1,13 +1,13 @@ %h3.page_title GITLAB - .pull-right - %span= Gitlab::VERSION - %small= Gitlab::REVISION + .right + %span= Gitlab::Version + %small= Gitlab::Revision %hr %p.lead Self Hosted Git Management %br - Fast, secure and stable solution based on Ruby on Rails. + Fast, secure and stable solution based on Ruby on Rails & Gitolite. %br @@ -22,7 +22,7 @@ = mail_to Gitlab.config.gitlab.support_email, "support contact" %li Use the - = link_to "search bar", '#', onclick: "$('#search').focus();" + = link_to "search bar", '#', onclick: "$("#search").focus();" on the top of this page %li Ask in our diff --git a/app/views/help/markdown.html.haml b/app/views/help/markdown.html.haml index 92c1e49b..0419f7c1 100644 --- a/app/views/help/markdown.html.haml +++ b/app/views/help/markdown.html.haml @@ -1,127 +1,129 @@ -= render layout: 'help/layout' do - %h3.page_title GitLab Flavored Markdown - %br +%h3.page_title GitLab Flavored Markdown +.back_link + = link_to help_path do + ← to index +%hr - .row - .span8 +.row + .span8 + %p + For GitLab we developed something we call "GitLab Flavored Markdown" (GFM). + It extends the standard Markdown in a few significant ways adds some useful functionality. + + %p You can use GFM in: + %ul + %li commit messages + %li comments + %li wall posts + %li issues + %li merge requests + %li milestones + %li wiki pages + + .span4 + .alert.alert-info %p - For GitLab we developed something we call "GitLab Flavored Markdown" (GFM). - It extends the standard Markdown in a few significant ways adds some useful functionality. + If you're not already familiar with Markdown, you should spend 15 minutes and go over the excellent + %strong= link_to "Markdown Syntax Guide", "http://daringfireball.net/projects/markdown/syntax" + at Daring Fireball. - %p You can use GFM in: - %ul - %li commit messages - %li comments - %li wall posts - %li issues - %li merge requests - %li milestones - %li wiki pages +.row + .span8 + %h3 Differences from traditional Markdown - .span4 - .alert.alert-info - %p - If you're not already familiar with Markdown, you should spend 15 minutes and go over the excellent - %strong= link_to "Markdown Syntax Guide", "http://daringfireball.net/projects/markdown/syntax" - at Daring Fireball. + %h4 Newlines - .row - .span8 - %h3 Differences from traditional Markdown + %p + The biggest difference that GFM introduces is in the handling of linebreaks. + With traditional Markdown you can hard wrap paragraphs of text and they will be combined into a single paragraph. We find this to be the cause of a huge number of unintentional formatting errors. + GFM treats newlines in paragraph-like content as real line breaks, which is probably what you intended. - %h4 Newlines + %p The next paragraph contains two phrases separated by a single newline character: + %pre= "Roses are red\nViolets are blue" + %p becomes + = markdown "Roses are red\nViolets are blue" + + %h4 Multiple underscores in words + + %p + It is not reasonable to italicize just part of a word, especially when you're dealing with code and names often appear with multiple underscores. + Therefore, GFM ignores multiple underscores in words. + + %pre= "perform_complicated_task\ndo_this_and_do_that_and_another_thing" + %p becomes + = markdown "perform_complicated_task\ndo_this_and_do_that_and_another_thing" + + %h4 URL autolinking + + %p + GFM will autolink standard URLs you copy and paste into your text. + So if you want to link to a URL (instead of a textual link), you can simply put the URL in verbatim and it will be turned into a link to that URL. + + %h4 Fenced code blocks + + %p + Markdown converts text with four spaces at the front of each line to code blocks. + GFM supports that, but we also support fenced blocks. + Just wrap your code blocks in ``` and you won't need to indent manually to trigger a code block. + + %pre= %Q{```ruby\nrequire 'redcarpet'\nmarkdown = Redcarpet.new("Hello World!")\nputs markdown.to_html\n```} + %p becomes + = markdown %Q{```ruby\nrequire 'redcarpet'\nmarkdown = Redcarpet.new("Hello World!")\nputs markdown.to_html\n```} + + %h4 Emoji + +.row + .span8 + :ruby + puts markdown %Q{Sometimes you want to be :cool: and add some :sparkles: to your :speech_balloon:. Well we have a :gift: for you: + + :exclamation: You can use emoji anywhere GFM is supported. :sunglasses: + + You can use it to point out a :bug: or warn about :monkey:patches. And if someone improves your really :snail: code, send them a :bouquet: or some :candy:. People will :heart: you for that. + + If you are :new: to this, don't be :fearful:. You can easily join the emoji :circus_tent:. All you need to do is to :book: up on the supported codes. + } + + .span4 + .alert.alert-info %p - The biggest difference that GFM introduces is in the handling of linebreaks. - With traditional Markdown you can hard wrap paragraphs of text and they will be combined into a single paragraph. We find this to be the cause of a huge number of unintentional formatting errors. - GFM treats newlines in paragraph-like content as real line breaks, which is probably what you intended. + Consult the + %strong= link_to "Emoji Cheat Sheet", "http://www.emoji-cheat-sheet.com/" + for a list of all supported emoji codes. +.row + .span8 + %h4 Special GitLab references - %p The next paragraph contains two phrases separated by a single newline character: - %pre= "Roses are red\nViolets are blue" - %p becomes - = markdown "Roses are red\nViolets are blue" + %p + GFM recognizes special references. + You can easily reference e.g. a team member, an issue or a commit within a project. + GFM will turn that reference into a link so you can navigate between them easily. - %h4 Multiple underscores in words + %p GFM will recognize the following references: + %ul + %li + %code @foo + for team members + %li + %code #123 + for issues + %li + %code !123 + for merge request + %li + %code $123 + for snippets + %li + %code 1234567 + for commits - %p - It is not reasonable to italicize just part of a word, especially when you're dealing with code and names often appear with multiple underscores. - Therefore, GFM ignores multiple underscores in words. - - %pre= "perform_complicated_task\ndo_this_and_do_that_and_another_thing" - %p becomes - = markdown "perform_complicated_task\ndo_this_and_do_that_and_another_thing" - - %h4 URL autolinking - - %p - GFM will autolink standard URLs you copy and paste into your text. - So if you want to link to a URL (instead of a textual link), you can simply put the URL in verbatim and it will be turned into a link to that URL. - - %h4 Fenced code blocks - - %p - Markdown converts text with four spaces at the front of each line to code blocks. - GFM supports that, but we also support fenced blocks. - Just wrap your code blocks in ``` and you won't need to indent manually to trigger a code block. - - %pre= %Q{```ruby\nrequire 'redcarpet'\nmarkdown = Redcarpet.new("Hello World!")\nputs markdown.to_html\n```} - %p becomes - = markdown %Q{```ruby\nrequire 'redcarpet'\nmarkdown = Redcarpet.new("Hello World!")\nputs markdown.to_html\n```} - - %h4 Emoji - - .row - .span8 - :ruby - puts markdown %Q{Sometimes you want to be :cool: and add some :sparkles: to your :speech_balloon:. Well we have a :gift: for you: - - :exclamation: You can use emoji anywhere GFM is supported. :sunglasses: - - You can use it to point out a :bug: or warn about :monkey:patches. And if someone improves your really :snail: code, send them a :bouquet: or some :candy:. People will :heart: you for that. - - If you are :new: to this, don't be :fearful:. You can easily join the emoji :circus_tent:. All you need to do is to :book: up on the supported codes. - } - - .span4 - .alert.alert-info - %p - Consult the - %strong= link_to "Emoji Cheat Sheet", "http://www.emoji-cheat-sheet.com/" - for a list of all supported emoji codes. - - .row - .span8 - %h4 Special GitLab references - - %p - GFM recognizes special references. - You can easily reference e.g. a team member, an issue or a commit within a project. - GFM will turn that reference into a link so you can navigate between them easily. - - %p GFM will recognize the following references: - %ul - %li - %code @foo - for team members - %li - %code #123 - for issues - %li - %code !123 - for merge request - %li - %code $123 - for snippets - %li - %code 1234567 - for commits - - -# this example will only be shown if the user has a project with at least one issue - - 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.username} is working on solving it." - %p becomes: - = markdown "This is related to ##{issue.id}. @#{current_user.username} is working on solving it." - - @project = nil # Prevent this from bubbling up to page title + -# this example will only be shown if the user has a project with at least one issue + - 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." + %p becomes: + = markdown "This is related to ##{issue.id}. @#{current_user.name} is working on solving it." + - @project = nil # Prevent this from bubbling up to page title diff --git a/app/views/help/permissions.html.haml b/app/views/help/permissions.html.haml index 2075753e..b56251f3 100644 --- a/app/views/help/permissions.html.haml +++ b/app/views/help/permissions.html.haml @@ -1,66 +1,68 @@ -= render layout: 'help/layout' do - %h3.page_title Permissions - %br +%h3.page_title Permissions +.back_link + = link_to help_path do + ← to index +%hr - %fieldset - %legend Guest - %ul - %li Create new issue - %li Leave comments - %li Write on project wall +%fieldset + %legend Guest + %ul + %li Create new issue + %li Leave comments + %li Write on project wall - %fieldset - %legend Reporter - %ul - %li Create new issue - %li Leave comments - %li Write on project wall - %li Pull project code - %li Download project - %li Create a code snippets +%fieldset + %legend Reporter + %ul + %li Create new issue + %li Leave comments + %li Write on project wall + %li Pull project code + %li Download project + %li Create a code snippets - %fieldset - %legend Developer - %ul - %li Create new issue - %li Leave comments - %li Write on project wall - %li Pull project code - %li Download project - %li Create new merge request - %li Create a code snippets - %li Create new branches - %li Push to non-protected branches - %li Remove non-protected branches - %li Add tags - %li Write a wiki +%fieldset + %legend Developer + %ul + %li Create new issue + %li Leave comments + %li Write on project wall + %li Pull project code + %li Download project + %li Create new merge request + %li Create a code snippets + %li Create new branches + %li Push to non-protected branches + %li Remove non-protected branches + %li Add tags + %li Write a wiki - %fieldset - %legend Master - %ul - %li Create new issue - %li Leave comments - %li Write on project wall - %li Pull project code - %li Download project - %li Create new merge request - %li Create a code snippets - %li Create new branches - %li Push to non-protected branches - %li Remove non-protected branches - %li Add tags - %li Write a wiki - %li Add new team members - %li Push to protected branches - %li Remove protected branches - %li Push with force option - %li Edit project - %li Add Deploy Keys to project - %li Configure Project Hooks +%fieldset + %legend Master + %ul + %li Create new issue + %li Leave comments + %li Write on project wall + %li Pull project code + %li Download project + %li Create new merge request + %li Create a code snippets + %li Create new branches + %li Push to non-protected branches + %li Remove non-protected branches + %li Add tags + %li Write a wiki + %li Add new team members + %li Push to protected branches + %li Remove protected branches + %li Push with force option + %li Edit project + %li Add Deploy Keys to project + %li Configure Project Hooks - %fieldset - %legend Owner - %ul - %li Transfer project to another namespace - %li Remove project +%fieldset + %legend Owner + %ul + %li Transfer project to another namespace + %li Remove project diff --git a/app/views/help/public_access.html.haml b/app/views/help/public_access.html.haml index 66de17a3..60d8d597 100644 --- a/app/views/help/public_access.html.haml +++ b/app/views/help/public_access.html.haml @@ -1,16 +1,18 @@ -= render layout: 'help/layout' do - %h3.page_title Public Access - %br +%h3.page_title Public Access +.back_link + = link_to help_path do + ← to index +%hr - %p - GitLab allows you to open selected projects to be accessed publicly. - These projects will be clonable - %em without any - authentication. - Also they will be listed on the #{link_to "public access directory", public_root_path}. +%p + GitLab allows you to open selected projects to be accessed publicly. + These projects will be clonable + %em without any + authentication. + Also they will be listed on the #{link_to "public access directory", public_root_path}. - %ol - %li Go to your project dashboard - %li Click on the "Edit" tab - %li Select "Public clone access" +%ol + %li Go to your project dashboard + %li Click on the "Edit" tab + %li Select "Public clone access" diff --git a/app/views/help/raketasks.html.haml b/app/views/help/raketasks.html.haml index bcc874fc..f015451a 100644 --- a/app/views/help/raketasks.html.haml +++ b/app/views/help/raketasks.html.haml @@ -1,64 +1,66 @@ -= render layout: 'help/layout' do - %h3.page_title GitLab Rake Tasks - %br +%h3.page_title GitLab Rake Tasks +.back_link + = link_to help_path do + ← to index +%hr - %p.slead - GitLab provides some specific rake tasks to enable special features or perform maintenance tasks. +%p.slead + GitLab provides some specific rake tasks to enable special features or perform maintenance tasks. - %ul.nav.nav-tabs.log-tabs - %li.active - = link_to "Features", "#features", 'data-toggle' => 'tab' - %li - = link_to "Maintenance", "#maintenance", 'data-toggle' => 'tab' - %li - = 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' +%ul.nav.nav-tabs.log-tabs + %li.active + = link_to "Features", "#features", 'data-toggle' => 'tab' + %li + = link_to "Maintenance", "#maintenance", 'data-toggle' => 'tab' + %li + = 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 - .file_holder - .file_title - %i.icon-file - Features - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "raketasks", "features.md")) +.tab-content + .tab-pane.active#features + .file_holder + .file_title + %i.icon-file + Features + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "features.md")) - .tab-pane#maintenance - .file_holder - .file_title - %i.icon-file - Maintenance - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "raketasks", "maintenance.md")) + .tab-pane#maintenance + .file_holder + .file_title + %i.icon-file + Maintenance + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "maintenance.md")) - .tab-pane#user_management - .file_holder - .file_title - %i.icon-file - User Management - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "raketasks", "user_management.md")) + .tab-pane#user_management + .file_holder + .file_title + %i.icon-file + User Management + .file_content.wiki + = 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#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 - %i.icon-file - Backup & Restore - .file_content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "raketasks", "backup_restore.md")) + .tab-pane#backup_restore + .file_holder + .file_title + %i.icon-file + Backup & Restore + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "backup_restore.md")) diff --git a/app/views/help/ssh.html.haml b/app/views/help/ssh.html.haml index 11441597..3f082333 100644 --- a/app/views/help/ssh.html.haml +++ b/app/views/help/ssh.html.haml @@ -1,23 +1,25 @@ -= render layout: 'help/layout' do - %h3.page_title SSH Keys - %br +%h3.page_title SSH Keys +.back_link + = link_to help_path do + ← to index +%hr - %p.slead - SSH key allows you to establish a secure connection between your computer and GitLab +%p.slead + SSH key allows you to establish a secure connection between your computer and GitLab - %p.slead - To generate a new SSH key just open your terminal and use code below. +%p.slead + To generate a new SSH key just open your terminal and use code below. - %pre.dark - ssh-keygen -t rsa -C "#{current_user.email}" +%pre.dark + ssh-keygen -t rsa -C "#{current_user.email}" - \# Creates a new ssh key using the provided email - \# Generating public/private rsa key pair... + \# Creates a new ssh key using the provided email + \# Generating public/private rsa key pair... - %p.slead - Next just use code below to dump your public key and add to GitLab SSH Keys +%p.slead + Next just use code below to dump your public key and add to GitLab SSH Keys - %pre.dark - cat ~/.ssh/id_rsa.pub +%pre.dark + cat ~/.ssh/id_rsa.pub - \# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc.... + \# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc.... diff --git a/app/views/help/system_hooks.html.haml b/app/views/help/system_hooks.html.haml index c49011a2..c25b60de 100644 --- a/app/views/help/system_hooks.html.haml +++ b/app/views/help/system_hooks.html.haml @@ -1,12 +1,14 @@ -= render layout: 'help/layout' do - %h3.page_title System hooks - %br +%h3 System hooks +.back_link + = link_to :back do + ← back +%hr - %p.slead - Your GitLab instance can perform HTTP POST requests on the following events: create_project, delete_project, create_user, delete_user, change_team_member. - %br - %br - System Hooks can be used, e.g. for logging or changing information in a LDAP server. - %br - %h5 Hooks request example: - = render "admin/hooks/data_ex" +%p.slead + Your GitLab instance can perform HTTP POST requests on the following events: create_project, delete_project, create_user, delete_user, change_team_member. + %br + %br + System Hooks can be used, e.g. for logging or changing information in a LDAP server. + %br +%h5 Hooks request example: += render "admin/hooks/data_ex" diff --git a/app/views/help/web_hooks.html.haml b/app/views/help/web_hooks.html.haml index 09745f73..65036613 100644 --- a/app/views/help/web_hooks.html.haml +++ b/app/views/help/web_hooks.html.haml @@ -1,13 +1,15 @@ -= render layout: 'help/layout' do - %h3.page_title Web hooks +%h3.page_title Web hooks +.back_link + = link_to help_path do + ← to index +%hr + +%p.slead + Every GitLab project can trigger a web server whenever the repo is pushed to. %br - - %p.slead - Every GitLab project can trigger a web server whenever the repo is pushed to. - %br - Web Hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. - %br - GitLab will send POST request with commits information on every push. - %h5 Hooks request example: - = render "hooks/data_ex" + Web Hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. + %br + GitLab will send POST request with commits information on every push. +%h5 Hooks request example: += render "hooks/data_ex" diff --git a/app/views/help/workflow.html.haml b/app/views/help/workflow.html.haml index 495b7c6e..6062ca09 100644 --- a/app/views/help/workflow.html.haml +++ b/app/views/help/workflow.html.haml @@ -1,38 +1,40 @@ -= render layout: 'help/layout' do - %h3.page_title Workflow - %br +%h3.page_title Workflow +.back_link + = link_to help_path do + ← to index +%hr - %ol.help - %li - %p Clone project - .bash - %pre.dark - git clone git@example.com:project-name.git +%ol.help + %li + %p Clone project + .bash + %pre.dark + git clone git@example.com:project-name.git - %li - %p Create branch with your feature - .bash - %pre.dark - git checkout -b $feature_name + %li + %p Create branch with your feature + .bash + %pre.dark + git checkout -b $feature_name - %li - %p Write code. Commit changes - .bash - %pre.dark - git commit -am "My feature is ready" + %li + %p Write code. Commit changes + .bash + %pre.dark + git commit -am "My feature is ready" - %li - %p Push your branch to GitLab - .bash - %pre.dark - git push origin $feature_name + %li + %p Push your branch to GitLab + .bash + %pre.dark + git push origin $feature_name - %li - %p Review your code on Commits page + %li + %p Review your code on Commits page - %li - %p Create a merge request + %li + %p Create a merge request - %li - %p Your team lead will review code & merge it to main branch + %li + %p Your team lead will review code & merge it to main branch diff --git a/app/views/hooks/index.html.haml b/app/views/hooks/index.html.haml index 3155dd32..1fcf6e1c 100644 --- a/app/views/hooks/index.html.haml +++ b/app/views/hooks/index.html.haml @@ -1,4 +1,4 @@ -= render "projects/settings_nav" += render "projects/project_head" - if can? current_user, :admin_project, @project .alert.alert-info @@ -10,7 +10,7 @@ = form_for [@project, @hook], as: :hook, url: project_hooks_path(@project), html: { class: 'form-inline' } do |f| -if @hook.errors.any? - .alert.alert-error + .alert-message.block-message.error - @hook.errors.full_messages.each do |msg| %p= msg .clearfix @@ -18,7 +18,7 @@ .input = f.text_field :url, class: "text_field xxlarge"   - = f.submit "Add Web Hook", class: "btn btn-create" + = f.submit "Add Web Hook", class: "btn primary" %hr -if @hooks.any? @@ -37,6 +37,6 @@ → %span.monospace= hook.url %td - .pull-right - = link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn btn-small grouped" - = link_to 'Remove', project_hook_path(@project, hook), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove btn-small grouped" + .right + = link_to 'Test Hook', test_project_hook_path(@project, hook), class: "btn small grouped" + = link_to 'Remove', project_hook_path(@project, hook), confirm: 'Are you sure?', method: :delete, class: "danger btn small grouped" diff --git a/app/views/issues/_filter.html.haml b/app/views/issues/_filter.html.haml index b621f11b..779e55bb 100644 --- a/app/views/issues/_filter.html.haml +++ b/app/views/issues/_filter.html.haml @@ -6,10 +6,7 @@ Open %li{class: ("active" if params[:status] == 'assigned-to-me')} = link_to project_issues_path(@project, status: 'assigned-to-me') do - Assigned to me - %li{class: ("active" if params[:status] == 'created-by-me')} - = link_to project_issues_path(@project, status: 'created-by-me') do - Created by me + Assigned To Me %li{class: ("active" if params[:status] == 'closed')} = link_to project_issues_path(@project, status: 'closed') do Closed @@ -19,5 +16,5 @@ %fieldset %hr - = link_to "Reset", project_issues_path(@project), class: 'btn pull-right' + = 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 6d7613a7..bef235f2 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -2,7 +2,7 @@ %h3.page_title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}" = form_for [@project, @issue] do |f| -if @issue.errors.any? - .alert.alert-error + .alert-message.block-message.error - @issue.errors.full_messages.each do |msg| %span= msg %br @@ -44,12 +44,12 @@ .actions - if @issue.new_record? - = f.submit 'Submit new issue', class: "btn btn-create" + = f.submit 'Submit new issue', class: "btn success" -else - = f.submit 'Save changes', class: "btn-save btn" + = f.submit 'Save changes', class: "save-btn btn" - cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue) - = link_to "Cancel", cancel_path, class: 'btn btn-cancel' + = link_to "Cancel", cancel_path, class: 'btn cancel-btn' diff --git a/app/views/issues/_head.html.haml b/app/views/issues/_head.html.haml index 44d14d5c..4294503c 100644 --- a/app/views/issues/_head.html.haml +++ b/app/views/issues/_head.html.haml @@ -5,6 +5,7 @@ = link_to 'Milestones', project_milestones_path(@project), class: "tab" = nav_link(controller: :labels) do = link_to 'Labels', project_labels_path(@project), class: "tab" - %li.pull-right - = link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do - %i.icon-rss + %li.right + %span.rss-icon + = link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do + = image_tag "rss_ui.png", title: "feed" diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml index dc7db906..8821dbb8 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/issues/_issues.html.haml @@ -1,9 +1,10 @@ -= render @issues +- @issues.each do |issue| + = render(partial: 'issues/show', locals: {issue: issue}) - if @issues.present? %li.bottom .left= paginate @issues, remote: true, theme: "gitlab" - .pull-right + .right %span.issue_counter #{@issues.total_count} issues for this filter - else diff --git a/app/views/issues/_issue.html.haml b/app/views/issues/_show.html.haml similarity index 77% rename from app/views/issues/_issue.html.haml rename to app/views/issues/_show.html.haml index 3d1ecd43..dcef901c 100644 --- a/app/views/issues/_issue.html.haml +++ b/app/views/issues/_show.html.haml @@ -2,17 +2,17 @@ - if controller.controller_name == 'issues' .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) - .pull-right + .right - if issue.notes.any? - %span.btn.btn-small.disabled.grouped + %span.btn.small.disabled.grouped %i.icon-comment = issue.notes.count - if can? current_user, :modify_issue, issue - - if issue.closed? - = link_to 'Reopen', project_issue_path(issue.project, issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-small grouped reopen_issue", remote: true + - if issue.closed + = link_to 'Reopen', project_issue_path(issue.project, issue, issue: {closed: false }, status_only: true), method: :put, class: "btn small grouped reopen_issue", remote: true - else - = link_to 'Close', project_issue_path(issue.project, issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-small grouped close_issue", remote: true - = link_to edit_project_issue_path(issue.project, issue), class: "btn btn-small edit-issue-link grouped" do + = link_to 'Close', project_issue_path(issue.project, issue, issue: {closed: true }, status_only: true), method: :put, class: "btn small grouped close_issue", remote: true + = link_to edit_project_issue_path(issue.project, issue), class: "btn small edit-issue-link grouped" do %i.icon-edit Edit diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index 875f29e2..d5c29c78 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -3,16 +3,16 @@ %h3.page_title Issues %span (#{@issues.total_count}) - .pull-right + .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: "btn btn-primary pull-right", 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: 'pull-right' do + = 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[:status] - = search_field_tag :issue_search, nil, { placeholder: 'Search', class: 'issue_search span3 pull-right neib search-text-input' } + = search_field_tag :issue_search, nil, { placeholder: 'Search', class: 'issue_search span3 right neib search-text-input' } .clearfix @@ -33,7 +33,7 @@ = 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 btn-save" + = 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") diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 70f94e52..6bf78929 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -5,18 +5,18 @@ created at = @issue.created_at.stamp("Aug 21, 2011") - %span.pull-right - - if can?(current_user, :modify_issue, @issue) - - if @issue.closed? - = link_to 'Reopen', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn grouped reopen_issue" + %span.right + - if can?(current_user, :admin_project, @project) || @issue.author == current_user + - if @issue.closed + = link_to 'Reopen', project_issue_path(@project, @issue, issue: {closed: false }, status_only: true), method: :put, class: "btn grouped reopen_issue" - else - = link_to 'Close', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn grouped close_issue", title: "Close Issue" - + = link_to 'Close', project_issue_path(@project, @issue, issue: {closed: true }, status_only: true), method: :put, class: "btn grouped close_issue", title: "Close Issue" + - if can?(current_user, :admin_project, @project) || @issue.author == current_user = link_to edit_project_issue_path(@project, @issue), class: "btn grouped" do %i.icon-edit Edit -.pull-right +.right .span3#votes= render 'votes/votes_block', votable: @issue .back_link @@ -27,7 +27,7 @@ .ui-box.ui-box-show .ui-box-head %h4.box-title - - if @issue.closed? + - if @issue.closed .error.status_info Closed = gfm escape_once(@issue.title) @@ -42,7 +42,7 @@ %cite.cgray and attached to milestone %strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone) - .pull-right + .right - @issue.labels.each do |label| %span.label %i.icon-tag @@ -55,11 +55,5 @@ = preserve do = markdown @issue.description -- content_for :note_actions do - - if can?(current_user, :modify_issue, @issue) - - if @issue.closed? - = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn grouped reopen_issue" - - else - = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn grouped close_issue", title: "Close Issue" .voting_notes#notes= render "notes/notes_with_form" diff --git a/app/views/keys/_form.html.haml b/app/views/keys/_form.html.haml index fe26216b..26700803 100644 --- a/app/views/keys/_form.html.haml +++ b/app/views/keys/_form.html.haml @@ -1,7 +1,7 @@ %div = form_for @key do |f| -if @key.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @key.errors.full_messages.each do |msg| %li= msg @@ -19,6 +19,6 @@ .actions - = f.submit 'Save', class: "btn btn-save" - = link_to "Cancel", keys_path, class: "btn btn-cancel" + = f.submit 'Save', class: "btn save-btn" + = link_to "Cancel", keys_path, class: "btn cancel-btn" diff --git a/app/views/keys/_show.html.haml b/app/views/keys/_show.html.haml index 52bbea6f..9d4485cf 100644 --- a/app/views/keys/_show.html.haml +++ b/app/views/keys/_show.html.haml @@ -8,5 +8,5 @@ = time_ago_in_words(key.created_at) ago %td - = link_to 'Remove', key, confirm: 'Are you sure?', method: :delete, class: "btn btn-small btn-remove delete-key pull-right" + = link_to 'Remove', key, confirm: 'Are you sure?', method: :delete, class: "btn small danger delete-key right" diff --git a/app/views/keys/index.html.haml b/app/views/keys/index.html.haml index 7730b344..f5a8283a 100644 --- a/app/views/keys/index.html.haml +++ b/app/views/keys/index.html.haml @@ -1,6 +1,6 @@ %h3.page_title SSH Keys - = link_to "Add new", new_key_path, class: "btn pull-right" + = link_to "Add new", new_key_path, class: "btn right" %hr %p.slead diff --git a/app/views/keys/show.html.haml b/app/views/keys/show.html.haml index 059fe5e5..a8cba6c8 100644 --- a/app/views/keys/show.html.haml +++ b/app/views/keys/show.html.haml @@ -10,5 +10,5 @@ %hr %pre= @key.key -.pull-right - = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn btn-remove delete-key" +.right + = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: "btn danger delete-key" diff --git a/app/views/labels/_label.html.haml b/app/views/labels/_label.html.haml index 027b041d..6e223e8e 100644 --- a/app/views/labels/_label.html.haml +++ b/app/views/labels/_label.html.haml @@ -2,7 +2,7 @@ %strong %i.icon-tag = label.name - .pull-right + .right = link_to project_issues_path(label_name: label.name) do %strong = pluralize(label.count, 'issue') diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index a3bed593..9961ce8d 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -1,8 +1,3 @@ -.flash-container - - if alert - .alert - %span= alert - - - elsif notice - .alert.alert-info - %span= notice +- if text = alert || notice + #flash-container + %h4= text diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index eb83fd2f..4b4f5da3 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -7,7 +7,6 @@ = stylesheet_link_tag "application" = javascript_include_tag "application" = csrf_meta_tags - = include_gon -# Atom feed - if current_user diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index 8f6873e1..f4b2228a 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -8,11 +8,6 @@ %span.separator %h1.project_name= title %ul.nav - %li - = render "layouts/search" - %li - = link_to public_root_path, title: "Public area", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do - %i.icon-globe - if current_user.is_admin? %li = link_to admin_root_path, title: "Admin area", class: 'has_bottom_tooltip', 'data-original-title' => 'Admin area' do @@ -22,14 +17,22 @@ = link_to new_project_path, title: "Create New Project", class: 'has_bottom_tooltip', 'data-original-title' => 'New project' do %i.icon-plus %li - = link_to profile_path, title: "My Profile", class: 'has_bottom_tooltip', 'data-original-title' => 'Your profile' do + = link_to profile_path, title: "Your Profile", class: 'has_bottom_tooltip', 'data-original-title' => 'Your profile' do %i.icon-user + %li.separator %li - = link_to destroy_user_session_path, class: "logout", method: :delete, title: "Logout", class: 'has_bottom_tooltip', 'data-original-title' => 'Logout' do - %i.icon-signout + = render "layouts/search" %li - = link_to current_user, class: "profile-pic" do - = image_tag gravatar_icon(current_user.email, 26) + .account-box + = link_to profile_path, class: "pic" do + = image_tag gravatar_icon(current_user.email) + .account-links + = link_to profile_path, class: "username" do + %i.icon-user.icon-white + My profile + = link_to destroy_user_session_path, class: "logout", method: :delete do + %i.icon-signout.icon-white + Logout = render "layouts/init_auto_complete" diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml index c484af04..7ea90798 100644 --- a/app/views/layouts/_search.html.haml +++ b/app/views/layouts/_search.html.haml @@ -1,8 +1,6 @@ .search = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| = text_field_tag "search", nil, placeholder: "Search", class: "search-input" - = hidden_field_tag :group_id, @group.try(:id) - = hidden_field_tag :project_id, @project.try(:id) :javascript $(function(){ diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index abe3f2ea..a60e7feb 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -2,10 +2,23 @@ %html{ lang: "en"} = render "layouts/head", title: "Admin area" %body{class: "#{app_theme} admin"} - = render "layouts/head_panel", title: "Admin area" = render "layouts/flash" - %nav.main-nav - .container= render 'layouts/nav/admin' - + = render "layouts/head_panel", title: "Admin area" .container + %ul.main_menu + = nav_link(controller: :dashboard, html_options: {class: 'home'}) do + = link_to "Stats", admin_root_path + = nav_link(controller: :projects) do + = link_to "Projects", admin_projects_path + = nav_link(controller: :groups) do + = link_to "Groups", admin_groups_path + = nav_link(controller: :users) do + = link_to "Users", admin_users_path + = nav_link(controller: :logs) do + = link_to "Logs", admin_logs_path + = nav_link(controller: :hooks) do + = link_to "Hooks", admin_hooks_path + = nav_link(controller: :resque) do + = 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 4e683140..88da5c98 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -2,10 +2,23 @@ %html{ lang: "en"} = render "layouts/head", title: "Dashboard" %body{class: "#{app_theme} application"} - = render "layouts/head_panel", title: "Dashboard" = render "layouts/flash" - %nav.main-nav - .container= render 'layouts/nav/dashboard' - + = render "layouts/head_panel", title: "Dashboard" .container + %ul.main_menu + = nav_link(path: 'dashboard#index', html_options: {class: 'home'}) do + = link_to "Home", root_path, title: "Home" + = nav_link(path: 'dashboard#issues') do + = link_to dashboard_issues_path do + Issues + %span.count= current_user.assigned_issues.opened.count + = nav_link(path: 'dashboard#merge_requests') do + = link_to dashboard_merge_requests_path do + Merge Requests + %span.count= current_user.cared_merge_requests.opened.count + = nav_link(path: 'search#show') do + = link_to "Search", search_path + = nav_link(controller: :help) do + = link_to "Help", help_path + .content= yield diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index a9758f19..36c6b4c6 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -3,6 +3,4 @@ = render "layouts/head" %body.ui_basic.login-page = render "layouts/flash" - .container - .content - = yield + .container= yield diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml index b9395873..3554d88f 100644 --- a/app/views/layouts/errors.html.haml +++ b/app/views/layouts/errors.html.haml @@ -2,8 +2,8 @@ %html{ lang: "en"} = render "layouts/head", title: "Error" %body{class: "#{app_theme} application"} - = render "layouts/head_panel", title: "" = render "layouts/flash" + = render "layouts/head_panel", title: "" .container .content %center.padded.prepend-top-20 diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml index 8296b8ae..f47e8b3e 100644 --- a/app/views/layouts/group.html.haml +++ b/app/views/layouts/group.html.haml @@ -2,10 +2,23 @@ %html{ lang: "en"} = render "layouts/head", title: "#{@group.name}" %body{class: "#{app_theme} application"} - = render "layouts/head_panel", title: "group: #{@group.name}" = render "layouts/flash" - %nav.main-nav - .container= render 'layouts/nav/group' - + = render "layouts/head_panel", title: "#{@group.name}" .container + %ul.main_menu + = nav_link(path: 'groups#show', html_options: {class: 'home'}) do + = link_to "Home", group_path(@group), title: "Home" + = nav_link(path: 'groups#issues') do + = link_to issues_group_path(@group) do + Issues + %span.count= current_user.assigned_issues.opened.of_group(@group).count + = nav_link(path: 'groups#merge_requests') do + = link_to merge_requests_group_path(@group) do + Merge Requests + %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 + = link_to "People", people_group_path(@group) + .content= yield diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml deleted file mode 100644 index ca77c26e..00000000 --- a/app/views/layouts/nav/_admin.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -%ul - = nav_link(controller: :dashboard, html_options: {class: 'home'}) do - = link_to admin_root_path, title: "Stats" do - %i.icon-home - = nav_link(controller: :projects) do - = link_to "Projects", admin_projects_path - = nav_link(controller: :teams) do - = link_to "Teams", admin_teams_path - = nav_link(controller: :groups) do - = link_to "Groups", admin_groups_path - = nav_link(controller: :users) do - = link_to "Users", admin_users_path - = nav_link(controller: :logs) do - = link_to "Logs", admin_logs_path - = nav_link(controller: :hooks) do - = link_to "Hooks", admin_hooks_path - = nav_link(controller: :resque) do - = link_to "Background Jobs", admin_resque_path - diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml deleted file mode 100644 index 2ac35050..00000000 --- a/app/views/layouts/nav/_dashboard.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%ul - = nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do - = link_to root_path, title: "Home" do - %i.icon-home - = nav_link(path: 'dashboard#projects') do - = link_to projects_dashboard_path do - Projects - = nav_link(path: 'dashboard#issues') do - = link_to issues_dashboard_path do - Issues - %span.count= current_user.assigned_issues.opened.count - = nav_link(path: 'dashboard#merge_requests') do - = link_to merge_requests_dashboard_path do - Merge Requests - %span.count= current_user.cared_merge_requests.opened.count - = nav_link(path: 'search#show') do - = link_to "Search", search_path - = nav_link(controller: :help) do - = link_to "Help", help_path - diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml deleted file mode 100644 index f3cdb5ac..00000000 --- a/app/views/layouts/nav/_group.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%ul - = nav_link(path: 'groups#show', html_options: {class: 'home'}) do - = link_to group_path(@group), title: "Home" do - %i.icon-home - = nav_link(path: 'groups#issues') do - = link_to issues_group_path(@group) do - Issues - %span.count= current_user.assigned_issues.opened.of_group(@group).count - = nav_link(path: 'groups#merge_requests') do - = link_to merge_requests_group_path(@group) do - Merge Requests - %span.count= current_user.cared_merge_requests.opened.of_group(@group).count - = nav_link(path: 'groups#people') do - = link_to "People", people_group_path(@group) - - - if can?(current_user, :manage_group, @group) - = nav_link(path: 'groups#edit') do - = link_to edit_group_path(@group), class: "tab " do - Settings - diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml deleted file mode 100644 index e5e4b27c..00000000 --- a/app/views/layouts/nav/_profile.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -%ul - = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do - = link_to profile_path, title: "Profile" do - %i.icon-home - = nav_link(path: 'profiles#account') do - = link_to "Account", account_profile_path - = nav_link(controller: :notifications) do - = link_to "Notifications", profile_notifications_path - = nav_link(controller: :keys) do - = link_to keys_path do - SSH Keys - %span.count= current_user.keys.count - = nav_link(path: 'profiles#design') do - = link_to "Design", design_profile_path - = nav_link(path: 'profiles#history') do - = link_to "History", history_profile_path - diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml deleted file mode 100644 index ec3da964..00000000 --- a/app/views/layouts/nav/_project.html.haml +++ /dev/null @@ -1,43 +0,0 @@ -%ul - = nav_link(path: 'projects#show', html_options: {class: "home"}) do - = link_to project_path(@project), title: "Project" do - %i.icon-home - - - unless @project.empty_repo? - - if can? current_user, :download_code, @project - = nav_link(controller: %w(tree blob blame)) do - = 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 || @repository.root_ref) - = nav_link(controller: %w(graph)) do - = link_to "Network", project_graph_path(@project, @ref || @repository.root_ref) - - - if @project.issues_enabled - = nav_link(controller: %w(issues milestones labels)) do - = link_to url_for_project_issues do - Issues - - if @project.used_default_issues_tracker? - %span.count.issue_counter= @project.issues.opened.count - - - if @project.repo_exists? && @project.merge_requests_enabled - = nav_link(controller: :merge_requests) do - = link_to project_merge_requests_path(@project) do - Merge Requests - %span.count.merge_counter= @project.merge_requests.opened.count - - - if @project.wiki_enabled - = nav_link(controller: :wikis) do - = link_to 'Wiki', project_wiki_path(@project, :home) - - - if @project.wall_enabled - = nav_link(controller: :walls) do - = link_to 'Wall', project_wall_path(@project) - - - if @project.snippets_enabled - = nav_link(controller: :snippets) do - = link_to 'Snippets', project_snippets_path(@project) - - - if can? current_user, :admin_project, @project - = nav_link(html_options: {class: "#{project_tab_class}"}) do - = link_to edit_project_path(@project), class: "stat-tab tab " do - Settings diff --git a/app/views/layouts/nav/_team.html.haml b/app/views/layouts/nav/_team.html.haml deleted file mode 100644 index 415e4510..00000000 --- a/app/views/layouts/nav/_team.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -%ul - = nav_link(path: 'teams#show', html_options: {class: 'home'}) do - = link_to team_path(@team), title: "Home" do - %i.icon-home - - = nav_link(path: 'teams#issues') do - = link_to issues_team_path(@team) do - Issues - %span.count= Issue.opened.of_user_team(@team).count - - = nav_link(path: 'teams#merge_requests') do - = link_to merge_requests_team_path(@team) do - Merge Requests - %span.count= MergeRequest.opened.of_user_team(@team).count - - = nav_link(controller: [:members]) do - = link_to team_members_path(@team), class: "team-tab tab" do - Members - %span.count= @team.members.count - - - if can? current_user, :admin_user_team, @team - = nav_link(path: 'teams#edit') do - = link_to edit_team_path(@team), class: "stat-tab tab " do - Settings - diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index f88abeca..3db1f59b 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -4,19 +4,29 @@ %title GitLab - %body - %h1{style: "background: #EEE; border-bottom: 1px solid #DDD; color: #474D57; font: normal 20px Helvetica, Arial, sans-serif; margin: 0; padding: 5px 10px; line-height: 32px; font-size: 16px;"} - GitLab - - if @project - \| - = link_to @project.name_with_namespace, project_url(@project), style: 'color: #29B; text-decoration: none' - %table{align: "left", border: "0", cellpadding: "0", cellspacing: "0", style: "padding: 10px 0;", width: "100%"} + %body{bgcolor: "#EAEAEA", style: "margin: 0; padding: 0; background: #EAEAEA"} + %table{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "padding: 35px 0; background: #EAEAEA;", width: "100%"} %tr - %td{align: "left", style: "margin: 0; padding: 10px;"} - = yield - %br - %tr - %td{align: "left", style: "margin: 0; padding: 10px;"} - %p{style: "font-size:small;color:#777"} - - if @project - You're receiving this notification because you are a member of the #{@project.name_with_namespace} project team. + %td{align: "center", style: "margin: 0; padding: 0; background: #EAEAEA;"} + %table.header{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background:#333", width: "600"} + %tr + %td{style: "font-size: 0px;", width: "20"} + \  + %td{align: "left", style: "padding: 10px 0", width: "580"} + %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} + %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 + %td{align: "left", colspan: "2", height: "3", style: "padding: font-size: 0; line-height: 0; height: 3px;", width: "600"} + %table.footer{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; line-height: 10px;", width: "600"} + %tr + %td{align: "center", style: "padding: 5px 0 10px; font-size: 11px; color:#7d7a7a; margin: 0; line-height: 1.2;font-family: Helvetica, Arial, sans-serif;", valign: "top"} + %br + %p{style: "font-size: 11px; color:#7d7a7a; margin: 0; padding: 0; font-family: Helvetica, Arial, sans-serif;"} + You're receiving this notification because you are a member of the + - if @project + #{@project.name_with_namespace} + project team. diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml index 535f94c4..7852ed6f 100644 --- a/app/views/layouts/profile.html.haml +++ b/app/views/layouts/profile.html.haml @@ -2,10 +2,21 @@ %html{ lang: "en"} = render "layouts/head", title: "Profile" %body{class: "#{app_theme} profile"} - = render "layouts/head_panel", title: "Profile" = render "layouts/flash" - %nav.main-nav - .container= render 'layouts/nav/profile' - + = render "layouts/head_panel", title: "Profile" .container + %ul.main_menu + = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do + = link_to "Profile", profile_path + = nav_link(path: 'profiles#account') do + = link_to "Account", account_profile_path + = nav_link(controller: :keys) do + = link_to keys_path do + SSH Keys + %span.count= current_user.keys.count + = nav_link(path: 'profiles#design') do + = link_to "Design", design_profile_path + = nav_link(path: 'profiles#history') do + = link_to "History", history_profile_path + .content= yield diff --git a/app/views/layouts/project_resource.html.haml b/app/views/layouts/project_resource.html.haml index 7b0d4789..14671c5c 100644 --- a/app/views/layouts/project_resource.html.haml +++ b/app/views/layouts/project_resource.html.haml @@ -2,13 +2,45 @@ %html{ lang: "en"} = render "layouts/head", title: @project.name_with_namespace %body{class: "#{app_theme} project"} - = render "layouts/head_panel", title: project_title(@project) = render "layouts/flash" + = render "layouts/head_panel", title: project_title(@project) - if can?(current_user, :download_code, @project) = render 'shared/no_ssh' - %nav.main-nav - .container= render 'layouts/nav/project' - + - unless @project.users.include?(current_user) + = render 'shared/not_in_team' .container + %ul.main_menu + = nav_link(html_options: {class: "home #{project_tab_class}"}) do + = link_to @project.path, project_path(@project), title: "Project" + + - 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 || @repository.root_ref) + = nav_link(controller: %w(commit commits compare repositories protected_branches)) do + = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref) + = nav_link(path: 'projects#graph') do + = link_to "Network", graph_project_path(@project) + + - if @project.issues_enabled + = nav_link(controller: %w(issues milestones labels)) do + = link_to project_issues_filter_path(@project) do + Issues + %span.count.issue_counter= @project.issues.opened.count + + - if @project.repo_exists? && @project.merge_requests_enabled + = nav_link(controller: :merge_requests) do + = link_to project_merge_requests_path(@project) do + Merge Requests + %span.count.merge_counter= @project.merge_requests.opened.count + + - if @project.wall_enabled + = nav_link(path: 'projects#wall') do + = link_to 'Wall', wall_project_path(@project) + + - if @project.wiki_enabled + = nav_link(controller: :wikis) do + = link_to 'Wiki', project_wiki_path(@project, :index) + .content= yield diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 435250b6..fa368e9b 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -10,7 +10,7 @@ = link_to root_path, class: "home" do %h1 GITLAB %span.separator - %h1.project_name Public Projects + %h1.project_name Public Projects .container .content .prepend-top-20 diff --git a/app/views/layouts/user_team.html.haml b/app/views/layouts/user_team.html.haml deleted file mode 100644 index f2ead9d2..00000000 --- a/app/views/layouts/user_team.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -!!! 5 -%html{ lang: "en"} - = render "layouts/head", title: "#{@team.name}" - %body{class: "#{app_theme} application"} - = render "layouts/head_panel", title: "team: #{@team.name}" - = render "layouts/flash" - %nav.main-nav - .container= render 'layouts/nav/team' - - .container - .content= yield diff --git a/app/views/merge_requests/_filter.html.haml b/app/views/merge_requests/_filter.html.haml index 4b48306e..86148fbc 100644 --- a/app/views/merge_requests/_filter.html.haml +++ b/app/views/merge_requests/_filter.html.haml @@ -16,5 +16,5 @@ %fieldset %hr - = link_to "Reset", project_merge_requests_path(@project), class: 'btn pull-right' + = 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 6d64988c..9a4f0617 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/merge_requests/_form.html.haml @@ -1,6 +1,6 @@ = form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f| -if @merge_request.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @merge_request.errors.full_messages.each do |msg| %li= msg @@ -13,7 +13,7 @@ .mr_branch_box %h5.cgray From (Head Branch) .body - .padded= f.select(:source_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'}) + .padded= f.select(:source_branch, @repository.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'}) .mr_source_commit .span2 @@ -22,7 +22,7 @@ .mr_branch_box %h5.cgray To (Base Branch) .body - .padded= f.select(:target_branch, @repository.branch_names, { include_blank: "Select branch" }, {class: 'chosen span4'}) + .padded= f.select(:target_branch, @repository.heads.map(&:name), { include_blank: "Select branch" }, {class: 'chosen span4'}) .mr_target_commit %fieldset @@ -51,19 +51,19 @@ .form-actions - if @merge_request.new_record? - = f.submit 'Submit merge request', class: "btn btn-create" + = f.submit 'Submit merge request', class: "btn success" -else - = f.submit 'Save changes', class: "btn btn-save" + = f.submit 'Save changes', class: "save-btn btn" - if @merge_request.new_record? - = link_to project_merge_requests_path(@project), class: "btn btn-cancel" do + = link_to project_merge_requests_path(@project), class: "btn cancel-btn" do Cancel - else - = link_to project_merge_request_path(@project, @merge_request), class: "btn btn-cancel" do + = link_to project_merge_request_path(@project, @merge_request), class: "btn cancel-btn" do Cancel :javascript $(function(){ - disableButtonIfEmptyField("#merge_request_title", ".btn-save"); + disableButtonIfEmptyField("#merge_request_title", ".save-btn"); var source_branch = $("#merge_request_source_branch") , target_branch = $("#merge_request_target_branch"); diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index 09c55d98..7369f3dd 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -1,20 +1,20 @@ %li{ class: mr_css_classes(merge_request) } - .pull-right + .right .left - if merge_request.merged? - %span.btn.btn-small.disabled.grouped + %span.btn.small.disabled.grouped %strong %i.icon-ok = "MERGED" - if merge_request.notes.any? - %span.btn.btn-small.disabled.grouped + %span.btn.small.disabled.grouped %i.icon-comment = merge_request.mr_and_commit_notes.count - if merge_request.milestone_id? - %span.btn.btn-small.disabled.grouped + %span.btn.small.disabled.grouped %i.icon-time = merge_request.milestone.title - %span.btn.btn-small.disabled.grouped + %span.btn.small.disabled.grouped = merge_request.source_branch → = merge_request.target_branch diff --git a/app/views/merge_requests/_show.html.haml b/app/views/merge_requests/_show.html.haml index 08b80172..cefd33c0 100644 --- a/app/views/merge_requests/_show.html.haml +++ b/app/views/merge_requests/_show.html.haml @@ -29,10 +29,10 @@ $(function(){ merge_request = new MergeRequest({ url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}", - check_enable: #{@merge_request.unchecked? ? "true" : "false"}, + check_enable: #{@merge_request.state == MergeRequest::UNCHECKED ? "true" : "false"}, url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}", ci_enable: #{@project.gitlab_ci? ? "true" : "false"}, - current_status: "#{@merge_request.merge_status_name}", + current_state: "#{@merge_request.human_state}", action: "#{controller.action_name}" }); }); diff --git a/app/views/merge_requests/index.html.haml b/app/views/merge_requests/index.html.haml index 3073c8f6..61c32b53 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/merge_requests/index.html.haml @@ -1,5 +1,5 @@ - if can? current_user, :write_merge_request, @project - = link_to new_project_merge_request_path(@project), class: "pull-right btn btn-primary", title: "New Merge Request" do + = 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 @@ -28,8 +28,8 @@ - if @merge_requests.present? %li.bottom .left= paginate @merge_requests, theme: "gitlab" - .pull-right - %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter + .right + %span.cgray.right #{@merge_requests.total_count} merge requests for this filter :javascript $(merge_requestsPage); diff --git a/app/views/merge_requests/invalid.html.haml b/app/views/merge_requests/invalid.html.haml deleted file mode 100644 index a73bef9e..00000000 --- a/app/views/merge_requests/invalid.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.merge-request - = render "merge_requests/show/mr_title" - = render "merge_requests/show/mr_box" - - .alert.alert-error - %h5 - %i.icon-exclamation-sign - We cannot find - %span.label-branch= @merge_request.source_branch - or - %span.label-branch= @merge_request.target_branch - branches in the repository. - %p - Maybe it was removed or never pushed. - %p - Please close Merge Request or change branches with existing one - diff --git a/app/views/merge_requests/show/_mr_accept.html.haml b/app/views/merge_requests/show/_mr_accept.html.haml index ac97f632..128ffe76 100644 --- a/app/views/merge_requests/show/_mr_accept.html.haml +++ b/app/views/merge_requests/show/_mr_accept.html.haml @@ -1,9 +1,9 @@ -- unless @allowed_to_merge - .alert - %strong You don't have enough permissions to merge this MR +- unless can?(current_user, :accept_mr, @project) + .alert-message + %strong Only masters can accept MR -- if @show_merge_controls +- if @merge_request.open? && @commits.any? && can?(current_user, :accept_mr, @project) .automerge_widget.can_be_merged{style: "display:none"} .alert.alert-success %span @@ -29,14 +29,14 @@ %strong This repository does not have satellite. Ask administrator to fix this issue .automerge_widget.cannot_be_merged{style: "display:none"} - .alert.alert-disabled + .alert.alert-info %span - = link_to "Show how to merge", "#", class: "how_to_merge_link btn btn-small padded", title: "How To Merge" + = link_to "Show how to merge", "#", class: "how_to_merge_link btn small padded", title: "How To Merge"   %strong This request can't be merged with GitLab. You should do it manually .automerge_widget.unchecked - .alert + .alert-message %strong %i.icon-refresh Checking for ability to automatically merge… @@ -46,7 +46,5 @@ %strong This merge request already can not be merged. Try to reload page. .merge-in-progress.hide - %span.cgray - %i.icon-refresh.icon-spin -   - Merge is in progress. Please wait. Page will be automatically reloaded.   + %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 3b54f613..644d7fcc 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/merge_requests/show/_mr_box.html.haml @@ -1,11 +1,11 @@ .ui-box.ui-box-show .ui-box-head %h4.box-title - - if @merge_request.merged? + - if @merge_request.merged .error.status_info %i.icon-ok Merged - - elsif @merge_request.closed? + - elsif @merge_request.closed .error.status_info Closed = gfm escape_once(@merge_request.title) @@ -21,14 +21,14 @@ %strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone) - - if @merge_request.closed? + - if @merge_request.closed .ui-box-bottom - %span - Closed by #{link_to_member(@project, @merge_request.closed_event.author)} - %small #{time_ago_in_words(@merge_request.closed_event.created_at)} ago. - - if @merge_request.merged? - .ui-box-bottom - %span - Merged by #{link_to_member(@project, @merge_request.merge_event.author)} - %small #{time_ago_in_words(@merge_request.merge_event.created_at)} ago. + - if @merge_request.merged? + %span + Merged by #{link_to_member(@project, @merge_request.merge_event.author)} + %small #{time_ago_in_words(@merge_request.merge_event.created_at)} ago. + - elsif @merge_request.closed_event + %span + Closed by #{link_to_member(@project, @merge_request.closed_event.author)} + %small #{time_ago_in_words(@merge_request.closed_event.created_at)} ago. diff --git a/app/views/merge_requests/show/_mr_ci.html.haml b/app/views/merge_requests/show/_mr_ci.html.haml index a8faa6ba..d46b606e 100644 --- a/app/views/merge_requests/show/_mr_ci.html.haml +++ b/app/views/merge_requests/show/_mr_ci.html.haml @@ -1,4 +1,4 @@ -- if @merge_request.opened? && @commits.any? +- if @merge_request.open? && @commits.any? .ci_widget.ci-success{style: "display:none"} .alert.alert-success %i.icon-ok @@ -23,7 +23,7 @@ = link_to "Build page", ci_build_details_path(@merge_request) .ci_widget - .alert + .alert-message %strong %i.icon-refresh Checking for CI status for #{@merge_request.last_commit_short_sha} diff --git a/app/views/merge_requests/show/_mr_title.html.haml b/app/views/merge_requests/show/_mr_title.html.haml index 24285c27..c2ffe8e3 100644 --- a/app/views/merge_requests/show/_mr_title.html.haml +++ b/app/views/merge_requests/show/_mr_title.html.haml @@ -1,13 +1,13 @@ %h3.page_title = "Merge Request ##{@merge_request.id}:"   - %span.label-branch= @merge_request.source_branch + %span.label_branch= @merge_request.source_branch → - %span.label-branch= @merge_request.target_branch + %span.label_branch= @merge_request.target_branch - %span.pull-right + %span.right - if can?(current_user, :modify_merge_request, @merge_request) - - if @merge_request.opened? + - if @merge_request.open? .left.btn-group %a.btn.grouped.dropdown-toggle{ data: {toggle: :dropdown} } %i.icon-download-alt @@ -17,13 +17,13 @@ %li= link_to "Email Patches", project_merge_request_path(@project, @merge_request, format: :patch) %li= link_to "Plain Diff", project_merge_request_path(@project, @merge_request, format: :diff) - = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn grouped btn-close", title: "Close merge request" + = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {closed: true }, status_only: true), method: :put, class: "btn grouped danger", title: "Close merge request" = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn grouped" do %i.icon-edit Edit -.pull-right +.right .span3#votes= render 'votes/votes_block', votable: @merge_request .back_link diff --git a/app/views/milestones/_form.html.haml b/app/views/milestones/_form.html.haml index fbaf64a3..1c496a93 100644 --- a/app/views/milestones/_form.html.haml +++ b/app/views/milestones/_form.html.haml @@ -7,7 +7,7 @@ = form_for [@project, @milestone], html: {class: "new_milestone form-horizontal"} do |f| -if @milestone.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @milestone.errors.full_messages.each do |msg| %li= msg @@ -32,16 +32,16 @@ .form-actions - if @milestone.new_record? - = f.submit 'Create milestone', class: "btn-save btn" - = link_to "Cancel", project_milestones_path(@project), class: "btn btn-cancel" + = f.submit 'Create milestone', class: "save-btn btn" + = link_to "Cancel", project_milestones_path(@project), class: "btn cancel-btn" -else - = f.submit 'Save changes', class: "btn-save btn" - = link_to "Cancel", project_milestone_path(@project, @milestone), class: "btn btn-cancel" + = f.submit 'Save changes', class: "save-btn btn" + = link_to "Cancel", project_milestone_path(@project, @milestone), class: "btn cancel-btn" :javascript $(function() { - disableButtonIfEmptyField("#milestone_title", ".btn-save"); + disableButtonIfEmptyField("#milestone_title", ".save-btn"); $( ".datepicker" ).datepicker({ dateFormat: "yy-mm-dd", onSelect: function(dateText, inst) { $("#milestone_due_date").val(dateText) } diff --git a/app/views/milestones/_milestone.html.haml b/app/views/milestones/_milestone.html.haml index 8a3727c6..3864792f 100644 --- a/app/views/milestones/_milestone.html.haml +++ b/app/views/milestones/_milestone.html.haml @@ -1,12 +1,12 @@ -%li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone) } - .pull-right - - if can?(current_user, :admin_milestone, milestone.project) and milestone.active? - = link_to edit_project_milestone_path(milestone.project, milestone), class: "btn btn-small edit-milestone-link grouped" do +%li{class: "milestone milestone-#{milestone.closed ? 'closed' : 'open'}", id: dom_id(milestone) } + .right + - if can?(current_user, :admin_milestone, milestone.project) and milestone.open? + = link_to edit_project_milestone_path(milestone.project, milestone), class: "btn small edit-milestone-link grouped" do %i.icon-edit Edit %h4 = link_to_gfm truncate(milestone.title, length: 100), project_milestone_path(milestone.project, milestone) - - if milestone.expired? and not milestone.closed? + - if milestone.expired? and not milestone.closed %span.cred (Expired) %small = milestone.expires_at diff --git a/app/views/milestones/index.html.haml b/app/views/milestones/index.html.haml index b78f1705..3089595f 100644 --- a/app/views/milestones/index.html.haml +++ b/app/views/milestones/index.html.haml @@ -3,7 +3,7 @@ %h3.page_title Milestones - if can? current_user, :admin_milestone, @project - = link_to "New Milestone", new_project_milestone_path(@project), class: "pull-right btn btn-small", title: "New Milestone" + = link_to "New Milestone", new_project_milestone_path(@project), class: "right btn small", title: "New Milestone" %br %div.ui-box .title diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index e1808a20..fc7ae51f 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -8,14 +8,14 @@ = link_to project_milestones_path(@project) do ← To milestones list .span6 - .pull-right - - unless @milestone.closed? - = link_to new_project_issue_path(@project, issue: { milestone_id: @milestone.id }), class: "btn btn-small grouped", title: "New Issue" do + .right + - unless @milestone.closed + = link_to new_project_issue_path(@project, issue: { milestone_id: @milestone.id }), class: "btn small grouped", title: "New Issue" do %i.icon-plus New Issue = link_to 'Browse Issues', project_issues_path(@milestone.project, milestone_id: @milestone.id), class: "btn edit-milestone-link small grouped" - if can?(current_user, :admin_milestone, @project) - = link_to edit_project_milestone_path(@project, @milestone), class: "btn btn-small grouped" do + = link_to edit_project_milestone_path(@project, @milestone), class: "btn small grouped" do %i.icon-edit Edit @@ -25,12 +25,12 @@ %hr %p %span All issues for this milestone are closed. You may close milestone now. - = link_to 'Close Milestone', project_milestone_path(@project, @milestone, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-remove" + = link_to 'Close Milestone', project_milestone_path(@project, @milestone, milestone: {closed: true }), method: :put, class: "btn small danger" .ui-box.ui-box-show .ui-box-head %h4.box-title - - if @milestone.closed? + - if @milestone.closed .error.status_info Closed - elsif @milestone.expired? .error.status_info Expired @@ -43,7 +43,7 @@ #{@milestone.closed_items_count} closed – #{@milestone.open_items_count} open - %span.pull-right= @milestone.expires_at + %span.right= @milestone.expires_at .progress.progress-info .bar{style: "width: #{@milestone.percent_complete}%;"} @@ -63,7 +63,7 @@ %li=link_to('All Issues', '#') %ul.well-list - @issues.each do |issue| - %li{data: {closed: issue.closed?}} + %li{data: {closed: issue.closed}} = link_to [@project, issue] do %span.badge.badge-info ##{issue.id} – @@ -77,7 +77,7 @@ %li=link_to('All Merge Requests', '#') %ul.well-list - @merge_requests.each do |merge_request| - %li{data: {closed: merge_request.closed? || merge_request.merged?}} + %li{data: {closed: merge_request.closed}} = link_to [@project, merge_request] do %span.badge.badge-info ##{merge_request.id} – @@ -87,7 +87,7 @@ %h6 Participants: %div - @users.each do |user| - = link_to user, class: 'float-link' do + = link_to tm_path(user.tm_of(@project)), class: 'float-link' do = user.avatar_image = user.name diff --git a/app/views/notes/_discussion.html.haml b/app/views/notes/_discussion.html.haml index 24cb4228..a9a11fc2 100644 --- a/app/views/notes/_discussion.html.haml +++ b/app/views/notes/_discussion.html.haml @@ -38,7 +38,7 @@ - if note.for_diff_line? - if note.diff .content - .file= render "notes/discussion_diff", discussion_notes: discussion_notes, note: note + .diff_file= render "notes/discussion_diff", discussion_notes: discussion_notes, note: note - else = link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion' %div.hide.outdated-discussion diff --git a/app/views/notes/_discussion_diff.html.haml b/app/views/notes/_discussion_diff.html.haml index 20bdb3f3..93ab59c7 100644 --- a/app/views/notes/_discussion_diff.html.haml +++ b/app/views/notes/_discussion_diff.html.haml @@ -1,5 +1,5 @@ - diff = note.diff -.header +.diff_file_header - if diff.deleted_file %span= diff.old_path - else @@ -7,9 +7,9 @@ - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" %br/ -.content +.diff_file_content %table - - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old| + - each_diff_line(diff, note.diff_file_index) do |line, type, line_code, line_new, line_old| %tr.line_holder{ id: line_code } - if type == "match" %td.old_line= "..." @@ -22,3 +22,4 @@ - if line_code == note.line_code = render "notes/diff_notes_with_reply", notes: discussion_notes + - break # cut off diff after notes diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml index 7add2921..d094119a 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/notes/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note js-new-note-form common-note-form" } do |f| += form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note js-new-note-form" } do |f| = note_target_fields = f.hidden_field :commit_id @@ -15,23 +15,30 @@ = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input turn-on' .note_preview.js-note-preview.turn-off + .buttons + = f.submit 'Add Comment', class: "btn comment-btn grouped js-comment-button" + %a.btn.grouped.js-close-discussion-note-form Cancel .hint - .pull-right Comments are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + .right Comments are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. .clearfix - .note-form-actions - .buttons - = f.submit 'Add Comment', class: "btn comment-btn grouped js-comment-button" - = yield(:note_actions) + .note_options + .attachment + %h6 Attachment: + .file_name.js-attachment-filename File name... + %a.choose-btn.btn.small.js-choose-note-attachment-button Choose File ... + .hint Any file up to 10 MB - %a.btn.grouped.js-close-discussion-note-form Cancel + = f.file_field :attachment, class: "js-note-attachment-input" - .note-form-option - %a.choose-btn.btn.btn-small.js-choose-note-attachment-button - %i.icon-paper-clip - %span Choose File ... -   - %span.file_name.js-attachment-filename File name... - = f.file_field :attachment, class: "js-note-attachment-input hide" + .notify_options + %h6 Notify via email: + = label_tag :notify do + = check_box_tag :notify, 1, !@note.for_commit? + Project team - .clearfix + .js-notify-commit-author + = label_tag :notify_author do + = check_box_tag :notify_author, 1 , @note.for_commit? + Commit author + .clearfix diff --git a/app/views/notes/_note.html.haml b/app/views/notes/_note.html.haml index b355e2a0..9efeb563 100644 --- a/app/views/notes/_note.html.haml +++ b/app/views/notes/_note.html.haml @@ -30,8 +30,8 @@ - if note.attachment.url - if note.attachment.image? = image_tag note.attachment.url, class: 'note-image-attach' - .attachment.pull-right - = link_to note.attachment.secure_url, target: "_blank" do - %i.icon-paper-clip + .attachment.right + = link_to note.attachment.url, target: "_blank" do + %i.icon-attachment = note.attachment_identifier .clear diff --git a/app/views/notes/_reversed_notes_with_form.html.haml b/app/views/notes/_reversed_notes_with_form.html.haml new file mode 100644 index 00000000..bb583b8c --- /dev/null +++ b/app/views/notes/_reversed_notes_with_form.html.haml @@ -0,0 +1,12 @@ +.js-main-target-form +- if can? current_user, :write_note, @project + = render "notes/form" + +%ul#new-notes-list.reversed.notes +%ul#notes-list.reversed.notes +.notes-busy.js-notes-busy + +:javascript + $(function(){ + NoteList.init("#{@target_id}", "#{@target_type}", "#{project_notes_path(@project)}"); + }); diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml index 43e79c69..c573d406 100644 --- a/app/views/notes/create.js.haml +++ b/app/views/notes/create.js.haml @@ -2,7 +2,10 @@ var noteHtml = "#{escape_javascript(render "notes/note", note: @note)}"; - if note_for_main_target?(@note) - NoteList.appendNewNote(#{@note.id}, noteHtml); + - if @note.for_wall? + NoteList.appendNewWallNote(#{@note.id}, noteHtml); + - else + NoteList.appendNewNote(#{@note.id}, noteHtml); - else :plain var firstDiscussionNoteHtml = "#{escape_javascript(render "notes/diff_notes_with_reply", notes: [@note])}"; @@ -15,4 +18,4 @@ - if note_for_main_target?(@note) NoteList.errorsOnForm(errorsHtml); - else - NoteList.errorsOnForm(errorsHtml, "#{@note.discussion_id}"); + NoteList.errorsOnForm(errorsHtml, "#{@note.discussion_id}"); \ No newline at end of file diff --git a/app/views/notes/index.js.haml b/app/views/notes/index.js.haml index 826862b1..f0826100 100644 --- a/app/views/notes/index.js.haml +++ b/app/views/notes/index.js.haml @@ -1,4 +1,15 @@ - unless @notes.blank? var notesHtml = "#{escape_javascript(render 'notes/notes')}"; - new_note_ids = @notes.map(&:id) - NoteList.setContent(#{new_note_ids}, notesHtml); + - if loading_more_notes? + NoteList.appendMoreNotes(#{new_note_ids}, notesHtml); + + - elsif loading_new_notes? + NoteList.replaceNewNotes(#{new_note_ids}, notesHtml); + + - else + NoteList.setContent(#{new_note_ids}, notesHtml); + +- else + - if loading_more_notes? + NoteList.finishedLoadingMore(); diff --git a/app/views/notifications/show.html.haml b/app/views/notifications/show.html.haml deleted file mode 100644 index d8ab93b8..00000000 --- a/app/views/notifications/show.html.haml +++ /dev/null @@ -1,68 +0,0 @@ -%h3.page_title Setup your notification level - -%br - -%p.light - %strong Disabled - – You will not get any notifications via email -%p.light - %strong Participating - – You will receive only notifications from related resources(ex. from assigned issue or your commit) -%p.light - %strong Watch - – You will receive all notifications from projects in which you participate -%hr - -= form_tag profile_notifications_path, method: :put, remote: true, class: 'update-notifications' do - %ul.well-list - %li - .row - .span4 - %h5 Global - .span7 - = label_tag do - = radio_button_tag :notification_level, Notification::N_DISABLED, @notification.disabled? - %span Disabled - - = label_tag do - = radio_button_tag :notification_level, Notification::N_PARTICIPATING, @notification.participating? - %span Participating - - = label_tag do - = radio_button_tag :notification_level, Notification::N_WATCH, @notification.watch? - %span Watch - - - = link_to '#', class: 'js-toggle-visibility-link' do - %h6.btn.btn-tiny - %i.icon-chevron-down - %span Per project notifications settings - %ul.well-list.js-toggle-visibility-container.hide - - @projects.each do |project| - %li - .row - .span4 - %span - = project.name_with_namespace - .span7 - = label_tag do - = radio_button_tag :"notification_level[#{project.id}]", Notification::N_DISABLED, @notification.disabled?, disabled: true - %span Disabled - - = label_tag do - = radio_button_tag :"notification_level[#{project.id}]", Notification::N_PARTICIPATING, @notification.participating?, disabled: true - %span Participating - - = label_tag do - = radio_button_tag :"notification_level[#{project.id}]", Notification::N_WATCH, @notification.watch?, disabled: true - %span Watch - - - .form-actions - = submit_tag 'Save', class: 'btn btn-save' - %span.update-success.cgreen.hide - %i.icon-ok - Saved - %span.update-failed.cred.hide - %i.icon-remove - Failed diff --git a/app/views/notifications/update.js.haml b/app/views/notifications/update.js.haml deleted file mode 100644 index 4468004a..00000000 --- a/app/views/notifications/update.js.haml +++ /dev/null @@ -1,7 +0,0 @@ -- if @saved - :plain - $('.update-notifications .update-success').showAndHide(); -- else - :plain - $('.update-notifications .update-failed').showAndHide(); - diff --git a/app/views/notify/_note_message.html.haml b/app/views/notify/_note_message.html.haml deleted file mode 100644 index 88c4df55..00000000 --- a/app/views/notify/_note_message.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%p - %strong #{@note.author_name} - left next message: - -%cite{style: 'color: #666'} - = markdown(@note.note) diff --git a/app/views/notify/closed_issue_email.html.haml b/app/views/notify/closed_issue_email.html.haml deleted file mode 100644 index 23ccc453..00000000 --- a/app/views/notify/closed_issue_email.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%p - = "Issue was closed by #{@updated_by.name}" -%p - = "Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title diff --git a/app/views/notify/closed_issue_email.text.haml b/app/views/notify/closed_issue_email.text.haml deleted file mode 100644 index 0cca3215..00000000 --- a/app/views/notify/closed_issue_email.text.haml +++ /dev/null @@ -1,3 +0,0 @@ -= "Issue was closed by #{@updated_by.name}" - -Issue ##{@issue.id}: #{project_issue_url(@issue.project, @issue)} diff --git a/app/views/notify/closed_merge_request_email.html.haml b/app/views/notify/closed_merge_request_email.html.haml deleted file mode 100644 index 0c6c79e0..00000000 --- a/app/views/notify/closed_merge_request_email.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%p - = "Merge Request #{@merge_request.id} was closed by #{@updated_by.name}" -%p - = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.project, @merge_request) -%p - Branches: #{@merge_request.source_branch} → #{@merge_request.target_branch} -%p - Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} - diff --git a/app/views/notify/closed_merge_request_email.text.haml b/app/views/notify/closed_merge_request_email.text.haml deleted file mode 100644 index ee4648e3..00000000 --- a/app/views/notify/closed_merge_request_email.text.haml +++ /dev/null @@ -1,8 +0,0 @@ -= "Merge Request #{@merge_request.id} was closed by #{@updated_by.name}" - -Merge Request url: #{project_merge_request_url(@merge_request.project, @merge_request)} - -Branches: #{@merge_request.source_branch} - #{@merge_request.target_branch} - -Author: #{@merge_request.author_name} -Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/issue_status_changed_email.html.haml b/app/views/notify/issue_status_changed_email.html.haml index 4cdb7099..27168eef 100644 --- a/app/views/notify/issue_status_changed_email.html.haml +++ b/app/views/notify/issue_status_changed_email.html.haml @@ -1,5 +1,16 @@ -%p - = "Issue was #{@issue_status} by #{@updated_by.name}" -%p - = "Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title +%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{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"} + %tr + %td{style: "font-size: 1px; line-height: 1px;", 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}" + = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title + %br + diff --git a/app/views/notify/issue_status_changed_email.text.erb b/app/views/notify/issue_status_changed_email.text.erb deleted file mode 100644 index bbca3474..00000000 --- a/app/views/notify/issue_status_changed_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ -Issue was <%= @issue_status %> by <%= @updated_by.name %> - -Issue <%= @issue.id %>: <%= url_for(project_issue_url(@issue.project, @issue)) %> - diff --git a/app/views/notify/merged_merge_request_email.html.haml b/app/views/notify/merged_merge_request_email.html.haml deleted file mode 100644 index 2b8cc030..00000000 --- a/app/views/notify/merged_merge_request_email.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%p - = "Merge Request #{@merge_request.id} was merged" -%p - = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.project, @merge_request) -%p - Branches: #{@merge_request.source_branch} → #{@merge_request.target_branch} -%p - Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} - diff --git a/app/views/notify/merged_merge_request_email.text.haml b/app/views/notify/merged_merge_request_email.text.haml deleted file mode 100644 index 91c23360..00000000 --- a/app/views/notify/merged_merge_request_email.text.haml +++ /dev/null @@ -1,8 +0,0 @@ -= "Merge Request #{@merge_request.id} was merged" - -Merge Request Url: #{project_merge_request_url(@merge_request.project, @merge_request)} - -Branches: #{@merge_request.source_branch} - #{@merge_request.target_branch} - -Author: #{@merge_request.author_name} -Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml index f11c8506..3cb53513 100644 --- a/app/views/notify/new_issue_email.html.haml +++ b/app/views/notify/new_issue_email.html.haml @@ -1,9 +1,15 @@ -%p - New Issue was created. -%p - = "Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title -%p - Author: #{@issue.author_name} -%p - Assignee: #{@issue.assignee_name} +%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{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{width: "21"} + %tr + %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}" + = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title + %br diff --git a/app/views/notify/new_issue_email.text.erb b/app/views/notify/new_issue_email.text.erb deleted file mode 100644 index 9907ca83..00000000 --- a/app/views/notify/new_issue_email.text.erb +++ /dev/null @@ -1,5 +0,0 @@ -New Issue was created. - -Issue <%= @issue.id %>: <%= url_for(project_issue_url(@issue.project, @issue)) %> -Author: <%= @issue.author_name %> -Asignee: <%= @issue.assignee_name %> diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index 0f1cfff5..990d4d2a 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -1,9 +1,19 @@ -%p - = "New Merge Request !#{@merge_request.id}" -%p - = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.project, @merge_request) -%p - Branches: #{@merge_request.source_branch} → #{@merge_request.target_branch} -%p - Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} +%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 Merge Request !#{@merge_request.id}" + %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} + = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.project, @merge_request) + %td{style: "font-size: 1px; line-height: 1px;", 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; "} + 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; "} + Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} + %td diff --git a/app/views/notify/new_merge_request_email.text.erb b/app/views/notify/new_merge_request_email.text.erb deleted file mode 100644 index 3393d838..00000000 --- a/app/views/notify/new_merge_request_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New Merge Request <%= @merge_request.id %> - -<%= url_for(project_merge_request_url(@merge_request.project, @merge_request)) %> - - -Branches: <%= @merge_request.source_branch %> to <%= @merge_request.target_branch %> -Author: <%= @merge_request.author_name %> -Asignee: <%= @merge_request.assignee_name %> - diff --git a/app/views/notify/new_ssh_key_email.html.haml b/app/views/notify/new_ssh_key_email.html.haml deleted file mode 100644 index 57f4297e..00000000 --- a/app/views/notify/new_ssh_key_email.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%p - Hi #{@user.name}! -%p - A new public key was added to your account: -%p - title: - %code= @key.title -%p - If this key was added in error, you can remove here: - = link_to "SSH Keys", keys_url diff --git a/app/views/notify/new_ssh_key_email.text.erb b/app/views/notify/new_ssh_key_email.text.erb deleted file mode 100644 index 71974eab..00000000 --- a/app/views/notify/new_ssh_key_email.text.erb +++ /dev/null @@ -1,7 +0,0 @@ -Hi <%= @user.name %>! - -A new public key was added to your account: - -title.................. <%= @key.title %> - -If this key was added in error, you can remove here: <%= keys_url %> diff --git a/app/views/notify/new_user_email.html.haml b/app/views/notify/new_user_email.html.haml index 8606dc6a..e8e97355 100644 --- a/app/views/notify/new_user_email.html.haml +++ b/app/views/notify/new_user_email.html.haml @@ -1,16 +1,27 @@ -%p - Hi #{@user['name']}! -%p - - if Gitlab.config.gitlab.signup_enabled - Account has been created successfully. - - else - Administrator created account for you. Now you are a member of company GitLab application. -%p - login.......................................... - %code= @user['email'] -%p - - unless Gitlab.config.gitlab.signup_enabled - password.................................. - %code= @password -%p - = link_to "Click here to login", root_url +%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; "} + Hi #{@user['name']}! + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + - if Gitlab.config.gitlab.signup_enabled + Account has been created successfully. + - else + Administrator created account for you. Now you are a member of company GitLab application. + %td{style: "font-size: 1px; line-height: 1px;", 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: 28px; font-size: 16px;font-family: Helvetica, Arial, sans-serif; "} + login.......................................... + %code= @user['email'] + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 16px;font-family: Helvetica, Arial, sans-serif; "} + - unless Gitlab.config.gitlab.signup_enabled + password.................................. + %code= @password + %p{style: "color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 28px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "} + = link_to "Click here to login", root_url + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + diff --git a/app/views/notify/new_user_email.text.erb b/app/views/notify/new_user_email.text.erb deleted file mode 100644 index 94072d7f..00000000 --- a/app/views/notify/new_user_email.text.erb +++ /dev/null @@ -1,10 +0,0 @@ -Hi <%= @user.name %>! - -Administrator created account for you. Now you are a member of company GitLab application. - -login.................. <%= @user.email %> -<% unless Gitlab.config.gitlab.signup_enabled %> - password............... <%= @password %> -<% end %> - -Click here to login: <%= url_for(root_url) %> diff --git a/app/views/notify/note_commit_email.html.haml b/app/views/notify/note_commit_email.html.haml index 620b258f..e87f9c12 100644 --- a/app/views/notify/note_commit_email.html.haml +++ b/app/views/notify/note_commit_email.html.haml @@ -1,5 +1,23 @@ -%p - = "New comment for Commit #{@commit.short_id}" - = link_to_gfm truncate(@commit.title, length: 16), project_commit_url(@note.project, id: @commit.id, anchor: "note_#{@note.id}") -= render 'note_message' +%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 Commit #{@commit.short_id}" + = link_to_gfm truncate(@commit.title, length: 16), project_commit_url(@note.project, id: @commit.id, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", 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} + 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" } + = markdown(@note.note) + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_commit_email.text.erb b/app/views/notify/note_commit_email.text.erb deleted file mode 100644 index aab8e5cf..00000000 --- a/app/views/notify/note_commit_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New comment for Commit <%= @commit.short_id %> - -<%= url_for(project_commit_url(@note.project, id: @commit.id, anchor: "note_#{@note.id}")) %> - - -Author: <%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/note_issue_email.html.haml b/app/views/notify/note_issue_email.html.haml index ca133126..832f5df4 100644 --- a/app/views/notify/note_issue_email.html.haml +++ b/app/views/notify/note_issue_email.html.haml @@ -1,4 +1,23 @@ -%p - = "New comment for Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, length: 35), project_issue_url(@issue.project, @issue, anchor: "note_#{@note.id}") -= render 'note_message' +%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 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + = "New comment for Issue ##{@issue.id}" + = link_to_gfm truncate(@issue.title, length: 35), project_issue_url(@issue.project, @issue, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", 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} + 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" } + = markdown(@note.note) + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + diff --git a/app/views/notify/note_issue_email.text.erb b/app/views/notify/note_issue_email.text.erb deleted file mode 100644 index a476b286..00000000 --- a/app/views/notify/note_issue_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New comment for Issue <%= @issue.id %> - -<%= url_for(project_issue_url(@issue.project, @issue, anchor: "note_#{@note.id}")) %> - - -Author: <%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml index 4f97867e..3857f2f0 100644 --- a/app/views/notify/note_merge_request_email.html.haml +++ b/app/views/notify/note_merge_request_email.html.haml @@ -1,8 +1,27 @@ -%p - - 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)}" -= render 'note_message' +%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{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{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:10px 20px;border:1px solid #ddd" } + = markdown(@note.note) + %td{width: "21"} + diff --git a/app/views/notify/note_merge_request_email.text.erb b/app/views/notify/note_merge_request_email.text.erb deleted file mode 100644 index 26c73bda..00000000 --- a/app/views/notify/note_merge_request_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New comment for Merge Request <%= @merge_request.id %> - -<%= url_for(project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}")) %> - - -<%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/note_wall_email.html.haml b/app/views/notify/note_wall_email.html.haml index 92200e83..0661c580 100644 --- a/app/views/notify/note_wall_email.html.haml +++ b/app/views/notify/note_wall_email.html.haml @@ -1,5 +1,22 @@ -%p - New message on - = link_to "Project Wall", project_wall_url(@note.project, anchor: "note_#{@note.id}") - -= render 'note_message' +%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 message on + = link_to "Project Wall", wall_project_url(@note.project, anchor: "note_#{@note.id}") + %td{style: "font-size: 1px; line-height: 1px;", 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} + 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" } + = markdown(@note.note) + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/note_wall_email.text.erb b/app/views/notify/note_wall_email.text.erb deleted file mode 100644 index 97910d5e..00000000 --- a/app/views/notify/note_wall_email.text.erb +++ /dev/null @@ -1,9 +0,0 @@ -New message on the project wall <%= @note.project %> - -<%= url_for(project_wall_url(@note.project, anchor: "note_#{@note.id}")) %> - - -<%= @note.author_name %> - -<%= @note.note %> - diff --git a/app/views/notify/project_access_granted_email.html.haml b/app/views/notify/project_access_granted_email.html.haml index b4b44eaf..11117bf0 100644 --- a/app/views/notify/project_access_granted_email.html.haml +++ b/app/views/notify/project_access_granted_email.html.haml @@ -1,5 +1,15 @@ -%p - = "You have been granted #{@users_project.project_access_human} access to project" -%p - = link_to project_url(@project) do - = @project.name_with_namespace +%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{width: "21"} + %td + %h2{style: "color:#646464;" } + = "You have been granted #{@users_project.project_access_human} access to project" + %td{style: "font-size: 1px; line-height: 1px;", width: "21"} + %tr + %td{width: "21"} + %td + %h3 + = link_to project_url(@project) do + = @project.name_with_namespace + %br diff --git a/app/views/notify/project_access_granted_email.text.erb b/app/views/notify/project_access_granted_email.text.erb deleted file mode 100644 index 077c3b8a..00000000 --- a/app/views/notify/project_access_granted_email.text.erb +++ /dev/null @@ -1,4 +0,0 @@ - -You have been granted <%= @users_project.project_access_human %> access to project <%= @project.name_with_namespace %> - -<%= url_for(project_url(@project)) %> diff --git a/app/views/notify/project_was_moved_email.html.haml b/app/views/notify/project_was_moved_email.html.haml index 3e761c43..222bd0fe 100644 --- a/app/views/notify/project_was_moved_email.html.haml +++ b/app/views/notify/project_was_moved_email.html.haml @@ -1,11 +1,25 @@ -%p - = "Project was moved to another location" -%p - The project is now located under - = link_to project_url(@project) do - = @project.name_with_namespace -%p - To update the remote url in your local repository run: -%p{ style: "background:#f5f5f5; padding:10px; border:1px solid #ddd" } - git remote set-url origin #{@project.ssh_url_to_repo} -%br +%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: #555; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} + %tr + %td{width: "21"} + %td + %h2 + = "Project was moved to another location" + %td{width: "21"} + %tr + %td{width: "21"} + %td + %p + The project is now located under + = link_to project_url(@project) do + = @project.name_with_namespace + %p + To update the remote url in your local repository run: + %br + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} + %tr + %td{valign: "top"} + %p{ style: "background:#f5f5f5; padding:10px; border:1px solid #ddd" } + git remote set-url origin #{@project.ssh_url_to_repo} + %br + %td{ width: "21"} diff --git a/app/views/notify/project_was_moved_email.text.erb b/app/views/notify/project_was_moved_email.text.erb deleted file mode 100644 index 9c41073f..00000000 --- a/app/views/notify/project_was_moved_email.text.erb +++ /dev/null @@ -1,8 +0,0 @@ -Project was moved to another location - -The project is now located under -<%= project_url(@project) %> - - -To update the remote url in your local repository run: - git remote set-url origin <%= @project.ssh_url_to_repo %> diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml index 018f20bf..bc2d6f70 100644 --- a/app/views/notify/reassigned_issue_email.html.haml +++ b/app/views/notify/reassigned_issue_email.html.haml @@ -1,9 +1,16 @@ -%p - = "Reassigned Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) -%p - Assignee changed from - %strong #{@previous_assignee.name} - to - %strong #{@issue.assignee_name} +%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 + %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) + %td{style: "font-size: 1px; line-height: 1px;", 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; "} + Assignee changed from #{@previous_assignee.name} to #{@issue.assignee_name} + %td diff --git a/app/views/notify/reassigned_issue_email.text.erb b/app/views/notify/reassigned_issue_email.text.erb deleted file mode 100644 index 49704418..00000000 --- a/app/views/notify/reassigned_issue_email.text.erb +++ /dev/null @@ -1,7 +0,0 @@ -Reassigned Issue <%= @issue.id %> - -<%= url_for(project_issue_url(@issue.project, @issue)) %> - - -Assignee changed from <%= @previous_assignee.name %> to <%= @issue.assignee_name %> - diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml index 9039bc8b..8f7308b3 100644 --- a/app/views/notify/reassigned_merge_request_email.html.haml +++ b/app/views/notify/reassigned_merge_request_email.html.haml @@ -1,8 +1,16 @@ -%p - = "Reassigned Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request) -%p - Assignee changed from - %strong #{@previous_assignee.name} - to - %strong #{@merge_request.assignee_name} +%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; "} + = "Reassigned Merge Request !#{@merge_request.id}" + = link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request) + %td{style: "font-size: 1px; line-height: 1px;", 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; "} + Assignee changed from #{@previous_assignee.name} to #{@merge_request.assignee_name} + %td + diff --git a/app/views/notify/reassigned_merge_request_email.text.erb b/app/views/notify/reassigned_merge_request_email.text.erb deleted file mode 100644 index 1af4ab55..00000000 --- a/app/views/notify/reassigned_merge_request_email.text.erb +++ /dev/null @@ -1,7 +0,0 @@ -Reassigned Merge Request <%= @merge_request.id %> - -<%= url_for(project_merge_request_url(@merge_request.project, @merge_request)) %> - - -Assignee changed from <%= @previous_assignee.name %> to <%= @merge_request.assignee_name %> - diff --git a/app/views/profiles/account.html.haml b/app/views/profiles/account.html.haml index b20d5c7a..ea9bcb64 100644 --- a/app/views/profiles/account.html.haml +++ b/app/views/profiles/account.html.haml @@ -9,10 +9,10 @@ -%fieldset.update-token +%fieldset %legend Private token - %span.cred.pull-right + %span.cred.right keep it secret! .padded = form_for @user, url: reset_private_token_profile_path, method: :put do |f| @@ -24,18 +24,18 @@ %p.cgray - if current_user.private_token = text_field_tag "token", current_user.private_token, class: "xxlarge large_text" - = f.submit 'Reset', confirm: "Are you sure?", class: "btn btn-primary btn-build-token" + = f.submit 'Reset', confirm: "Are you sure?", class: "btn primary btn-build-token" - else %span You don`t have one yet. Click generate to fix it. = f.submit 'Generate', class: "btn success btn-build-token" -%fieldset.update-password +%fieldset %legend Password = form_for @user, url: update_password_profile_path, method: :put do |f| .padded %p.slead After successful password update you will be redirected to login page where you should login with new password -if @user.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @user.errors.full_messages.each do |msg| %li= msg @@ -49,7 +49,7 @@ = f.password_field :password_confirmation, required: true .clearfix .input - = f.submit 'Save password', class: "btn btn-save" + = f.submit 'Save password', class: "btn save-btn" @@ -57,7 +57,7 @@ %fieldset.update-username %legend Username - %small.cred.pull-right + %small.cred.right Changing your username can have unintended side effects! = form_for @user, url: update_username_profile_path, method: :put, remote: true do |f| .padded @@ -76,12 +76,6 @@ %li It will change web url for personal projects. %li It will change the git path to repositories for personal projects. .input - = f.submit 'Save username', class: "btn btn-save" + = f.submit 'Save username', class: "btn save-btn" + -- if Gitlab.config.gitlab.signup_enabled - %fieldset.remove-account - %legend - Remove account - %small.cred.pull-right - Before removing the account you must remove all projects! - = link_to 'Delete account', user_registration_path, confirm: "REMOVE #{current_user.name}? Are you sure?", method: :delete, class: "btn btn-remove delete-key btn-small pull-right" diff --git a/app/views/profiles/design.html.haml b/app/views/profiles/design.html.haml index 77068dab..f4b50677 100644 --- a/app/views/profiles/design.html.haml +++ b/app/views/profiles/design.html.haml @@ -43,15 +43,10 @@ = label_tag do .prev = image_tag "white.png" - = f.radio_button :color_scheme_id, 1 - White + = f.radio_button :dark_scheme, false + White code preview = label_tag do .prev = image_tag "dark.png" - = f.radio_button :color_scheme_id, 2 - Dark - = label_tag do - .prev - = image_tag "solarized_dark.png" - = f.radio_button :color_scheme_id, 3 - Solarized Dark + = f.radio_button :dark_scheme, true + Dark code preview diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 9cab3ba5..687463b6 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -6,7 +6,7 @@ %small = @user.email - .pull-right + .right = link_to destroy_user_session_path, class: "logout", method: :delete do %small %i.icon-signout @@ -15,7 +15,7 @@ = form_for @user, url: profile_path, method: :put, html: { class: "edit_user form-horizontal" } do |f| -if @user.errors.any? - %div.alert.alert-error + %div.alert-message.block-message.error %ul - @user.errors.full_messages.each do |msg| %li= msg @@ -31,22 +31,8 @@ .controls = f.text_field :email, class: "input-xlarge", required: true %span.help-block We also use email for avatar detection. - .control-group - = f.label :skype, class: "control-label" - .controls= f.text_field :skype, class: "input-xlarge" - .control-group - = f.label :linkedin, class: "control-label" - .controls= f.text_field :linkedin, class: "input-xlarge" - .control-group - = f.label :twitter, class: "control-label" - .controls= f.text_field :twitter, class: "input-xlarge" - .control-group - = f.label :bio, class: "control-label" - .controls - = f.text_area :bio, rows: 6, class: "input-xlarge", maxlength: 250 - %span.help-block Tell us about yourself in fewer than 250 characters. - .span5.pull-right + .span5.right %fieldset.tips %legend Tips: %ul @@ -61,23 +47,29 @@ %p You can login through #{@user.provider.titleize}! = link_to "click here to change", account_profile_path - - if current_user.can_create_group? - %li - %p - Need a group for several dependent projects? - = link_to new_group_path, class: "btn btn-tiny" do - Create a group - - if current_user.can_create_team? - %li - %p - Want to share a team between projects? - = link_to new_team_path, class: "btn btn-tiny" do - Create a team + + .row + .span7 + .control-group + = f.label :skype, class: "control-label" + .controls= f.text_field :skype, class: "input-xlarge" + .control-group + = f.label :linkedin, class: "control-label" + .controls= f.text_field :linkedin, class: "input-xlarge" + .control-group + = f.label :twitter, class: "control-label" + .controls= f.text_field :twitter, class: "input-xlarge" + .control-group + = f.label :bio, class: "control-label" + .controls + = f.text_area :bio, rows: 6, class: "input-xlarge", maxlength: 250 + %span.help-block Tell us about yourself in fewer than 250 characters. + .span5.right %fieldset %legend Personal projects: - %small.pull-right - %span= current_user.owned_projects.count + %small.right + %span= current_user.personal_projects.count of %span= current_user.projects_limit .padded @@ -87,10 +79,9 @@ %fieldset %legend SSH public keys: - %span.pull-right - = link_to pluralize(current_user.keys.count, 'key'), keys_path + %strong.right= link_to current_user.keys.count, keys_path .padded - = link_to "Add Public Key", new_key_path, class: "btn btn-small" + = link_to "Add Public Key", new_key_path, class: "btn small" .form-actions - = f.submit 'Save', class: "btn btn-save" + = f.submit 'Save', class: "btn save-btn" diff --git a/app/views/projects/_clone_panel.html.haml b/app/views/projects/_clone_panel.html.haml index 9a2be429..2962ad98 100644 --- a/app/views/projects/_clone_panel.html.haml +++ b/app/views/projects/_clone_panel.html.haml @@ -2,8 +2,8 @@ .row .span7 .form-horizontal= render "shared/clone_panel" - .span4.pull-right - .pull-right + .span4.right + .right - unless @project.empty_repo? - if can? current_user, :download_code, @project = link_to archive_project_repository_path(@project), class: "btn-small btn grouped" do @@ -13,5 +13,5 @@ = link_to new_project_merge_request_path(@project), title: "New Merge Request", class: "btn-small btn grouped" do Merge Request - if @project.issues_enabled && can?(current_user, :write_issue, @project) - = link_to url_for_new_issue, title: "New Issue", class: "btn-small btn grouped" do + = link_to new_project_issue_path(@project), title: "New Issue", class: "btn-small btn grouped" do Issue diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 4d51e10d..b582adc9 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -1,140 +1,85 @@ -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li.active - = link_to 'Settings', '#tab-settings', 'data-toggle' => 'tab' - %li - = link_to 'Transfer', '#tab-transfer', 'data-toggle' => 'tab' - %li - = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - - .span9 - .tab-content - .tab-pane.active#tab-settings - .ui-box.white - %h5.title Settings: - .form-holder - = form_for(@project, remote: true) do |f| - - if @project.errors.any? - .alert.alert-error - %ul - - @project.errors.full_messages.each do |msg| - %li= msg - - %fieldset - .clearfix.project_name_holder - = f.label :name do - Project name is - .input - = f.text_field :name, placeholder: "Example Project", class: "span5" += form_for(@project, remote: true) do |f| + - if @project.errors.any? + .alert-message.block-message.error + %ul + - @project.errors.full_messages.each do |msg| + %li= msg + .clearfix.project_name_holder + = f.label :name do + Project name is + .input + = f.text_field :name, placeholder: "Example Project", class: "xxlarge" + - unless @repository.heads.empty? + .clearfix + = f.label :default_branch, "Default Branch" + .input= f.select(:default_branch, @repository.heads.map(&:name), {}, style: "width:210px;") - .clearfix - = f.label :description do - Project description - %span.light (optional) - .input - = f.text_area :description, placeholder: "awesome project", class: "span5", rows: 3, maxlength: 250 + %fieldset.features + %legend Features: - - unless @project.empty_repo? - .clearfix - = f.label :default_branch, "Default Branch" - .input= f.select(:default_branch, @repository.branch_names, {}) + .control-group + = f.label :issues_enabled, "Issues", class: 'control-label' + .controls + = f.check_box :issues_enabled + %span.descr Lightweight issue tracking system for this project + + .control-group + = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label' + .controls + = f.check_box :merge_requests_enabled + %span.descr Submit changes to be merged upstream. + + .control-group + = f.label :wall_enabled, "Wall", class: 'control-label' + .controls + = f.check_box :wall_enabled + %span.descr Simple chat system for broadcasting inside project + + .control-group + = f.label :wiki_enabled, "Wiki", class: 'control-label' + .controls + = f.check_box :wiki_enabled + %span.descr Pages for project documentation + + - if can? current_user, :change_public_mode, @project + %fieldset.features + %legend + %i.icon-share + Public mode: + .control-group + = f.label :public, class: 'control-label' do + %span Public clone access + .controls + = f.check_box :public + %span.descr + If checked, this project can be cloned + %em without any + authentification. + It will also be listed on the #{link_to "public access directory", public_root_path}. - - if can?(current_user, :change_public_mode, @project) - %fieldset.public-mode - %legend - Public mode: - .control-group - = f.label :public, class: 'control-label' do - %span Public clone access - .controls - = f.check_box :public - %span.descr - If checked, this project can be cloned - %em without any - authentication. - It will also be listed on the #{link_to "public access directory", public_root_path}. - - %fieldset.features - %legend - Features: - .control-group - = f.label :issues_enabled, "Issues", class: 'control-label' - .controls - = f.check_box :issues_enabled - %span.descr Lightweight issue tracking system for this project - - - if Project.issues_tracker.values.count > 1 - .control-group - = f.label :issues_tracker, "Issues tracker", class: 'control-label' - .input= f.select(:issues_tracker, Project.issues_tracker.values, {}, { disabled: !@project.issues_enabled }) - - .clearfix - = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label' - .input= f.text_field :issues_tracker_id, disabled: !@project.can_have_issues_tracker_id? - - .control-group - = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label' - .controls - = f.check_box :merge_requests_enabled - %span.descr Submit changes to be merged upstream. - - .control-group - = f.label :wiki_enabled, "Wiki", class: 'control-label' - .controls - = f.check_box :wiki_enabled - %span.descr Pages for project documentation - - .control-group - = f.label :wall_enabled, "Wall", class: 'control-label' - .controls - = f.check_box :wall_enabled - %span.descr Simple chat system for broadcasting inside project - - .control-group - = f.label :snippets_enabled, "Snippets", class: 'control-label' - .controls - = f.check_box :snippets_enabled - %span.descr Share code pastes with others out of git repository + - if can? current_user, :change_namespace, @project + %fieldset.features + %legend Transfer: + .control-group + = f.label :namespace_id do + %span Namespace + .controls + = f.select :namespace_id, namespaces_options(@project.namespace_id || Namespace::global_id), {prompt: 'Choose a project namespace'}, {class: 'chosen'} + %br + %ul.prepend-top-10.cred + %li Be careful. Changing project namespace can have unintended side effects + %li You can transfer project only to namespaces you can manage + %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Save', class: "btn btn-save" + %br - .tab-pane#tab-transfer - - if can?(current_user, :change_namespace, @project) - .ui-box.ui-box-danger - %h5.title Transfer project - .errors-holder - .form-holder - = form_for(@project, url: transfer_project_path(@project), remote: true, html: { class: 'transfer-project' }) do |f| - .control-group - = f.label :namespace_id do - %span Namespace - .controls - .clearfix - = f.select :namespace_id, namespaces_options(@project.namespace_id || Namespace::global_id), {prompt: 'Choose a project namespace'}, {class: 'chosen'} - %ul - %li Be careful. Changing project namespace can have unintended side effects - %li You can transfer project only to namespaces you can manage - %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Transfer', class: "btn btn-remove" - - else - %p.nothing_here_message Only project owner can transfer a project - - .tab-pane#tab-remove - - if can?(current_user, :remove_project, @project) - .ui-box.ui-box-danger - %h5.title Remove project - .ui-box-body - %p - Remove of project will cause removing repository and all related resources like issues, merge requests etc. - %p - %strong Removed project can not be restored! - - = link_to 'Remove project', @project, confirm: 'Removed project can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small" - - else - %p.nothing_here_message Only project owner can remove a project + .actions + = f.submit 'Save', class: "btn save-btn" + = link_to 'Cancel', @project, class: "btn" + - unless @project.new_record? + - if can?(current_user, :remove_project, @project) + .right + = link_to 'Remove Project', @project, confirm: 'Removed project can not be restored! Are you sure?', method: :delete, class: "btn danger" diff --git a/app/views/projects/_new_form.html.haml b/app/views/projects/_new_form.html.haml index b6503636..131a4de4 100644 --- a/app/views/projects/_new_form.html.haml +++ b/app/views/projects/_new_form.html.haml @@ -1,13 +1,13 @@ = form_for(@project, remote: true) do |f| - if @project.errors.any? - .alert.alert-error + .alert-message.block-message.error %span= @project.errors.full_messages.first .clearfix.project_name_holder = f.label :name do Project name is .input = f.text_field :name, placeholder: "Example Project", class: "xxlarge" - = f.submit 'Create project', class: "btn btn-create project-submit" + = f.submit 'Create project', class: "btn success project-submit" - if current_user.can_select_namespace? .clearfix @@ -15,34 +15,6 @@ %span Namespace .input = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'chosen'} - - - .clearfix - .input - = link_to "#", class: 'appear-link' do - %i.icon-upload-alt - %span Import existing repository? - .clearfix.appear-data - = f.label :import_url do - %span Import existing repo - .input - = f.text_field :import_url, class: 'xlarge', placeholder: 'https://github.com/randx/six.git' - .light - URL must be clonable - - %p.padded - New projects are private by default. You choose who can see the project and commit to repository. %hr - - - if current_user.can_create_group? - .clearfix - .input.light - Need a group for several dependent projects? - = link_to new_group_path, class: "btn btn-tiny" do - Create a group - - if current_user.can_create_team? - .clearfix - .input.light - Want to share a project between team? - = link_to new_team_path, class: "btn btn-tiny" do - Create a team + %p.padded + All created project are private. You choose who can see project and commit to repository. diff --git a/app/views/projects/_project_head.html.haml b/app/views/projects/_project_head.html.haml new file mode 100644 index 00000000..94052650 --- /dev/null +++ b/app/views/projects/_project_head.html.haml @@ -0,0 +1,31 @@ +%ul.nav.nav-tabs + = nav_link(path: 'projects#show') do + = link_to project_path(@project), class: "activities-tab tab" do + %i.icon-home + Show + = nav_link(controller: :team_members) do + = link_to project_team_index_path(@project), class: "team-tab tab" do + %i.icon-user + Team + = nav_link(path: 'projects#files') do + = link_to 'Attachments', files_project_path(@project), class: "files-tab tab" + = nav_link(controller: :snippets) do + = link_to 'Snippets', project_snippets_path(@project), class: "snippets-tab tab" + + - if can? current_user, :admin_project, @project + = nav_link(controller: :deploy_keys, html_options: {class: 'right'}) do + = link_to project_deploy_keys_path(@project) do + %span + Deploy Keys + = nav_link(controller: :hooks, html_options: {class: 'right'}) do + = link_to project_hooks_path(@project) do + %span + Hooks + = nav_link(controller: :services, html_options: {class: 'right'}) do + = link_to project_services_path(@project) do + %span + Services + = nav_link(path: 'projects#edit', html_options: {class: 'right'}) do + = link_to edit_project_path(@project), class: "stat-tab tab " do + %i.icon-edit + Edit diff --git a/app/views/projects/_settings_nav.html.haml b/app/views/projects/_settings_nav.html.haml deleted file mode 100644 index acaa03f9..00000000 --- a/app/views/projects/_settings_nav.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -%ul.nav.nav-tabs - = nav_link(path: 'projects#edit') do - = link_to edit_project_path(@project), class: "stat-tab tab " do - %i.icon-edit - Edit - = nav_link(controller: [:team_members, :teams]) do - = link_to project_team_index_path(@project), class: "team-tab tab" do - %i.icon-user - Team - = nav_link(controller: :deploy_keys) do - = link_to project_deploy_keys_path(@project) do - %span - Deploy Keys - = nav_link(controller: :hooks) do - = link_to project_hooks_path(@project) do - %span - Hooks - = nav_link(controller: :services) do - = link_to project_services_path(@project) do - %span - Services diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 394522bf..fdd537da 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -1,5 +1,4 @@ -= render "projects/settings_nav" - += render "project_head" .project_edit_holder %h3.page_title Edit Project %hr diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index b1795b30..52dff687 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -4,14 +4,14 @@ %fieldset %legend Git global setup: %pre.dark - :preserve + = preserve do git config --global user.name "#{current_user.name}" git config --global user.email "#{current_user.email}" %fieldset %legend Create Repository %pre.dark - :preserve + = preserve do mkdir #{@project.path} cd #{@project.path} git init @@ -24,11 +24,11 @@ %fieldset %legend Existing Git Repo? %pre.dark - :preserve + = preserve do cd existing_git_repo git remote add origin #{@project.url_to_repo} git push -u origin master - if can? current_user, :remove_project, @project .prepend-top-20 - = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn btn-remove pull-right" + = link_to 'Remove project', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger right" diff --git a/app/views/projects/files.html.haml b/app/views/projects/files.html.haml new file mode 100644 index 00000000..d1083083 --- /dev/null +++ b/app/views/projects/files.html.haml @@ -0,0 +1,22 @@ += render "project_head" +- unless @notes.empty? + %table + %thead + %tr + %th File name + %th + + - @notes.each do |note| + %tr + %td + %a{href: note.attachment.url} + = image_tag gravatar_icon(note.author_email), class: "avatar s24" + = note.attachment_identifier + %td + Added + = time_ago_in_words(note.created_at) + ago +- else + %p.slead All files attached to project wall, issues etc will be displayed here + + diff --git a/app/views/graph/show.html.haml b/app/views/projects/graph.html.haml similarity index 50% rename from app/views/graph/show.html.haml rename to app/views/projects/graph.html.haml index e45aca1d..4e0b0e36 100644 --- a/app/views/graph/show.html.haml +++ b/app/views/projects/graph.html.haml @@ -1,4 +1,5 @@ -= render "head" +%h3.page_title Project Network Graph +%br .graph_holder %h4 %small You can move around the graph by using the arrow keys. @@ -9,9 +10,7 @@ var branch_graph; $(function(){ branch_graph = new BranchGraph($("#holder"), { - url: '#{project_graph_path(@project, @ref, q: @q, format: :json)}', - commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}', - ref: '#{@ref}', - commit_id: '#{@commit.id}' + url: '#{url_for controller: 'projects', action: 'graph', format: :json}', + commit_url: '#{url_for controller: 'projects', action: 'show'}/commits/%s' }); }); diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 824d4daf..2c4f55eb 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -1,32 +1,8 @@ += render "project_head" = render 'clone_panel' = render "events/event_last_push", event: @last_push +.content_list= render @events +.loading.hide -.row - .span9 - .content_list= render @events - .loading.hide - .span3 - .ui-box.white - .padded - %h3.page_title - = @project.name - - if @project.description.present? - %p.light= @project.description - - %hr - %p - Access level: - - if @project.public - %span.cblue - %i.icon-share - Public - - else - %span.cgreen - %i.icon-lock - Private - - %p Repo Size: #{@project.repository.size} MB - %p Created at: #{@project.created_at.stamp('Aug 22, 2013')} - %p Owner: #{link_to @project.owner_name, @project.owner} :javascript $(function(){ Pager.init(20); }); diff --git a/app/views/projects/teams/available.html.haml b/app/views/projects/teams/available.html.haml deleted file mode 100644 index 29fe8ed2..00000000 --- a/app/views/projects/teams/available.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -= render "projects/settings_nav" - -%h3.page_title - = "Assign project to team of users" -%hr -%p.slead - Read more about assign to team of users #{link_to "here", '#', class: 'vlink'}. -= form_tag assign_project_teams_path(@project), method: 'post' do - %p.slead Choose Team of users you want to assign: - .padded - = label_tag :team_id, "Team" - .input= select_tag(:team_id, options_from_collection_for_select(@teams, :id, :name), prompt: "Select team", class: "chosen xxlarge", required: true) - %p.slead Choose greatest user acces in team you want to assign: - .padded - = label_tag :team_ids, "Permission" - .input= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen span3" } - - - .actions - = submit_tag 'Assign', class: "btn btn-create" - = link_to "Cancel", project_team_index_path(@project), class: "btn btn-cancel" - diff --git a/app/views/projects/transfer.js.haml b/app/views/projects/transfer.js.haml deleted file mode 100644 index 10b0de98..00000000 --- a/app/views/projects/transfer.js.haml +++ /dev/null @@ -1,7 +0,0 @@ -- if @project.errors[:namespace_id].present? - :plain - $("#tab-transfer .errors-holder").replaceWith(errorMessage('#{escape_javascript(@project.errors[:namespace_id].first)}')); - $("#tab-transfer .form-actions input").removeAttr('disabled').removeClass('disabled'); -- else - :plain - location.href = "#{edit_project_path(@project)}"; diff --git a/app/views/projects/update_failed.js.haml b/app/views/projects/update_failed.js.haml new file mode 100644 index 00000000..a3ac5f40 --- /dev/null +++ b/app/views/projects/update_failed.js.haml @@ -0,0 +1,2 @@ +:plain + $(".save-project-loader").replaceWith(errorMessage('#{escape_javascript(@error.message)}')); diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml new file mode 100644 index 00000000..82b565de --- /dev/null +++ b/app/views/projects/wall.html.haml @@ -0,0 +1,2 @@ +%div.wall_page + = render "notes/reversed_notes_with_form" diff --git a/app/views/protected_branches/index.html.haml b/app/views/protected_branches/index.html.haml index 15644de5..c1ecceda 100644 --- a/app/views/protected_branches/index.html.haml +++ b/app/views/protected_branches/index.html.haml @@ -14,7 +14,7 @@ - if can? current_user, :admin_project, @project = form_for [@project, @protected_branch] do |f| -if @protected_branch.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @protected_branch.errors.full_messages.each do |msg| %li= msg @@ -24,7 +24,7 @@ .span3 = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "chosen span3"})   - = f.submit 'Protect', class: "btn-primary btn" + = f.submit 'Protect', class: "primary btn" - unless @branches.empty? %table @@ -51,4 +51,4 @@ (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: "btn btn-remove btn-small" + = link_to 'Unprotect', [@project, branch], confirm: 'Are you sure?', method: :delete, class: "danger btn small" diff --git a/app/views/public/projects/index.html.haml b/app/views/public/projects/index.html.haml index b50484f6..afdd4c5f 100644 --- a/app/views/public/projects/index.html.haml +++ b/app/views/public/projects/index.html.haml @@ -1,20 +1,16 @@ %h3.page_title - Projects (#{@projects.total_count}) + Projects %small with read-only access %hr -.public-projects - %ul.unstyled - - @projects.each do |project| - %li.clearfix - %h5 - %i.icon-share - = project.name_with_namespace - .pull-right - %pre.dark.tiny git clone #{project.http_url_to_repo} - %p.description - = project.description - - unless @projects.present? - %h3.nothing_here_message No public projects +%ul.unstyled + - @projects.each do |project| + %li.clearfix + %h5 + %i.icon-share + = project.name_with_namespace + .right + %pre.dark.tiny git clone #{project.http_url_to_repo} - = paginate @projects, theme: "admin" + += paginate @projects, theme: "admin" diff --git a/app/views/repositories/_branch.html.haml b/app/views/repositories/_branch.html.haml index dd91e14b..a6faa5fd 100644 --- a/app/views/repositories/_branch.html.haml +++ b/app/views/repositories/_branch.html.haml @@ -1,4 +1,5 @@ -- commit = Commit.new(Gitlab::Git::Commit.new(branch.commit)) +- commit = Commit.new(branch.commit) +- commit = CommitDecorator.decorate(commit) %tr %td = link_to project_commits_path(@project, branch.name) do diff --git a/app/views/repositories/_feed.html.haml b/app/views/repositories/_feed.html.haml index 6bb75265..44380133 100644 --- a/app/views/repositories/_feed.html.haml +++ b/app/views/repositories/_feed.html.haml @@ -1,4 +1,5 @@ - commit = update +- commit = CommitDecorator.new(commit) %tr %td = link_to project_commits_path(@project, commit.head.name) do @@ -14,6 +15,6 @@ = image_tag gravatar_icon(commit.author_email), class: "", width: 16 = gfm escape_once(truncate(commit.title, length: 40)) %td - %span.pull-right.cgray + %span.right.cgray = time_ago_in_words(commit.committed_date) ago diff --git a/app/views/repositories/_head.html.haml b/app/views/repositories/_head.html.haml new file mode 100644 index 00000000..bc96f306 --- /dev/null +++ b/app/views/repositories/_head.html.haml @@ -0,0 +1 @@ += render "projects/project_head" diff --git a/app/views/repositories/stats.html.haml b/app/views/repositories/stats.html.haml index dde35ea3..bdf047f1 100644 --- a/app/views/repositories/stats.html.haml +++ b/app/views/repositories/stats.html.haml @@ -23,7 +23,7 @@ = image_tag gravatar_icon(author.email, 16), class: 'avatar s16' = author.name %small.light= author.email - .pull-right + .right = author.commits diff --git a/app/views/repositories/tags.html.haml b/app/views/repositories/tags.html.haml index 2d311124..d4b8bbe1 100644 --- a/app/views/repositories/tags.html.haml +++ b/app/views/repositories/tags.html.haml @@ -7,7 +7,8 @@ %th Last commit %th - @tags.each do |tag| - - commit = Commit.new(Gitlab::Git::Commit.new(tag.commit)) + - commit = Commit.new(tag.commit) + - commit = CommitDecorator.decorate(commit) %tr %td %strong diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml deleted file mode 100644 index a523fa25..00000000 --- a/app/views/search/_filter.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%fieldset - %legend Groups: - .clearfix - = select_tag 'group_id', options_from_collection_for_select(current_user.authorized_groups, :id, :name, params[:group_id]), prompt: 'All', include_blank: true, class: 'trigger-submit chosen' - - -%fieldset - %legend Teams: - .clearfix - = select_tag 'team_id', options_from_collection_for_select(current_user.authorized_teams, :id, :name, params[:team_id]), prompt: 'All', include_blank: true, class: 'trigger-submit chosen' - -%fieldset - %legend Projects: - .clearfix - = select_tag 'project_id', options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace, params[:project_id]), prompt: 'All', include_blank: true, class: 'trigger-submit chosen' - diff --git a/app/views/search/_result.html.haml b/app/views/search/_result.html.haml index bfa46075..79bed4f7 100644 --- a/app/views/search/_result.html.haml +++ b/app/views/search/_result.html.haml @@ -1,38 +1,83 @@ -%fieldset - %legend - Search results - %span.cgray (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count}) +%br +%h3.page_title + Search results + %span.cgray (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count}) +%hr .search_results - %ul.well-list - - @projects.each do |project| - %li - project: - = link_to project do - %strong.term= project.name_with_namespace - - @merge_requests.each do |merge_request| - %li - merge request: - = link_to [merge_request.project, merge_request] do - %span ##{merge_request.id} - %strong.term - = truncate merge_request.title, length: 50 - %span.light (#{merge_request.project.name_with_namespace}) - - @issues.each do |issue| - %li - issue: - = link_to [issue.project, issue] do - %span ##{issue.id} - %strong.term - = truncate issue.title, length: 50 - %span.light (#{issue.project.name_with_namespace}) - - @wiki_pages.each do |wiki_page| - %li - wiki: - = link_to project_wiki_path(wiki_page.project, wiki_page) do - %strong.term - = truncate wiki_page.title, length: 50 - %span.light (#{wiki_page.project.name_with_namespace}) - + .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 5914c22d..aa0d6d70 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,15 +1,9 @@ = form_tag search_path, method: :get, class: 'form-inline' do |f| - .search-holder + .padded = label_tag :search do - %span Looking for + %strong Looking for .input = search_field_tag :search, params[:search], placeholder: "issue 143", class: "input-xxlarge search-text-input", id: "dashboard_search" - = submit_tag 'Search', class: "btn btn-primary wide" - .clearfix - .row - .span3 - = render 'filter', f: f - .span9 - .results - - if params[:search].present? - = render 'search/result' + = submit_tag 'Search', class: "btn primary wide" +- if params[:search].present? + = render 'search/result' diff --git a/app/views/services/_gitlab_ci.html.haml b/app/views/services/_gitlab_ci.html.haml index dfde6438..649c5cc4 100644 --- a/app/views/services/_gitlab_ci.html.haml +++ b/app/views/services/_gitlab_ci.html.haml @@ -1,7 +1,7 @@ %h3.page_title GitLab CI %small Continuous integration server from GitLab - .pull-right + .right - if @service.active %small.cgreen Enabled - else @@ -16,7 +16,7 @@ %hr = form_for(@service, :as => :service, :url => project_service_path(@project, :gitlab_ci), :method => :put) do |f| - if @service.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @service.errors.full_messages.each do |msg| %li= msg @@ -40,7 +40,7 @@ .form-actions - = f.submit 'Save', class: 'btn btn-save' + = f.submit 'Save', class: 'btn save-btn'   - if @service.valid? && @service.active = link_to 'Test settings', test_project_service_path(@project), class: 'btn btn-small' diff --git a/app/views/services/edit.html.haml b/app/views/services/edit.html.haml index 0c63a7ed..d893847f 100644 --- a/app/views/services/edit.html.haml +++ b/app/views/services/edit.html.haml @@ -1,3 +1,2 @@ -= render "projects/settings_nav" - += render "projects/project_head" = render 'gitlab_ci' diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml index eb2f8d0c..2c94f965 100644 --- a/app/views/services/index.html.haml +++ b/app/views/services/index.html.haml @@ -1,5 +1,4 @@ -= render "projects/settings_nav" - += render "projects/project_head" %h3.page_title Services %br @@ -9,7 +8,7 @@ = link_to edit_project_service_path(@project, :gitlab_ci) do GitLab CI %small Continuous integration server from GitLab - .pull-right + .right - if @gitlab_ci_service.try(:active) %small.cgreen %i.icon-ok @@ -22,11 +21,11 @@ %h4 Jenkins CI %small An extendable open source continuous integration server - .pull-right + .right %small Not implemented yet %li.disabled %h4 Campfire %small Web-based group chat tool - .pull-right + .right %small Not implemented yet diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml index bd9ca729..7b5de4a6 100644 --- a/app/views/shared/_clone_panel.html.haml +++ b/app/views/shared/_clone_panel.html.haml @@ -1,4 +1,5 @@ .input-prepend.project_clone_holder %button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase - = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge", readonly: true + + = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge" diff --git a/app/views/shared/_not_in_team.html.haml b/app/views/shared/_not_in_team.html.haml new file mode 100644 index 00000000..0d003bde --- /dev/null +++ b/app/views/shared/_not_in_team.html.haml @@ -0,0 +1,2 @@ +%p.error_message.centered + You won't be able to use git over ssh until you join project on #{link_to 'team page', project_team_index_path(@project)} diff --git a/app/views/snippets/_blob.html.haml b/app/views/snippets/_blob.html.haml index 017a33b3..ed518300 100644 --- a/app/views/snippets/_blob.html.haml +++ b/app/views/snippets/_blob.html.haml @@ -3,7 +3,7 @@ %i.icon-file %strong= @snippet.file_name %span.options - = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank" + = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn very_small", target: "_blank" .file_content.code - unless @snippet.content.empty? %div{class: user_color_scheme_class} diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml index 77162cdc..baef737b 100644 --- a/app/views/snippets/_form.html.haml +++ b/app/views/snippets/_form.html.haml @@ -4,7 +4,7 @@ .snippet-form-holder = form_for [@project, @snippet] do |f| -if @snippet.errors.any? - .alert.alert-error + .alert-message.block-message.error %ul - @snippet.errors.full_messages.each do |msg| %li= msg @@ -27,10 +27,10 @@ = f.hidden_field :content, class: 'snippet-file-content' .form-actions - = f.submit 'Save', class: "btn-save btn" + = f.submit 'Save', class: "save-btn btn" = link_to "Cancel", project_snippets_path(@project), class: " btn" - unless @snippet.new_record? - .pull-right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn pull-right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}" + .right= link_to 'Destroy', [@project, @snippet], confirm: 'Are you sure?', method: :delete, class: "btn right danger delete-snippet", id: "destroy_snippet_#{@snippet.id}" :javascript diff --git a/app/views/snippets/edit.html.haml b/app/views/snippets/edit.html.haml index f81c0b8b..8afaf46e 100644 --- a/app/views/snippets/edit.html.haml +++ b/app/views/snippets/edit.html.haml @@ -1 +1,2 @@ += render "projects/project_head" = render "snippets/form" diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index bacf23d8..7b8f94de 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -1,9 +1,11 @@ += render "projects/project_head" + %h3.page_title Snippets %small share code pastes with others out of git repository - if can? current_user, :write_snippet, @project - = link_to new_project_snippet_path(@project), class: "btn btn-small add_new pull-right", title: "New Snippet" do + = link_to new_project_snippet_path(@project), class: "btn small add_new right", title: "New Snippet" do Add new snippet %br %table diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml index f81c0b8b..8afaf46e 100644 --- a/app/views/snippets/new.html.haml +++ b/app/views/snippets/new.html.haml @@ -1 +1,2 @@ += render "projects/project_head" = render "snippets/form" diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index 12534edf..02022185 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -1,8 +1,10 @@ += render "projects/project_head" + %h3.page_title = @snippet.title %small= @snippet.file_name - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user - = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small pull-right", title: 'Edit Snippet' + = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn small right" %br %div= render 'blob' diff --git a/app/views/team_members/_assigned_team.html.haml b/app/views/team_members/_assigned_team.html.haml deleted file mode 100644 index 51a31a64..00000000 --- a/app/views/team_members/_assigned_team.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%li{id: dom_id(team), class: "user_team_row team_#{team.id}"} - .pull-right - - if can?(current_user, :admin_team_member, @project) - = link_to resign_project_team_path(@project, team), method: :delete, confirm: "Are you sure?", class: "btn btn-remove btn-tiny" do - %i.icon-minus.icon-white - - %strong= link_to team.name, team_path(team), title: team.name, class: "dark" - %br - %small.cgray Members: #{team.members.count} - %small.cgray Max access: #{team_relation.human_max_access} diff --git a/app/views/team_members/_assigned_teams.html.haml b/app/views/team_members/_assigned_teams.html.haml deleted file mode 100644 index 91c6d8f7..00000000 --- a/app/views/team_members/_assigned_teams.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -.ui-box - %ul.well-list - - assigned_teams.sort_by(&:team_name).each do |team_relation| - = render "team_members/assigned_team", team_relation: team_relation, team: team_relation.user_team diff --git a/app/views/team_members/_form.html.haml b/app/views/team_members/_form.html.haml index 4e8f6770..a963e462 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/team_members/_form.html.haml @@ -1,24 +1,23 @@ %h3.page_title = "New Team member(s)" %hr -= form_for @user_project_relation, as: :team_member, url: project_team_members_path(@project) do |f| - -if @user_project_relation.errors.any? - .alert.alert-error += form_for @team_member, as: :team_member, url: project_team_members_path(@project, @team_member) do |f| + -if @team_member.errors.any? + .alert-message.block-message.error %ul - - @user_project_relation.errors.full_messages.each do |msg| + - @team_member.errors.full_messages.each do |msg| %li= msg %h6 1. Choose people you want in the team .clearfix = f.label :user_ids, "People" - .input - = users_select_tag(:user_ids, 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 = f.label :project_access, "Project Access" - .input= select_tag :project_access, options_for_select(Project.access_options, @user_project_relation.project_access), class: "project-access-select chosen" + .input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen" .actions - = f.submit 'Add users', class: "btn btn-create" - = link_to "Cancel", project_team_index_path(@project), class: "btn btn-cancel" + = f.submit 'Save', class: "btn save-btn" + = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" diff --git a/app/views/team_members/_show.html.haml b/app/views/team_members/_show.html.haml new file mode 100644 index 00000000..8082f47f --- /dev/null +++ b/app/views/team_members/_show.html.haml @@ -0,0 +1,28 @@ +- user = member.user +- allow_admin = can? current_user, :admin_project, @project +%li{id: dom_id(member), class: "team_member_row user_#{user.id}"} + .row + .span6 + = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do + = image_tag gravatar_icon(user.email, 40), class: "avatar s32" + = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do + %strong= truncate(user.name, lenght: 40) + %br + %small.cgray= user.email + + .span5.right + - if allow_admin + .left + = form_for(member, as: :team_member, url: project_team_member_path(@project, member)) do |f| + = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2" + .right + - if current_user == user + %span.btn.disabled This is you! + - if @project.namespace_owner == user + %span.btn.disabled.success Owner + - elsif user.blocked + %span.btn.disabled.blocked Blocked + - elsif allow_admin + = link_to project_team_member_path(project_id: @project, id: member.id), confirm: remove_from_team_message(@project, member), method: :delete, class: "very_small btn danger" do + %i.icon-minus.icon-white + diff --git a/app/views/team_members/_team.html.haml b/app/views/team_members/_team.html.haml index 2ec8c1a8..365d9b65 100644 --- a/app/views/team_members/_team.html.haml +++ b/app/views/team_members/_team.html.haml @@ -1,8 +1,16 @@ -- team.each do |access, members| +- grouper_project_members(@project).each do |access, members| .ui-box %h5.title = Project.access_options.key(access).pluralize %small= members.size %ul.well-list - - members.sort_by(&:user_name).each do |team_member| - = render 'team_members/team_member', member: team_member + - members.sort_by(&:user_name).each do |up| + = render(partial: 'team_members/show', locals: {member: up}) + + +:javascript + $(function(){ + $('.repo-access-select, .project-access-select').live("change", function() { + $(this.form).submit(); + }); + }) diff --git a/app/views/team_members/_team_member.html.haml b/app/views/team_members/_team_member.html.haml deleted file mode 100644 index 2b0709be..00000000 --- a/app/views/team_members/_team_member.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -- user = member.user -- allow_admin = can? current_user, :admin_project, @project -%li{id: dom_id(user), class: "team_member_row user_#{user.id}"} - .row - .span4 - = link_to user, title: user.name, class: "dark" do - = image_tag gravatar_icon(user.email, 32), class: "avatar s32" - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username - - .span4.pull-right - - if allow_admin - .left - = form_for(member, as: :team_member, url: project_team_member_path(@project, member.user)) do |f| - = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2 trigger-submit" - .pull-right - - if current_user == user - %span.label This is you! - - if @project.namespace_owner == user - %span.label Owner - - elsif user.blocked? - %span.label Blocked - - elsif allow_admin - = link_to project_team_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from team' do - %i.icon-minus.icon-white - diff --git a/app/views/team_members/create.js.haml b/app/views/team_members/create.js.haml index b7dff35a..d5ae5d0c 100644 --- a/app/views/team_members/create.js.haml +++ b/app/views/team_members/create.js.haml @@ -1,4 +1,4 @@ -- if @user_project_relation.valid? +- if @team_member.valid? :plain $("#new_team_member").hide("slide", { direction: "right" }, 150, function(){ $("#team-table").show("slide", { direction: "left" }, 150, function() { diff --git a/app/views/team_members/import.html.haml b/app/views/team_members/import.html.haml index 0f7175b9..de82f416 100644 --- a/app/views/team_members/import.html.haml +++ b/app/views/team_members/import.html.haml @@ -1,10 +1,10 @@ -= render "projects/settings_nav" += render "projects/project_head" %h3.page_title = "Import team from another project" %hr %p.slead - Read more about project team import #{link_to "here", '#', class: 'vlink'}. + Read more about team import #{link_to "here", '#', class: 'vlink'}. = form_tag apply_import_project_team_members_path(@project), method: 'post' do %p.slead Choose project you want to use as team source: .padded @@ -12,6 +12,6 @@ .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 btn-save" - = link_to "Cancel", project_team_index_path(@project), class: "btn btn-cancel" + = submit_tag 'Import', class: "btn save-btn" + = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" diff --git a/app/views/team_members/index.html.haml b/app/views/team_members/index.html.haml index 50d44bcd..e413c81b 100644 --- a/app/views/team_members/index.html.haml +++ b/app/views/team_members/index.html.haml @@ -1,56 +1,20 @@ -= render "projects/settings_nav" += render "projects/project_head" %h3.page_title Team Members - (#{@project.users.count}) + (#{@project.users_projects.count}) %small Read more about project permissions %strong= link_to "here", help_permissions_path, class: "vlink" - if can? current_user, :admin_team_member, @project - %span.pull-right - = link_to import_project_team_members_path(@project), class: "btn btn-small grouped", title: "Import team from another project" do + %span.right + = link_to import_project_team_members_path(@project), class: "btn small grouped", title: "Import team from another project" do Import team from another project - = link_to available_project_teams_path(@project), class: "btn btn-small grouped", title: "Assign project to team of users" do - Assign project to Team of users - = link_to new_project_team_member_path(@project), class: "btn btn-primary small grouped", title: "New Team Member" do + = link_to new_project_team_member_path(@project), class: "btn success small grouped", title: "New Team Member" do New Team Member - %hr + .clearfix -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li{class: ("active" if !params[:type])} - = link_to project_team_members_path(type: nil) do - All - %li{class: ("active" if params[:type] == 'masters')} - = link_to project_team_members_path(type: 'masters') do - Masters - %span.pull-right= @project.users_projects.masters.count - %li{class: ("active" if params[:type] == 'developers')} - = link_to project_team_members_path(type: 'developers') do - Developers - %span.pull-right= @project.users_projects.developers.count - %li{class: ("active" if params[:type] == 'reporters')} - = link_to project_team_members_path(type: 'reporters') do - Reporters - %span.pull-right= @project.users_projects.reporters.count - %li{class: ("active" if params[:type] == 'guests')} - = link_to project_team_members_path(type: 'guests') do - Guests - %span.pull-right= @project.users_projects.guests.count - - - if @assigned_teams.present? - %h5 - Assigned teams - (#{@project.user_teams.count}) - %div - = render "team_members/assigned_teams", assigned_teams: @assigned_teams - - .span9 - %div.team-table - = render "team_members/team", team: @team - - - +%div.team-table + = render partial: "team_members/team", locals: {project: @project} diff --git a/app/views/team_members/new.html.haml b/app/views/team_members/new.html.haml index 7e20f50d..40eb4ceb 100644 --- a/app/views/team_members/new.html.haml +++ b/app/views/team_members/new.html.haml @@ -1,2 +1,2 @@ -= render "projects/settings_nav" += render "projects/project_head" = render "team_members/form" diff --git a/app/views/team_members/show.html.haml b/app/views/team_members/show.html.haml new file mode 100644 index 00000000..4008e8bd --- /dev/null +++ b/app/views/team_members/show.html.haml @@ -0,0 +1,60 @@ +- allow_admin = can? current_user, :admin_project, @project +- user = @team_member.user + +.team_member_show + - if can? current_user, :admin_project, @project + = link_to 'Remove from team', project_team_member_path(project_id: @project, id: @team_member.id), confirm: 'Are you sure?', method: :delete, class: "right btn danger" + .profile_avatar_holder + = image_tag gravatar_icon(user.email, 60), class: "borders" + %h3.page_title + = user.name + %small (@#{user.username}) + + %hr + .back_link + %br + = link_to project_team_index_path(@project), class: "" do + ← To team list + %br + .row + .span6 + %table.lite + %tr + %td Email + %td= mail_to user.email + %tr + %td Skype + %td= user.skype + - unless user.linkedin.blank? + %tr + %td LinkedIn + %td= user.linkedin + - unless user.twitter.blank? + %tr + %td Twitter + %td= user.twitter + - unless user.bio.blank? + %tr + %td Bio + %td= user.bio + .span6 + %table.lite + %tr + %td Member since + %td= @team_member.created_at.stamp("Aug 21, 2011") + %tr + %td + Project Access: + %small (#{link_to "read more", help_permissions_path, class: "vlink"}) + %td + = form_for(@team_member, as: :team_member, url: project_team_member_path(@project, @team_member)) do |f| + = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, class: "project-access-select", disabled: !allow_admin + %hr + = render @events +:javascript + $(function(){ + $('.repo-access-select, .project-access-select').live("change", function() { + $(this.form).submit(); + }); + }) + diff --git a/app/views/team_members/update.js.haml b/app/views/team_members/update.js.haml index c68fe957..6d7f8816 100644 --- a/app/views/team_members/update.js.haml +++ b/app/views/team_members/update.js.haml @@ -1,6 +1,6 @@ -- if @user_project_relation.valid? +- if @team_member.valid? :plain - $("##{dom_id(@user_project_relation)}").effect("highlight", {color: "#529214"}, 1000);; + $("##{dom_id(@team_member)}").effect("highlight", {color: "#529214"}, 1000);; - else :plain - $("##{dom_id(@user_project_relation)}").effect("highlight", {color: "#D12F19"}, 1000);; + $("##{dom_id(@team_member)}").effect("highlight", {color: "#D12F19"}, 1000);; diff --git a/app/views/teams/_filter.html.haml b/app/views/teams/_filter.html.haml deleted file mode 100644 index f461fcad..00000000 --- a/app/views/teams/_filter.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -= form_tag team_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 team_filter_path(entity, status: nil) do - Open - %li{class: ("active" if params[:status] == 'closed')} - = link_to team_filter_path(entity, status: 'closed') do - Closed - %li{class: ("active" if params[:status] == 'all')} - = link_to team_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 team_filter_path(entity, project_id: project.id) do - = project.name_with_namespace - %small.pull-right= entities_per_project(project, entity) - - %fieldset - %hr - = link_to "Reset", team_filter_path(entity), class: 'btn pull-right' - diff --git a/app/views/teams/_projects.html.haml b/app/views/teams/_projects.html.haml deleted file mode 100644 index d0061aa2..00000000 --- a/app/views/teams/_projects.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -.ui-box - %h5.title - Projects - %small - (#{projects.count}) - - if can? current_user, :manage_user_team, @team - %span.pull-right - = link_to edit_team_path(@team), class: "btn btn-tiny info" do - %i.icon-plus - Assign Project - %ul.well-list - - if projects.blank? - %p.nothing_here_message This team has no projects yet - - projects.each do |project| - %li - = link_to project_path(project), class: dom_class(project) do - %strong.well-title= truncate(project.name_with_namespace, length: 40) - %span.arrow - → - %span.last_activity - %strong Last activity: - %span= project_last_activity(project) diff --git a/app/views/teams/edit.html.haml b/app/views/teams/edit.html.haml deleted file mode 100644 index c9d573ea..00000000 --- a/app/views/teams/edit.html.haml +++ /dev/null @@ -1,73 +0,0 @@ -.row - .span3 - %ul.nav.nav-pills.nav-stacked - %li.active - = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab' - %li - = link_to 'Edit Team', '#tab-edit', 'data-toggle' => 'tab' - %li - = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - - .span9 - .tab-content - .tab-pane.active#tab-projects - .ui-box.projects-table - %h5.title Projects - %ul.well-list - - @projects.each do |project| - %li - - if project.public - %i.icon-share - - else - %i.icon-lock.cgreen - = link_to project.name_with_namespace, project - .pull-right - = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn btn-small" - = link_to 'Relegate', team_project_path(@team, project), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small" - .form-holder - = form_tag team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do - %table.headless - %tr - %td= select_tag :project_ids, options_from_collection_for_select(@avaliable_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span4' - %td= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen" } - %td= submit_tag 'Add Project', class: "btn btn-create", id: :assign_projects_to_team - - - .tab-pane#tab-edit - .ui-box - %h5.title Edit Team - %div.form-holder - = form_for @team, url: team_path(@team) do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xlarge js-gfm-input", rows: 4 - - .clearfix - = f.label :path do - Team path is - .input - = f.text_field :path, placeholder: "opensource", class: "xlarge left" - - .form-actions - = f.submit 'Save team changes', class: "btn btn-primary" - - .tab-pane#tab-remove - .ui-box.ui-box-danger - %h5.title Remove team - .ui-box-body - %p - Remove of team will cause removing members access to projects. - %p - %strong Removed team can not be restored! - - = link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small" diff --git a/app/views/teams/issues.html.haml b/app/views/teams/issues.html.haml deleted file mode 100644 index 5b17c5d4..00000000 --- a/app/views/teams/issues.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h3.page_title - Issues - %small (in Team projects assigned to Team members) - %small.pull-right #{@issues.total_count} issues - -%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 issue - %hr - = paginate @issues, theme: "gitlab" - - else - %p.nothing_here_message Nothing to show here diff --git a/app/views/teams/members/_form.html.haml b/app/views/teams/members/_form.html.haml deleted file mode 100644 index c22ee783..00000000 --- a/app/views/teams/members/_form.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -= form_tag admin_team_member_path(@team, @member), method: :put do - -if @member.errors.any? - .alert.alert-error - %ul - - @member.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Default access for Team projects: - .input - = select_tag :default_project_access, options_for_select(UserTeam.access_roles, @team.default_projects_access(@member)), class: "project-access-select chosen span3" - .clearfix - %label Team admin? - .input - = check_box_tag :group_admin, true, @team.admin?(@member) - - %br - .actions - = submit_tag 'Save', class: "btn btn-save" - = link_to 'Cancel', :back, class: "btn" diff --git a/app/views/teams/members/_show.html.haml b/app/views/teams/members/_show.html.haml deleted file mode 100644 index 1a323043..00000000 --- a/app/views/teams/members/_show.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- user = member.user -- allow_admin = can? current_user, :manage_user_team, @team -%li{id: dom_id(member), class: "team_member_row user_#{user.id}"} - .row - .span5 - = link_to user_path(user.username), title: user.name, class: "dark" do - = image_tag gravatar_icon(user.email, 40), class: "avatar s32" - = link_to user_path(user.username), title: user.name, class: "dark" do - %strong= truncate(user.name, lenght: 40) - %br - %small.cgray= user.username - - .span4 - - if allow_admin - = form_for(member, as: :team_member, url: team_member_path(@team, user)) do |f| - = f.select :permission, options_for_select(UsersProject.access_roles, @team.default_projects_access(user)), {}, class: "medium trigger-submit" - %br - = label_tag do - = f.check_box :group_admin, class: 'trigger-submit' - %span Admin access - .pull-right - - if current_user == user - %span.btn.disabled This is you! - - if @team.owner == user - %span.btn.disabled Owner - - elsif user.blocked? - %span.btn.disabled.blocked Blocked - - elsif allow_admin - = link_to team_member_path(@team, user), confirm: remove_from_user_team_message(@team, user), method: :delete, class: "btn-tiny btn btn-remove", title: "Remove from team" do - %i.icon-minus.icon-white diff --git a/app/views/teams/members/_team.html.haml b/app/views/teams/members/_team.html.haml deleted file mode 100644 index d8afc1fa..00000000 --- a/app/views/teams/members/_team.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- grouped_user_team_members(@team).each do |access, members| - .ui-box - %h5.title - = Project.access_options.key(access).pluralize - %small= members.size - %ul.well-list - - members.sort_by(&:user_name).each do |up| - = render(partial: 'teams/members/show', locals: {member: up}) - - -:javascript - $(function(){ - $('.repo-access-select, .project-access-select').live("change", function() { - $(this.form).submit(); - }); - }) diff --git a/app/views/teams/members/edit.html.haml b/app/views/teams/members/edit.html.haml deleted file mode 100644 index 37588049..00000000 --- a/app/views/teams/members/edit.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3.page_title - Edit access #{@member.name} in #{@team.name} team - -%hr -%table.zebra-striped - %tr - %td User: - %td= @member.name - %tr - %td Team: - %td= @team.name - %tr - %td Since: - %td= member_since(@team, @member).stamp("Nov 11, 2010") - -= render 'form' diff --git a/app/views/teams/members/index.html.haml b/app/views/teams/members/index.html.haml deleted file mode 100644 index 87438266..00000000 --- a/app/views/teams/members/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -%h3.page_title - Team Members - (#{@members.count}) - %small - Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" - - - if can? current_user, :manage_user_team, @team - %span.pull-right - = link_to new_team_member_path(@team), class: "btn btn-primary small grouped", title: "New Team Member" do - New Team Member -%hr - - -.clearfix -%div.team-table - = render partial: "teams/members/team", locals: {project: @team} diff --git a/app/views/teams/members/new.html.haml b/app/views/teams/members/new.html.haml deleted file mode 100644 index 9b9b3cef..00000000 --- a/app/views/teams/members/new.html.haml +++ /dev/null @@ -1,29 +0,0 @@ -%h3.page_title - Team: #{@team.name} - -%fieldset - %legend Members (#{@team.members.count}) - = form_tag team_members_path(@team), id: "team_members", class: "bulk_import", method: :post do - %table#members_list - %thead - %tr - %th User name - %th Default project access - %th Team access - %th - - @team.members.each do |member| - %tr.member - %td - = member.name - %small= "(#{member.username})" - %td= @team.human_default_projects_access(member) - %td= @team.admin?(member) ? "Admin" : "Member" - %td - %tr - %td - = users_select_tag(:user_ids, multiple: true) - %td= select_tag :default_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } - %td - %span= check_box_tag :group_admin - %span Admin? - %td= submit_tag 'Add User', class: "btn btn-create", id: :add_members_to_team diff --git a/app/views/teams/merge_requests.html.haml b/app/views/teams/merge_requests.html.haml deleted file mode 100644 index 417d1aa6..00000000 --- a/app/views/teams/merge_requests.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -%h3.page_title - Merge Requests - %small (authored by or assigned to Team members) - %small.pull-right #{@merge_requests.total_count} merge requests - -%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 diff --git a/app/views/teams/new.html.haml b/app/views/teams/new.html.haml deleted file mode 100644 index 99d30821..00000000 --- a/app/views/teams/new.html.haml +++ /dev/null @@ -1,39 +0,0 @@ -%h3.page_title New Team -%hr -= form_for @team, url: teams_path do |f| - - if @team.errors.any? - .alert.alert-error - %span= @team.errors.full_messages.first - .clearfix - = f.label :name do - Team name is - .input - = f.text_field :name, placeholder: "Ex. Ruby Developers", class: "xxlarge left" - - .clearfix.team-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Create team', class: "btn btn-create" - - .padded - %ul - %li All created teams are public (users can view who enter into team and which project are assigned for this team) - %li People within a team see only projects they have access to - %li You will be able to assign existing projects for team - %hr - - - if current_user.can_create_group? - .clearfix - .input.light - Need a group for several dependent projects? - = link_to new_group_path, class: "btn btn-tiny" do - Create a group - - if current_user.can_create_project? - .clearfix - .input.light - Want to create a project? - = link_to new_project_path, class: "btn btn-tiny" do - Create a project diff --git a/app/views/teams/projects/_form.html.haml b/app/views/teams/projects/_form.html.haml deleted file mode 100644 index d2c89b0c..00000000 --- a/app/views/teams/projects/_form.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= form_tag team_project_path(@team, @project), method: :put do - -if @project.errors.any? - .alert.alert-error - %ul - - @project.errors.full_messages.each do |msg| - %li= msg - - .clearfix - %label Max access for Team members: - .input - = select_tag :greatest_project_access, options_for_select(UserTeam.access_roles, @team.max_project_access(@project)), class: "project-access-select chosen span3" - - %br - .actions - = submit_tag 'Save', class: "btn btn-save" - = link_to 'Cancel', :back, class: "btn btn-cancel" diff --git a/app/views/teams/projects/edit.html.haml b/app/views/teams/projects/edit.html.haml deleted file mode 100644 index 82c7d734..00000000 --- a/app/views/teams/projects/edit.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h3.page_title - Edit max access in #{link_to @project.name_with_namespace, @project} for #{link_to(@team.name, team_path(@team))} team - -%hr - -= render 'form' diff --git a/app/views/teams/show.atom.builder b/app/views/teams/show.atom.builder deleted file mode 100644 index bb0f666e..00000000 --- a/app/views/teams/show.atom.builder +++ /dev/null @@ -1,29 +0,0 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Team feed - #{@team.name}" - xml.link :href => team_url(@team, :atom), :rel => "self", :type => "application/atom+xml" - xml.link :href => team_url(@team), :rel => "alternate", :type => "text/html" - xml.id projects_url - xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? - - @events.each do |event| - if event.proper? - event = EventDecorator.decorate(event) - xml.entry do - event_link = event.feed_url - event_title = event.feed_title - - xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}" - xml.link :href => event_link - xml.title truncate(event_title, :length => 80) - xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ") - xml.media :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(event.author_email) - xml.author do |author| - xml.name event.author_name - xml.email event.author_email - end - xml.summary event_title - end - end - end -end diff --git a/app/views/teams/show.html.haml b/app/views/teams/show.html.haml deleted file mode 100644 index 2eb0283e..00000000 --- a/app/views/teams/show.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -.projects - .activities.span8 - = link_to dashboard_path, class: 'btn btn-tiny' do - ← To dashboard -   - %span.cgray Events and projects are filtered in scope of team - %hr - - if @events.any? - .content_list - - else - %p.nothing_here_message Projects activity will be displayed here - .loading.hide - .side.span4 - - if @team.description.present? - .description.well.light - = @team.description - = render "projects", projects: @projects - .prepend-top-20 - = link_to team_path(@team, { format: :atom, private_token: current_user.private_token }), title: "Feed" do - %strong - %i.icon-rss - News Feed - - %hr - .gitlab-promo - = link_to "Homepage", "http://gitlabhq.com" - = link_to "Blog", "http://blog.gitlabhq.com" - = link_to "@gitlabhq", "https://twitter.com/gitlabhq" - -:javascript - $(function(){ Pager.init(20, true); }); diff --git a/app/views/teams/show.js.haml b/app/views/teams/show.js.haml deleted file mode 100644 index 7e5a148e..00000000 --- a/app/views/teams/show.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -:plain - Pager.append(#{@events.count}, "#{escape_javascript(render(@events))}"); diff --git a/app/views/tree/_blob_actions.html.haml b/app/views/tree/_blob_actions.html.haml index 1d55a4ff..21334ea1 100644 --- a/app/views/tree/_blob_actions.html.haml +++ b/app/views/tree/_blob_actions.html.haml @@ -1,12 +1,12 @@ .btn-group.tree-btn-group -# only show edit link for text files - if @tree.text? - = link_to "edit", project_edit_tree_path(@project, @id), class: "btn btn-tiny", disabled: !allowed_tree_edit? - = link_to "raw", project_blob_path(@project, @id), class: "btn btn-tiny", target: "_blank" + = link_to "edit", edit_project_tree_path(@project, @id), class: "btn very_small", disabled: !allowed_tree_edit? + = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" -# only show normal/blame view links for text files - if @tree.text? - if current_page? project_blame_path(@project, @id) - = link_to "normal view", project_tree_path(@project, @id), class: "btn btn-tiny" + = link_to "normal view", project_tree_path(@project, @id), class: "btn very_small" - else - = link_to "blame", project_blame_path(@project, @id), class: "btn btn-tiny" - = link_to "history", project_commits_path(@project, @id), class: "btn btn-tiny" + = link_to "blame", project_blame_path(@project, @id), class: "btn very_small" + = link_to "history", project_commits_path(@project, @id), class: "btn very_small" diff --git a/app/views/tree/_head.html.haml b/app/views/tree/_head.html.haml new file mode 100644 index 00000000..f14526cf --- /dev/null +++ b/app/views/tree/_head.html.haml @@ -0,0 +1,7 @@ +%ul.nav.nav-tabs + %li + = render partial: 'shared/ref_switcher', locals: {destination: 'tree', path: @path} + = nav_link(controller: :tree) do + = link_to 'Source', project_tree_path(@project, @ref) + %li.right + = render "shared/clone_panel" diff --git a/app/views/tree/_tree.html.haml b/app/views/tree/_tree.html.haml index caab6e45..c2842959 100644 --- a/app/views/tree/_tree.html.haml +++ b/app/views/tree/_tree.html.haml @@ -1,9 +1,9 @@ %ul.breadcrumb %li - %i.icon-angle-right + %span.arrow = link_to project_tree_path(@project, @ref) do - = @project.path - - tree_breadcrumbs(tree, 6) do |title, path| + = @project.name + - tree.breadcrumbs(6) do |title, path| \/ %li - if path @@ -11,6 +11,9 @@ - else = link_to title, '#' +.clear +%div.tree_progress + %div#tree-content-holder.tree-content-holder - if tree.is_blob? = render "tree/blob", blob: tree @@ -21,13 +24,13 @@ %th Name %th Last Update %th Last Commit - %th= link_to "history", project_commits_path(@project, @id), class: "btn btn-tiny pull-right" + %th= link_to "history", project_commits_path(@project, @id), class: "btn very_small right" - if tree.up_dir? %tr.tree-item %td.tree-item-file-name = image_tag "file_empty.png", size: '16x16' - = link_to "..", project_tree_path(@project, up_dir_path(tree)) + = link_to "..", project_tree_path(@project, tree.up_dir_path) %td %td %td @@ -37,8 +40,6 @@ - if tree.readme = render "tree/readme", readme: tree.readme -%div.tree_progress - - unless tree.is_blob? :javascript // Load last commit log for each file in tree diff --git a/app/views/tree/_tree_commit_column.html.haml b/app/views/tree/_tree_commit_column.html.haml index 7ae2582c..9d02132b 100644 --- a/app/views/tree/_tree_commit_column.html.haml +++ b/app/views/tree/_tree_commit_column.html.haml @@ -1,2 +1,2 @@ -%span.tree_author= commit_author_link(commit, avatar: true) +%span.tree_author= commit.author_link avatar: true = link_to_gfm truncate(commit.title, length: 80), project_commit_path(@project, commit.id), class: "tree-commit-link" diff --git a/app/views/edit_tree/show.html.haml b/app/views/tree/edit.html.haml similarity index 86% rename from app/views/edit_tree/show.html.haml rename to app/views/tree/edit.html.haml index 211396ba..adee68a0 100644 --- a/app/views/edit_tree/show.html.haml +++ b/app/views/tree/edit.html.haml @@ -1,5 +1,5 @@ .file-editor - = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do + = form_tag(project_tree_path(@project, @id), method: :put, class: "form-horizontal") do .file_holder .file_title %i.icon-file @@ -10,7 +10,7 @@ %strong= @ref %span.options .btn-group.tree-btn-group - = link_to "Cancel", project_tree_path(@project, @id), class: "btn btn-tiny btn-cancel", confirm: "Are you sure?" + = link_to "Cancel", project_tree_path(@project, @id), class: "btn very_small cancel-btn", confirm: "Are you sure?" .file_content.code %pre#editor= @tree.data @@ -27,7 +27,7 @@ .message to branch %strong= @ref - = link_to "Cancel", project_tree_path(@project, @id), class: "btn btn-cancel", confirm: "Are you sure?" + = link_to "Cancel", project_tree_path(@project, @id), class: "btn cancel-btn", confirm: "Are you sure?" :javascript var ace_mode = "#{@tree.language.try(:ace_mode)}"; diff --git a/app/views/tree/show.html.haml b/app/views/tree/show.html.haml index 0f7692ab..a4034f22 100644 --- a/app/views/tree/show.html.haml +++ b/app/views/tree/show.html.haml @@ -1,4 +1,3 @@ -%div.tree-ref-holder - = render 'shared/ref_switcher', destination: 'tree', path: @path += render "head" %div#tree-holder.tree-holder = render "tree", tree: @tree diff --git a/app/views/tree/show.js.haml b/app/views/tree/show.js.haml index a01d4917..fadd5e22 100644 --- a/app/views/tree/show.js.haml +++ b/app/views/tree/show.js.haml @@ -1,7 +1,7 @@ :plain // Load Files list $("#tree-holder").html("#{escape_javascript(render(partial: "tree", locals: {tree: @tree}))}"); - $("#tree-content-holder").show("slide", { direction: "right" }, 400); + $("#tree-content-holder").show("slide", { direction: "right" }, 150); $('.project-refs-form #path').val("#{@path}"); // Load last commit log for each file in tree diff --git a/app/views/users/_profile.html.haml b/app/views/users/_profile.html.haml deleted file mode 100644 index fba3660b..00000000 --- a/app/views/users/_profile.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.ui-box - %h5.title - Profile - %ul.well-list - %li - %span.light Member since - %strong= user.created_at.stamp("Aug 21, 2011") - - unless user.skype.blank? - %li - %span.light Skype: - %strong= user.skype - - unless user.linkedin.blank? - %li - %span.light LinkedIn: - %strong= user.linkedin - - unless user.twitter.blank? - %li - %span.light Twitter: - %strong= user.twitter - - unless user.bio.blank? - %li - %span.light Bio: - %span= user.bio diff --git a/app/views/users/_projects.html.haml b/app/views/users/_projects.html.haml deleted file mode 100644 index 4bee2f0c..00000000 --- a/app/views/users/_projects.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -.ui-box - %h5.title Projects - %ul.well-list - - @projects.each do |project| - %li - = link_to project_path(project), class: dom_class(project) do - - if project.namespace - = project.namespace.human_name - \/ - %strong.well-title - = truncate(project.name, length: 45) - %span.pull-right.light - - if project.owner == user - %i.icon-wrench - - tm = project.team.get_tm(user.id) - - if tm - = tm.project_access_human -%p.light - %i.icon-wrench - – user is a project owner diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml deleted file mode 100644 index 10bd90b1..00000000 --- a/app/views/users/show.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -.row - .span8 - %h3.page_title - = image_tag gravatar_icon(@user.email, 90), class: "avatar s90" - = @user.name - - if @user == current_user - .pull-right - = link_to profile_path, class: 'btn btn-small' do - %i.icon-edit - Edit Profile - %br - %small #{@user.username} - %br - %small member since #{@user.created_at.stamp("Nov 12, 2031")} - .clearfix - %hr - %h5 Recent events - = render @events - .span4 - = render 'profile', user: @user - = render 'projects', user: @user diff --git a/app/views/walls/show.html.haml b/app/views/walls/show.html.haml deleted file mode 100644 index 139e66f5..00000000 --- a/app/views/walls/show.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -%div.wall-page - %ul.notes - - - if can? current_user, :write_note, @project - .note-form-holder - = form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note wall-note-form" } do |f| - = note_target_fields - .note_text_and_preview - = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input turn-on' - .note-form-actions - .buttons - = f.submit 'Add Comment', class: "btn comment-btn grouped js-comment-button" - - .note-form-option - %a.choose-btn.btn.btn-small.js-choose-note-attachment-button - %i.icon-paper-clip - %span Choose File ... -   - %span.file_name.js-attachment-filename File name... - = f.file_field :attachment, class: "js-note-attachment-input hide" - - .hint.pull-right CTRL + Enter to send message - .clearfix - -:javascript - $(function(){ - Wall.init(#{@project.id}); - }); diff --git a/app/views/wikis/_form.html.haml b/app/views/wikis/_form.html.haml index 7cf08815..9eb2a571 100644 --- a/app/views/wikis/_form.html.haml +++ b/app/views/wikis/_form.html.haml @@ -8,12 +8,9 @@ .ui-box.ui-box-show .ui-box-head - %h3.page_title - .edit-wiki-header - = @wiki.title.titleize - = f.hidden_field :title, value: @wiki.title - = f.select :format, options_for_select(GollumWiki::MARKUPS, {selected: @wiki.format}), {}, class: "pull-right input-medium" - = f.label :format, class: "pull-right", style: "padding-right: 20px;" + = f.label :title + .input= f.text_field :title, class: 'span8' + = f.hidden_field :slug .ui-box-body .input %span.cgray @@ -25,12 +22,6 @@ .ui-box-bottom = f.label :content .input= f.text_area :content, class: 'span8 js-gfm-input' - .ui-box-bottom - = f.label :commit_message - .input= f.text_field :message, class: 'span8' .actions - = f.submit 'Save', class: "btn-save btn" - - if @wiki && @wiki.persisted? - = link_to "Cancel", project_wiki_path(@project, @wiki), class: "btn btn-cancel" - - else - = link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel" + = f.submit 'Save', class: "save-btn btn" + = link_to "Cancel", project_wiki_path(@project, :index), class: "btn cancel-btn" diff --git a/app/views/wikis/_main_links.html.haml b/app/views/wikis/_main_links.html.haml deleted file mode 100644 index cb8ccf81..00000000 --- a/app/views/wikis/_main_links.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%span.pull-right - - if (@wiki && @wiki.persisted?) - = link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do - Page History - - if can?(current_user, :write_wiki, @project) - = link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do - %i.icon-edit - Edit diff --git a/app/views/wikis/_nav.html.haml b/app/views/wikis/_nav.html.haml deleted file mode 100644 index 0dffdd8f..00000000 --- a/app/views/wikis/_nav.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -%ul.nav.nav-tabs - = nav_link(html_options: {class: params[:id] == 'home' ? 'active' : '' }) do - = link_to 'Home', project_wiki_path(@project, :home) - - = nav_link(path: 'wikis#pages') do - = link_to 'Pages', pages_project_wikis_path(@project) - - = nav_link(path: 'wikis#git_access') do - = link_to git_access_project_wikis_path(@project) do - %i.icon-download-alt - Git Access - - - if can?(current_user, :write_wiki, @project) - %li.pull-right - = link_to '#', class: "add-new-wiki" do - %i.icon-plus - New Page - -= render 'wikis/new' diff --git a/app/views/wikis/_new.html.haml b/app/views/wikis/_new.html.haml deleted file mode 100644 index 50b40bff..00000000 --- a/app/views/wikis/_new.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -%div#modal-new-wiki.modal.hide - .modal-header - %a.close{href: "#"} × - %h3 New Wiki Page - .modal-body - = label_tag :new_wiki_path do - %span Page slug - = text_field_tag :new_wiki_path, nil, placeholder: 'how-to-setup', class: 'input-xlarge' - .modal-footer - = link_to 'Build', '#', class: 'build-new-wiki btn btn-create' - -:javascript - $(function(){ - var modal = $('#modal-new-wiki').modal({modal: true, show:false}); - $('.add-new-wiki').bind("click", function(){ - modal.show(); - }); - $('.build-new-wiki').bind("click", function(){ - location.href = "#{project_wikis_path(@project)}/" + $('#new_wiki_path').val(); - }); - $('.modal-header .close').bind("click", function(){ - modal.hide(); - }) - }) - diff --git a/app/views/wikis/edit.html.haml b/app/views/wikis/edit.html.haml index 7441ceff..8f6b457f 100644 --- a/app/views/wikis/edit.html.haml +++ b/app/views/wikis/edit.html.haml @@ -1,10 +1,8 @@ -= render 'wikis/nav' -%h3.page_title - Editing page - = render partial: 'main_links' +%h3.page_title Editing page +%hr = render 'form' -.pull-right - - if @wiki.persisted? && can?(current_user, :admin_wiki, @project) - = link_to project_wiki_path(@project, @wiki), confirm: "Are you sure you want to delete this page?", method: :delete, class: "btn btn-small btn-remove" do - Delete this page +.right + - if can? current_user, :admin_wiki, @project + = link_to project_wiki_path(@project, @wiki), confirm: "Are you sure you want to delete this page?", method: :delete, class: "btn small danger" do + Delete this page \ No newline at end of file diff --git a/app/views/wikis/git_access.html.haml b/app/views/wikis/git_access.html.haml deleted file mode 100644 index 58c8aa06..00000000 --- a/app/views/wikis/git_access.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -= render 'wikis/nav' -%h3.page_title - Git Access - %strong= @gollum_wiki.path_with_namespace - = render partial: 'main_links' - -%br -.content - .project_clone_panel - .row - .span7 - .form-horizontal - .input-prepend.project_clone_holder - %button{class: "btn active", :"data-clone" => @gollum_wiki.ssh_url_to_repo} SSH - %button{class: "btn", :"data-clone" => @gollum_wiki.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase - = text_field_tag :project_clone, @gollum_wiki.url_to_repo, class: "one_click_select input-xxlarge", readonly: true - .git-empty - %fieldset - %legend Install Gollum: - %pre.dark - :preserve - gem install gollum - - %legend Clone Your Wiki: - %pre.dark - :preserve - git clone #{@gollum_wiki.path_with_namespace}.git - cd #{@gollum_wiki.path_with_namespace} - - %legend Start Gollum And Edit Locally: - %pre.dark - :preserve - gollum - == Sinatra/1.3.5 has taken the stage on 4567 for development with backup from Thin - >> Thin web server (v1.5.0 codename Knife) - >> Maximum connections set to 1024 - >> Listening on 0.0.0.0:4567, CTRL+C to stop diff --git a/app/views/wikis/history.html.haml b/app/views/wikis/history.html.haml index f4946ed0..18df8e1d 100644 --- a/app/views/wikis/history.html.haml +++ b/app/views/wikis/history.html.haml @@ -1,31 +1,23 @@ -= render 'wikis/nav' %h3.page_title - %span.light History for - = @wiki.title.titleize - = render partial: 'main_links' + %span.cgray History for + = @wiki_pages.first.title %br %table %thead %tr %th Page version - %th Author - %th Commit Message %th Last updated - %th Format + %th Updated by %tbody - - @wiki.versions.each do |version| - - commit = version + - @wiki_pages.each_with_index do |wiki_page, i| %tr - %td - = link_to project_wiki_path(@project, @wiki, version_id: commit.id) do - = commit.short_id - %td - = commit_author_link(commit, avatar: true, size: 24) - %td - = commit.title - %td - = time_ago_in_words(version.date) - ago %td %strong - = @wiki.page.wiki.page(@wiki.page.name, commit.id).try(:format) + = link_to project_wiki_path(@project, wiki_page, version_id: wiki_page.id) do + Version + = @wiki_pages.count - i + %td + = wiki_page.created_at.to_s(:short) + (#{time_ago_in_words(wiki_page.created_at)} + ago) + %td= link_to_member(@project, wiki_page.user) diff --git a/app/views/wikis/pages.html.haml b/app/views/wikis/pages.html.haml index 95d5eef1..2e0f091c 100644 --- a/app/views/wikis/pages.html.haml +++ b/app/views/wikis/pages.html.haml @@ -1,25 +1,20 @@ -= render 'wikis/nav' -%h3.page_title - All Pages - = render partial: 'main_links' +%h3.page_title All Pages %br %table %thead %tr %th Title - %th Format + %th Slug %th Last updated %th Updated by %tbody - @wiki_pages.each do |wiki_page| %tr %td - %strong= link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) - %td - %strong= wiki_page.format + %strong= link_to wiki_page.title, project_wiki_path(@project, wiki_page) + %td= wiki_page.slug %td = wiki_page.created_at.to_s(:short) do (#{time_ago_in_words(wiki_page.created_at)} ago) - %td - = commit_author_link(wiki_page.version, avatar: true, size: 24) + %td= link_to_member(@project, wiki_page.user) diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml index b237bc52..d3bd58bb 100644 --- a/app/views/wikis/show.html.haml +++ b/app/views/wikis/show.html.haml @@ -1,9 +1,16 @@ -= render 'wikis/nav' %h3.page_title - = @wiki.title.titleize - = render partial: 'main_links' + = @wiki.title + %span.right + = link_to pages_project_wikis_path(@project), class: "btn small grouped" do + Pages + - if can? current_user, :write_wiki, @project + = link_to history_project_wiki_path(@project, @wiki), class: "btn small grouped" do + History + = link_to edit_project_wiki_path(@project, @wiki), class: "btn small grouped" do + %i.icon-edit + Edit %br -- if @wiki.historical? +- if @wiki != @most_recent_wiki .warning_message This is an old version of this page. You can view the #{link_to "most recent version", project_wiki_path(@project, @wiki)} or browse the #{link_to "history", history_project_wiki_path(@project, @wiki)}. @@ -11,6 +18,6 @@ .file_holder .file_content.wiki = preserve do - = render_wiki_content(@wiki) + = markdown @wiki.content -%p.time Last edited by #{commit_author_link(@wiki.version, avatar: true, size: 16)} #{time_ago_in_words @wiki.created_at} ago +%p.time Last edited by #{link_to_member @project, @wiki.user}, #{time_ago_in_words @wiki.created_at} ago diff --git a/app/workers/gitlab_shell_worker.rb b/app/workers/gitlab_shell_worker.rb deleted file mode 100644 index cfeda88b..00000000 --- a/app/workers/gitlab_shell_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class GitlabShellWorker - include Sidekiq::Worker - include Gitlab::ShellAdapter - - sidekiq_options queue: :gitlab_shell - - def perform(action, *arg) - gitlab_shell.send(action, *arg) - end -end diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index 72cef0fd..e74379a6 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -4,44 +4,24 @@ class PostReceive sidekiq_options queue: :post_receive def perform(repo_path, oldrev, newrev, ref, identifier) - - if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s) - repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "") - else - Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"") - end - + repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "") repo_path.gsub!(/.git$/, "") repo_path.gsub!(/^\//, "") project = Project.find_with_namespace(repo_path) + return false if project.nil? - if project.nil? - Gitlab::GitLogger.error("POST-RECEIVE: Triggered hook for non-existing project with full path \"#{repo_path} \"") - return false + # Ignore push from non-gitlab users + user = if identifier.eql? Gitlab.config.gitolite.admin_key + 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) + else + Key.find_by_identifier(identifier).try(:user) end + return false unless user - user = if identifier.blank? - # Local push from gitlab - email = project.repository.commit(newrev).author.email rescue nil - User.find_by_email(email) if email - - elsif identifier =~ /\Auser-\d+\Z/ - # git push over http - user_id = identifier.gsub("user-", "") - User.find_by_id(user_id) - - elsif identifier =~ /\Akey-\d+\Z/ - # git push over ssh - key_id = identifier.gsub("key-", "") - Key.find_by_id(key_id).try(:user) - end - - unless user - Gitlab::GitLogger.error("POST-RECEIVE: Triggered hook for non-existing user \"#{identifier} \"") - return false - end - - GitPushService.new.execute(project, user, oldrev, newrev, ref) + project.trigger_post_receive(oldrev, newrev, ref, user) end end diff --git a/app/workers/project_web_hook_worker.rb b/app/workers/project_web_hook_worker.rb deleted file mode 100644 index 9f9b9b1d..00000000 --- a/app/workers/project_web_hook_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ProjectWebHookWorker - include Sidekiq::Worker - - sidekiq_options queue: :project_web_hook - - def perform(hook_id, data) - WebHook.find(hook_id).execute data - end -end diff --git a/config/database.yml.postgresql b/config/database.yml.postgresql index 4a4aa346..0e873d2b 100644 --- a/config/database.yml.postgresql +++ b/config/database.yml.postgresql @@ -6,7 +6,7 @@ production: encoding: unicode database: gitlabhq_production pool: 5 - username: git + username: postgres password: # host: localhost # port: 5432 diff --git a/config/deploy.rb.example b/config/deploy.rb.example deleted file mode 100644 index ddce4671..00000000 --- a/config/deploy.rb.example +++ /dev/null @@ -1,72 +0,0 @@ -set :domain, 'set application domain here' -set :db_adapter, 'mysql' # or postgres -set :mount_point, '/' -set :application, 'gitlabhq' -set :user, 'git' -set :rails_env, 'production' -set :deploy_to, "/home/#{user}/apps/#{application}" -set :bundle_without, %w[development test] + (%w[mysql postgres] - [db_adapter]) -set :asset_env, "RAILS_GROUPS=assets RAILS_RELATIVE_URL_ROOT=#{mount_point.sub /\/+\Z/, ''}" - -set :use_sudo, false -default_run_options[:pty] = true - -# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` -set :scm, :git -set :repository, "git@#{domain}:#{application}.git" -set :deploy_via, :remote_cache - -# Alternatively, you can deploy via copy, if you don't have gitlab in git -#set :scm, :none -#set :repository, '.' -#set :deploy_via, :copy - -server domain, :app, :web, :db, primary: true - -namespace :foreman do - desc 'Export the Procfile to Ubuntu upstart scripts' - task :export, roles: :app do - foreman_export = "foreman export upstart /etc/init -f Procfile -a #{application} -u #{user} -l #{shared_path}/log/foreman" - run "cd #{release_path} && #{sudo} #{fetch :bundle_cmd, 'bundle'} exec #{foreman_export}" - end - - desc 'Start the application services' - task :start, roles: :app do - run "#{sudo} service #{application} start" - end - - desc 'Stop the application services' - task :stop, roles: :app do - run "#{sudo} service #{application} stop" - end - - desc 'Restart the application services' - task :restart, roles: :app do - run "#{sudo} service #{application} restart" - end -end - -namespace :deploy do - desc 'Start the application services' - task :start, roles: :app do - foreman.start - end - - desc 'Stop the application services' - task :stop, roles: :app do - foreman.stop - end - - desc 'Restart the application services' - task :restart, roles: :app do - foreman.restart - end -end - -after 'deploy:cold' do - run "cd #{release_path} && #{rake} gitlab:setup force=yes RAILS_ENV=#{rails_env}" - deploy.restart -end - -after 'deploy:update', 'foreman:export' # Export foreman scripts -#after 'deploy:update', 'foreman:restart' # Restart application scripts diff --git a/config/environments/production.rb b/config/environments/production.rb index 6ae0324f..52fb8877 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -40,7 +40,7 @@ Gitlab::Application.configure do # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production - config.cache_store = :redis_store + config.cache_store = :memory_store # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 90d04b39..4b2f69ab 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -1,165 +1,133 @@ # # # # # # # # # # # # # # # # # # -# GitLab application config file # +# Gitlab application config file # # # # # # # # # # # # # # # # # # # # # How to use: # 1. copy file as gitlab.yml # 2. Replace gitlab -> host with your domain -# 3. Replace gitlab -> email_from +# 3. Replace gitolite -> ssh_host with your domain +# 4. Replace gitlab -> email_from -production: &base - # - # 1. GitLab app settings - # ========================== +# +# 1. GitLab app settings +# ========================== - ## GitLab settings - gitlab: - ## Web server settings - 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 +## GitLab settings +gitlab: + ## Web server settings + 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 - # Uncomment and customize if you can't use the default user to run GitLab (default: 'git') - # user: git + # Uncomment and customize if you can't use the default user to run GitLab (default: 'gitlab') + # user: user123 - ## Email settings - # Email address used in the "From" field in mails sent by GitLab - email_from: gitlab@localhost + ## Email settings + # Email address used in the "From" field in mails sent by GitLab + email_from: gitlab@localhost - # Email address of your support contact (default: same as email_from) - support_email: support@localhost + # Email address of your support contanct (default: same as email_from) + support_email: support@localhost - ## Project settings - default_projects_limit: 10 - # signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled. - # username_changing_enabled: false # default: true - User can change her username/namespace + ## Project settings + default_projects_limit: 10 + # signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled. + # username_changing_enabled: false # default: true - User can change her username/namespace - - ## External issues trackers - issues_tracker: - # redmine: - # ## If not nil, link 'Issues' on project page will be replaced with this - # ## Use placeholders: - # ## :project_id - GitLab project identifier - # ## :issues_tracker_id - Project Name or Id in external issue tracker - # project_url: "http://redmine.sample/projects/:issues_tracker_id" - # - # ## If not nil, links from /#\d/ entities from commit messages will replaced with this - # ## Use placeholders: - # ## :project_id - GitLab project identifier - # ## :issues_tracker_id - Project Name or Id in external issue tracker - # ## :id - Issue id (from commit messages) - # issues_url: "http://redmine.sample/issues/:id" - # - # ## If not nil, linkis to creating new issues will be replaced with this - # ## Use placeholders: - # ## :project_id - GitLab project identifier - # ## :issues_tracker_id - Project Name or Id in external issue tracker - # new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new" - - ## Gravatar - gravatar: - enabled: true # Use user avatar image from Gravatar.com (default: true) - # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm - # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm +## Gravatar +gravatar: + enabled: true # Use user avatar images from Gravatar.com (default: true) + # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm + # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm - # - # 2. Auth settings - # ========================== +# +# 2. Auth settings +# ========================== - ## LDAP settings - ldap: - enabled: false - host: '_your_ldap_server' - base: '_the_base_where_you_search_for_users' - port: 636 - uid: 'sAMAccountName' - method: 'ssl' # "ssl" or "plain" - bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' - password: '_the_password_of_the_bind_user' +## LDAP settings +ldap: + enabled: false + host: '_your_ldap_server' + base: '_the_base_where_you_search_for_users' + port: 636 + uid: 'sAMAccountName' + method: 'ssl' # "ssl" or "plain" + bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' + password: '_the_password_of_the_bind_user' - ## OmniAuth settings - omniauth: - # Allow login via Twitter, Google, etc. using OmniAuth providers - enabled: false +## Omniauth settings +omniauth: + # Enable ability for users + # Allow logging in via Twitter, Google, etc. using Omniauth providers + enabled: false - # CAUTION! - # This allows users to login without having a user account first (default: false). - # User accounts will be created automatically when authentication was successful. - allow_single_sign_on: false - # Locks down those users until they have been cleared by the admin (default: true). - block_auto_created_users: true - - ## Auth providers - # Uncomment the following lines and fill in the data of the auth provider you want to use - # If your favorite auth provider is not listed you can use others: - # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers - # The 'app_id' and 'app_secret' parameters are always passed as the first two - # arguments, followed by optional 'args' which can be either a hash or an array. - providers: - # - { name: 'google_oauth2', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET', - # args: { access_type: 'offline', approval_prompt: '' } } - # - { name: 'twitter', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET'} - # - { name: 'github', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET' } - - - - # - # 3. Advanced settings - # ========================== - - # GitLab Satellites - satellites: - # Relative paths are relative to Rails.root (default: tmp/repo_satellites/) - path: /home/git/gitlab-satellites/ - - ## Backup settings - backup: - path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) - # keep_time: 604800 # default: 0 (forever) (in seconds) - - ## GitLab Shell settings - gitlab_shell: - # REPOS_PATH MUST NOT BE A SYMLINK!!! - repos_path: /home/git/repositories/ - hooks_path: /home/git/gitlab-shell/hooks/ - - # Git over HTTP - upload_pack: true - receive_pack: true - - # If you use non-standard ssh port you need to specify it - # ssh_port: 22 - - ## Git settings # CAUTION! - # Use the default values unless you really know what you are doing - git: - bin_path: /usr/bin/git - # Max size of a git object (e.g. a commit), in bytes - # This value can be increased if you have very large commits - max_size: 5242880 # 5.megabytes - # Git timeout to read a commit, in seconds - timeout: 10 + # This allows users to login without having a user account first (default: false) + # User accounts will be created automatically when authentication was successful. + allow_single_sign_on: false + # Locks down those users until they have been cleared by the admin (default: true) + block_auto_created_users: true -development: - <<: *base + ## Auth providers + # Uncomment the lines and fill in the data of the auth provider you want to use + # If your favorite auth provider is not listed you can user others: + # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers + # The 'app_id' and 'app_secret' parameters are always passed as the first two + # arguments, followed by optional 'args' which can be either a hash or an array. + providers: + # - { name: 'google_oauth2', app_id: 'YOUR APP ID', + # app_secret: 'YOUR APP SECRET', + # args: { access_type: 'offline', approval_prompt: '' } } + # - { name: 'twitter', app_id: 'YOUR APP ID', + # app_secret: 'YOUR APP SECRET'} + # - { name: 'github', app_id: 'YOUR APP ID', + # app_secret: 'YOUR APP SECRET' } -test: - <<: *base - issues_tracker: - redmine: - project_url: "http://redmine/projects/:issues_tracker_id" - issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" - new_issue_url: "http://redmine/projects/:issues_tracker_id/insues/new" -staging: - <<: *base + +# +# 3. Advanced settings +# ========================== + +# GitLab Satellites +satellites: + # Relative paths are relative to Rails.root (default: tmp/repo_satellites/) + path: /home/gitlab/gitlab-satellites/ + +## Backup settings +backup: + path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) + # keep_time: 604800 # default: 0 (forever) (in seconds) + +## 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 + upload_pack: true + receive_pack: true + ssh_user: git + ssh_host: localhost + # ssh_port: 22 + # config_file: gitolite.conf + + # Uncomment and customize if you can't use the default group to own the repositories and run Gitolite (default: same as the 'ssh_user' above) + # owner_group: group123 + +## Git settings +# CAUTION! +# Use the default values unless you really know what you are doing +git: + bin_path: /usr/bin/git + # Max size of git object like commit, in bytes + # This value can be increased if you have a very large commits + max_size: 5242880 # 5.megabytes + # Git timeout to read commit, in seconds + timeout: 10 diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index ac35eef4..0334b35e 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -1,6 +1,5 @@ class Settings < Settingslogic source "#{Rails.root}/config/gitlab.yml" - namespace Rails.env class << self def gitlab_on_non_standard_port? @@ -9,11 +8,11 @@ class Settings < Settingslogic private - def build_gitlab_shell_ssh_path_prefix - if gitlab_shell.ssh_port != 22 - "ssh://#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:#{gitlab_shell.ssh_port}/" + def build_gitolite_ssh_path_prefix + if gitolite.ssh_port != 22 + "ssh://#{gitolite.ssh_user}@#{gitolite.ssh_host}:#{gitolite.ssh_port}/" else - "#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:" + "#{gitolite.ssh_user}@#{gitolite.ssh_host}:" end end @@ -42,57 +41,43 @@ Settings['omniauth'] ||= Settingslogic.new({}) Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil? Settings.omniauth['providers'] ||= [] -Settings['issues_tracker'] ||= {} - -# -# GitLab -# Settings['gitlab'] ||= Settingslogic.new({}) Settings.gitlab['default_projects_limit'] ||= 10 Settings.gitlab['host'] ||= 'localhost' Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 -Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || '' +Settings.gitlab['relative_url_root'] ||= '' Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" Settings.gitlab['support_email'] ||= Settings.gitlab.email_from Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) -Settings.gitlab['user'] ||= 'git' +Settings.gitlab['user'] ||= 'gitlab' Settings.gitlab['signup_enabled'] ||= false Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil? -# -# Gravatar -# Settings['gravatar'] ||= Settingslogic.new({}) Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil? 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' -# -# GitLab Shell -# -Settings['gitlab_shell'] ||= Settingslogic.new({}) -Settings.gitlab_shell['hooks_path'] ||= '/home/git/gitlab-shell/hooks/' -Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil? -Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil? -Settings.gitlab_shell['repos_path'] ||= '/home/git/repositories/' -Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.host || 'localhost') -Settings.gitlab_shell['ssh_port'] ||= 22 -Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user -Settings.gitlab_shell['owner_group'] ||= Settings.gitlab.user -Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_ssh_path_prefix) +Settings['gitolite'] ||= Settingslogic.new({}) +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'] = true if Settings.gitolite['receive_pack'].nil? +Settings.gitolite['upload_pack'] = true if Settings.gitolite['upload_pack'].nil? +Settings.gitolite['repos_path'] ||= '/home/git/repositories/' +Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost') +Settings.gitolite['ssh_port'] ||= 22 +Settings.gitolite['ssh_user'] ||= 'git' +Settings.gitolite['owner_group'] ||= Settings.gitolite.ssh_user +Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix) -# -# Backup -# Settings['backup'] ||= Settingslogic.new({}) Settings.backup['keep_time'] ||= 0 Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) -# -# Git -# Settings['git'] ||= Settingslogic.new({}) Settings.git['max_size'] ||= 5242880 # 5.megabytes Settings.git['bin_path'] ||= '/usr/bin/git' diff --git a/config/initializers/2_app.rb b/config/initializers/2_app.rb index 27a0c0ff..748f15a1 100644 --- a/config/initializers/2_app.rb +++ b/config/initializers/2_app.rb @@ -1,6 +1,6 @@ module Gitlab - VERSION = File.read(Rails.root.join("VERSION")).strip - REVISION = `git log --pretty=format:'%h' -n 1` + Version = File.read(Rails.root.join("VERSION")) + Revision = `git log --pretty=format:'%h' -n 1` def self.config Settings diff --git a/config/initializers/4_sidekiq.rb b/config/initializers/4_sidekiq.rb index c90d3762..6abe6e74 100644 --- a/config/initializers/4_sidekiq.rb +++ b/config/initializers/4_sidekiq.rb @@ -4,19 +4,19 @@ config_file = Rails.root.join('config', 'resque.yml') resque_url = if File.exists?(config_file) YAML.load_file(config_file)[Rails.env] else - "redis://localhost:6379" + "localhost:6379" end Sidekiq.configure_server do |config| config.redis = { - url: resque_url, + url: "redis://#{resque_url}", namespace: 'resque:gitlab' } end Sidekiq.configure_client do |config| config.redis = { - url: resque_url, + url: "redis://#{resque_url}", namespace: 'resque:gitlab' } end diff --git a/config/initializers/5_backend.rb b/config/initializers/5_backend.rb index 7c2e7f39..85f747ac 100644 --- a/config/initializers/5_backend.rb +++ b/config/initializers/5_backend.rb @@ -1,8 +1,5 @@ # GIT over HTTP require Rails.root.join("lib", "gitlab", "backend", "grack_auth") -# GIT over SSH -require Rails.root.join("lib", "gitlab", "backend", "shell") - -# GitLab shell adapter -require Rails.root.join("lib", "gitlab", "backend", "shell_adapter") +# GITOLITE backend +require Rails.root.join("lib", "gitlab", "backend", "gitolite") diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5714407f..97946c54 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -23,7 +23,7 @@ Devise.setup do |config| # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. - config.authentication_keys = [ :login ] + # config.authentication_keys = [ :email ] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the @@ -99,7 +99,7 @@ Devise.setup do |config| # ==> Configuration for :validatable # Range for password length. Default is 6..128. - config.password_length = 6..128 + # config.password_length = 6..128 # Email regex used to validate email formats. It simply asserts that # an one (and only one) @ exists in the given string. This is mainly diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 275273a0..3b763cf4 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -17,7 +17,6 @@ en: unauthenticated: 'You need to sign in before continuing.' unconfirmed: 'You have to confirm your account before continuing.' locked: 'Your account is locked.' - not_found_in_database: 'Invalid email or password.' invalid: 'Invalid email or password.' invalid_token: 'Invalid authentication token.' timeout: 'Your session expired, please sign in again to continue.' diff --git a/config/resque.yml.example b/config/resque.yml.example index 3c7ad0e5..cd3d4874 100644 --- a/config/resque.yml.example +++ b/config/resque.yml.example @@ -1,3 +1,3 @@ -development: redis://localhost:6379 -test: redis://localhost:6379 -production: redis://redis.example.com:6379 +development: localhost:6379 +test: localhost:6379 +production: redis.example.com:6379 diff --git a/config/routes.rb b/config/routes.rb index 61a604b9..00ff3f63 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,7 +8,6 @@ Gitlab::Application.routes.draw do # API require 'api' - Gitlab::API.logger Rails.logger mount Gitlab::API => '/api' constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin? } @@ -19,10 +18,10 @@ Gitlab::Application.routes.draw do # Enable Grack support mount Grack::Bundle.new({ git_path: Gitlab.config.git.bin_path, - project_root: Gitlab.config.gitlab_shell.repos_path, - upload_pack: Gitlab.config.gitlab_shell.upload_pack, - receive_pack: Gitlab.config.gitlab_shell.receive_pack - }), at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) } + project_root: Gitlab.config.gitolite.repos_path, + upload_pack: Gitlab.config.gitolite.upload_pack, + receive_pack: Gitlab.config.gitolite.receive_pack + }), at: '/', constraints: lambda { |request| /[-\/\w\.-]+\.git\//.match(request.path_info) } # # Help @@ -46,23 +45,17 @@ Gitlab::Application.routes.draw do root to: "projects#index" end - # - # Attachments serving - # - get 'files/:type/:id/:filename' => 'files#download', constraints: { id: /\d+/, type: /[a-z]+/, filename: /.+/ } - # # Admin Area # namespace :admin do - resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do + resources :users do member do put :team_update put :block put :unblock end end - resources :groups, constraints: { id: /[^\/]+/ } do member do put :project_update @@ -70,27 +63,18 @@ Gitlab::Application.routes.draw do delete :remove_project end end - - resources :teams, constraints: { id: /[^\/]+/ } do - scope module: :teams do - resources :members, only: [:edit, :update, :destroy, :new, :create] - resources :projects, only: [:edit, :update, :destroy, :new, :create], constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } + resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do + member do + get :team + put :team_update end end - + resources :team_members, only: [:edit, :update, :destroy] resources :hooks, only: [:index, :create, :destroy] do get :test end - resource :logs, only: [:show] resource :resque, controller: 'resque', only: [:show] - - resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do - scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do - resources :members, only: [:edit, :update, :destroy] - end - end - root to: "dashboard#index" end @@ -110,30 +94,22 @@ Gitlab::Application.routes.draw do put :reset_private_token put :update_username end - - resource :notifications end resources :keys - match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ } - - # # Dashboard Area # - resource :dashboard, controller: "dashboard" do - member do - get :projects - get :issues - get :merge_requests - end - end + get "dashboard" => "dashboard#index" + get "dashboard/issues" => "dashboard#issues" + get "dashboard/merge_requests" => "dashboard#merge_requests" + # # Groups Area # - resources :groups, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} do + resources :groups, constraints: { id: /[^\/]+/ }, only: [:show] do member do get :issues get :merge_requests @@ -143,20 +119,6 @@ Gitlab::Application.routes.draw do end end - # - # Teams Area - # - resources :teams, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} do - member do - get :issues - get :merge_requests - end - scope module: :teams do - resources :members, only: [:index, :new, :create, :edit, :update, :destroy] - resources :projects, only: [:index, :new, :create, :edit, :update, :destroy], constraints: { id: /[a-zA-Z.0-9_\-\/]+/ } - end - end - resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create] devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations } @@ -164,27 +126,25 @@ Gitlab::Application.routes.draw do # # Project Area # - resources :projects, constraints: { id: /(?:[a-zA-Z.0-9_\-]+\/)?[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 - put :transfer + get "wall" + get "graph" + get "files" end - resources :blob, only: [:show], constraints: {id: /.+/} - resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ } - resources :edit_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'edit' + resources :tree, only: [:show, :edit, :update], constraints: {id: /.+/} resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} - resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} + resources :commits, only: [:show], constraints: {id: /.+/} resources :compare, only: [:index, :create] resources :blame, only: [:show], constraints: {id: /.+/} - resources :graph, only: [:show], constraints: {id: /(?:[^.]|\.(?!json$))+/, format: /json/} + 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 - put ':id' => 'wikis#update' - get :git_access end member do @@ -192,12 +152,6 @@ Gitlab::Application.routes.draw do end end - resource :wall, only: [:show] do - member do - get 'notes' - end - end - resource :repository do member do get "branches" @@ -281,18 +235,6 @@ Gitlab::Application.routes.draw do end end - scope module: :projects do - resources :teams, only: [] do - collection do - get :available - post :assign - end - member do - delete :resign - end - end - end - resources :notes, only: [:index, :create, :destroy] do collection do post :preview @@ -300,5 +242,5 @@ Gitlab::Application.routes.draw do end end - root to: "dashboard#show" + root to: "dashboard#index" end diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index 75945182..4852cd65 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -2,7 +2,7 @@ # note that config/gitlab.yml web path should also be changed # ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" -app_dir = File.expand_path '../../', __FILE__ +app_dir = "/home/gitlab/gitlab/" worker_processes 2 working_directory app_dir @@ -30,7 +30,7 @@ end before_fork do |server, worker| - # the following is highly recommended for Rails + "preload_app true" + # the following is highly recomended for Rails + "preload_app true" # as there's no need for the master process to hold a connection defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! diff --git a/db/fixtures/development/01_admin.rb b/db/fixtures/development/001_admin.rb similarity index 100% rename from db/fixtures/development/01_admin.rb rename to db/fixtures/development/001_admin.rb diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/002_project.rb similarity index 81% rename from db/fixtures/development/04_project.rb rename to db/fixtures/development/002_project.rb index 9904c48e..e50ab5d9 100644 --- a/db/fixtures/development/04_project.rb +++ b/db/fixtures/development/002_project.rb @@ -1,3 +1,9 @@ +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, [ # Global diff --git a/db/fixtures/development/05_users.rb b/db/fixtures/development/003_users.rb similarity index 100% rename from db/fixtures/development/05_users.rb rename to db/fixtures/development/003_users.rb diff --git a/db/fixtures/development/06_teams.rb b/db/fixtures/development/004_teams.rb similarity index 66% rename from db/fixtures/development/06_teams.rb rename to db/fixtures/development/004_teams.rb index 9fbf21a0..7a8f9139 100644 --- a/db/fixtures/development/06_teams.rb +++ b/db/fixtures/development/004_teams.rb @@ -1,3 +1,5 @@ +UsersProject.skip_callback(:save, :after, :update_repository) + Gitlab::Seeder.quiet do (1..300).each do |i| @@ -19,4 +21,9 @@ Gitlab::Seeder.quiet do print('.') end end + +UsersProject.set_callback(:save, :after, :update_repository) + +puts "\nRebuild gitolite\n".yellow +Project.all.each(&:update_repository) puts "OK".green diff --git a/db/fixtures/development/07_milestones.rb b/db/fixtures/development/005_milestones.rb similarity index 100% rename from db/fixtures/development/07_milestones.rb rename to db/fixtures/development/005_milestones.rb diff --git a/db/fixtures/development/08_wall.rb b/db/fixtures/development/006_wall.rb similarity index 100% rename from db/fixtures/development/08_wall.rb rename to db/fixtures/development/006_wall.rb diff --git a/db/fixtures/development/09_issues.rb b/db/fixtures/development/007_issues.rb similarity index 91% rename from db/fixtures/development/09_issues.rb rename to db/fixtures/development/007_issues.rb index cd9b2b3e..8978db47 100644 --- a/db/fixtures/development/09_issues.rb +++ b/db/fixtures/development/007_issues.rb @@ -16,7 +16,7 @@ Gitlab::Seeder.quiet do project_id: project.id, author_id: user_id, assignee_id: user_id, - state: ['opened', 'closed'].sample, + closed: [true, false].sample, milestone: project.milestones.sample, title: Faker::Lorem.sentence(6) }]) diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/008_merge_requests.rb similarity index 92% rename from db/fixtures/development/10_merge_requests.rb rename to db/fixtures/development/008_merge_requests.rb index 6d111b26..9904b4a1 100644 --- a/db/fixtures/development/10_merge_requests.rb +++ b/db/fixtures/development/008_merge_requests.rb @@ -17,7 +17,7 @@ Gitlab::Seeder.quiet do project_id: project.id, author_id: user_id, assignee_id: user_id, - state: ['opened', 'closed'].sample, + closed: [true, false].sample, milestone: project.milestones.sample, title: Faker::Lorem.sentence(6) }]) diff --git a/db/fixtures/development/02_source_code.rb b/db/fixtures/development/009_source_code.rb similarity index 66% rename from db/fixtures/development/02_source_code.rb rename to db/fixtures/development/009_source_code.rb index a0a46c9e..a64b905e 100644 --- a/db/fixtures/development/02_source_code.rb +++ b/db/fixtures/development/009_source_code.rb @@ -1,4 +1,4 @@ -root = Gitlab.config.gitlab_shell.repos_path +root = Gitlab.config.gitolite.repos_path projects = [ { path: 'underscore.git', git: 'https://github.com/documentcloud/underscore.git' }, @@ -13,17 +13,19 @@ projects = [ projects.each do |project| project_path = File.join(root, project[:path]) - if File.exists?(project_path) - print '-' - next - end + next if File.exists?(project_path) - if system("/home/git/gitlab-shell/bin/gitlab-projects import-project #{project[:path]} #{project[:git]}") - print '.' - else - print 'F' + cmds = [ + "cd #{root} && sudo -u git -H git clone --bare #{project[:git]} ./#{project[:path]}", + "sudo ln -s ./lib/hooks/post-receive #{project_path}/hooks/post-receive", + "sudo chown git:git -R #{project_path}", + "sudo chmod 770 -R #{project_path}", + ] + + cmds.each do |cmd| + puts cmd.yellow + `#{cmd}` end end puts "OK".green - diff --git a/db/fixtures/development/11_keys.rb b/db/fixtures/development/010_keys.rb similarity index 100% rename from db/fixtures/development/11_keys.rb rename to db/fixtures/development/010_keys.rb diff --git a/db/fixtures/development/03_group.rb b/db/fixtures/development/03_group.rb deleted file mode 100644 index 01174a4b..00000000 --- a/db/fixtures/development/03_group.rb +++ /dev/null @@ -1,5 +0,0 @@ -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 }, -]) diff --git a/db/migrate/20121219183753_create_user_teams.rb b/db/migrate/20121219183753_create_user_teams.rb deleted file mode 100644 index 65c4d053..00000000 --- a/db/migrate/20121219183753_create_user_teams.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUserTeams < ActiveRecord::Migration - def change - create_table :user_teams do |t| - t.string :name - t.string :path - t.integer :owner_id - - t.timestamps - end - end -end diff --git a/db/migrate/20121220064104_create_user_team_project_relationships.rb b/db/migrate/20121220064104_create_user_team_project_relationships.rb deleted file mode 100644 index 8eb654c8..00000000 --- a/db/migrate/20121220064104_create_user_team_project_relationships.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUserTeamProjectRelationships < ActiveRecord::Migration - def change - create_table :user_team_project_relationships do |t| - t.integer :project_id - t.integer :user_team_id - t.integer :greatest_access - - t.timestamps - end - end -end diff --git a/db/migrate/20121220064453_create_user_team_user_relationships.rb b/db/migrate/20121220064453_create_user_team_user_relationships.rb deleted file mode 100644 index 7783b0ae..00000000 --- a/db/migrate/20121220064453_create_user_team_user_relationships.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateUserTeamUserRelationships < ActiveRecord::Migration - def change - create_table :user_team_user_relationships do |t| - t.integer :user_id - t.integer :user_team_id - t.boolean :group_admin - t.integer :permission - - t.timestamps - end - end -end diff --git a/db/migrate/20130123114545_add_issues_tracker_to_project.rb b/db/migrate/20130123114545_add_issues_tracker_to_project.rb deleted file mode 100644 index 288d0f07..00000000 --- a/db/migrate/20130123114545_add_issues_tracker_to_project.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIssuesTrackerToProject < ActiveRecord::Migration - def change - add_column :projects, :issues_tracker, :string, default: :gitlab, null: false - end -end diff --git a/db/migrate/20130125090214_add_user_permissions.rb b/db/migrate/20130125090214_add_user_permissions.rb deleted file mode 100644 index 38b5f439..00000000 --- a/db/migrate/20130125090214_add_user_permissions.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddUserPermissions < ActiveRecord::Migration - def up - add_column :users, :can_create_group, :boolean, default: true, null: false - add_column :users, :can_create_team, :boolean, default: true, null: false - end - - def down - remove_column :users, :can_create_group - remove_column :users, :can_create_team - end -end diff --git a/db/migrate/20130131070232_remove_private_flag_from_project.rb b/db/migrate/20130131070232_remove_private_flag_from_project.rb deleted file mode 100644 index 5754db11..00000000 --- a/db/migrate/20130131070232_remove_private_flag_from_project.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemovePrivateFlagFromProject < ActiveRecord::Migration - def up - remove_column :projects, :private_flag - end - - def down - add_column :projects, :private_flag, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20130206084024_add_description_to_namsespace.rb b/db/migrate/20130206084024_add_description_to_namsespace.rb deleted file mode 100644 index ef02e489..00000000 --- a/db/migrate/20130206084024_add_description_to_namsespace.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDescriptionToNamsespace < ActiveRecord::Migration - def change - add_column :namespaces, :description, :string, default: '', null: false - end -end diff --git a/db/migrate/20130207104426_add_description_to_teams.rb b/db/migrate/20130207104426_add_description_to_teams.rb deleted file mode 100644 index 6d037779..00000000 --- a/db/migrate/20130207104426_add_description_to_teams.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDescriptionToTeams < ActiveRecord::Migration - def change - add_column :user_teams, :description, :string, default: '', null: false - end -end diff --git a/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb b/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb deleted file mode 100644 index 71763d18..00000000 --- a/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIssuesTrackerIdToProject < ActiveRecord::Migration - def change - add_column :projects, :issues_tracker_id, :string - end -end diff --git a/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb b/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb deleted file mode 100644 index 23797fe1..00000000 --- a/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration - def change - rename_column :merge_requests, :state, :merge_status - end -end diff --git a/db/migrate/20130218140952_add_state_to_issue.rb b/db/migrate/20130218140952_add_state_to_issue.rb deleted file mode 100644 index 062103d0..00000000 --- a/db/migrate/20130218140952_add_state_to_issue.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStateToIssue < ActiveRecord::Migration - def change - add_column :issues, :state, :string - end -end diff --git a/db/migrate/20130218141038_add_state_to_merge_request.rb b/db/migrate/20130218141038_add_state_to_merge_request.rb deleted file mode 100644 index ac4108ee..00000000 --- a/db/migrate/20130218141038_add_state_to_merge_request.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStateToMergeRequest < ActiveRecord::Migration - def change - add_column :merge_requests, :state, :string - end -end diff --git a/db/migrate/20130218141117_add_state_to_milestone.rb b/db/migrate/20130218141117_add_state_to_milestone.rb deleted file mode 100644 index c8403910..00000000 --- a/db/migrate/20130218141117_add_state_to_milestone.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStateToMilestone < ActiveRecord::Migration - def change - add_column :milestones, :state, :string - end -end diff --git a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb b/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb deleted file mode 100644 index 9fa96203..00000000 --- a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ConvertClosedToStateInIssue < ActiveRecord::Migration - def up - Issue.transaction do - Issue.where(closed: true).update_all(state: :closed) - Issue.where(closed: false).update_all(state: :opened) - end - end - - def down - Issue.transaction do - Issue.where(state: :closed).update_all(closed: true) - end - end -end diff --git a/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb b/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb deleted file mode 100644 index ebb7ae58..00000000 --- a/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb +++ /dev/null @@ -1,16 +0,0 @@ -class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration - def up - MergeRequest.transaction do - MergeRequest.where(closed: true, merged: true).update_all(state: :merged) - MergeRequest.where(closed: true, merged: false).update_all(state: :closed) - MergeRequest.where(closed: false).update_all(state: :opened) - end - end - - def down - MergeRequest.transaction do - MergeRequest.where(state: :closed).update_all(closed: true) - MergeRequest.where(state: :merged).update_all(closed: true, merged: true) - end - end -end diff --git a/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb b/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb deleted file mode 100644 index 1978ea89..00000000 --- a/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ConvertClosedToStateInMilestone < ActiveRecord::Migration - def up - Milestone.transaction do - Milestone.where(closed: true).update_all(state: :closed) - Milestone.where(closed: false).update_all(state: :active) - end - end - - def down - Milestone.transaction do - Milestone.where(state: :closed).update_all(closed: true) - end - end -end diff --git a/db/migrate/20130218141444_remove_merged_from_merge_request.rb b/db/migrate/20130218141444_remove_merged_from_merge_request.rb deleted file mode 100644 index a7bd82f5..00000000 --- a/db/migrate/20130218141444_remove_merged_from_merge_request.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveMergedFromMergeRequest < ActiveRecord::Migration - def up - remove_column :merge_requests, :merged - end - - def down - add_column :merge_requests, :merged, :boolean, default: true, null: false - end -end diff --git a/db/migrate/20130218141507_remove_closed_from_issue.rb b/db/migrate/20130218141507_remove_closed_from_issue.rb deleted file mode 100644 index 95cc0642..00000000 --- a/db/migrate/20130218141507_remove_closed_from_issue.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveClosedFromIssue < ActiveRecord::Migration - def up - remove_column :issues, :closed - end - - def down - add_column :issues, :closed, :boolean - end -end diff --git a/db/migrate/20130218141536_remove_closed_from_merge_request.rb b/db/migrate/20130218141536_remove_closed_from_merge_request.rb deleted file mode 100644 index 37183593..00000000 --- a/db/migrate/20130218141536_remove_closed_from_merge_request.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveClosedFromMergeRequest < ActiveRecord::Migration - def up - remove_column :merge_requests, :closed - end - - def down - add_column :merge_requests, :closed, :boolean - end -end diff --git a/db/migrate/20130218141554_remove_closed_from_milestone.rb b/db/migrate/20130218141554_remove_closed_from_milestone.rb deleted file mode 100644 index e8dae4a1..00000000 --- a/db/migrate/20130218141554_remove_closed_from_milestone.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveClosedFromMilestone < ActiveRecord::Migration - def up - remove_column :milestones, :closed - end - - def down - add_column :milestones, :closed, :boolean - end -end diff --git a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb b/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb deleted file mode 100644 index d78bd0ae..00000000 --- a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration - def change - add_column :merge_requests, :new_merge_status, :string - end -end diff --git a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb b/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb deleted file mode 100644 index b310b35e..00000000 --- a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb +++ /dev/null @@ -1,17 +0,0 @@ -class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration - def up - MergeRequest.transaction do - MergeRequest.where(merge_status: 1).update_all("new_merge_status = 'unchecked'") - MergeRequest.where(merge_status: 2).update_all("new_merge_status = 'can_be_merged'") - MergeRequest.where(merge_status: 3).update_all("new_merge_status = 'cannot_be_merged'") - end - end - - def down - MergeRequest.transaction do - MergeRequest.where(new_merge_status: :unchecked).update_all("merge_status = 1") - MergeRequest.where(new_merge_status: :can_be_merged).update_all("merge_status = 2") - MergeRequest.where(new_merge_status: :cannot_be_merged).update_all("merge_status = 3") - end - end -end diff --git a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb b/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb deleted file mode 100644 index 9083183b..00000000 --- a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration - def up - remove_column :merge_requests, :merge_status - end - - def down - add_column :merge_requests, :merge_status, :integer - end -end diff --git a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb b/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb deleted file mode 100644 index 3f8f38dc..00000000 --- a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration - def change - rename_column :merge_requests, :new_merge_status, :merge_status - end -end diff --git a/db/migrate/20130304104623_add_state_to_user.rb b/db/migrate/20130304104623_add_state_to_user.rb deleted file mode 100644 index 8154c210..00000000 --- a/db/migrate/20130304104623_add_state_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStateToUser < ActiveRecord::Migration - def change - add_column :users, :state, :string - end -end diff --git a/db/migrate/20130304104740_convert_blocked_to_state.rb b/db/migrate/20130304104740_convert_blocked_to_state.rb deleted file mode 100644 index e8d5257a..00000000 --- a/db/migrate/20130304104740_convert_blocked_to_state.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ConvertBlockedToState < ActiveRecord::Migration - def up - User.transaction do - User.where(blocked: true).update_all(state: :blocked) - User.where(blocked: false).update_all(state: :active) - end - end - - def down - User.transaction do - User.where(state: :blocked).update_all(blocked: :true) - end - end -end diff --git a/db/migrate/20130304105317_remove_blocked_from_user.rb b/db/migrate/20130304105317_remove_blocked_from_user.rb deleted file mode 100644 index e0104745..00000000 --- a/db/migrate/20130304105317_remove_blocked_from_user.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveBlockedFromUser < ActiveRecord::Migration - def up - remove_column :users, :blocked - end - - def down - add_column :users, :blocked, :boolean - end -end diff --git a/db/migrate/20130315124931_user_color_scheme.rb b/db/migrate/20130315124931_user_color_scheme.rb deleted file mode 100644 index fe139e32..00000000 --- a/db/migrate/20130315124931_user_color_scheme.rb +++ /dev/null @@ -1,12 +0,0 @@ -class UserColorScheme < ActiveRecord::Migration - def up - add_column :users, :color_scheme_id, :integer, null: false, default: 1 - User.where(dark_scheme: true).update_all(color_scheme_id: 2) - remove_column :users, :dark_scheme - end - - def down - add_column :users, :dark_scheme, :boolean, null: false, default: false - remove_column :users, :color_scheme_id - end -end diff --git a/db/migrate/20130318212250_add_snippets_to_features.rb b/db/migrate/20130318212250_add_snippets_to_features.rb deleted file mode 100644 index ad0b4434..00000000 --- a/db/migrate/20130318212250_add_snippets_to_features.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSnippetsToFeatures < ActiveRecord::Migration - def change - add_column :projects, :snippets_enabled, :boolean, null: false, default: true - end -end diff --git a/db/migrate/20130325173941_add_notification_level_to_user.rb b/db/migrate/20130325173941_add_notification_level_to_user.rb deleted file mode 100644 index 9f466e38..00000000 --- a/db/migrate/20130325173941_add_notification_level_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNotificationLevelToUser < ActiveRecord::Migration - def change - add_column :users, :notification_level, :integer, null: false, default: 1 - end -end diff --git a/db/schema.rb b/db/schema.rb index 3c8b9eae..4b3a2243 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 => 20130325173941) do +ActiveRecord::Schema.define(:version => 20130110172407) do create_table "events", :force => true do |t| t.string "target_type" @@ -37,17 +37,18 @@ ActiveRecord::Schema.define(:version => 20130325173941) do t.integer "assignee_id" t.integer "author_id" t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "closed", :default => false, :null => false t.integer "position", :default => 0 t.string "branch_name" t.text "description" t.integer "milestone_id" - t.string "state" end add_index "issues", ["assignee_id"], :name => "index_issues_on_assignee_id" add_index "issues", ["author_id"], :name => "index_issues_on_author_id" + add_index "issues", ["closed"], :name => "index_issues_on_closed" add_index "issues", ["created_at"], :name => "index_issues_on_created_at" add_index "issues", ["milestone_id"], :name => "index_issues_on_milestone_id" add_index "issues", ["project_id"], :name => "index_issues_on_project_id" @@ -68,23 +69,25 @@ ActiveRecord::Schema.define(:version => 20130325173941) do add_index "keys", ["user_id"], :name => "index_keys_on_user_id" create_table "merge_requests", :force => true do |t| - t.string "target_branch", :null => false - t.string "source_branch", :null => false - t.integer "project_id", :null => false + t.string "target_branch", :null => false + t.string "source_branch", :null => false + t.integer "project_id", :null => false t.integer "author_id" t.integer "assignee_id" t.string "title" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.boolean "closed", :default => false, :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "st_commits", :limit => 2147483647 t.text "st_diffs", :limit => 2147483647 + t.boolean "merged", :default => false, :null => false + t.integer "state", :default => 1, :null => false t.integer "milestone_id" - t.string "state" - t.string "merge_status" end add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" + add_index "merge_requests", ["closed"], :name => "index_merge_requests_on_closed" add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id" @@ -93,26 +96,25 @@ ActiveRecord::Schema.define(:version => 20130325173941) do add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" create_table "milestones", :force => true do |t| - t.string "title", :null => false - t.integer "project_id", :null => false + t.string "title", :null => false + t.integer "project_id", :null => false t.text "description" t.date "due_date" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "state" + t.boolean "closed", :default => false, :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" create_table "namespaces", :force => true do |t| - t.string "name", :null => false - t.string "path", :null => false - t.integer "owner_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.string "name", :null => false + t.string "path", :null => false + t.integer "owner_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "type" - t.string "description", :default => "", :null => false end add_index "namespaces", ["name"], :name => "index_namespaces_on_name" @@ -143,19 +145,17 @@ ActiveRecord::Schema.define(:version => 20130325173941) do t.string "name" t.string "path" t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "private_flag", :default => true, :null => false t.integer "creator_id" t.string "default_branch" - t.boolean "issues_enabled", :default => true, :null => false - t.boolean "wall_enabled", :default => true, :null => false - t.boolean "merge_requests_enabled", :default => true, :null => false - t.boolean "wiki_enabled", :default => true, :null => false + t.boolean "issues_enabled", :default => true, :null => false + t.boolean "wall_enabled", :default => true, :null => false + t.boolean "merge_requests_enabled", :default => true, :null => false + t.boolean "wiki_enabled", :default => true, :null => false t.integer "namespace_id" - t.boolean "public", :default => false, :null => false - t.string "issues_tracker", :default => "gitlab", :null => false - t.string "issues_tracker_id" - t.boolean "snippets_enabled", :default => true, :null => false + t.boolean "public", :default => false, :null => false end add_index "projects", ["creator_id"], :name => "index_projects_on_owner_id" @@ -213,32 +213,6 @@ ActiveRecord::Schema.define(:version => 20130325173941) do t.string "name" end - create_table "user_team_project_relationships", :force => true do |t| - t.integer "project_id" - t.integer "user_team_id" - t.integer "greatest_access" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_team_user_relationships", :force => true do |t| - t.integer "user_id" - t.integer "user_team_id" - t.boolean "group_admin" - t.integer "permission" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "user_teams", :force => true do |t| - t.string "name" - t.string "path" - t.integer "owner_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "description", :default => "", :null => false - end - create_table "users", :force => true do |t| t.string "email", :default => "", :null => false t.string "encrypted_password", :default => "", :null => false @@ -259,21 +233,19 @@ ActiveRecord::Schema.define(:version => 20130325173941) do t.string "linkedin", :default => "", :null => false t.string "twitter", :default => "", :null => false t.string "authentication_token" + t.boolean "dark_scheme", :default => false, :null => false t.integer "theme_id", :default => 1, :null => false t.string "bio" + t.boolean "blocked", :default => false, :null => false t.integer "failed_attempts", :default => 0 t.datetime "locked_at" t.string "extern_uid" t.string "provider" t.string "username" - t.boolean "can_create_group", :default => true, :null => false - t.boolean "can_create_team", :default => true, :null => false - t.string "state" - t.integer "color_scheme_id", :default => 1, :null => false - t.integer "notification_level", :default => 1, :null => false end add_index "users", ["admin"], :name => "index_users_on_admin" + add_index "users", ["blocked"], :name => "index_users_on_blocked" add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true add_index "users", ["name"], :name => "index_users_on_name" diff --git a/doc/api/README.md b/doc/api/README.md index c4d44c52..477429c9 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -1,6 +1,6 @@ # GitLab API -All API requests require authentication. You need to pass a `private_token` parameter by url or header. If passed as header, the header name must be "PRIVATE-TOKEN" (capital and with dash instead of underscore). You can find or reset your private token in your profile. +All API requests require authentication. You need to pass a `private_token` parameter by url or header. You can find or reset your private token in your profile. If no, or an invalid, `private_token` is provided then an error message will be returned with status code 401: @@ -10,7 +10,7 @@ If no, or an invalid, `private_token` is provided then an error message will be } ``` -API requests should be prefixed with `api` and the API version. The API version is defined in `lib/api.rb`. +API requests should be prefixed with `api` and the API version. The API version is equal to the GitLab major version number, which is defined in `lib/api.rb`. Example of a valid API request: @@ -18,48 +18,8 @@ Example of a valid API request: GET http://example.com/api/v3/projects?private_token=QVy1PB7sTxfy4pqfZM1U ``` -Example for a valid API request using curl and authentication via header: - -``` -curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/projects" -``` - - The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL. - - -## Status codes - -The API is designed to return different status codes according to context and action. In this way -if a request results in an error the caller is able to get insight into what went wrong, e.g. -status code `400 Bad Request` is returned if a required attribute is missing from the request. -The following list gives an overview of how the API functions generally behave. - -API request types: - -* `GET` requests access one or more resources and return the result as JSON -* `POST` requests return `201 Created` if the resource is successfully created and return the newly created resource as JSON -* `GET`, `PUT` and `DELETE` return `200 Ok` if the resource is accessed, modified or deleted successfully, the (modified) result is returned as JSON -* `DELETE` requests are designed to be idempotent, meaning a request a resource still returns `200 Ok` even it was deleted before or is not available. The reasoning behind it is the user is not really interested if the resource existed before or not. - - -The following list shows the possible return codes for API requests. - -Return values: - -* `200 Ok` - The `GET`, `PUT` or `DELETE` request was successful, the resource(s) itself is returned as JSON -* `201 Created` - The `POST` request was successful and the resource is returned as JSON -* `400 Bad Request` - A required attribute of the API request is missing, e.g. the title of an issue is not given -* `401 Unauthorized` - The user is not authenticated, a valid user token is necessary, see above -* `403 Forbidden` - The request is not allowed, e.g. the user is not allowed to delete a project -* `404 Not Found` - A resource could not be accessed, e.g. an ID for a resource could not be found -* `405 Method Not Allowed` - The request is not supported -* `409 Conflict` - A conflicting resource already exists, e.g. creating a project with a name that already exists -* `500 Server Error` - While handling the request something went wrong on the server side - - - #### Pagination When listing resources you can pass the following parameters: @@ -72,10 +32,8 @@ When listing resources you can pass the following parameters: + [Users](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/users.md) + [Session](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/session.md) + [Projects](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md) -+ [Groups](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/groups.md) + [Snippets](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/snippets.md) + [Repositories](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repositories.md) + [Issues](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/issues.md) + [Milestones](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/milestones.md) + [Notes](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/notes.md) -+ [System Hooks](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/system_hooks.md) diff --git a/doc/api/groups.md b/doc/api/groups.md deleted file mode 100644 index e9702ea2..00000000 --- a/doc/api/groups.md +++ /dev/null @@ -1,57 +0,0 @@ -## List project groups - -Get a list of groups. (As user: my groups, as admin: all groups) - -``` -GET /groups -``` - -```json -[ - { - "id": 1, - "name": "Foobar Group", - "path": "foo-bar", - "owner_id": 18 - } -] -``` - - -## Details of a group - -Get all details of a group. - -``` -GET /groups/:id -``` - -Parameters: - -+ `id` (required) - The ID of a group - - -## New group - -Creates a new project group. Available only for admin. - -``` -POST /groups -``` - -Parameters: - -+ `name` (required) - The name of the group -+ `path` (required) - The path of the group - -## Transfer project to group - -Transfer a project to the Group namespace. Available only for admin - -``` -POST /groups/:id/projects/:project_id -``` - -Parameters: -+ `id` (required) - The ID of a group -+ `project_id (required) - The ID of a project diff --git a/doc/api/issues.md b/doc/api/issues.md index a8ae7401..0383b676 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -1,7 +1,6 @@ ## List issues -Get all issues created by authenticed user. This function takes pagination parameters -`page` and `per_page` to restrict the list of issues. +Get all issues created by authenticed user. ``` GET /issues @@ -69,11 +68,9 @@ GET /issues ] ``` - ## List project issues -Get a list of project issues. This function accepts pagination parameters `page` and `per_page` -to return the list of project issues. +Get a list of project issues. ``` GET /projects/:id/issues @@ -83,10 +80,9 @@ Parameters: + `id` (required) - The ID of a project - ## Single issue -Gets a single project issue. +Get a project issue. ``` GET /projects/:id/issues/:issue_id @@ -137,10 +133,9 @@ Parameters: } ``` - ## New issue -Creates a new project issue. +Create a new project issue. ``` POST /projects/:id/issues @@ -155,10 +150,11 @@ Parameters: + `milestone_id` (optional) - The ID of a milestone to assign issue + `labels` (optional) - Comma-separated label names for an issue +Will return created issue with status `201 Created` on success, or `404 Not found` on fail. ## Edit issue -Updates an existing project issue. This function is also used to mark an issue as closed. +Update an existing project issue. ``` PUT /projects/:id/issues/:issue_id @@ -175,19 +171,5 @@ Parameters: + `labels` (optional) - Comma-separated label names for an issue + `closed` (optional) - The state of an issue (0 = false, 1 = true) - -## Delete existing issue (**Deprecated**) - -The function is deprecated and returns a `405 Method Not Allowed` -error if called. An issue gets now closed and is done by calling `PUT /projects/:id/issues/:issue_id` with -parameter `closed` set to 1. - -``` -DELETE /projects/:id/issues/:issue_id -``` - -Parameters: - -+ `id` (required) - The project ID -+ `issue_id` (required) - The ID of the issue +Will return updated issue with status `200 OK` on success, or `404 Not found` on fail. diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 111c5211..525c55d1 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -1,7 +1,6 @@ ## List merge requests -Get all merge requests for this project. This function takes pagination parameters -`page` and `per_page` to restrict the list of merge requests. +Get all MR for this project. ``` GET /projects/:id/merge_requests @@ -41,10 +40,9 @@ Parameters: ] ``` +## Show MR -## Get single MR - -Shows information about a single merge request. +Show information about MR. ``` GET /projects/:id/merge_request/:merge_request_id @@ -86,7 +84,7 @@ Parameters: ## Create MR -Creates a new merge request. +Create MR. ``` POST /projects/:id/merge_requests @@ -128,10 +126,9 @@ Parameters: } ``` - ## Update MR -Updates an existing merge request. You can change branches, title, or even close the MR. +Update MR. You can change branches, title, or even close the MR. ``` PUT /projects/:id/merge_request/:merge_request_id @@ -175,11 +172,9 @@ Parameters: } } ``` - - ## Post comment to MR -Adds a comment to a merge request. +Post comment to MR ``` POST /projects/:id/merge_request/:merge_request_id/comments @@ -188,9 +183,10 @@ POST /projects/:id/merge_request/:merge_request_id/comments Parameters: + `id` (required) - The ID of a project -+ `merge_request_id` (required) - ID of merge request ++ `merge_request_id` (required) - ID of MR + `note` (required) - Text of comment +Will return created note with status `201 Created` on success, or `404 Not found` on fail. ```json { diff --git a/doc/api/milestones.md b/doc/api/milestones.md index 92a29cee..b997e839 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -1,6 +1,6 @@ ## List project milestones -Returns a list of project milestones. +Get a list of project milestones. ``` GET /projects/:id/milestones @@ -10,10 +10,9 @@ Parameters: + `id` (required) - The ID of a project +## Single milestone -## Get single milestone - -Gets a single project milestone. +Get a single project milestone. ``` GET /projects/:id/milestones/:milestone_id @@ -24,10 +23,9 @@ Parameters: + `id` (required) - The ID of a project + `milestone_id` (required) - The ID of a project milestone +## New milestone -## Create new milestone - -Creates a new project milestone. +Create a new project milestone. ``` POST /projects/:id/milestones @@ -36,14 +34,14 @@ POST /projects/:id/milestones Parameters: + `id` (required) - The ID of a project ++ `milestone_id` (required) - The ID of a project milestone + `title` (required) - The title of an milestone + `description` (optional) - The description of the milestone + `due_date` (optional) - The due date of the milestone - ## Edit milestone -Updates an existing project milestone. +Update an existing project milestone. ``` PUT /projects/:id/milestones/:milestone_id @@ -57,4 +55,3 @@ Parameters: + `description` (optional) - The description of a milestone + `due_date` (optional) - The due date of the milestone + `closed` (optional) - The status of the milestone - diff --git a/doc/api/notes.md b/doc/api/notes.md index 4b57f636..bb33efb8 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -1,4 +1,4 @@ -## Wall +## List notes ### List project wall notes @@ -30,40 +30,9 @@ Parameters: + `id` (required) - The ID of a project +### List issue notes -### Get single wall note - -Returns a single wall note. - -``` -GET /projects/:id/notes/:note_id -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `note_id` (required) - The ID of a wall note - - -### Create new wall note - -Creates a new wall note. - -``` -POST /projects/:id/notes -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `body` (required) - The content of a note - - -## Issues - -### List project issue notes - -Gets a list of all notes for a single issue. +Get a list of issue notes. ``` GET /projects/:id/issues/:issue_id/notes @@ -74,13 +43,40 @@ Parameters: + `id` (required) - The ID of a project + `issue_id` (required) - The ID of an issue +### List snippet notes -### Get single issue note - -Returns a single note for a specific project issue +Get a list of snippet notes. ``` -GET /projects/:id/issues/:issue_id/notes/:note_id +GET /projects/:id/snippets/:snippet_id/notes +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `snippet_id` (required) - The ID of a snippet + +## Single note + +### Single wall note + +Get a wall note. + +``` +GET /projects/:id/notes/:note_id +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `note_id` (required) - The ID of a wall note + +### Single issue note + +Get an issue note. + +``` +GET /projects/:id/issues/:issue_id/:notes/:note_id ``` Parameters: @@ -89,10 +85,41 @@ Parameters: + `issue_id` (required) - The ID of a project issue + `note_id` (required) - The ID of an issue note +### Single snippet note -### Create new issue note +Get a snippet note. -Creates a new note to a single project issue. +``` +GET /projects/:id/issues/:snippet_id/:notes/:note_id +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `snippet_id` (required) - The ID of a project snippet ++ `note_id` (required) - The ID of an snippet note + +## New note + +### New wall note + +Create a new wall note. + +``` +POST /projects/:id/notes +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `body` (required) - The content of a note + +Will return created note with status `201 Created` on success, or `404 Not found` on fail. + + +### New issue note + +Create a new issue note. ``` POST /projects/:id/issues/:issue_id/notes @@ -104,41 +131,11 @@ Parameters: + `issue_id` (required) - The ID of an issue + `body` (required) - The content of a note +Will return created note with status `201 Created` on success, or `404 Not found` on fail. -## Snippets +### New snippet note -### List all snippet notes - -Gets a list of all notes for a single snippet. Snippet notes are comments users can post to a snippet. - -``` -GET /projects/:id/snippets/:snippet_id/notes -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `snippet_id` (required) - The ID of a project snippet - - -### Get single snippet note - -Returns a single note for a given snippet. - -``` -GET /projects/:id/snippets/:snippet_id/notes/:note_id -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `snippet_id` (required) - The ID of a project snippet -+ `note_id` (required) - The ID of an snippet note - - -### Create new snippet note - -Creates a new note for a single snippet. Snippet notes are comments users can post to a snippet. +Create a new snippet note. ``` POST /projects/:id/snippets/:snippet_id/notes @@ -150,49 +147,4 @@ Parameters: + `snippet_id` (required) - The ID of an snippet + `body` (required) - The content of a note - -## Merge Requests - -### List all merge request notes - -Gets a list of all notes for a single merge request. - -``` -GET /projects/:id/merge_requests/:merge_request_id/notes -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - The ID of a project merge request - - -### Get single merge request note - -Returns a single note for a given merge request. - -``` -GET /projects/:id/merge_requests/:merge_request_id/notes/:note_id -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - The ID of a project merge request -+ `note_id` (required) - The ID of a merge request note - - -### Create new merge request note - -Creates a new note for a single merge request. - -``` -POST /projects/:id/merge_requests/:merge_request_id/notes -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - The ID of a merge request -+ `body` (required) - The content of a note - +Will return created note with status `201 Created` on success, or `404 Not found` on fail. diff --git a/doc/api/projects.md b/doc/api/projects.md index d6a9a885..41128675 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1,6 +1,4 @@ -## Projects - -### List projects +## List projects Get a list of projects owned by the authenticated user. @@ -23,9 +21,7 @@ GET /projects "blocked": false, "created_at": "2012-05-23T08:00:58Z" }, - "public": true, - "path": "rails", - "path_with_namespace": "rails/rails", + "private": true, "issues_enabled": false, "merge_requests_enabled": false, "wall_enabled": true, @@ -45,9 +41,7 @@ GET /projects "blocked": false, "created_at": "2012-05-23T08:00:58Z" }, - "public": true, - "path": "gitlab", - "path_with_namespace": "randx/gitlab", + "private": true, "issues_enabled": true, "merge_requests_enabled": true, "wall_enabled": true, @@ -57,11 +51,9 @@ GET /projects ] ``` +## Single project -### Get single project - -Get a specific project, identified by project ID or NAME, which is owned by the authentication user. -Currently namespaced projects cannot retrieved by name. +Get a specific project, identified by project ID, which is owned by the authentication user. ``` GET /projects/:id @@ -69,7 +61,7 @@ GET /projects/:id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project ```json { @@ -85,9 +77,7 @@ Parameters: "blocked": false, "created_at": "2012-05-23T08:00:58Z" }, - "public": true, - "path": "gitlab", - "path_with_namespace": "randx/gitlab", + "private": true, "issues_enabled": true, "merge_requests_enabled": true, "wall_enabled": true, @@ -96,10 +86,9 @@ Parameters: } ``` +## Create project -### Create project - -Creates new project owned by user. +Create new project owned by user ``` POST /projects @@ -115,42 +104,10 @@ Parameters: + `merge_requests_enabled` (optional) - enabled by default + `wiki_enabled` (optional) - enabled by default -**Project access levels** +Will return created project with status `201 Created` on success, or `404 Not +found` on fail. -The project access levels are defined in the `user_project.rb` class. Currently, these levels are recoginized: - -``` - GUEST = 10 - REPORTER = 20 - DEVELOPER = 30 - MASTER = 40 -``` - - -### Create project for user - -Creates a new project owned by user. Available only for admins. - -``` -POST /projects/user/:user_id -``` - -Parameters: - -+ `user_id` (required) - user_id of owner -+ `name` (required) - new project name -+ `description` (optional) - short project description -+ `default_branch` (optional) - 'master' by default -+ `issues_enabled` (optional) - enabled by default -+ `wall_enabled` (optional) - enabled by default -+ `merge_requests_enabled` (optional) - enabled by default -+ `wiki_enabled` (optional) - enabled by default - - - -## Team members - -### List project team members +## List project team members Get a list of project team members. @@ -160,13 +117,12 @@ GET /projects/:id/members Parameters: -+ `id` (required) - The ID or NAME of a project -+ `query` (optional) - Query string to search for members ++ `id` (required) - The ID of a project ++ `query` - Query string +## Get project team member -### Get project team member - -Gets a project team member. +Get a project team member. ``` GET /projects/:id/members/:user_id @@ -174,11 +130,12 @@ GET /projects/:id/members/:user_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `user_id` (required) - The ID of a user ```json { + "id": 1, "username": "john_smith", "email": "john@example.com", @@ -189,12 +146,9 @@ Parameters: } ``` +## Add project team member -### Add project team member - -Adds a user to a project team. This is an idempotent method and can be called multiple times -with the same parameters. Adding team membership to a user that is already a member does not -affect the existing membership. +Add a user to a project team. ``` POST /projects/:id/members @@ -202,14 +156,15 @@ POST /projects/:id/members Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `user_id` (required) - The ID of a user to add + `access_level` (required) - Project access level +Will return status `201 Created` on success, or `404 Not found` on fail. -### Edit project team member +## Edit project team member -Updates project team member to a specified access level. +Update project team member to specified access level. ``` PUT /projects/:id/members/:user_id @@ -217,12 +172,13 @@ PUT /projects/:id/members/:user_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `user_id` (required) - The ID of a team member + `access_level` (required) - Project access level +Will return status `200 OK` on success, or `404 Not found` on fail. -### Remove project team member +## Remove project team member Removes user from project team. @@ -232,20 +188,14 @@ DELETE /projects/:id/members/:user_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `user_id` (required) - The ID of a team member -This method is idempotent and can be called multiple times with the same parameters. -Revoking team membership for a user who is not currently a team member is considered success. -Please note that the returned JSON currently differs slightly. Thus you should not -rely on the returned JSON structure. +Status code `200` will be returned on success. +## List project hooks -## Hooks - -### List project hooks - -Get list of project hooks. +Get list for project hooks ``` GET /projects/:id/hooks @@ -253,12 +203,13 @@ GET /projects/:id/hooks Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project +Will return hooks with status `200 OK` on success, or `404 Not found` on fail. -### Get project hook +## Get project hook -Get a specific hook for project. +Get hook for project ``` GET /projects/:id/hooks/:hook_id @@ -266,21 +217,14 @@ GET /projects/:id/hooks/:hook_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `hook_id` (required) - The ID of a project hook -```json -{ - "id": 1, - "url": "http://example.com/hook", - "created_at": "2012-10-12T17:04:47Z" -} -``` +Will return hook with status `200 OK` on success, or `404 Not found` on fail. +## Add project hook -### Add project hook - -Adds a hook to project. +Add hook to project ``` POST /projects/:id/hooks @@ -288,13 +232,14 @@ POST /projects/:id/hooks Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `url` (required) - The hook URL +Will return status `201 Created` on success, or `404 Not found` on fail. -### Edit project hook +## Edit project hook -Edits a hook for project. +Edit hook for project ``` PUT /projects/:id/hooks/:hook_id @@ -302,205 +247,24 @@ PUT /projects/:id/hooks/:hook_id Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `hook_id` (required) - The ID of a project hook + `url` (required) - The hook URL +Will return status `201 Created` on success, or `404 Not found` on fail. -### Delete project hook -Removes a hook from project. This is an idempotent method and can be called multiple times. -Either the hook is available or not. +## Delete project hook + +Delete hook from project ``` -DELETE /projects/:id/hooks/ +DELETE /projects/:id/hooks ``` Parameters: -+ `id` (required) - The ID or NAME of a project ++ `id` (required) - The ID of a project + `hook_id` (required) - The ID of hook to delete -Note the JSON response differs if the hook is available or not. If the project hook -is available before it is returned in the JSON response or an empty response is returned. - - -## Branches - -### List branches - -Lists all branches of a project. - -``` -GET /projects/:id/repository/branches -``` - -Parameters: - -+ `id` (required) - The ID of the project - - -### List single branch - -Lists a specific branch of a project. - -``` -GET /projects/:id/repository/branches/:branch -``` - -Parameters: - -+ `id` (required) - The ID of the project. -+ `branch` (required) - The name of the branch. - - -### Protect single branch - -Protects a single branch of a project. - -``` -PUT /projects/:id/repository/branches/:branch/protect -``` - -Parameters: - -+ `id` (required) - The ID of the project. -+ `branch` (required) - The name of the branch. - - -### Unprotect single branch - -Unprotects a single branch of a project. - -``` -PUT /projects/:id/repository/branches/:branch/unprotect -``` - -Parameters: - -+ `id` (required) - The ID of the project. -+ `branch` (required) - The name of the branch. - - -### List tags - -Lists all tags of a project. - -``` -GET /projects/:id/repository/tags -``` - -Parameters: - -+ `id` (required) - The ID of the project - - -### List commits - -Lists all commits with pagination. If the optional `ref_name` name is not given the commits of -the default branch (usually master) are returned. - -``` -GET /projects/:id/repository/commits -``` - -Parameters: - -+ `id` (required) - The Id of the project -+ `ref_name` (optional) - The name of a repository branch or tag -+ `page` (optional) - The page of commits to return (`0` default) -+ `per_page` (optional) - The number of commits per page (`20` default) - -Returns values: - -+ `200 Ok` on success and a list with commits -+ `404 Not Found` if project with id or the branch with `ref_name` not found - - - -## Deploy Keys - -### List deploy keys - -Get a list of a project's deploy keys. - -``` -GET /projects/:id/keys -``` - -Parameters: - -+ `id` (required) - The ID of the project - -```json -[ - { - "id": 1, - "title" : "Public key" - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4 - 596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4 - soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", - }, - { - "id": 3, - "title" : "Another Public key" - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4 - 596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4 - soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=" - } -] -``` - - -### Single deploy key - -Get a single key. - -``` -GET /projects/:id/keys/:key_id -``` - -Parameters: - -+ `id` (required) - The ID of the project -+ `key_id` (required) - The ID of the deploy key - -```json -{ - "id": 1, - "title" : "Public key" - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4 - 596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4 - soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=" -} -``` - - -### Add deploy key - -Creates a new deploy key for a project. - -``` -POST /projects/:id/keys -``` - -Parameters: - -+ `id` (required) - The ID of the project -+ `title` (required) - New deploy key's title -+ `key` (required) - New deploy key - - -### Delete deploy key - -Delete a deploy key from a project - -``` -DELETE /projects/:id/keys/:key_id -``` - -Parameters: - -+ `id` (required) - The ID of the project -+ `key_id` (required) - The ID of the deploy key - +Will return status `200 OK` on success, or `404 Not found` on fail. diff --git a/doc/api/repositories.md b/doc/api/repositories.md index 90fda387..685797ad 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -1,4 +1,4 @@ -## List repository branches +## Project repository branches Get a list of repository branches from a project, sorted by name alphabetically. @@ -33,14 +33,12 @@ Parameters: }, "authored_date": "2012-06-27T05:51:39-07:00", "committed_date": "2012-06-28T03:44:20-07:00" - }, - "protected": true + } } ] ``` - -## Get single repository branch +## Project repository branch Get a single project repository branch. @@ -75,97 +73,11 @@ Parameters: }, "authored_date": "2012-06-27T05:51:39-07:00", "committed_date": "2012-06-28T03:44:20-07:00" - }, - "protected": true + } } ``` - -## Protect repository branch - -Protects a single project repository branch. This is an idempotent function, protecting an already -protected repository branch still returns a `200 Ok` status code. - -``` -PUT /projects/:id/repository/branches/:branch/protect -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `branch` (required) - The name of the branch - -```json -{ - "name": "master", - "commit": { - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", - "parents": [ - { - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" - } - ], - "tree": "46e82de44b1061621357f24c05515327f2795a95", - "message": "add projects API", - "author": { - "name": "John Smith", - "email": "john@example.com" - }, - "committer": { - "name": "John Smith", - "email": "john@example.com" - }, - "authored_date": "2012-06-27T05:51:39-07:00", - "committed_date": "2012-06-28T03:44:20-07:00" - }, - "protected": true -} -``` - - -## Unprotect repository branch - -Unprotects a single project repository branch. This is an idempotent function, unprotecting an already -unprotected repository branch still returns a `200 Ok` status code. - -``` -PUT /projects/:id/repository/branches/:branch/unprotect -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `branch` (required) - The name of the branch - -```json -{ - "name": "master", - "commit": { - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", - "parents": [ - { - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" - } - ], - "tree": "46e82de44b1061621357f24c05515327f2795a95", - "message": "add projects API", - "author": { - "name": "John Smith", - "email": "john@example.com" - }, - "committer": { - "name": "John Smith", - "email": "john@example.com" - }, - "authored_date": "2012-06-27T05:51:39-07:00", - "committed_date": "2012-06-28T03:44:20-07:00" - }, - "protected": false -} -``` - - -## List project repository tags +## Project repository tags Get a list of repository tags from a project, sorted by name in reverse alphabetical order. @@ -198,14 +110,12 @@ Parameters: }, "authored_date": "2012-05-28T04:42:42-07:00", "committed_date": "2012-05-28T04:42:42-07:00" - }, - "protected": null + } } ] ``` - -## List repository commits +## Project repository commits Get a list of repository commits in a project. @@ -216,7 +126,7 @@ GET /projects/:id/repository/commits Parameters: + `id` (required) - The ID of a project -+ `ref_name` (optional) - The name of a repository branch or tag or if not given the default branch ++ `ref_name` (optional) - The name of a repository branch or tag ```json [ @@ -239,7 +149,6 @@ Parameters: ] ``` - ## Raw blob content Get the raw file contents for a file. @@ -253,3 +162,5 @@ Parameters: + `id` (required) - The ID of a project + `sha` (required) - The commit or branch name + `filepath` (required) - The path the file + +Will return the raw file contents. diff --git a/doc/api/session.md b/doc/api/session.md index d68788d5..c7e57aac 100644 --- a/doc/api/session.md +++ b/doc/api/session.md @@ -17,17 +17,7 @@ Parameters: "email": "john@example.com", "name": "John Smith", "private_token": "dd34asd13as", - "blocked": false, "created_at": "2012-05-23T08:00:58Z", - "bio": null, - "skype": "", - "linkedin": "", - "twitter": "", - "dark_scheme": false, - "theme_id": 1 - "is_admin": false, - "can_create_group" : true, - "can_create_team" : true, - "can_create_project" : true + "blocked": true } ``` diff --git a/doc/api/snippets.md b/doc/api/snippets.md index 04ea367d..ceb8a63d 100644 --- a/doc/api/snippets.md +++ b/doc/api/snippets.md @@ -10,10 +10,9 @@ Parameters: + `id` (required) - The ID of a project - ## Single snippet -Get a single project snippet. +Get a project snippet. ``` GET /projects/:id/snippets/:snippet_id @@ -43,10 +42,22 @@ Parameters: } ``` +## Snippet content -## Create new snippet +Get a raw project snippet. -Creates a new project snippet. The user must have permission to create new snippets. +``` +GET /projects/:id/snippets/:snippet_id/raw +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `snippet_id` (required) - The ID of a project's snippet + +## New snippet + +Create a new project snippet. ``` POST /projects/:id/snippets @@ -60,10 +71,11 @@ Parameters: + `lifetime` (optional) - The expiration date of a snippet + `code` (required) - The content of a snippet +Will return created snippet with status `201 Created` on success, or `404 Not found` on fail. -## Update snippet +## Edit snippet -Updates an existing project snippet. The user must have permission to change an existing snippet. +Update an existing project snippet. ``` PUT /projects/:id/snippets/:snippet_id @@ -78,11 +90,11 @@ Parameters: + `lifetime` (optional) - The expiration date of a snippet + `code` (optional) - The content of a snippet +Will return updated snippet with status `200 OK` on success, or `404 Not found` on fail. ## Delete snippet -Deletes an existing project snippet. This is an idempotent function and deleting a non-existent -snippet still returns a `200 Ok` status code. +Delete existing project snippet. ``` DELETE /projects/:id/snippets/:snippet_id @@ -93,16 +105,5 @@ Parameters: + `id` (required) - The ID of a project + `snippet_id` (required) - The ID of a project's snippet +Status code `200` will be returned on success. -## Snippet content - -Returns the raw project snippet as plain text. - -``` -GET /projects/:id/snippets/:snippet_id/raw -``` - -Parameters: - -+ `id` (required) - The ID of a project -+ `snippet_id` (required) - The ID of a project's snippet diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md deleted file mode 100644 index dca22c43..00000000 --- a/doc/api/system_hooks.md +++ /dev/null @@ -1,49 +0,0 @@ -All methods require admin authorization. - -## List system hooks - -Get list of system hooks - -``` -GET /hooks -``` - -Parameters: - -+ **none** - - -## Add new system hook hook - -``` -POST /hooks -``` - -Parameters: - -+ `url` (required) - The hook URL - - -## Test system hook - -``` -GET /hooks/:id -``` - -Parameters: - -+ `id` (required) - The ID of hook - - -## Delete system hook - -Deletes a system hook. This is an idempotent API function and returns `200 Ok` even if the hook -is not available. If the hook is deleted it is also returned as JSON. - -``` -DELETE /hooks/:id -``` - -Parameters: - -+ `id` (required) - The ID of hook diff --git a/doc/api/users.md b/doc/api/users.md index c05bcb3e..200c0e06 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -20,8 +20,6 @@ GET /users "linkedin": "", "twitter": "", "dark_scheme": false, - "extern_uid": "john.smith", - "provider": "provider_name", "theme_id": 1 }, { @@ -36,14 +34,11 @@ GET /users "linkedin": "", "twitter": "", "dark_scheme": true, - "extern_uid": "jack.smith", - "provider": "provider_name", "theme_id": 1 } ] ``` - ## Single user Get a single user. @@ -69,80 +64,33 @@ Parameters: "linkedin": "", "twitter": "", "dark_scheme": false, - "extern_uid": "john.smith", - "provider": "provider_name", "theme_id": 1 } ``` - ## User creation - -Creates a new user. Note only administrators can create new users. +Create user. Available only for admin ``` POST /users ``` Parameters: - -+ `email` (required) - Email -+ `password` (required) - Password -+ `username` (required) - Username -+ `name` (required) - Name -+ `skype` (optional) - Skype ID -+ `linkedin` (optional) - Linkedin -+ `twitter` (optional) - Twitter account -+ `projects_limit` (optional) - Number of projects user can create -+ `extern_uid` (optional) - External UID -+ `provider` (optional) - External provider name -+ `bio` (optional) - User's bio - - -## User modification - -Modifies an existing user. Only administrators can change attributes of a user. - -``` -PUT /users/:id -``` - -Parameters: - -+ `email` - Email -+ `username` - Username -+ `name` - Name -+ `password` - Password ++ `email` (required) - Email ++ `password` (required) - Password ++ `username` (required) - Username ++ `name` (required) - Name + `skype` - Skype ID + `linkedin` - Linkedin + `twitter` - Twitter account -+ `projects_limit` - Limit projects each user can create -+ `extern_uid` - External UID -+ `provider` - External provider name -+ `bio` - User's bio - -Note, at the moment this method does only return a 404 error, even in cases where a 409 (Conflict) would -be more appropriate, e.g. when renaming the email address to some exsisting one. - - -## User deletion - -Deletes a user. Available only for administrators. This is an idempotent function, calling this function -for a non-existent user id still returns a status code `200 Ok`. The JSON response differs if the user -was actually deleted or not. In the former the user is returned and in the latter not. - -``` -DELETE /users/:id -``` - -Parameters: - -+ `id` (required) - The ID of the user ++ `projects_limit` - Number of projects user can create +Will return created user with status `201 Created` on success, or `404 Not +found` on fail. ## Current user -Gets currently authenticated user. +Get currently authenticated user. ``` GET /user @@ -154,7 +102,6 @@ GET /user "username": "john_smith", "email": "john@example.com", "name": "John Smith", - "private_token": "dd34asd13as", "blocked": false, "created_at": "2012-05-23T08:00:58Z", "bio": null, @@ -163,14 +110,9 @@ GET /user "twitter": "", "dark_scheme": false, "theme_id": 1 - "is_admin": false, - "can_create_group" : true, - "can_create_team" : true, - "can_create_project" : true } ``` - ## List SSH keys Get a list of currently authenticated user's SSH keys. @@ -198,11 +140,6 @@ GET /user/keys ] ``` -Parameters: - -+ **none** - - ## Single SSH key Get a single key. @@ -224,11 +161,9 @@ Parameters: soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=" } ``` - - ## Add SSH key -Creates a new key owned by the currently authenticated user. +Create new key owned by currently authenticated user ``` POST /user/keys @@ -239,28 +174,12 @@ Parameters: + `title` (required) - new SSH Key's title + `key` (required) - new SSH key - -## Add SSH key for user - -Create new key owned by specified user. Available only for admin - -``` -POST /users/:id/keys -``` - -Parameters: - -+ `id` (required) - id of specified user -+ `title` (required) - new SSH Key's title -+ `key` (required) - new SSH key - Will return created key with status `201 Created` on success, or `404 Not found` on fail. ## Delete SSH key -Deletes key owned by currently authenticated user. This is an idempotent function and calling it on a key that is already -deleted or not available results in `200 Ok`. +Delete key owned by currently authenticated user ``` DELETE /user/keys/:id @@ -270,3 +189,4 @@ Parameters: + `id` (required) - SSH key ID +Will return `200 OK` on success, or `404 Not Found` on fail. diff --git a/doc/code/apple-touch-icon.png b/doc/code/apple-touch-icon.png new file mode 100644 index 00000000..50f98b0f 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 00000000..c50e5d3e --- /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 00000000..21119cc8 --- /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 00000000..fdf88c1c --- /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 00000000..ec389166 --- /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 00000000..2c8d740a --- /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 00000000..0ee82105 --- /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 00000000..f2ea0db4 --- /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 00000000..31f4982e --- /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 00000000..ba82287d --- /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 00000000..02643b7f --- /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 00000000..b3651e8b --- /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 00000000..1d56fbc7 --- /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 00000000..8782d95f --- /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 00000000..1a0bd492 --- /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 00000000..52cb2f87 --- /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 00000000..b055f509 --- /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 00000000..cfe1e514 --- /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 00000000..629a30fe --- /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 00000000..f1c3bed9 --- /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 00000000..348cf42a --- /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 00000000..2c3a82bb --- /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 00000000..79bc7c98 --- /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 00000000..fc93f4be --- /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 00000000..3fbc76bf --- /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 00000000..2d641cb0 --- /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 00000000..22df013f --- /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 00000000..15369b89 --- /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 00000000..5f0bbe9e --- /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 00000000..90630578 --- /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 00000000..82c04feb --- /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 00000000..53d32967 --- /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 00000000..4e4addfb --- /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 00000000..3db60f96 --- /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 00000000..ae8b126d --- /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 00000000..6fcb426c --- /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 00000000..952d295c --- /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 00000000..b03cc04c --- /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 00000000..608db599 --- /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 00000000..1fdf7f5c --- /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 00000000..5bf01133 --- /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 00000000..7c7041c6 --- /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 00000000..0b8c0c26 --- /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 00000000..67632e3b --- /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 00000000..b1da2752 --- /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 00000000..c11d89b3 --- /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 00000000..52ea8b32 --- /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 00000000..5127be6e --- /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 00000000..fe2ccc76 --- /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 00000000..603443dd --- /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 00000000..2f4dc534 --- /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 00000000..c8a1e3c2 --- /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 00000000..4eeb3fec --- /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 00000000..8cb9ed35 --- /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 00000000..a42cc91d --- /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 00000000..432c6f4b --- /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 00000000..e05a43b8 --- /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 00000000..e6807716 --- /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 00000000..3c375faa --- /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 00000000..f0ba6567 --- /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 00000000..a111b19f --- /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 00000000..151abf27 --- /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 00000000..61259d0c --- /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 00000000..3d181a6f --- /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 00000000..ee6a10e7 --- /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 00000000..cbc4d1a3 --- /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 00000000..5c296676 --- /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 00000000..a17b808d --- /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 00000000..d73be2ca --- /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 00000000..19018c0f --- /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 00000000..fabe18bb --- /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 00000000..8cf9c58c --- /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 00000000..8a45dae1 --- /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 00000000..11026f5c --- /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 00000000..35c46f38 --- /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 00000000..53efe1e8 --- /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 00000000..e0827c84 --- /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 00000000..0198b3f0 --- /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 00000000..b410947b --- /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 00000000..cd04b7d0 --- /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 00000000..91c6dead --- /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 00000000..2c523c19 --- /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 00000000..45d853f3 --- /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 00000000..556f2b01 --- /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 00000000..4226dab3 --- /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 00000000..90d3e7af --- /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 00000000..d13cf13d --- /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 00000000..0071ba0c --- /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 00000000..9005134e --- /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 00000000..674df322 --- /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 00000000..943bbf8e --- /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 00000000..abe7411e --- /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 00000000..3a35aa22 --- /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 00000000..064c4f06 --- /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 00000000..86d82e6a --- /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 00000000..a62c96a5 --- /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 00000000..ad14adc0 --- /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 00000000..8f918b35 --- /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 00000000..50ba3131 --- /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 00000000..a56f614f --- /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 00000000..32ae5f82 --- /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 00000000..9261c356 --- /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 00000000..a1350e2f --- /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 00000000..cf61c3ea --- /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 00000000..dbca1708 --- /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 00000000..fbb76563 --- /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 00000000..511e05f0 --- /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 00000000..6f71ea72 --- /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 00000000..7398308a --- /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 00000000..5c3ca9b2 --- /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 00000000..1600c0f0 --- /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 00000000..0214d217 --- /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 00000000..1e18d7a8 --- /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 00000000..7b751045 --- /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 00000000..0298ec75 --- /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 00000000..0935e486 --- /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 00000000..1044ea2f --- /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 00000000..9caccb75 --- /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 00000000..53d54c6b --- /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 00000000..cd404609 --- /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 00000000..364e0346 --- /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 00000000..4cf181fa --- /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 00000000..33725cf7 --- /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 00000000..5e2501c7 --- /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 00000000..5f275210 --- /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 00000000..48a3beb6 --- /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 00000000..02c9b7e4 --- /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 00000000..976338e8 --- /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 00000000..28d485d9 --- /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 00000000..4ec1c4dc --- /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 00000000..0817d170 --- /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 00000000..cc0e5156 --- /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 00000000..19b8dd38 --- /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 00000000..adb3a46f --- /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 00000000..24731bc4 --- /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 00000000..12cc98fa --- /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 00000000..39ff6794 --- /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 00000000..ea740381 --- /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 00000000..5ebc2dcd --- /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 00000000..5f54fc02 --- /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 00000000..d078e65e --- /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 00000000..edab6952 --- /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 00000000..faf4874a --- /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 00000000..00428548 --- /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 00000000..2d0be3a4 --- /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 00000000..3fa9c759 --- /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 00000000..bf2292a5 --- /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 00000000..757055ab --- /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 00000000..3fe3f4d6 --- /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 00000000..3cc6dd07 --- /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 00000000..a2084279 --- /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 00000000..c5399ed4 --- /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 00000000..f1175852 --- /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 00000000..8b74ebee --- /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 00000000..f747fb4a --- /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 00000000..e1b53d96 --- /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 00000000..29a76394 --- /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 00000000..664207dd --- /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 00000000..971b8fcb --- /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 00000000..cd661646 --- /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 00000000..a6266790 --- /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 00000000..ec3fc9e4 --- /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 00000000..b8ecb2e7 --- /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 00000000..5f26c934 --- /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 00000000..f4973cb3 --- /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 00000000..faff9256 --- /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 00000000..c0165b09 --- /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 00000000..05219228 --- /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 00000000..a71f1316 --- /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 00000000..fd7e0fe6 --- /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 00000000..4230a0cc --- /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 00000000..46ead776 --- /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 00000000..38508f6d --- /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 00000000..4f1ce71f --- /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 00000000..24609a5c --- /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 00000000..9c114ba6 --- /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 00000000..c7b4c790 --- /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 00000000..cf30b011 --- /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 00000000..08d2c07e --- /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 00000000..f411dfd1 --- /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 00000000..5b9b6478 --- /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 00000000..e71dfa3f --- /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 00000000..35c99bc0 --- /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 00000000..9b32e1c9 --- /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 00000000..a9ca7949 --- /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 00000000..661b143e --- /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 00000000..24ce4b76 --- /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 00000000..6899937a --- /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 00000000..76ae5125 --- /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 00000000..50b02dc7 --- /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 00000000..bb786a79 --- /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 00000000..54097dd3 --- /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 00000000..ab0fe9b2 --- /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 00000000..3247d4f0 --- /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 00000000..3177c0b3 --- /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 00000000..bd778a76 --- /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 00000000..7d5a913a --- /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 00000000..9bd8027b --- /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 00000000..da4a2394 --- /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 00000000..e0e80cf8 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 00000000..f873d9b2 --- /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 00000000..21416430 --- /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 00000000..c21f5e1b --- /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 00000000..18b89d58 --- /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 00000000..6d83a6b4 --- /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 00000000..5f9c5462 --- /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 00000000..7cf9a67c --- /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 00000000..84c7f143 --- /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 00000000..2712b358 --- /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 00000000..85d7cc30 --- /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 00000000..ebb88998 --- /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 00000000..1fd4edd0 --- /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 00000000..8fe6fc90 --- /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 00000000..221091a2 --- /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 00000000..27957990 --- /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 00000000..2d611510 --- /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 00000000..742a9c7d --- /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 00000000..b821baff --- /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 00000000..c8188f7e --- /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 00000000..78375592 --- /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 00000000..f13dba25 --- /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 00000000..f0c34244 --- /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 00000000..a5bdfad1 --- /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 00000000..a7189c86 --- /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 00000000..989e4cd8 --- /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 00000000..479fa869 --- /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 00000000..ac7012f4 --- /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 00000000..c0c598a2 --- /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 00000000..bd2da28b --- /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 00000000..905f17b3 --- /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 00000000..0c41c81e --- /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 00000000..8182569b --- /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 00000000..1c198695 --- /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 00000000..d88ed459 --- /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 00000000..6b22a056 --- /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 00000000..5dd462cc --- /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 00000000..70eb9de7 --- /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 00000000..67e846be --- /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 00000000..1b5e8fa0 --- /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 00000000..0b085838 --- /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 00000000..e17be7ab --- /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 00000000..939eb71e --- /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 00000000..1fca7134 --- /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 00000000..207441f1 --- /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 00000000..eab4dd4d --- /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 00000000..f47c3664 --- /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 00000000..de836e79 --- /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 00000000..662aef91 --- /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 00000000..c4784ecc --- /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 00000000..1a21f186 --- /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 00000000..bbebf05f --- /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 00000000..5998d46d --- /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 00000000..ef09e718 --- /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 00000000..156d6008 --- /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 00000000..0ca1f9ee --- /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 00000000..ab659f66 --- /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 00000000..72447215 --- /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 00000000..4d78fca9 --- /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 00000000..31389328 --- /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 00000000..63903ce0 --- /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 00000000..9aada0e7 --- /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 00000000..1e107ebf --- /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 00000000..556caad9 --- /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 00000000..2fb5aa1d --- /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 00000000..a21a80fe --- /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 00000000..d87776b9 --- /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 00000000..c388a481 --- /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 00000000..697e590e --- /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 00000000..5bb3d629 --- /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 00000000..074e404c --- /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 00000000..2d7bac33 --- /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 00000000..86e17f0f --- /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 00000000..cf22c56a --- /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 00000000..f48c8a6c --- /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 00000000..0409518c --- /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 00000000..69849529 --- /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 00000000..9606ee7b --- /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 00000000..1cf1727c --- /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 00000000..8b703afe --- /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 00000000..11fbed2e --- /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 00000000..38ec8298 --- /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 00000000..d0e97db6 --- /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 00000000..6c7a6e21 --- /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 00000000..8756e2a3 --- /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 00000000..739bb5c7 --- /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 00000000..496b4d21 --- /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 00000000..7fa375a2 --- /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 00000000..47b0f7fc --- /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 00000000..96016354 --- /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 00000000..edccffd9 --- /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 00000000..89ca7611 --- /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 00000000..18a35e06 --- /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 00000000..072ae905 --- /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 00000000..0fc97423 --- /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 00000000..57d5a2a2 --- /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 00000000..2a78e1ab --- /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 00000000..7f373bac --- /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 00000000..9834dfc4 --- /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 00000000..5b779474 --- /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 00000000..e5a0e03c --- /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 00000000..0a4b2b51 --- /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 00000000..53e351ef --- /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 00000000..d17f2409 --- /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 00000000..e427fc5b --- /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 00000000..9d8821be --- /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 00000000..d6d0437d --- /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 00000000..5a878fc0 --- /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 00000000..bb787914 --- /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 00000000..d15014b9 --- /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 00000000..a32a7c94 --- /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 00000000..6b0d320d --- /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 00000000..62203df1 --- /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 00000000..f9a847d6 --- /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 00000000..c2355819 --- /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 00000000..5517f98d --- /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 00000000..a11bf506 --- /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 00000000..27680fa1 --- /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 00000000..fd4e73bf --- /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 00000000..e62abde0 --- /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 00000000..385b7b2f --- /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 00000000..94a4a723 --- /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 00000000..2085b87a --- /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 00000000..392c8250 --- /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 00000000..6911c723 --- /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 00000000..cfd57933 --- /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 00000000..3e007ff6 --- /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 00000000..de791415 --- /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 00000000..6b42df4c --- /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 00000000..a96dd91f --- /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 00000000..caaaf0db --- /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 00000000..65215d38 --- /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 00000000..88aa2eec --- /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 00000000..936db6d6 --- /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 00000000..596c954e --- /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 00000000..0a015fb7 --- /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 00000000..7e3e29a5 --- /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 00000000..6160d25e --- /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 00000000..5853380f --- /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 00000000..de812d93 --- /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 00000000..e205ecf0 --- /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 00000000..8e4ed070 --- /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 00000000..7105222d --- /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 00000000..704f6f02 --- /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 00000000..df59e4d7 --- /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 00000000..14da5f0e --- /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 00000000..da20f2d3 --- /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 00000000..e8d05b92 --- /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 00000000..5aac1d3f --- /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 00000000..3fdcf008 --- /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 00000000..a37be49c --- /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 00000000..3c540290 --- /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 00000000..70af8a34 --- /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 00000000..8faa1a53 --- /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 00000000..7bf16c73 --- /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 00000000..48b1b65c --- /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 00000000..7f54400a --- /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 00000000..11a0dd2d --- /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 00000000..985c23a5 --- /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 00000000..c53c4e86 --- /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 00000000..651a1268 --- /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 00000000..b66613c3 --- /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 00000000..d1743456 --- /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 00000000..db7541dd --- /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 00000000..0e8e013f --- /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 00000000..405a2c75 --- /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 00000000..1df6b794 --- /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 00000000..848bb0a1 --- /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 00000000..708dcefc --- /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 00000000..8924ca8a --- /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 00000000..bd5f5e2e --- /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 00000000..6acee13f --- /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 00000000..dfdab455 --- /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 00000000..3c1e8448 --- /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 00000000..e4a473ec --- /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 00000000..6bbc8483 --- /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 00000000..54c513f7 --- /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 00000000..f02fde65 --- /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 00000000..97dccfd7 --- /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 00000000..a99c19fa --- /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 00000000..33bb541b --- /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 00000000..e54060f4 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 00000000..199ba692 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 00000000..7d236633 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 00000000..c7011386 --- /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 00000000..01b59273 --- /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 00000000..5b25307c --- /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 00000000..859772b9 --- /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/code/js/navigation.js b/doc/code/js/navigation.js new file mode 100644 index 00000000..e4126812 --- /dev/null +++ b/doc/code/js/navigation.js @@ -0,0 +1,142 @@ +/* + * Navigation allows movement using the arrow keys through the search results. + * + * When using this library you will need to set scrollIntoView to the + * appropriate function for your layout. Use scrollInWindow if the container + * is not scrollable and scrollInElement if the container is a separate + * scrolling region. + */ +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: + this.clearMoveTimeout(); + break; + } + } + + this.onkeydown = function(e) { + if (!this.navigationActive) return; + switch(e.keyCode) { + case 37: //Event.KEY_LEFT: + if (this.moveLeft()) e.preventDefault(); + break; + case 38: //Event.KEY_UP: + if (e.keyCode == 38 || e.ctrlKey) { + if (this.moveUp()) e.preventDefault(); + this.startMoveTimeout(false); + } + break; + case 39: //Event.KEY_RIGHT: + if (this.moveRight()) e.preventDefault(); + break; + case 40: //Event.KEY_DOWN: + if (e.keyCode == 40 || e.ctrlKey) { + if (this.moveDown()) e.preventDefault(); + this.startMoveTimeout(true); + } + break; + case 13: //Event.KEY_RETURN: + if (this.$current) + e.preventDefault(); + this.select(this.$current); + 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); + } + + /* + * Scrolls to the given element in the scrollable element view. + */ + this.scrollInElement = function(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; + } + } + + /* + * Scrolls to the given element in the window. The second argument is + * ignored + */ + this.scrollInWindow = function(element, ignored) { + var offset, viewHeight, viewScroll, height; + offset = element.offsetTop; + height = element.offsetHeight; + viewHeight = window.innerHeight; + viewScroll = window.scrollY; + + if (offset - viewScroll + height > viewHeight) { + window.scrollTo(window.scrollX, offset - viewHeight + height); + } + if (offset < viewScroll) { + window.scrollTo(window.scrollX, offset); + } + } +} + diff --git a/doc/code/js/search_index.js b/doc/code/js/search_index.js new file mode 100644 index 00000000..7fda2f97 --- /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 00000000..77910c4b --- /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/code/js/searcher.js b/doc/code/js/searcher.js new file mode 100644 index 00000000..f854b541 --- /dev/null +++ b/doc/code/js/searcher.js @@ -0,0 +1,228 @@ +Searcher = function(data) { + this.data = data; + this.handlers = []; +} + +Searcher.prototype = new function() { + // search is performed in chunks of 1000 for non-blocking user input + var CHUNK_SIZE = 1000; + // do not try to find more than 100 results + var MAX_RESULTS = 100; + var huid = 1; + var suid = 1; + var runs = 0; + + this.find = function(query) { + var queries = splitQuery(query); + var regexps = buildRegexps(queries); + var highlighters = buildHilighters(queries); + var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++}; + var _this = this; + + this.currentSuid = state.n; + + if (!query) return; + + var run = function() { + // stop current search thread if new search started + if (state.n != _this.currentSuid) return; + + var results = + performSearch(_this.data, regexps, queries, highlighters, state); + var hasMore = (state.limit > 0 && state.pass < 4); + + triggerResults.call(_this, results, !hasMore); + if (hasMore) { + setTimeout(run, 2); + } + runs++; + }; + runs = 0; + + // start search thread + run(); + } + + /* ----- Events ------ */ + this.ready = function(fn) { + fn.huid = huid; + this.handlers.push(fn); + } + + /* ----- Utilities ------ */ + function splitQuery(query) { + return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) { + return string.match(/\S/) + }); + } + + function buildRegexps(queries) { + return jQuery.map(queries, function(query) { + return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i') + }); + } + + function buildHilighters(queries) { + return jQuery.map(queries, function(query) { + return jQuery.map(query.split(''), function(l, i) { + return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2); + }).join(''); + }); + } + + // function longMatchRegexp(index, longIndex, regexps) { + // for (var i = regexps.length - 1; i >= 0; i--){ + // if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false; + // }; + // return true; + // } + + + /* ----- Mathchers ------ */ + + /* + * This record matches if the index starts with queries[0] and the record + * matches all of the regexps + */ + function matchPassBeginning(index, longIndex, queries, regexps) { + if (index.indexOf(queries[0]) != 0) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if the longIndex starts with queries[0] and the + * longIndex matches all of the regexps + */ + function matchPassLongIndex(index, longIndex, queries, regexps) { + if (longIndex.indexOf(queries[0]) != 0) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if the index contains queries[0] and the record + * matches all of the regexps + */ + function matchPassContains(index, longIndex, queries, regexps) { + if (index.indexOf(queries[0]) == -1) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + /* + * This record matches if regexps[0] matches the index and the record + * matches all of the regexps + */ + function matchPassRegexp(index, longIndex, queries, regexps) { + if (!index.match(regexps[0])) return false; + for (var i=1, l = regexps.length; i < l; i++) { + if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) + return false; + }; + return true; + } + + + /* ----- Highlighters ------ */ + function highlightRegexp(info, queries, regexps, highlighters) { + var result = createResult(info); + for (var i=0, l = regexps.length; i < l; i++) { + result.title = result.title.replace(regexps[i], highlighters[i]); + result.namespace = result.namespace.replace(regexps[i], highlighters[i]); + }; + return result; + } + + function hltSubstring(string, pos, length) { + return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length); + } + + function highlightQuery(info, queries, regexps, highlighters) { + var result = createResult(info); + var pos = 0; + var lcTitle = result.title.toLowerCase(); + + pos = lcTitle.indexOf(queries[0]); + if (pos != -1) { + result.title = hltSubstring(result.title, pos, queries[0].length); + } + + result.namespace = result.namespace.replace(regexps[0], highlighters[0]); + for (var i=1, l = regexps.length; i < l; i++) { + result.title = result.title.replace(regexps[i], highlighters[i]); + result.namespace = result.namespace.replace(regexps[i], highlighters[i]); + }; + return result; + } + + function createResult(info) { + var result = {}; + result.title = info[0]; + result.namespace = info[1]; + result.path = info[2]; + result.params = info[3]; + result.snippet = info[4]; + return result; + } + + /* ----- Searching ------ */ + function performSearch(data, regexps, queries, highlighters, state) { + var searchIndex = data.searchIndex; + var longSearchIndex = data.longSearchIndex; + var info = data.info; + var result = []; + var i = state.from; + var l = searchIndex.length; + var togo = CHUNK_SIZE; + var matchFunc, hltFunc; + + while (state.pass < 4 && state.limit > 0 && togo > 0) { + if (state.pass == 0) { + matchFunc = matchPassBeginning; + hltFunc = highlightQuery; + } else if (state.pass == 1) { + matchFunc = matchPassLongIndex; + hltFunc = highlightQuery; + } else if (state.pass == 2) { + matchFunc = matchPassContains; + hltFunc = highlightQuery; + } else if (state.pass == 3) { + matchFunc = matchPassRegexp; + hltFunc = highlightRegexp; + } + + for (; togo > 0 && i < l && state.limit > 0; i++, togo--) { + if (info[i].n == state.n) continue; + if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) { + info[i].n = state.n; + result.push(hltFunc(info[i], queries, regexps, highlighters)); + state.limit--; + } + }; + if (searchIndex.length <= i) { + state.pass++; + i = state.from = 0; + } else { + state.from = i; + } + } + return result; + } + + function triggerResults(results, isLast) { + jQuery.each(this.handlers, function(i, fn) { + fn.call(this, results, isLast) + }) + } +} + diff --git a/doc/code/panel/index.html b/doc/code/panel/index.html new file mode 100755 index 00000000..f815a113 --- /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 00000000..5c356c74 --- /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 00000000..eeb04922 --- /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/databases.md b/doc/install/databases.md index fade5d4f..4c6c084d 100644 --- a/doc/install/databases.md +++ b/doc/install/databases.md @@ -12,7 +12,7 @@ GitLab supports the following databases: sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev # Login to MySQL - mysql -u root -p + $ mysql -u root -p # Create a user for GitLab. (change $password to a real password) mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; @@ -27,7 +27,7 @@ GitLab supports the following databases: mysql> \q # Try connecting to the new database with the new user - sudo -u git -H mysql -u gitlab -p -D gitlabhq_production + sudo -u gitlab -H mysql -u gitlab -p -D gitlabhq_production ## PostgreSQL @@ -38,14 +38,14 @@ GitLab supports the following databases: sudo -u postgres psql -d template1 # Create a user for GitLab. (change $password to a real password) - template1=# CREATE USER git WITH PASSWORD '$password'; + template1=# CREATE USER gitlab WITH PASSWORD '$password'; # Create the GitLab production database & grant all privileges on database - template1=# CREATE DATABASE gitlabhq_production OWNER git; + template1=# CREATE DATABASE gitlabhq_production OWNER gitlab; # Quit the database session template1=# \q # Try connecting to the new database with the new user - sudo -u git -H psql -d gitlabhq_production + sudo -u gitlab -H psql -d gitlabhq_production diff --git a/doc/install/installation.md b/doc/install/installation.md index a9ae4b1e..e0744e09 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -1,12 +1,19 @@ -# Important notes +This installation guide was created for Debian/Ubuntu and tested on it. -This installation guide was created for and tested on **Debian/Ubuntu** operating systems. Please read [`doc/install/requirements.md`](./requirements.md) for hardware and operating system requirements. +Please read `doc/install/requirements.md` for hardware and platform requirements. -This is the official installation guide to set up a production server. To set up a **development installation** or for many other installation options please consult [the installation section in the readme](https://github.com/gitlabhq/gitlabhq#installation). -The following steps have been known to work. Please **use caution when you deviate** from this guide. Make sure you don't violate any assumptions GitLab makes about its environment. +**Important Note:** +The following steps have been known to work. +If you deviate from this guide, do it with caution and make sure you don't +violate any assumptions GitLab makes about its environment. +For things like AWS installation scripts, init scripts or config files for +alternative web server have a look at the "Advanced Setup Tips" section. -If you find a bug/error in this guide please **submit a pull request** following the [`contributing guide`](../../CONTRIBUTING.md). + +**Important Note:** +If you find a bug/error in this guide please submit an issue or pull request +following the contribution guide (see `CONTRIBUTING.md`). - - - @@ -17,7 +24,7 @@ The GitLab installation consists of setting up the following components: 1. Packages / Dependencies 2. Ruby 3. System Users -4. GitLab shell +4. Gitolite 5. Database 6. GitLab 7. Nginx @@ -25,13 +32,16 @@ The GitLab installation consists of setting up the following components: # 1. Packages / Dependencies -`sudo` is not installed on Debian by default. Make sure your system is -up-to-date and install it. +`sudo` is not installed on Debian by default. If you don't have it you'll need +to install it first. # run as root - apt-get update - apt-get upgrade - apt-get install sudo + apt-get update && apt-get upgrade && apt-get install sudo + +Make sure your system is up-to-date: + + sudo apt-get update + sudo apt-get upgrade **Note:** Vim is an editor that is used here whenever there are files that need to be @@ -67,8 +77,8 @@ Make sure you have the right version of Python installed. Download and compile it: mkdir /tmp/ruby && cd /tmp/ruby - curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz - cd ruby-1.9.3-p392 + curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz | tar xz + cd ruby-1.9.3-p327 ./configure make sudo make install @@ -80,86 +90,134 @@ Install the Bundler Gem: # 3. System Users -Create a `git` user for Gitlab: +Create a user for Git and Gitolite: - sudo adduser --disabled-login --gecos 'GitLab' git + sudo adduser \ + --system \ + --shell /bin/sh \ + --gecos 'Git Version Control' \ + --group \ + --disabled-password \ + --home /home/git \ + git + +Create a user for GitLab: + + sudo adduser --disabled-login --gecos 'GitLab' gitlab + + # Add it to the git group + sudo usermod -a -G git gitlab + + # Generate the SSH key + sudo -u gitlab -H ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa -# 4. GitLab shell +# 4. Gitolite -GitLab Shell is a ssh access and repository management software developed specially for GitLab. +Clone GitLab's fork of the Gitolite source code: - # Login as git - sudo su git - - # Go to home directory cd /home/git + sudo -u git -H git clone -b gl-v320 https://github.com/gitlabhq/gitolite.git /home/git/gitolite - # Clone gitlab shell - git clone https://github.com/gitlabhq/gitlab-shell.git +Setup Gitolite with GitLab as its admin: - cd gitlab-shell - cp config.yml.example config.yml +**Important Note:** +GitLab assumes *full and unshared* control over this Gitolite installation. - # Edit config and replace gitlab_url - # with something like 'http://domain.com/' - vim config.yml + # Add Gitolite scripts to $PATH + sudo -u git -H mkdir /home/git/bin + sudo -u git -H sh -c 'printf "%b\n%b\n" "PATH=\$PATH:/home/git/bin" "export PATH" >> /home/git/.profile' + sudo -u git -H sh -c 'gitolite/install -ln /home/git/bin' - # Do setup - ./bin/install + # Copy the gitlab user's (public) SSH key ... + sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub + sudo chmod 0444 /home/git/gitlab.pub + + # ... and use it as the admin key for the Gitolite setup + sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub" + +Fix the directory permissions for the configuration directory: + + # Make sure the Gitolite config dir is owned by git + sudo chmod 750 /home/git/.gitolite/ + sudo chown -R git:git /home/git/.gitolite/ + +Fix the directory permissions for the repositories: + + # Make sure the repositories dir is owned by git and it stays that way + sudo chmod -R ug+rwXs,o-rwx /home/git/repositories/ + sudo chown -R git:git /home/git/repositories/ + + +## Add domains to list to the list of known hosts + + sudo -u gitlab -H ssh git@localhost + sudo -u gitlab -H ssh git@YOUR_DOMAIN_NAME + sudo -u gitlab -H ssh git@YOUR_GITOLITE_DOMAIN_NAME + + +## Test if everything works so far + + # Clone the admin repo so SSH adds localhost to known_hosts ... + # ... and to be sure your users have access to Gitolite + sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin + + # If it succeeded without errors you can remove the cloned repo + sudo rm -rf /tmp/gitolite-admin + +**Important Note:** +If you can't clone the `gitolite-admin` repository: **DO NOT PROCEED WITH INSTALLATION**! +Check the [Trouble Shooting Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide) +and make sure you have followed all of the above steps carefully. # 5. Database -To setup the MySQL/PostgreSQL database and dependencies please see [`doc/install/databases.md`](./databases.md). +See `doc/install/databases.md` # 6. GitLab - # We'll install GitLab into home directory of the user "git" - cd /home/git + # We'll install GitLab into home directory of the user "gitlab" + cd /home/gitlab ## Clone the Source # Clone GitLab repository - sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab - - # Go to gitlab dir - cd /home/git/gitlab + 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 git -H git checkout 5-0-stable + sudo -u gitlab -H git checkout 4-1-stable **Note:** -You can change `5-0-stable` to `master` if you want the *bleeding edge* version, but +You can change `4-1-stable` to `master` if you want the *bleeding edge* version, but do so with caution! ## Configure it - cd /home/git/gitlab + cd /home/gitlab/gitlab # Copy the example GitLab config - sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml + sudo -u gitlab -H cp config/gitlab.yml.example config/gitlab.yml # Make sure to change "localhost" to the fully-qualified domain name of your # host serving GitLab where necessary - sudo -u git -H vim config/gitlab.yml + sudo -u gitlab -H vim config/gitlab.yml # Make sure GitLab can write to the log/ and tmp/ directories - sudo chown -R git log/ - sudo chown -R git tmp/ + sudo chown -R gitlab log/ + sudo chown -R gitlab tmp/ sudo chmod -R u+rwX log/ sudo chmod -R u+rwX tmp/ - # Create directory for satellites - sudo -u git -H mkdir /home/git/gitlab-satellites - - # Create directory for pids and make sure GitLab can write to it - sudo -u git -H mkdir tmp/pids/ - sudo chmod -R u+rwX tmp/pids/ + # Make directory for satellites + sudo -u gitlab -H mkdir /home/gitlab/gitlab-satellites # Copy the example Unicorn config - sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb + sudo -u gitlab -H cp config/unicorn.rb.example config/unicorn.rb **Important Note:** Make sure to edit both files to match your setup. @@ -167,36 +225,49 @@ Make sure to edit both files to match your setup. ## Configure GitLab DB settings # Mysql - sudo -u git cp config/database.yml.mysql config/database.yml + sudo -u gitlab cp config/database.yml.mysql config/database.yml # PostgreSQL - sudo -u git cp config/database.yml.postgresql config/database.yml + sudo -u gitlab cp config/database.yml.postgresql config/database.yml Make sure to update username/password in config/database.yml. ## Install Gems - cd /home/git/gitlab + cd /home/gitlab/gitlab sudo gem install charlock_holmes --version '0.6.9' # For MySQL (note, the option says "without") - sudo -u git -H bundle install --deployment --without development test postgres + sudo -u gitlab -H bundle install --deployment --without development test postgres # Or for PostgreSQL - sudo -u git -H bundle install --deployment --without development test mysql + sudo -u gitlab -H bundle install --deployment --without development test mysql +## Configure Git + +GitLab needs to be able to commit and push changes to Gitolite. In order to do +that Git requires a username and email. (We recommend using the same address +used for the `email.from` setting in `config/gitlab.yml`) + + sudo -u gitlab -H git config --global user.name "GitLab" + sudo -u gitlab -H git config --global user.email "gitlab@localhost" + +## Setup GitLab Hooks + + sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive + sudo chown git:git /home/git/.gitolite/hooks/common/post-receive ## Initialise Database and Activate Advanced Features - sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production + sudo -u gitlab -H bundle exec rake gitlab:setup RAILS_ENV=production ## Install Init Script Download the init script (will be /etc/init.d/gitlab): - sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab + sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/4-1-stable/init.d/gitlab sudo chmod +x /etc/init.d/gitlab Make GitLab start on boot: @@ -206,13 +277,13 @@ Make GitLab start on boot: ## Check Application Status -Check if GitLab and its environment are configured correctly: +Check if GitLab and its environment is configured correctly: - sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + sudo -u gitlab -H bundle exec rake gitlab:env:info RAILS_ENV=production To make sure you didn't miss anything run a more thorough check with: - sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production If all items are green, then congratulations on successfully installing GitLab! However there are still a few steps left. @@ -221,23 +292,23 @@ However there are still a few steps left. sudo service gitlab start # or - sudo /etc/init.d/gitlab restart + sudo /etc/init.d/gitlab start # 7. Nginx **Note:** If you can't or don't want to use Nginx as your web server, have a look at the -[`Advanced Setup Tips`](./installation.md#advanced-setup-tips) section. +"Advanced Setup Tips" section. ## Installation - sudo apt-get install nginx + sudo apt-get -y install nginx ## Site Configuration Download an example site config: - sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab + sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/4-1-stable/nginx/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab Make sure to edit the config file to match your setup: @@ -245,11 +316,11 @@ Make sure to edit the config file to match your setup: # Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN** # to the IP address and fully-qualified domain name # of your host serving GitLab - sudo vim /etc/nginx/sites-available/gitlab + sudo vim /etc/nginx/sites-enabled/gitlab ## Restart - sudo service nginx restart + sudo /etc/init.d/nginx restart # Done! @@ -279,13 +350,13 @@ a different host, you can configure its connection string via the `config/resque.yml` file. # example - production: redis://redis.example.tld:6379 + production: redis.example.tld:6379 ## Custom SSH Connection -If you are running SSH on a non-standard port, you must change the gitlab user's SSH config. - - # Add to /home/git/.ssh/config +If you are running SSH on a non-standard port, you must change the gitlab user'S SSH config. + + # Add to /home/gitlab/.ssh/config host localhost # Give your setup a name (here: override localhost) user git # Your remote git user port 2222 # Your port number @@ -293,26 +364,7 @@ If you are running SSH on a non-standard port, you must change the gitlab user's You also need to change the corresponding options (e.g. ssh_user, ssh_host, admin_uri) in the `config\gitlab.yml` file. -## LDAP authentication +## User-contributed Configurations -You can configure LDAP authentication in config/gitlab.yml. Please restart GitLab after editing this file. - -## Using Custom Omniauth Providers - -GitLab uses [Omniauth](http://www.omniauth.org/) for authentication and already ships with a few providers preinstalled (e.g. LDAP, GitHub, Twitter). But sometimes that is not enough and you need to integrate with other authentication solutions. For these cases you can use the Omniauth provider. - -### Steps - -These steps are fairly general and you will need to figure out the exact details from the Omniauth provider's documentation. - -* Add `gem "omniauth-your-auth-provider"` to the [Gemfile](https://github.com/gitlabhq/gitlabhq/blob/master/Gemfile#L18) -* Run `sudo -u gitlab -H bundle install` to install the new gem(s) -* Add provider specific configuration options to your `config/gitlab.yml` (you can use the [auth providers section of the example config](https://github.com/gitlabhq/gitlabhq/blob/master/config/gitlab.yml.example#L53) as a reference) -* Add icons for the new provider into the [vendor/assets/images/authbuttons](https://github.com/gitlabhq/gitlabhq/tree/master/vendor/assets/images/authbuttons) directory (you can find some more popular ones over at https://github.com/intridea/authbuttons) -* Restart GitLab - -### Examples - -If you have successfully set up a provider that is not shipped with GitLab itself, please let us know. -You can help others by reporting successful configurations and probably share a few insights or provide warnings for common errors or pitfalls by sharing your experience [in the public Wiki](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Working-Custom-Omniauth-Provider-Configurations). -While we can't officially support every possible auth mechanism out there, we'd like to at least help those with special needs. +You can find things like AWS installation scripts, init scripts or config files +for alternative web server in our [recipes collection](https://github.com/gitlabhq/gitlab-recipes/). diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 9209fad5..ec5b013c 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -1,3 +1,13 @@ +# Hardware + +We recommend you to run GitLab on a server with at least 1GB RAM. + +The necessary hard disk space largely depends on the size of the repos you want +to use GitLab with. But as a *rule of thumb* you should have at least as much +free space as your all repos combined take up. + + + # Operating Systems ## Linux @@ -26,7 +36,8 @@ systems. This means you may get it to work on systems running FreeBSD or OS X. ## Windows GitLab does **not** run on Windows and we have no plans of supporting it in the -near future. Please consider using a virtual machine to run GitLab. +near future. + # Rubies @@ -37,24 +48,6 @@ While it is generally possible to use other Rubies (like some work on your part. -# Hardware requirements - -## CPU - -We recommend a processor with **4 cores**. At a minimum you need a processor with 2 cores to responsively run an unmodified installation. - -## Memory - -We recommend you to run GitLab on a server with at least **1GB of RAM** memory. You can use it with 512MB of memory but you need to setup unicorn to use only 1 worker and you need at least 200MB of swap. The minimal requirement for an unmodified installation is 768MB. With 1.5GB of memory you should be able to support 1000+ users. - -## Storage - -The necessary hard drive space largely depends on the size of the repos you want -to store in GitLab. But as a *rule of thumb* you should have at least twice as much -free space as your all repos combined take up. You need twice the storage because [GitLab satellites](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/structure.md) contain an extra copy of each repo. Apart from a local hard drive you can also mount a volume that supports the network file system (NFS) protocol. This volume might be located on a file server, a network attached storage (NAS) device, a storage area network (SAN) or on an Amazon Web Services (AWS) Elastic Block Store (EBS) volume. - -If you have enough RAM memory and a recent CPU the speed of GitLab is mainly limited by hard drive seek times. Having a fast drive (7200 RPM and up) or a solid state drive (SSD) will improve the responsiveness of GitLab. - # Installation troubles and reporting success or failure diff --git a/doc/install/structure.md b/doc/install/structure.md index f580ea15..a67e12cc 100644 --- a/doc/install/structure.md +++ b/doc/install/structure.md @@ -3,23 +3,37 @@ This is the directory structure you will end up with following the instructions in the Installation Guide. |-- home - | |-- git + | |-- gitlab | |-- .ssh | |-- gitlab | |-- gitlab-satellites - | |-- gitlab-shell + | |-- git + | |-- .gitolite + | |-- .ssh + | |-- bin + | |-- gitolite | |-- repositories -**/home/git/.ssh** +**/home/gitlab/.ssh** + Contains the Gitolite admin key GitLab uses to configure Gitolite. -**/home/git/gitlab** +**/home/gitlab/gitlab** This is where GitLab lives. -**/home/git/gitlab-satellites** +**/home/gitlab/gitlab-satellites** Contains a copy of all repositories with a working tree. It's used for merge requests, editing files, etc. +**/home/git/.ssh** + Contains the SSH access configuration managed by Gitolite. + +**/home/git/bin** + Contains Gitolite executables. + +**/home/git/gitolite** + This is where Gitolite lives. + **/home/git/repositories** Holds all your repositories in bare format. This is the place Git uses when you pull/push to your projects. diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index d2da64f3..9b42afa7 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -31,6 +31,7 @@ Dumping database tables: - Dumping table wikis... [DONE] Dumping repositories: - Dumping repository abcd... [DONE] +- Dumping repository gitolite-admin.git... [DONE] Creating backup archive: $TIMESTAMP_gitlab_backup.tar [DONE] Deleting tmp directories...[DONE] Deleting old backups... [SKIPPING] @@ -76,5 +77,6 @@ Restoring database tables: - Loading fixture wikis...[SKIPPING] Restoring repositories: - Restoring repository abcd... [DONE] +- Restoring repository gitolite-admin.git... [DONE] Deleting tmp directories...[DONE] ``` diff --git a/doc/raketasks/cleanup.md b/doc/raketasks/cleanup.md index 30a5d362..ad9e5a61 100644 --- a/doc/raketasks/cleanup.md +++ b/doc/raketasks/cleanup.md @@ -1,4 +1,10 @@ -### Remove grabage from filesystem. Important! Data loss! +### 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 diff --git a/doc/raketasks/features.md b/doc/raketasks/features.md index 018817d2..7f7daaf0 100644 --- a/doc/raketasks/features.md +++ b/doc/raketasks/features.md @@ -17,12 +17,12 @@ bundle exec rake gitlab:enable_namespaces RAILS_ENV=production ``` -### Rebuild project satellites +### Enable auto merge -This command will build missing satellites for projects. After this you will be able to **merge a merge request** via GitLab and use the **online editor**. +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:satellites:create RAILS_ENV=production +bundle exec rake gitlab:enable_automerge RAILS_ENV=production ``` Example output: diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index b5514705..ee5a8a3b 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -15,7 +15,7 @@ System: Debian 6.0.6 Current User: gitlab Using RVM: yes RVM Version: 1.17.2 -Ruby Version: ruby-1.9.3-p392 +Ruby Version: ruby-1.9.3-p327 Gem Version: 1.8.24 Bundler Version:1.2.3 Rake Version: 10.0.1 @@ -31,10 +31,12 @@ SSH Clone URL: git@localhost:some-project.git Using LDAP: no Using Omniauth: no -GitLab Shell -Version: 1.0.4 +Gitolite information +Version: v3.04-4-g4524f01 +Admin URI: git@localhost:gitolite-admin +Admin Key: gitlab Repositories: /home/git/repositories/ -Hooks: /home/git/gitlab-shell/hooks/ +Hooks: /home/git/.gitolite/hooks/ Git: /usr/bin/git ``` @@ -44,8 +46,8 @@ Git: /usr/bin/git Runs the following rake tasks: * gitlab:env:check -* gitlab:gitlab_shell:check -* gitlab:sidekiq:check +* gitlab:gitolite:check +* gitlab:resque:check * gitlab:app:check It will check that each component was setup according to the installation guide and suggest fixes for issues found. @@ -72,12 +74,16 @@ Checking Environment ... Finished Checking Gitolite ... Using recommended version ... yes +Repo umask is 0007 in .gitolite.rc? ... yes +Allow all Git config keys in .gitolite.rc ... yes Config directory exists? ... yes Config directory owned by git:git? ... yes Config directory access is drwxr-x---? ... yes Repo base directory exists? ... yes Repo base owned by git:git? ... yes -Repo base access is drwxrws---? ... yes +Repo base access is drwsrws---? ... yes +Can clone gitolite-admin? ... yes +Can commit to gitolite-admin? ... yes post-receive hook exists? ... yes post-receive hook up-to-date? ... yes post-receive hooks in repos are links: ... @@ -129,6 +135,24 @@ If necessary, remove the `tmp/repo_satellites` directory and rerun the command b bundle exec rake gitlab:satellites:create RAILS_ENV=production ``` + +### Rebuild each key at gitolite config + +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 RAILS_ENV=production +``` + + +### Rebuild each project at gitolite config + +This makes sure that all projects are present in gitolite and can be accessed. + +``` +bundle exec rake gitlab:gitolite:update_repos RAILS_ENV=production +``` + ### Import bare repositories into GitLab project instance Notes: diff --git a/features/admin/teams.feature b/features/admin/teams.feature deleted file mode 100644 index 6a15fddc..00000000 --- a/features/admin/teams.feature +++ /dev/null @@ -1,70 +0,0 @@ -Feature: Admin Teams - Background: - Given I sign in as an admin - And Create gitlab user "John" - - Scenario: Create a team - When I visit admin teams page - And I click new team link - And submit form with new team info - Then I should be redirected to team page - And I should see newly created team - - Scenario: Add user to team - When I visit admin teams page - When I have clean "HardCoders" team - And I visit "HardCoders" team page - When I click to "Add members" link - When I select user "John" from user list as "Developer" - And submit form with new team member info - Then I should see "John" in teams members list as "Developer" - - Scenario: Assign team to existing project - When I visit admin teams page - When I have "HardCoders" team with "John" member with "Developer" role - When I have "Shop" project - And I visit "HardCoders" team page - Then I should see empty projects table - When I click to "Add projects" link - When I select project "Shop" with max access "Reporter" - And submit form with new team project info - Then I should see "Shop" project in projects list - When I visit "Shop" project admin page - Then I should see "John" user with role "Reporter" in team table - - Scenario: Add user to team with ptojects - When I visit admin teams page - When I have "HardCoders" team with "John" member with "Developer" role - And "HardCoders" team assigned to "Shop" project with "Developer" max role access - When I have gitlab user "Jimm" - And I visit "HardCoders" team page - Then I should see members table without "Jimm" member - When I click to "Add members" link - When I select user "Jimm" ub team members list as "Master" - And submit form with new team member info - Then I should see "Jimm" in teams members list as "Master" - - Scenario: Remove member from team - Given I have users team "HardCoders" - And gitlab user "John" is a member "HardCoders" team - And gitlab user "Jimm" is a member "HardCoders" team - And "HardCoders" team is assigned to "Shop" project - When I visit admin teams page - When I visit "HardCoders" team admin page - Then I shoould see "John" in members list - And I should see "Jimm" in members list - And I should see "Shop" in projects list - When I click on remove "Jimm" user link - Then I should be redirected to "HardCoders" team admin page - And I should not to see "Jimm" user in members list - - Scenario: Remove project from team - Given I have users team "HardCoders" - And gitlab user "John" is a member "HardCoders" team - And gitlab user "Jimm" is a member "HardCoders" team - And "HardCoders" team is assigned to "Shop" project - When I visit admin teams page - When I visit "HardCoders" team admin page - Then I should see "Shop" project in projects list - When I click on "Relegate" link on "Shop" project - Then I should see projects liston team page without "Shop" project diff --git a/features/admin/users.feature b/features/admin/users.feature index 4c951df9..03ac86a3 100644 --- a/features/admin/users.feature +++ b/features/admin/users.feature @@ -6,11 +6,3 @@ Feature: Admin Users Scenario: On Admin Users Given I visit admin users page Then I should see all users - - Scenario: Edit user and change username to non ascii char - When I visit admin users page - And Click edit - And Input non ascii char in username - And Click save - Then See username error message - And Not chenged form action url diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index 695148b5..75984369 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -16,6 +16,12 @@ Feature: Dashboard And I visit dashboard page Then I should see groups list + Scenario: I should see correct projects count + Given I have group with projects + And group has a projects that does not belongs to me + When I visit dashboard page + Then I should see 1 project at group list + Scenario: I should see last push widget Then I should see last push widget And I click "Create Merge Request" link diff --git a/features/dashboard/projects.feature b/features/dashboard/projects.feature deleted file mode 100644 index 7e617bd1..00000000 --- a/features/dashboard/projects.feature +++ /dev/null @@ -1,12 +0,0 @@ -Feature: Dashboard projects - Background: - Given I sign in as a user - And I own project "Shop" - And I visit dashboard projects page - - Scenario: I should see projects list - Then I should see projects list - - Scenario: I should see project I am looking for - Given I search for "Sho" - Then I should see "Shop" project link diff --git a/features/group/create_group.feature b/features/group/create_group.feature deleted file mode 100644 index b77f3599..00000000 --- a/features/group/create_group.feature +++ /dev/null @@ -1,11 +0,0 @@ -Feature: Groups - Background: - Given I sign in as a user - - Scenario: Create a group from dasboard - Given I have group with projects - And I visit dashboard page - When I click new group link - And submit form with new group info - Then I should be redirected to group page - And I should see newly created group diff --git a/features/group/group.feature b/features/group/group.feature index a48affe8..a4a55a7f 100644 --- a/features/group/group.feature +++ b/features/group/group.feature @@ -24,9 +24,3 @@ Feature: Groups 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 - - Scenario: I should see edit group page - When I visit group settings page - And I change group name - Then I should see new group name - diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index f33e4b9e..2d3e41d3 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -49,52 +49,51 @@ Feature: Project active tab Scenario: On Project Home/Show Given I visit my project's home page - Then the active main tab should be Home - And no other main tabs should be active + Then the active sub tab should be Show + And no other sub tabs should be active + And the active main tab should be Home - #Scenario: On Project Settings/Attachments - #Given I visit my project's home page - #And I click the "Attachments" tab - #Then the active sub tab should be Attachments - #And no other sub tabs should be active - #And the active main tab should be Home - - #Scenario: On Project Settings/Snippets - #Given I visit my project's home page - #And I click the "Snippets" tab - #Then the active sub tab should be Snippets - #And no other sub tabs should be active - #And the active main tab should be Home - - # Sub Tabs: Settings - - Scenario: On Project Settings/Team - Given I visit my project's settings page + Scenario: On Project Home/Team + Given I visit my project's home page And I click the "Team" tab Then the active sub tab should be Team And no other sub tabs should be active - And the active main tab should be Settings + And the active main tab should be Home - Scenario: On Project Settings/Edit - Given I visit my project's settings page + Scenario: On Project Home/Attachments + Given I visit my project's home page + And I click the "Attachments" tab + Then the active sub tab should be Attachments + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Snippets + Given I visit my project's home page + And I click the "Snippets" tab + Then the active sub tab should be Snippets + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Edit + Given I visit my project's home page And I click the "Edit" tab Then the active sub tab should be Edit And no other sub tabs should be active - And the active main tab should be Settings + And the active main tab should be Home - Scenario: On Project Settings/Hooks - Given I visit my project's settings page + Scenario: On Project Home/Hooks + Given I visit my project's home page And I click the "Hooks" tab Then the active sub tab should be Hooks And no other sub tabs should be active - And the active main tab should be Settings + And the active main tab should be Home - Scenario: On Project Settings/Deploy Keys - Given I visit my project's settings page + Scenario: On Project Home/Deploy Keys + Given I visit my project's home page And I click the "Deploy Keys" tab Then the active sub tab should be Deploy Keys And no other sub tabs should be active - And the active main tab should be Settings + And the active main tab should be Home # Sub Tabs: Commits diff --git a/features/project/network.feature b/features/project/network.feature index a6cbd2c4..31ce5ad3 100644 --- a/features/project/network.feature +++ b/features/project/network.feature @@ -7,19 +7,3 @@ Feature: Project Network Graph @javascript Scenario: I should see project network Then page should have network graph - And page should select "master" in select box - And page should have "master" on graph - - @javascript - Scenario: I should switch ref to "stable" - When I switch ref to "stable" - Then page should have network graph - And page should select "stable" in select box - And page should have "stable" on graph - - @javascript - Scenario: I should looking for a commit by SHA of "v2.1.0" - When I looking for a commit by SHA of "v2.1.0" - Then page should have network graph - And page should select "master" in select box - And page should have "v2.1.0" on graph diff --git a/features/project/project.feature b/features/project/project.feature index 0c8c97c8..23fef69e 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -18,3 +18,6 @@ Feature: Project Feature 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/source/browse_files.feature b/features/project/source/browse_files.feature index ee26f537..0b8495ff 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -12,7 +12,7 @@ Feature: Project Browse files Then I should see files from repository for "8470d70" Scenario: I browse file content - Given I click on "Gemfile.lock" file in repo + Given I click on "Gemfile" file in repo Then I should see it content Scenario: I browse raw file @@ -22,6 +22,6 @@ Feature: Project Browse files @javascript Scenario: I can edit file - Given I click on "Gemfile.lock" file in repo + Given I click on "Gemfile" file in repo And I click button "edit" Then I can edit code diff --git a/features/project/source/git_blame.feature b/features/project/source/git_blame.feature index 3b20437a..93ed20a8 100644 --- a/features/project/source/git_blame.feature +++ b/features/project/source/git_blame.feature @@ -5,6 +5,6 @@ Feature: Project Browse git repo Given I visit project source page Scenario: I blame file - Given I click on "Gemfile.lock" file in repo + Given I click on "Gemfile" file in repo And I click blame button Then I should see git file blame diff --git a/features/project/team_management.feature b/features/project/team_management.feature index 04545a08..0ac37620 100644 --- a/features/project/team_management.feature +++ b/features/project/team_management.feature @@ -11,7 +11,6 @@ Feature: Project Team management Then I should be able to see myself in team And I should see "Sam" in team list - @javascript Scenario: Add user to project Given I click link "New Team Member" And I select "Mike" as "Reporter" @@ -24,8 +23,13 @@ Feature: Project Team management Then I visit project "Shop" team page And I should see "Sam" in team list as "Reporter" + Scenario: View team member profile + Given I click link "Sam" + Then I should see "Sam" team profile + Scenario: Cancel team member - Given I click cancel link for "Sam" + Given I click link "Sam" + And I click link "Remove from team" Then I visit project "Shop" team page And I should not see "Sam" in team list diff --git a/features/project/wiki.feature b/features/project/wiki.feature index 90eb2b79..f052e2f2 100644 --- a/features/project/wiki.feature +++ b/features/project/wiki.feature @@ -5,43 +5,5 @@ Feature: Project Wiki Given I visit project wiki page Scenario: Add new page - Given I create the Wiki Home page - Then I should see the newly created wiki page - - Scenario: Pressing Cancel while editing a brand new Wiki - Given I click on the Cancel button - Then I should be redirected back to the Edit Home Wiki page - - Scenario: Edit existing page - Given I have an existing Wiki page - And I browse to that Wiki page - And I click on the Edit button - And I change the content - Then I should see the updated content - - Scenario: Pressing Cancel while editing an existing Wiki page - Given I have an existing Wiki page - And I browse to that Wiki page - And I click on the Edit button - And I click on the Cancel button - Then I should be redirected back to that Wiki page - - Scenario: View page history - Given I have an existing wiki page - And That page has two revisions - And I browse to that Wiki page - And I click the History button - Then I should see both revisions - - Scenario: Destroy Wiki page - Given I have an existing wiki page - And I browse to that Wiki page - And I click on the Edit button - And I click on the "Delete this page" button - Then The page should be deleted - - Scenario: View all pages - Given I have an existing wiki page - And I browse to that Wiki page - And I click on the "Pages" button - Then I should see the existing page in the pages list + Given I create Wiki page + Then I should see newly created wiki page diff --git a/features/steps/admin/admin_active_tab.rb b/features/steps/admin/admin_active_tab.rb index f14c5f39..48ec7bac 100644 --- a/features/steps/admin/admin_active_tab.rb +++ b/features/steps/admin/admin_active_tab.rb @@ -4,7 +4,7 @@ class AdminActiveTab < Spinach::FeatureSteps include SharedActiveTab Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') + ensure_active_main_tab('Stats') end Then 'the active main tab should be Projects' do diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb index 167763b6..cbca2daa 100644 --- a/features/steps/admin/admin_groups.rb +++ b/features/steps/admin/admin_groups.rb @@ -25,13 +25,11 @@ class AdminGroups < Spinach::FeatureSteps And 'submit form with new group info' do fill_in 'group_name', :with => 'gitlab' - fill_in 'group_description', :with => 'Group description' click_button "Create group" end Then 'I should see newly created group' do page.should have_content "Group: gitlab" - page.should have_content "Group description" end Then 'I should be redirected to group page' do diff --git a/features/steps/admin/admin_projects.rb b/features/steps/admin/admin_projects.rb index b410b238..dd6b4e98 100644 --- a/features/steps/admin/admin_projects.rb +++ b/features/steps/admin/admin_projects.rb @@ -16,7 +16,9 @@ class AdminProjects < Spinach::FeatureSteps 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_teams.rb b/features/steps/admin/admin_teams.rb deleted file mode 100644 index 65c7e485..00000000 --- a/features/steps/admin/admin_teams.rb +++ /dev/null @@ -1,236 +0,0 @@ -class AdminTeams < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedActiveTab - include SharedAdmin - - And 'I have own project' do - create :project - end - - And 'Create gitlab user "John"' do - @user = create(:user, name: "John") - end - - And 'I click new team link' do - click_link "New Team" - end - - And 'submit form with new team info' do - fill_in 'user_team_name', with: 'gitlab' - fill_in 'user_team_description', with: 'description' - click_button 'Create team' - end - - Then 'I should be redirected to team page' do - current_path.should == admin_team_path(UserTeam.last) - end - - And 'I should see newly created team' do - page.should have_content "Team: gitlab" - page.should have_content "description" - end - - When 'I visit admin teams page' do - visit admin_teams_path - end - - When 'I have clean "HardCoders" team' do - @team = create :user_team, name: "HardCoders", owner: current_user - end - - And 'I visit "HardCoders" team page' do - visit admin_team_path(UserTeam.find_by_name("HardCoders")) - end - - Then 'I should see only me in members table' do - members_list = find("#members_list .member") - members_list.should have_content(current_user.name) - members_list.should have_content(current_user.username) - end - - When 'I select user "John" from user list as "Developer"' do - @user ||= User.find_by_name("John") - within "#team_members" do - select "#{@user.name} (#{@user.username})", from: "user_ids" - select "Developer", from: "default_project_access" - end - end - - And 'submit form with new team member info' do - click_button 'add_members_to_team' - end - - Then 'I should see "John" in teams members list as "Developer"' do - @user ||= User.find_by_name("John") - find_in_list("#members_list .member", @user).must_equal true - end - - When 'I visit "John" user admin page' do - pending 'step not implemented' - end - - Then 'I should see "HardCoders" team in teams table' do - pending 'step not implemented' - end - - When 'I have "HardCoders" team with "John" member with "Developer" role' do - @team = create :user_team, name: "HardCoders", owner: current_user - @user ||= User.find_by_name("John") - @team.add_member(@user, UserTeam.access_roles["Developer"], group_admin: false) - end - - When 'I have "Shop" project' do - @project = create :project, name: "Shop" - end - - Then 'I should see empty projects table' do - page.has_no_css?("#projects_list").must_equal true - end - - When 'I select project "Shop" with max access "Reporter"' do - @project ||= Project.find_by_name("Shop") - within "#assign_projects" do - select @project.name, from: "project_ids" - select "Reporter", from: "greatest_project_access" - end - - end - - And 'submit form with new team project info' do - click_button 'assign_projects_to_team' - end - - Then 'I should see "Shop" project in projects list' do - project = Project.find_by_name("Shop") - find_in_list("#projects_list .project", project).must_equal true - end - - When 'I visit "Shop" project admin page' do - project = Project.find_by_name("Shop") - visit admin_project_path(project) - end - - And '"HardCoders" team assigned to "Shop" project with "Developer" max role access' do - @team = UserTeam.find_by_name("HardCoders") - @project = create :project, name: "Shop" - @team.assign_to_project(@project, UserTeam.access_roles["Developer"]) - end - - When 'I have gitlab user "Jimm"' do - create :user, name: "Jimm" - end - - Then 'I should see members table without "Jimm" member' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal false - end - - When 'I select user "Jimm" ub team members list as "Master"' do - user = User.find_by_name("Jimm") - within "#team_members" do - select "#{user.name} (#{user.username})", from: "user_ids" - select "Developer", from: "default_project_access" - end - end - - Then 'I should see "Jimm" in teams members list as "Master"' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal true - end - - Given 'I have users team "HardCoders"' do - @team = create :user_team, name: "HardCoders" - end - - And 'gitlab user "John" is a member "HardCoders" team' do - @team = UserTeam.find_by_name("HardCoders") - @user = User.find_by_name("John") - @user = create :user, name: "John" unless @user - @team.add_member(@user, UserTeam.access_roles["Master"], group_admin: false) - end - - And 'gitlab user "Jimm" is a member "HardCoders" team' do - @team = UserTeam.find_by_name("HardCoders") - @user = User.find_by_name("Jimm") - @user = create :user, name: "Jimm" unless @user - @team.add_member(@user, UserTeam.access_roles["Master"], group_admin: false) - end - - And '"HardCoders" team is assigned to "Shop" project' do - @team = UserTeam.find_by_name("HardCoders") - @project = create :project, name: "Shop" - @team.assign_to_project(@project, UserTeam.access_roles["Developer"]) - end - - When 'I visit "HardCoders" team admin page' do - visit admin_team_path(UserTeam.find_by_name("HardCoders")) - end - - Then 'I shoould see "John" in members list' do - user = User.find_by_name("John") - find_in_list("#members_list .member", user).must_equal true - end - - And 'I should see "Jimm" in members list' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal true - end - - And 'I should see "Shop" in projects list' do - project = Project.find_by_name("Shop") - find_in_list("#projects_list .project", project).must_equal true - end - - When 'I click on remove "Jimm" user link' do - user = User.find_by_name("Jimm") - click_link "remove_member_#{user.id}" - end - - Then 'I should be redirected to "HardCoders" team admin page' do - current_path.should == admin_team_path(UserTeam.find_by_name("HardCoders")) - end - - And 'I should not to see "Jimm" user in members list' do - user = User.find_by_name("Jimm") - find_in_list("#members_list .member", user).must_equal false - end - - When 'I click on "Relegate" link on "Shop" project' do - project = Project.find_by_name("Shop") - click_link "relegate_project_#{project.id}" - end - - Then 'I should see projects liston team page without "Shop" project' do - project = Project.find_by_name("Shop") - find_in_list("#projects_list .project", project).must_equal false - end - - Then 'I should see "John" user with role "Reporter" in team table' do - user = User.find_by_name("John") - find_in_list(".team_members", user).must_equal true - end - - When 'I click to "Add members" link' do - click_link "Add members" - end - - When 'I click to "Add projects" link' do - click_link "Add projects" - end - - protected - - def current_team - @team ||= Team.first - end - - def find_in_list(selector, item) - members_list = all(selector) - entered = false - members_list.each do |member_item| - entered = true if member_item.has_content?(item.name) - end - entered - end -end diff --git a/features/steps/admin/admin_users.rb b/features/steps/admin/admin_users.rb index 61b3ed91..1828ae70 100644 --- a/features/steps/admin/admin_users.rb +++ b/features/steps/admin/admin_users.rb @@ -8,27 +8,4 @@ class AdminUsers < Spinach::FeatureSteps page.should have_content user.name end end - - And 'Click edit' do - @user = User.first - find("#edit_user_#{@user.id}").click - end - - And 'Input non ascii char in username' do - fill_in 'user_username', with: "\u3042\u3044" - end - - And 'Click save' do - click_button("Save") - end - - Then 'See username error message' do - within "#error_explanation" do - page.should have_content "Username" - end - end - - And 'Not chenged form action url' do - page.should have_selector %(form[action="/admin/users/#{@user.username}"]) - end end diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index c6832056..4bcefba7 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -33,7 +33,7 @@ class Dashboard < Spinach::FeatureSteps Event.create( project: project, author_id: user.id, - action: Event::JOINED + action: Event::Joined ) end @@ -47,7 +47,7 @@ class Dashboard < Spinach::FeatureSteps Event.create( project: project, author_id: user.id, - action: Event::LEFT + action: Event::Left ) end @@ -63,12 +63,6 @@ class Dashboard < Spinach::FeatureSteps @project.team << [current_user, :master] end - Then 'I should see projects list' do - @user.authorized_projects.all.each do |project| - page.should have_link project.name_with_namespace - end - end - Then 'I should see groups list' do Group.all.each do |group| page.should have_link group.name diff --git a/features/steps/dashboard/dashboard_event_filters.rb b/features/steps/dashboard/dashboard_event_filters.rb index afa15c31..bfc05363 100644 --- a/features/steps/dashboard/dashboard_event_filters.rb +++ b/features/steps/dashboard/dashboard_event_filters.rb @@ -45,7 +45,7 @@ class EventFilters < Spinach::FeatureSteps @event = Event.create( project: @project, - action: Event::PUSHED, + action: Event::Pushed, data: data, author_id: @user.id ) @@ -56,7 +56,7 @@ class EventFilters < Spinach::FeatureSteps Event.create( project: @project, author_id: user.id, - action: Event::JOINED + action: Event::Joined ) end @@ -64,7 +64,7 @@ class EventFilters < Spinach::FeatureSteps merge_request = create :merge_request, author: @user, project: @project Event.create( project: @project, - action: Event::MERGED, + action: Event::Merged, target_id: merge_request.id, target_type: "MergeRequest", author_id: @user.id diff --git a/features/steps/dashboard/dashboard_projects.rb b/features/steps/dashboard/dashboard_projects.rb deleted file mode 100644 index 670e25a9..00000000 --- a/features/steps/dashboard/dashboard_projects.rb +++ /dev/null @@ -1,23 +0,0 @@ -class DashboardProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - Then 'I should see projects list' do - @user.authorized_projects.all.each do |project| - page.should have_link project.name_with_namespace - end - end - - Given 'I search for "Sho"' do - fill_in "dashboard_projects_search", with: "Sho" - - within ".dashboard-search-filter" do - find('button').click - end - end - - Then 'I should see "Shop" project link' do - page.should have_link "Shop" - end -end diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 5ac958e3..04d8c874 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -28,7 +28,7 @@ class Groups < Spinach::FeatureSteps Then 'I should see merge requests from this group assigned to me' do assigned_to_me(:merge_requests).each do |issue| - page.should have_content issue.title[0..80] + page.should have_content issue.title end end @@ -64,37 +64,6 @@ class Groups < Spinach::FeatureSteps author: current_user end - When 'I click new group link' do - click_link "New Group" - end - - And 'submit form with new group info' do - fill_in 'group_name', with: 'Samurai' - fill_in 'group_description', with: 'Tokugawa Shogunate' - click_button "Create group" - end - - Then 'I should see newly created group' do - page.should have_content "Samurai" - page.should have_content "Tokugawa Shogunate" - page.should have_content "You will only see events from projects in this group" - end - - Then 'I should be redirected to group page' do - current_path.should == group_path(Group.last) - end - - And 'I change group name' do - fill_in 'group_name', :with => 'new-name' - click_button "Save group" - end - - Then 'I should see new group name' do - within ".navbar-gitlab" do - page.should have_content "group: new-name" - end - end - protected def current_group diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index a02ed057..b6833f2b 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -23,19 +23,15 @@ class Profile < Spinach::FeatureSteps end Then 'I change my password' do - within '.update-password' do - fill_in "user_password", :with => "222333" - fill_in "user_password_confirmation", :with => "222333" - click_button "Save" - end + fill_in "user_password", :with => "222333" + fill_in "user_password_confirmation", :with => "222333" + click_button "Save" end When 'I unsuccessfully change my password' do - within '.update-password' do - fill_in "user_password", with: "password" - fill_in "user_password_confirmation", with: "confirmation" - click_button "Save" - end + fill_in "user_password", with: "password" + fill_in "user_password_confirmation", with: "confirmation" + click_button "Save" end Then "I should see a password error message" do @@ -47,10 +43,8 @@ class Profile < Spinach::FeatureSteps end Then 'I reset my token' do - within '.update-token' do - @old_token = @user.private_token - click_button "Reset" - end + @old_token = @user.private_token + click_button "Reset" end And 'I should see new token' do @@ -67,15 +61,11 @@ class Profile < Spinach::FeatureSteps end When "I change my application theme" do - within '.application-theme' do - choose "Violet" - end + choose "Violet" end When "I change my code preview theme" do - within '.code-preview-theme' do - choose "Solarized Dark" - end + choose "Dark code preview" end Then "I should see the theme change immediately" do diff --git a/features/steps/profile/profile_active_tab.rb b/features/steps/profile/profile_active_tab.rb index ee9f5f20..1924a6fa 100644 --- a/features/steps/profile/profile_active_tab.rb +++ b/features/steps/profile/profile_active_tab.rb @@ -4,7 +4,7 @@ class ProfileActiveTab < Spinach::FeatureSteps include SharedActiveTab Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') + ensure_active_main_tab('Profile') end Then 'the active main tab should be Account' do diff --git a/features/steps/profile/profile_ssh_keys.rb b/features/steps/profile/profile_ssh_keys.rb index fbb92077..8ae1fa91 100644 --- a/features/steps/profile/profile_ssh_keys.rb +++ b/features/steps/profile/profile_ssh_keys.rb @@ -43,6 +43,6 @@ class ProfileSshKeys < Spinach::FeatureSteps end And 'I have ssh key "ssh-rsa Work"' do - create(:key, :user => @user, :title => "ssh-rsa Work", :key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work") + create(:key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work") end end diff --git a/features/steps/project/project_active_tab.rb b/features/steps/project/project_active_tab.rb index 4c6d890f..a5c80353 100644 --- a/features/steps/project/project_active_tab.rb +++ b/features/steps/project/project_active_tab.rb @@ -7,11 +7,7 @@ class ProjectActiveTab < Spinach::FeatureSteps # Main Tabs Then 'the active main tab should be Home' do - ensure_active_main_tab('Home') - end - - Then 'the active main tab should be Settings' do - ensure_active_main_tab('Settings') + ensure_active_main_tab(@project.name) end Then 'the active main tab should be Files' do diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb index b4c595fa..3433c2ba 100644 --- a/features/steps/project/project_browse_commits.rb +++ b/features/steps/project/project_browse_commits.rb @@ -15,7 +15,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps end Then 'I see commits atom feed' do - commit = @project.repository.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) diff --git a/features/steps/project/project_browse_files.rb b/features/steps/project/project_browse_files.rb index 71360fb6..4efce0dc 100644 --- a/features/steps/project/project_browse_files.rb +++ b/features/steps/project/project_browse_files.rb @@ -16,12 +16,12 @@ class ProjectBrowseFiles < Spinach::FeatureSteps page.should have_content "Gemfile" end - Given 'I click on "Gemfile.lock" file in repo' do - click_link "Gemfile.lock" + Given 'I click on "Gemfile" file in repo' do + click_link "Gemfile" end Then 'I should see it content' do - page.should have_content "DEPENDENCIES" + page.should have_content "rubygems.org" end And 'I click link "raw"' do diff --git a/features/steps/project/project_browse_git_repo.rb b/features/steps/project/project_browse_git_repo.rb index cd9a60f4..19edfb07 100644 --- a/features/steps/project/project_browse_git_repo.rb +++ b/features/steps/project/project_browse_git_repo.rb @@ -3,8 +3,8 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps include SharedProject include SharedPaths - Given 'I click on "Gemfile.lock" file in repo' do - click_link "Gemfile.lock" + Given 'I click on "Gemfile" file in repo' do + click_link "Gemfile" end And 'I click blame button' do @@ -12,7 +12,7 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps end Then 'I should see git file blame' do - page.should have_content "DEPENDENCIES" + page.should have_content "rubygems.org" page.should have_content "Dmitriy Zaporozhets" page.should have_content "Moving to rails 3.2" end diff --git a/features/steps/project/project_issues.rb b/features/steps/project/project_issues.rb index 7d540099..2103aeb1 100644 --- a/features/steps/project/project_issues.rb +++ b/features/steps/project/project_issues.rb @@ -122,9 +122,10 @@ class ProjectIssues < Spinach::FeatureSteps And 'project "Shop" have "Release 0.3" closed issue' do project = Project.find_by_name("Shop") - create(:closed_issue, + create(:issue, :title => "Release 0.3", :project => project, - :author => project.users.first) + :author => project.users.first, + :closed => true) end end diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb index 4c22119b..329261ad 100644 --- a/features/steps/project/project_merge_requests.rb +++ b/features/steps/project/project_merge_requests.rb @@ -25,8 +25,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps end Then 'I should see closed merge request "Bug NS-04"' do - merge_request = MergeRequest.find_by_title!("Bug NS-04") - merge_request.closed?.should be_true + mr = MergeRequest.find_by_title("Bug NS-04") + mr.closed.should be_true page.should have_content "Closed by" end @@ -63,6 +63,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps end And 'project "Shop" have "Bug NS-04" open merge request' do + project = Project.find_by_name("Shop") create(:merge_request, title: "Bug NS-04", project: project, @@ -70,6 +71,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps end And 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do + project = Project.find_by_name("Shop") create(:merge_request_with_diffs, title: "Bug NS-05", project: project, @@ -77,23 +79,27 @@ class ProjectMergeRequests < Spinach::FeatureSteps end And 'project "Shop" have "Feature NS-03" closed merge request' do - create(:closed_merge_request, + project = Project.find_by_name("Shop") + create(:merge_request, title: "Feature NS-03", project: project, - author: project.users.first) + author: project.users.first, + closed: true) end And 'I switch to the diff tab' do - visit diffs_project_merge_request_path(project, merge_request) + mr = MergeRequest.find_by_title("Bug NS-05") + visit diffs_project_merge_request_path(mr.project, mr) end And 'I switch to the merge request\'s comments tab' do - visit project_merge_request_path(project, merge_request) + mr = MergeRequest.find_by_title("Bug NS-05") + visit project_merge_request_path(mr.project, mr) end And 'I click on the first commit in the merge request' do - - click_link merge_request.commits.first.short_id(8) + mr = MergeRequest.find_by_title("Bug NS-05") + click_link mr.commits.first.short_id(8) end And 'I leave a comment on the diff page' do @@ -116,7 +122,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps end Then 'I should see a discussion has started on line 185' do - first_commit = merge_request.commits.first + mr = MergeRequest.find_by_title("Bug NS-05") + first_commit = mr.commits.first first_diff = first_commit.diffs.first page.should have_content "#{current_user.name} started a discussion on this merge request diff" page.should have_content "#{first_diff.b_path}:L185" @@ -124,7 +131,8 @@ class ProjectMergeRequests < Spinach::FeatureSteps end Then 'I should see a discussion has started on commit bcf03b5de6c:L185' do - first_commit = merge_request.commits.first + mr = MergeRequest.find_by_title("Bug NS-05") + first_commit = mr.commits.first first_diff = first_commit.diffs.first page.should have_content "#{current_user.name} started a discussion on commit" page.should have_content first_commit.short_id(8) @@ -133,19 +141,12 @@ class ProjectMergeRequests < Spinach::FeatureSteps end Then 'I should see a discussion has started on commit bcf03b5de6c' do - first_commit = merge_request.st_commits.first + mr = MergeRequest.find_by_title("Bug NS-05") + first_commit = mr.st_commits.first first_diff = first_commit.diffs.first page.should have_content "#{current_user.name} started a discussion on commit bcf03b5de6c" page.should have_content first_commit.short_id(8) page.should have_content "One comment to rule them all" page.should have_content "#{first_diff.b_path}:L185" end - - def project - @project ||= Project.find_by_name!("Shop") - end - - def merge_request - @merge_request ||= MergeRequest.find_by_title!("Bug NS-05") - end end diff --git a/features/steps/project/project_network_graph.rb b/features/steps/project/project_network_graph.rb index cf5fa751..77149bfe 100644 --- a/features/steps/project/project_network_graph.rb +++ b/features/steps/project/project_network_graph.rb @@ -4,53 +4,16 @@ class ProjectNetworkGraph < Spinach::FeatureSteps Then 'page should have network graph' do page.should have_content "Project Network Graph" - page.should have_selector ".graph" + within ".graph" do + page.should have_content "master" + end end - When 'I visit project "Shop" network page' do - # Stub Graph max_size to speed up test (10 commits vs. 650) - Network::Graph.stub(max_count: 10) + And 'I visit project "Shop" network page' do + # Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650) + Gitlab::Graph::JsonBuilder.stub(max_count: 10) project = Project.find_by_name("Shop") - visit project_graph_path(project, "master") - end - - And 'page should select "master" in select box' do - page.should have_selector '#ref_chzn span', :text => "master" - end - - And 'page should have "master" on graph' do - within '.graph' do - page.should have_content 'master' - end - end - - When 'I switch ref to "stable"' do - page.select 'stable', :from => 'ref' - sleep 2 - end - - And 'page should select "stable" in select box' do - page.should have_selector '#ref_chzn span', :text => "stable" - end - - And 'page should have "stable" on graph' do - within '.graph' do - page.should have_content 'stable' - end - end - - When 'I looking for a commit by SHA of "v2.1.0"' do - within ".content .search" do - fill_in 'q', :with => '98d6492' - find('button').click - end - sleep 2 - end - - And 'page should have "v2.1.0" on graph' do - within '.graph' do - page.should have_content 'v2.1.0' - end + visit graph_project_path(project) end end diff --git a/features/steps/project/project_team_management.rb b/features/steps/project/project_team_management.rb index e8e05435..91b3ffee 100644 --- a/features/steps/project/project_team_management.rb +++ b/features/steps/project/project_team_management.rb @@ -2,17 +2,16 @@ class ProjectTeamManagement < Spinach::FeatureSteps include SharedAuthentication include SharedProject include SharedPaths - include Select2Helper Then 'I should be able to see myself in team' do page.should have_content(@user.name) - page.should have_content(@user.username) + page.should have_content(@user.email) end And 'I should see "Sam" in team list' do user = User.find_by_name("Sam") page.should have_content(user.name) - page.should have_content(user.username) + page.should have_content(user.email) end Given 'I click link "New Team Member"' do @@ -21,12 +20,11 @@ class ProjectTeamManagement < Spinach::FeatureSteps And 'I select "Mike" as "Reporter"' do user = User.find_by_name("Mike") - - select2(user.id, from: "#user_ids", multiple: true) within "#new_team_member" do + select user.name, :from => "user_ids" select "Reporter", :from => "project_access" end - click_button "Add users" + click_button "Save" end Then 'I should see "Mike" in team list as "Reporter"' do @@ -54,6 +52,17 @@ class ProjectTeamManagement < Spinach::FeatureSteps role_id.should == UsersProject.access_roles["Reporter"].to_s end + Given 'I click link "Sam"' do + click_link "Sam" + end + + Then 'I should see "Sam" team profile' do + user = User.find_by_name("Sam") + page.should have_content(user.name) + page.should have_content(user.email) + page.should have_content("To team list") + end + And 'I click link "Remove from team"' do click_link "Remove from team" end @@ -61,7 +70,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps And 'I should not see "Sam" in team list' do user = User.find_by_name("Sam") page.should_not have_content(user.name) - page.should_not have_content(user.username) + page.should_not have_content(user.email) end And 'gitlab user "Mike"' do @@ -97,10 +106,4 @@ class ProjectTeamManagement < Spinach::FeatureSteps select 'Website', from: 'source_project_id' click_button 'Import' end - - step 'I click cancel link for "Sam"' do - within "#user_#{User.find_by_name('Sam').id}" do - click_link('Remove user from team') - end - end end diff --git a/features/steps/project/project_wall.rb b/features/steps/project/project_wall.rb index 7c61580e..ba9d3533 100644 --- a/features/steps/project/project_wall.rb +++ b/features/steps/project/project_wall.rb @@ -3,16 +3,4 @@ class ProjectWall < Spinach::FeatureSteps include SharedProject include SharedNote include SharedPaths - - - Given 'I write new comment "my special test message"' do - within(".wall-note-form") do - fill_in "note[note]", with: "my special test message" - click_button "Add Comment" - end - end - - Then 'I should see project wall note "my special test message"' do - page.should have_content "my special test message" - end end diff --git a/features/steps/project/project_wiki.rb b/features/steps/project/project_wiki.rb index 745e9ede..902e9ce1 100644 --- a/features/steps/project/project_wiki.rb +++ b/features/steps/project/project_wiki.rb @@ -4,89 +4,17 @@ class ProjectWiki < Spinach::FeatureSteps include SharedNote include SharedPaths - Given 'I click on the Cancel button' do - within(:css, ".actions") do - click_on "Cancel" - end - end - - Then 'I should be redirected back to the Edit Home Wiki page' do - url = URI.parse(current_url) - url.path.should == project_wiki_path(project, :home) - end - - Given 'I create the Wiki Home page' do + Given 'I create Wiki page' do + fill_in "Title", :with => 'Test title' fill_in "Content", :with => '[link test](test)' click_on "Save" end - Then 'I should see the newly created wiki page' do - page.should have_content "Home" + Then 'I should see newly created wiki page' do + page.should have_content "Test title" page.should have_content "link test" click_link "link test" page.should have_content "Editing page" end - - Given 'I have an existing Wiki page' do - wiki.create_page("existing", "content", :markdown, "first commit") - @page = wiki.find_page("existing") - end - - And 'I browse to that Wiki page' do - visit project_wiki_path(project, @page) - end - - And 'I click on the Edit button' do - click_on "Edit" - end - - And 'I change the content' do - fill_in "Content", :with => 'Updated Wiki Content' - click_on "Save" - end - - Then 'I should see the updated content' do - page.should have_content "Updated Wiki Content" - end - - Then 'I should be redirected back to that Wiki page' do - url = URI.parse(current_url) - url.path.should == project_wiki_path(project, @page) - end - - And 'That page has two revisions' do - @page.update("new content", :markdown, "second commit") - end - - And 'I click the History button' do - click_on "History" - end - - Then 'I should see both revisions' do - page.should have_content current_user.name - page.should have_content "first commit" - page.should have_content "second commit" - end - - And 'I click on the "Delete this page" button' do - click_on "Delete this page" - end - - Then 'The page should be deleted' do - page.should have_content "Page was successfully deleted" - end - - And 'I click on the "Pages" button' do - click_on "Pages" - end - - Then 'I should see the existing page in the pages list' do - page.should have_content current_user.name - page.should have_content @page.title.titleize - end - - def wiki - @gollum_wiki = GollumWiki.new(project, current_user) - end end diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index 617a077b..884f2d5f 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -2,11 +2,7 @@ module SharedActiveTab include Spinach::DSL def ensure_active_main_tab(content) - if content == "Home" - page.find('.main-nav li.active').should have_css('i.icon-home') - else - page.find('.main-nav li.active').should have_content(content) - end + page.find('ul.main_menu li.active').should have_content(content) end def ensure_active_sub_tab(content) @@ -14,7 +10,7 @@ module SharedActiveTab end And 'no other main tabs should be active' do - page.should have_selector('.main-nav li.active', count: 1) + page.should have_selector('ul.main_menu li.active', count: 1) end And 'no other sub tabs should be active' do diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 9dbbc553..2ae0f124 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -2,27 +2,27 @@ module SharedDiffNote include Spinach::DSL Given 'I cancel the diff comment' do - within(".file") do + within(".diff_file") do find(".js-close-discussion-note-form").trigger("click") end end Given 'I delete a diff comment' do sleep 1 - within(".file") do + within(".diff_file") do first(".js-note-delete").trigger("click") end end Given 'I haven\'t written any diff comment text' do - within(".file") do + within(".diff_file") do fill_in "note[note]", with: "" end end Given 'I leave a diff comment like "Typo, please fix"' do find("#586fb7c4e1add2d4d24e27566ed7064680098646_29_14.line_holder .js-add-diff-note-button").trigger("click") - within(".file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do + within(".diff_file") do fill_in "note[note]", with: "Typo, please fix" #click_button("Add Comment") find(".js-comment-button").trigger("click") @@ -32,7 +32,7 @@ module SharedDiffNote Given 'I preview a diff comment text like "Should fix it :smile:"' do find("#586fb7c4e1add2d4d24e27566ed7064680098646_29_14.line_holder .js-add-diff-note-button").trigger("click") - within(".file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do + within(".diff_file") do fill_in "note[note]", with: "Should fix it :smile:" find(".js-note-preview-button").trigger("click") end @@ -40,7 +40,7 @@ module SharedDiffNote Given 'I preview another diff comment text like "DRY this up"' do find("#586fb7c4e1add2d4d24e27566ed7064680098646_57_41.line_holder .js-add-diff-note-button").trigger("click") - within(".file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do + within(".diff_file") do fill_in "note[note]", with: "DRY this up" find(".js-note-preview-button").trigger("click") end @@ -55,13 +55,13 @@ module SharedDiffNote end Given 'I write a diff comment like ":-1: I don\'t like this"' do - within(".file") do + within(".diff_file") do fill_in "note[note]", with: ":-1: I don\'t like this" end end Given 'I submit the diff comment' do - within(".file") do + within(".diff_file") do click_button("Add Comment") end end @@ -69,49 +69,49 @@ module SharedDiffNote Then 'I should not see the diff comment form' do - within(".file") do + within(".diff_file") do page.should_not have_css("form.new_note") end end Then 'I should not see the diff comment preview button' do - within(".file") do + within(".diff_file") do page.should have_css(".js-note-preview-button", visible: false) end end Then 'I should not see the diff comment text field' do - within(".file") do + within(".diff_file") do page.should have_css(".js-note-text", visible: false) end end Then 'I should only see one diff form' do - within(".file") do + within(".diff_file") do page.should have_css("form.new_note", count: 1) end end Then 'I should see a diff comment form with ":-1: I don\'t like this"' do - within(".file") do + within(".diff_file") do page.should have_field("note[note]", with: ":-1: I don\'t like this") end end Then 'I should see a diff comment saying "Typo, please fix"' do - within(".file .note") do + within(".diff_file .note") do page.should have_content("Typo, please fix") end end Then 'I should see a discussion reply button' do - within(".file") do + within(".diff_file") do page.should have_link("Reply") end end Then 'I should see a temporary diff comment form' do - within(".file") do + within(".diff_file") do page.should have_css(".js-temp-notes-holder form.new_note") end end @@ -121,37 +121,37 @@ module SharedDiffNote end Then 'I should see an empty diff comment form' do - within(".file") do + within(".diff_file") do page.should have_field("note[note]", with: "") end end Then 'I should see the cancel comment button' do - within(".file form") do + within(".diff_file form") do page.should have_css(".js-close-discussion-note-form", text: "Cancel") end end Then 'I should see the diff comment preview' do - within(".file form") do + within(".diff_file form") do page.should have_css(".js-note-preview", visible: false) end end Then 'I should see the diff comment edit button' do - within(".file") do + within(".diff_file") do page.should have_css(".js-note-edit-button", visible: true) end end Then 'I should see the diff comment preview button' do - within(".file") do + within(".diff_file") do page.should have_css(".js-note-preview-button", visible: true) end end Then 'I should see two separate previews' do - within(".file") do + within(".diff_file") do page.should have_css(".js-note-preview", visible: true, count: 2) page.should have_content("Should fix it") page.should have_content("DRY this up") diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index e0ff52a7..5dcc75f9 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -97,6 +97,21 @@ module SharedNote end end + + + # Wall + + Given 'I write new comment "my special test message"' do + within(".js-main-target-form") do + fill_in "note[note]", with: "my special test message" + click_button "Add Comment" + end + end + + Then 'I should see project wall note "my special test message"' do + page.should have_content "my special test message" + end + Then 'I should see comment "XML attached"' do within(".note") do page.should have_content("XML attached") diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 1af8b478..c046c4e6 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -25,10 +25,6 @@ module SharedPaths visit people_group_path(current_group) end - When 'I visit group settings page' do - visit edit_group_path(current_group) - end - # ---------------------------------------- # Dashboard # ---------------------------------------- @@ -37,16 +33,12 @@ module SharedPaths visit dashboard_path end - Given 'I visit dashboard projects page' do - visit projects_dashboard_path - end - Given 'I visit dashboard issues page' do - visit issues_dashboard_path + visit dashboard_issues_path end Given 'I visit dashboard merge requests page' do - visit merge_requests_dashboard_path + visit dashboard_merge_requests_path end Given 'I visit dashboard search page' do @@ -113,10 +105,6 @@ module SharedPaths visit admin_groups_path end - When 'I visit admin teams page' do - visit admin_teams_path - end - # ---------------------------------------- # Generic Project # ---------------------------------------- @@ -125,10 +113,6 @@ module SharedPaths visit project_path(@project) end - Given "I visit my project's settings page" do - visit edit_project_path(@project) - end - Given "I visit my project's files page" do visit project_tree_path(@project, root_ref) end @@ -146,10 +130,10 @@ module SharedPaths end Given "I visit my project's network page" do - # Stub Graph max_size to speed up test (10 commits vs. 650) - Network::Graph.stub(max_count: 10) + # Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650) + Gitlab::Graph::JsonBuilder.stub(max_count: 10) - visit project_graph_path(@project, root_ref) + visit graph_project_path(@project) end Given "I visit my project's issues page" do @@ -161,11 +145,11 @@ module SharedPaths end Given "I visit my project's wall page" do - visit project_wall_path(@project) + visit wall_project_path(@project) end Given "I visit my project's wiki page" do - visit project_wiki_path(@project, :home) + visit project_wiki_path(@project, :index) end When 'I visit project hooks page' do @@ -177,10 +161,12 @@ module SharedPaths # ---------------------------------------- And 'I visit project "Shop" page' do + project = Project.find_by_name("Shop") 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 @@ -221,7 +207,7 @@ module SharedPaths end And 'I visit project "Shop" issues page' do - visit project_issues_path(project) + visit project_issues_path(Project.find_by_name("Shop")) end Given 'I visit issue page "Release 0.4"' do @@ -230,7 +216,7 @@ module SharedPaths end Given 'I visit project "Shop" labels page' do - visit project_labels_path(project) + visit project_labels_path(Project.find_by_name("Shop")) end Given 'I visit merge request page "Bug NS-04"' do @@ -244,30 +230,28 @@ module SharedPaths end And 'I visit project "Shop" merge requests page' do - visit project_merge_requests_path(project) + visit project_merge_requests_path(Project.find_by_name("Shop")) end Given 'I visit project "Shop" milestones page' do - visit project_milestones_path(project) + @project = Project.find_by_name("Shop") + visit project_milestones_path(@project) end Then 'I visit project "Shop" team page' do - visit project_team_index_path(project) + visit project_team_index_path(Project.find_by_name("Shop")) end Then 'I visit project "Shop" wall page' do - visit project_wall_path(project) + project = Project.find_by_name("Shop") + visit wall_project_path(project) end Given 'I visit project wiki page' do - visit project_wiki_path(@project, :home) + visit project_wiki_path(@project, :index) end def root_ref @project.repository.root_ref end - - def project - project = Project.find_by_name!("Shop") - end end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index b16032a8..1623edb8 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -3,14 +3,13 @@ module SharedProject # Create a project without caring about what it's called And "I own a project" do - @project = create(:project_with_code) + @project = create(:project) @project.team << [@user, :master] end # Create a specific project called "Shop" And 'I own project "Shop"' do - @project = Project.find_by_name "Shop" - @project ||= create(:project_with_code, name: "Shop") + @project = create(:project, name: "Shop") @project.team << [@user, :master] end @@ -34,7 +33,7 @@ module SharedProject @event = Event.create( project: @project, - action: Event::PUSHED, + action: Event::Pushed, data: data, author_id: @user.id ) diff --git a/features/steps/userteams/userteams.rb b/features/steps/userteams/userteams.rb deleted file mode 100644 index 9a86572e..00000000 --- a/features/steps/userteams/userteams.rb +++ /dev/null @@ -1,257 +0,0 @@ -class Userteams < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - include Select2Helper - - When 'I do not have teams with me' do - UserTeam.with_member(current_user).destroy_all - end - - Then 'I should see dashboard page without teams info block' do - page.has_no_css?(".teams-box").must_equal true - end - - When 'I have teams with my membership' do - team = create :user_team, owner: current_user - team.add_member(current_user, UserTeam.access_roles["Master"], true) - end - - Then 'I should see dashboard page with teams information block' do - page.should have_css(".teams-box") - end - - When 'exist user teams' do - team = create :user_team - team.add_member(current_user, UserTeam.access_roles["Master"], true) - end - - And 'I click on "All teams" link' do - click_link("All Teams") - end - - Then 'I should see "All teams" page' do - current_path.should == teams_path - end - - And 'I should see exist teams in teams list' do - team = UserTeam.last - find_in_list(".teams_list tr", team).must_equal true - end - - When 'I click to "New team" link' do - click_link("New Team") - end - - And 'I submit form with new team info' do - fill_in 'name', with: 'gitlab' - - fill_in 'user_team_description', with: 'team description' - click_button 'Create team' - end - - And 'I should see newly created team' do - page.should have_content "gitlab" - page.should have_content "team description" - end - - Then 'I should be redirected to new team page' do - team = UserTeam.last - current_path.should == team_path(team) - end - - When 'I have teams with projects and members' do - team = create :user_team, owner: current_user - @project = create :project - team.add_member(current_user, UserTeam.access_roles["Master"], true) - team.assign_to_project(@project, UserTeam.access_roles["Master"]) - @event = create(:closed_issue_event, project: @project) - end - - When 'I visit team page' do - visit team_path(UserTeam.last) - end - - Then 'I should see projects list' do - within(".side .ui-box") do - page.should have_content(@project.name) - end - end - - And 'project from team has issues assigned to me' do - team = UserTeam.last - team.projects.each do |project| - project.issues << create(:issue, assignee: current_user) - end - end - - When 'I visit team issues page' do - team = UserTeam.last - visit issues_team_path(team) - end - - Then 'I should see issues from this team assigned to me' do - team = UserTeam.last - team.projects.each do |project| - project.issues.assigned(current_user).each do |issue| - page.should have_content issue.title - end - end - end - - Given 'I have team with projects and members' do - team = create :user_team, owner: current_user - project = create :project - user = create :user - team.add_member(current_user, UserTeam.access_roles["Master"], true) - team.add_member(user, UserTeam.access_roles["Developer"], false) - team.assign_to_project(project, UserTeam.access_roles["Master"]) - end - - Given 'project from team has issues assigned to teams members' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - project.issues << create(:issue, assignee: member) - end - end - end - - Then 'I should see issues from this team assigned to teams members' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - project.issues.assigned(member).each do |issue| - page.should have_content issue.title - end - end - end - end - - Given 'project from team has merge requests assigned to me' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - 3.times { create(:merge_request, assignee: member, project: project) } - end - end - end - - When 'I visit team merge requests page' do - team = UserTeam.last - visit merge_requests_team_path(team) - end - - Then 'I should see merge requests from this team assigned to me' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - project.issues.assigned(member).each do |merge_request| - page.should have_content merge_request.title - end - end - end - end - - Given 'project from team has merge requests assigned to team members' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - 3.times { create(:merge_request, assignee: member, project: project) } - end - end - end - - Then 'I should see merge requests from this team assigned to me' do - team = UserTeam.last - team.projects.each do |project| - team.members.each do |member| - project.issues.assigned(member).each do |merge_request| - page.should have_content merge_request.title - end - end - end - end - - Given 'I have new user "John"' do - create :user, name: "John" - end - - When 'I visit team people page' do - team = UserTeam.last - visit team_members_path(team) - end - - And 'I select user "John" from list with role "Reporter"' do - user = User.find_by_name("John") - select2(user.id, from: "#user_ids", multiple: true) - within "#team_members" do - select "Reporter", from: "default_project_access" - end - click_button "Add" - end - - Then 'I should see user "John" in team list' do - user = User.find_by_name("John") - team_members_list = find(".team-table") - team_members_list.should have_content user.name - end - - And 'I have my own project without teams' do - @project = create :project, namespace: current_user.namespace - end - - And 'I visit my team page' do - team = UserTeam.where(owner_id: current_user.id).last - visit team_path(team) - end - - When 'I click on link "Assign Project"' do - click_link "Assign Project" - end - - Then 'I should see form with my own project in available projects list' do - projects_select = find("#project_ids") - projects_select.should have_content(@project.name) - end - - When 'I submit form with selected project and max access' do - within "#assign_projects" do - select @project.name_with_namespace, from: "project_ids" - select "Reporter", from: "greatest_project_access" - end - click_button "Add" - end - - Then 'I should see my own project in team projects list' do - projects = find(".projects-table") - projects.should have_content(@project.name) - end - - When 'I click link "New Team Member"' do - click_link "New Team Member" - end - - protected - - def current_team - @user_team ||= UserTeam.first - end - - def project - current_team.projects.first - end - - def assigned_to_user key, user - project.send(key).where(assignee_id: user) - end - - def find_in_list(selector, item) - members_list = all(selector) - entered = false - members_list.each do |member_item| - entered = true if member_item.has_content?(item.name) - end - entered - end -end diff --git a/features/support/env.rb b/features/support/env.rb index 08b627f5..be10ad1b 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,10 +1,5 @@ require 'simplecov' unless ENV['CI'] -if ENV['TRAVIS'] - require 'coveralls' - Coveralls.wear! -end - ENV['RAILS_ENV'] = 'test' require './config/environment' @@ -14,13 +9,19 @@ require 'spinach/capybara' require 'sidekiq/testing/inline' -%w(valid_commit select2_helper test_env).each do |f| +%w(gitolite_stub stubbed_repository valid_commit).each do |f| require Rails.root.join('spec', 'support', f) end Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file} +# +# Stub gitolite +# +include GitoliteStub + WebMock.allow_net_connect! + # # JS driver # @@ -28,16 +29,17 @@ require 'capybara/poltergeist' Capybara.javascript_driver = :poltergeist Spinach.hooks.on_tag("javascript") do ::Capybara.current_driver = ::Capybara.javascript_driver + ::Capybara.default_wait_time = 5 end -Capybara.default_wait_time = 10 DatabaseCleaner.strategy = :truncation Spinach.hooks.before_scenario do - TestEnv.init - - DatabaseCleaner.start + # 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 end Spinach.hooks.after_scenario do @@ -48,4 +50,6 @@ Spinach.hooks.before_run do RSpec::Mocks::setup self include FactoryGirl::Syntax::Methods + + stub_gitolite! end diff --git a/features/teams/team.feature b/features/teams/team.feature deleted file mode 100644 index ac34ed76..00000000 --- a/features/teams/team.feature +++ /dev/null @@ -1,65 +0,0 @@ -Feature: UserTeams - Background: - Given I sign in as a user - And I own project "Shop" - And project "Shop" has push event - - Scenario: I should see teams info block - When I have teams with my membership - And I visit dashboard page - Then I should see dashboard page with teams information block - - Scenario: I should can create new team - When I have teams with my membership - And I visit dashboard page - When I click to "New team" link - And I submit form with new team info - Then I should be redirected to new team page - Then I should see newly created team - - Scenario: I should see team dashboard list - When I have teams with projects and members - When I visit team page - Then I should see projects list - - Scenario: I should see team issues list - Given I have team with projects and members - And project from team has issues assigned to me - When I visit team issues page - Then I should see issues from this team assigned to me - - Scenario: I should see teams members issues list - Given I have team with projects and members - Given project from team has issues assigned to teams members - When I visit team issues page - Then I should see issues from this team assigned to teams members - - Scenario: I should see team merge requests list - Given I have team with projects and members - Given project from team has merge requests assigned to me - When I visit team merge requests page - Then I should see merge requests from this team assigned to me - - Scenario: I should see teams members merge requests list - Given I have team with projects and members - Given project from team has merge requests assigned to team members - When I visit team merge requests page - Then I should see merge requests from this team assigned to me - - @javascript - Scenario: I should add user to projects in Team - Given I have team with projects and members - Given I have new user "John" - When I visit team people page - When I click link "New Team Member" - And I select user "John" from list with role "Reporter" - Then I should see user "John" in team list - - Scenario: I should assign my team to my own project - Given I have team with projects and members - And I have my own project without teams - And I visit my team page - When I click on link "Assign Project" - Then I should see form with my own project in available projects list - When I submit form with selected project and max access - Then I should see my own project in team projects list diff --git a/lib/api.rb b/lib/api.rb index d241f9b7..f58b82ff 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -8,23 +8,10 @@ module Gitlab rack_response({'message' => '404 Not found'}.to_json, 404) end - rescue_from :all do |exception| - # lifted from https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L60 - # why is this not wrapped in something reusable? - trace = exception.backtrace - - message = "\n#{exception.class} (#{exception.message}):\n" - message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code) - message << " " << trace.join("\n ") - - API.logger.add Logger::FATAL, message - rack_response({'message' => '500 Internal Server Error'}, 500) - end - format :json + error_format :json helpers APIHelpers - - mount Groups + mount Users mount Projects mount Issues @@ -32,7 +19,5 @@ module Gitlab mount Session mount MergeRequests mount Notes - mount Internal - mount SystemHooks end end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 3fe4abc3..80e2954a 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -2,23 +2,15 @@ module Gitlab module Entities class User < Grape::Entity expose :id, :username, :email, :name, :bio, :skype, :linkedin, :twitter, - :dark_scheme, :theme_id, :state, :created_at, :extern_uid, :provider - end - - class UserSafe < Grape::Entity - expose :name + :dark_scheme, :theme_id, :blocked, :created_at end class UserBasic < Grape::Entity - expose :id, :username, :email, :name, :state, :created_at + expose :id, :username, :email, :name, :blocked, :created_at end - class UserLogin < User + class UserLogin < UserBasic expose :private_token - expose :is_admin?, as: :is_admin - expose :can_create_group?, as: :can_create_group - expose :can_create_project?, as: :can_create_project - expose :can_create_team?, as: :can_create_team end class Hook < Grape::Entity @@ -28,33 +20,19 @@ module Gitlab class Project < Grape::Entity expose :id, :name, :description, :default_branch expose :owner, using: Entities::UserBasic - expose :public - expose :path, :path_with_namespace + expose :private_flag, as: :private expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at expose :namespace end class ProjectMember < UserBasic - expose :project_access, as: :access_level do |user, options| + expose :project_access, :as => :access_level do |user, options| options[:project].users_projects.find_by_user_id(user.id).project_access end end - class Group < Grape::Entity - expose :id, :name, :path, :owner_id - end - - class GroupDetail < Group - expose :projects, using: Entities::Project - end - class RepoObject < Grape::Entity expose :name, :commit - expose :protected do |repo, options| - if options[:project] - options[:project].protected_branch? repo.name - end - end end class RepoCommit < Grape::Entity @@ -70,7 +48,7 @@ module Gitlab class Milestone < Grape::Entity expose :id expose (:project_id) {|milestone| milestone.project.id} - expose :title, :description, :due_date, :state, :updated_at, :created_at + expose :title, :description, :due_date, :closed, :updated_at, :created_at end class Issue < Grape::Entity @@ -80,7 +58,7 @@ module Gitlab expose :label_list, as: :labels expose :milestone, using: Entities::Milestone expose :assignee, :author, using: Entities::UserBasic - expose :state, :updated_at, :created_at + expose :closed, :updated_at, :created_at end class SSHKey < Grape::Entity @@ -88,14 +66,13 @@ module Gitlab end class MergeRequest < Grape::Entity - expose :id, :target_branch, :source_branch, :project_id, :title, :state + expose :id, :target_branch, :source_branch, :project_id, :title, :closed, :merged expose :author, :assignee, using: Entities::UserBasic end class Note < Grape::Entity expose :id expose :note, as: :body - expose :attachment_identifier, as: :attachment expose :author, using: Entities::UserBasic expose :created_at end diff --git a/lib/api/groups.rb b/lib/api/groups.rb deleted file mode 100644 index 52fa8eff..00000000 --- a/lib/api/groups.rb +++ /dev/null @@ -1,76 +0,0 @@ -module Gitlab - # groups API - class Groups < Grape::API - before { authenticate! } - - resource :groups do - # Get a groups list - # - # Example Request: - # GET /groups - get do - if current_user.admin - @groups = paginate Group - else - @groups = paginate current_user.groups - end - present @groups, with: Entities::Group - end - - # Create group. Available only for admin - # - # Parameters: - # name (required) - The name of the group - # path (required) - The path of the group - # Example Request: - # POST /groups - post do - authenticated_as_admin! - required_attributes! [:name, :path] - - attrs = attributes_for_keys [:name, :path] - @group = Group.new(attrs) - @group.owner = current_user - - if @group.save - present @group, with: Entities::Group - else - not_found! - end - end - - # Get a single group, with containing projects - # - # Parameters: - # id (required) - The ID of a group - # Example Request: - # GET /groups/:id - get ":id" do - @group = Group.find(params[:id]) - if current_user.admin or current_user.groups.include? @group - present @group, with: Entities::GroupDetail - else - not_found! - end - end - - # Transfer a project to the Group namespace - # - # Parameters: - # id - group id - # project_id - project id - # Example Request: - # POST /groups/:id/projects/:project_id - post ":id/projects/:project_id" do - authenticated_as_admin! - @group = Group.find(params[:id]) - project = Project.find(params[:project_id]) - if project.transfer(@group) - present @group - else - not_found! - end - end - end - end -end diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index f12fb5fd..6bd8111c 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -41,17 +41,6 @@ module Gitlab abilities.allowed?(object, action, subject) end - # Checks the occurrences of required attributes, each attribute must be present in the params hash - # or a Bad Request error is invoked. - # - # Parameters: - # keys (required) - A hash consisting of keys that must be present - def required_attributes!(keys) - keys.each do |key| - bad_request!(key) unless params[key].present? - end - end - def attributes_for_keys(keys) attrs = {} keys.each do |key| @@ -66,12 +55,6 @@ module Gitlab render_api_error!('403 Forbidden', 403) end - def bad_request!(attribute) - message = ["400 (Bad request)"] - message << "\"" + attribute.to_s + "\" not given" - render_api_error!(message.join(' '), 400) - end - def not_found!(resource = nil) message = ["404"] message << resource if resource diff --git a/lib/api/internal.rb b/lib/api/internal.rb deleted file mode 100644 index 81451638..00000000 --- a/lib/api/internal.rb +++ /dev/null @@ -1,68 +0,0 @@ -module Gitlab - # Internal access API - class Internal < Grape::API - namespace 'internal' do - # - # Check if ssh key has access to project code - # - # Params: - # key_id - SSH Key id - # project - project path with namespace - # action - git action (git-upload-pack or git-receive-pack) - # ref - branch name - # - get "/allowed" do - # Check for *.wiki repositories. - # Strip out the .wiki from the pathname before finding the - # project. This applies the correct project permissions to - # the wiki repository as well. - project_path = params[:project] - project_path.gsub!(/\.wiki/,'') if project_path =~ /\.wiki/ - - key = Key.find(params[:key_id]) - project = Project.find_with_namespace(project_path) - git_cmd = params[:action] - - - if key.is_deploy_key - project == key.project && git_cmd == 'git-upload-pack' - else - user = key.user - - return false if user.blocked? - - action = case git_cmd - when 'git-upload-pack' - then :download_code - when 'git-receive-pack' - then - if project.protected_branch?(params[:ref]) - :push_code_to_protected_branches - else - :push_code - end - end - - user.can?(action, project) - end - end - - # - # Discover user by ssh key - # - get "/discover" do - key = Key.find(params[:key_id]) - present key.user, with: Entities::UserSafe - end - - get "/check" do - { - api_version: Gitlab::API.version, - gitlab_version: Gitlab::VERSION, - gitlab_rev: Gitlab::REVISION, - } - end - end - end -end - diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 500a8551..4d832fbe 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -48,7 +48,6 @@ module Gitlab # Example Request: # POST /projects/:id/issues post ":id/issues" do - required_attributes! [:title] attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id] attrs[:label_list] = params[:labels] if params[:labels].present? @issue = user_project.issues.new attrs @@ -70,14 +69,14 @@ module Gitlab # assignee_id (optional) - The ID of a user to assign issue # milestone_id (optional) - The ID of a milestone to assign issue # labels (optional) - The labels of an issue - # state (optional) - The state of an issue (close|reopen) + # closed (optional) - The state of an issue (0 = false, 1 = true) # Example Request: # PUT /projects/:id/issues/:issue_id put ":id/issues/:issue_id" do @issue = user_project.issues.find(params[:issue_id]) authorize! :modify_issue, @issue - attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :state_event] + 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 diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index d5595d5f..470cd1e1 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -4,16 +4,6 @@ module Gitlab before { authenticate! } resource :projects do - helpers do - def handle_merge_request_errors!(errors) - if errors[:project_access].any? - error!(errors[:project_access], 422) - elsif errors[:branch_conflict].any? - error!(errors[:branch_conflict], 422) - end - not_found! - end - end # List merge requests # @@ -61,7 +51,6 @@ module Gitlab # post ":id/merge_requests" do authorize! :write_merge_request, user_project - required_attributes! [:source_branch, :target_branch, :title] attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title] merge_request = user_project.merge_requests.new(attrs) @@ -71,7 +60,7 @@ module Gitlab merge_request.reload_code present merge_request, with: Entities::MergeRequest else - handle_merge_request_errors! merge_request.errors + not_found! end end @@ -84,24 +73,22 @@ module Gitlab # target_branch - The target branch # assignee_id - Assignee user ID # title - Title of MR - # state_event - Status of MR. (close|reopen|merge) + # closed - Status of MR. true - closed # Example: # PUT /projects/:id/merge_request/:merge_request_id # put ":id/merge_request/:merge_request_id" do - attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event] + attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :closed] merge_request = user_project.merge_requests.find(params[:merge_request_id]) authorize! :modify_merge_request, merge_request - MergeRequestObserver.current_user = current_user - if merge_request.update_attributes attrs merge_request.reload_code merge_request.mark_as_unchecked present merge_request, with: Entities::MergeRequest else - handle_merge_request_errors! merge_request.errors + not_found! end end @@ -115,8 +102,6 @@ module Gitlab # POST /projects/:id/merge_request/:merge_request_id/comments # post ":id/merge_request/:merge_request_id/comments" do - required_attributes! [:note] - merge_request = user_project.merge_requests.find(params[:merge_request_id]) note = merge_request.notes.new(note: params[:note], project_id: user_project.id) note.author = current_user diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb index 1adeefec..6aca9d01 100644 --- a/lib/api/milestones.rb +++ b/lib/api/milestones.rb @@ -41,7 +41,6 @@ module Gitlab # POST /projects/:id/milestones post ":id/milestones" do authorize! :admin_milestone, user_project - required_attributes! [:title] attrs = attributes_for_keys [:title, :description, :due_date] @milestone = user_project.milestones.new attrs @@ -60,14 +59,14 @@ module Gitlab # title (optional) - The title of a milestone # description (optional) - The description of a milestone # due_date (optional) - The due date of a milestone - # state (optional) - The status of the milestone (close|activate) + # closed (optional) - The status of the milestone # Example Request: # PUT /projects/:id/milestones/:milestone_id put ":id/milestones/:milestone_id" do authorize! :admin_milestone, user_project @milestone = user_project.milestones.find(params[:milestone_id]) - attrs = attributes_for_keys [:title, :description, :due_date, :state_event] + attrs = attributes_for_keys [:title, :description, :due_date, :closed] if @milestone.update_attributes attrs present @milestone, with: Entities::Milestone else diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 450faae5..4613db54 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -3,7 +3,7 @@ module Gitlab class Notes < Grape::API before { authenticate! } - NOTEABLE_TYPES = [Issue, MergeRequest, Snippet] + NOTEABLE_TYPES = [Issue, Snippet] resource :projects do # Get a list of project wall notes @@ -14,10 +14,6 @@ module Gitlab # GET /projects/:id/notes get ":id/notes" do @notes = user_project.notes.common - - # Get recent notes if recent = true - @notes = @notes.order('id DESC') if params[:recent] - present paginate(@notes), with: Entities::Note end @@ -41,16 +37,12 @@ module Gitlab # Example Request: # POST /projects/:id/notes post ":id/notes" do - required_attributes! [:body] - @note = user_project.notes.new(note: params[:body]) @note.author = current_user if @note.save present @note, with: Entities::Note else - # :note is exposed as :body, but :note is set on error - bad_request!(:note) if @note.errors[:note].any? not_found! end end @@ -97,8 +89,6 @@ module Gitlab # POST /projects/:id/issues/:noteable_id/notes # POST /projects/:id/snippets/:noteable_id/notes post ":id/#{noteables_str}/:#{noteable_id_str}/notes" do - required_attributes! [:body] - @noteable = user_project.send(:"#{noteables_str}").find(params[:"#{noteable_id_str}"]) @note = @noteable.notes.new(note: params[:body]) @note.author = current_user diff --git a/lib/api/projects.rb b/lib/api/projects.rb index ce94c34b..cbef1ed3 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -4,15 +4,6 @@ module Gitlab before { authenticate! } resource :projects do - helpers do - def handle_project_member_errors(errors) - if errors[:project_access].any? - error!(errors[:project_access], 422) - end - not_found! - end - end - # Get a projects list for authenticated user # # Example Request: @@ -42,46 +33,9 @@ module Gitlab # wall_enabled (optional) - enabled by default # merge_requests_enabled (optional) - enabled by default # wiki_enabled (optional) - enabled by default - # namespace_id (optional) - defaults to user namespace # Example Request # POST /projects post do - required_attributes! [:name] - attrs = attributes_for_keys [:name, - :description, - :default_branch, - :issues_enabled, - :wall_enabled, - :merge_requests_enabled, - :wiki_enabled, - :namespace_id] - @project = ::Projects::CreateContext.new(current_user, attrs).execute - if @project.saved? - present @project, with: Entities::Project - else - if @project.errors[:limit_reached].present? - error!(@project.errors[:limit_reached], 403) - end - not_found! - end - end - - # Create new project for a specified user. Only available to admin users. - # - # Parameters: - # user_id (required) - The ID of a user - # name (required) - name for new project - # description (optional) - short project description - # default_branch (optional) - 'master' by default - # issues_enabled (optional) - enabled by default - # wall_enabled (optional) - enabled by default - # merge_requests_enabled (optional) - enabled by default - # wiki_enabled (optional) - enabled by default - # Example Request - # POST /projects/user/:user_id - post "user/:user_id" do - authenticated_as_admin! - user = User.find(params[:user_id]) attrs = attributes_for_keys [:name, :description, :default_branch, @@ -89,7 +43,7 @@ module Gitlab :wall_enabled, :merge_requests_enabled, :wiki_enabled] - @project = ::Projects::CreateContext.new(user, attrs).execute + @project = ::Projects::CreateContext.new(current_user, attrs).execute if @project.saved? present @project, with: Entities::Project else @@ -97,7 +51,6 @@ module Gitlab end end - # Get a project team members # # Parameters: @@ -136,22 +89,16 @@ module Gitlab # POST /projects/:id/members post ":id/members" do authorize! :admin_project, user_project - required_attributes! [:user_id, :access_level] + users_project = user_project.users_projects.new( + user_id: params[:user_id], + project_access: params[:access_level] + ) - # either the user is already a team member or a new one - team_member = user_project.team_member_by_id(params[:user_id]) - if team_member.nil? - team_member = user_project.users_projects.new( - user_id: params[:user_id], - project_access: params[:access_level] - ) - end - - if team_member.save - @member = team_member.user + if users_project.save + @member = users_project.user present @member, with: Entities::ProjectMember, project: user_project else - handle_project_member_errors team_member.errors + not_found! end end @@ -165,16 +112,13 @@ module Gitlab # PUT /projects/:id/members/:user_id put ":id/members/:user_id" do authorize! :admin_project, user_project - required_attributes! [:access_level] + users_project = user_project.users_projects.find_by_user_id params[:user_id] - team_member = user_project.users_projects.find_by_user_id(params[:user_id]) - not_found!("User can not be found") if team_member.nil? - - if team_member.update_attributes(project_access: params[:access_level]) - @member = team_member.user + if users_project.update_attributes(project_access: params[:access_level]) + @member = users_project.user present @member, with: Entities::ProjectMember, project: user_project else - handle_project_member_errors team_member.errors + not_found! end end @@ -187,12 +131,8 @@ module Gitlab # DELETE /projects/:id/members/:user_id delete ":id/members/:user_id" do authorize! :admin_project, user_project - team_member = user_project.users_projects.find_by_user_id(params[:user_id]) - unless team_member.nil? - team_member.destroy - else - {message: "Access revoked", id: params[:user_id].to_i} - end + users_project = user_project.users_projects.find_by_user_id params[:user_id] + users_project.destroy end # Get project hooks @@ -215,7 +155,6 @@ module Gitlab # Example Request: # GET /projects/:id/hooks/:hook_id get ":id/hooks/:hook_id" do - authorize! :admin_project, user_project @hook = user_project.hooks.find(params[:hook_id]) present @hook, with: Entities::Hook end @@ -230,16 +169,11 @@ module Gitlab # POST /projects/:id/hooks post ":id/hooks" do authorize! :admin_project, user_project - required_attributes! [:url] - @hook = user_project.hooks.new({"url" => params[:url]}) if @hook.save present @hook, with: Entities::Hook else - if @hook.errors[:url].present? - error!("Invalid url given", 422) - end - not_found! + error!({'message' => '404 Not found'}, 404) end end @@ -254,36 +188,27 @@ module Gitlab put ":id/hooks/:hook_id" do @hook = user_project.hooks.find(params[:hook_id]) authorize! :admin_project, user_project - required_attributes! [:url] attrs = attributes_for_keys [:url] + if @hook.update_attributes attrs present @hook, with: Entities::Hook else - if @hook.errors[:url].present? - error!("Invalid url given", 422) - end not_found! end end - # Deletes project hook. This is an idempotent function. + # Delete project hook # # Parameters: # id (required) - The ID of a project # hook_id (required) - The ID of hook to delete # Example Request: - # DELETE /projects/:id/hooks/:hook_id + # DELETE /projects/:id/hooks delete ":id/hooks" do authorize! :admin_project, user_project - required_attributes! [:hook_id] - - begin - @hook = ProjectHook.find(params[:hook_id]) - @hook.destroy - rescue - # ProjectHook can raise Error if hook_id not found - end + @hook = user_project.hooks.find(params[:hook_id]) + @hook.destroy end # Get a project repository branches @@ -293,7 +218,7 @@ module Gitlab # Example Request: # GET /projects/:id/repository/branches get ":id/repository/branches" do - present user_project.repo.heads.sort_by(&:name), with: Entities::RepoObject, project: user_project + present user_project.repo.heads.sort_by(&:name), with: Entities::RepoObject end # Get a single branch @@ -305,46 +230,7 @@ module Gitlab # GET /projects/:id/repository/branches/:branch get ":id/repository/branches/:branch" do @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } - not_found!("Branch does not exist") if @branch.nil? - present @branch, with: Entities::RepoObject, project: user_project - end - - # Protect a single branch - # - # Parameters: - # id (required) - The ID of a project - # branch (required) - The name of the branch - # Example Request: - # PUT /projects/:id/repository/branches/:branch/protect - put ":id/repository/branches/:branch/protect" do - @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } - not_found! unless @branch - protected = user_project.protected_branches.find_by_name(@branch.name) - - unless protected - user_project.protected_branches.create(name: @branch.name) - end - - present @branch, with: Entities::RepoObject, project: user_project - end - - # Unprotect a single branch - # - # Parameters: - # id (required) - The ID of a project - # branch (required) - The name of the branch - # Example Request: - # PUT /projects/:id/repository/branches/:branch/unprotect - put ":id/repository/branches/:branch/unprotect" do - @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } - not_found! unless @branch - protected = user_project.protected_branches.find_by_name(@branch.name) - - if protected - protected.destroy - end - - present @branch, with: Entities::RepoObject, project: user_project + present @branch, with: Entities::RepoObject end # Get a project repository tags @@ -361,18 +247,18 @@ module Gitlab # # Parameters: # id (required) - The ID of a project - # ref_name (optional) - The name of a repository branch or tag, if not given the default branch is used + # ref_name (optional) - The name of a repository branch or tag # Example Request: # GET /projects/:id/repository/commits get ":id/repository/commits" do authorize! :download_code, user_project page = params[:page] || 0 - per_page = (params[:per_page] || 20).to_i + per_page = params[:per_page] || 20 ref = params[:ref_name] || user_project.try(:default_branch) || 'master' commits = user_project.repository.commits(ref, nil, per_page, page * per_page) - present commits, with: Entities::RepoCommit + present CommitDecorator.decorate(commits), with: Entities::RepoCommit end # Get a project snippets @@ -409,7 +295,6 @@ module Gitlab # POST /projects/:id/snippets post ":id/snippets" do authorize! :write_snippet, user_project - required_attributes! [:title, :file_name, :code] attrs = attributes_for_keys [:title, :file_name] attrs[:expires_at] = params[:lifetime] if params[:lifetime].present? @@ -458,12 +343,10 @@ module Gitlab # Example Request: # DELETE /projects/:id/snippets/:snippet_id delete ":id/snippets/:snippet_id" do - begin - @snippet = user_project.snippets.find(params[:snippet_id]) - authorize! :modify_snippet, user_project - @snippet.destroy - rescue - end + @snippet = user_project.snippets.find(params[:snippet_id]) + authorize! :modify_snippet, @snippet + + @snippet.destroy end # Get a raw project snippet @@ -489,7 +372,6 @@ module Gitlab # GET /projects/:id/repository/commits/:sha/blob get ":id/repository/commits/:sha/blob" do authorize! :download_code, user_project - required_attributes! [:filepath] ref = params[:sha] @@ -503,49 +385,6 @@ module Gitlab present tree.data end - # Get a specific project's keys - # - # Example Request: - # GET /projects/:id/keys - get ":id/keys" do - present user_project.deploy_keys, with: Entities::SSHKey - end - - # Get single key owned by currently authenticated user - # - # Example Request: - # GET /projects/:id/keys/:id - get ":id/keys/:key_id" do - key = user_project.deploy_keys.find params[:key_id] - present key, with: Entities::SSHKey - end - - # Add new ssh key to currently authenticated user - # - # Parameters: - # key (required) - New SSH Key - # title (required) - New SSH Key's title - # Example Request: - # POST /projects/:id/keys - post ":id/keys" do - attrs = attributes_for_keys [:title, :key] - key = user_project.deploy_keys.new attrs - if key.save - present key, with: Entities::SSHKey - else - not_found! - end - end - - # Delete existed ssh key of currently authenticated user - # - # Example Request: - # DELETE /projects/:id/keys/:id - delete ":id/keys/:key_id" do - key = user_project.deploy_keys.find params[:key_id] - key.delete - end - end end end diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb deleted file mode 100644 index da0b005d..00000000 --- a/lib/api/system_hooks.rb +++ /dev/null @@ -1,70 +0,0 @@ -module Gitlab - # Hooks API - class SystemHooks < Grape::API - before { - authenticate! - authenticated_as_admin! - } - - resource :hooks do - # Get the list of system hooks - # - # Example Request: - # GET /hooks - get do - @hooks = SystemHook.all - present @hooks, with: Entities::Hook - end - - # Create new system hook - # - # Parameters: - # url (required) - url for system hook - # Example Request - # POST /hooks - post do - attrs = attributes_for_keys [:url] - required_attributes! [:url] - @hook = SystemHook.new attrs - if @hook.save - present @hook, with: Entities::Hook - else - not_found! - end - end - - # Test a hook - # - # Example Request - # GET /hooks/:id - get ":id" do - @hook = SystemHook.find(params[:id]) - data = { - event_name: "project_create", - name: "Ruby", - path: "ruby", - project_id: 1, - owner_name: "Someone", - owner_email: "example@gitlabhq.com" - } - @hook.execute(data) - data - end - - # Delete a hook. This is an idempotent function. - # - # Parameters: - # id (required) - ID of the hook - # Example Request: - # DELETE /hooks/:id - delete ":id" do - begin - @hook = SystemHook.find(params[:id]) - @hook.destroy - rescue - # SystemHook raises an Error if no hook with id found - end - end - end - end -end \ No newline at end of file diff --git a/lib/api/users.rb b/lib/api/users.rb index 125a8624..140c20f6 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -9,9 +9,7 @@ module Gitlab # Example Request: # GET /users get do - @users = User.scoped - @users = @users.active if params[:active].present? - @users = @users.search(params[:search]) if params[:search].present? + @users = paginate User present @users, with: Entities::User end @@ -36,16 +34,11 @@ module Gitlab # linkedin - Linkedin # twitter - Twitter account # projects_limit - Number of projects user can create - # extern_uid - External authentication provider UID - # provider - External provider - # bio - Bio # Example Request: # POST /users post do authenticated_as_admin! - required_attributes! [:email, :password, :name, :username] - - attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :extern_uid, :provider, :bio] + attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username] user = User.new attrs, as: :admin if user.save present user, with: Entities::User @@ -53,70 +46,6 @@ module Gitlab not_found! end end - - # Update user. Available only for admin - # - # Parameters: - # email - Email - # name - Name - # password - Password - # skype - Skype ID - # linkedin - Linkedin - # twitter - Twitter account - # projects_limit - Limit projects each user can create - # extern_uid - External authentication provider UID - # provider - External provider - # bio - Bio - # Example Request: - # PUT /users/:id - put ":id" do - authenticated_as_admin! - - attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :extern_uid, :provider, :bio] - user = User.find(params[:id]) - not_found!("User not found") unless user - - if user.update_attributes(attrs) - present user, with: Entities::User - else - not_found! - end - end - - # Add ssh key to a specified user. Only available to admin users. - # - # Parameters: - # id (required) - The ID of a user - # key (required) - New SSH Key - # title (required) - New SSH Key's title - # Example Request: - # POST /users/:id/keys - post ":id/keys" do - authenticated_as_admin! - user = User.find(params[:id]) - attrs = attributes_for_keys [:title, :key] - key = user.keys.new attrs - if key.save - present key, with: Entities::SSHKey - else - not_found! - end - end - - # Delete user. Available only for admin - # - # Example Request: - # DELETE /users/:id - delete ":id" do - authenticated_as_admin! - user = User.find_by_id(params[:id]) - - if user - user.destroy - else - not_found! - end - end end resource :user do @@ -125,7 +54,7 @@ module Gitlab # Example Request: # GET /user get do - present @current_user, with: Entities::UserLogin + present @current_user, with: Entities::User end # Get currently authenticated user's keys @@ -153,8 +82,6 @@ module Gitlab # Example Request: # POST /user/keys post "keys" do - required_attributes! [:title, :key] - attrs = attributes_for_keys [:title, :key] key = current_user.keys.new attrs if key.save @@ -164,18 +91,15 @@ module Gitlab end end - # Delete existing ssh key of currently authenticated user + # Delete existed ssh key of currently authenticated user # # Parameters: # id (required) - SSH Key ID # Example Request: # DELETE /user/keys/:id delete "keys/:id" do - begin - key = current_user.keys.find params[:id] - key.delete - rescue - end + key = current_user.keys.find params[:id] + key.delete end end end diff --git a/lib/event_filter.rb b/lib/event_filter.rb index 9b4b8c38..14ab0193 100644 --- a/lib/event_filter.rb +++ b/lib/event_filter.rb @@ -37,15 +37,15 @@ class EventFilter filter = params.dup actions = [] - actions << Event::PUSHED if filter.include? 'push' - actions << Event::MERGED if filter.include? 'merged' + actions << Event::Pushed if filter.include? 'push' + actions << Event::Merged if filter.include? 'merged' if filter.include? 'team' - actions << Event::JOINED - actions << Event::LEFT + actions << Event::Joined + actions << Event::Left end - actions << Event::COMMENTED if filter.include? 'comments' + actions << Event::Commented if filter.include? 'comments' events = events.where(action: actions) end diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index 2e3ab1b2..270a0aaa 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -8,7 +8,7 @@ module ExtractsPath included do if respond_to?(:before_filter) - before_filter :assign_ref_vars + before_filter :assign_ref_vars, only: [:show] end end @@ -33,7 +33,7 @@ module ExtractsPath # extract_ref("v2.0.0/README.md") # # => ['v2.0.0', 'README.md'] # - # extract_ref('master/app/models/project.rb') + # extract_ref('/gitlab/vagrant/tree/master/app/models/project.rb') # # => ['master', 'app/models/project.rb'] # # extract_ref('issues/1234/app/models/project.rb') @@ -45,12 +45,19 @@ module ExtractsPath # # Returns an Array where the first value is the tree-ish and the second is the # path - def extract_ref(id) + def extract_ref(input) pair = ['', ''] return pair unless @project - if id.match(/^([[:alnum:]]{40})(.+)/) + # 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 else @@ -58,6 +65,7 @@ module ExtractsPath # 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.repository.ref_names @@ -85,8 +93,8 @@ module ExtractsPath # - @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 Commit representing the commit from the given ref - # - @tree - A Tree representing the tree at the given ref/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. @@ -94,18 +102,25 @@ module ExtractsPath # Automatically renders `not_found!` if a valid tree path could not be # resolved (e.g., when a user inserts an invalid path or ref). def assign_ref_vars - @id = params[:id] + # Handle formats embedded in the id + if params[:id].ends_with?('.atom') + params[:id].gsub!(/\.atom$/, '') + request.format = :atom + end - @ref, @path = extract_ref(@id) + path = CGI::unescape(request.fullpath.dup) - # It is used "@project.repository.commits(@ref, @path, 1, 0)", - # because "@project.repository.commit(@ref)" returns wrong commit when @ref is tag name. - @commit = @project.repository.commits(@ref, @path, 1, 0).first + @ref, @path = extract_ref(path) + + @id = File.join(@ref, @path) + + @commit = CommitDecorator.decorate(@project.repository.commit(@ref)) @tree = Tree.new(@commit.tree, @ref, @path) + @tree = TreeDecorator.new(@tree) raise InvalidPathError if @tree.invalid? - rescue RuntimeError, NoMethodError, InvalidPathError + rescue NoMethodError, InvalidPathError not_found! end end diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 0fee33db..d0e792be 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -41,12 +41,10 @@ module Gitlab password_confirmation: password, projects_limit: Gitlab.config.gitlab.default_projects_limit, }, as: :admin) - @user.save! - if Gitlab.config.omniauth['block_auto_created_users'] && !ldap - @user.block + @user.blocked = true end - + @user.save! @user end diff --git a/lib/gitlab/backend/gitolite.rb b/lib/gitlab/backend/gitolite.rb new file mode 100644 index 00000000..3b8a2090 --- /dev/null +++ b/lib/gitlab/backend/gitolite.rb @@ -0,0 +1,56 @@ +require_relative 'gitolite_config' + +module Gitlab + class Gitolite + class AccessDenied < StandardError; end + + def config + Gitlab::GitoliteConfig.new + end + + 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 + + def remove_key key_id, projects + config.apply do |config| + config.rm_key(key_id) + config.update_projects(projects) + end + end + + def update_repository project + config.update_project!(project) + end + + def move_repository(old_repo, project) + config.apply do |config| + config.clean_repo(old_repo) + config.update_project(project) + end + end + + def remove_repository project + config.destroy_project!(project) + end + + def url_to_repo path + Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git" + end + + def enable_automerge + config.admin_all_repo! + end + + def update_repositories projects + config.apply do |config| + config.update_projects(projects) + end + end + + alias_method :create_repository, :update_repository + end +end diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb new file mode 100644 index 00000000..1783b2c3 --- /dev/null +++ b/lib/gitlab/backend/gitolite_config.rb @@ -0,0 +1,244 @@ +require 'gitolite' +require 'timeout' +require 'fileutils' + +module Gitlab + class GitoliteConfig + class PullError < StandardError; end + class PushError < StandardError; end + class BrokenGitolite < StandardError; end + + attr_reader :config_tmp_dir, :ga_repo, :conf + + def config_tmp_dir + @config_tmp_dir ||= Rails.root.join('tmp',"gitlabhq-gitolite-#{Time.now.to_i}") + end + + def ga_repo + @ga_repo ||= ::Gitolite::GitoliteAdmin.new( + File.join(config_tmp_dir,'gitolite'), + conf: Gitlab.config.gitolite.config_file + ) + end + + 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 BrokenGitolite => ex + log("Gitolite error -> " + " " + ex.message) + raise Gitolite::AccessDenied, ex.message + + rescue Exception => ex + log(ex.class.name + " " + ex.message) + raise Gitolite::AccessDenied.new("gitolite timeout") + end + + def log message + Gitlab::GitLogger.error(message) + end + + def destroy_project(project) + if project.repository + FileUtils.rm_rf(project.repository.path_to_repo) + end + conf.rm_repo(project.path_with_namespace) + end + + def clean_repo repo_name + conf.rm_repo(repo_name) + end + + def destroy_project!(project) + apply do |config| + config.destroy_project(project) + end + end + + def write_key(id, key) + File.open(File.join(config_tmp_dir, 'gitolite/keydir',"#{id}.pub"), 'w') do |f| + f.write(key.gsub(/\n/,'')) + end + end + + 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 or create + def update_project(project) + repo = update_project_config(project, conf) + conf.add_repo(repo, true) + end + + def update_project!( project) + apply do |config| + config.update_project(project) + end + end + + # Updates many projects and uses project.path_with_namespace as the repo path + # An order of magnitude faster than update_project + def update_projects(projects) + projects.each do |project| + repo = update_project_config(project, conf) + conf.add_repo(repo, true) + end + end + + 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.team.repository_readers + name_writers = project.team.repository_writers + name_masters = project.team.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 + + # Enable access to all repos for gitolite admin. + # We use it for accept merge request feature + 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 + + def admin_all_repo! + apply { |config| config.admin_all_repo } + end + + private + + def pull tmp_dir + Dir.mkdir tmp_dir + `git clone #{Gitlab.config.gitolite.admin_uri} #{tmp_dir}/gitolite` + + unless File.exists?(File.join(tmp_dir, 'gitolite', 'conf', 'gitolite.conf')) + raise PullError, "unable to clone gitolite-admin repo" + end + end + + def push tmp_dir + output, status = popen('git add -A') + raise "Git add failed." unless status.zero? + + # git commit returns 0 on success, and 1 if there is nothing to commit + output, status = popen('git commit -m "GitLab"') + raise "Git add failed." unless [0,1].include?(status) + + output, status = popen('git push') + + if output =~ /remote\: FATAL/ + raise BrokenGitolite, output + end + + if status.zero? || output =~ /Everything up\-to\-date/ + return true + else + raise PushError, "unable to push gitolite-admin repo" + end + end + + def popen(cmd) + path = File.join(config_tmp_dir,'gitolite') + vars = { "PWD" => path } + options = { :chdir => path } + + @cmd_output = "" + @cmd_status = 0 + Open3.popen3(vars, cmd, options) do |stdin, stdout, stderr, wait_thr| + @cmd_status = wait_thr.value.exitstatus + @cmd_output << stdout.read + @cmd_output << stderr.read + end + + return @cmd_output, @cmd_status + end + end +end + diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index abbee613..a2d15d57 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -1,5 +1,3 @@ -require_relative 'shell_env' - module Grack class Auth < Rack::Auth::Basic attr_accessor :user, :project @@ -9,6 +7,9 @@ module Grack @request = Rack::Request.new(env) @auth = Request.new(env) + # 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'] = "" @@ -34,7 +35,8 @@ module Grack self.user = User.find_by_email(login) || User.find_by_username(login) return false unless user.try(:valid_password?, password) - Gitlab::ShellEnv.set_env(user) + # Set GL_USER env variable + ENV['GL_USER'] = user.email end # Git upload and receive diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb deleted file mode 100644 index bae87977..00000000 --- a/lib/gitlab/backend/shell.rb +++ /dev/null @@ -1,136 +0,0 @@ -module Gitlab - class Shell - class AccessDenied < StandardError; end - - # Init new repository - # - # name - project path with namespace - # - # Ex. - # add_repository("gitlab/gitlab-ci") - # - def add_repository(name) - system("#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects add-project #{name}.git") - end - - # Import repository - # - # name - project path with namespace - # - # Ex. - # import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git") - # - def import_repository(name, url) - system("#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects import-project #{name}.git #{url}") - end - - # Move repository - # - # path - project path with namespace - # new_path - new project path with namespace - # - # Ex. - # mv_repository("gitlab/gitlab-ci", "randx/gitlab-ci-new.git") - # - def mv_repository(path, new_path) - system("#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects mv-project #{path}.git #{new_path}.git") - end - - # Remove repository from file system - # - # name - project path with namespace - # - # Ex. - # remove_repository("gitlab/gitlab-ci") - # - def remove_repository(name) - system("#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects rm-project #{name}.git") - end - - # Add new key to gitlab-shell - # - # Ex. - # add_key("key-42", "sha-rsa ...") - # - def add_key(key_id, key_content) - system("#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys add-key #{key_id} \"#{key_content}\"") - end - - # Remove ssh key from gitlab shell - # - # Ex. - # remove_key("key-342", "sha-rsa ...") - # - def remove_key(key_id, key_content) - system("#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-keys rm-key #{key_id} \"#{key_content}\"") - end - - # Add empty directory for storing repositories - # - # Ex. - # add_namespace("gitlab") - # - def add_namespace(name) - FileUtils.mkdir(full_path(name), mode: 0770) unless exists?(name) - end - - # Remove directory from repositories storage - # Every repository inside this directory will be removed too - # - # Ex. - # rm_namespace("gitlab") - # - def rm_namespace(name) - FileUtils.rm_r(full_path(name), force: true) - end - - # Move namespace directory inside repositories storage - # - # Ex. - # mv_namespace("gitlab", "gitlabhq") - # - def mv_namespace(old_name, new_name) - return false if exists?(new_name) || !exists?(old_name) - - FileUtils.mv(full_path(old_name), full_path(new_name)) - end - - # Remove GitLab Satellites for provided path (namespace or repo dir) - # - # Ex. - # rm_satellites("gitlab") - # - # rm_satellites("gitlab/gitlab-ci.git") - # - def rm_satellites(path) - raise ArgumentError.new("Path can't be blank") if path.blank? - - satellites_path = File.join(Gitlab.config.satellites.path, path) - FileUtils.rm_r(satellites_path, force: true) - end - - def url_to_repo path - Gitlab.config.gitlab_shell.ssh_path_prefix + "#{path}.git" - end - - protected - - def gitlab_shell_user_home - File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}") - end - - def repos_path - Gitlab.config.gitlab_shell.repos_path - end - - def full_path(dir_name) - raise ArgumentError.new("Directory name can't be blank") if dir_name.blank? - - File.join(repos_path, dir_name) - end - - def exists?(dir_name) - File.exists?(full_path(dir_name)) - end - end -end diff --git a/lib/gitlab/backend/shell_adapter.rb b/lib/gitlab/backend/shell_adapter.rb deleted file mode 100644 index f247f459..00000000 --- a/lib/gitlab/backend/shell_adapter.rb +++ /dev/null @@ -1,12 +0,0 @@ -# == GitLab Shell mixin -# -# Provide a shortcut to Gitlab::Shell instance by gitlab_shell -# -module Gitlab - module ShellAdapter - def gitlab_shell - Gitlab::Shell.new - end - end -end - diff --git a/lib/gitlab/backend/shell_env.rb b/lib/gitlab/backend/shell_env.rb deleted file mode 100644 index 15721875..00000000 --- a/lib/gitlab/backend/shell_env.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Gitlab - # This module provide 2 methods - # to set specific ENV variabled for GitLab Shell - module ShellEnv - extend self - - def set_env(user) - # Set GL_ID env variable - ENV['GL_ID'] = "user-#{user.id}" - end - - def reset_env - # Reset GL_ID env variable - ENV['GL_ID'] = nil - end - end -end diff --git a/lib/gitlab/git/blame.rb b/lib/gitlab/git/blame.rb deleted file mode 100644 index d6e988b6..00000000 --- a/lib/gitlab/git/blame.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Gitlab - module Git - class Blame - - attr_accessor :repository, :sha, :path - - def initialize(repository, sha, path) - @repository, @sha, @path = repository, sha, path - - end - - def each - raw_blame = Grit::Blob.blame(repository.repo, sha, path) - - raw_blame.each do |commit, lines| - commit = Gitlab::Git::Commit.new(commit) - yield(commit, lines) - end - end - end - end -end diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb deleted file mode 100644 index 35991a38..00000000 --- a/lib/gitlab/git/commit.rb +++ /dev/null @@ -1,153 +0,0 @@ -# Gitlab::Git::Commit is a wrapper around native Grit::Commit object -# We dont want to use grit objects inside app/ -# It helps us easily migrate to rugged in future -module Gitlab - module Git - class Commit - attr_accessor :raw_commit, :head, :refs - - delegate :message, :authored_date, :committed_date, :parents, :sha, - :date, :committer, :author, :diffs, :tree, :id, :stats, :to_patch, - to: :raw_commit - - class << self - 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 - - 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 - - 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 - - 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 - - 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 - - def commits_between(repo, from, to) - repo.commits_between(from, to).map { |c| Commit.new(c) } - end - end - - def initialize(raw_commit, head = nil) - raise "Nil as raw commit passed" unless raw_commit - - @raw_commit = raw_commit - @head = head - end - - def short_id(length = 10) - id.to_s[0..length] - end - - def safe_message - @safe_message ||= message - end - - def created_at - committed_date - end - - def author_email - author.email - end - - def author_name - author.name - end - - # Was this commit committed by a different person than the original author? - def different_committer? - author_name != committer_name || author_email != committer_email - end - - def committer_name - committer.name - end - - def committer_email - committer.email - end - - def prev_commit - @prev_commit ||= if parents.present? - Commit.new(parents.first) - else - nil - end - end - - def prev_commit_id - prev_commit.try :id - 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. - 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 =~ /^[\d.]+$/ # Git version - lines.pop if lines.last == "-- " # end of diff - lines.join("\n") - end - - def has_zero_stats? - stats.total.zero? - rescue - true - end - - def no_commit_message - "--no commit message" - end - end - end -end diff --git a/lib/gitlab/git/compare.rb b/lib/gitlab/git/compare.rb deleted file mode 100644 index 1fa43062..00000000 --- a/lib/gitlab/git/compare.rb +++ /dev/null @@ -1,37 +0,0 @@ -module Gitlab - module Git - class Compare - attr_accessor :commits, :commit, :diffs, :same - - def initialize(repository, from, to) - @commits, @diffs = [], [] - @commit = nil - @same = false - - return unless from && to - - first = repository.commit(to.try(:strip)) - last = repository.commit(from.try(:strip)) - - return unless first && last - - if first.id == last.id - @same = true - return - end - - @commit = Commit.new(first) - - @commits = repository.commits_between(last.id, first.id) - @commits = @commits.map { |c| Commit.new(c) } - - @diffs = if @commits.size > 100 - [] - else - repository.repo.diff(last.id, first.id) rescue [] - end - end - end - end -end - diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb deleted file mode 100644 index 30344a3d..00000000 --- a/lib/gitlab/git/repository.rb +++ /dev/null @@ -1,185 +0,0 @@ -# Gitlab::Git::Gitlab::Git::Commit is a wrapper around native Grit::Repository object -# We dont want to use grit objects inside app/ -# It helps us easily migrate to rugged in future -module Gitlab - module Git - class Repository - include Gitlab::Popen - - class NoRepository < StandardError; end - - # Repository directory name with namespace direcotry - # Examples: - # gitlab/gitolite - # diaspora - # - attr_accessor :path_with_namespace - - # 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 - end - - def raw - repo - end - - def path_to_repo - @path_to_repo ||= File.join(repos_path, "#{path_with_namespace}.git") - end - - def repos_path - Gitlab.config.gitlab_shell.repos_path - end - - def repo - @repo ||= Grit::Repo.new(path_to_repo) - rescue Grit::NoSuchPathError - raise NoRepository.new('no repository for such path') - end - - def commit(commit_id = nil) - Gitlab::Git::Commit.find_or_first(repo, commit_id, root_ref) - end - - def fresh_commits(n = 10) - Gitlab::Git::Commit.fresh_commits(repo, n) - end - - def commits_with_refs(n = 20) - Gitlab::Git::Commit.commits_with_refs(repo, n) - end - - def commits_since(date) - Gitlab::Git::Commit.commits_since(repo, date) - end - - def commits(ref, path = nil, limit = nil, offset = nil) - Gitlab::Git::Commit.commits(repo, ref, path, limit, offset) - end - - def last_commit_for(ref, path = nil) - commits(ref, path, 1).first - end - - def commits_between(from, to) - Gitlab::Git::Commit.commits_between(repo, from, to) - end - - # Returns an Array of branch names - # sorted by name ASC - def branch_names - branches.map(&:name) - end - - # Returns an Array of Branches - def branches - repo.branches.sort_by(&:name) - end - - # Returns an Array of tag names - def tag_names - repo.tags.collect(&:name).sort.reverse - end - - # Returns an Array of Tags - def tags - repo.tags.sort_by(&:name).reverse - end - - # Returns an Array of branch and tag names - def ref_names - [branch_names + tag_names].flatten - end - - def heads - @heads ||= repo.heads - end - - def tree(fcommit, path = nil) - fcommit = commit if fcommit == :head - tree = fcommit.tree - path ? (tree / path) : tree - end - - 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 - # - # - 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) - 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 - - # Archive Project to .tar.gz - # - # Already packed repo archives stored at - # app_root/tmp/repositories/project_name/project_name-commit-id.tag.gz - # - def archive_repo(ref) - ref = ref || self.root_ref - commit = self.commit(ref) - return nil unless commit - - # Build file path - file_name = self.path_with_namespace.gsub("/","_") + "-" + commit.id.to_s + ".tar.gz" - storage_path = Rails.root.join("tmp", "repositories") - file_path = File.join(storage_path, self.path_with_namespace, file_name) - - # Put files into a directory before archiving - prefix = File.basename(self.path_with_namespace) + "/" - - # Create file if not exists - unless File.exists?(file_path) - FileUtils.mkdir_p File.dirname(file_path) - file = self.repo.archive_to_file(ref, prefix, file_path) - end - - file_path - end - - # Return repo size in megabytes - # Cached in redis - def size - Rails.cache.fetch(cache_key(:size)) do - size = popen('du -s', path_to_repo).first.strip.to_i - (size.to_f / 1024).round(2) - end - end - - def expire_cache - Rails.cache.delete(cache_key(:size)) - end - - def cache_key(type) - "#{type}:#{path_with_namespace}" - end - end - end -end diff --git a/lib/gitlab/graph/commit.rb b/lib/gitlab/graph/commit.rb new file mode 100644 index 00000000..a6bf23a2 --- /dev/null +++ b/lib/gitlab/graph/commit.rb @@ -0,0 +1,50 @@ +require "grit" + +module Gitlab + module Graph + class Commit + include ActionView::Helpers::TagHelper + + attr_accessor :time, :space, :refs + + def initialize(commit) + @_commit = commit + @time = -1 + @space = 0 + end + + def method_missing(m, *args, &block) + @_commit.send(m, *args, &block) + end + + def to_graph_hash + h = {} + h[:parents] = self.parents.collect do |p| + [p.id,0,0] + end + 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 + end + + 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 + end + end +end diff --git a/lib/gitlab/graph/json_builder.rb b/lib/gitlab/graph/json_builder.rb new file mode 100644 index 00000000..4a48b3b5 --- /dev/null +++ b/lib/gitlab/graph/json_builder.rb @@ -0,0 +1,182 @@ +require "grit" + +module Gitlab + module Graph + class JsonBuilder + attr_accessor :days, :commits, :ref_cache, :repo + + def self.max_count + @max_count ||= 650 + end + + def initialize project + @project = project + @repo = project.repo + @ref_cache = {} + + @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 + # + 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 + + # 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] comits to index + # + # @return [Array] list of commit dates corelated with time on commits + 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 + + # Add space mark on commit and its parents + # + # @param [Graph::Commit] the commit object. + # @param [Hash] map of commits + 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 + + def mark_reserved(time_range, space) + for day in time_range + @_reserved[day].push(space) + end + end + + 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 + + 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. + # + # @param [Graph::Commit] the commit object. + # @param [Hash] map of commits + # + # @return [Array] list of branch commits + 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 + end + end +end diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index ad6ba3e8..e7d6e3e6 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -17,7 +17,7 @@ module Gitlab # Examples # # >> gfm("Hey @david, can you fix this?") - # => "Hey @david, can you fix this?" + # => "Hey @david, can you fix this?" # # >> gfm("Commit 35d5f7c closes #1234") # => "Commit 35d5f7c closes #1234" @@ -25,8 +25,6 @@ module Gitlab # >> gfm(":trollface:") # => "\":trollface:\" module Markdown - include IssuesHelper - attr_reader :html_options # Public: Parse the provided text with GitLab-Flavored Markdown @@ -160,16 +158,13 @@ module Gitlab def reference_user(identifier) if member = @project.users_projects.joins(:user).where(users: { username: identifier }).first - link_to("@#{identifier}", user_path(identifier), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member + link_to("@#{identifier}", project_team_member_url(@project, member), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member end end def reference_issue(identifier) - if @project.issue_exists? identifier - url = url_for_issue(identifier) - title = title_for_issue(identifier) - - link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + if issue = @project.issues.where(id: identifier).first + link_to("##{identifier}", project_issue_url(@project, issue), html_options.merge(title: "Issue: #{issue.title}", class: "gfm gfm-issue #{html_options[:class]}")) end end @@ -187,7 +182,7 @@ module Gitlab def reference_commit(identifier) if @project.valid_repo? && commit = @project.repository.commit(identifier) - link_to(identifier, project_commit_url(@project, commit), html_options.merge(title: commit.link_title, class: "gfm gfm-commit #{html_options[:class]}")) + link_to(identifier, project_commit_url(@project, commit), html_options.merge(title: CommitDecorator.new(commit).link_title, class: "gfm gfm-commit #{html_options[:class]}")) end end end diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb deleted file mode 100644 index f2cfd807..00000000 --- a/lib/gitlab/popen.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Gitlab - module Popen - def popen(cmd, path) - vars = { "PWD" => path } - options = { :chdir => path } - - @cmd_output = "" - @cmd_status = 0 - Open3.popen3(vars, cmd, options) do |stdin, stdout, stderr, wait_thr| - @cmd_status = wait_thr.value.exitstatus - @cmd_output << stdout.read - @cmd_output << stderr.read - end - - return @cmd_output, @cmd_status - end - end -end diff --git a/lib/gitlab/project_mover.rb b/lib/gitlab/project_mover.rb new file mode 100644 index 00000000..207e585f --- /dev/null +++ b/lib/gitlab/project_mover.rb @@ -0,0 +1,45 @@ +# ProjectMover class +# +# Used for moving project repositories from one subdir to another +module Gitlab + class ProjectMover + class ProjectMoveError < StandardError; end + + attr_reader :project, :old_dir, :new_dir + + def initialize(project, old_dir, new_dir) + @project = project + @old_dir = old_dir + @new_dir = new_dir + end + + def execute + # Create new dir if missing + new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir) + 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") + + if File.exists? new_path + raise ProjectMoveError.new("Destination #{new_path} already exists") + end + + begin + FileUtils.mv( old_path, new_path ) + log_info "Project #{project.name} was moved from #{old_path} to #{new_path}" + true + rescue Exception => e + message = "Project #{project.name} cannot be moved from #{old_path} to #{new_path}" + log_info "Error! #{message} (#{e.message})" + raise ProjectMoveError.new(message) + end + end + + protected + + def log_info message + Gitlab::AppLogger.info message + end + end +end diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index 5eeb7c80..48304220 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -10,10 +10,6 @@ module Gitlab /\A[a-zA-Z][a-zA-Z0-9_\-\. ]*\z/ end - def name_regex - /\A[a-zA-Z0-9_\-\. ]*\z/ - end - def path_regex default_regex end diff --git a/lib/gitlab/satellite/action.rb b/lib/gitlab/satellite/action.rb index 63303ca3..ed2541f3 100644 --- a/lib/gitlab/satellite/action.rb +++ b/lib/gitlab/satellite/action.rb @@ -17,8 +17,6 @@ module Gitlab # * Locks the satellite repo # * Yields the prepared satellite repo def in_locked_and_timed_satellite - Gitlab::ShellEnv.set_env(user) - Grit::Git.with_timeout(options[:git_timeout]) do project.satellite.lock do return yield project.satellite.repo @@ -30,8 +28,6 @@ module Gitlab rescue Grit::Git::GitTimeout => ex Gitlab::GitLogger.error(ex.message) return false - ensure - Gitlab::ShellEnv.reset_env end # * Clears the satellite diff --git a/lib/gitlab/satellite/edit_file_action.rb b/lib/gitlab/satellite/edit_file_action.rb index 07570965..e9053f90 100644 --- a/lib/gitlab/satellite/edit_file_action.rb +++ b/lib/gitlab/satellite/edit_file_action.rb @@ -13,7 +13,7 @@ module Gitlab # 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 committing the change fails + # Returns false if commiting the change fails # Returns false if pushing from the satellite to Gitolite failed or was rejected # Returns true otherwise def commit!(content, commit_message, last_commit) diff --git a/lib/gitlab/satellite/logger.rb b/lib/gitlab/satellite/logger.rb deleted file mode 100644 index 6f3f8255..00000000 --- a/lib/gitlab/satellite/logger.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Gitlab - module Satellite - class Logger < Gitlab::Logger - def self.file_name - 'satellites.log' - end - - def format_message(severity, timestamp, progname, msg) - "#{timestamp.to_s(:long)}: #{msg}\n" - end - end - end -end diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index 668de75f..164af55d 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -3,8 +3,6 @@ module Gitlab module Satellite class Satellite - include Gitlab::Popen - PARKING_BRANCH = "__parking_branch" attr_accessor :project @@ -13,10 +11,6 @@ module Gitlab @project = project end - def log message - Gitlab::Satellite::Logger.error(message) - end - def raise_no_satellite raise SatelliteNotExistError.new("Satellite doesn't exist") end @@ -24,22 +18,17 @@ module Gitlab def clear_and_update! raise_no_satellite unless exists? - clear_working_dir! delete_heads! + clear_working_dir! update_from_source! end def create - output, status = popen("git clone #{project.repository.path_to_repo} #{path}", - Gitlab.config.satellites.path) - - log("PID: #{project.id}: git clone #{project.repository.path_to_repo} #{path}") - log("PID: #{project.id}: -> #{output}") - - if status.zero? + create_cmd = "git clone #{project.url_to_repo} #{path}" + if system(create_cmd) true else - log("Failed to create satellite for #{project.name_with_namespace}") + Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}") false end end @@ -77,10 +66,6 @@ module Gitlab @repo ||= Grit::Repo.new(path) end - def destroy - FileUtils.rm_rf(path) - end - private # Clear the working directory diff --git a/lib/gitlab/user_team_manager.rb b/lib/gitlab/user_team_manager.rb deleted file mode 100644 index 4127d5e1..00000000 --- a/lib/gitlab/user_team_manager.rb +++ /dev/null @@ -1,137 +0,0 @@ -# UserTeamManager class -# -# Used for manage User teams with project repositories -module Gitlab - class UserTeamManager - class << self - def assign(team, project, access) - project = Project.find(project) unless project.is_a? Project - searched_project = team.user_team_project_relationships.find_by_project_id(project.id) - - unless searched_project.present? - team.user_team_project_relationships.create(project_id: project.id, greatest_access: access) - update_team_users_access_in_project(team, project, :added) - end - end - - def resign(team, project) - project = Project.find(project) unless project.is_a? Project - - team.user_team_project_relationships.with_project(project).destroy_all - - update_team_users_access_in_project(team, project, :updated) - end - - def update_team_user_membership(team, member, options) - updates = {} - - if options[:default_projects_access] && options[:default_projects_access] != team.default_projects_access(member) - updates[:permission] = options[:default_projects_access] - end - - if options[:group_admin].to_s != team.admin?(member).to_s - updates[:group_admin] = options[:group_admin].present? - end - - unless updates.blank? - user_team_relationship = team.user_team_user_relationships.find_by_user_id(member) - if user_team_relationship.update_attributes(updates) - if updates[:permission] - rebuild_project_permissions_to_member(team, member) - end - true - else - false - end - else - true - end - end - - def update_project_greates_access(team, project, permission) - project_relation = team.user_team_project_relationships.find_by_project_id(project) - if permission != team.max_project_access(project) - if project_relation.update_attributes(greatest_access: permission) - update_team_users_access_in_project(team, project, :updated) - true - else - false - end - else - true - end - end - - def rebuild_project_permissions_to_member(team, member) - team.projects.each do |project| - update_team_user_access_in_project(team, member, project) - end - end - - def update_team_users_access_in_project(team, project, action) - members = team.members - members.each do |member| - update_team_user_access_in_project(team, member, project, action) - end - end - - def update_team_user_access_in_project(team, user, project, action) - granted_access = max_teams_member_permission_in_project(user, project, action) - - project_team_user = UsersProject.find_by_user_id_and_project_id(user.id, project.id) - project_team_user.destroy if project_team_user.present? - - # project_team_user.project_access != granted_access - project.team << [user, granted_access] if granted_access > 0 - end - - def max_teams_member_permission_in_project(user, project, action = nil, teams = nil) - result_access = 0 - - teams ||= project.user_teams.with_member(user) - - if action && (action == :added) && (teams.count == 1) - result_access ||= project.users_project.with_user(user).first.project_access - end - - if teams.any? - teams.each do |team| - granted_access = max_team_member_permission_in_project(team, user, project) - result_access = [granted_access, result_access].max - end - end - result_access - end - - def max_team_member_permission_in_project(team, user, project) - member_access = team.default_projects_access(user) - team_access = team.user_team_project_relationships.find_by_project_id(project.id).greatest_access - - [team_access, member_access].min - end - - def add_member_into_team(team, user, access, admin) - user = User.find(user) unless user.is_a? User - - team.user_team_user_relationships.create(user_id: user.id, permission: access, group_admin: admin) - team.projects.each do |project| - update_team_user_access_in_project(team, user, project, :added) - end - end - - def remove_member_from_team(team, user) - user = User.find(user) unless user.is_a? User - - team.user_team_user_relationships.with_user(user).destroy_all - other_teams = [] - team.projects.each do |project| - other_teams << project.user_teams.with_member(user) - end - other_teams.uniq - unless other_teams.any? - UsersProject.in_projects(team.projects).with_user(user).destroy_all - end - end - end - end -end diff --git a/lib/gitolited.rb b/lib/gitolited.rb new file mode 100644 index 00000000..68b9b625 --- /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 new file mode 100755 index 00000000..6944d3e3 --- /dev/null +++ b/lib/hooks/post-receive @@ -0,0 +1,12 @@ +#!/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. + +while read oldrev newrev ref +do + # For every branch or tag that was pushed, create a Resque job in redis. + repo_path=`pwd` + env -i redis-cli rpush "resque:gitlab:queue:post_receive" "{\"class\":\"PostReceive\",\"args\":[\"$repo_path\",\"$oldrev\",\"$newrev\",\"$ref\",\"$GL_USER\"]}" > /dev/null 2>&1 +done diff --git a/lib/support/rewrite-hooks.sh b/lib/support/rewrite-hooks.sh new file mode 100755 index 00000000..b8fd36b9 --- /dev/null +++ b/lib/support/rewrite-hooks.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +src="/home/git/repositories" + +for dir in `ls "$src/"` +do + if [ -d "$src/$dir" ]; then + + if [ "$dir" = "gitolite-admin.git" ] + then + continue + fi + + 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 + 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 00000000..3b14e2ee --- /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/cache.rake b/lib/tasks/cache.rake deleted file mode 100644 index 8320b9b2..00000000 --- a/lib/tasks/cache.rake +++ /dev/null @@ -1,6 +0,0 @@ -namespace :cache do - desc "GITLAB | Clear redis cache" - task :clear => :environment do - Rails.cache.clear - end -end diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index 32acdcf5..ae2b1bb7 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -144,7 +144,7 @@ namespace :gitlab do task :restore => :environment do backup_path_repo = File.join(Gitlab.config.backup.path, "repositories") - repos_path = Gitlab.config.gitlab_shell.repos_path + repos_path = Gitlab.config.gitolite.repos_path puts "Restoring repositories ... " @@ -178,9 +178,8 @@ namespace :gitlab do ActiveRecord::Base.connection.tables.each do |tbl| print " * #{tbl.yellow} ... " count = 1 - safe_tablename = ActiveRecord::Base.connection.quote_table_name(tbl) File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file| - ActiveRecord::Base.connection.select_all("SELECT * FROM #{safe_tablename}").each do |line| + ActiveRecord::Base.connection.select_all("SELECT * FROM `#{tbl}`").each do |line| line.delete_if{|k,v| v.blank?} output = {tbl + '_' + count.to_s => line} file << output.to_yaml.gsub(/^---\n/,'') + "\n" diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake index eb1a7559..36c51d06 100644 --- a/lib/tasks/gitlab/bulk_add_permission.rake +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -4,21 +4,21 @@ namespace :gitlab do task :all_users_to_all_projects => :environment do |t, args| user_ids = User.where(:admin => false).pluck(:id) admin_ids = User.where(:admin => true).pluck(:id) - projects_ids = Project.pluck(:id) - puts "Importing #{user_ids.size} users into #{projects_ids.size} projects" - UsersProject.add_users_into_projects(projects_ids, user_ids, UsersProject::DEVELOPER) - - puts "Importing #{admin_ids.size} admins into #{projects_ids.size} projects" - UsersProject.add_users_into_projects(projects_ids, admin_ids, UsersProject::MASTER) + Project.find_each do |project| + puts "Importing #{user_ids.size} users into #{project.code}" + UsersProject.bulk_import(project, user_ids, UsersProject::DEVELOPER) + puts "Importing #{admin_ids.size} admins into #{project.code}" + UsersProject.bulk_import(project, admin_ids, UsersProject::MASTER) + end end desc "GITLAB | Add a specific user to all projects (as a developer)" task :user_to_projects, [:email] => :environment do |t, args| user = User.find_by_email args.email project_ids = Project.pluck(:id) - puts "Importing #{user.email} users into #{project_ids.size} projects" - UsersProject.add_users_into_projects(project_ids, Array.wrap(user.id), UsersProject::DEVELOPER) + + UsersProject.user_bulk_import(user, project_ids, UsersProject::DEVELOPER) end end end \ No newline at end of file diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index c8d8d531..00068abf 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -1,7 +1,7 @@ namespace :gitlab do desc "GITLAB | Check the configuration of GitLab and its environment" task check: %w{gitlab:env:check - gitlab:gitlab_shell:check + gitlab:gitolite:check gitlab:sidekiq:check gitlab:app:check} @@ -142,7 +142,7 @@ namespace :gitlab do return end - recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab 2>/dev/null` + recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/4-1-stable/init.d/gitlab 2>/dev/null` script_content = File.read(script_path) if recipe_content == script_content @@ -169,7 +169,7 @@ namespace :gitlab do else puts "no".red try_fixing_it( - sudo_gitlab("bundle exec rake db:migrate RAILS_ENV=production") + sudo_gitlab("bundle exec rake db:migrate") ) fix_and_rerun end @@ -194,7 +194,7 @@ namespace :gitlab do else puts "no".red try_fixing_it( - sudo_gitlab("bundle exec rake gitlab:satellites:create RAILS_ENV=production"), + sudo_gitlab("bundle exec rake gitlab:satellites:create"), "If necessary, remove the tmp/repo_satellites directory ...", "... and rerun the above command" ) @@ -255,6 +255,8 @@ namespace :gitlab do warn_user_is_not_gitlab start_checking "Environment" + check_gitlab_in_git_group + check_issue_1059_shell_profile_error check_gitlab_git_config check_python2_exists check_python2_version @@ -293,6 +295,49 @@ namespace :gitlab do end end + def check_gitlab_in_git_group + gitlab_user = Gitlab.config.gitlab.user + gitolite_owner_group = Gitlab.config.gitolite.owner_group + print "#{gitlab_user} user is in #{gitolite_owner_group} group? ... " + + if run_and_match("id -rnG", /^#{gitolite_owner_group}\W|\W#{gitolite_owner_group}\W|\W#{gitolite_owner_group}$/) + puts "yes".green + else + puts "no".red + try_fixing_it( + "sudo usermod -a -G #{gitolite_owner_group} #{gitlab_user}" + ) + for_more_information( + see_installation_guide_section "System Users" + ) + fix_and_rerun + end + end + + # see https://github.com/gitlabhq/gitlabhq/issues/1059 + 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.join(gitolite_user_home, ".profile") + + unless File.read(profile_file) =~ /^-e PATH/ + puts "yes".green + else + puts "no".red + try_fixing_it( + "Open #{profile_file}", + "Find the line starting with \"-e PATH\"", + "Remove \"-e \" so the line starts with PATH" + ) + for_more_information( + see_installation_guide_section("Gitolite"), + "https://github.com/gitlabhq/gitlabhq/issues/1059" + ) + fix_and_rerun + end + end + def check_python2_exists print "Has python2? ... " @@ -342,48 +387,296 @@ namespace :gitlab do - namespace :gitlab_shell do - desc "GITLAB | Check the configuration of Gitlab Shell" + namespace :gitolite do + desc "GITLAB | Check the configuration of Gitolite" task check: :environment do warn_user_is_not_gitlab - start_checking "Gitlab Shell" + start_checking "Gitolite" - check_gitlab_shell + check_gitolite_is_up_to_date + check_gitoliterc_repo_umask + check_gitoliterc_git_config_keys + check_dot_gitolite_exists + 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 + check_can_commit_to_gitolite_admin + check_post_receive_hook_exists check_post_receive_hook_is_up_to_date check_repos_post_receive_hooks_is_link + check_repos_git_config - finished_checking "Gitlab Shell" + finished_checking "Gitolite" end # Checks ######################## + def check_can_clone_gitolite_admin + print "Can clone gitolite-admin? ... " + + test_path = "/tmp/gitlab_gitolite_admin_test" + FileUtils.rm_rf(test_path) + `git clone -q #{Gitlab.config.gitolite.admin_uri} #{test_path}` + raise unless $?.success? + + puts "yes".green + rescue + puts "no".red + try_fixing_it( + "Make sure the \"admin_uri\" is set correctly in config/gitlab.yml", + "Try cloning it yourself with:", + " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin", + "Make sure Gitolite is installed correctly." + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + end + + # assumes #check_can_clone_gitolite_admin has been run before + def check_can_commit_to_gitolite_admin + print "Can commit to gitolite-admin? ... " + + test_path = "/tmp/gitlab_gitolite_admin_test" + unless File.exists?(test_path) + puts "can't check because of previous errors".magenta + return + end + + Dir.chdir(test_path) do + `touch foo && git add foo && git commit -qm foo` + raise unless $?.success? + end + + puts "yes".green + rescue + puts "no".red + try_fixing_it( + "Try committing to it yourself with:", + " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin", + " touch foo", + " git add foo", + " git commit -m \"foo\"", + "Make sure Gitolite is installed correctly." + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + ensure + FileUtils.rm_rf("/tmp/gitolite_gitlab_test") + end + + def check_dot_gitolite_exists + print "Config directory exists? ... " + + gitolite_config_path = File.join(gitolite_user_home, ".gitolite") + + if File.directory?(gitolite_config_path) + puts "yes".green + else + puts "no".red + puts "#{gitolite_config_path} is missing".red + try_fixing_it( + "This should have been created when setting up Gitolite.", + "Make sure Gitolite is installed correctly." + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + end + end + + def check_dot_gitolite_permissions + print "Config directory access is drwxr-x---? ... " + + gitolite_config_path = File.join(gitolite_user_home, ".gitolite") + unless File.exists?(gitolite_config_path) + puts "can't check because of previous errors".magenta + return + end + + if File.stat(gitolite_config_path).mode.to_s(8).ends_with?("750") + puts "yes".green + else + puts "no".red + try_fixing_it( + "sudo chmod 750 #{gitolite_config_path}" + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + end + end + + def check_dot_gitolite_user_and_group + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user + gitolite_owner_group = Gitlab.config.gitolite.owner_group + print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_owner_group} ... " + + gitolite_config_path = File.join(gitolite_user_home, ".gitolite") + unless File.exists?(gitolite_config_path) + puts "can't check because of previous errors".magenta + return + end + + if File.stat(gitolite_config_path).uid == uid_for(gitolite_ssh_user) && + File.stat(gitolite_config_path).gid == gid_for(gitolite_owner_group) + puts "yes".green + else + puts "no".red + try_fixing_it( + "sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{gitolite_config_path}" + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + end + end + + def check_gitolite_is_up_to_date + print "Using recommended version ... " + if gitolite_version.try(:start_with?, "v3.2") + puts "yes".green + else + puts "no".red + try_fixing_it( + "We strongly recommend using the version pointed out in the installation guide." + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + # this is not a "hard" failure + end + end + + def check_gitoliterc_git_config_keys + gitoliterc_path = File.join(gitolite_user_home, ".gitolite.rc") + + print "Allow all Git config keys in .gitolite.rc ... " + option_name = if has_gitolite3? + # see https://github.com/sitaramc/gitolite/blob/v3.04/src/lib/Gitolite/Rc.pm#L329 + "GIT_CONFIG_KEYS" + else + # assume older version + # see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L49 + "\\$GL_GITCONFIG_KEYS" + end + option_value = ".*" + if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*["']#{option_value}["']/).any? + puts "yes".green + else + puts "no".red + try_fixing_it( + "Open #{gitoliterc_path}", + "Find the \"#{option_name}\" option", + "Change its value to \".*\"" + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + end + end + + def check_gitoliterc_repo_umask + gitoliterc_path = File.join(gitolite_user_home, ".gitolite.rc") + + print "Repo umask is 0007 in .gitolite.rc? ... " + option_name = if has_gitolite3? + # see https://github.com/sitaramc/gitolite/blob/v3.04/src/lib/Gitolite/Rc.pm#L328 + "UMASK" + else + # assume older version + # see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L32 + "\\$REPO_UMASK" + end + option_value = "0007" + if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*#{option_value}/).any? + puts "yes".green + else + puts "no".red + try_fixing_it( + "Open #{gitoliterc_path}", + "Find the \"#{option_name}\" option", + "Change its value to \"0007\"" + ) + for_more_information( + see_installation_guide_section "Gitolite" + ) + fix_and_rerun + end + end + + def check_post_receive_hook_exists + print "post-receive hook exists? ... " + + 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_ssh_user = Gitlab.config.gitolite.ssh_user + + gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file) + + if File.exists?(gitolite_hook_file) + puts "yes".green + else + puts "no".red + try_fixing_it( + "sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}" + ) + for_more_information( + see_installation_guide_section "Setup GitLab Hooks" + ) + fix_and_rerun + end + end def check_post_receive_hook_is_up_to_date print "post-receive hook up-to-date? ... " hook_file = "post-receive" - gitlab_shell_hooks_path = Gitlab.config.gitlab_shell.hooks_path - gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file) - gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") + gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user - unless File.exists?(gitlab_shell_hook_file) + unless File.exists?(gitolite_hook_file) puts "can't check because of previous errors".magenta return end - puts "yes".green + 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) + + if gitolite_hook_content == gitlab_hook_content + puts "yes".green + else + puts "no".red + try_fixing_it( + "sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}" + ) + for_more_information( + see_installation_guide_section "Setup GitLab Hooks" + ) + fix_and_rerun + end end def check_repo_base_exists print "Repo base directory exists? ... " - repo_base_path = Gitlab.config.gitlab_shell.repos_path + repo_base_path = Gitlab.config.gitolite.repos_path if File.exists?(repo_base_path) puts "yes".green @@ -391,12 +684,12 @@ namespace :gitlab do puts "no".red puts "#{repo_base_path} is missing".red try_fixing_it( - "This should have been created when setting up Gitlab Shell.", + "This should have been created when setting up Gitolite.", "Make sure it's set correctly in config/gitlab.yml", - "Make sure Gitlab Shell is installed correctly." + "Make sure Gitolite is installed correctly." ) for_more_information( - see_installation_guide_section "Gitlab Shell" + see_installation_guide_section "Gitolite" ) fix_and_rerun end @@ -405,7 +698,7 @@ namespace :gitlab do def check_repo_base_is_not_symlink print "Repo base directory is a symlink? ... " - repo_base_path = Gitlab.config.gitlab_shell.repos_path + repo_base_path = Gitlab.config.gitolite.repos_path unless File.exists?(repo_base_path) puts "can't check because of previous errors".magenta return @@ -423,65 +716,102 @@ namespace :gitlab do end def check_repo_base_permissions - print "Repo base access is drwxrws---? ... " + print "Repo base access is drwsrws---? ... " - repo_base_path = Gitlab.config.gitlab_shell.repos_path + 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 - if File.stat(repo_base_path).mode.to_s(8).ends_with?("2770") + if File.stat(repo_base_path).mode.to_s(8).ends_with?("6770") puts "yes".green else puts "no".red try_fixing_it( - "sudo chmod -R ug+rwX,o-rwx #{repo_base_path}", - "sudo chmod -R ug-s #{repo_base_path}", - "find #{repo_base_path} -type d -print0 | sudo xargs -0 chmod g+s" + "sudo chmod -R ug+rwXs,o-rwx #{repo_base_path}" ) for_more_information( - see_installation_guide_section "Gitlab Shell" + see_installation_guide_section "Gitolite" ) fix_and_rerun end end def check_repo_base_user_and_group - gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user - gitlab_shell_owner_group = Gitlab.config.gitlab_shell.owner_group - print "Repo base owned by #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group}? ... " + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user + gitolite_owner_group = Gitlab.config.gitolite.owner_group + print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_owner_group}? ... " - repo_base_path = Gitlab.config.gitlab_shell.repos_path + 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 - if File.stat(repo_base_path).uid == uid_for(gitlab_shell_ssh_user) && - File.stat(repo_base_path).gid == gid_for(gitlab_shell_owner_group) + if File.stat(repo_base_path).uid == uid_for(gitolite_ssh_user) && + File.stat(repo_base_path).gid == gid_for(gitolite_owner_group) puts "yes".green else puts "no".red try_fixing_it( - "sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}" + "sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{repo_base_path}" ) for_more_information( - see_installation_guide_section "Gitlab Shell" + see_installation_guide_section "Gitolite" ) fix_and_rerun end end + def check_repos_git_config + print "Git config in repos: ... " + + unless Project.count > 0 + puts "can't check, you have no projects".magenta + return + end + puts "" + + options = { + "core.sharedRepository" => "0660", + } + + Project.find_each(batch_size: 100) do |project| + print "#{project.name_with_namespace.yellow} ... " + + if project.empty_repo? + puts "repository is empty".magenta + else + correct_options = options.map do |name, value| + run("git --git-dir=\"#{project.repository.path_to_repo}\" config --get #{name}").try(:chomp) == value + end + + if correct_options.all? + puts "ok".green + else + puts "wrong or missing".red + try_fixing_it( + sudo_gitlab("bundle exec rake gitlab:gitolite:update_repos") + ) + for_more_information( + "doc/raketasks/maintenance.md" + ) + fix_and_rerun + end + end + end + end + def check_repos_post_receive_hooks_is_link print "post-receive hooks in repos are links: ... " hook_file = "post-receive" - gitlab_shell_hooks_path = Gitlab.config.gitlab_shell.hooks_path - gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file) - gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") + gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user - unless File.exists?(gitlab_shell_hook_file) + unless File.exists?(gitolite_hook_file) puts "can't check because of previous errors".magenta return end @@ -503,22 +833,22 @@ namespace :gitlab do unless File.exists?(project_hook_file) puts "missing".red try_fixing_it( - "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}" + "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}" ) for_more_information( - "#{gitlab_shell_user_home}/gitlab-shell/support/rewrite-hooks.sh" + "lib/support/rewrite-hooks.sh" ) fix_and_rerun next end if File.lstat(project_hook_file).symlink? && - File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file) + File.realpath(project_hook_file) == File.realpath(gitolite_hook_file) puts "ok".green else - puts "not a link to Gitlab Shell's hook".red + puts "not a link to Gitolite's hook".red try_fixing_it( - "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}" + "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}" ) for_more_information( "lib/support/rewrite-hooks.sh" @@ -533,19 +863,19 @@ namespace :gitlab do # Helper methods ######################## - def gitlab_shell_user_home - File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}") + def gitolite_user_home + File.expand_path("~#{Gitlab.config.gitolite.ssh_user}") end - def gitlab_shell_version - gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab-shell/VERSION" - if File.readable?(gitlab_shell_version_file) - File.read(gitlab_shell_version_file) + def gitolite_version + gitolite_version_file = "#{gitolite_user_home}/gitolite/src/VERSION" + if File.readable?(gitolite_version_file) + File.read(gitolite_version_file) end end - def has_gitlab_shell3? - gitlab_shell_version.try(:start_with?, "v3.") + def has_gitolite3? + gitolite_version.try(:start_with?, "v3.") end end @@ -574,7 +904,7 @@ namespace :gitlab do else puts "no".red try_fixing_it( - sudo_gitlab("bundle exec rake sidekiq:start RAILS_ENV=production") + sudo_gitlab("bundle exec rake sidekiq:start") ) for_more_information( see_installation_guide_section("Install Init Script"), @@ -634,13 +964,4 @@ namespace :gitlab do puts " #{step}" end end - - def check_gitlab_shell - print "GitLab Shell version? ... " - if gitlab_shell_version.strip == '1.2.0' - puts 'OK (1.2.0)'.green - else - puts 'FAIL. Please update gitlab-shell to v1.2.0'.red - end - end end diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake index d8ee56e5..2a0ffe0f 100644 --- a/lib/tasks/gitlab/cleanup.rake +++ b/lib/tasks/gitlab/cleanup.rake @@ -1,5 +1,38 @@ 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 @@ -7,7 +40,7 @@ namespace :gitlab do namespaces = Namespace.pluck(:path) - git_base_path = Gitlab.config.gitlab_shell.repos_path + git_base_path = Gitlab.config.gitolite.repos_path all_dirs = Dir.glob(git_base_path + '/*') puts git_base_path.yellow @@ -48,7 +81,7 @@ namespace :gitlab do warn_user_is_not_gitlab remove_flag = ENV['REMOVE'] - git_base_path = Gitlab.config.gitlab_shell.repos_path + git_base_path = Gitlab.config.gitolite.repos_path all_dirs = Dir.glob(git_base_path + '/*') global_projects = Project.where(namespace_id: nil).pluck(:path) @@ -68,6 +101,13 @@ namespace :gitlab do 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 diff --git a/lib/tasks/gitlab/enable_automerge.rake b/lib/tasks/gitlab/enable_automerge.rake index 6822e5cf..e92da810 100644 --- a/lib/tasks/gitlab/enable_automerge.rake +++ b/lib/tasks/gitlab/enable_automerge.rake @@ -1,18 +1,17 @@ namespace :gitlab do - namespace :satellites do - desc "GITLAB | Create satellite repos" - task create: :environment do - create_satellites - end - end - - def create_satellites + desc "GITLAB | Enable auto merge" + task :enable_automerge => :environment do warn_user_is_not_gitlab + 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 - return + next end puts "" @@ -39,4 +38,9 @@ namespace :gitlab do end end end + + namespace :satellites do + desc "GITLAB | Create satellite repos" + task create: 'gitlab:enable_automerge' + end end diff --git a/lib/tasks/gitlab/enable_namespaces.rake b/lib/tasks/gitlab/enable_namespaces.rake index 6b7b75fd..aa76a2f7 100644 --- a/lib/tasks/gitlab/enable_namespaces.rake +++ b/lib/tasks/gitlab/enable_namespaces.rake @@ -6,6 +6,11 @@ namespace :gitlab do 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 @@ -75,7 +80,7 @@ namespace :gitlab do end def migrate_projects - git_path = Gitlab.config.gitlab_shell.repos_path + 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 @@ -99,7 +104,7 @@ namespace :gitlab do end begin - project.transfer(group.path) + Gitlab::ProjectMover.new(project, '', group.path).execute puts "moved to #{new_path}".green rescue puts "failed moving to #{new_path}".red diff --git a/lib/tasks/gitlab/gitolite_rebuild.rake b/lib/tasks/gitlab/gitolite_rebuild.rake new file mode 100644 index 00000000..af2a2127 --- /dev/null +++ b/lib/tasks/gitlab/gitolite_rebuild.rake @@ -0,0 +1,27 @@ +namespace :gitlab do + namespace :gitolite do + desc "GITLAB | Rebuild each project in Gitolite config" + task :update_repos => :environment do + warn_user_is_not_gitlab + + puts "Rebuilding projects ... " + Project.find_each(:batch_size => 100) do |project| + puts "#{project.name_with_namespace.yellow} ... " + project.update_repository + puts "... #{"done".green}" + end + end + + desc "GITLAB | Rebuild each user key in Gitolite config" + task :update_keys => :environment do + 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) + puts "... #{"done".green}" + end + end + end +end diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index bddbd7ef..29e5847b 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -12,7 +12,7 @@ namespace :gitlab do desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance" task :repos => :environment do - git_base_path = Gitlab.config.gitlab_shell.repos_path + git_base_path = Gitlab.config.gitolite.repos_path repos_to_import = Dir.glob(git_base_path + '/*') namespaces = Namespace.pluck(:path) @@ -26,6 +26,7 @@ namespace :gitlab do # 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$/, '') @@ -41,6 +42,7 @@ namespace :gitlab do project_params = { :name => path, + :namespace_id => Namespace.global_id, } project = Projects::CreateContext.new(user, project_params).execute diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake index 091de6ee..b325bcc3 100644 --- a/lib/tasks/gitlab/info.rake +++ b/lib/tasks/gitlab/info.rake @@ -40,8 +40,8 @@ namespace :gitlab do puts "" puts "GitLab information".yellow - puts "Version:\t#{Gitlab::VERSION}" - puts "Revision:\t#{Gitlab::REVISION}" + puts "Version:\t#{Gitlab::Version}" + puts "Revision:\t#{Gitlab::Revision}" puts "Directory:\t#{Rails.root}" puts "DB Adapter:\t#{database_adapter}" puts "URL:\t\t#{Gitlab.config.gitlab.url}" @@ -54,16 +54,18 @@ namespace :gitlab do # check Gitolite version - gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.repos_path}/../gitlab-shell/VERSION" - if File.readable?(gitlab_shell_version_file) - gitlab_shell_version = File.read(gitlab_shell_version_file) + gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitolite/src/VERSION" + if File.readable?(gitolite_version_file) + gitolite_version = File.read(gitolite_version_file) end puts "" - puts "GitLab Shell".yellow - puts "Version:\t#{gitlab_shell_version || "unknown".red}" - puts "Repositories:\t#{Gitlab.config.gitlab_shell.repos_path}" - puts "Hooks:\t\t#{Gitlab.config.gitlab_shell.hooks_path}" + puts "Gitolite information".yellow + puts "Version:\t#{gitolite_version || "unknown".red}" + puts "Admin URI:\t#{Gitlab.config.gitolite.admin_uri}" + puts "Admin Key:\t#{Gitlab.config.gitolite.admin_key}" + puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}" + puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}" puts "Git:\t\t#{Gitlab.config.git.bin_path}" end diff --git a/lib/tasks/gitlab/migrate_wiki.rake b/lib/tasks/gitlab/migrate_wiki.rake deleted file mode 100644 index 5d9881e4..00000000 --- a/lib/tasks/gitlab/migrate_wiki.rake +++ /dev/null @@ -1,42 +0,0 @@ -namespace :gitlab do - namespace :wiki do - - # This task will migrate all of the existing Wiki - # content stored in your database into the new - # Gollum Wiki system. A new repository named - # namespace/project.wiki.git will be created for - # each project that currently has Wiki pages in - # the database. - # - # Notes: - # * The existing Wiki content will remain in your - # database in-tact. - desc "GITLAB | Migrate Wiki content from database to Gollum repositories." - task :migrate => :environment do - wiki_migrator = WikiToGollumMigrator.new - wiki_migrator.migrate! - end - - # This task will destroy all of the Wiki repos - # that the Wiki migration task created. Run this - # to clean up your environment if you experienced - # problems during the original migration. After - # executing this task, you can attempt the original - # migration again. - # - # Notes: - # * This will not affect Wikis that have been created - # as Gollum Wikis only. It will only remove the wikis - # for the repositories that have old Wiki data in the - # dataabase. - # * If you have any repositories already named - # namespace/project.wiki that you do not wish - # to be removed you may want to perform a manual - # cleanup instead. - desc "GITLAB | Remove the Wiki repositories created by the `gitlab:wiki:migrate` task." - task :rollback => :environment do - wiki_migrator = WikiToGollumMigrator.new - wiki_migrator.rollback! - end - end -end diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake index 5b74daf9..5699e5d6 100644 --- a/lib/tasks/gitlab/setup.rake +++ b/lib/tasks/gitlab/setup.rake @@ -1,21 +1,20 @@ namespace :gitlab do desc "GITLAB | Setup production application" task :setup => :environment do - setup_db + setup end - def setup_db + def setup warn_user_is_not_gitlab - unless ENV['force'] == 'yes' - puts "This will create the necessary database tables and seed the database." - puts "You will lose any previous data stored in the database." - ask_to_continue - puts "" - end + puts "This will create the necessary database tables and seed the database." + puts "You will lose any previous data stored in the database." + ask_to_continue + puts "" Rake::Task["db:setup"].invoke Rake::Task["db:seed_fu"].invoke + Rake::Task["gitlab:enable_automerge"].invoke rescue Gitlab::TaskAbortedByUserError puts "Quitting...".red exit 1 diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake deleted file mode 100644 index ec5451dd..00000000 --- a/lib/tasks/gitlab/shell.rake +++ /dev/null @@ -1,49 +0,0 @@ -namespace :gitlab do - namespace :shell do - desc "GITLAB | Setup gitlab-shell" - task setup: :environment do - setup - end - - desc "GITLAB | Build missing projects" - task build_missing_projects: :environment do - Project.find_each(batch_size: 1000) do |project| - path_to_repo = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git") - if File.exists?(path_to_repo) - print '-' - else - if Gitlab::Shell.new.add_repository(project.path_with_namespace) - print '.' - else - print 'F' - end - end - end - end - end - - def setup - warn_user_is_not_gitlab - - gitlab_shell_authorized_keys = File.join(File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}"),'.ssh/authorized_keys') - puts "This will rebuild an authorized_keys file." - puts "You will lose any data stored in #{gitlab_shell_authorized_keys}." - ask_to_continue - puts "" - - system("echo '# Managed by gitlab-shell' > #{gitlab_shell_authorized_keys}") - - Key.find_each(batch_size: 1000) do |key| - if Gitlab::Shell.new.add_key(key.shell_id, key.key) - print '.' - else - print 'F' - end - end - - rescue Gitlab::TaskAbortedByUserError - puts "Quitting...".red - exit 1 - end -end - diff --git a/lib/tasks/gitlab/task_helpers.rake b/lib/tasks/gitlab/task_helpers.rake index cfab3670..d494125f 100644 --- a/lib/tasks/gitlab/task_helpers.rake +++ b/lib/tasks/gitlab/task_helpers.rake @@ -38,7 +38,7 @@ namespace :gitlab do # Prompt the user to input something # # message - the message to display before input - # choices - array of strings of acceptable answers or nil for any answer + # choices - array of strings of acceptible answers or nil for any answer # # Returns the user's answer def prompt(message, choices = nil) @@ -49,7 +49,7 @@ namespace :gitlab do answer end - # Runs the given command and matches the output against the given pattern + # Runs the given command and matches the output agains the given pattern # # Returns nil if nothing matched # Retunrs the MatchData if the pattern matched @@ -77,7 +77,8 @@ namespace :gitlab do end def gid_for(group_name) - Etc.getgrnam(group_name).gid + group_line = File.read("/etc/group").lines.select{|l| l.start_with?("#{group_name}:")}.first + group_line.split(":")[2].to_i end def warn_user_is_not_gitlab diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake index d0e9dfe4..01da919d 100644 --- a/lib/tasks/sidekiq.rake +++ b/lib/tasks/sidekiq.rake @@ -1,17 +1,12 @@ namespace :sidekiq do desc "GITLAB | Stop sidekiq" task :stop do - system "bundle exec sidekiqctl stop #{pidfile}" + run "bundle exec sidekiqctl stop #{pidfile}" end desc "GITLAB | Start sidekiq" task :start do - system "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &" - end - - desc "GITLAB | Start sidekiq with launchd on Mac OS X" - task :launchd do - system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1" + run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &" end def pidfile diff --git a/lib/wiki_to_gollum_migrator.rb b/lib/wiki_to_gollum_migrator.rb deleted file mode 100644 index ed6a1700..00000000 --- a/lib/wiki_to_gollum_migrator.rb +++ /dev/null @@ -1,124 +0,0 @@ -class WikiToGollumMigrator - - attr_reader :projects - - def initialize - @projects = [] - - Project.find_in_batches(batch_size: 50) do |batch| - batch.each { |p| @projects << p if p.wikis.any? } - end - end - - def migrate! - projects.each do |project| - log "\nMigrating Wiki for '#{project.path_with_namespace}'" - wiki = create_gollum_repo(project) - create_pages project, wiki - log "Project '#{project.path_with_namespace}' migrated. " + "[OK]".green - end - end - - def rollback! - log "\nBeginning Wiki Migration Rollback..." - projects.each do |project| - destroy_gollum_repo project - end - log "\nWiki Rollback Complete." - end - - private - - def create_gollum_repo(project) - GollumWiki.new(project, nil).wiki - end - - def destroy_gollum_repo(project) - log " Removing Wiki repo for project: #{project.path_with_namespace}" - path = GollumWiki.new(project, nil).path_with_namespace - if Gitlab::Shell.new.remove_repository(path) - log " Wiki destroyed successfully. " + "[OK}".green - else - log " Problem destroying wiki. Please remove it manually. " + "[FAILED]".red - end - end - - def create_pages(project, wiki) - pages = project.wikis.group(:slug).all - - pages.each do |page| - create_page_and_revisions(project, page) - end - end - - def create_page_and_revisions(project, page) - # Grab all revisions of the page - revisions = project.wikis.where(slug: page.slug).ordered.all - - # Remove the first revision created from the array - # and use it to create the Gollum page. Each successive revision - # will then be applied to the new Gollum page as an update. - first_rev = revisions.pop - - wiki = GollumWiki.new(project, page.user) - wiki_page = WikiPage.new(wiki) - - attributes = extract_attributes_from_page(first_rev, project) - - log " Creating page '#{first_rev.title}'..." - if wiki_page.create(attributes) - log " Created page '#{wiki_page.title}' " + "[OK]".green - - # Reverse the revisions to create them in the correct - # chronological order. - create_revisions(project, wiki_page, revisions.reverse) - else - log " Failed to create page '#{wiki_page.title}' " + "[FAILED]".red - end - end - - def create_revisions(project, page, revisions) - log " Creating revisions..." - revisions.each do |revision| - # Reinitialize a new GollumWiki instance for each page - # and revision created so the correct User is shown in - # the commit message. - wiki = GollumWiki.new(project, revision.user) - wiki_page = wiki.find_page(page.slug) - - attributes = extract_attributes_from_page(revision, project) - - content = attributes[:content] - - if wiki_page.update(content) - log " Created revision " + "[OK]".green - else - log " Failed to create revision " + "[FAILED]".red - end - end - end - - def extract_attributes_from_page(page, project) - attributes = page.attributes - .with_indifferent_access - .slice(:title, :content) - - slug = page.slug - - # Change 'index' pages to 'home' pages to match Gollum standards - if slug.downcase == "index" - attributes[:title] = "home" unless home_already_exists?(project) - end - - attributes - end - - def home_already_exists?(project) - project.wikis.where(slug: 'home').any? || project.wikis.where(slug: 'Home').any? - end - - def log(message) - puts message - end - -end diff --git a/public/deploy.html b/public/deploy.html deleted file mode 100644 index d9c4bb5c..00000000 --- a/public/deploy.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Deploy in progress. Please try again in few minutes - - - -

    Deploy in progress

    -

    Please try again in few minutes or contact your administrator.

    - - diff --git a/public/gitlab_logo.png b/public/gitlab_logo.png deleted file mode 100644 index e3cda597..00000000 Binary files a/public/gitlab_logo.png and /dev/null differ diff --git a/spec/controllers/commit_controller_spec.rb b/spec/controllers/commit_controller_spec.rb index 5fffbf0e..7bf13822 100644 --- a/spec/controllers/commit_controller_spec.rb +++ b/spec/controllers/commit_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe CommitController do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:user) { create(:user) } let(:commit) { project.repository.last_commit_for("master") } diff --git a/spec/controllers/commits_controller_spec.rb b/spec/controllers/commits_controller_spec.rb index ce402917..1d5d99df 100644 --- a/spec/controllers/commits_controller_spec.rb +++ b/spec/controllers/commits_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe CommitsController do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:user) { create(:user) } before do @@ -13,7 +13,7 @@ describe CommitsController do describe "GET show" do context "as atom feed" do it "should render as atom" do - get :show, project_id: project.path, id: "master", format: "atom" + get :show, project_id: project.path, id: "master.atom" response.should be_success response.content_type.should == 'application/atom+xml' end diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb index e8dd9bf9..37e36efc 100644 --- a/spec/controllers/merge_requests_controller_spec.rb +++ b/spec/controllers/merge_requests_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe MergeRequestsController do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:user) { create(:user) } let(:merge_request) { create(:merge_request_with_diffs, project: project, target_branch: "bcf03b5d~3", source_branch: "bcf03b5d") } diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb index 8232f147..81c7656d 100644 --- a/spec/controllers/tree_controller_spec.rb +++ b/spec/controllers/tree_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe TreeController do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:user) { create(:user) } before do diff --git a/spec/factories.rb b/spec/factories.rb index 3205cabd..593b8350 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -12,7 +12,7 @@ FactoryGirl.define do factory :user, aliases: [:author, :assignee, :owner, :creator] do email { Faker::Internet.email } name - sequence(:username) { |n| "#{Faker::Internet.user_name}#{n}" } + username { Faker::Internet.user_name } password "123456" password_confirmation { password } @@ -29,15 +29,6 @@ FactoryGirl.define do creator end - factory :redmine_project, parent: :project do - issues_tracker { "redmine" } - issues_tracker_id { "project_name_in_redmine" } - end - - factory :project_with_code, parent: :project do - path { 'gitlabhq' } - end - factory :group do sequence(:name) { |n| "group#{n}" } path { name.downcase.gsub(/\s/, '_') } @@ -63,48 +54,38 @@ FactoryGirl.define do project trait :closed do - state :closed - end - - trait :reopened do - state :reopened + closed true end factory :closed_issue, traits: [:closed] - factory :reopened_issue, traits: [:reopened] end factory :merge_request do title author - project factory: :project_with_code + project source_branch "master" target_branch "stable" + trait :closed do + closed true + end + # pick 3 commits "at random" (from bcf03b5d~3 to bcf03b5d) trait :with_diffs do target_branch "master" # pretend bcf03b5d~3 source_branch "stable" # pretend bcf03b5d st_commits do - [Commit.new(project.repository.commit('bcf03b5d')), - Commit.new(project.repository.commit('bcf03b5d~1')), - Commit.new(project.repository.commit('bcf03b5d~2'))] + [Commit.new(project.repo.commit('bcf03b5d')), + Commit.new(project.repo.commit('bcf03b5d~1')), + Commit.new(project.repo.commit('bcf03b5d~2'))] end st_diffs do project.repo.diff("bcf03b5d~3", "bcf03b5d") end end - trait :closed do - state :closed - end - - trait :reopened do - state :reopened - end - factory :closed_merge_request, traits: [:closed] - factory :reopened_merge_request, traits: [:reopened] factory :merge_request_with_diffs, traits: [:with_diffs] end @@ -120,7 +101,6 @@ FactoryGirl.define do factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff] trait :on_commit do - project factory: :project_with_code commit_id "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" noteable_type "Commit" end @@ -130,7 +110,6 @@ FactoryGirl.define do end trait :on_merge_request do - project factory: :project_with_code noteable_id 1 noteable_type "MergeRequest" end @@ -144,7 +123,7 @@ FactoryGirl.define do factory :event do factory :closed_issue_event do project - action { Event::CLOSED } + action Event::Closed target factory: :closed_issue author factory: :user end @@ -169,23 +148,11 @@ FactoryGirl.define do "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=" end end - - factory :invalid_key do - key do - "ssh-rsa this_is_invalid_key==" - end - end end factory :milestone do title project - - trait :closed do - state :closed - end - - factory :closed_milestone, traits: [:closed] end factory :system_hook do diff --git a/spec/factories/user_team_project_relationships.rb b/spec/factories/user_team_project_relationships.rb deleted file mode 100644 index e900d86c..00000000 --- a/spec/factories/user_team_project_relationships.rb +++ /dev/null @@ -1,21 +0,0 @@ -# == Schema Information -# -# Table name: user_team_project_relationships -# -# id :integer not null, primary key -# project_id :integer -# user_team_id :integer -# greatest_access :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -# Read about factories at https://github.com/thoughtbot/factory_girl - -FactoryGirl.define do - factory :user_team_project_relationship do - project - user_team - greatest_access { UsersProject::MASTER } - end -end diff --git a/spec/factories/user_team_user_relationships.rb b/spec/factories/user_team_user_relationships.rb deleted file mode 100644 index 8c729dd8..00000000 --- a/spec/factories/user_team_user_relationships.rb +++ /dev/null @@ -1,23 +0,0 @@ -# == Schema Information -# -# Table name: user_team_user_relationships -# -# id :integer not null, primary key -# user_id :integer -# user_team_id :integer -# group_admin :boolean -# permission :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -# Read about factories at https://github.com/thoughtbot/factory_girl - -FactoryGirl.define do - factory :user_team_user_relationship do - user - user_team - group_admin false - permission { UsersProject::MASTER } - end -end diff --git a/spec/factories/user_teams.rb b/spec/factories/user_teams.rb deleted file mode 100644 index 3aeea40a..00000000 --- a/spec/factories/user_teams.rb +++ /dev/null @@ -1,23 +0,0 @@ -# == Schema Information -# -# Table name: user_teams -# -# id :integer not null, primary key -# name :string(255) -# path :string(255) -# owner_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# description :string(255) default(""), not null -# - -# Read about factories at https://github.com/thoughtbot/factory_girl - -FactoryGirl.define do - factory :user_team do - sequence(:name) { |n| "team#{n}" } - sequence(:description) { |n| "team_description#{n}" } - path { name.downcase.gsub(/\s/, '_') } - owner - end -end diff --git a/spec/factories_spec.rb b/spec/factories_spec.rb index 8360477d..5ee73546 100644 --- a/spec/factories_spec.rb +++ b/spec/factories_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' -INVALID_FACTORIES = [ - :key_with_a_space_in_the_middle, - :invalid_key, -] +INVALID_FACTORIES = [:key_with_a_space_in_the_middle] FactoryGirl.factories.map(&:name).each do |factory_name| next if INVALID_FACTORIES.include?(factory_name) diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb deleted file mode 100644 index 23370891..00000000 --- a/spec/features/admin/admin_projects_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'spec_helper' - -describe "Admin::Projects" do - before do - @project = create(:project) - login_as :admin - end - - describe "GET /admin/projects" do - before do - visit admin_projects_path - end - - it "should be ok" do - current_path.should == admin_projects_path - end - - it "should have projects list" do - page.should have_content(@project.name) - end - end - - describe "GET /admin/projects/:id" do - before do - visit admin_projects_path - click_link "#{@project.name}" - end - - it "should have project info" do - page.should have_content(@project.path) - page.should have_content(@project.name) - end - end -end diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb deleted file mode 100644 index 51b95c25..00000000 --- a/spec/features/profile_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'spec_helper' - -describe "Profile account page" do - let(:user) { create(:user) } - - before do - login_as :user - end - - describe "when signup is enabled" do - before do - Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) - visit account_profile_path - end - - it { page.should have_content("Remove account") } - - it "should delete the account", js: true do - expect { click_link "Delete account" }.to change {User.count}.by(-1) - current_path.should == new_user_session_path - end - end - - describe "when signup is enabled and user has a project" do - before do - Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) - @project = create(:project, namespace: @user.namespace) - @project.team << [@user, :master] - visit account_profile_path - end - it { page.should have_content("Remove account") } - - it "should not allow user to delete the account" do - expect { click_link "Delete account" }.not_to change {User.count}.by(-1) - end - end - - describe "when signup is disabled" do - before do - Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) - visit account_profile_path - end - - it "should not have option to remove account" do - page.should_not have_content("Remove account") - current_path.should == account_profile_path - end - end -end diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb deleted file mode 100644 index ed9e44fb..00000000 --- a/spec/features/users_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe 'Users' do - describe "GET /users/sign_up" do - before do - Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) - end - - it "should create a new user account" do - visit new_user_registration_path - fill_in "user_name", with: "Name Surname" - fill_in "user_username", with: "Great" - fill_in "user_email", with: "name@mail.com" - fill_in "user_password", with: "password1234" - fill_in "user_password_confirmation", with: "password1234" - expect { click_button "Sign up" }.to change {User.count}.by(1) - end - end -end diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 4140ba48..1b067972 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -2,12 +2,11 @@ require "spec_helper" describe GitlabMarkdownHelper do include ApplicationHelper - include IssuesHelper - let!(:project) { create(:project_with_code) } + let!(:project) { create(:project) } let(:user) { create(:user, username: 'gfm') } - let(:commit) { project.repository.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 +84,7 @@ describe GitlabMarkdownHelper do describe "referencing a team member" do let(:actual) { "@#{user.username} you are right." } - let(:expected) { user_path(user) } + let(:expected) { project_team_member_path(project, member) } before do project.team << [user, :master] @@ -363,28 +362,4 @@ describe GitlabMarkdownHelper do markdown(":smile:").should include("src=\"#{url_to_image("emoji/smile")}") end end - - describe "#render_wiki_content" do - before do - @wiki = stub('WikiPage') - @wiki.stub(:content).and_return('wiki content') - end - - it "should use Gitlab Flavored Markdown for markdown files" do - @wiki.stub(:format).and_return(:markdown) - - helper.should_receive(:markdown).with('wiki content') - - helper.render_wiki_content(@wiki) - end - - it "should use the Gollum renderer for all other file types" do - @wiki.stub(:format).and_return(:rdoc) - formatted_content_stub = stub('formatted_content') - formatted_content_stub.should_receive(:html_safe) - @wiki.stub(:formatted_content).and_return(formatted_content_stub) - - helper.render_wiki_content(@wiki) - end - end end diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb deleted file mode 100644 index a1f23073..00000000 --- a/spec/helpers/issues_helper_spec.rb +++ /dev/null @@ -1,106 +0,0 @@ -require "spec_helper" - -describe IssuesHelper do - let(:project) { create :project } - let(:issue) { create :issue, project: project } - let(:ext_project) { create :redmine_project } - - describe :title_for_issue do - it "should return issue title if used internal tracker" do - @project = project - title_for_issue(issue.id).should eq issue.title - end - - it "should always return empty string if used external tracker" do - @project = ext_project - title_for_issue(rand(100)).should eq "" - end - - it "should always return empty string if project nil" do - @project = nil - - title_for_issue(rand(100)).should eq "" - end - end - - describe :url_for_project_issues do - let(:project_url) { Gitlab.config.issues_tracker.redmine.project_url} - let(:ext_expected) do - project_url.gsub(':project_id', ext_project.id.to_s) - .gsub(':issues_tracker_id', ext_project.issues_tracker_id.to_s) - end - let(:int_expected) { polymorphic_path([project]) } - - it "should return internal path if used internal tracker" do - @project = project - url_for_project_issues.should match(int_expected) - end - - it "should return path to external tracker" do - @project = ext_project - - url_for_project_issues.should match(ext_expected) - end - - it "should return empty string if project nil" do - @project = nil - - url_for_project_issues.should eq "" - end - end - - describe :url_for_issue do - let(:issue_id) { 3 } - let(:issues_url) { Gitlab.config.issues_tracker.redmine.issues_url} - let(:ext_expected) do - issues_url.gsub(':id', issue_id.to_s) - .gsub(':project_id', ext_project.id.to_s) - .gsub(':issues_tracker_id', ext_project.issues_tracker_id.to_s) - end - let(:int_expected) { polymorphic_path([project, issue]) } - - it "should return internal path if used internal tracker" do - @project = project - url_for_issue(issue.id).should match(int_expected) - end - - it "should return path to external tracker" do - @project = ext_project - - url_for_issue(issue_id).should match(ext_expected) - end - - it "should return empty string if project nil" do - @project = nil - - url_for_issue(issue.id).should eq "" - end - end - - describe :url_for_new_issue do - let(:issues_url) { Gitlab.config.issues_tracker.redmine.new_issue_url} - let(:ext_expected) do - issues_url.gsub(':project_id', ext_project.id.to_s) - .gsub(':issues_tracker_id', ext_project.issues_tracker_id.to_s) - end - let(:int_expected) { new_project_issue_path(project) } - - it "should return internal path if used internal tracker" do - @project = project - url_for_new_issue.should match(int_expected) - end - - it "should return path to external tracker" do - @project = ext_project - - url_for_new_issue.should match(ext_expected) - end - - it "should return empty string if project nil" do - @project = nil - - url_for_new_issue.should eq "" - end - end - -end diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb deleted file mode 100644 index f97959ee..00000000 --- a/spec/helpers/notifications_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the NotificationsHelper. For example: -# -# describe NotificationsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe NotificationsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb index aac72c63..deb6499e 100644 --- a/spec/lib/extracts_path_spec.rb +++ b/spec/lib/extracts_path_spec.rb @@ -54,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/git/commit_spec.rb b/spec/lib/git/commit_spec.rb deleted file mode 100644 index 475bc359..00000000 --- a/spec/lib/git/commit_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -require "spec_helper" - -describe Gitlab::Git::Commit do - let(:commit) { create(:project_with_code).repository.commit } - - 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 = Gitlab::Git::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 { Gitlab::Git::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) } - end -end diff --git a/spec/lib/gitolite_config_spec.rb b/spec/lib/gitolite_config_spec.rb new file mode 100644 index 00000000..c3ce0db5 --- /dev/null +++ b/spec/lib/gitolite_config_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe Gitlab::GitoliteConfig do + let(:gitolite) { Gitlab::GitoliteConfig.new } + + it { should respond_to :write_key } + it { should respond_to :rm_key } + it { should respond_to :update_project } + it { should respond_to :update_project! } + it { should respond_to :update_projects } + it { should respond_to :destroy_project } + it { should respond_to :destroy_project! } + it { should respond_to :apply } + it { should respond_to :admin_all_repo } + it { should respond_to :admin_all_repo! } +end diff --git a/spec/lib/gitolite_spec.rb b/spec/lib/gitolite_spec.rb new file mode 100644 index 00000000..8075b99e --- /dev/null +++ b/spec/lib/gitolite_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe Gitlab::Gitolite do + let(:project) { double('Project', path: 'diaspora') } + let(:gitolite_config) { double('Gitlab::GitoliteConfig') } + let(:gitolite) { Gitlab::Gitolite.new } + + before do + gitolite.stub(config: gitolite_config) + end + + it { should respond_to :set_key } + it { should respond_to :remove_key } + + it { should respond_to :update_repository } + it { should respond_to :create_repository } + it { should respond_to :remove_repository } + + it { gitolite.url_to_repo('diaspora').should == Gitlab.config.gitolite.ssh_path_prefix + "diaspora.git" } + + it "should call config update" do + gitolite_config.should_receive(:update_project!) + gitolite.update_repository project + end +end diff --git a/spec/lib/popen_spec.rb b/spec/lib/popen_spec.rb deleted file mode 100644 index 4791be41..00000000 --- a/spec/lib/popen_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe 'Gitlab::Popen', no_db: true do - let (:path) { Rails.root.join('tmp').to_s } - - before do - @klass = Class.new(Object) - @klass.send(:include, Gitlab::Popen) - end - - context 'zero status' do - before do - @output, @status = @klass.new.popen('ls', path) - end - - it { @status.should be_zero } - it { @output.should include('cache') } - end - - context 'non-zero status' do - before do - @output, @status = @klass.new.popen('cat NOTHING', path) - end - - it { @status.should == 1 } - it { @output.should include('No such file or directory') } - end -end - diff --git a/spec/lib/project_mover_spec.rb b/spec/lib/project_mover_spec.rb new file mode 100644 index 00000000..28323b24 --- /dev/null +++ b/spec/lib/project_mover_spec.rb @@ -0,0 +1,66 @@ +require 'spec_helper' + +describe Gitlab::ProjectMover do + let(:base_path) { Rails.root.join('tmp', 'rspec-sandbox') } + + 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) + + @project = create(:project) + end + + after do + FileUtils.rm_rf base_path + end + + it "should move project to subdir" do + mk_dir base_path, '', @project.path + mover = Gitlab::ProjectMover.new(@project, '', 'opensource') + + mover.execute.should be_true + moved?('opensource', @project.path).should be_true + end + + it "should move project from one subdir to another" do + mk_dir base_path, 'vsizov', @project.path + mover = Gitlab::ProjectMover.new(@project, 'vsizov', 'randx') + + mover.execute.should be_true + moved?('randx', @project.path).should be_true + end + + it "should move project from subdir to base" do + mk_dir base_path, 'vsizov', @project.path + mover = Gitlab::ProjectMover.new(@project, 'vsizov', '') + + mover.execute.should be_true + moved?('', @project.path).should be_true + end + + it "should raise if destination exists" do + mk_dir base_path, '', @project.path + mk_dir base_path, 'vsizov', @project.path + mover = Gitlab::ProjectMover.new(@project, 'vsizov', '') + + expect { mover.execute }.to raise_error(Gitlab::ProjectMover::ProjectMoveError) + end + + it "should raise if move failed" do + mk_dir base_path + mover = Gitlab::ProjectMover.new(@project, 'vsizov', '') + + expect { mover.execute }.to raise_error(Gitlab::ProjectMover::ProjectMoveError) + end + + + def mk_dir base_path, namespace = '', project_path = '' + FileUtils.mkdir_p File.join(base_path, namespace, project_path + ".git") + end + + def moved? namespace, path + File.exists?(File.join(base_path, namespace, path + '.git')) + end +end diff --git a/spec/lib/shell_spec.rb b/spec/lib/shell_spec.rb deleted file mode 100644 index 3c04f4bb..00000000 --- a/spec/lib/shell_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Shell do - let(:project) { double('Project', id: 7, path: 'diaspora') } - let(:gitlab_shell) { Gitlab::Shell.new } - - before do - Project.stub(find: project) - end - - it { should respond_to :add_key } - it { should respond_to :remove_key } - it { should respond_to :add_repository } - it { should respond_to :remove_repository } - - it { gitlab_shell.url_to_repo('diaspora').should == Gitlab.config.gitlab_shell.ssh_path_prefix + "diaspora.git" } -end diff --git a/spec/lib/wiki_to_gollum_migrator_spec.rb b/spec/lib/wiki_to_gollum_migrator_spec.rb deleted file mode 100644 index f9b9c78e..00000000 --- a/spec/lib/wiki_to_gollum_migrator_spec.rb +++ /dev/null @@ -1,219 +0,0 @@ -require "spec_helper" - -describe WikiToGollumMigrator do - - def create_wiki_for(project) - 3.times { @pages[project.id] << create_page(project) } - end - - def create_revisions_for(project) - @pages[project.id].each do |page| - create_revision(page) - end - end - - def create_page(project) - page = project.wikis.new(title: "Page #{rand(1000)}", content: "Content") - page.user = project.owner - page.slug = page.title.parameterize - page.save! - page - end - - def create_revision(page) - revision = page.dup - revision.content = "Updated Content" - revision.save! - end - - def create_temp_repo(path) - FileUtils.mkdir_p path - command = "git init --quiet --bare #{path};" - system(command) - end - - before do - @repo_path = "#{Rails.root}/tmp/test-git-base-path" - @projects = [] - @pages = Hash.new {|h,k| h[k] = Array.new } - - @projects << create(:project) - @projects << create(:project) - - @projects.each do |project| - create_wiki_for project - create_revisions_for project - end - - @project_without_wiki = create(:project) - end - - context "Before the migration" do - it "has two projects with valid wikis" do - @projects.each do |project| - pages = project.wikis.group(:slug).all - pages.count.should == 3 - end - end - - it "has two revision for each page" do - @projects.each do |project| - @pages[project.id].each do |page| - revisions = project.wikis.where(slug: page.slug) - revisions.count.should == 2 - end - end - end - end - - describe "#initialize" do - it "finds all projects that have existing wiki pages" do - Project.count.should == 3 - subject.projects.count.should == 2 - end - end - - context "#migrate!" do - before do - Gitlab::Shell.any_instance.stub(:add_repository) do |path| - create_temp_repo("#{@repo_path}/#{path}.git") - end - - subject.stub(:log).as_null_object - - subject.migrate! - end - - it "creates a new Gollum Wiki for each project" do - @projects.each do |project| - wiki_path = project.path_with_namespace + ".wiki.git" - full_path = @repo_path + "/" + wiki_path - File.exist?(full_path).should be_true - File.directory?(full_path).should be_true - end - end - - it "creates a gollum page for each unique Wiki page" do - @projects.each do |project| - wiki = GollumWiki.new(project, nil) - wiki.pages.count.should == 3 - end - end - - it "creates a new revision for each old revision of the page" do - @projects.each do |project| - wiki = GollumWiki.new(project, nil) - wiki.pages.each do |page| - page.versions.count.should == 2 - end - end - end - - context "wikis with pages that have titles that do not match the slugs" do - before do - project = @projects.last - @page = project.wikis.new(title: "test page", content: "Invalid Page") - @page.slug = "totally-incorrect-slug" - @page.user = project.owner - @page.save! - - create_revision(@page) - - subject.rollback! - subject.migrate! - end - - it "has a page with a title differing the slug" do - @page.slug.should_not == @page.title.parameterize - end - - it "creates a new revision for each old revision of the page" do - @projects.each do |project| - wiki = GollumWiki.new(project, nil) - wiki.pages.each do |page| - page.versions.count.should == 2 - end - end - end - end - - context "changing wiki title from index to home" do - before do - @project = @projects.last - @page = @project.wikis.new(title: "Index", content: "Home Page") - @page.slug = "index" - @page.user = @project.owner - @page.save! - - create_revision(@page) - - subject.rollback! - end - - it "creates a page called Home" do - subject.migrate! - wiki = GollumWiki.new(@project, nil) - page = wiki.find_page("home") - page.should be_present - end - - context "when a page called Home already exists" do - before do - @index_page = @project.wikis.new(title: "Index", content: "Index Page") - @index_page.slug = "index" - @index_page.user = @project.owner - @index_page.save! - - create_revision(@index_page) - - @home_page = @project.wikis.new(title: "Home", content: "Home Page") - @home_page.slug = "home" - @home_page.user = @project.owner - @home_page.save! - - create_revision(@home_page) - subject.migrate! - end - - it "creates the index page" do - wiki = GollumWiki.new(@project, nil) - page = wiki.find_page("index") - page.should be_present - end - - it "creates the home page" do - wiki = GollumWiki.new(@project, nil) - page = wiki.find_page("home") - page.should be_present - end - end - end - end - - context "#rollback!" do - before do - Gitlab::Shell.any_instance.stub(:add_repository) do |path| - create_temp_repo("#{@repo_path}/#{path}.git") - end - - Gitlab::Shell.any_instance.stub(:remove_repository) do |path| - FileUtils.rm_rf "#{@repo_path}/#{path}.git" - end - - subject.stub(:log).as_null_object - - subject.migrate! - subject.rollback! - end - - it "destroys all of the wiki repositories that were created during migrate!" do - @projects.each do |project| - wiki_path = project.path_with_namespace + ".wiki.git" - full_path = @repo_path + "/" + wiki_path - File.exist?(full_path).should be_false - end - end - end - - -end diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 84ce7e86..d947f0e2 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -5,7 +5,7 @@ describe Notify do include EmailSpec::Matchers let(:recipient) { create(:user, email: 'recipient@example.com') } - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } shared_examples 'a multiple recipients email' do it 'is sent to the given recipient' do @@ -70,28 +70,6 @@ describe Notify do end end - describe 'user added ssh key' do - let(:key) { create(:personal_key) } - - subject { Notify.new_ssh_key_email(key.id) } - - it 'is sent to the new user' do - should deliver_to key.user.email - end - - it 'has the correct subject' do - should have_subject /^gitlab \| SSH key was added to your account$/i - end - - it 'contains the new ssh key title' do - should have_body_text /#{key.title}/ - end - - it 'includes a link to ssh keys page' do - should have_body_text /#{keys_path}/ - end - end - context 'for a project' do describe 'items that are assignable, the email' do let(:assignee) { create(:user, email: 'assignee@example.com') } @@ -107,7 +85,7 @@ describe Notify do let(:issue) { create(:issue, assignee: assignee, project: project ) } describe 'that are new' do - subject { Notify.new_issue_email(issue.assignee_id, issue.id) } + subject { Notify.new_issue_email(issue.id) } it_behaves_like 'an assignee email' @@ -172,7 +150,7 @@ describe Notify do let(:merge_request) { create(:merge_request, assignee: assignee, project: project) } describe 'that are new' do - subject { Notify.new_merge_request_email(merge_request.assignee_id, merge_request.id) } + subject { Notify.new_merge_request_email(merge_request.id) } it_behaves_like 'an assignee email' @@ -261,7 +239,7 @@ describe Notify do end describe 'on a project wall' do - let(:note_on_the_wall_path) { project_wall_path(project, anchor: "note_#{note.id}") } + let(:note_on_the_wall_path) { wall_project_path(project, anchor: "note_#{note.id}") } subject { Notify.note_wall_email(recipient.id, note.id) } @@ -277,11 +255,18 @@ describe Notify do end describe 'on a commit' do - let(:commit) { project.repository.commit } + let(:commit) do + mock(:commit).tap do |commit| + commit.stub(:id).and_return('fauxsha1') + commit.stub(:project).and_return(project) + commit.stub(:short_id).and_return('fauxsha1') + commit.stub(:safe_message).and_return('some message') + end + end before(:each) { note.stub(:noteable).and_return(commit) } - subject { Notify.note_commit_email(recipient.id, note.id) } + subject { Notify.note_commit_email(recipient.email, note.id) } it_behaves_like 'a note email' @@ -290,7 +275,7 @@ describe Notify do end it 'contains a link to the commit' do - should have_body_text commit.short_id + should have_body_text /fauxsha1/ end end diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 6cf777be..91301029 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -1,35 +1,83 @@ require 'spec_helper' describe Commit do - let(:commit) { create(:project_with_code).repository.commit } + let(:commit) { create(:project).repository.commit } + describe CommitDecorator do + let(:decorator) { CommitDecorator.new(commit) } - describe '#title' do - it "returns no_commit_message when safe_message is blank" do - commit.stub(:safe_message).and_return('') - commit.title.should == "--no commit message" + describe '#title' do + it "returns no_commit_message when safe_message is blank" do + decorator.stub(:safe_message).and_return('') + decorator.title.should == "--no commit message" + end + + it "truncates a message without a newline at 70 characters" do + message = commit.safe_message * 10 + + decorator.stub(:safe_message).and_return(message) + decorator.title.should == "#{message[0..69]}…" + end + + it "truncates a message with a newline before 80 characters at the newline" do + message = commit.safe_message.split(" ").first + + decorator.stub(:safe_message).and_return(message + "\n" + message) + decorator.title.should == message + end + + it "truncates a message with a newline after 80 characters at 70 characters" do + message = (commit.safe_message * 10) + "\n" + + decorator.stub(:safe_message).and_return(message) + decorator.title.should == "#{message[0..69]}…" + 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 "truncates a message without a newline at 70 characters" do - message = commit.safe_message * 10 + 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 - commit.stub(:safe_message).and_return(message) - commit.title.should == "#{message[0..69]}…" - end + describe "Class methods" do + subject { Commit } - it "truncates a message with a newline before 80 characters at the newline" do - message = commit.safe_message.split(" ").first - - commit.stub(:safe_message).and_return(message + "\n" + message) - commit.title.should == message - end - - it "truncates a message with a newline after 80 characters at 70 characters" do - message = (commit.safe_message * 10) + "\n" - - commit.stub(:safe_message).and_return(message) - commit.title.should == "#{message[0..69]}…" - end + 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 diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb index 551e1753..b5d4bd7b 100644 --- a/spec/models/concerns/issuable_spec.rb +++ b/spec/models/concerns/issuable_spec.rb @@ -15,6 +15,7 @@ describe Issue, "Issuable" do it { should validate_presence_of(:author) } it { should validate_presence_of(:title) } it { should ensure_length_of(:title).is_at_least(0).is_at_most(255) } + it { should ensure_inclusion_of(:closed).in_array([true, false]) } end describe "Scope" do diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 85bdf08a..82b46b68 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -52,7 +52,7 @@ describe Event do @event = Event.create( project: project, - action: Event::PUSHED, + action: Event::Pushed, data: data, author_id: @user.id ) @@ -72,7 +72,6 @@ describe Event do before { Event.should_receive :create - observer.stub(notification: stub.as_null_object) } describe "Joined project team" do diff --git a/spec/models/gollum_wiki_spec.rb b/spec/models/gollum_wiki_spec.rb deleted file mode 100644 index aa850dfd..00000000 --- a/spec/models/gollum_wiki_spec.rb +++ /dev/null @@ -1,196 +0,0 @@ -require "spec_helper" - -describe GollumWiki do - - def create_temp_repo(path) - FileUtils.mkdir_p path - command = "git init --quiet #{path};" - system(command) - end - - def remove_temp_repo(path) - FileUtils.rm_rf path - end - - def commit_details - commit = {name: user.name, email: user.email, message: "test commit"} - end - - def create_page(name, content) - subject.wiki.write_page(name, :markdown, content, commit_details) - end - - def destroy_page(page) - subject.wiki.delete_page(page, commit_details) - end - - let(:project) { create(:project) } - let(:repository) { project.repository } - let(:user) { project.owner } - let(:gitlab_shell) { Gitlab::Shell.new } - - subject { GollumWiki.new(project, user) } - - before do - create_temp_repo(subject.send(:path_to_repo)) - end - - describe "#path_with_namespace" do - it "returns the project path with namespace with the .wiki extension" do - subject.path_with_namespace.should == project.path_with_namespace + ".wiki" - end - end - - describe "#url_to_repo" do - it "returns the correct ssh url to the repo" do - subject.url_to_repo.should == gitlab_shell.url_to_repo(subject.path_with_namespace) - end - end - - describe "#ssh_url_to_repo" do - it "equals #url_to_repo" do - subject.ssh_url_to_repo.should == subject.url_to_repo - end - end - - describe "#http_url_to_repo" do - it "provides the full http url to the repo" do - gitlab_url = Gitlab.config.gitlab.url - repo_http_url = "#{gitlab_url}/#{subject.path_with_namespace}.git" - subject.http_url_to_repo.should == repo_http_url - end - end - - describe "#wiki" do - it "contains a Gollum::Wiki instance" do - subject.wiki.should be_a Gollum::Wiki - end - - before do - Gitlab::Shell.any_instance.stub(:add_repository) do - create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git") - end - project.stub(:path_with_namespace).and_return("non-existant") - end - - it "creates a new wiki repo if one does not yet exist" do - wiki = GollumWiki.new(project, user) - wiki.create_page("index", "test content").should_not == false - - FileUtils.rm_rf wiki.send(:path_to_repo) - end - - it "raises CouldNotCreateWikiError if it can't create the wiki repository" do - GollumWiki.any_instance.stub(:init_repo).and_return(false) - expect { GollumWiki.new(project, user).wiki }.to raise_exception(GollumWiki::CouldNotCreateWikiError) - end - end - - describe "#pages" do - before do - create_page("index", "This is an awesome new Gollum Wiki") - @pages = subject.pages - end - - after do - destroy_page(@pages.first.page) - end - - it "returns an array of WikiPage instances" do - @pages.first.should be_a WikiPage - end - - it "returns the correct number of pages" do - @pages.count.should == 1 - end - end - - describe "#find_page" do - before do - create_page("index page", "This is an awesome Gollum Wiki") - end - - after do - destroy_page(subject.pages.first.page) - end - - it "returns the latest version of the page if it exists" do - page = subject.find_page("index page") - page.title.should == "index page" - end - - it "returns nil if the page does not exist" do - subject.find_page("non-existant").should == nil - end - - it "can find a page by slug" do - page = subject.find_page("index-page") - page.title.should == "index page" - end - - it "returns a WikiPage instance" do - page = subject.find_page("index page") - page.should be_a WikiPage - end - end - - describe "#create_page" do - after do - destroy_page(subject.pages.first.page) - end - - it "creates a new wiki page" do - subject.create_page("test page", "this is content").should_not == false - subject.pages.count.should == 1 - end - - it "returns false when a duplicate page exists" do - subject.create_page("test page", "content") - subject.create_page("test page", "content").should == false - end - - it "stores an error message when a duplicate page exists" do - 2.times { subject.create_page("test page", "content") } - subject.error_message.should =~ /Duplicate page:/ - end - - it "sets the correct commit message" do - subject.create_page("test page", "some content", :markdown, "commit message") - subject.pages.first.page.version.message.should == "commit message" - end - end - - describe "#update_page" do - before do - create_page("update-page", "some content") - @gollum_page = subject.wiki.paged("update-page") - subject.update_page(@gollum_page, "some other content", :markdown, "updated page") - @page = subject.pages.first.page - end - - after do - destroy_page(@page) - end - - it "updates the content of the page" do - @page.raw_data.should == "some other content" - end - - it "sets the correct commit message" do - @page.version.message.should == "updated page" - end - end - - describe "#delete_page" do - before do - create_page("index", "some content") - @page = subject.wiki.paged("index") - end - - it "deletes the page" do - subject.delete_page(@page) - subject.pages.count.should == 0 - end - end - -end diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 5d4674e3..108bc303 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -2,14 +2,13 @@ # # 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) -# description :string(255) default(""), not null +# 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) # require 'spec_helper' diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 1bc794dc..0816b3ee 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -9,11 +9,11 @@ # 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 -# state :string(255) # require 'spec_helper' @@ -28,6 +28,10 @@ describe Issue do it { should_not allow_mass_assignment_of(:project_id) } end + describe "Validation" do + it { should ensure_length_of(:description).is_within(0..10000) } + end + describe 'modules' do it { should include_module(Issuable) } end @@ -44,15 +48,34 @@ describe Issue do end end - describe '#is_being_reassigned?' do - it 'returnes issues assigned to user' do - user = create :user + describe '#is_being_closed?' do + it 'returns true if the closed attribute has changed and is now true' do + subject.closed = true + subject.is_being_closed?.should be_true + end + it 'returns false if the closed attribute has changed and is now false' do + issue = create(:closed_issue) + issue.closed = false + issue.is_being_closed?.should be_false + end + it 'returns false if the closed attribute has not changed' do + subject.is_being_closed?.should be_false + end + end - 2.times do - issue = create :issue, assignee: user - end - Issue.open_for(user).count.should eq 2 + describe '#is_being_reopened?' do + it 'returns true if the closed attribute has changed and is now false' do + issue = create(:closed_issue) + issue.closed = false + issue.is_being_reopened?.should be_true + end + it 'returns false if the closed attribute has changed and is now true' do + subject.closed = true + subject.is_being_reopened?.should be_false + end + it 'returns false if the closed attribute has not changed' do + subject.is_being_reopened?.should be_false end end end diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index a9ab2f05..6d2310df 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -46,9 +46,9 @@ describe Key do key.should_not be_valid end - it "does not accept the same key for another project" do + it "does accept the same key for another project" do key = build(:key, project_id: 0) - key.should_not be_valid + key.should be_valid end end @@ -73,12 +73,8 @@ describe Key do build(:key, user: user).should be_valid end - it "rejects the unfingerprintable key (contains space in middle)" do + it "rejects the unfingerprintable key" do build(:key_with_a_space_in_the_middle).should_not be_valid end - - it "rejects the unfingerprintable key (not a key)" do - build(:invalid_key).should_not be_valid - end end end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index c64c053b..41f4ede5 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -9,13 +9,14 @@ # 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 -# state :string(255) -# merge_status :string(255) # require 'spec_helper' @@ -31,20 +32,10 @@ describe MergeRequest do it { should_not allow_mass_assignment_of(:project_id) } end - describe "Respond to" do - it { should respond_to(:unchecked?) } - it { should respond_to(:can_be_merged?) } - it { should respond_to(:cannot_be_merged?) } - end - describe 'modules' do it { should include_module(Issuable) } end - describe "#mr_and_commit_notes" do - - end - describe "#mr_and_commit_notes" do let!(:merge_request) { create(:merge_request) } @@ -71,4 +62,35 @@ describe MergeRequest do subject.is_being_reassigned?.should be_false end end + + describe '#is_being_closed?' do + it 'returns true if the closed attribute has changed and is now true' do + subject.closed = true + subject.is_being_closed?.should be_true + end + it 'returns false if the closed attribute has changed and is now false' do + merge_request = create(:closed_merge_request) + merge_request.closed = false + merge_request.is_being_closed?.should be_false + end + it 'returns false if the closed attribute has not changed' do + subject.is_being_closed?.should be_false + end + end + + + describe '#is_being_reopened?' do + it 'returns true if the closed attribute has changed and is now false' do + merge_request = create(:closed_merge_request) + merge_request.closed = false + merge_request.is_being_reopened?.should be_true + end + it 'returns false if the closed attribute has changed and is now true' do + subject.closed = true + subject.is_being_reopened?.should be_false + end + it 'returns false if the closed attribute has not changed' do + subject.is_being_reopened?.should be_false + end + end end diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index f74fea01..2ea2c56a 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -7,9 +7,9 @@ # 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 -# state :string(255) # require 'spec_helper' @@ -27,6 +27,7 @@ describe Milestone do describe "Validation" do it { should validate_presence_of(:title) } it { should validate_presence_of(:project) } + it { should ensure_inclusion_of(:closed).in_array([true, false]) } end let(:milestone) { create(:milestone) } @@ -40,7 +41,7 @@ describe Milestone do it "should count closed issues" do IssueObserver.current_user = issue.author - issue.close + issue.update_attributes(closed: true) milestone.issues << issue milestone.percent_complete.should == 100 end @@ -95,7 +96,7 @@ describe Milestone do describe :items_count do before do milestone.issues << create(:issue) - milestone.issues << create(:closed_issue) + milestone.issues << create(:issue, closed: true) milestone.merge_requests << create(:merge_request) end @@ -109,35 +110,7 @@ describe Milestone do it { milestone.can_be_closed?.should be_true } end - describe :is_empty? do - before do - issue = create :closed_issue, milestone: milestone - merge_request = create :merge_request, milestone: milestone - end - - it 'Should return total count of issues and merge requests assigned to milestone' do - milestone.total_items_count.should eq 2 - end + describe :open? do + it { milestone.open?.should be_true } end - - describe :can_be_closed? do - before do - milestone = create :milestone - create :closed_issue, milestone: milestone - - issue = create :issue - end - - it 'should be true if milestone active and all nestied issues closed' do - milestone.can_be_closed?.should be_true - end - - it 'should be false if milestone active and not all nestied issues closed' do - issue.milestone = milestone - issue.save - - milestone.can_be_closed?.should be_false - end - end - end diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index b40a0795..d0de4a7b 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -2,14 +2,13 @@ # # 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) -# description :string(255) default(""), not null +# 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) # require 'spec_helper' @@ -60,7 +59,7 @@ describe Namespace do end it "should raise error when dirtory exists" do - expect { @namespace.move_dir }.to raise_error("namespace directory cannot be moved") + expect { @namespace.move_dir }.to raise_error("Already exists") end it "should move dir if path changed" do diff --git a/spec/models/project_hooks_spec.rb b/spec/models/project_hooks_spec.rb new file mode 100644 index 00000000..60457e20 --- /dev/null +++ b/spec/models/project_hooks_spec.rb @@ -0,0 +1,125 @@ +require 'spec_helper' + +describe Project, "Hooks" do + let(:project) { create(:project) } + + before do + @key = create(:key, user: project.owner) + @user = @key.user + @key_id = @key.identifier + end + + describe "Post Receive Event" do + it "should create push event" do + oldrev, newrev, ref = '00000000000000000000000000000000', 'newrev', 'refs/heads/master' + data = project.post_receive_data(oldrev, newrev, ref, @user) + + project.observe_push(data) + event = Event.last + + event.should_not be_nil + event.project.should == project + event.action.should == Event::Pushed + event.data.should == data + end + end + + describe "Project hooks" do + context "with no web hooks" do + it "raises no errors" do + lambda { + project.execute_hooks({}) + }.should_not raise_error + end + end + + context "with web hooks" do + before do + @project_hook = create(:project_hook) + @project_hook_2 = create(:project_hook) + project.hooks << [@project_hook, @project_hook_2] + end + + it "executes multiple web hook" do + @project_hook.should_receive(:execute).once + @project_hook_2.should_receive(:execute).once + + project.trigger_post_receive('oldrev', 'newrev', 'refs/heads/master', @user) + end + end + + context "does not execute web hooks" do + before do + @project_hook = create(:project_hook) + project.hooks << [@project_hook] + end + + it "when pushing a branch for the first time" do + @project_hook.should_not_receive(:execute) + project.trigger_post_receive('00000000000000000000000000000000', 'newrev', 'refs/heads/master', @user) + end + + it "when pushing tags" do + @project_hook.should_not_receive(:execute) + project.trigger_post_receive('oldrev', 'newrev', 'refs/tags/v1.0.0', @user) + end + end + + context "when pushing new branches" do + + end + + context "when gathering commit data" do + before do + @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" + + @data = project.post_receive_data(@oldrev, @newrev, @ref, @user) + end + + subject { @data } + + it { should include(before: @oldrev) } + it { should include(after: @newrev) } + it { should include(ref: @ref) } + it { should include(user_id: project.owner.id) } + it { should include(user_name: project.owner.name) } + + context "with repository data" do + subject { @data[:repository] } + + it { should include(name: project.name) } + it { should include(url: project.url_to_repo) } + it { should include(description: project.description) } + it { should include(homepage: project.web_url) } + end + + context "with commits" do + subject { @data[:commits] } + + it { should be_an(Array) } + it { should have(1).element } + + context "the commit" do + subject { @data[:commits].first } + + it { should include(id: @commit.id) } + it { should include(message: @commit.safe_message) } + it { should include(timestamp: @commit.date.xmlschema) } + it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.code}/commit/#{@commit.id}") } + + context "with a author" do + subject { @data[:commits].first[:author] } + + it { should include(name: @commit.author_name) } + it { should include(email: @commit.author_email) } + end + end + end + end + end +end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index cbc7f278..17bc988b 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -8,6 +8,7 @@ # description :text # created_at :datetime not null # updated_at :datetime not null +# private_flag :boolean default(TRUE), not null # creator_id :integer # default_branch :string(255) # issues_enabled :boolean default(TRUE), not null @@ -15,10 +16,6 @@ # merge_requests_enabled :boolean default(TRUE), not null # wiki_enabled :boolean default(TRUE), not null # namespace_id :integer -# public :boolean default(FALSE), not null -# issues_tracker :string(255) default("gitlab"), not null -# issues_tracker_id :string(255) -# snippets_enabled :boolean default(TRUE), not null # require 'spec_helper' @@ -45,6 +42,7 @@ describe Project do describe "Mass assignment" do it { should_not allow_mass_assignment_of(:namespace_id) } it { should_not allow_mass_assignment_of(:creator_id) } + it { should_not allow_mass_assignment_of(:private_flag) } end describe "Validation" do @@ -63,12 +61,16 @@ describe Project do 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 ensure_length_of(:issues_tracker_id).is_within(0..255) } it "should not allow new projects beyond user limits" do project.stub(:creator).and_return(double(can_create_project?: false, projects_limit: 1)) project.should_not be_valid - project.errors[:limit_reached].first.should match(/Your own projects limit is 1/) + project.errors[:base].first.should match(/Your own projects limit is 1/) + end + + it "should not allow 'gitolite-admin' as repo name" do + should allow_value("blah").for(:path) + should_not allow_value("gitolite-admin").for(:path) end end @@ -76,8 +78,13 @@ describe Project do it { should respond_to(:url_to_repo) } it { should respond_to(:repo_exists?) } it { should respond_to(:satellite) } + it { should respond_to(:update_repository) } + it { should respond_to(:destroy_repository) } + 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) } it { should respond_to(:transfer) } it { should respond_to(:name_with_namespace) } it { should respond_to(:namespace_owner) } @@ -87,7 +94,7 @@ describe Project do it "should return valid url to repo" do project = Project.new(path: "somewhere") - project.url_to_repo.should == Gitlab.config.gitlab_shell.ssh_path_prefix + "somewhere.git" + project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git" end it "returns the full web URL for this repo" do @@ -119,10 +126,13 @@ describe Project do end describe :update_merge_requests do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } before do - @merge_request = create(:merge_request, project: project) + @merge_request = create(:merge_request, + project: project, + merged: false, + closed: false) @key = create(:key, user_id: project.owner.id) end @@ -131,7 +141,8 @@ describe Project do @merge_request.last_commit.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a", "refs/heads/stable", @key.user) @merge_request.reload - @merge_request.merged?.should be_true + @merge_request.merged.should be_true + @merge_request.closed.should be_true end it "should update merge request commits with new one if pushed to source branch" do @@ -189,69 +200,9 @@ describe Project do it "should return valid repo" do project.repository.should be_kind_of(Repository) end - end - describe :issue_exists? do - let(:project) { create(:project) } - let(:existed_issue) { create(:issue, project: project) } - let(:not_existed_issue) { create(:issue) } - let(:ext_project) { create(:redmine_project) } - - it "should be true or if used internal tracker and issue exists" do - project.issue_exists?(existed_issue.id).should be_true + it "should return nil" do + Project.new(path: "empty").repository.should be_nil end - - it "should be false or if used internal tracker and issue not exists" do - project.issue_exists?(not_existed_issue.id).should be_false - end - - it "should always be true if used other tracker" do - ext_project.issue_exists?(rand(100)).should be_true - end - end - - describe :used_default_issues_tracker? do - let(:project) { create(:project) } - let(:ext_project) { create(:redmine_project) } - - it "should be true if used internal tracker" do - project.used_default_issues_tracker?.should be_true - end - - it "should be false if used other tracker" do - ext_project.used_default_issues_tracker?.should be_false - end - end - - describe :can_have_issues_tracker_id? do - let(:project) { create(:project) } - let(:ext_project) { create(:redmine_project) } - - it "should be true for projects with external issues tracker if issues enabled" do - ext_project.can_have_issues_tracker_id?.should be_true - end - - it "should be false for projects with internal issue tracker if issues enabled" do - project.can_have_issues_tracker_id?.should be_false - end - - it "should be always false if issues disbled" do - project.issues_enabled = false - ext_project.issues_enabled = false - - project.can_have_issues_tracker_id?.should be_false - ext_project.can_have_issues_tracker_id?.should be_false - end - end - - describe :open_branches do - let(:project) { create(:project_with_code) } - - before do - project.protected_branches.create(name: 'master') - end - - it { project.open_branches.map(&:name).should include('bootstrap') } - it { project.open_branches.map(&:name).should_not include('master') } end end diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index 6e830393..c4d2e2f4 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -24,4 +24,19 @@ describe ProtectedBranch do it { should validate_presence_of(:project) } it { should validate_presence_of(:name) } end + + describe 'Callbacks' do + let(:branch) { build(:protected_branch) } + + it 'call update_repository after save' do + branch.should_receive(:update_repository) + branch.save + end + + it 'call update_repository after destroy' do + branch.save + branch.should_receive(:update_repository) + branch.destroy + end + end end diff --git a/spec/lib/git/repository_spec.rb b/spec/models/repository_spec.rb similarity index 96% rename from spec/lib/git/repository_spec.rb rename to spec/models/repository_spec.rb index b2b6f196..71f9b964 100644 --- a/spec/lib/git/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1,7 +1,8 @@ require "spec_helper" -describe Gitlab::Git::Repository do - let(:repository) { Gitlab::Git::Repository.new('gitlabhq', 'master') } +describe Repository do + let(:project) { create(:project) } + let(:repository) { project.repository } describe "Respond to" do subject { repository } diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index e4d19348..b474d88c 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -38,5 +38,6 @@ describe Snippet do it { should ensure_length_of(:title).is_within(0..255) } it { should validate_presence_of(:content) } + it { should ensure_length_of(:content).is_within(0..10_000) } end end diff --git a/spec/models/project_team_spec.rb b/spec/models/team_spec.rb similarity index 62% rename from spec/models/project_team_spec.rb rename to spec/models/team_spec.rb index 3e3543e8..65ffe13b 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/team_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe ProjectTeam do +describe Team do let(:team) { create(:project).team } describe "Respond to" do @@ -10,6 +10,9 @@ describe ProjectTeam do 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 4e276dea..f19c40b5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -22,18 +22,15 @@ # 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) -# can_create_group :boolean default(TRUE), not null -# can_create_team :boolean default(TRUE), not null -# state :string(255) -# color_scheme_id :integer default(1), not null -# notification_level :integer default(1), not null # require 'spec_helper' @@ -70,10 +67,28 @@ describe User do describe "Respond to" do it { should respond_to(:is_admin?) } + it { should respond_to(:identifier) } it { should respond_to(:name) } it { should respond_to(:private_token) } end + describe '#identifier' do + it "should return valid identifier" do + user = build(:user, email: "test@mail.com") + user.identifier.should == "test_mail_com" + end + + it "should return identifier without + sign" do + user = build(:user, email: "test+foo@mail.com") + user.identifier.should == "test_foo_mail_com" + end + + it "should conform to Gitolite's required identifier pattern" do + user = build(:user, email: "_test@example.com") + user.identifier.should == 'test_example_com' + end + end + describe '#generate_password' do it "should execute callback when force_random_password specified" do user = build(:user, force_random_password: true) @@ -141,7 +156,7 @@ describe User do it "should block user" do user.block - user.blocked?.should be_true + user.blocked.should be_true end end @@ -150,7 +165,7 @@ describe User do User.delete_all @user = create :user @admin = create :user, admin: true - @blocked = create :user, state: :blocked + @blocked = create :user, blocked: true end it { User.filter("admins").should == [@admin] } @@ -174,7 +189,7 @@ describe User do it { user.is_admin?.should be_false } it { user.require_ssh_key?.should be_true } - it { user.can_create_group?.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 diff --git a/spec/models/user_team_project_relationship_spec.rb b/spec/models/user_team_project_relationship_spec.rb deleted file mode 100644 index 86150cf3..00000000 --- a/spec/models/user_team_project_relationship_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# == Schema Information -# -# Table name: user_team_project_relationships -# -# id :integer not null, primary key -# project_id :integer -# user_team_id :integer -# greatest_access :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -require 'spec_helper' - -describe UserTeamProjectRelationship do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/user_team_spec.rb b/spec/models/user_team_spec.rb deleted file mode 100644 index d330bbf3..00000000 --- a/spec/models/user_team_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# == Schema Information -# -# Table name: user_teams -# -# id :integer not null, primary key -# name :string(255) -# path :string(255) -# owner_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# description :string(255) default(""), not null -# - -require 'spec_helper' - -describe UserTeam do - let(:team) { FactoryGirl.create :user_team } - - context ".add_member" do - let(:user) { FactoryGirl.create :user } - - it "should work" do - team.add_member(user, UsersProject::DEVELOPER, false) - team.members.should include(user) - end - end - - context ".remove_member" do - let(:user) { FactoryGirl.create :user } - before { team.add_member(user, UsersProject::DEVELOPER, false) } - - it "should work" do - team.remove_member(user) - team.members.should_not include(user) - end - end -end diff --git a/spec/models/user_team_user_relationship_spec.rb b/spec/models/user_team_user_relationship_spec.rb deleted file mode 100644 index 981ad1e8..00000000 --- a/spec/models/user_team_user_relationship_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# == Schema Information -# -# Table name: user_team_user_relationships -# -# id :integer not null, primary key -# user_id :integer -# user_team_id :integer -# group_admin :boolean -# permission :integer -# created_at :datetime not null -# updated_at :datetime not null -# - -require 'spec_helper' - -describe UserTeamUserRelationship do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb deleted file mode 100644 index 67f2a6da..00000000 --- a/spec/models/wiki_page_spec.rb +++ /dev/null @@ -1,164 +0,0 @@ -require "spec_helper" - -describe WikiPage do - - def create_temp_repo(path) - FileUtils.mkdir_p path - command = "git init --quiet #{path};" - system(command) - end - - def remove_temp_repo(path) - FileUtils.rm_rf path - end - - def commit_details - commit = {name: user.name, email: user.email, message: "test commit"} - end - - def create_page(name, content) - wiki.wiki.write_page(name, :markdown, content, commit_details) - end - - def destroy_page(title) - page = wiki.wiki.paged(title) - wiki.wiki.delete_page(page, commit_details) - end - - let(:project) { create(:project) } - let(:repository) { project.repository } - let(:user) { project.owner } - let(:wiki) { GollumWiki.new(project, user) } - - subject { WikiPage.new(wiki) } - - before do - create_temp_repo(wiki.send(:path_to_repo)) - end - - describe "#initialize" do - context "when initialized with an existing gollum page" do - before do - create_page("test page", "test content") - @page = wiki.wiki.paged("test page") - @wiki_page = WikiPage.new(wiki, @page, true) - end - - it "sets the slug attribute" do - @wiki_page.slug.should == "test-page" - end - - it "sets the title attribute" do - @wiki_page.title.should == "test page" - end - - it "sets the formatted content attribute" do - @wiki_page.content.should == "test content" - end - - it "sets the format attribute" do - @wiki_page.format.should == :markdown - end - - it "sets the message attribute" do - @wiki_page.message.should == "test commit" - end - - it "sets the version attribute" do - @wiki_page.version.should be_a Commit - end - end - end - - describe "validations" do - before do - subject.attributes = {title: 'title', content: 'content'} - end - - it "validates presence of title" do - subject.attributes.delete(:title) - subject.valid?.should be_false - end - - it "validates presence of content" do - subject.attributes.delete(:content) - subject.valid?.should be_false - end - end - - before do - @wiki_attr = {title: "Index", content: "Home Page", format: "markdown"} - end - - describe "#create" do - after do - destroy_page("Index") - end - - context "with valid attributes" do - it "saves the wiki page" do - subject.create(@wiki_attr) - wiki.find_page("Index").should_not be_nil - end - - it "returns true" do - subject.create(@wiki_attr).should == true - end - end - end - - describe "#update" do - before do - create_page("Update", "content") - @page = wiki.find_page("Update") - end - - after do - destroy_page("Update") - end - - context "with valid attributes" do - it "updates the content of the page" do - @page.update("new content") - @page = wiki.find_page("Update") - end - - it "returns true" do - @page.update("more content").should be_true - end - end - end - - describe "#destroy" do - before do - create_page("Delete Page", "content") - @page = wiki.find_page("Delete Page") - end - - it "should delete the page" do - @page.delete - wiki.pages.should be_empty - end - - it "should return true" do - @page.delete.should == true - end - end - - describe "#versions" do - before do - create_page("Update", "content") - @page = wiki.find_page("Update") - end - - after do - destroy_page("Update") - end - - it "returns an array of all commits for the page" do - 3.times { |i| @page.update("content #{i}") } - @page.versions.count.should == 4 - end - end - -end diff --git a/spec/observers/activity_observer_spec.rb b/spec/observers/activity_observer_spec.rb index 3d503027..6af5d070 100644 --- a/spec/observers/activity_observer_spec.rb +++ b/spec/observers/activity_observer_spec.rb @@ -17,7 +17,7 @@ describe ActivityObserver do end it_should_be_valid_event - it { @event.action.should == Event::CREATED } + it { @event.action.should == Event::Created } it { @event.target.should == @merge_request } end @@ -30,7 +30,7 @@ describe ActivityObserver do end it_should_be_valid_event - it { @event.action.should == Event::CREATED } + it { @event.action.should == Event::Created } it { @event.target.should == @issue } end @@ -44,7 +44,7 @@ describe ActivityObserver do end it_should_be_valid_event - it { @event.action.should == Event::COMMENTED } + it { @event.action.should == Event::Commented } it { @event.target.should == @note } end end diff --git a/spec/observers/issue_observer_spec.rb b/spec/observers/issue_observer_spec.rb index 539c6550..700c9a3a 100644 --- a/spec/observers/issue_observer_spec.rb +++ b/spec/observers/issue_observer_spec.rb @@ -1,19 +1,12 @@ require 'spec_helper' describe IssueObserver do - let(:some_user) { create :user } - let(:assignee) { create :user } - let(:author) { create :user } - let(:mock_issue) { double(:issue, id: 42, assignee: assignee, author: author) } - let(:assigned_issue) { create(:issue, assignee: assignee, author: author) } - let(:unassigned_issue) { create(:issue, author: author) } - let(:closed_assigned_issue) { create(:closed_issue, assignee: assignee, author: author) } - let(:closed_unassigned_issue) { create(:closed_issue, author: author) } - - - before { subject.stub(:current_user).and_return(some_user) } - before { subject.stub(notification: mock('NotificationService').as_null_object) } + let(:some_user) { double(:user, id: 1) } + let(:assignee) { double(:user, id: 2) } + let(:author) { double(:user, id: 3) } + let(:issue) { double(:issue, id: 42, assignee: assignee, author: author) } + before(:each) { subject.stub(:current_user).and_return(some_user) } subject { IssueObserver.instance } @@ -27,57 +20,25 @@ describe IssueObserver do end end - it 'trigger notification to send emails' do - subject.should_receive(:notification) + it 'sends an email to the assignee' do + Notify.should_receive(:new_issue_email).with(issue.id) - subject.after_create(mock_issue) - end - end - - context '#after_close' do - context 'a status "closed"' do - it 'note is created if the issue is being closed' do - Note.should_receive(:create_status_change_note).with(assigned_issue, some_user, 'closed') - - assigned_issue.close - end - - it 'trigger notification to send emails' do - subject.should_receive(:notification) - - assigned_issue.close - end - - it 'creates a note' do - Note.should_receive(:create_status_change_note).with(unassigned_issue, some_user, 'closed') - unassigned_issue.close - end + subject.after_create(issue) end - context 'a status "reopened"' do - it 'note is created if the issue is being reopened' do - Note.should_receive(:create_status_change_note).with(closed_assigned_issue, some_user, 'reopened') + it 'does not send an email to the assignee if assignee created the issue' do + subject.stub(:current_user).and_return(assignee) + Notify.should_not_receive(:new_issue_email) - closed_assigned_issue.reopen - end - - it 'trigger notification to send emails' do - subject.should_receive(:notification) - - closed_assigned_issue.reopen - end - - it 'create a note' do - Note.should_receive(:create_status_change_note).with(closed_unassigned_issue, some_user, 'reopened') - - closed_unassigned_issue.reopen - end + subject.after_create(issue) end end context '#after_update' do before(:each) do - mock_issue.stub(:is_being_reassigned?).and_return(false) + issue.stub(:is_being_reassigned?).and_return(false) + issue.stub(:is_being_closed?).and_return(false) + issue.stub(:is_being_reopened?).and_return(false) end it 'is called when an issue is changed' do @@ -90,19 +51,148 @@ describe IssueObserver do end end - context 'notification' do - it 'triggered if the issue is being reassigned' do - mock_issue.should_receive(:is_being_reassigned?).and_return(true) - subject.should_receive(:notification) + context 'a reassigned email' do + it 'is sent if the issue is being reassigned' do + issue.should_receive(:is_being_reassigned?).and_return(true) + subject.should_receive(:send_reassigned_email).with(issue) - subject.after_update(mock_issue) + subject.after_update(issue) end - it 'is not triggered if the issue is not being reassigned' do - mock_issue.should_receive(:is_being_reassigned?).and_return(false) - subject.should_not_receive(:notification) + it 'is not sent if the issue is not being reassigned' do + issue.should_receive(:is_being_reassigned?).and_return(false) + subject.should_not_receive(:send_reassigned_email) - subject.after_update(mock_issue) + subject.after_update(issue) + end + end + + 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) + end + + it 'note is not created if the issue is not being closed' do + issue.should_receive(:is_being_closed?).and_return(false) + Note.should_not_receive(:create_status_change_note).with(issue, some_user, 'closed') + + subject.after_update(issue) + end + + 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 + Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed') + + subject.after_update(issue) + end + + it 'notification is not delivered if the issue not being closed' do + issue.stub(:is_being_closed?).and_return(false) + Notify.should_not_receive(:issue_status_changed_email) + Note.should_not_receive(:create_status_change_note).with(issue, some_user, 'closed') + + subject.after_update(issue) + end + + it 'notification is delivered only to author if the issue being closed' do + issue_without_assignee = double(:issue, id: 42, author: author, assignee: nil) + 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 + Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'closed') + + subject.after_update(issue_without_assignee) + end + end + + 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') + + subject.after_update(issue) + end + + it 'note is not created if the issue is not being reopened' do + issue.should_receive(:is_being_reopened?).and_return(false) + Note.should_not_receive(:create_status_change_note).with(issue, some_user, 'reopened') + + subject.after_update(issue) + end + + 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 + Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened') + + subject.after_update(issue) + end + + it 'notification is not delivered if the issue not being reopened' do + issue.stub(:is_being_reopened?).and_return(false) + Notify.should_not_receive(:issue_status_changed_email) + Note.should_not_receive(:create_status_change_note).with(issue, some_user, 'reopened') + + subject.after_update(issue) + end + + it 'notification is delivered only to author if the issue being reopened' do + issue_without_assignee = double(:issue, id: 42, author: author, assignee: nil) + 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 + Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'reopened') + + subject.after_update(issue_without_assignee) + end + end + end + + describe '#send_reassigned_email' do + let(:previous_assignee) { double(:user, id: 3) } + + before(:each) do + issue.stub(:assignee_id).and_return(assignee.id) + issue.stub(:assignee_id_was).and_return(previous_assignee.id) + end + + def it_sends_a_reassigned_email_to(recipient) + Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id) + end + + def it_does_not_send_a_reassigned_email_to(recipient) + Notify.should_not_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id) + end + + it 'sends a reassigned email to the previous and current assignees' do + it_sends_a_reassigned_email_to assignee.id + it_sends_a_reassigned_email_to previous_assignee.id + + subject.send(:send_reassigned_email, issue) + end + + context 'does not send an email to the user who made the reassignment' do + it 'if the user is the assignee' do + subject.stub(:current_user).and_return(assignee) + it_sends_a_reassigned_email_to previous_assignee.id + it_does_not_send_a_reassigned_email_to assignee.id + + subject.send(:send_reassigned_email, issue) + end + it 'if the user is the previous assignee' do + subject.stub(:current_user).and_return(previous_assignee) + it_sends_a_reassigned_email_to assignee.id + it_does_not_send_a_reassigned_email_to previous_assignee.id + + subject.send(:send_reassigned_email, issue) end end end diff --git a/spec/observers/key_observer_spec.rb b/spec/observers/key_observer_spec.rb index 452844cb..ae7b0f73 100644 --- a/spec/observers/key_observer_spec.rb +++ b/spec/observers/key_observer_spec.rb @@ -2,21 +2,32 @@ require 'spec_helper' describe KeyObserver do before do - @key = create(:personal_key) + @key = double('Key', + identifier: 'admin_654654', + key: '== a vaild ssh key', + projects: [], + is_deploy_key: false + ) + + @gitolite = double('Gitlab::Gitolite', + set_key: true, + remove_key: true + ) @observer = KeyObserver.instance + @observer.stub(gitolite: @gitolite) end context :after_save do it do - GitlabShellWorker.should_receive(:perform_async).with(:add_key, @key.shell_id, @key.key) + @gitolite.should_receive(:set_key).with(@key.identifier, @key.key, @key.projects) @observer.after_save(@key) end end context :after_destroy do it do - GitlabShellWorker.should_receive(:perform_async).with(:remove_key, @key.shell_id, @key.key) + @gitolite.should_receive(:remove_key).with(@key.identifier, @key.projects) @observer.after_destroy(@key) end end diff --git a/spec/observers/merge_request_observer_spec.rb b/spec/observers/merge_request_observer_spec.rb index 2593da72..4841bf88 100644 --- a/spec/observers/merge_request_observer_spec.rb +++ b/spec/observers/merge_request_observer_spec.rb @@ -1,17 +1,12 @@ require 'spec_helper' describe MergeRequestObserver do - let(:some_user) { create :user } - let(:assignee) { create :user } - let(:author) { create :user } - let(:mr_mock) { double(:merge_request, id: 42, assignee: assignee, author: author) } - let(:assigned_mr) { create(:merge_request, assignee: assignee, author: author) } - let(:unassigned_mr) { create(:merge_request, author: author) } - let(:closed_assigned_mr) { create(:closed_merge_request, assignee: assignee, author: author) } - let(:closed_unassigned_mr) { create(:closed_merge_request, author: author) } + let(:some_user) { double(:user, id: 1) } + let(:assignee) { double(:user, id: 2) } + let(:author) { double(:user, id: 3) } + let(:mr) { double(:merge_request, id: 42, assignee: assignee, author: author) } - before { subject.stub(:current_user).and_return(some_user) } - before { subject.stub(notification: mock('NotificationService').as_null_object) } + before(:each) { subject.stub(:current_user).and_return(some_user) } subject { MergeRequestObserver.instance } @@ -19,18 +14,30 @@ describe MergeRequestObserver do it 'is called when a merge request is created' do subject.should_receive(:after_create) - create(:merge_request, project: create(:project)) + + MergeRequest.observers.enable :merge_request_observer do + create(:merge_request, project: create(:project)) + end end - it 'trigger notification service' do - subject.should_receive(:notification) - subject.after_create(mr_mock) + it 'sends an email to the assignee' do + Notify.should_receive(:new_merge_request_email).with(mr.id) + subject.after_create(mr) + end + + it 'does not send an email to the assignee if assignee created the merge request' do + subject.stub(:current_user).and_return(assignee) + Notify.should_not_receive(:new_merge_request_email) + + subject.after_create(mr) end end context '#after_update' do before(:each) do - mr_mock.stub(:is_being_reassigned?).and_return(false) + mr.stub(:is_being_reassigned?).and_return(false) + mr.stub(:is_being_closed?).and_return(false) + mr.stub(:is_being_reopened?).and_return(false) end it 'is called when a merge request is changed' do @@ -43,51 +50,140 @@ describe MergeRequestObserver do end end - context 'a notification' do + context 'a reassigned email' do it 'is sent if the merge request is being reassigned' do - mr_mock.should_receive(:is_being_reassigned?).and_return(true) - subject.should_receive(:notification) + mr.should_receive(:is_being_reassigned?).and_return(true) + subject.should_receive(:send_reassigned_email).with(mr) - subject.after_update(mr_mock) + subject.after_update(mr) end it 'is not sent if the merge request is not being reassigned' do - mr_mock.should_receive(:is_being_reassigned?).and_return(false) - subject.should_not_receive(:notification) + mr.should_receive(:is_being_reassigned?).and_return(false) + subject.should_not_receive(:send_reassigned_email) - subject.after_update(mr_mock) + subject.after_update(mr) end end - end - context '#after_close' do context 'a status "closed"' do it 'note is created if the merge request is being closed' do - Note.should_receive(:create_status_change_note).with(assigned_mr, some_user, 'closed') + mr.should_receive(:is_being_closed?).and_return(true) + Note.should_receive(:create_status_change_note).with(mr, some_user, 'closed') - assigned_mr.close + subject.after_update(mr) + end + + it 'note is not created if the merge request is not being closed' do + mr.should_receive(:is_being_closed?).and_return(false) + Note.should_not_receive(:create_status_change_note).with(mr, some_user, 'closed') + + subject.after_update(mr) + end + + it 'notification is delivered if the merge request being closed' do + mr.stub(:is_being_closed?).and_return(true) + Note.should_receive(:create_status_change_note).with(mr, some_user, 'closed') + + subject.after_update(mr) + end + + it 'notification is not delivered if the merge request not being closed' do + mr.stub(:is_being_closed?).and_return(false) + Note.should_not_receive(:create_status_change_note).with(mr, some_user, 'closed') + + subject.after_update(mr) end it 'notification is delivered only to author if the merge request is being closed' do - Note.should_receive(:create_status_change_note).with(unassigned_mr, some_user, 'closed') + mr_without_assignee = double(:merge_request, id: 42, author: author, assignee: nil) + mr_without_assignee.stub(:is_being_reassigned?).and_return(false) + mr_without_assignee.stub(:is_being_closed?).and_return(true) + mr_without_assignee.stub(:is_being_reopened?).and_return(false) + Note.should_receive(:create_status_change_note).with(mr_without_assignee, some_user, 'closed') - unassigned_mr.close + subject.after_update(mr_without_assignee) + end + end + + context 'a status "reopened"' do + it 'note is created if the merge request is being reopened' do + mr.should_receive(:is_being_reopened?).and_return(true) + Note.should_receive(:create_status_change_note).with(mr, some_user, 'reopened') + + subject.after_update(mr) + end + + it 'note is not created if the merge request is not being reopened' do + mr.should_receive(:is_being_reopened?).and_return(false) + Note.should_not_receive(:create_status_change_note).with(mr, some_user, 'reopened') + + subject.after_update(mr) + end + + it 'notification is delivered if the merge request being reopened' do + mr.stub(:is_being_reopened?).and_return(true) + Note.should_receive(:create_status_change_note).with(mr, some_user, 'reopened') + + subject.after_update(mr) + end + + it 'notification is not delivered if the merge request is not being reopened' do + mr.stub(:is_being_reopened?).and_return(false) + Note.should_not_receive(:create_status_change_note).with(mr, some_user, 'reopened') + + subject.after_update(mr) + end + + it 'notification is delivered only to author if the merge request is being reopened' do + mr_without_assignee = double(:merge_request, id: 42, author: author, assignee: nil) + mr_without_assignee.stub(:is_being_reassigned?).and_return(false) + mr_without_assignee.stub(:is_being_closed?).and_return(false) + mr_without_assignee.stub(:is_being_reopened?).and_return(true) + Note.should_receive(:create_status_change_note).with(mr_without_assignee, some_user, 'reopened') + + subject.after_update(mr_without_assignee) end end end - context '#after_reopen' do - context 'a status "reopened"' do - it 'note is created if the merge request is being reopened' do - Note.should_receive(:create_status_change_note).with(closed_assigned_mr, some_user, 'reopened') + describe '#send_reassigned_email' do + let(:previous_assignee) { double(:user, id: 3) } - closed_assigned_mr.reopen + before(:each) do + mr.stub(:assignee_id).and_return(assignee.id) + mr.stub(:assignee_id_was).and_return(previous_assignee.id) + end + + def it_sends_a_reassigned_email_to(recipient) + 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) + Notify.should_not_receive(:reassigned_merge_request_email).with(recipient, mr.id, previous_assignee.id) + end + + it 'sends a reassigned email to the previous and current assignees' do + it_sends_a_reassigned_email_to assignee.id + it_sends_a_reassigned_email_to previous_assignee.id + + subject.send(:send_reassigned_email, mr) + end + + context 'does not send an email to the user who made the reassignment' do + it 'if the user is the assignee' do + subject.stub(:current_user).and_return(assignee) + it_sends_a_reassigned_email_to previous_assignee.id + it_does_not_send_a_reassigned_email_to assignee.id + + subject.send(:send_reassigned_email, mr) end + it 'if the user is the previous assignee' do + subject.stub(:current_user).and_return(previous_assignee) + it_sends_a_reassigned_email_to assignee.id + it_does_not_send_a_reassigned_email_to previous_assignee.id - it 'notification is delivered only to author if the merge request is being reopened' do - Note.should_receive(:create_status_change_note).with(closed_unassigned_mr, some_user, 'reopened') - - closed_unassigned_mr.reopen + subject.send(:send_reassigned_email, mr) end end end diff --git a/spec/observers/note_observer_spec.rb b/spec/observers/note_observer_spec.rb index 9ada9270..8ad42c21 100644 --- a/spec/observers/note_observer_spec.rb +++ b/spec/observers/note_observer_spec.rb @@ -2,7 +2,6 @@ require 'spec_helper' describe NoteObserver do subject { NoteObserver.instance } - before { subject.stub(notification: mock('NotificationService').as_null_object) } let(:team_without_author) { (1..2).map { |n| double :user, id: n } } @@ -18,9 +17,116 @@ describe NoteObserver do end it 'sends out notifications' do - subject.should_receive(:notification) + subject.should_receive(:send_notify_mails).with(note) subject.after_create(note) end end + + describe "#send_notify_mails" do + let(:note) { double :note, notify: false, notify_author: false } + + it 'notifies team of new note when flagged to notify' do + note.stub(:notify).and_return(true) + subject.should_receive(:notify_team).with(note) + + subject.after_create(note) + end + + it 'does not notify team of new note when not flagged to notify' do + subject.should_not_receive(:notify_team).with(note) + + subject.after_create(note) + end + + it 'notifies the author of a commit when flagged to notify the author' do + note.stub(:notify_author).and_return(true) + note.stub(:noteable).and_return(double(author_email: 'test@test.com')) + note.stub(:id).and_return(42) + author = double :user, id: 1, email: 'test@test.com' + note.stub(:commit_author).and_return(author) + 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) + + subject.after_create(note) + end + + it 'does nothing if no notify flags are set' do + subject.after_create(note).should be_nil + end + end + + describe '#notify_team' do + let(:note) { double :note, id: 1 } + + before :each do + subject.stub(:team_without_note_author).with(note).and_return(team_without_author) + end + + 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 + + subject.send(:notify_team, note) + end + + it 'an issue' do + note.stub(:noteable_type).and_return('Issue') + 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 + + 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 + + subject.send(:notify_team, note) + end + + 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 + + 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') + + subject.send(:notify_team, note).should be_nil + end + end + + + describe '#team_without_note_author' do + let(:author) { double :user, id: 4 } + + let(:users) { team_without_author + [author] } + let(:project) { double :project, users: users } + let(:note) { double :note, project: project, author: author } + + it 'returns the projects user without the note author included' 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 5b735a8f..bffa5fcf 100644 --- a/spec/observers/user_observer_spec.rb +++ b/spec/observers/user_observer_spec.rb @@ -2,7 +2,6 @@ require 'spec_helper' describe UserObserver do subject { UserObserver.instance } - before { subject.stub(notification: mock('NotificationService').as_null_object) } it 'calls #after_create when new users are created' do new_user = build(:user) @@ -12,12 +11,11 @@ describe UserObserver do context 'when a new user is created' do it 'sends an email' do - subject.should_receive(:notification) + Notify.should_receive(:new_user_email) create(:user) end it 'trigger logger' do - user = double(:user, id: 42, password: 'P@ssword!', name: 'John', email: 'u@mail.local', extern_uid?: false) Gitlab::AppLogger.should_receive(:info) create(:user) end diff --git a/spec/observers/users_project_observer_spec.rb b/spec/observers/users_project_observer_spec.rb index c034501e..068688b0 100644 --- a/spec/observers/users_project_observer_spec.rb +++ b/spec/observers/users_project_observer_spec.rb @@ -4,7 +4,6 @@ describe UsersProjectObserver do let(:user) { create(:user) } let(:project) { create(:project) } subject { UsersProjectObserver.instance } - before { subject.stub(notification: mock('NotificationService').as_null_object) } describe "#after_commit" do it "should called when UsersProject created" do @@ -13,7 +12,7 @@ describe UsersProjectObserver do end it "should send email to user" do - subject.should_receive(:notification) + Notify.should_receive(:project_access_granted_email).and_return(double(deliver: true)) Event.stub(:create => true) create(:users_project) @@ -37,7 +36,7 @@ describe UsersProjectObserver do end it "should send email to user" do - subject.should_receive(:notification) + Notify.should_receive(:project_access_granted_email) @users_project.update_attribute(:project_access, UsersProject::MASTER) end diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/requests/admin/admin_hooks_spec.rb similarity index 97% rename from spec/features/admin/admin_hooks_spec.rb rename to spec/requests/admin/admin_hooks_spec.rb index 102a1b92..bc0586b2 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/requests/admin/admin_hooks_spec.rb @@ -12,7 +12,7 @@ describe "Admin::Hooks" do describe "GET /admin/hooks" do it "should be ok" do visit admin_root_path - within ".main-nav" do + within ".main_menu" do click_on "Hooks" end current_path.should == admin_hooks_path diff --git a/spec/requests/admin/admin_projects_spec.rb b/spec/requests/admin/admin_projects_spec.rb new file mode 100644 index 00000000..c9ddf1f4 --- /dev/null +++ b/spec/requests/admin/admin_projects_spec.rb @@ -0,0 +1,76 @@ +require 'spec_helper' + +describe "Admin::Projects" do + before do + @project = create(:project) + login_as :admin + end + + describe "GET /admin/projects" do + before do + visit admin_projects_path + end + + it "should be ok" do + current_path.should == admin_projects_path + end + + it "should have projects list" do + page.should have_content(@project.name) + end + end + + describe "GET /admin/projects/:id" do + before do + visit admin_projects_path + click_link "#{@project.name}" + end + + it "should have project info" do + page.should have_content(@project.path) + page.should have_content(@project.name) + end + end + + describe "GET /admin/projects/:id/edit" do + before do + visit admin_projects_path + click_link "edit_project_#{@project.id}" + end + + it "should have project edit page" do + page.should have_content("Edit project") + page.should have_button("Save Project") + end + + describe "Update project" do + before do + fill_in "project_name", with: "Big Bang" + click_button "Save Project" + @project.reload + end + + it "should show page with new data" do + page.should have_content("Big Bang") + end + + it "should change project entry" do + @project.name.should == "Big Bang" + end + end + end + + describe "Add new team member" do + before do + @new_user = create(:user) + visit admin_project_path(@project) + end + + it "should create new user" do + select @new_user.name, from: "user_ids" + expect { click_button "Add" }.to change { UsersProject.count }.by(1) + page.should have_content @new_user.name + current_path.should == admin_project_path(@project) + end + end +end diff --git a/spec/features/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb similarity index 93% rename from spec/features/admin/admin_users_spec.rb rename to spec/requests/admin/admin_users_spec.rb index 22d1ee91..455caf4a 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/requests/admin/admin_users_spec.rb @@ -55,8 +55,8 @@ describe "Admin::Users" do user = User.last email = ActionMailer::Base.deliveries.last email.subject.should have_content("Account was created") - email.text_part.body.should have_content(user.email) - email.text_part.body.should have_content(@password) + email.body.should have_content(user.email) + email.body.should have_content(@password) end end @@ -67,8 +67,8 @@ describe "Admin::Users" do user = User.last email = ActionMailer::Base.deliveries.last email.subject.should have_content("Account was created") - email.text_part.body.should have_content(user.email) - email.text_part.body.should_not have_content(@password) + email.body.should have_content(user.email) + email.body.should_not have_content(@password) end end end @@ -82,6 +82,7 @@ describe "Admin::Users" do it "should have user info" do page.should have_content(@user.email) page.should have_content(@user.name) + page.should have_content(@user.projects_limit) end end diff --git a/spec/features/admin/security_spec.rb b/spec/requests/admin/security_spec.rb similarity index 100% rename from spec/features/admin/security_spec.rb rename to spec/requests/admin/security_spec.rb diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb deleted file mode 100644 index e97ceb2c..00000000 --- a/spec/requests/api/groups_spec.rb +++ /dev/null @@ -1,126 +0,0 @@ -require 'spec_helper' - -describe Gitlab::API do - include ApiHelpers - - let(:user1) { create(:user) } - let(:user2) { create(:user) } - let(:admin) { create(:admin) } - let!(:group1) { create(:group, owner: user1) } - let!(:group2) { create(:group, owner: user2) } - - describe "GET /groups" do - context "when unauthenticated" do - it "should return authentication error" do - get api("/groups") - response.status.should == 401 - end - end - - context "when authenticated as user" do - it "normal user: should return an array of groups of user1" do - get api("/groups", user1) - response.status.should == 200 - json_response.should be_an Array - json_response.length.should == 1 - json_response.first['name'].should == group1.name - end - end - - context "when authenticated as admin" do - it "admin: should return an array of all groups" do - get api("/groups", admin) - response.status.should == 200 - json_response.should be_an Array - json_response.length.should == 2 - end - end - end - - describe "GET /groups/:id" do - context "when authenticated as user" do - it "should return one of user1's groups" do - get api("/groups/#{group1.id}", user1) - response.status.should == 200 - json_response['name'] == group1.name - end - - it "should not return a non existing group" do - get api("/groups/1328", user1) - response.status.should == 404 - end - - it "should not return a group not attached to user1" do - get api("/groups/#{group2.id}", user1) - response.status.should == 404 - end - end - - context "when authenticated as admin" do - it "should return any existing group" do - get api("/groups/#{group2.id}", admin) - response.status.should == 200 - json_response['name'] == group2.name - end - - it "should not return a non existing group" do - get api("/groups/1328", admin) - response.status.should == 404 - end - end - end - - describe "POST /groups" do - context "when authenticated as user" do - it "should not create group" do - post api("/groups", user1), attributes_for(:group) - response.status.should == 403 - end - end - - context "when authenticated as admin" do - it "should create group" do - post api("/groups", admin), attributes_for(:group) - response.status.should == 201 - end - - it "should not create group, duplicate" do - post api("/groups", admin), {:name => "Duplicate Test", :path => group2.path} - response.status.should == 404 - end - - it "should return 400 bad request error if name not given" do - post api("/groups", admin), { :path => group2.path } - response.status.should == 400 - end - - it "should return 400 bad request error if path not given" do - post api("/groups", admin), { :name => 'test' } - response.status.should == 400 - end - end - end - - describe "POST /groups/:id/projects/:project_id" do - let(:project) { create(:project) } - before(:each) do - project.stub!(:transfer).and_return(true) - Project.stub(:find).and_return(project) - end - - - context "when authenticated as user" do - it "should not transfer project to group" do - post api("/groups/#{group1.id}/projects/#{project.id}", user2) - response.status.should == 403 - end - end - - context "when authenticated as admin" do - it "should transfer project to group" do - project.should_receive(:transfer) - post api("/groups/#{group1.id}/projects/#{project.id}", admin) - end - end - end -end diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb deleted file mode 100644 index ba11a41d..00000000 --- a/spec/requests/api/internal_spec.rb +++ /dev/null @@ -1,124 +0,0 @@ -require 'spec_helper' - -describe Gitlab::API do - include ApiHelpers - - let(:user) { create(:user) } - let(:key) { create(:key, user: user) } - let(:project) { create(:project) } - - describe "GET /internal/check", no_db: true do - it do - get api("/internal/check") - - response.status.should == 200 - json_response['api_version'].should == Gitlab::API.version - end - end - - describe "GET /internal/discover" do - it do - get(api("/internal/discover"), key_id: key.id) - - response.status.should == 200 - - json_response['name'].should == user.name - end - end - - describe "GET /internal/allowed" do - context "access granted" do - before do - project.team << [user, :developer] - end - - context "git pull" do - it do - pull(key, project) - - response.status.should == 200 - response.body.should == 'true' - end - end - - context "git push" do - it do - push(key, project) - - response.status.should == 200 - response.body.should == 'true' - end - end - end - - context "access denied" do - before do - project.team << [user, :guest] - end - - context "git pull" do - it do - pull(key, project) - - response.status.should == 200 - response.body.should == 'false' - end - end - - context "git push" do - it do - push(key, project) - - response.status.should == 200 - response.body.should == 'false' - end - end - end - - context "blocked user" do - let(:personal_project) { create(:project, namespace: user.namespace) } - - before do - user.block - end - - context "git pull" do - it do - pull(key, personal_project) - - response.status.should == 200 - response.body.should == 'false' - end - end - - context "git push" do - it do - push(key, personal_project) - - response.status.should == 200 - response.body.should == 'false' - end - end - end - end - - def pull(key, project) - get( - api("/internal/allowed"), - ref: 'master', - key_id: key.id, - project: project.path_with_namespace, - action: 'git-upload-pack' - ) - end - - def push(key, project) - get( - api("/internal/allowed"), - ref: 'master', - key_id: key.id, - project: project.path_with_namespace, - action: 'git-receive-pack' - ) - end -end diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index ecf0bdb7..781ebab0 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -41,11 +41,6 @@ describe Gitlab::API do response.status.should == 200 json_response['title'].should == issue.title end - - it "should return 404 if issue id not found" do - get api("/projects/#{project.id}/issues/54321", user) - response.status.should == 404 - end end describe "POST /projects/:id/issues" do @@ -57,37 +52,16 @@ describe Gitlab::API do json_response['description'].should be_nil json_response['labels'].should == ['label', 'label2'] end - - it "should return a 400 bad request if title not given" do - post api("/projects/#{project.id}/issues", user), labels: 'label, label2' - response.status.should == 400 - end end - describe "PUT /projects/:id/issues/:issue_id to update only title" do + describe "PUT /projects/:id/issues/:issue_id" do it "should update a project issue" do put api("/projects/#{project.id}/issues/#{issue.id}", user), - title: 'updated title' + title: 'updated title', labels: 'label2', closed: 1 response.status.should == 200 - json_response['title'].should == 'updated title' - end - - it "should return 404 error if issue id not found" do - put api("/projects/#{project.id}/issues/44444", user), - title: 'updated title' - response.status.should == 404 - end - end - - describe "PUT /projects/:id/issues/:issue_id to update state and label" do - it "should update a project issue" do - put api("/projects/#{project.id}/issues/#{issue.id}", user), - labels: 'label2', state_event: "close" - response.status.should == 200 - json_response['labels'].should == ['label2'] - json_response['state'].should eq "closed" + json_response['closed'].should be_true end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 25bbd986..5da54154 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -4,7 +4,7 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user ) } - let!(:project) { create(:project_with_code, creator_id: user.id) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:merge_request) { create(:merge_request, author: user, assignee: user, project: project, title: "Test") } before { project.team << [user, :reporters] } @@ -32,11 +32,6 @@ describe Gitlab::API do response.status.should == 200 json_response['title'].should == merge_request.title end - - it "should return a 404 error if merge_request_id not found" do - get api("/projects/#{project.id}/merge_request/999", user) - response.status.should == 404 - end end describe "POST /projects/:id/merge_requests" do @@ -46,46 +41,6 @@ describe Gitlab::API do response.status.should == 201 json_response['title'].should == 'Test merge_request' end - - it "should return 422 when source_branch equals target_branch" do - post api("/projects/#{project.id}/merge_requests", user), - title: "Test merge_request", source_branch: "master", target_branch: "master", author: user - response.status.should == 422 - end - - it "should return 400 when source_branch is missing" do - post api("/projects/#{project.id}/merge_requests", user), - title: "Test merge_request", target_branch: "master", author: user - response.status.should == 400 - end - - it "should return 400 when target_branch is missing" do - post api("/projects/#{project.id}/merge_requests", user), - title: "Test merge_request", source_branch: "stable", author: user - response.status.should == 400 - end - - it "should return 400 when title is missing" do - post api("/projects/#{project.id}/merge_requests", user), - target_branch: 'master', source_branch: 'stable' - response.status.should == 400 - end - end - - describe "PUT /projects/:id/merge_request/:merge_request_id to close MR" do - it "should return merge_request" do - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "close" - response.status.should == 200 - json_response['state'].should == 'closed' - end - end - - describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do - it "should return merge_request" do - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "merge" - response.status.should == 200 - json_response['state'].should == 'merged' - end end describe "PUT /projects/:id/merge_request/:merge_request_id" do @@ -94,18 +49,6 @@ describe Gitlab::API do response.status.should == 200 json_response['title'].should == 'New title' end - - it "should return 422 when source_branch and target_branch are renamed the same" do - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), - source_branch: "master", target_branch: "master" - response.status.should == 422 - end - - it "should return merge_request with renamed target_branch" do - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), target_branch: "test" - response.status.should == 200 - json_response['target_branch'].should == 'test' - end end describe "POST /projects/:id/merge_request/:merge_request_id/comments" do @@ -114,16 +57,6 @@ describe Gitlab::API do response.status.should == 201 json_response['note'].should == 'My comment' end - - it "should return 400 if note is missing" do - post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user) - response.status.should == 400 - end - - it "should return 404 if note is attached to non existent merge request" do - post api("/projects/#{project.id}/merge_request/111/comments", user), note: "My comment" - response.status.should == 404 - end end end diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index c379e8a5..80696671 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -16,11 +16,6 @@ describe Gitlab::API do json_response.should be_an Array json_response.first['title'].should == milestone.title end - - it "should return a 401 error if user not authenticated" do - get api("/projects/#{project.id}/milestones") - response.status.should == 401 - end end describe "GET /projects/:id/milestones/:milestone_id" do @@ -29,38 +24,16 @@ describe Gitlab::API do response.status.should == 200 json_response['title'].should == milestone.title end - - it "should return 401 error if user not authenticated" do - get api("/projects/#{project.id}/milestones/#{milestone.id}") - response.status.should == 401 - end - - it "should return a 404 error if milestone id not found" do - get api("/projects/#{project.id}/milestones/1234", user) - response.status.should == 404 - end end describe "POST /projects/:id/milestones" do it "should create a new project milestone" do - post api("/projects/#{project.id}/milestones", user), title: 'new milestone' + post api("/projects/#{project.id}/milestones", user), + title: 'new milestone' response.status.should == 201 json_response['title'].should == 'new milestone' json_response['description'].should be_nil end - - it "should create a new project milestone with description and due date" do - post api("/projects/#{project.id}/milestones", user), - title: 'new milestone', description: 'release', due_date: '2013-03-02' - response.status.should == 201 - json_response['description'].should == 'release' - json_response['due_date'].should == '2013-03-02' - end - - it "should return a 400 error if title is missing" do - post api("/projects/#{project.id}/milestones", user) - response.status.should == 400 - end end describe "PUT /projects/:id/milestones/:milestone_id" do @@ -70,21 +43,5 @@ describe Gitlab::API do response.status.should == 200 json_response['title'].should == 'updated title' end - - it "should return a 404 error if milestone id not found" do - put api("/projects/#{project.id}/milestones/1234", user), - title: 'updated title' - response.status.should == 404 - end - end - - describe "PUT /projects/:id/milestones/:milestone_id to close milestone" do - it "should update a project milestone" do - put api("/projects/#{project.id}/milestones/#{milestone.id}", user), - state_event: 'close' - response.status.should == 200 - - json_response['state'].should == 'closed' - end end end diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 90164083..ae4fc111 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -6,10 +6,8 @@ describe Gitlab::API do let(:user) { create(:user) } let!(:project) { create(:project, namespace: user.namespace ) } let!(:issue) { create(:issue, project: project, author: user) } - let!(:merge_request) { create(:merge_request, project: project, author: user) } let!(:snippet) { create(:snippet, project: project, author: user) } let!(:issue_note) { create(:note, noteable: issue, project: project, author: user) } - let!(:merge_request_note) { create(:note, noteable: merge_request, 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.team << [user, :reporter] } @@ -38,11 +36,6 @@ describe Gitlab::API do response.status.should == 200 json_response['body'].should == wall_note.note end - - it "should return a 404 error if note not found" do - get api("/projects/#{project.id}/notes/123", user) - response.status.should == 404 - end end describe "POST /projects/:id/notes" do @@ -51,16 +44,6 @@ describe Gitlab::API do response.status.should == 201 json_response['body'].should == 'hi!' end - - it "should return 401 unauthorized error" do - post api("/projects/#{project.id}/notes") - response.status.should == 401 - end - - it "should return a 400 bad request if body is missing" do - post api("/projects/#{project.id}/notes", user) - response.status.should == 400 - end end describe "GET /projects/:id/noteable/:noteable_id/notes" do @@ -71,11 +54,6 @@ describe Gitlab::API do json_response.should be_an Array json_response.first['body'].should == issue_note.note end - - it "should return a 404 error when issue id not found" do - get api("/projects/#{project.id}/issues/123/notes", user) - response.status.should == 404 - end end context "when noteable is a Snippet" do @@ -85,25 +63,6 @@ describe Gitlab::API do json_response.should be_an Array json_response.first['body'].should == snippet_note.note end - - it "should return a 404 error when snippet id not found" do - get api("/projects/#{project.id}/snippets/42/notes", user) - response.status.should == 404 - end - end - - context "when noteable is a Merge Request" do - it "should return an array of merge_requests notes" do - get api("/projects/#{project.id}/merge_requests/#{merge_request.id}/notes", user) - response.status.should == 200 - json_response.should be_an Array - json_response.first['body'].should == merge_request_note.note - end - - it "should return a 404 error if merge request id not found" do - get api("/projects/#{project.id}/merge_requests/4444/notes", user) - response.status.should == 404 - end end end @@ -114,11 +73,6 @@ describe Gitlab::API do response.status.should == 200 json_response['body'].should == issue_note.note end - - it "should return a 404 error if issue note not found" do - get api("/projects/#{project.id}/issues/#{issue.id}/notes/123", user) - response.status.should == 404 - end end context "when noteable is a Snippet" do @@ -127,11 +81,6 @@ describe Gitlab::API do response.status.should == 200 json_response['body'].should == snippet_note.note end - - it "should return a 404 error if snippet note not found" do - get api("/projects/#{project.id}/snippets/#{snippet.id}/notes/123", user) - response.status.should == 404 - end end end @@ -143,16 +92,6 @@ describe Gitlab::API do json_response['body'].should == 'hi!' json_response['author']['email'].should == user.email end - - it "should return a 400 bad request error if body not given" do - post api("/projects/#{project.id}/issues/#{issue.id}/notes", user) - response.status.should == 400 - end - - it "should return a 401 unauthorized error if user not authenticated" do - post api("/projects/#{project.id}/issues/#{issue.id}/notes"), body: 'hi!' - response.status.should == 401 - end end context "when noteable is a Snippet" do @@ -162,16 +101,6 @@ describe Gitlab::API do json_response['body'].should == 'hi!' json_response['author']['email'].should == user.email end - - it "should return a 400 bad request error if body not given" do - post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user) - response.status.should == 400 - end - - it "should return a 401 unauthorized error if user not authenticated" do - post api("/projects/#{project.id}/snippets/#{snippet.id}/notes"), body: 'hi!' - response.status.should == 401 - end end end end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index aca3919a..c2244210 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -6,14 +6,11 @@ describe Gitlab::API do let(:user) { create(:user) } let(:user2) { create(:user) } let(:user3) { create(:user) } - let(:admin) { create(:admin) } - let!(:project) { create(:project_with_code, creator_id: user.id) } let!(:hook) { create(:project_hook, project: project, url: "http://example.com") } + 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) } - let(:key) { create(:key, project: project) } - before { project.team << [user, :reporter] } describe "GET /projects" do @@ -36,20 +33,6 @@ describe Gitlab::API do end describe "POST /projects" do - context "maximum number of projects reached" do - before do - (1..user2.projects_limit).each do |project| - post api("/projects", user2), name: "foo#{project}" - end - end - - it "should not create new project" do - expect { - post api("/projects", user2), name: 'foo' - }.to change {Project.count}.by(0) - end - end - it "should create new project without path" do expect { post api("/projects", user), name: 'foo' }.to change {Project.count}.by(1) end @@ -58,72 +41,13 @@ describe Gitlab::API do expect { post api("/projects", user) }.to_not change {Project.count} end - it "should return a 400 error if name not given" do - post api("/projects", user) - response.status.should == 400 - end - - it "should create last project before reaching project limit" do - (1..user2.projects_limit-1).each { |p| post api("/projects", user2), name: "foo#{p}" } - post api("/projects", user2), name: "foo" - response.status.should == 201 - end - it "should respond with 201 on success" do post api("/projects", user), name: 'foo' response.status.should == 201 end - it "should respond with 400 if name is not given" do - post api("/projects", user) - response.status.should == 400 - end - - it "should return a 403 error if project limit reached" do - (1..user.projects_limit).each do |p| - post api("/projects", user), name: "foo#{p}" - end - post api("/projects", user), name: 'bar' - response.status.should == 403 - end - - it "should assign attributes to project" do - project = attributes_for(:project, { - description: Faker::Lorem.sentence, - default_branch: 'stable', - issues_enabled: false, - wall_enabled: false, - merge_requests_enabled: false, - wiki_enabled: false - }) - - post api("/projects", user), project - - project.each_pair do |k,v| - next if k == :path - json_response[k.to_s].should == v - end - end - end - - describe "POST /projects/user/:id" do - before { admin } - - it "should create new project without path" do - expect { post api("/projects/user/#{user.id}", admin), name: 'foo' }.to change {Project.count}.by(1) - end - - it "should not create new project without name" do - expect { post api("/projects/user/#{user.id}", admin) }.to_not change {Project.count} - end - - it "should respond with 201 on success" do - post api("/projects/user/#{user.id}", admin), name: 'foo' - response.status.should == 201 - end - it "should respond with 404 on failure" do - post api("/projects/user/#{user.id}", admin) + post api("/projects", user) response.status.should == 404 end @@ -137,7 +61,7 @@ describe Gitlab::API do wiki_enabled: false }) - post api("/projects/user/#{user.id}", admin), project + post api("/projects", user), project project.each_pair do |k,v| next if k == :path @@ -165,12 +89,6 @@ describe Gitlab::API do response.status.should == 404 json_response['message'].should == '404 Not Found' end - - it "should return a 404 error if user is not a member" do - other_user = create(:user) - get api("/projects/#{project.id}", other_user) - response.status.should == 404 - end end describe "GET /projects/:id/repository/branches" do @@ -189,56 +107,6 @@ describe Gitlab::API do json_response['name'].should == 'new_design' json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1' - json_response['protected'].should == false - end - - it "should return a 404 error if branch is not available" do - get api("/projects/#{project.id}/repository/branches/unknown", user) - response.status.should == 404 - end - end - - describe "PUT /projects/:id/repository/branches/:branch/protect" do - it "should protect a single branch" do - put api("/projects/#{project.id}/repository/branches/new_design/protect", user) - response.status.should == 200 - - json_response['name'].should == 'new_design' - json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1' - json_response['protected'].should == true - end - - it "should return a 404 error if branch not found" do - put api("/projects/#{project.id}/repository/branches/unknown/protect", user) - response.status.should == 404 - end - - it "should return success when protect branch again" do - put api("/projects/#{project.id}/repository/branches/new_design/protect", user) - put api("/projects/#{project.id}/repository/branches/new_design/protect", user) - response.status.should == 200 - end - end - - describe "PUT /projects/:id/repository/branches/:branch/unprotect" do - it "should unprotect a single branch" do - put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user) - response.status.should == 200 - - json_response['name'].should == 'new_design' - json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1' - json_response['protected'].should == false - end - - it "should return success when unprotect branch" do - put api("/projects/#{project.id}/repository/branches/unknown/unprotect", user) - response.status.should == 404 - end - - it "should return success when unprotect branch again" do - put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user) - put api("/projects/#{project.id}/repository/branches/new_design/unprotect", user) - response.status.should == 200 end end @@ -258,11 +126,6 @@ describe Gitlab::API do json_response.count.should == 1 json_response.first['email'].should == user.email end - - it "should return a 404 error if id not found" do - get api("/projects/9999/members", user) - response.status.should == 404 - end end describe "GET /projects/:id/members/:user_id" do @@ -272,11 +135,6 @@ describe Gitlab::API do json_response['email'].should == user.email json_response['access_level'].should == UsersProject::MASTER end - - it "should return a 404 error if user id not found" do - get api("/projects/#{project.id}/members/1234", user) - response.status.should == 404 - end end describe "POST /projects/:id/members" do @@ -290,34 +148,6 @@ describe Gitlab::API do json_response['email'].should == user2.email json_response['access_level'].should == UsersProject::DEVELOPER end - - it "should return a 201 status if user is already project member" do - post api("/projects/#{project.id}/members", user), user_id: user2.id, - access_level: UsersProject::DEVELOPER - expect { - post api("/projects/#{project.id}/members", user), user_id: user2.id, - access_level: UsersProject::DEVELOPER - }.not_to change { UsersProject.count }.by(1) - - response.status.should == 201 - json_response['email'].should == user2.email - json_response['access_level'].should == UsersProject::DEVELOPER - end - - it "should return a 400 error when user id is not given" do - post api("/projects/#{project.id}/members", user), access_level: UsersProject::MASTER - response.status.should == 400 - end - - it "should return a 400 error when access level is not given" do - post api("/projects/#{project.id}/members", user), user_id: user2.id - response.status.should == 400 - end - - it "should return a 422 error when access level is not known" do - post api("/projects/#{project.id}/members", user), user_id: user2.id, access_level: 1234 - response.status.should == 422 - end end describe "PUT /projects/:id/members/:user_id" do @@ -327,21 +157,6 @@ describe Gitlab::API do json_response['email'].should == user3.email json_response['access_level'].should == UsersProject::MASTER end - - it "should return a 404 error if user_id is not found" do - put api("/projects/#{project.id}/members/1234", user), access_level: UsersProject::MASTER - response.status.should == 404 - end - - it "should return a 400 error when access level is not given" do - put api("/projects/#{project.id}/members/#{user3.id}", user) - response.status.should == 400 - end - - it "should return a 422 error when access level is not known" do - put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: 123 - response.status.should == 422 - end end describe "DELETE /projects/:id/members/:user_id" do @@ -350,76 +165,25 @@ describe Gitlab::API do delete api("/projects/#{project.id}/members/#{user3.id}", user) }.to change { UsersProject.count }.by(-1) end - - it "should return 200 if team member is not part of a project" do - delete api("/projects/#{project.id}/members/#{user3.id}", user) - expect { - delete api("/projects/#{project.id}/members/#{user3.id}", user) - }.to_not change { UsersProject.count }.by(1) - end - - it "should return 200 if team member already removed" do - delete api("/projects/#{project.id}/members/#{user3.id}", user) - delete api("/projects/#{project.id}/members/#{user3.id}", user) - response.status.should == 200 - end - end - - describe "DELETE /projects/:id/members/:user_id" do - it "should return 200 OK when the user was not member" do - expect { - delete api("/projects/#{project.id}/members/1000000", user) - }.to change { UsersProject.count }.by(0) - response.status.should == 200 - json_response['message'].should == "Access revoked" - json_response['id'].should == 1000000 - end end describe "GET /projects/:id/hooks" do - context "authorized user" do - it "should return project hooks" do - get api("/projects/#{project.id}/hooks", user) - response.status.should == 200 + it "should return project hooks" do + get api("/projects/#{project.id}/hooks", user) - json_response.should be_an Array - json_response.count.should == 1 - json_response.first['url'].should == "http://example.com" - end - end + response.status.should == 200 - context "unauthorized user" do - it "should not access project hooks" do - get api("/projects/#{project.id}/hooks", user3) - response.status.should == 403 - end + json_response.should be_an Array + json_response.count.should == 1 + json_response.first['url'].should == "http://example.com" end end describe "GET /projects/:id/hooks/:hook_id" do - context "authorized user" do - it "should return a project hook" do - get api("/projects/#{project.id}/hooks/#{hook.id}", user) - response.status.should == 200 - json_response['url'].should == hook.url - end - - it "should return a 404 error if hook id is not available" do - get api("/projects/#{project.id}/hooks/1234", user) - response.status.should == 404 - end - end - - context "unauthorized user" do - it "should not access an existing hook" do - get api("/projects/#{project.id}/hooks/#{hook.id}", user3) - response.status.should == 403 - end - end - - it "should return a 404 error if hook id is not available" do - get api("/projects/#{project.id}/hooks/1234", user) - response.status.should == 404 + it "should return a project hook" do + get api("/projects/#{project.id}/hooks/#{hook.id}", user) + response.status.should == 200 + json_response['url'].should == hook.url end end @@ -427,19 +191,8 @@ describe Gitlab::API do it "should add hook to project" do expect { post api("/projects/#{project.id}/hooks", user), - url: "http://example.com" + "url" => "http://example.com" }.to change {project.hooks.count}.by(1) - response.status.should == 201 - end - - it "should return a 400 error if url not given" do - post api("/projects/#{project.id}/hooks", user) - response.status.should == 400 - end - - it "should return a 422 error if url not valid" do - post api("/projects/#{project.id}/hooks", user), "url" => "ftp://example.com" - response.status.should == 422 end end @@ -450,44 +203,15 @@ describe Gitlab::API do response.status.should == 200 json_response['url'].should == 'http://example.org' end - - it "should return 404 error if hook id not found" do - put api("/projects/#{project.id}/hooks/1234", user), url: 'http://example.org' - response.status.should == 404 - end - - it "should return 400 error if url is not given" do - put api("/projects/#{project.id}/hooks/#{hook.id}", user) - response.status.should == 400 - end - - it "should return a 422 error if url is not valid" do - put api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'ftp://example.com' - response.status.should == 422 - end end + describe "DELETE /projects/:id/hooks" do it "should delete hook from project" do expect { - delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id + delete api("/projects/#{project.id}/hooks", user), + hook_id: hook.id }.to change {project.hooks.count}.by(-1) - response.status.should == 200 - end - - it "should return success when deleting hook" do - delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id - response.status.should == 200 - end - - it "should return success when deleting non existent hook" do - delete api("/projects/#{project.id}/hooks", user), hook_id: 42 - response.status.should == 200 - end - - it "should return a 400 error if hook id not given" do - delete api("/projects/#{project.id}/hooks", user) - response.status.should == 400 end end @@ -536,11 +260,6 @@ describe Gitlab::API do response.status.should == 200 json_response['title'].should == snippet.title end - - it "should return a 404 error if snippet id not found" do - get api("/projects/#{project.id}/snippets/1234", user) - response.status.should == 404 - end end describe "POST /projects/:id/snippets" do @@ -550,24 +269,6 @@ describe Gitlab::API do response.status.should == 201 json_response['title'].should == 'api test' end - - it "should return a 400 error if title is not given" do - post api("/projects/#{project.id}/snippets", user), - file_name: 'sample.rb', code: 'test' - response.status.should == 400 - end - - it "should return a 400 error if file_name not given" do - post api("/projects/#{project.id}/snippets", user), - title: 'api test', code: 'test' - response.status.should == 400 - end - - it "should return a 400 error if code not given" do - post api("/projects/#{project.id}/snippets", user), - title: 'api test', file_name: 'sample.rb' - response.status.should == 400 - end end describe "PUT /projects/:id/snippets/:shippet_id" do @@ -578,13 +279,6 @@ describe Gitlab::API do json_response['title'].should == 'example' snippet.reload.content.should == 'updated code' end - - it "should update an existing project snippet with new title" do - put api("/projects/#{project.id}/snippets/#{snippet.id}", user), - title: 'other api test' - response.status.should == 200 - json_response['title'].should == 'other api test' - end end describe "DELETE /projects/:id/snippets/:snippet_id" do @@ -592,12 +286,6 @@ describe Gitlab::API do expect { delete api("/projects/#{project.id}/snippets/#{snippet.id}", user) }.to change { Snippet.count }.by(-1) - response.status.should == 200 - end - - it "should return success when deleting unknown snippet id" do - delete api("/projects/#{project.id}/snippets/1234", user) - response.status.should == 200 end end @@ -606,14 +294,9 @@ describe Gitlab::API do get api("/projects/#{project.id}/snippets/#{snippet.id}/raw", user) response.status.should == 200 end - - it "should return a 404 error if raw project snippet not found" do - get api("/projects/#{project.id}/snippets/5555/raw", user) - response.status.should == 404 - end end - describe "GET /projects/:id/repository/commits/:sha/blob" do + describe "GET /projects/:id/:sha/blob" do it "should get the raw file contents" do get api("/projects/#{project.id}/repository/commits/master/blob?filepath=README.md", user) response.status.should == 200 @@ -628,65 +311,5 @@ describe Gitlab::API do get api("/projects/#{project.id}/repository/commits/master/blob?filepath=README.invalid", user) response.status.should == 404 end - - it "should return a 400 error if filepath is missing" do - get api("/projects/#{project.id}/repository/commits/master/blob", user) - response.status.should == 400 - end - end - - describe "GET /projects/:id/keys" do - it "should return array of ssh keys" do - project.deploy_keys << key - project.save - get api("/projects/#{project.id}/keys", user) - response.status.should == 200 - json_response.should be_an Array - json_response.first['title'].should == key.title - end - end - - describe "GET /projects/:id/keys/:key_id" do - it "should return a single key" do - project.deploy_keys << key - project.save - get api("/projects/#{project.id}/keys/#{key.id}", user) - response.status.should == 200 - json_response['title'].should == key.title - end - - it "should return 404 Not Found with invalid ID" do - get api("/projects/#{project.id}/keys/404", user) - response.status.should == 404 - end - end - - describe "POST /projects/:id/keys" do - it "should not create an invalid ssh key" do - post api("/projects/#{project.id}/keys", user), { title: "invalid key" } - response.status.should == 404 - end - - it "should create new ssh key" do - key_attrs = attributes_for :key - expect { - post api("/projects/#{project.id}/keys", user), key_attrs - }.to change{ project.deploy_keys.count }.by(1) - end - end - - describe "DELETE /projects/:id/keys/:key_id" do - it "should delete existing key" do - project.deploy_keys << key - project.save - expect { - delete api("/projects/#{project.id}/keys/#{key.id}", user) - }.to change{ project.deploy_keys.count }.by(-1) - end - - it "should return 404 Not Found with invalid ID" do - delete api("/projects/#{project.id}/keys/404", user) - response.status.should == 404 - end end end diff --git a/spec/requests/api/session_spec.rb b/spec/requests/api/session_spec.rb index 4a37312b..afae8be8 100644 --- a/spec/requests/api/session_spec.rb +++ b/spec/requests/api/session_spec.rb @@ -13,10 +13,6 @@ describe Gitlab::API do json_response['email'].should == user.email json_response['private_token'].should == user.private_token - json_response['is_admin'].should == user.is_admin? - json_response['can_create_team'].should == user.can_create_team? - json_response['can_create_project'].should == user.can_create_project? - json_response['can_create_group'].should == user.can_create_group? end end @@ -39,15 +35,5 @@ describe Gitlab::API do json_response['private_token'].should be_nil end end - - context "when empty name" do - it "should return authentication error" do - post api("/session"), password: user.password - response.status.should == 401 - - json_response['email'].should be_nil - json_response['private_token'].should be_nil - end - end end end diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb deleted file mode 100644 index fe1b324c..00000000 --- a/spec/requests/api/system_hooks_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'spec_helper' - -describe Gitlab::API do - include ApiHelpers - - let(:user) { create(:user) } - let(:admin) { create(:admin) } - let!(:hook) { create(:system_hook, url: "http://example.com") } - - before { stub_request(:post, hook.url) } - - describe "GET /hooks" do - context "when no user" do - it "should return authentication error" do - get api("/hooks") - response.status.should == 401 - end - end - - context "when not an admin" do - it "should return forbidden error" do - get api("/hooks", user) - response.status.should == 403 - end - end - - context "when authenticated as admin" do - it "should return an array of hooks" do - get api("/hooks", admin) - response.status.should == 200 - json_response.should be_an Array - json_response.first['url'].should == hook.url - end - end - end - - describe "POST /hooks" do - it "should create new hook" do - expect { - post api("/hooks", admin), url: 'http://example.com' - }.to change { SystemHook.count }.by(1) - end - - it "should respond with 400 if url not given" do - post api("/hooks", admin) - response.status.should == 400 - end - - it "should not create new hook without url" do - expect { - post api("/hooks", admin) - }.to_not change { SystemHook.count } - end - end - - describe "GET /hooks/:id" do - it "should return hook by id" do - get api("/hooks/#{hook.id}", admin) - response.status.should == 200 - json_response['event_name'].should == 'project_create' - end - - it "should return 404 on failure" do - get api("/hooks/404", admin) - response.status.should == 404 - end - end - - describe "DELETE /hooks/:id" do - it "should delete a hook" do - expect { - delete api("/hooks/#{hook.id}", admin) - }.to change { SystemHook.count }.by(-1) - end - - it "should return success if hook id not found" do - delete api("/hooks/12345", admin) - response.status.should == 200 - end - end -end \ No newline at end of file diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index b4688dd2..ee5f510a 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -31,181 +31,55 @@ describe Gitlab::API do response.status.should == 200 json_response['email'].should == user.email end - - it "should return a 401 if unauthenticated" do - get api("/users/9998") - response.status.should == 401 - end - - it "should return a 404 error if user id not found" do - get api("/users/9999", user) - response.status.should == 404 - end end describe "POST /users" do before{ admin } + it "should not create invalid user" do + post api("/users", admin), { email: "invalid email" } + response.status.should == 404 + end + it "should create user" do expect { post api("/users", admin), attributes_for(:user, projects_limit: 3) }.to change { User.count }.by(1) end - it "should return 201 Created on success" do - post api("/users", admin), attributes_for(:user, projects_limit: 3) - response.status.should == 201 - end - - it "should not create user with invalid email" do - post api("/users", admin), { email: "invalid email", password: 'password' } - response.status.should == 400 - end - - it "should return 400 error if password not given" do - post api("/users", admin), { email: 'test@example.com' } - response.status.should == 400 - end - - it "should return 400 error if email not given" do - post api("/users", admin), { password: 'pass1234' } - response.status.should == 400 - end - it "shouldn't available for non admin users" do post api("/users", user), attributes_for(:user) response.status.should == 403 end + end - context "with existing user" do - before { post api("/users", admin), { email: 'test@example.com', password: 'password', username: 'test' } } - - it "should not create user with same email" do - expect { - post api("/users", admin), { email: 'test@example.com', password: 'password' } - }.to change { User.count }.by(0) - end - - it "should return 409 conflict error if user with email exists" do - post api("/users", admin), { email: 'test@example.com', password: 'password' } - end - - it "should return 409 conflict error if same username exists" do - post api("/users", admin), { email: 'foo@example.com', password: 'pass', username: 'test' } - end + describe "GET /users/sign_up" do + before do + Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) + end + it "should redirect to sign in page if signup is disabled" do + get "/users/sign_up" + response.status.should == 302 + response.should redirect_to(new_user_session_path) end end describe "GET /users/sign_up" do - context 'enabled' do - before do - Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) - end - - it "should return sign up page if signup is enabled" do - get "/users/sign_up" - response.status.should == 200 - end + before do + Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) end - - context 'disabled' do - before do - Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) - end - - it "should redirect to sign in page if signup is disabled" do - get "/users/sign_up" - response.status.should == 302 - response.should redirect_to(new_user_session_path) - end - end - end - - describe "PUT /users/:id" do - before { admin } - - it "should update user with new bio" do - put api("/users/#{user.id}", admin), {bio: 'new test bio'} + it "should return sign up page if signup is enabled" do + get "/users/sign_up" response.status.should == 200 - json_response['bio'].should == 'new test bio' - user.reload.bio.should == 'new test bio' end - - it "should not allow invalid update" do - put api("/users/#{user.id}", admin), {email: 'invalid email'} - response.status.should == 404 - user.reload.email.should_not == 'invalid email' - end - - it "shouldn't available for non admin users" do - put api("/users/#{user.id}", user), attributes_for(:user) - response.status.should == 403 - end - - it "should return 404 for non-existing user" do - put api("/users/999999", admin), {bio: 'update should fail'} - response.status.should == 404 - end - - context "with existing user" do - before { - post api("/users", admin), { email: 'test@example.com', password: 'password', username: 'test', name: 'test' } - post api("/users", admin), { email: 'foo@bar.com', password: 'password', username: 'john', name: 'john' } - @user_id = User.all.last.id - } - -# it "should return 409 conflict error if email address exists" do -# put api("/users/#{@user_id}", admin), { email: 'test@example.com' } -# response.status.should == 409 -# end -# -# it "should return 409 conflict error if username taken" do -# @user_id = User.all.last.id -# put api("/users/#{@user_id}", admin), { username: 'test' } -# response.status.should == 409 -# end - end - end - - describe "POST /users/:id/keys" do - before { admin } - - it "should not create invalid ssh key" do - post api("/users/#{user.id}/keys", admin), { title: "invalid key" } - response.status.should == 404 - end - - it "should create ssh key" do - key_attrs = attributes_for :key - expect { - post api("/users/#{user.id}/keys", admin), key_attrs - }.to change{ user.keys.count }.by(1) - end - end - - describe "DELETE /users/:id" do - before { admin } - - it "should delete user" do - delete api("/users/#{user.id}", admin) - response.status.should == 200 - expect { User.find(user.id) }.to raise_error ActiveRecord::RecordNotFound - json_response['email'].should == user.email - end - - it "should not delete for unauthenticated user" do - delete api("/users/#{user.id}") - response.status.should == 401 - end - - it "shouldn't available for non admin users" do - delete api("/users/#{user.id}", user) - response.status.should == 403 - end - - it "should return 404 for non-existing user" do - delete api("/users/999999", admin) - response.status.should == 404 + it "should create a new user account" do + visit new_user_registration_path + fill_in "user_name", with: "Name Surname" + fill_in "user_username", with: "Great" + fill_in "user_email", with: "name@mail.com" + fill_in "user_password", with: "password1234" + fill_in "user_password_confirmation", with: "password1234" + expect { click_button "Sign up" }.to change {User.count}.by(1) end end @@ -214,15 +88,6 @@ describe Gitlab::API do get api("/user", user) response.status.should == 200 json_response['email'].should == user.email - json_response['is_admin'].should == user.is_admin? - json_response['can_create_team'].should == user.can_create_team? - json_response['can_create_project'].should == user.can_create_project? - json_response['can_create_group'].should == user.can_create_group? - end - - it "should return 401 error if user is unauthenticated" do - get api("/user") - response.status.should == 401 end end @@ -259,38 +124,19 @@ describe Gitlab::API do get api("/user/keys/42", user) response.status.should == 404 end - - it "should return 404 error if admin accesses user's ssh key" do - user.keys << key - user.save - admin - get api("/user/keys/#{key.id}", admin) - response.status.should == 404 - end end describe "POST /user/keys" do + it "should not create invalid ssh key" do + post api("/user/keys", user), { title: "invalid key" } + response.status.should == 404 + end + it "should create ssh key" do key_attrs = attributes_for :key expect { post api("/user/keys", user), key_attrs }.to change{ user.keys.count }.by(1) - response.status.should == 201 - end - - it "should return a 401 error if unauthorized" do - post api("/user/keys"), title: 'some title', key: 'some key' - response.status.should == 401 - end - - it "should not create ssh key without key" do - post api("/user/keys", user), title: 'title' - response.status.should == 400 - end - - it "should not create ssh key without title" do - post api("/user/keys", user), key: "somekey" - response.status.should == 400 end end @@ -301,19 +147,11 @@ describe Gitlab::API do expect { delete api("/user/keys/#{key.id}", user) }.to change{user.keys.count}.by(-1) - response.status.should == 200 end - it "should return success if key ID not found" do + it "should return 404 Not Found within invalid ID" do delete api("/user/keys/42", user) - response.status.should == 200 - end - - it "should return 401 error if unauthorized" do - user.keys << key - user.save - delete api("/user/keys/#{key.id}") - response.status.should == 401 + response.status.should == 404 end end end diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/requests/atom/dashboard_issues_spec.rb similarity index 93% rename from spec/features/atom/dashboard_issues_spec.rb rename to spec/requests/atom/dashboard_issues_spec.rb index 6f5d51d1..8ce64cd4 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/requests/atom/dashboard_issues_spec.rb @@ -10,7 +10,7 @@ describe "Dashboard Issues Feed" do describe "atom feed" do it "should render atom feed via private token" do - visit issues_dashboard_path(:atom, private_token: user.private_token) + visit dashboard_issues_path(:atom, private_token: user.private_token) page.response_headers['Content-Type'].should have_content("application/atom+xml") page.body.should have_selector("title", text: "#{user.name} issues") diff --git a/spec/features/atom/dashboard_spec.rb b/spec/requests/atom/dashboard_spec.rb similarity index 100% rename from spec/features/atom/dashboard_spec.rb rename to spec/requests/atom/dashboard_spec.rb diff --git a/spec/features/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb similarity index 100% rename from spec/features/atom/issues_spec.rb rename to spec/requests/atom/issues_spec.rb diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb similarity index 81% rename from spec/features/gitlab_flavored_markdown_spec.rb rename to spec/requests/gitlab_flavored_markdown_spec.rb index 653ff865..9a568511 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/requests/gitlab_flavored_markdown_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe "Gitlab Flavored Markdown" do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:issue) { create(:issue, project: project) } let(:merge_request) { create(:merge_request, project: project) } let(:fred) do @@ -169,32 +169,55 @@ describe "Gitlab Flavored Markdown" do describe "for notes" do it "should render in commits#show", js: true do visit project_commit_path(project, commit) - within ".new_note.js-main-target-form" do - fill_in "note_note", with: "see ##{issue.id}" - click_button "Add Comment" - end + fill_in "note_note", with: "see ##{issue.id}" + click_button "Add Comment" page.should have_link("##{issue.id}") end it "should render in issue#show", js: true do visit project_issue_path(project, issue) - within ".new_note.js-main-target-form" do - fill_in "note_note", with: "see ##{issue.id}" - click_button "Add Comment" - end + fill_in "note_note", with: "see ##{issue.id}" + click_button "Add Comment" page.should have_link("##{issue.id}") end it "should render in merge_request#show", js: true do visit project_merge_request_path(project, merge_request) - within ".new_note.js-main-target-form" do - fill_in "note_note", with: "see ##{issue.id}" - click_button "Add Comment" - end + fill_in "note_note", with: "see ##{issue.id}" + click_button "Add Comment" + + page.should have_link("##{issue.id}") + end + + it "should render in projects#wall", js: true do + visit wall_project_path(project) + fill_in "note_note", with: "see ##{issue.id}" + click_button "Add Comment" page.should have_link("##{issue.id}") end end + + + describe "for wikis" do + before do + visit project_wiki_path(project, :index) + fill_in "Title", with: "Circumvent ##{issue.id}" + fill_in "Content", with: "# Other pages\n\n* [Foo](foo)\n* [Bar](bar)\n\nAlso look at ##{issue.id} :-)" + click_on "Save" + end + + it "should NOT render title in wikis#show" do + within(".content h3") do # page title + page.should have_content("Circumvent ##{issue.id}") + page.should_not have_link("##{issue.id}") + end + end + + it "should render content in wikis#show" do + page.should have_link("##{issue.id}") + end + end end diff --git a/spec/features/issues_spec.rb b/spec/requests/issues_spec.rb similarity index 98% rename from spec/features/issues_spec.rb rename to spec/requests/issues_spec.rb index 6fff59f0..2e94ffd0 100644 --- a/spec/features/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -58,7 +58,8 @@ describe "Issues" do it "should be able to search on different statuses" do issue = Issue.first # with title 'foobar' - issue.close + issue.closed = true + issue.save visit project_issues_path(project) click_link 'Closed' diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/requests/notes_on_merge_requests_spec.rb similarity index 92% rename from spec/features/notes_on_merge_requests_spec.rb rename to spec/requests/notes_on_merge_requests_spec.rb index 82f44279..2b670359 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/requests/notes_on_merge_requests_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe "On a merge request", js: true do - let!(:project) { create(:project_with_code) } + let!(:project) { create(:project) } let!(:merge_request) { create(:merge_request, project: project) } before do @@ -18,9 +18,14 @@ describe "On a merge request", js: true do it { should have_css(".js-main-target-form", visible: true, count: 1) } # button initalization - it { find(".js-main-target-form input[type=submit]").value.should == "Add Comment" } + it { within(".js-main-target-form") { should have_button("Add Comment") } } it { within(".js-main-target-form") { should_not have_link("Cancel") } } + # notifiactions + it { within(".js-main-target-form") { should have_checked_field("Project team") } } + it { within(".js-main-target-form") { should_not have_checked_field("Commit author") } } + it { within(".js-main-target-form") { should_not have_unchecked_field("Commit author") } } + describe "without text" do it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } end @@ -62,7 +67,7 @@ describe "On a merge request", js: true do end # note added - it { should have_content("This is awsome!") } + it { within(".js-main-target-form") { should have_content("This is awsome!") } } # reset form it { within(".js-main-target-form") { should have_no_field("note[note]", with: "This is awesome!") } } @@ -83,7 +88,7 @@ end describe "On a merge request diff", js: true, focus: true do - let!(:project) { create(:project_with_code) } + let!(:project) { create(:project) } let!(:merge_request) { create(:merge_request_with_diffs, project: project) } before do @@ -92,9 +97,7 @@ describe "On a merge request diff", js: true, focus: true do visit diffs_project_merge_request_path(project, merge_request) - within '.diffs-tab' do - click_link("Diff") - end + click_link("Diff") end subject { page } @@ -121,6 +124,9 @@ describe "On a merge request diff", js: true, focus: true do it { should have_button("Add Comment") } it { should have_css(".js-close-discussion-note-form", text: "Cancel") } + # notification options + it { should have_checked_field("Project team") } + it "shouldn't add a second form for same row" do find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder .js-add-diff-note-button").trigger("click") @@ -128,9 +134,7 @@ describe "On a merge request diff", js: true, focus: true do end it "should be removed when canceled" do - within(".file form[rel$='4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185']") do - find(".js-close-discussion-note-form").trigger("click") - end + find(".js-close-discussion-note-form").trigger("click") should have_no_css(".js-temp-notes-holder") end diff --git a/spec/requests/notes_on_wall_spec.rb b/spec/requests/notes_on_wall_spec.rb new file mode 100644 index 00000000..01673f99 --- /dev/null +++ b/spec/requests/notes_on_wall_spec.rb @@ -0,0 +1,85 @@ +require 'spec_helper' + +describe "On the project wall", js: true do + let!(:project) { create(:project) } + let!(:commit) { project.repository.commit("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } + + before do + login_as :user + project.team << [@user, :master] + visit wall_project_path(project) + end + + subject { page } + + describe "the note form" do + # main target form creation + it { should have_css(".js-main-target-form", visible: true, count: 1) } + + # button initalization + it { within(".js-main-target-form") { should have_button("Add Comment") } } + it { within(".js-main-target-form") { should_not have_link("Cancel") } } + + # notifiactions + it { within(".js-main-target-form") { should have_checked_field("Project team") } } + it { within(".js-main-target-form") { should_not have_checked_field("Commit author") } } + it { within(".js-main-target-form") { should_not have_unchecked_field("Commit author") } } + + describe "without text" do + it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } + end + + describe "with text" do + before do + within(".js-main-target-form") do + fill_in "note[note]", with: "This is awesome" + end + end + + it { within(".js-main-target-form") { should_not have_css(".js-comment-button[disabled]") } } + + it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: true) } } + end + + describe "with preview" do + before do + within(".js-main-target-form") do + fill_in "note[note]", with: "This is awesome" + find(".js-note-preview-button").trigger("click") + end + end + + it { within(".js-main-target-form") { should have_css(".js-note-preview", text: "This is awesome", visible: true) } } + + it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } + it { within(".js-main-target-form") { should have_css(".js-note-edit-button", visible: true) } } + end + end + + describe "when posting a note" do + before do + within(".js-main-target-form") do + fill_in "note[note]", with: "This is awsome!" + find(".js-note-preview-button").trigger("click") + click_button "Add Comment" + end + end + + # note added + it { within(".js-main-target-form") { should have_content("This is awsome!") } } + + # reset form + it { within(".js-main-target-form") { should have_no_field("note[note]", with: "This is awesome!") } } + + # return from preview + it { within(".js-main-target-form") { should have_css(".js-note-preview", visible: false) } } + it { within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } } + + + it "should be removable" do + find(".js-note-delete").trigger("click") + + should_not have_css(".note") + end + end +end diff --git a/spec/features/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb similarity index 100% rename from spec/features/projects_deploy_keys_spec.rb rename to spec/requests/projects_deploy_keys_spec.rb diff --git a/spec/features/projects_spec.rb b/spec/requests/projects_spec.rb similarity index 80% rename from spec/features/projects_spec.rb rename to spec/requests/projects_spec.rb index 1ffc28bf..7bc48260 100644 --- a/spec/features/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -11,7 +11,7 @@ describe "Projects" do end it "should be correct path" do - expect { click_link "Remove project" }.to change {Project.count}.by(-1) + expect { click_link "Remove" }.to change {Project.count}.by(-1) end end end diff --git a/spec/features/search_spec.rb b/spec/requests/search_spec.rb similarity index 70% rename from spec/features/search_spec.rb rename to spec/requests/search_spec.rb index 5ce4cae3..e338f359 100644 --- a/spec/features/search_spec.rb +++ b/spec/requests/search_spec.rb @@ -6,11 +6,8 @@ describe "Search" do @project = create(:project) @project.team << [@user, :reporter] visit search_path - - within '.search-holder' do - fill_in "search", with: @project.name[0..3] - click_button "Search" - end + fill_in "search", with: @project.name[0..3] + click_button "Search" end it "should show project in search results" do diff --git a/spec/features/security/profile_access_spec.rb b/spec/requests/security/profile_access_spec.rb similarity index 100% rename from spec/features/security/profile_access_spec.rb rename to spec/requests/security/profile_access_spec.rb diff --git a/spec/features/security/project_access_spec.rb b/spec/requests/security/project_access_spec.rb similarity index 85% rename from spec/features/security/project_access_spec.rb rename to spec/requests/security/project_access_spec.rb index cfbb8f13..a3517510 100644 --- a/spec/features/security/project_access_spec.rb +++ b/spec/requests/security/project_access_spec.rb @@ -14,7 +14,7 @@ describe "Application access" do end describe "Project" do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:master) { create(:user) } let(:guest) { create(:user) } @@ -33,7 +33,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -44,7 +44,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -55,7 +55,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -66,7 +66,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -77,7 +77,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -88,18 +88,18 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } end describe "GET /project_code/wall" do - subject { project_wall_path(project) } + subject { wall_project_path(project) } it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -114,7 +114,7 @@ describe "Application access" do it { @blob_path.should be_allowed_for master } it { @blob_path.should be_allowed_for reporter } - it { @blob_path.should be_allowed_for :admin } + it { @blob_path.should be_denied_for :admin } it { @blob_path.should be_denied_for guest } it { @blob_path.should be_denied_for :user } it { @blob_path.should be_denied_for :visitor } @@ -125,7 +125,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_denied_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -136,7 +136,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_denied_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -147,7 +147,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -158,7 +158,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -169,7 +169,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -180,7 +180,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -196,7 +196,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -212,7 +212,7 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } @@ -223,7 +223,18 @@ describe "Application access" do it { should be_allowed_for master } it { should be_allowed_for reporter } - it { should be_allowed_for :admin } + it { should be_denied_for :admin } + it { should be_denied_for guest } + it { should be_denied_for :user } + it { should be_denied_for :visitor } + end + + describe "GET /project_code/files" do + subject { files_project_path(project) } + + it { should be_allowed_for master } + it { should be_allowed_for reporter } + it { should be_denied_for :admin } it { should be_denied_for guest } it { should be_denied_for :user } it { should be_denied_for :visitor } diff --git a/spec/features/snippets_spec.rb b/spec/requests/snippets_spec.rb similarity index 98% rename from spec/features/snippets_spec.rb rename to spec/requests/snippets_spec.rb index 1a0f6eae..770e34dc 100644 --- a/spec/features/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -72,7 +72,7 @@ describe "Snippets" do author: @user, project: project) visit project_snippet_path(project, @snippet) - click_link "Edit Snippet" + click_link "Edit" end it "should open edit page" do diff --git a/spec/routing/admin_routing_spec.rb b/spec/routing/admin_routing_spec.rb index b6509fcb..fb26bf98 100644 --- a/spec/routing/admin_routing_spec.rb +++ b/spec/routing/admin_routing_spec.rb @@ -66,29 +66,49 @@ end # PUT /admin/projects/:id(.:format) admin/projects#update {:id=>/[^\/]+/} # DELETE /admin/projects/:id(.:format) admin/projects#destroy {:id=>/[^\/]+/} describe Admin::ProjectsController, "routing" do + it "to #team" do + get("/admin/projects/gitlab/team").should route_to('admin/projects#team', id: 'gitlab') + end + + it "to #team_update" do + put("/admin/projects/gitlab/team_update").should route_to('admin/projects#team_update', id: 'gitlab') + end + it "to #index" do get("/admin/projects").should route_to('admin/projects#index') end + it "to #edit" do + get("/admin/projects/gitlab/edit").should route_to('admin/projects#edit', id: 'gitlab') + end + it "to #show" do get("/admin/projects/gitlab").should route_to('admin/projects#show', id: 'gitlab') end -end - -# edit_admin_project_member GET /admin/projects/:project_id/members/:id/edit(.:format) admin/projects/members#edit {:id=>/[^\/]+/, :project_id=>/[^\/]+/} -# admin_project_member PUT /admin/projects/:project_id/members/:id(.:format) admin/projects/members#update {:id=>/[^\/]+/, :project_id=>/[^\/]+/} -# DELETE /admin/projects/:project_id/members/:id(.:format) admin/projects/members#destroy {:id=>/[^\/]+/, :project_id=>/[^\/]+/} -describe Admin::Projects::MembersController, "routing" do - it "to #edit" do - get("/admin/projects/test/members/1/edit").should route_to('admin/projects/members#edit', project_id: 'test', id: '1') - end it "to #update" do - put("/admin/projects/test/members/1").should route_to('admin/projects/members#update', project_id: 'test', id: '1') + put("/admin/projects/gitlab").should route_to('admin/projects#update', id: 'gitlab') end it "to #destroy" do - delete("/admin/projects/test/members/1").should route_to('admin/projects/members#destroy', project_id: 'test', id: '1') + delete("/admin/projects/gitlab").should route_to('admin/projects#destroy', id: 'gitlab') + end +end + +# edit_admin_team_member GET /admin/team_members/:id/edit(.:format) admin/team_members#edit +# admin_team_member PUT /admin/team_members/:id(.:format) admin/team_members#update +# DELETE /admin/team_members/:id(.:format) admin/team_members#destroy +describe Admin::TeamMembersController, "routing" do + it "to #edit" do + get("/admin/team_members/1/edit").should route_to('admin/team_members#edit', id: '1') + end + + it "to #update" do + put("/admin/team_members/1").should route_to('admin/team_members#update', id: '1') + end + + it "to #destroy" do + delete("/admin/team_members/1").should route_to('admin/team_members#destroy', id: '1') end end diff --git a/spec/routing/notifications_routing_spec.rb b/spec/routing/notifications_routing_spec.rb deleted file mode 100644 index 6880d281..00000000 --- a/spec/routing/notifications_routing_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require "spec_helper" - -describe NotificationsController do - describe "routing" do - it "routes to #show" do - get("/profile/notifications").should route_to("notifications#show") - end - - it "routes to #update" do - put("/profile/notifications").should route_to("notifications#update") - end - end -end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 41533f8b..61711416 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -56,6 +56,7 @@ end # projects POST /projects(.:format) projects#create # new_project GET /projects/new(.:format) projects#new # wall_project GET /:id/wall(.:format) projects#wall +# graph_project GET /:id/graph(.:format) projects#graph # files_project GET /:id/files(.:format) projects#files # edit_project GET /:id/edit(.:format) projects#edit # project GET /:id(.:format) projects#show @@ -71,7 +72,15 @@ describe ProjectsController, "routing" do end it "to #wall" do - get("/gitlabhq/wall").should route_to('walls#show', project_id: 'gitlabhq') + get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') + end + + it "to #graph" do + get("/gitlabhq/graph").should route_to('projects#graph', id: 'gitlabhq') + end + + it "to #files" do + get("/gitlabhq/files").should route_to('projects#files', id: 'gitlabhq') end it "to #edit" do @@ -193,7 +202,6 @@ describe RefsController, "routing" do it "to #logs_tree" do 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') - get("/gitlab/gitlabhq/refs/stable/logs_tree/files.scss").should route_to('refs#logs_tree', project_id: 'gitlab/gitlabhq', id: 'stable', path: 'files.scss') end end @@ -293,10 +301,6 @@ describe CommitsController, "routing" do let(:actions) { [:show] } let(:controller) { 'commits' } end - - it "to #show" do - get("/gitlab/gitlabhq/commits/master.atom").should route_to('commits#show', project_id: 'gitlab/gitlabhq', id: "master", format: "atom") - end end # project_team_members GET /:project_id/team_members(.:format) team_members#index @@ -381,7 +385,6 @@ end describe BlameController, "routing" do it "to #show" do get("/gitlabhq/blame/master/app/models/project.rb").should route_to('blame#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') - get("/gitlab/gitlabhq/blame/master/files.scss").should route_to('blame#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end @@ -389,8 +392,6 @@ end describe BlobController, "routing" do it "to #show" do get("/gitlabhq/blob/master/app/models/project.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') - get("/gitlabhq/blob/master/app/models/compare.rb").should route_to('blob#show', project_id: 'gitlabhq', id: 'master/app/models/compare.rb') - get("/gitlab/gitlabhq/blob/master/files.scss").should route_to('blob#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end @@ -398,7 +399,6 @@ end describe TreeController, "routing" do it "to #show" do get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb') - get("/gitlab/gitlabhq/tree/master/files.scss").should route_to('tree#show', project_id: 'gitlab/gitlabhq', id: 'master/files.scss') end end @@ -419,10 +419,3 @@ describe CompareController, "routing" do get("/gitlabhq/compare/issue/1234...stable").should route_to('compare#show', project_id: 'gitlabhq', from: 'issue/1234', to: 'stable') end end - -describe GraphController, "routing" do - it "to #show" do - get("/gitlabhq/graph/master").should route_to('graph#show', project_id: 'gitlabhq', id: 'master') - get("/gitlabhq/graph/master.json").should route_to('graph#show', project_id: 'gitlabhq', id: 'master', format: "json") - end -end diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 5ad8165e..57fd70e7 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -146,14 +146,14 @@ describe KeysController, "routing" do end end -# dashboard GET /dashboard(.:format) dashboard#show +# dashboard GET /dashboard(.:format) dashboard#index # dashboard_issues GET /dashboard/issues(.:format) dashboard#issues # dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests -# root / dashboard#show +# root / dashboard#index describe DashboardController, "routing" do it "to #index" do - get("/dashboard").should route_to('dashboard#show') - get("/").should route_to('dashboard#show') + get("/dashboard").should route_to('dashboard#index') + get("/").should route_to('dashboard#index') end it "to #issues" do diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb deleted file mode 100644 index 286a8cda..00000000 --- a/spec/services/git_push_service_spec.rb +++ /dev/null @@ -1,111 +0,0 @@ -require 'spec_helper' - -describe GitPushService do - let (:user) { create :user } - let (:project) { create :project_with_code } - let (:service) { GitPushService.new } - - before do - @oldrev = 'b98a310def241a6fd9c9a9a3e7934c48e498fe81' - @newrev = 'b19a04f53caeebf4fe5ec2327cb83e9253dc91bb' - @ref = 'refs/heads/master' - end - - describe "Git Push Data" do - before do - service.execute(project, user, @oldrev, @newrev, @ref) - @push_data = service.push_data - @commit = project.repository.commit(@newrev) - end - - subject { @push_data } - - it { should include(before: @oldrev) } - it { should include(after: @newrev) } - it { should include(ref: @ref) } - it { should include(user_id: user.id) } - it { should include(user_name: user.name) } - - context "with repository data" do - subject { @push_data[:repository] } - - it { should include(name: project.name) } - it { should include(url: project.url_to_repo) } - it { should include(description: project.description) } - it { should include(homepage: project.web_url) } - end - - context "with commits" do - subject { @push_data[:commits] } - - it { should be_an(Array) } - it { should have(1).element } - - context "the commit" do - subject { @push_data[:commits].first } - - it { should include(id: @commit.id) } - it { should include(message: @commit.safe_message) } - it { should include(timestamp: @commit.date.xmlschema) } - it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.code}/commit/#{@commit.id}") } - - context "with a author" do - subject { @push_data[:commits].first[:author] } - - it { should include(name: @commit.author_name) } - it { should include(email: @commit.author_email) } - end - end - end - end - - describe "Push Event" do - before do - service.execute(project, user, @oldrev, @newrev, @ref) - @event = Event.last - end - - it { @event.should_not be_nil } - it { @event.project.should == project } - it { @event.action.should == Event::PUSHED } - it { @event.data.should == service.push_data } - end - - describe "Web Hooks" do - context "with web hooks" do - before do - @project_hook = create(:project_hook) - @project_hook_2 = create(:project_hook) - project.hooks << [@project_hook, @project_hook_2] - - stub_request(:post, @project_hook.url) - stub_request(:post, @project_hook_2.url) - end - - it "executes multiple web hook" do - @project_hook.should_receive(:async_execute).once - @project_hook_2.should_receive(:async_execute).once - - service.execute(project, user, @oldrev, @newrev, @ref) - end - end - - context "does not execute web hooks" do - before do - @project_hook = create(:project_hook) - project.hooks << [@project_hook] - end - - it "when pushing a branch for the first time" do - @project_hook.should_not_receive(:execute) - service.execute(project, user, '00000000000000000000000000000000', 'newrev', 'refs/heads/master') - end - - it "when pushing tags" do - @project_hook.should_not_receive(:execute) - service.execute(project, user, 'newrev', 'newrev', 'refs/tags/v1.0.0') - end - end - end -end - diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb deleted file mode 100644 index fa47a635..00000000 --- a/spec/services/notification_service_spec.rb +++ /dev/null @@ -1,247 +0,0 @@ -require 'spec_helper' - -describe NotificationService do - # Disable observers to prevent factory trigger notification service - before(:all) { ActiveRecord::Base.observers.disable :all } - after(:all) { ActiveRecord::Base.observers.enable :all } - - let(:notification) { NotificationService.new } - - describe 'Keys' do - describe :new_key do - let(:key) { create(:personal_key) } - - it { notification.new_key(key).should be_true } - - it 'should sent email to key owner' do - Notify.should_receive(:new_ssh_key_email).with(key.id) - notification.new_key(key) - end - end - end - - describe 'Notes' do - context 'issue note' do - let(:issue) { create(:issue, assignee: create(:user)) } - let(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id) } - - before do - build_team(note.project) - end - - describe :new_note do - it do - should_email(@u_watcher.id) - should_email(note.noteable.author_id) - should_email(note.noteable.assignee_id) - should_not_email(note.author_id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.new_note(note) - end - - def should_email(user_id) - Notify.should_receive(:note_issue_email).with(user_id, note.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:note_issue_email).with(user_id, note.id) - end - end - end - - context 'commit note' do - let(:note) { create :note_on_commit } - - before do - build_team(note.project) - end - - describe :new_note do - it do - should_email(@u_watcher.id) - should_not_email(note.author_id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.new_note(note) - end - - it do - create(:note_on_commit, - author: @u_participating, - project_id: note.project_id, - commit_id: note.commit_id) - - should_email(@u_watcher.id) - should_email(@u_participating.id) - should_not_email(note.author_id) - should_not_email(@u_disabled.id) - notification.new_note(note) - end - - def should_email(user_id) - Notify.should_receive(:note_commit_email).with(user_id, note.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:note_commit_email).with(user_id, note.id) - end - end - end - end - - describe 'Issues' do - let(:issue) { create :issue, assignee: create(:user) } - - before do - build_team(issue.project) - end - - describe :new_issue do - it do - should_email(issue.assignee_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.new_issue(issue, @u_disabled) - end - - def should_email(user_id) - Notify.should_receive(:new_issue_email).with(user_id, issue.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:new_issue_email).with(user_id, issue.id) - end - end - - describe :reassigned_issue do - it 'should email new assignee' do - should_email(issue.assignee_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - - notification.reassigned_issue(issue, @u_disabled) - end - - def should_email(user_id) - Notify.should_receive(:reassigned_issue_email).with(user_id, issue.id, issue.assignee_id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:reassigned_issue_email).with(user_id, issue.id, issue.assignee_id) - end - end - - describe :close_issue do - it 'should sent email to issue assignee and issue author' do - should_email(issue.assignee_id) - should_email(issue.author_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - - notification.close_issue(issue, @u_disabled) - end - - def should_email(user_id) - Notify.should_receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:closed_issue_email).with(user_id, issue.id, @u_disabled.id) - end - end - end - - describe 'Merge Requests' do - let(:merge_request) { create :merge_request, assignee: create(:user) } - - before do - build_team(merge_request.project) - end - - describe :new_merge_request do - it do - should_email(merge_request.assignee_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.new_merge_request(merge_request, @u_disabled) - end - - def should_email(user_id) - Notify.should_receive(:new_merge_request_email).with(user_id, merge_request.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:new_merge_request_email).with(user_id, merge_request.id) - end - end - - describe :reassigned_merge_request do - it do - should_email(merge_request.assignee_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.reassigned_merge_request(merge_request, merge_request.author) - end - - def should_email(user_id) - Notify.should_receive(:reassigned_merge_request_email).with(user_id, merge_request.id, merge_request.assignee_id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:reassigned_merge_request_email).with(user_id, merge_request.id, merge_request.assignee_id) - end - end - - describe :closed_merge_request do - it do - should_email(merge_request.assignee_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.close_mr(merge_request, @u_disabled) - end - - def should_email(user_id) - Notify.should_receive(:closed_merge_request_email).with(user_id, merge_request.id, @u_disabled.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:closed_merge_request_email).with(user_id, merge_request.id, @u_disabled.id) - end - end - - describe :merged_merge_request do - it do - should_email(merge_request.assignee_id) - should_email(@u_watcher.id) - should_not_email(@u_participating.id) - should_not_email(@u_disabled.id) - notification.merge_mr(merge_request) - end - - def should_email(user_id) - Notify.should_receive(:merged_merge_request_email).with(user_id, merge_request.id) - end - - def should_not_email(user_id) - Notify.should_not_receive(:merged_merge_request_email).with(user_id, merge_request.id) - end - end - end - - def build_team(project) - @u_watcher = create(:user, notification_level: Notification::N_WATCH) - @u_participating = create(:user, notification_level: Notification::N_PARTICIPATING) - @u_disabled = create(:user, notification_level: Notification::N_DISABLED) - - project.team << [@u_watcher, :master] - project.team << [@u_participating, :master] - project.team << [@u_disabled, :master] - end -end diff --git a/spec/services/project_transfer_service_spec.rb b/spec/services/project_transfer_service_spec.rb deleted file mode 100644 index dea0b0b2..00000000 --- a/spec/services/project_transfer_service_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'spec_helper' - -describe ProjectTransferService do - context 'namespace -> namespace' do - let(:user) { create(:user) } - let(:group) { create(:group) } - let(:project) { create(:project, namespace: user.namespace) } - - before do - @result = service.transfer(project, group) - end - - it { @result.should be_true } - it { project.namespace.should == group } - end - - context 'namespace -> no namespace' do - let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } - - before do - @result = service.transfer(project, nil) - end - - it { @result.should be_true } - it { project.namespace.should == nil } - end - - context 'no namespace -> namespace' do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - @result = service.transfer(project, user.namespace) - end - - it { @result.should be_true } - it { project.namespace.should == user.namespace } - end - - def service - service = ProjectTransferService.new - service.gitlab_shell.stub(mv_repository: true) - service - end -end - diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb deleted file mode 100644 index 7f1590f5..00000000 --- a/spec/services/system_hooks_service_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'spec_helper' - -describe SystemHooksService do - let (:user) { create :user } - let (:project) { create :project } - let (:users_project) { create :users_project } - - context 'it should build event data' do - it 'should build event data for user' do - SystemHooksService.build_event_data(user, :create).should include(:event_name, :name, :created_at, :email) - end - - it 'should build event data for project' do - SystemHooksService.build_event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) - end - - it 'should build event data for users project' do - SystemHooksService.build_event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) - end - end - - context 'it should build event names' do - it 'should build event names for user' do - SystemHooksService.build_event_name(user, :create).should eq "user_create" - - SystemHooksService.build_event_name(user, :destroy).should eq "user_destroy" - end - - it 'should build event names for project' do - SystemHooksService.build_event_name(project, :create).should eq "project_create" - - SystemHooksService.build_event_name(project, :destroy).should eq "project_destroy" - end - - it 'should build event names for users project' do - SystemHooksService.build_event_name(users_project, :create).should eq "user_add_to_team" - - SystemHooksService.build_event_name(users_project, :destroy).should eq "user_remove_from_team" - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8a01c930..dbac3c54 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,58 +1,45 @@ -require 'rubygems' -require 'spork' +require 'simplecov' unless ENV['CI'] -Spork.prefork do - require 'simplecov' unless ENV['CI'] - if ENV['TRAVIS'] - require 'coveralls' - Coveralls.wear! - end +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' +require 'capybara/rails' +require 'capybara/rspec' +require 'webmock/rspec' +require 'email_spec' +require 'sidekiq/testing/inline' - # This file is copied to spec/ when you run 'rails generate rspec:install' - ENV["RAILS_ENV"] ||= 'test' - require File.expand_path("../../config/environment", __FILE__) - require 'rspec/rails' - require 'capybara/rails' - require 'capybara/rspec' - require 'webmock/rspec' - require 'email_spec' - require 'sidekiq/testing/inline' - require 'capybara/poltergeist' +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - # Loading more in this block will cause your tests to run faster. However, +require 'capybara/poltergeist' +Capybara.javascript_driver = :poltergeist - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it take effect. - Capybara.javascript_driver = :poltergeist - Capybara.default_wait_time = 10 +WebMock.disable_net_connect!(allow_localhost: true) - # Requires supporting ruby files with custom matchers and macros, etc, - # in spec/support/ and its subdirectories. - Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} +RSpec.configure do |config| + config.mock_with :rspec - WebMock.disable_net_connect!(allow_localhost: true) + config.include LoginHelpers, type: :request + config.include GitoliteStub + config.include FactoryGirl::Syntax::Methods + config.include Devise::TestHelpers, type: :controller - RSpec.configure do |config| - config.mock_with :rspec + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = false - config.include LoginHelpers, type: :feature - config.include LoginHelpers, type: :request - config.include FactoryGirl::Syntax::Methods - config.include Devise::TestHelpers, type: :controller + config.before do + stub_gitolite! - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = false - - config.before do - TestEnv.init - end + # Use tmp dir for FS manipulations + 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 - -Spork.each_run do - # This code will be run each time you run your specs. - -end diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb index 8c9c74f1..f1e072aa 100644 --- a/spec/support/db_cleaner.rb +++ b/spec/support/db_cleaner.rb @@ -9,14 +9,10 @@ RSpec.configure do |config| DatabaseCleaner.strategy = :transaction end - unless example.metadata[:no_db] - DatabaseCleaner.start - end + DatabaseCleaner.start end config.after do - unless example.metadata[:no_db] - DatabaseCleaner.clean - end + DatabaseCleaner.clean end end diff --git a/spec/support/gitolite_stub.rb b/spec/support/gitolite_stub.rb new file mode 100644 index 00000000..574bb5a1 --- /dev/null +++ b/spec/support/gitolite_stub.rb @@ -0,0 +1,21 @@ +module GitoliteStub + def stub_gitolite! + stub_gitlab_gitolite + stub_gitolite_admin + end + + def stub_gitolite_admin + gitolite_admin = double('Gitolite::GitoliteAdmin') + gitolite_admin.as_null_object + + Gitolite::GitoliteAdmin.stub(new: gitolite_admin) + end + + def stub_gitlab_gitolite + gitolite_config = double('Gitlab::GitoliteConfig') + gitolite_config.stub(apply: ->() { yield(self) }) + gitolite_config.as_null_object + + Gitlab::GitoliteConfig.stub(new: gitolite_config) + end +end diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index d423ccf8..4579c971 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -12,7 +12,7 @@ module LoginHelpers # user - User instance to login with def login_with(user) visit new_user_session_path - fill_in "user_login", with: user.email + fill_in "user_email", with: user.email fill_in "user_password", with: "123456" click_button "Sign in" end diff --git a/spec/support/select2_helper.rb b/spec/support/select2_helper.rb deleted file mode 100644 index 20dd9bf4..00000000 --- a/spec/support/select2_helper.rb +++ /dev/null @@ -1,25 +0,0 @@ -# Select2 ajax programatic helper -# It allows you to select value from select2 -# -# Params -# value - real value of selected item -# opts - options containing css selector -# -# Usage: -# -# select2(2, from: '#user_ids') -# - -module Select2Helper - def select2(value, options={}) - raise "Must pass a hash containing 'from'" if not options.is_a?(Hash) or not options.has_key?(:from) - - selector = options[:from] - - if options[:multiple] - page.execute_script("$('#{selector}').select2('val', ['#{value}']);") - else - page.execute_script("$('#{selector}').select2('val', '#{value}');") - end - end -end diff --git a/spec/support/stubbed_repository.rb b/spec/support/stubbed_repository.rb new file mode 100644 index 00000000..e6e194d7 --- /dev/null +++ b/spec/support/stubbed_repository.rb @@ -0,0 +1,34 @@ +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. +class Project + def repository + if path == "empty" || !path + nil + else + GitLabTestRepo.new(path_with_namespace) + end + end + + def satellite + FakeSatellite.new + end + + class FakeSatellite + def exists? + true + end + + def create + true + end + end +end + +class GitLabTestRepo < Repository + def repo + @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq')) + end +end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb deleted file mode 100644 index 370094d3..00000000 --- a/spec/support/test_env.rb +++ /dev/null @@ -1,63 +0,0 @@ -module TestEnv - extend self - - # Test environment - # - # all repositories and namespaces stored at - # RAILS_APP/tmp/test-git-base-path - # - # Next shell methods are stubbed and return true - # - mv_repository - # - remove_repository - # - add_key - # - remove_key - # - def init - # Use tmp dir for FS manipulations - repos_path = Rails.root.join('tmp', 'test-git-base-path') - Gitlab.config.gitlab_shell.stub(repos_path: repos_path) - - GollumWiki.any_instance.stub(:init_repo) do |path| - create_temp_repo(File.join(repos_path, "#{path}.git")) - end - - Gitlab::Shell.any_instance.stub( - add_repository: true, - mv_repository: true, - remove_repository: true, - add_key: true, - remove_key: true - ) - - Gitlab::Satellite::Satellite.any_instance.stub( - exists?: true, - destroy: true, - create: true - ) - - MergeRequest.any_instance.stub( - check_if_can_be_merged: true - ) - - Repository.any_instance.stub( - size: 12.45 - ) - - # Remove tmp/test-git-base-path - FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path - - # Recreate tmp/test-git-base-path - FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path - - # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq - seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq') - target_repo = File.join(repos_path, 'gitlabhq.git') - system("ln -s #{seed_repo} #{target_repo}") - end - - def create_temp_repo(path) - FileUtils.mkdir_p path - command = "git init --quiet --bare #{path};" - system(command) - end -end diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 46e86dbe..f408c89a 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -9,9 +9,9 @@ describe PostReceive do end context "web hook" do - let(:project) { create(:project_with_code) } + let(:project) { create(:project) } let(:key) { create(:key, user: project.owner) } - let(:key_id) { key.shell_id } + let(:key_id) { key.identifier } it "fetches the correct project" do Project.should_receive(:find_with_namespace).with(project.path_with_namespace).and_return(project) @@ -19,8 +19,9 @@ describe PostReceive do end it "does not run if the author is not in the project" do - Key.stub(find_by_id: nil) + Key.stub(find_by_identifier: nil) + project.should_not_receive(:observe_push) project.should_not_receive(:execute_hooks) PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false @@ -31,12 +32,13 @@ describe PostReceive do project.should_receive(:execute_hooks) project.should_receive(:execute_services) project.should_receive(:update_merge_requests) + project.should_receive(:observe_push) PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) end end def pwd(project) - File.join(Gitlab.config.gitlab_shell.repos_path, project.path_with_namespace) + File.join(Gitlab.config.gitolite.repos_path, project.path_with_namespace) end end diff --git a/vendor/assets/javascripts/ace-src-noconflict/ace.js b/vendor/assets/javascripts/ace-src-noconflict/ace.js index 8bd2d9a6..11b4bbb8 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/ace.js +++ b/vendor/assets/javascripts/ace-src-noconflict/ace.js @@ -4800,7 +4800,7 @@ var SearchHighlight = require("./search_highlight").SearchHighlight; /** * new EditSession(text, mode) * - text (Document | String): If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text - * - mode (TextMode): The initial language mode to use for the document + * - mode (TextMode): The inital language mode to use for the document * * Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`. * @@ -10068,7 +10068,7 @@ ace.define('ace/token_iterator', ['require', 'exports', 'module' ], function(req * - initialRow (Number): The row to start the tokenizing at * - initialColumn (Number): The column to start the tokenizing at * - * Creates a new token iterator object. The initial token index is set to the provided row and column coordinates. + * Creates a new token iterator object. The inital token index is set to the provided row and column coordinates. * **/ var TokenIterator = function(session, initialRow, initialColumn) { @@ -11946,7 +11946,7 @@ var VirtualRenderer = function(container, theme) { this.$horizScroll = horizScroll; if (horizScrollChanged) { this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden"; - // when we hide scrollbar scroll event isn't emitted + // when we hide scrollbar scroll event isn't emited // leaving session with wrong scrollLeft value if (!horizScroll) this.session.setScrollLeft(0); @@ -13029,7 +13029,7 @@ var Text = function(parentEl) { var html = []; // Get the tokens per line as there might be some lines in between - // being folded. + // beeing folded. this.$renderLine(html, row, false, row == foldStart ? foldLine : false); // don't use setInnerHtml since we are working with an empty DIV @@ -14529,7 +14529,7 @@ var Editor = require("./editor").Editor; * - dir (Number): The direction of lines to select: -1 for up, 1 for down * - skip (Boolean): If `true`, removes the active selection range * - * Finds the next occurrence of text in an active selection and adds it to the selections. + * Finds the next occurence of text in an active selection and adds it to the selections. **/ this.selectMore = function(dir, skip) { var session = this.session; @@ -15878,4 +15878,4 @@ ace.define("text!ace/theme/textmate.css", [], ".ace-tm .ace_editor {\n" + ace[key] = a[key]; }); })(); - + \ No newline at end of file diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-coldfusion.js b/vendor/assets/javascripts/ace-src-noconflict/mode-coldfusion.js index aea42145..1b41d001 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-coldfusion.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-coldfusion.js @@ -1170,7 +1170,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-groovy.js b/vendor/assets/javascripts/ace-src-noconflict/mode-groovy.js index 80d153d8..ad7bdf58 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-groovy.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-groovy.js @@ -337,7 +337,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-html.js b/vendor/assets/javascripts/ace-src-noconflict/mode-html.js index 5ec11f14..0ea36845 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-html.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-html.js @@ -389,7 +389,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-jade.js b/vendor/assets/javascripts/ace-src-noconflict/mode-jade.js index 32aafd17..c01a3598 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-jade.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-jade.js @@ -659,7 +659,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-java.js b/vendor/assets/javascripts/ace-src-noconflict/mode-java.js index c05bf0f9..23f9e603 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-java.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-java.js @@ -338,7 +338,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-javascript.js b/vendor/assets/javascripts/ace-src-noconflict/mode-javascript.js index 90cf57eb..d266bffb 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-javascript.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-javascript.js @@ -342,7 +342,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-jsp.js b/vendor/assets/javascripts/ace-src-noconflict/mode-jsp.js index e4f4bcff..c96d25e9 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-jsp.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-jsp.js @@ -597,7 +597,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-liquid.js b/vendor/assets/javascripts/ace-src-noconflict/mode-liquid.js index 3886e739..2623396c 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-liquid.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-liquid.js @@ -641,7 +641,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-luahtml.js b/vendor/assets/javascripts/ace-src-noconflict/mode-luahtml.js index d8a1b653..89bc2ec7 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-luahtml.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-luahtml.js @@ -466,7 +466,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { @@ -2412,4 +2412,4 @@ oop.inherits(LuaHtmlHighlightRules, HtmlHighlightRules); exports.LuaHtmlHighlightRules = LuaHtmlHighlightRules; -}); +}); \ No newline at end of file diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-luapage.js b/vendor/assets/javascripts/ace-src-noconflict/mode-luapage.js index 9be136de..8f03866d 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-luapage.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-luapage.js @@ -382,7 +382,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { @@ -2477,4 +2477,4 @@ oop.inherits(LuaPageHighlightRules, HtmlHighlightRules); exports.LuaPageHighlightRules = LuaPageHighlightRules; -}); +}); \ No newline at end of file diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-markdown.js b/vendor/assets/javascripts/ace-src-noconflict/mode-markdown.js index e1c269ee..179376aa 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-markdown.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-markdown.js @@ -384,7 +384,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-php.js b/vendor/assets/javascripts/ace-src-noconflict/mode-php.js index 40710cee..d3deefc6 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-php.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-php.js @@ -1685,7 +1685,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-scala.js b/vendor/assets/javascripts/ace-src-noconflict/mode-scala.js index 87b8e12b..ee8ebb8f 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-scala.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-scala.js @@ -338,7 +338,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/mode-svg.js b/vendor/assets/javascripts/ace-src-noconflict/mode-svg.js index 96b965ba..29c2b17b 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/mode-svg.js +++ b/vendor/assets/javascripts/ace-src-noconflict/mode-svg.js @@ -1177,7 +1177,7 @@ var JavaScriptHighlightRules = function() { } ], // regular expressions are only allowed after certain tokens. This - // makes sure we don't mix up regexps with the division operator + // makes sure we don't mix up regexps with the divison operator "regex_allowed": [ DocCommentHighlightRules.getStartRule("doc-start"), { diff --git a/vendor/assets/javascripts/ace-src-noconflict/worker-javascript.js b/vendor/assets/javascripts/ace-src-noconflict/worker-javascript.js index 671d7bec..923bac6f 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/worker-javascript.js +++ b/vendor/assets/javascripts/ace-src-noconflict/worker-javascript.js @@ -2912,7 +2912,7 @@ var JSHINT = (function () { immed : true, // if immediate invocations must be wrapped in parens iterator : true, // if the `__iterator__` property should be allowed jquery : true, // if jQuery globals should be predefined - lastsemic : true, // if semicolons may be omitted for the trailing + lastsemic : true, // if semicolons may be ommitted for the trailing // statements inside of a one-line blocks. latedef : true, // if the use before definition should not be tolerated laxbreak : true, // if line breaks should not be checked @@ -3674,7 +3674,7 @@ var JSHINT = (function () { line += 1; // If smarttabs option is used check for spaces followed by tabs only. - // Otherwise check for any occurrence of mixed tabs and spaces. + // Otherwise check for any occurence of mixed tabs and spaces. if (option.smarttabs) at = s.search(/ \t/); else diff --git a/vendor/assets/javascripts/ace-src-noconflict/worker-xquery.js b/vendor/assets/javascripts/ace-src-noconflict/worker-xquery.js index 1d8c512e..494066fd 100644 --- a/vendor/assets/javascripts/ace-src-noconflict/worker-xquery.js +++ b/vendor/assets/javascripts/ace-src-noconflict/worker-xquery.js @@ -7609,7 +7609,7 @@ org.antlr.runtime.BaseRecognizer.prototype = { * * Until then I'll leave this unimplemented. If there is enough clamor * it would be possible to keep track of the invocation stack using an - * auxiliary array, but that will definitely be a performance hit. + * auxillary array, but that will definitely be a performance hit. */ getRuleInvocationStack: function(e, recognizerClassName) { diff --git a/vendor/assets/javascripts/branch-graph.js b/vendor/assets/javascripts/branch-graph.js new file mode 100644 index 00000000..805423bc --- /dev/null +++ b/vendor/assets/javascripts/branch-graph.js @@ -0,0 +1,354 @@ +!function(){ + + var BranchGraph = function(element, options){ + this.element = element; + this.options = options; + + this.preparedCommits = {}; + this.mtime = 0; + this.mspace = 0; + this.parents = {}; + this.colors = ["#000"]; + + this.load(); + }; + + BranchGraph.prototype.load = function(){ + $.ajax({ + url: this.options.url, + method: 'get', + dataType: 'json', + success: $.proxy(function(data){ + $('.loading', this.element).hide(); + this.prepareData(data.days, data.commits); + this.buildGraph(); + }, this) + }); + }; + + BranchGraph.prototype.prepareData = function(days, commits){ + this.days = days; + this.dayCount = days.length; + this.commits = commits; + this.commitCount = commits.length; + + this.collectParents(); + + this.mtime += 4; + this.mspace += 10; + for (var i = 0; i < this.commitCount; i++) { + if (this.commits[i].id in this.parents) { + this.commits[i].isParent = true; + } + this.preparedCommits[this.commits[i].id] = this.commits[i]; + } + this.collectColors(); + }; + + BranchGraph.prototype.collectParents = function(){ + for (var i = 0; i < this.commitCount; i++) { + for (var j = 0, jj = this.commits[i].parents.length; j < jj; j++) { + this.parents[this.commits[i].parents[j][0]] = true; + } + this.mtime = Math.max(this.mtime, this.commits[i].time); + this.mspace = Math.max(this.mspace, this.commits[i].space); + } + }; + + BranchGraph.prototype.collectColors = function(){ + for (var k = 0; k < this.mspace; k++) { + this.colors.push(Raphael.getColor(.8)); + // Skipping a few colors in the spectrum to get more contrast between colors + Raphael.getColor();Raphael.getColor(); + } + }; + + BranchGraph.prototype.buildGraph = function(){ + var graphWidth = $(this.element).width() + , ch = this.mspace * 20 + 20 + , cw = Math.max(graphWidth, this.mtime * 20 + 20) + , r = Raphael(this.element.get(0), cw, ch) + , top = r.set() + , cuday = 0 + , cumonth = "" + , offsetX = 20 + , offsetY = 60 + , barWidth = Math.max(graphWidth, this.dayCount * 20 + 80); + + this.raphael = r; + + r.rect(0, 0, barWidth, 20).attr({fill: "#222"}); + r.rect(0, 20, barWidth, 20).attr({fill: "#444"}); + + for (mm = 0; mm < this.dayCount; mm++) { + if(this.days[mm] != null){ + if(cuday != this.days[mm][0]){ + // Dates + r.text(offsetX + mm * 20, 31, this.days[mm][0]).attr({ + font: "12px Monaco, monospace", + fill: "#DDD" + }); + cuday = this.days[mm][0]; + } + if(cumonth != this.days[mm][1]){ + // Months + r.text(offsetX + mm * 20, 11, this.days[mm][1]).attr({ + font: "12px Monaco, monospace", + fill: "#EEE" + }); + cumonth = this.days[mm][1]; + } + } + } + + for (i = 0; i < this.commitCount; i++) { + var x = offsetX + 20 * this.commits[i].time + , 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" + }); + + // 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) { + var cx = offsetX + 20 * c.time + , cy = offsetY + 20 * c.space; + if (c.space == this.commits[i].space) { + r.path([ + "M", x, y, + "L", x - 20 * (c.time + 1), y + ]).attr({ + stroke: this.colors[c.space], + "stroke-width": 2 + }); + + } else if (c.space < this.commits[i].space) { + r.path(["M", x - 5, y + .0001, "l-5-2,0,4,5,-2C", x - 5, y, x - 17, y + 2, x - 20, y - 5, "L", cx, y - 5, cx, cy]) + .attr({ + stroke: this.colors[this.commits[i].space], + "stroke-width": 2 + }); + } else { + r.path(["M", x - 3, y + 6, "l-4,3,4,2,0,-5L", x - 10, y + 20, "L", x - 10, cy, cx, cy]) + .attr({ + stroke: this.colors[c.space], + "stroke-width": 2 + }); + } + } + } + + if (this.commits[i].refs) { + this.appendLabel(x, y, this.commits[i].refs); + } + + this.appendAnchor(top, this.commits[i], x, y); + } + top.toFront(); + this.element.scrollLeft(cw); + this.bindEvents(); + }; + + BranchGraph.prototype.bindEvents = function(){ + var drag = {} + , element = this.element; + + var dragger = function(event){ + element.scrollLeft(drag.sl - (event.clientX - drag.x)); + element.scrollTop(drag.st - (event.clientY - drag.y)); + }; + + element.on({ + mousedown: function (event) { + drag = { + x: event.clientX, + y: event.clientY, + st: element.scrollTop(), + sl: element.scrollLeft() + }; + $(window).on('mousemove', dragger); + } + }); + $(window).on({ + mouseup: function(){ + //bars.animate({opacity: 0}, 300); + $(window).off('mousemove', dragger); + }, + keydown: function(event){ + if(event.keyCode == 37){ + // left + element.scrollLeft( element.scrollLeft() - 50); + } + if(event.keyCode == 38){ + // top + element.scrollTop( element.scrollTop() - 50); + } + if(event.keyCode == 39){ + // right + element.scrollLeft( element.scrollLeft() + 50); + } + if(event.keyCode == 40){ + // bottom + element.scrollTop( element.scrollTop() + 50); + } + } + }); + }; + + 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; + anchor = r.circle(x, y, 10).attr({ + fill: "#000", + opacity: 0, + cursor: "pointer" + }) + .click(function(){ + window.location = options.commit_url.replace('%s', commit.id); + }) + .hover(function(){ + this.tooltip = r.commitTooltip(x, y + 5, commit); + top.push(this.tooltip.insertBefore(this)); + }, function(){ + this.tooltip && this.tooltip.remove() && delete this.tooltip; + }); + top.push(anchor); + }; + + this.BranchGraph = BranchGraph; + +}(this); +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