diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2014-06-28 19:45:23 +0000 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2014-06-28 19:45:23 +0000 |
commit | c15ee938e84201871bc981eb232d03055d7aea8d (patch) | |
tree | 5363a9053aa453c938354bee8bb9e970989a584c | |
parent | cdec1324173c2331153b671ef6ebab749bca9cd4 (diff) | |
parent | d1e424bd5c403d73d399bf0f92e39aefde56e638 (diff) | |
download | gitlab-ce-c15ee938e84201871bc981eb232d03055d7aea8d.tar.gz |
Merge tag 'v7.0.0' into gitlab-update
Version 7.0.0
529 files changed, 6166 insertions, 4799 deletions
diff --git a/.gitignore b/.gitignore index d151849b713..92ca729dc11 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ config/gitlab.yml config/database.yml config/initializers/omniauth.rb config/initializers/rack_attack.rb +config/initializers/smtp_settings.rb config/unicorn.rb config/resque.yml config/aws.yml diff --git a/.pkgr.yml b/.pkgr.yml index 09cb83783dc..97d78b6ef69 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -17,3 +17,10 @@ targets: - libicu52 - libpcre3 - git + centos-6: + build_dependencies: + - libicu-devel + dependencies: + - libicu + - pcre + - git diff --git a/.travis.yml b/.travis.yml index 9bab337f336..8bb2da5e51e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,18 +3,22 @@ env: global: - TRAVIS=true matrix: - - TASK=spinach DB=mysql + - TASK=spinach_project DB=mysql + - TASK=spinach_other DB=mysql - TASK=spec:api DB=mysql - TASK=spec:feature DB=mysql - TASK=spec:other DB=mysql - TASK=jasmine:ci DB=mysql - - TASK=spinach DB=postgresql + - TASK=spinach_project DB=postgresql + - TASK=spinach_other DB=postgresql - TASK=spec:api DB=postgresql - TASK=spec:feature DB=postgresql - TASK=spec:other DB=postgresql - TASK=jasmine:ci DB=postgresql before_install: - sudo apt-get install libicu-dev -y +install: + - "bundle install --deployment --without production" branches: only: - 'master' diff --git a/CHANGELOG b/CHANGELOG index aaf1879dcce..495d20e8b04 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,52 @@ +v 7.0.0 + - The CPU no longer overheats when you hold down the spacebar + - Improve edit file UI + - Add ability to upload group avatar when create + - Protected branch cannot be removed + - Developers can remove normal branches with UI + - Remove branch via API (sponsored by O'Reilly Media) + - Move protected branches page to Project settings area + - Redirect to Files view when create new branch via UI + - Drag and drop upload of image in every markdown-area (Earle Randolph Bunao and Neil Francis Calabroso) + - Refactor the markdown relative links processing + - Make it easier to implement other CI services for GitLab + - Group masters can create projects in group + - Deprecate ruby 1.9.3 support + - Only masters can rewrite/remove git tags + - Add X-Frame-Options SAMEORIGIN to Nginx config so Sidekiq admin is visible + - UI improvements + - Case-insensetive search for issues + - Update to rails 4.1 + - Improve performance of application for projects and groups with a lot of members + - Formally support Ruby 2.1 + - Include Nginx gitlab-ssl config + - Add manual language detection for highlight.js + - Added example.com/:username routing + - Show notice if your profile is public + - UI improvements for mobile devices + - Improve diff rendering performance + - Drag-n-drop for issues and merge requests between states at milestone page + - Fix '0 commits' message for huge repositories on project home page + - Prevent 500 error page when visit commit page from large repo + - Add notice about huge push over http to unicorn config + - File action in satellites uses default 30 seconds timeout instead of old 10 seconds one + - Overall performance improvements + - Skip init script check on omnibus-gitlab + - Be more selective when killing stray Sidekiqs + - Check LDAP user filter during sign-in + - Remove wall feature (no data loss - you can take it from database) + - Dont expose user emails via API unless you are admin + - Detect issues closed by Merge Request description + - Better email subject lines from email on push service (Alex Elman) + - Enable identicon for gravatar be default + +v 6.9.2 + - Revert the commit that broke the LDAP user filter + +v 6.9.1 + - Fix scroll to highlighted line + - Fix the pagination on load for commits page + v 6.9.0 - Store Rails cache data in the Redis `cache:gitlab` namespace - Adjust MySQL limits for existing installations @@ -19,6 +68,7 @@ v 6.9.0 - Add more access checks during API calls - Block SSH access for 'disabled' Active Directory users - Labels for merge requests (Drew Blessing) + - Threaded emails by setting a Message-ID (Philip Blatter) v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 780db547f82..3b6212c960d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,16 +24,11 @@ Issues and merge requests should be in English and contain appropriate language To get support for your particular problem please use the channels as detailed in the [getting help section of the readme](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/README.md#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/). -The [issue tracker](https://gitlab.com/gitlab-org/gitlab-ce/issues) is only for obvious errors in the latest [stable or development release of GitLab](MAINTENANCE.md). -If something is wrong but it is not a regression compared to older versions of GitLab please do not open an issue but a feature request. -When submitting an issue please conform to the issue submission guidelines listed below. -Not all issues will be addressed and your issue is more likely to be addressed if you submit a merge request which partially or fully addresses the issue. +The [issue tracker](https://gitlab.com/gitlab-org/gitlab-ce/issues) is only for obvious errors in the latest [stable or development release of GitLab](MAINTENANCE.md). If something is wrong but it is not a regression compared to older versions of GitLab please do not open an issue but a feature request. When submitting an issue please conform to the issue submission guidelines listed below. Not all issues will be addressed and your issue is more likely to be addressed if you submit a merge request which partially or fully addresses the issue. Issues can be filed either at [gitlab.com](https://gitlab.com/gitlab-org/gitlab-ce/issues) or [github.com](https://github.com/gitlabhq/gitlabhq/issues). -Do not use the issue tracker for feature requests. -We have a specific [feature request forum](http://feedback.gitlab.com) for this purpose. -Please keep feature requests as small and simple as possible, complex ones might be edited to make them small and simple. +Do not use the issue tracker for feature requests. We have a specific [feature request forum](http://feedback.gitlab.com) for this purpose. Please keep feature requests as small and simple as possible, complex ones might be edited to make them small and simple. Please send a merge request with a tested solution or a merge request with a failing test instead of opening an issue if you can. If you're unsure where to post, post to the [mailing list](https://groups.google.com/forum/#!forum/gitlabhq) or [Stack Overflow](http://stackoverflow.com/questions/tagged/gitlab) 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. @@ -42,16 +37,16 @@ Please send a merge request with a tested solution or a merge request with a fai **[Search the issues](https://gitlab.com/gitlab-org/gitlab-ce/issues)** for similar entries before submitting your own, there's a good chance somebody else had the same issue. Show your support with `:+1:` and/or join the discussion. Please submit issues in the following format (as the first post): 1. **Summary:** Summarize your issue in one sentence (what goes wrong, what did you expect to happen) -2. **Steps to reproduce:** How can we reproduce the issue, preferably on the [GitLab development virtual machine with vagrant](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/doc/development.md) (start your issue with: `vagrant destroy && vagrant up && vagrant ssh`) -3. **Expected behavior:** Describe your issue in detail -4. **Observed behavior** -5. **Relevant logs and/or screenshots:** Please use code blocks (\`\`\`) to format console output, logs, and code as it's very hard to read otherwise. -6. **Output of checks** +1. **Steps to reproduce:** How can we reproduce the issue, preferably on the [GitLab development virtual machine with vagrant](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/doc/development.md) (start your issue with: `vagrant destroy && vagrant up && vagrant ssh`) +1. **Expected behavior:** Describe your issue in detail +1. **Observed behavior** +1. **Relevant logs and/or screenshots:** Please use code blocks (\`\`\`) to format console output, logs, and code as it's very hard to read otherwise. +1. **Output of checks** * Results of GitLab [Application Check](doc/install/installation.md#check-application-status) (`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production`); we will only investigate if the tests are passing * Version of GitLab you are running; we will only investigate issues in the latest stable and development releases as per the [maintenance policy](MAINTENANCE.md) * Add the last commit sha1 of the GitLab version you used to replicate the issue (obtainable from the help page) * Describe your setup (use relevant parts from `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`) -7. **Possible fixes**: If you can, link to the line of code that might be responsible for the problem +1. **Possible fixes**: If you can, link to the line of code that might be responsible for the problem ## Merge requests @@ -78,7 +73,7 @@ If you can, please submit a merge request with the fix or improvements including 1. Be prepared to answer questions and incorporate feedback even if requests for this arrive weeks or months after your MR submittion 1. If your MR touches code that executes shell commands, make sure it adheres to the [shell command guidelines]( doc/development/shell_commands.md). -The **official merge window** is in the beginning of the month from the 1st to the 7th day of the month. The best time to submit a MR and get feedback fast. Before this time the GitLab.com team is still dealing with work that is created by the monthly release such as assisting subscribers with upgrade issues, the release of Enterprise Edition and the upgrade of GitLab Cloud. After the 7th it is already getting closer to the release date of the next version. This means there is less time to fix the issues created by merging large new features. +The **official merge window** is in the beginning of the month from the 1st to the 7th day of the month. The best time to submit a MR and get feedback fast. Before this time the GitLab B.V. team is still dealing with work that is created by the monthly release such as assisting subscribers with upgrade issues, the release of Enterprise Edition and the upgrade of GitLab Cloud. After the 7th it is already getting closer to the release date of the next version. This means there is less time to fix the issues created by merging large new features. Please keep the change in a single MR **as small as possible**. If you want to contribute a large feature think very hard what the minimum viable change is. Can you split functionality? Can you only submit the backend/API code? Can you start with a very simple UI? The smaller a MR is the more likely it is it will be merged, after that you can send more MR's to enhance it. @@ -87,10 +82,10 @@ For examples of feedback on merge requests please look at already [closed merge **Please format your merge request description as follows:** 1. What does this MR do? -2. Are there points in the code the reviewer needs to double check? -3. Why was this MR needed? -4. What are the relevant issue numbers / [Feature requests](http://feedback.gitlab.com/)? -5. Screenshots (If appropiate) +1. Are there points in the code the reviewer needs to double check? +1. Why was this MR needed? +1. What are the relevant issue numbers / [Feature requests](http://feedback.gitlab.com/)? +1. Screenshots (If appropiate) ## Contribution acceptance criteria @@ -106,11 +101,16 @@ For examples of feedback on merge requests please look at already [closed merge 1. It conforms to the following style guides ## Style guides -1. [Ruby](https://github.com/bbatsov/ruby-style-guide) -1. [Rails](https://github.com/bbatsov/rails-style-guide) -1. [Formatting](https://github.com/thoughtbot/guides/tree/master/style#formatting) -1. [Naming](https://github.com/thoughtbot/guides/tree/master/style#naming) -1. [Testing](https://github.com/thoughtbot/guides/tree/master/style#testing) -1. [CoffeeScript](https://github.com/thoughtbot/guides/tree/master/style#coffeescript) -1. [Shell commands](doc/development/shell_commands.md) -1. [Markdown](http://www.cirosantilli.com/markdown-styleguide) + +1. [Ruby](https://github.com/bbatsov/ruby-style-guide). + Important sections include [Source Code Layout](https://github.com/bbatsov/ruby-style-guide#source-code-layout) + and [Naming](https://github.com/bbatsov/ruby-style-guide#naming). Use: + - multi-line method chaining style **Option B**: dot `.` on previous line + - string literal quoting style **Option A**: single quoted by default +1. [Rails](https://github.com/bbatsov/rails-style-guide) +1. [Testing](https://github.com/thoughtbot/guides/tree/master/style#testing) +1. [CoffeeScript](https://github.com/thoughtbot/guides/tree/master/style#coffeescript) +1. [Shell commands](doc/development/shell_commands.md) created by GitLab contributors to enhance security +1. [Markdown](http://www.cirosantilli.com/markdown-styleguide) + +This is also the style used by linting tools such as [Rubocop](https://github.com/bbatsov/rubocop), PullReview[https://www.pullreview.com/] and [Hound CI](https://houndci.com). diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION new file mode 100644 index 00000000000..7bc1c40470f --- /dev/null +++ b/GITLAB_SHELL_VERSION @@ -0,0 +1 @@ +1.9.6 @@ -8,11 +8,14 @@ def linux_only(require_as) RUBY_PLATFORM.include?('linux') && require_as end -gem "rails", "~> 4.0.0" +gem "rails", "~> 4.1.0" gem "protected_attributes" gem 'rails-observers' +# Make links from text +gem 'rails_autolink', '~> 1.1' + # Default values for AR models gem "default_value_for", "~> 3.0.0" @@ -30,7 +33,7 @@ gem 'omniauth-github' # Extracting information from a git repository # Provide access to Gitlab::Git library -gem "gitlab_git", '~> 5.8' +gem "gitlab_git", '~> 6.0' # Ruby/Rack Git Smart-HTTP Server Handler gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack' @@ -50,9 +53,6 @@ gem "grape", "~> 0.6.1" gem "grape-entity", "~> 0.4.2" gem 'rack-cors', require: 'rack/cors' -# Email validation -gem "email_validator", "~> 1.4.0", :require => 'email_validator/strict' - # Format dates and times # based on human-friendly examples gem "stamp" @@ -69,6 +69,9 @@ gem "haml-rails" # Files attachments gem "carrierwave" +# Drag and Drop UI +gem 'dropzonejs-rails' + # for aws storage gem "fog", "~> 1.14", group: :aws gem "unf", group: :aws @@ -82,6 +85,7 @@ gem "seed-fu" # Markdown to HTML gem "redcarpet", "~> 2.2.2" gem "github-markup" +gem "org-ruby" # For rendering .org files # Diffs gem 'diffy', '~> 3.0.3' @@ -152,6 +156,9 @@ gem "rack-attack" # Ace editor gem 'ace-rails-ap' +# Semantic UI Sass for Sidebar +gem 'semantic-ui-sass', '~> 0.16.1.0' + gem "sass-rails", '~> 4.0.2' gem "coffee-rails" gem "uglifier" @@ -163,6 +170,7 @@ gem 'select2-rails' gem 'jquery-atwho-rails', "~> 0.3.3" gem "jquery-rails" gem "jquery-ui-rails" +gem "jquery-scrollto-rails" gem "raphael-rails", "~> 2.1.2" gem 'bootstrap-sass', '~> 3.0' gem "font-awesome-rails", '~> 3.2' @@ -194,7 +202,7 @@ group :development, :test do # gem 'rails-dev-tweaks' gem 'spinach-rails' gem "rspec-rails" - gem "capybara" + gem "capybara", '~> 2.2.1' gem "pry" gem "awesome_print" gem "database_cleaner" @@ -202,7 +210,7 @@ group :development, :test do gem 'factory_girl_rails' # Prevent occasions where minitest is not bundled in packaged versions of ruby (see #3826) - gem 'minitest', '~> 4.7.0' + gem 'minitest', '~> 5.3.0' # Generate Fake data gem "ffaker" @@ -217,9 +225,9 @@ group :development, :test do gem 'rb-inotify', require: linux_only('rb-inotify') # PhantomJS driver for Capybara - gem 'poltergeist', '~> 1.4.1' + gem 'poltergeist', '~> 1.5.1' - gem 'jasmine', '2.0.0.rc5' + gem 'jasmine', '2.0.2' gem "spring", '1.1.1' gem "spring-commands-rspec", '1.0.1' @@ -235,5 +243,5 @@ group :test do end group :production do - gem "gitlab_meta", '6.0' + gem "gitlab_meta", '7.0' end diff --git a/Gemfile.lock b/Gemfile.lock index f5f31105e18..6c27b6e3739 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,37 +2,39 @@ GEM remote: https://rubygems.org/ specs: ace-rails-ap (2.0.1) - actionmailer (4.0.5) - actionpack (= 4.0.5) + actionmailer (4.1.1) + actionpack (= 4.1.1) + actionview (= 4.1.1) mail (~> 2.5.4) - actionpack (4.0.5) - activesupport (= 4.0.5) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionpack (4.1.1) + actionview (= 4.1.1) + activesupport (= 4.1.1) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.5) - activesupport (= 4.0.5) - builder (~> 3.1.0) - activerecord (4.0.5) - activemodel (= 4.0.5) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.5) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.5) + actionview (4.1.1) + activesupport (= 4.1.1) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.1) + activesupport (= 4.1.1) + builder (~> 3.1) + activerecord (4.1.1) + activemodel (= 4.1.1) + activesupport (= 4.1.1) + arel (~> 5.0.0) + activesupport (4.1.1) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) acts-as-taggable-on (2.4.1) rails (>= 3, < 5) addressable (2.3.5) annotate (2.6.0) activerecord (>= 2.3.0) rake (>= 0.8.7) - arel (4.0.2) + arel (5.0.1.20140414130214) asciidoctor (0.1.4) awesome_print (1.2.0) axiom-types (0.0.5) @@ -46,8 +48,8 @@ GEM debug_inspector (>= 0.0.1) bootstrap-sass (3.0.3.0) sass (~> 3.2) - builder (3.1.4) - capybara (2.1.0) + builder (3.2.2) + capybara (2.2.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -60,7 +62,7 @@ GEM celluloid (0.15.2) timers (~> 1.1.0) charlock_holmes (0.6.9.4) - cliver (0.2.2) + cliver (0.3.2) code_analyzer (0.4.3) sexp_processor coderay (1.1.0) @@ -87,7 +89,7 @@ GEM d3_rails (3.1.10) railties (>= 3.1.0) daemons (1.1.9) - database_cleaner (1.2.0) + database_cleaner (1.3.0) debug_inspector (0.0.2) default_value_for (3.0.0) activerecord (>= 3.2.0, < 5.0) @@ -103,11 +105,11 @@ GEM diffy (3.0.3) docile (1.1.1) dotenv (0.9.0) + dropzonejs-rails (0.4.14) + rails (> 3.1) email_spec (1.5.0) launchy (~> 2.1) mail (~> 2.2) - email_validator (1.4.0) - activemodel emoji (1.0.1) json enumerize (0.7.0) @@ -162,7 +164,7 @@ GEM multi_json gitlab-grack (2.0.0.pre) rack (~> 1.5.1) - gitlab-grit (2.6.7) + gitlab-grit (2.6.9) charlock_holmes (~> 0.6) diff-lcs (~> 1.1) mime-types (~> 1.15) @@ -173,13 +175,13 @@ GEM mime-types (~> 1.19) gitlab_emoji (0.0.1.1) emoji (~> 1.0.1) - gitlab_git (5.8.0) + gitlab_git (6.0.0) activesupport (~> 4.0) charlock_holmes (~> 0.6) gitlab-grit (~> 2.6) gitlab-linguist (~> 3.0) rugged (~> 0.19.0) - gitlab_meta (6.0) + gitlab_meta (7.0) gitlab_omniauth-ldap (1.0.4) net-ldap (~> 0.3.1) omniauth (~> 1.0) @@ -221,13 +223,13 @@ GEM guard-spinach (0.0.2) guard (>= 1.1) spinach - haml (4.0.4) + haml (4.0.5) tilt - haml-rails (0.5.1) - actionpack (~> 4.0.0) - activesupport (~> 4.0.0) + haml-rails (0.5.3) + actionpack (>= 4.0.1) + activesupport (>= 4.0.1) haml (>= 3.1, < 5.0) - railties (~> 4.0.0) + railties (>= 4.0.1) hashie (2.0.5) hike (1.2.3) hipchat (0.14.0) @@ -240,16 +242,18 @@ GEM httpauth (0.2.0) i18n (0.6.9) ice_nine (0.10.0) - jasmine (2.0.0.rc5) - jasmine-core (~> 2.0.0.rc5) + jasmine (2.0.2) + jasmine-core (~> 2.0.0) phantomjs rack (>= 1.2.1) rake - jasmine-core (2.0.0.rc5) + jasmine-core (2.0.0) jquery-atwho-rails (0.3.3) jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jquery-scrollto-rails (1.4.3) + railties (> 3.1, < 5.0) jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks @@ -277,18 +281,18 @@ GEM treetop (~> 1.4.8) method_source (0.8.2) mime-types (1.25.1) - mini_portile (0.5.3) - minitest (4.7.5) - multi_json (1.10.0) + mini_portile (0.6.0) + minitest (5.3.4) + multi_json (1.10.1) multi_xml (0.5.5) multipart-post (1.2.0) - mysql2 (0.3.11) + mysql2 (0.3.16) net-ldap (0.3.1) net-scp (1.1.2) net-ssh (>= 2.6.5) net-ssh (2.8.0) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + nokogiri (1.6.2.1) + mini_portile (= 0.6.0) nprogress-rails (0.1.2.3) oauth (0.4.7) oauth2 (0.8.1) @@ -315,12 +319,14 @@ GEM omniauth-twitter (1.0.1) multi_json (~> 1.3) omniauth-oauth (~> 1.0) + org-ruby (0.9.6) + rubypants (>= 0.2.0) orm_adapter (0.5.0) pg (0.15.1) phantomjs (1.9.2.0) - poltergeist (1.4.1) - capybara (~> 2.1.0) - cliver (~> 0.2.1) + poltergeist (1.5.1) + capybara (~> 2.1) + cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) polyglot (0.3.4) @@ -349,16 +355,20 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (4.0.5) - actionmailer (= 4.0.5) - actionpack (= 4.0.5) - activerecord (= 4.0.5) - activesupport (= 4.0.5) + rails (4.1.1) + actionmailer (= 4.1.1) + actionpack (= 4.1.1) + actionview (= 4.1.1) + activemodel (= 4.1.1) + activerecord (= 4.1.1) + activesupport (= 4.1.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.5) - sprockets-rails (~> 2.0.0) + railties (= 4.1.1) + sprockets-rails (~> 2.0) rails-observers (0.1.2) activemodel (~> 4.0) + rails_autolink (1.1.6) + rails (> 3.1) rails_best_practices (1.14.4) activesupport awesome_print @@ -368,13 +378,13 @@ GEM i18n require_all ruby-progressbar - railties (4.0.5) - actionpack (= 4.0.5) - activesupport (= 4.0.5) + railties (4.1.1) + actionpack (= 4.1.1) + activesupport (= 4.1.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.12.0) - rake (10.3.1) + rake (10.3.2) raphael-rails (2.1.2) rb-fsevent (0.9.3) rb-inotify (0.9.2) @@ -423,6 +433,7 @@ GEM rspec-mocks (~> 2.14.0) ruby-progressbar (1.2.0) rubyntlm (0.1.1) + rubypants (0.2.0) rugged (0.19.0) safe_yaml (0.9.7) sanitize (2.1.0) @@ -436,11 +447,13 @@ GEM sdoc (0.3.20) json (>= 1.1.3) rdoc (~> 3.10) - seed-fu (2.3.0) - activerecord (>= 3.1, < 4.1) - activesupport (>= 3.1, < 4.1) + seed-fu (2.3.1) + activerecord (>= 3.1, < 4.2) + activesupport (>= 3.1, < 4.2) select2-rails (3.5.2) thor (~> 0.14) + semantic-ui-sass (0.16.1.0) + sass (~> 3.2) settingslogic (2.0.9) sexp_processor (4.4.0) shoulda-matchers (2.1.0) @@ -484,7 +497,7 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) + sprockets-rails (2.1.3) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) @@ -503,7 +516,7 @@ GEM eventmachine (>= 1.0.0) rack (>= 1.0.0) thor (0.19.1) - thread_safe (0.3.3) + thread_safe (0.3.4) tilt (1.4.1) timers (1.1.0) tinder (1.9.3) @@ -525,7 +538,8 @@ GEM eventmachine (>= 0.12.8) http_parser.rb (~> 0.5.1) simple_oauth (~> 0.1.4) - tzinfo (0.3.39) + tzinfo (1.2.1) + thread_safe (~> 0.1) uglifier (2.3.2) execjs (>= 0.3.0) json (>= 1.8.0) @@ -550,7 +564,7 @@ GEM webmock (1.16.0) addressable (>= 2.2.7) crack (>= 0.3.2) - websocket-driver (0.3.1) + websocket-driver (0.3.3) xpath (2.0.0) nokogiri (~> 1.3) @@ -566,7 +580,7 @@ DEPENDENCIES better_errors binding_of_caller bootstrap-sass (~> 3.0) - capybara + capybara (~> 2.2.1) carrierwave coffee-rails colored @@ -577,8 +591,8 @@ DEPENDENCIES devise (= 3.0.4) devise-async (= 0.8.0) diffy (~> 3.0.3) + dropzonejs-rails email_spec - email_validator (~> 1.4.0) enumerize factory_girl_rails ffaker @@ -591,8 +605,8 @@ DEPENDENCIES gitlab-grack (~> 2.0.0.pre) gitlab-linguist (~> 3.0.0) gitlab_emoji (~> 0.0.1.1) - gitlab_git (~> 5.8) - gitlab_meta (= 6.0) + gitlab_git (~> 6.0) + gitlab_meta (= 7.0) gitlab_omniauth-ldap (= 1.0.4) gollum-lib (~> 3.0.0) gon (~> 5.0.0) @@ -604,31 +618,34 @@ DEPENDENCIES haml-rails hipchat (~> 0.14.0) httparty - jasmine (= 2.0.0.rc5) + jasmine (= 2.0.2) jquery-atwho-rails (~> 0.3.3) jquery-rails + jquery-scrollto-rails jquery-turbolinks jquery-ui-rails kaminari (~> 0.15.1) launchy letter_opener - minitest (~> 4.7.0) + minitest (~> 5.3.0) mysql2 nprogress-rails omniauth (~> 1.1.3) omniauth-github omniauth-google-oauth2 omniauth-twitter + org-ruby pg - poltergeist (~> 1.4.1) + poltergeist (~> 1.5.1) protected_attributes pry quiet_assets (~> 1.0.1) rack-attack rack-cors rack-mini-profiler - rails (~> 4.0.0) + rails (~> 4.1.0) rails-observers + rails_autolink (~> 1.1) rails_best_practices raphael-rails (~> 2.1.2) rb-fsevent @@ -641,6 +658,7 @@ DEPENDENCIES sdoc seed-fu select2-rails + semantic-ui-sass (~> 0.16.1.0) settingslogic shoulda-matchers (~> 2.1.0) sidekiq (= 2.17.0) @@ -1,4 +1,4 @@ -Copyright (c) 2011-2014 Dmitriy Zaporozhets +Copyright (c) 2011-2014 GitLab B.V. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MAINTENANCE.md b/MAINTENANCE.md index 95d9f0a5e7b..19200fef389 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -1,24 +1,14 @@ # GitLab Maintenance Policy -GitLab is a fast moving and evolving project. We currently don't have the -resources to support many releases concurrently. We support exactly one stable -release at any given time. +GitLab is a fast moving and evolving project. We currently don't have the resources to support many releases concurrently. We support exactly one stable release at any given time. -GitLab follows the [Semantic Versioning](http://semver.org/) for its releases: -`(Major).(Minor).(Patch)`. +GitLab follows the [Semantic Versioning](http://semver.org/) for its releases: `(Major).(Minor).(Patch)`. -* **Major version**: Whenever there is something significant or any backwards - incompatible changes are introduced to the public API. -* **Minor version**: When new, backwards compatible functionality is introduced - to the public API or a minor feature is introduced, or when a set of smaller - features is rolled out. -* **Patch number**: When backwards compatible bug fixes are introduced that fix - incorrect behavior. +- **Major version**: Whenever there is something significant or any backwards incompatible changes are introduced to the public API. +- **Minor version**: When new, backwards compatible functionality is introduced to the public API or a minor feature is introduced, or when a set of smaller features is rolled out. +- **Patch number**: When backwards compatible bug fixes are introduced that fix incorrect behavior. -The current stable release will receive security patches and bug fixes -(eg. `5.0` -> `5.0.1`). Feature releases will mark the next supported stable -release where the minor version is increased numerically by increments of one -(eg. `5.0 -> 5.1`). +The current stable release will receive security patches and bug fixes (eg. `5.0` -> `5.0.1`). Feature releases will mark the next supported stable release where the minor version is increased numerically by increments of one (eg. `5.0 -> 5.1`). We encourage everyone to run the latest stable release to ensure that you can easily upgrade to the most secure and feature rich GitLab experience. In order to make sure you can easily run the most recent stable release, we are working hard to keep the update process simple and reliable. diff --git a/PROCESS.md b/PROCESS.md index 23dbfd0c699..a6ff62a9a69 100644 --- a/PROCESS.md +++ b/PROCESS.md @@ -13,7 +13,7 @@ Below we describe the contributing process to GitLab for two reasons. So that co - Monitors all issues for feedback (but especially ones commented on since automatically watching them) - Closes issues with no feedback from the reporter for two weeks -### Merge request officers +### Merge marshal - Responds to merge requests the issue team mentions them in and monitors for new merge requests - Provides feedback to the merge request submitter to improve the merge request (style, tests, etc.) @@ -24,9 +24,9 @@ Below we describe the contributing process to GitLab for two reasons. So that co ## Priorities of the issue team 1. Mentioning people (critical) -2. Workflow labels (normal) -3. Functional labels (minor) -4. Assigning issues (avoid if possible) +1. Workflow labels (normal) +1. Functional labels (minor) +1. Assigning issues (avoid if possible) ## Mentioning people @@ -36,11 +36,11 @@ The most important thing is making sure valid issues receive feedback from the d Workflow labels are purposely not very detailed since that would be hard to keep updated as you would need to reevaluate them after every comment. We optionally use functional labels on demand when want to group related issues to get an overview (for example all issues related to RVM, to tackle them in one go) and to add details to the issue. -- _Awaiting feedback_: Feedback pending from the reporter -- _Awaiting confirmation of fix_: The issue should already be solved in **master** (generally you can avoid this workflow item and just close the issue right away) -- _Attached MR_: There is a MR attached and the discussion should happen there - - We need to let issues stay in sync with the MR's. We can do this with a "Closing #XXXX" or "Fixes #XXXX" comment in the MR. We can't close the issue when there is a merge request because sometimes a MR is not good and we just close the MR, then the issue must stay. -- _Awaiting developer action/feedback_: Issue needs to be fixed or clarified by a developer +- *Awaiting feedback*: Feedback pending from the reporter +- *Awaiting confirmation of fix*: The issue should already be solved in **master** (generally you can avoid this workflow item and just close the issue right away) +- *Attached MR*: There is a MR attached and the discussion should happen there + - We need to let issues stay in sync with the MR's. We can do this with a "Closing #XXXX" or "Fixes #XXXX" comment in the MR. We can't close the issue when there is a merge request because sometimes a MR is not good and we just close the MR, then the issue must stay. +- *Awaiting developer action/feedback*: Issue needs to be fixed or clarified by a developer ## Functional labels @@ -51,12 +51,13 @@ These labels describe what development specialities are involved such as: Postgr If an issue is complex and needs the attention of a specific person, assignment is a good option but assigning issues might discourage other people from contributing to that issue. We need all the contributions we can get so this should never be discouraged. Also, an assigned person might not have time for a few weeks, so others should feel free to takeover. ## Label colors -- Light orange `#fef2c0`: workflow labels for issue team members (awaiting feedback, awaiting confirmation of fix) -- Bright orange `#eb6420`: workflow labels for core team members (attached MR, awaiting developer action/feedback) -- Light blue `#82C5FF`: functional labels -- Green labels `#009800`: issues that can generally be ignored. For example, issues given the following labels normally can be closed immediately: - - Feature request (see copy & paste response: [Feature requests](#feature-requests)) - - Support (see copy & paste response: [Support requests and configuration questions](#support-requests-and-configuration-questions) + +- Light orange `#fef2c0`: workflow labels for issue team members (awaiting feedback, awaiting confirmation of fix) +- Bright orange `#eb6420`: workflow labels for core team members (attached MR, awaiting developer action/feedback) +- Light blue `#82C5FF`: functional labels +- Green labels `#009800`: issues that can generally be ignored. For example, issues given the following labels normally can be closed immediately: + - Feature request (see copy & paste response: [Feature requests](#feature-requests)) + - Support (see copy & paste response: [Support requests and configuration questions](#support-requests-and-configuration-questions) ## Be kind @@ -102,8 +103,4 @@ This merge request has been closed because a request for more information has no ### Accepting merge requests -Is there a request on [the feature request forum](http://feedback.gitlab.com/forums/176466-general) that is similar to this? -If so, can you make a comment with a link to it? -Please be aware that new functionality that is not marked [accepting merge/pull requests](http://feedback.gitlab.com/forums/176466-general/status/796455) on the forum might not make it into GitLab. -You might be asked to make changes and even after implementing them your feature might still be declined. -If you want to reduce the chance of this happening please have a discussion in the forum first. +Is there a request on [the feature request forum](http://feedback.gitlab.com/forums/176466-general) that is similar to this? If so, can you make a comment with a link to it? Please be aware that new functionality that is not marked [accepting merge/pull requests](http://feedback.gitlab.com/forums/176466-general/status/796455) on the forum might not make it into GitLab. You might be asked to make changes and even after implementing them your feature might still be declined. If you want to reduce the chance of this happening please have a discussion in the forum first. diff --git a/README.md b/README.md index cbbfebc81ef..07c5c61e939 100644 --- a/README.md +++ b/README.md @@ -1,138 +1,129 @@ -## GitLab: self hosted Git management software +# GitLab + +## Open source software to collaborate on code ![logo](https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/gitlab_logo.png) ![animated-screenshots](https://gist.github.com/fnkr/2f9badd56bfe0ed04ee7/raw/4f48806fbae97f556c2f78d8c2d299c04500cb0d/compiled.gif) -### Gitlab is open source software to collaborate on code - -* Manage git repositories with fine grained access controls that keep your code secure -* Perform code reviews and enhance collaboration with merge requests -* Each project can also have an issue tracker and a wiki -* Used by more than 100,000 organizations, GitLab is the most popular solution to manage git repositories on-premises -* Completely free and open source (MIT Expat license) -* Powered by Ruby on Rails - -### Canonical source - -* The source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. - -### Code status - -* [![build status](https://ci.gitlab.org/projects/1/status.png?ref=master)](https://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) - -* [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.png)](https://codeclimate.com/github/gitlabhq/gitlabhq) +- Manage Git repositories with fine grained access controls that keep your code secure +- Perform code reviews and enhance collaboration with merge requests +- Each project can also have an issue tracker and a wiki +- Used by more than 100,000 organizations, GitLab is the most popular solution to manage Git repositories on-premises +- Completely free and open source (MIT Expat license) +- Powered by Ruby on Rails -* [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) +## Canonical source -* [![PullReview stats](https://www.pullreview.com/gitlab/gitlab-org/gitlab-ce/badges/master.svg?)](https://www.pullreview.com/gitlab.gitlab.com/gitlab-org/gitlab-ce/reviews/master) +- The source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. -### Resources +## Code status -* [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/). +- [![build status](https://ci.gitlab.org/projects/1/status.png?ref=master)](https://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) -* [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ee/) offers additional features aimed at larger organizations. +- [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.png)](https://codeclimate.com/github/gitlabhq/gitlabhq) -* [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab. +- [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) -* Unofficial third-party [iPhone app](http://gitlabcontrol.com/), [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) and [Ruby API wrapper](https://github.com/NARKOZ/gitlab) for GitLab. +- [![PullReview stats](https://www.pullreview.com/gitlab/gitlab-org/gitlab-ce/badges/master.svg?)](https://www.pullreview.com/gitlab.gitlab.com/gitlab-org/gitlab-ce/reviews/master) -### Requirements +## Website -* Ubuntu/Debian/CentOS/RHEL** -* ruby 1.9.3+ -* git 1.7.10+ -* redis 2.0+ -* MySQL or PostgreSQL +On [www.gitlab.com](https://www.gitlab.com/) you can find more information about: -** More details are in the [requirements doc](doc/install/requirements.md) +- [Subscriptions](https://www.gitlab.com/subscription/) +- [Consultancy](https://www.gitlab.com/consultancy/) +- [Community](https://www.gitlab.com/community/) +- [Hosted GitLab.com](https://www.gitlab.com/gitlab-com/) use GitLab as a free service +- [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ee/) with additional features aimed at larger organizations. +- [GitLab CI](https://www.gitlab.com/gitlab-ci/) a continuous integration (CI) server that is easy to integrate with GitLab. -### Installation +## Third-party applications -#### Official installation methods +Access GitLab from multiple platforms with applications below. +These applications are maintained by contributors, GitLab B.V. does not offer support for them. -* [GitLab packages](https://www.gitlab.com/downloads/) **recommended** These packages contain GitLab and all its depencies (Ruby, PostgreSQL, Redis, Nginx, Unicorn, etc.). They are made with [omnibus-gitlab](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md) that also contains the installation instructions. +- [iPhone app](http://gitlabcontrol.com/) +- [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) +- [Chrome app](https://chrome.google.com/webstore/detail/chrome-gitlab-notifier/eageapgbnjicdjjihgclpclilenjbobi) +- [Command line client](https://github.com/drewblessing/gitlab-cli) +- [Ruby API wrapper](https://github.com/NARKOZ/gitlab) -* [GitLab Chef Cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md) This cookbook can be used both for development installations and production installations. If you want to [contribute](CONTRIBUTE.md) to GitLab we suggest you follow the [development installation](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/doc/development.md) instructions to install all testing dependencies. +## Requirements -* [Manual installation guide](doc/install/installation.md) This guide to set up a production server on Ubuntu offers detailed and complete step-by-step instructions. +- Ubuntu/Debian/CentOS/RHEL** +- ruby 2.0+ +- git 1.7.10+ +- redis 2.0+ +- MySQL or PostgreSQL -#### Third party one-click installers +** More details are in the [requirements doc](doc/install/requirements.md). -* [Digital Ocean 1-Click Application Install](https://www.digitalocean.com/blog_posts/host-your-git-repositories-in-55-seconds-with-gitlab) Have a new server up in 55 seconds. Digital Ocean uses SSD disks which is great for an IO intensive app such as GitLab. We recommend selecting a droplet with [1GB of memory](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/requirements.md). +## Installation -* [BitNami one-click installers](http://bitnami.com/stack/gitlab) This package contains both GitLab and GitLab CI. It is available as installer, virtual machine or for cloud hosting providers (Amazon Web Services/Azure/etc.). +Please see [the installation page on the GitLab website](https://www.gitlab.com/installation/). -* [Cloud 66 deployment and management](http://blog.cloud66.com/installing-gitlab-ubuntu/) Use Cloud 66 to deploy GitLab to your own server or any cloud (eg. DigitalOcean, AWS, Rackspace, GCE) and then manage it with database backups, scaling and more. +### New versions -#### Unofficial installation methods +Since 2011 a minor or major version of GitLab is released on the 22nd of every month. Patch and security releases come out when needed. New features are detailed on the [blog](https://www.gitlab.com/blog/) and in the [changelog](CHANGELOG). For more information about the release process see the release [documentation](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/release). Features that will likely be in the next releases can be found on the [feature request forum](http://feedback.gitlab.com/forums/176466-general) with the status [started](http://feedback.gitlab.com/forums/176466-general/status/796456) and [completed](http://feedback.gitlab.com/forums/176466-general/status/796457). -* [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/) repository with unofficial guides for using GitLab with different software (operating systems, webservers, etc.) than the official version. +### Upgrading -* [Installation guides](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Unofficial-Installation-Guides) public wiki with unofficial guides to install GitLab on different operating systems. +For updating the the Omnibus installation please see the [update documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update.md). For manual installations there is an [upgrader script](doc/update/upgrader.md) and there are [upgrade guides](doc/update). -### New versions and upgrading - -Since 2011 GitLab is released on the 22nd of every month. Every new release includes an [upgrade guide](doc/update) and new features are detailed in the [Changelog](CHANGELOG). - -It is recommended to follow a monthly upgrade schedule. Security releases come out when needed. For more information about the release process see the documentation for [monthly](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/release/monthly.md) and [security](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/release/security.md) releases. - -* Features that will be in the next releases are listed on the [feature request forum](http://feedback.gitlab.com/forums/176466-general) with the status [started](http://feedback.gitlab.com/forums/176466-general/status/796456) and [completed](http://feedback.gitlab.com/forums/176466-general/status/796457). - -### Run in production mode +## Run in production mode The Installation guide contains instructions on how to download an init script and run it automatically on boot. You can also start the init script manually: sudo service gitlab start -or by directly calling the script +or by directly calling the script: sudo /etc/init.d/gitlab start -Please login with root / 5iveL!fe +Please login with `root` / `5iveL!fe`. -### Run in development mode +## Install a development environment -Consider setting up the development environment with [the cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md#installation). - -Copy the example development unicorn configuration file +We recommend setting up your development environment with [the cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md#installation). If you do not use the cookbook you might need to copy the example development unicorn configuration file cp config/unicorn.rb.example.development config/unicorn.rb +## Run in development mode + Start it with [Foreman](https://github.com/ddollar/foreman) bundle exec foreman start -p 3000 -or start each component separately +or start each component separately: bundle exec rails s - script/background_jobs start + bin/background_jobs start -And surf to [localhost:3000](http://localhost:3000/) and login with root / 5iveL!fe +And surf to [localhost:3000](http://localhost:3000/) and login with `root` / `5iveL!fe`. -### Run the tests +## Run the tests -* Run all tests +- Run all tests: bundle exec rake test -* [RSpec](http://rspec.info/) unit and functional tests - - All RSpec tests: bundle exec rake spec +- [RSpec](http://rspec.info/) unit and functional tests. - Single RSpec file: bundle exec rspec spec/controllers/commit_controller_spec.rb + All RSpec tests: `bundle exec rake spec` -* [Spinach](https://github.com/codegram/spinach) integration tests + Single RSpec file: `bundle exec rspec spec/controllers/commit_controller_spec.rb` - All Spinach tests: bundle exec rake spinach +- [Spinach](https://github.com/codegram/spinach) integration tests. - Single Spinach test: bundle exec spinach features/project/issues/milestones.feature + All Spinach tests: `bundle exec rake spinach` + Single Spinach test: `bundle exec spinach features/project/issues/milestones.feature` -### Documentation +## Documentation All documentation can be found on [doc.gitlab.com/ce/](http://doc.gitlab.com/ce/). -### Getting help +## Getting help Please see [Getting help for GitLab](https://www.gitlab.com/getting-help/) on our website for the many options to get help. @@ -1 +1 @@ -6.9.0 +7.0.0 diff --git a/app/assets/images/Storage-UI.PNG b/app/assets/images/Storage-UI.PNG Binary files differdeleted file mode 100644 index 8ab6678de32..00000000000 --- a/app/assets/images/Storage-UI.PNG +++ /dev/null diff --git a/app/assets/images/file_bin.png b/app/assets/images/file_bin.png Binary files differdeleted file mode 100644 index b3feafcce0b..00000000000 --- a/app/assets/images/file_bin.png +++ /dev/null diff --git a/app/assets/images/file_dir.png b/app/assets/images/file_dir.png Binary files differdeleted file mode 100644 index ea277bb14db..00000000000 --- a/app/assets/images/file_dir.png +++ /dev/null diff --git a/app/assets/images/file_empty.png b/app/assets/images/file_empty.png Binary files differdeleted file mode 100644 index 2e85bb48737..00000000000 --- a/app/assets/images/file_empty.png +++ /dev/null diff --git a/app/assets/images/file_img.png b/app/assets/images/file_img.png Binary files differdeleted file mode 100644 index ca554c5aefe..00000000000 --- a/app/assets/images/file_img.png +++ /dev/null diff --git a/app/assets/images/file_txt.png b/app/assets/images/file_txt.png Binary files differdeleted file mode 100644 index b3230b5add0..00000000000 --- a/app/assets/images/file_txt.png +++ /dev/null diff --git a/app/assets/images/rss_ui.png b/app/assets/images/rss_ui.png Binary files differdeleted file mode 100644 index c45afbab519..00000000000 --- a/app/assets/images/rss_ui.png +++ /dev/null diff --git a/app/assets/images/submodule.png b/app/assets/images/submodule.png Binary files differdeleted file mode 100644 index 62a88cc619b..00000000000 --- a/app/assets/images/submodule.png +++ /dev/null diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index a22ff6dec31..9bcd8f0a171 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -13,7 +13,7 @@ #= require jquery.history #= require jquery.waitforimages #= require jquery.atwho -#= require jquery.scrollto +#= require jquery.scrollTo #= require jquery.blockUI #= require turbolinks #= require jquery.turbolinks @@ -29,6 +29,8 @@ #= require underscore #= require nprogress #= require nprogress-turbolinks +#= require dropzone +#= require semantic-ui/sidebar #= require_tree . window.slugify = (text) -> diff --git a/app/assets/javascripts/behaviors/toggler_behavior.coffee b/app/assets/javascripts/behaviors/toggler_behavior.coffee index d06cb116dfe..1b2ed9efc25 100644 --- a/app/assets/javascripts/behaviors/toggler_behavior.coffee +++ b/app/assets/javascripts/behaviors/toggler_behavior.coffee @@ -1,8 +1,4 @@ $ -> - $("body").on "click", ".js-toggler-target", -> - container = $(@).closest(".js-toggler-container") - container.toggleClass("on") - # Toggle button. Show/hide content inside parent container. # Button does not change visibility. If button has icon - it changes chevron style. # diff --git a/app/assets/javascripts/blob.js.coffee b/app/assets/javascripts/blob.js.coffee index 584f6faea16..9db919e5a62 100644 --- a/app/assets/javascripts/blob.js.coffee +++ b/app/assets/javascripts/blob.js.coffee @@ -26,7 +26,7 @@ class BlobView unless isNaN first_line $("#tree-content-holder .highlight .line").removeClass("hll") $("#LC#{line}").addClass("hll") for line in [first_line..last_line] - $("#L#{first_line}").ScrollTo() unless e? + $.scrollTo("#L#{first_line}") unless e? # parse selected lines from hash # always return first and last line (initialized to NaN) diff --git a/app/assets/javascripts/commits.js.coffee b/app/assets/javascripts/commits.js.coffee index 9c004c997ed..784d7d20bb1 100644 --- a/app/assets/javascripts/commits.js.coffee +++ b/app/assets/javascripts/commits.js.coffee @@ -12,7 +12,7 @@ class CommitsList $('.loading').hide() @init: (ref, limit) -> - $(".day-commits-table li.commit").live 'click', (event) -> + $("body").on "click", ".day-commits-table li.commit", (event) -> if event.target.nodeName != "A" location.href = $(this).attr("url") e.stopPropagation() diff --git a/app/assets/javascripts/dashboard.js.coffee b/app/assets/javascripts/dashboard.js.coffee index d2bd9e7362b..c4a0ccd9c2a 100644 --- a/app/assets/javascripts/dashboard.js.coffee +++ b/app/assets/javascripts/dashboard.js.coffee @@ -4,7 +4,7 @@ class Dashboard $(".dash-filter").keyup -> terms = $(this).val() - uiBox = $(this).parents('.ui-box').first() + uiBox = $(this).parents('.panel').first() if terms == "" || terms == undefined uiBox.find(".dash-list li").show() else diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index b61d9875e03..ff68b520ad6 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -21,6 +21,8 @@ class Dispatcher Issues.init() when 'projects:issues:show' new Issue() + when 'projects:milestones:show' + new Milestone() when 'projects:issues:new', 'projects:merge_requests:new' GitLab.GfmAutoComplete.setup() when 'dashboard:show' @@ -32,8 +34,6 @@ class Dispatcher new Activities() when 'projects:new', 'projects:edit' new Project() - when 'projects:walls:show' - new Wall(project_id) when 'projects:teams:members:index' new TeamMembers() when 'groups:members' diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee index e2f1bc743f7..54de93a4e04 100644 --- a/app/assets/javascripts/issues.js.coffee +++ b/app/assets/javascripts/issues.js.coffee @@ -38,7 +38,7 @@ initChecks: -> $(".check_all_issues").click -> - $(".selected_issue").attr "checked", @checked + $(".selected_issue").prop("checked", @checked) Issues.checkChanged() $(".selected_issue").bind "change", Issues.checkChanged diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee new file mode 100644 index 00000000000..def5d12a820 --- /dev/null +++ b/app/assets/javascripts/markdown_area.js.coffee @@ -0,0 +1,85 @@ +formatLink = (str) -> + "![" + str.alt + "](" + str.url + ")" + +$(document).ready -> + alertClass = "alert alert-danger alert-dismissable div-dropzone-alert" + alertAttr = "class=\"close\" data-dismiss=\"alert\"" + "aria-hidden=\"true\"" + divHover = "<div class=\"div-dropzone-hover\"></div>" + divSpinner = "<div class=\"div-dropzone-spinner\"></div>" + divAlert = "<div class=\"" + alertClass + "\"></div>" + iconPicture = "<i class=\"icon-picture div-dropzone-icon\"></i>" + iconSpinner = "<i class=\"icon-spinner icon-spin div-dropzone-icon\"></i>" + btnAlert = "<button type=\"button\"" + alertAttr + ">×</button>" + project_image_path_upload = window.project_image_path_upload or null + + $("textarea.markdown-area").wrap "<div class=\"div-dropzone\"></div>" + + $(".div-dropzone").parent().addClass "div-dropzone-wrapper" + + $(".div-dropzone").append divHover + $(".div-dropzone-hover").append iconPicture + $(".div-dropzone").append divSpinner + $(".div-dropzone-spinner").append iconSpinner + + + dropzone = $(".div-dropzone").dropzone( + url: project_image_path_upload + dictDefaultMessage: "" + clickable: true + paramName: "markdown_img" + maxFilesize: 10 + uploadMultiple: false + acceptedFiles: "image/jpg,image/jpeg,image/gif,image/png" + headers: + "X-CSRF-Token": $("meta[name=\"csrf-token\"]").attr("content") + + previewContainer: false + + processing: -> + $(".div-dropzone-alert").alert "close" + + dragover: -> + $(".div-dropzone > textarea").addClass "div-dropzone-focus" + $(".div-dropzone-hover").css "opacity", 0.7 + return + + dragleave: -> + $(".div-dropzone > textarea").removeClass "div-dropzone-focus" + $(".div-dropzone-hover").css "opacity", 0 + return + + drop: -> + $(".div-dropzone > textarea").removeClass "div-dropzone-focus" + $(".div-dropzone-hover").css "opacity", 0 + $(".div-dropzone > textarea").focus() + return + + success: (header, response) -> + child = $(dropzone[0]).children("textarea") + $(child).val $(child).val() + formatLink(response.link) + "\n" + return + + error: (temp, errorMessage) -> + checkIfMsgExists = $(".error-alert").children().length + if checkIfMsgExists is 0 + $(".error-alert").append divAlert + $(".div-dropzone-alert").append btnAlert + errorMessage + return + + sending: -> + $(".div-dropzone-spinner").css "opacity", 0.7 + return + + complete: -> + $(".dz-preview").remove() + $(".markdown-area").trigger "input" + $(".div-dropzone-spinner").css "opacity", 0 + return + ) + + $(".markdown-selector").click (e) -> + e.preventDefault() + $(".div-dropzone").click() + return + + return
\ No newline at end of file diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee index 7589fc70cd8..b04a81c85eb 100644 --- a/app/assets/javascripts/merge_request.js.coffee +++ b/app/assets/javascripts/merge_request.js.coffee @@ -43,7 +43,7 @@ class MergeRequest , 'json' bindEvents: -> - this.$('.nav-tabs').on 'click', 'a', (event) => + this.$('.merge-request-tabs').on 'click', 'a', (event) => a = $(event.currentTarget) href = a.attr('href') @@ -51,7 +51,7 @@ class MergeRequest event.preventDefault() - this.$('.nav-tabs').on 'click', 'li', (event) => + this.$('.merge-request-tabs').on 'click', 'li', (event) => this.activateTab($(event.currentTarget).data('action')) this.$('.accept_merge_request').on 'click', -> @@ -71,15 +71,15 @@ class MergeRequest this.$('.remove_source_branch_widget.failed').show() activateTab: (action) -> - this.$('.nav-tabs li').removeClass 'active' + this.$('.merge-request-tabs li').removeClass 'active' this.$('.tab-content').hide() switch action when 'diffs' - this.$('.nav-tabs .diffs-tab').addClass 'active' + this.$('.merge-request-tabs .diffs-tab').addClass 'active' this.loadDiff() unless @diffs_loaded this.$('.diffs').show() else - this.$('.nav-tabs .notes-tab').addClass 'active' + this.$('.merge-request-tabs .notes-tab').addClass 'active' this.$('.notes').show() showState: (state) -> @@ -107,7 +107,7 @@ class MergeRequest loadDiff: (event) -> $.ajax type: 'GET' - url: this.$('.nav-tabs .diffs-tab a').attr('href') + url: this.$('.merge-request-tabs .diffs-tab a').attr('href') beforeSend: => this.$('.status').addClass 'loading' complete: => diff --git a/app/assets/javascripts/milestone.js.coffee b/app/assets/javascripts/milestone.js.coffee new file mode 100644 index 00000000000..ea01c318d4f --- /dev/null +++ b/app/assets/javascripts/milestone.js.coffee @@ -0,0 +1,119 @@ +class Milestone + @updateIssue: (li, issue_url, data) -> + $.ajax + type: "PUT" + url: issue_url + data: data + success: (data) -> + if data.saved == true + if data.assignee_avatar_url + img_tag = $('<img/>') + img_tag.attr('src', data.assignee_avatar_url) + img_tag.addClass('avatar s16') + $(li).find('.assignee-icon').html(img_tag) + else + $(li).find('.assignee-icon').html('') + $(li).effect 'highlight' + else + new Flash("Issue update failed", 'alert') + dataType: "json" + + @sortIssues: (data) -> + sort_issues_url = location.href + "/sort_issues" + + $.ajax + type: "PUT" + url: sort_issues_url + data: data + success: (data) -> + if data.saved != true + new Flash("Issues update failed", 'alert') + dataType: "json" + + @sortMergeRequests: (data) -> + sort_mr_url = location.href + "/sort_merge_requests" + + $.ajax + type: "PUT" + url: sort_mr_url + data: data + success: (data) -> + if data.saved != true + new Flash("MR update failed", 'alert') + dataType: "json" + + @updateMergeRequest: (li, merge_request_url, data) -> + $.ajax + type: "PUT" + url: merge_request_url + data: data + success: (data) -> + if data.saved == true + $(li).effect 'highlight' + else + new Flash("Issue update failed", 'alert') + dataType: "json" + + constructor: -> + @bindIssuesSorting() + @bindMergeRequestSorting() + + bindIssuesSorting: -> + $("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed").sortable( + connectWith: ".issues-sortable-list", + dropOnEmpty: true, + items: "li:not(.ui-sort-disabled)", + update: (event, ui) -> + data = $(this).sortable("serialize") + Milestone.sortIssues(data) + + receive: (event, ui) -> + new_state = $(this).data('state') + issue_id = ui.item.data('iid') + issue_url = ui.item.data('url') + + data = switch new_state + when 'ongoing' + "issue[assignee_id]=" + gon.current_user_id + when 'unassigned' + "issue[assignee_id]=" + when 'closed' + "issue[state_event]=close" + + if $(ui.sender).data('state') == "closed" + data += "&issue[state_event]=reopen" + + Milestone.updateIssue(ui.item, issue_url, data) + + ).disableSelection() + + bindMergeRequestSorting: -> + $("#merge_requests-list-unassigned, #merge_requests-list-ongoing, #merge_requests-list-closed").sortable( + connectWith: ".merge_requests-sortable-list", + dropOnEmpty: true, + items: "li:not(.ui-sort-disabled)", + update: (event, ui) -> + data = $(this).sortable("serialize") + Milestone.sortMergeRequests(data) + + receive: (event, ui) -> + new_state = $(this).data('state') + merge_request_id = ui.item.data('iid') + merge_request_url = ui.item.data('url') + + data = switch new_state + when 'ongoing' + "merge_request[assignee_id]=" + gon.current_user_id + when 'unassigned' + "merge_request[assignee_id]=" + when 'closed' + "merge_request[state_event]=close" + + if $(ui.sender).data('state') == "closed" + data += "&merge_request[state_event]=reopen" + + Milestone.updateMergeRequest(ui.item, merge_request_url, data) + + ).disableSelection() + +@Milestone = Milestone diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 4510718c2fd..a41ee67a841 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -32,6 +32,9 @@ class Notes # Preview button $(document).on "click", ".js-note-preview-button", @previewNote + # Preview button + $(document).on "click", ".js-note-write-button", @writeNote + # reset main target form after submit $(document).on "ajax:complete", ".js-main-target-form", @resetMainTargetForm @@ -68,6 +71,7 @@ class Notes $(document).off "click", ".js-note-delete" $(document).off "click", ".js-note-attachment-delete" $(document).off "click", ".js-note-preview-button" + $(document).off "click", ".js-note-write-button" $(document).off "ajax:complete", ".js-main-target-form" $(document).off "click", ".js-choose-note-attachment-button" $(document).off "click", ".js-discussion-reply-button" @@ -145,15 +149,35 @@ class Notes @removeDiscussionNoteForm(form) ### + Shows write note textarea. + ### + writeNote: (e) -> + e.preventDefault() + form = $(this).closest("form") + # toggle tabs + form.find(".js-note-write-button").parent().addClass "active" + form.find(".js-note-preview-button").parent().removeClass "active" + + # toggle content + form.find(".note-write-holder").show() + form.find(".note-preview-holder").hide() + + ### Shows the note preview. Lets the server render GFM into Html and displays it. - - Note: uses the Toggler behavior to toggle preview/edit views/buttons ### previewNote: (e) -> e.preventDefault() form = $(this).closest("form") + # toggle tabs + form.find(".js-note-write-button").parent().removeClass "active" + form.find(".js-note-preview-button").parent().addClass "active" + + # toggle content + form.find(".note-write-holder").hide() + form.find(".note-preview-holder").show() + preview = form.find(".js-note-preview") noteText = form.find(".js-note-text").val() if noteText.trim().length is 0 @@ -179,8 +203,7 @@ class Notes form.find(".js-errors").remove() # reset text and preview - previewContainer = form.find(".js-toggler-container.note_text_and_preview") - previewContainer.removeClass "on" if previewContainer.is(".on") + form.find(".js-note-write-button").click() form.find(".js-note-text").val("").trigger "input" ### @@ -230,7 +253,7 @@ class Notes form.removeClass "js-new-note-form" # setup preview buttons - form.find(".js-note-edit-button, .js-note-preview-button").tooltip placement: "left" + form.find(".js-note-write-button, .js-note-preview-button").tooltip placement: "left" previewButton = form.find(".js-note-preview-button") form.find(".js-note-text").on "input", -> if $(this).val().trim() isnt "" diff --git a/app/assets/javascripts/project_users_select.js.coffee b/app/assets/javascripts/project_users_select.js.coffee index b0e39610feb..cfbcd5108c8 100644 --- a/app/assets/javascripts/project_users_select.js.coffee +++ b/app/assets/javascripts/project_users_select.js.coffee @@ -38,12 +38,8 @@ projectUserFormatResult: (user) -> if user.avatar_url avatar = user.avatar_url - else if gon.gravatar_enabled - avatar = gon.gravatar_url - avatar = avatar.replace('%{hash}', md5(user.email)) - avatar = avatar.replace('%{size}', '24') else - avatar = gon.relative_url_root + "/assets/no_avatar.png" + avatar = gon.default_avatar_url if user.id == '' avatarMarkup = '' diff --git a/app/assets/javascripts/sidebar.js.coffee b/app/assets/javascripts/sidebar.js.coffee new file mode 100644 index 00000000000..c084d730d62 --- /dev/null +++ b/app/assets/javascripts/sidebar.js.coffee @@ -0,0 +1,26 @@ +responsive_resize = -> + current_width = $(window).width() + if current_width < 985 + $('.responsive-side').addClass("ui right wide sidebar") + else + $('.responsive-side').removeClass("ui right wide sidebar") + +$ -> + # Depending on window size, set the sidebar offscreen. + responsive_resize() + + $('.sidebar-expand-button').click -> + $('.ui.sidebar') + .sidebar({overlay: true}) + .sidebar('toggle') + + # Hide sidebar on click outside of sidebar + $(document).mouseup (e) -> + container = $(".ui.sidebar") + container.sidebar "hide" if not container.is(e.target) and container.has(e.target).length is 0 + return + +# On resize, check if sidebar should be offscreen. +$(window).resize -> + responsive_resize() + return diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee index ce9a505b1e3..86318bd7d94 100644 --- a/app/assets/javascripts/users_select.js.coffee +++ b/app/assets/javascripts/users_select.js.coffee @@ -2,12 +2,8 @@ $ -> userFormatResult = (user) -> if user.avatar_url avatar = user.avatar_url - else if gon.gravatar_enabled - avatar = gon.gravatar_url - avatar = avatar.replace('%{hash}', md5(user.email)) - avatar = avatar.replace('%{size}', '24') else - avatar = gon.relative_url_root + "/assets/no_avatar.png" + avatar = gon.default_avatar_url "<div class='user-result'> <div class='user-image'><img class='avatar s24' src='#{avatar}'></div> diff --git a/app/assets/javascripts/wall.js.coffee b/app/assets/javascripts/wall.js.coffee deleted file mode 100644 index 4cc11331aca..00000000000 --- a/app/assets/javascripts/wall.js.coffee +++ /dev/null @@ -1,85 +0,0 @@ -class Wall - constructor: (project_id) -> - @project_id = project_id - @note_ids = [] - @getContent() - @initRefresh() - @initForm() - - # - # Gets an initial set of notes. - # - getContent: -> - Api.notes @project_id, (notes) => - $.each notes, (i, note) => - # render note if it not present in loaded list - # or skip if rendered - if $.inArray(note.id, @note_ids) == -1 - @note_ids.push(note.id) - @renderNote(note) - @scrollDown() - $("abbr.timeago").timeago() - - initRefresh: -> - setInterval => - @refresh() - , 10000 - - refresh: -> - @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', => - @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 = @noteTemplate() - template = template.replace('{{author_name}}', note.author.name) - template = template.replace(/{{created_at}}/g, note.created_at) - template = template.replace('{{text}}', simpleFormat(note.body)) - - if note.attachment - file = '<i class="icon-paper-clip"/><a href="' + gon.relative_url_root + '/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>' - else - file = '' - template = template.replace('{{file}}', file) - - - $('ul.notes').append(template) - - noteTemplate: -> - return '<li> - <strong class="wall-author">{{author_name}}</strong> - <span class="wall-text"> - {{text}} - <span class="wall-file">{{file}}</span> - </span> - <abbr class="timeago" title="{{created_at}}">{{created_at}}</abbr> - </li>' - -@Wall = Wall diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index c53873f95a2..7d058ad7719 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -10,6 +10,7 @@ *= require_self *= require nprogress *= require nprogress-bootstrap + *= require dropzone/basic */ @import "main/*"; @@ -33,6 +34,7 @@ /** * Page specific styles (issues, projects etc): */ + @import "sections/*"; /** @@ -49,3 +51,8 @@ * Styles for JS behaviors. */ @import "behaviors.scss"; + +/** +* Styles for responsive sidebar +*/ +@import "semantic-ui/modules/sidebar" diff --git a/app/assets/stylesheets/behaviors.scss b/app/assets/stylesheets/behaviors.scss index 3fdc20485f2..23f206ce3dc 100644 --- a/app/assets/stylesheets/behaviors.scss +++ b/app/assets/stylesheets/behaviors.scss @@ -4,11 +4,3 @@ .js-details-container .content.hide { display: block; } .js-details-container.open .content { display: block; } .js-details-container.open .content.hide { display: none; } - - -// Toggler -//-------- -.js-toggler-container .turn-on { display: inherit; } -.js-toggler-container .turn-off { display: none; } -.js-toggler-container.on .turn-on { display: none; } -.js-toggler-container.on .turn-off { display: inherit; } diff --git a/app/assets/stylesheets/generic/buttons.scss b/app/assets/stylesheets/generic/buttons.scss index dd0a2938cfe..36fc771a9dc 100644 --- a/app/assets/stylesheets/generic/buttons.scss +++ b/app/assets/stylesheets/generic/buttons.scss @@ -59,23 +59,21 @@ &.btn-primary { color: #ffffff; - background-color: #429bca; - border-color: #358ebd; + background-color: $bg_primary; + border-color: $border_primary; &.hover, &:hover, &.disabled, &[disabled] { color: #ffffff; - background-color: #3286b1; - border-color: #286e8e; } } &.btn-success { color: #ffffff; - background-color: #5cb85c; - border-color: #4cae4c; + background-color: $bg_success; + border-color: $border_success; &.hover, @@ -83,15 +81,27 @@ &.disabled, &[disabled] { color: #ffffff; - background-color: #47a447; - border-color: #398439; } } &.btn-danger { color: #ffffff; - background-color: #d9534f; - border-color: #d43f3a; + background-color: $bg_danger; + border-color: $border_danger; + + + &.hover, + &:hover, + &.disabled, + &[disabled] { + color: #ffffff; + } + } + + &.btn-warning { + color: #ffffff; + background-color: $bg_warning; + border-color: $border_warning; &.hover, @@ -99,8 +109,6 @@ &.disabled, &[disabled] { color: #ffffff; - background-color: #d2322d; - border-color: #ac2925; } } diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss index 4e660d0b1e0..da2c1b0cbd8 100644 --- a/app/assets/stylesheets/generic/common.scss +++ b/app/assets/stylesheets/generic/common.scss @@ -3,12 +3,7 @@ .clgray { color: #BBB } .cred { color: #D12F19 } .cgreen { color: #4a2 } -.cblue { color: #29A } -.cblack { color: #111 } .cdark { color: #444 } -.camber { color: #ffc000 } -.cwhite { color: #fff!important } -.bgred { background: #F2DEDE!important } /** COMMON CLASSES **/ .prepend-top-10 { margin-top:10px } @@ -60,23 +55,12 @@ pre { .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { - background: #29b; + background: $bg_style_color; color: #FFF } -.breadcrumb > li + li:before { - content: "/"; - padding: 0; - color: #666; -} - .str-truncated { - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - vertical-align: top; - white-space: nowrap; - max-width: 82%; + @include str-truncated; } /** FLASH message **/ diff --git a/app/assets/stylesheets/generic/files.scss b/app/assets/stylesheets/generic/files.scss index 9e4207965f9..1412277ffb6 100644 --- a/app/assets/stylesheets/generic/files.scss +++ b/app/assets/stylesheets/generic/files.scss @@ -16,11 +16,11 @@ text-shadow: 0 1px 1px #fff; margin: 0; text-align: left; - padding: 9px 10px; + padding: 10px 15px; .options { float: right; - margin-top: -5px; + margin-top: -3px; } .left-options { diff --git a/app/assets/stylesheets/generic/forms.scss b/app/assets/stylesheets/generic/forms.scss index 36551f85b6a..5258acca466 100644 --- a/app/assets/stylesheets/generic/forms.scss +++ b/app/assets/stylesheets/generic/forms.scss @@ -82,6 +82,7 @@ label { font-family: $monospace_font; $left: 12px; .max-width-marker { + width: 72ch; color: rgba(0, 0, 0, 0.0); font-family: inherit; left: $left; @@ -98,3 +99,7 @@ label { z-index: 2; } } + +.fieldset-form fieldset { + margin-bottom: 20px; +} diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss index bd692417989..c468980f64d 100644 --- a/app/assets/stylesheets/generic/issue_box.scss +++ b/app/assets/stylesheets/generic/issue_box.scss @@ -17,52 +17,36 @@ &.issue-box-closed { border-color: $border_danger; .state { - background-color: $bg_light_danger; + background-color: $bg_danger; + color: #FFF; border-color: $border_danger; - color: $color_danger; - .state-label { - background-color: $bg_danger; - color: #FFF; - } } } &.issue-box-merged { border-color: $border_primary; .state { - background-color: $bg_light_primary; + background-color: $bg_primary; + color: #FFF; border-color: $border_primary; - color: $color_primary; - .state-label { - background-color: $bg_primary; - color: #FFF; - } } } &.issue-box-open { border-color: $border_success; .state { - background-color: $bg_light_success; border-color: $border_success; - color: $color_success; - .state-label { - background-color: $bg_success; - color: #FFF; - } + background-color: $bg_success; + color: #FFF; } } &.issue-box-expired { border-color: #cea61b; .state { - background-color: #fcf8e3; border-color: #faebcc; - color: #8a6d3b; - .state-label { - background: #cea61b; - color: #FFF; - } + background: #cea61b; + color: #FFF; } } @@ -72,23 +56,22 @@ .state { border-bottom: 1px solid #DDD; - line-height: 32px; + padding: 10px 15px; } .title { - font-size: 22px; - font-weight: 500; + font-size: 28px; + font-weight: normal; line-height: 1.5; margin: 0; color: #333; - padding-bottom: 0; - padding: 15px 25px; + padding: 10px 15px; } .context { border: none; border-top: 1px solid #eee; - padding: 15px 25px; + padding: 10px 15px; // Reset text align for children .text-right > * { text-align: left; } @@ -104,7 +87,7 @@ } .description { - padding: 0 25px 15px 25px; + padding: 0 15px 10px 15px; } .title, .context, .description { @@ -115,14 +98,15 @@ .state-label { font-size: 14px; - padding: 1px 25px; - text-align: center; - text-shadow: none; - display: inline-block; - line-height: 34px; + float: left; + font-weight: bold; } .creator { - padding: 2px 15px; + float: right; + a { + color: #FFF; + text-decoration: underline; + } } } diff --git a/app/assets/stylesheets/generic/lists.scss b/app/assets/stylesheets/generic/lists.scss index 963768044d5..0cab6c44c91 100644 --- a/app/assets/stylesheets/generic/lists.scss +++ b/app/assets/stylesheets/generic/lists.scss @@ -8,7 +8,7 @@ list-style: none; li { - padding: 10px; + padding: 10px 15px; min-height: 20px; border-bottom: 1px solid #eee; border-bottom: 1px solid rgba(0, 0, 0, 0.05); @@ -72,6 +72,15 @@ font-size: 14px; line-height: 18px; } + + .row_title { + font-weight: 500; + color: #444; + &:hover { + color: #444; + text-decoration: underline; + } + } } } diff --git a/app/assets/stylesheets/generic/markdown_area.scss b/app/assets/stylesheets/generic/markdown_area.scss new file mode 100644 index 00000000000..fbfa72c5e5e --- /dev/null +++ b/app/assets/stylesheets/generic/markdown_area.scss @@ -0,0 +1,52 @@ +.div-dropzone-wrapper { + .div-dropzone { + position: relative; + padding: 0; + border: 0; + margin-bottom: 5px; + + .div-dropzone-focus { + border-color: #66afe9 !important; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6) !important; + outline: 0 !important; + } + + .div-dropzone-hover { + position: absolute; + top: 50%; + left: 50%; + margin-top: -0.5em; + margin-left: -0.6em; + opacity: 0; + font-size: 50px; + transition: opacity 200ms ease-in-out; + } + + .div-dropzone-spinner { + position: absolute; + top: 100%; + left: 100%; + margin-top: -1.1em; + margin-left: -1.1em; + opacity: 0; + font-size: 30px; + transition: opacity 200ms ease-in-out; + } + + .div-dropzone-icon { + display: block; + text-align: center; + font-size: inherit; + } + + .dz-preview { + display: none; + } + } +} + +.div-dropzone-alert { + margin-top: 5px; + margin-bottom: 0; + transition: opacity 200ms ease-in-out; +} diff --git a/app/assets/stylesheets/generic/selects.scss b/app/assets/stylesheets/generic/selects.scss index 03597c1fc7d..0afd85aedf6 100644 --- a/app/assets/stylesheets/generic/selects.scss +++ b/app/assets/stylesheets/generic/selects.scss @@ -3,13 +3,29 @@ .select2-choice { background: #FFF; border-color: #BBB; + padding: 6px 12px; + font-size: 13px; + line-height: 18px; + height: auto; .select2-arrow { background: #FFF; + border-left: 1px solid #DDD; } } } +.select2-container-multi .select2-choices { + @include border-radius(4px) +} + +.select2-container-multi .select2-choices .select2-search-field input { + padding: 6px 12px; + font-size: 13px; + line-height: 18px; + height: auto; +} + .select2-drop-active { border: 1px solid #BBB !important; margin-top: 4px; diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss new file mode 100644 index 00000000000..f6311ef74e8 --- /dev/null +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -0,0 +1,46 @@ +.ui.sidebar { + z-index: 1000 !important; + background: #fff; + padding: 10px; + width: 285px; +} + +.ui.right.sidebar { + border-left: 1px solid #e1e1e1; + border-right: 0; +} + +.sidebar-expand-button { + cursor: pointer; + transition: all 0.4s; + -moz-transition: all 0.4s; + -webkit-transition: all 0.4s; +} + +.fixed.sidebar-expand-button { + background: #f9f9f9; + color: #555; + padding: 9px 12px 6px 14px; + border: 1px solid #E1E1E1; + border-right: 0; + position: fixed; + top: 108px; + right: 0px; + margin-right: 0; + &:hover { + background: #ddd; + color: #333; + padding-right: 25px; + } +} + +.btn.btn-default.sidebar-expand-button { + margin-left: 12px; + display: inline-block !important; +} + +@media (min-width: 767px) { +.btn.btn-default.sidebar-expand-button { + display: none!important; + } +} diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss index 8cc72d7f07a..9aa819d40fc 100644 --- a/app/assets/stylesheets/generic/typography.scss +++ b/app/assets/stylesheets/generic/typography.scss @@ -14,6 +14,7 @@ h2.page-title { h3.page-title { @include page-title; + font-size: 22px; } h6 { @@ -40,7 +41,7 @@ a { color: $link_color; &:hover { text-decoration: none; - color: $primary_color; + color: $link_hover_color; } &:focus { diff --git a/app/assets/stylesheets/generic/ui_box.scss b/app/assets/stylesheets/generic/ui_box.scss deleted file mode 100644 index 7a977eae70d..00000000000 --- a/app/assets/stylesheets/generic/ui_box.scss +++ /dev/null @@ -1,173 +0,0 @@ -/** - * UI box: - * Block element for separating information on page. - * Used for storing issues lists, grouped data. - * You can have multiple ui boxes on one page - * - * Classes: - * .ui-box - for any block & widgets - * .ui-box.ui-box-small - same but with smaller title - * .ui-box.ui-box-danger - with red title - * - * Ex. 1: List - * .ui-box - * .title - * # title here - * %ul - * # content here - * - * Ex. 2: Block data - * .ui-box - * .title - * # title here - * .body - * # content here - * - */ - -.ui-box { - background: #FFF; - margin-bottom: 20px; - border: 1px solid #DDD; - word-wrap: break-word; - - img { - max-width: 100%; - } - - pre { - code { - background: none !important; - } - } - - ul { - margin: 0; - padding: 0; - } - - .title { - background-color: #EEE; - border-bottom: 1px solid #DDD; - color: #666; - font-size: 16px; - text-shadow: 0 1px 1px #fff; - padding: 0 10px; - font-size: 14px; - line-height: 40px; - font-weight: normal; - margin: 0; - - > a { - text-shadow: 0 1px 1px #fff; - } - - form { - margin-bottom: 0; - margin-top: 0; - } - - .btn { - vertical-align: middle; - padding: 4px 12px; - @include box-shadow(0 0px 1px 1px #f2f2f2); - } - - .nav-pills { - > li { - > a { - padding: 13px; - margin: 0; - font-size: 13px; - } - &.active { - > a { - background: #D5D5D5; - color: $style_color; - @include border-radius(0); - border-radius: 0; - border-left: 1px solid #CCC; - border-right: 1px solid #CCC; - } - } - } - } - } - - .body { - padding: 10px; - } - - &.padded { - h5, .title { - margin: -20px; - margin-bottom: 0; - padding: 5px 20px; - } - } - - .row_title { - font-weight: 500; - color: #444; - &:hover { - color: #444; - text-decoration: underline; - } - } - - .form-holder { - padding-top: 20px; - form { - margin-bottom: 0; - legend { - text-indent: 10px; - } - .form-actions { - margin-bottom: 0; - } - } - } -} - -/* - * Small box - */ -.ui-box.ui-box-small { - margin-bottom: 10px; - - .title { - font-size: 13px; - line-height: 30px; - - a { - color: #666; - &:hover { - text-decoration: underline; - } - } - } -} - -/* - * Danger box - */ -.ui-box.ui-box-danger { - background: #f7f7f7; - border: none; - - .title { - background: #D65; - color: #fff; - text-shadow: none; - font-weight: 500; - } -} - -/* - * Block under tw-bootstrap tabs - */ -.tab-pane { - .ui-box { - margin: 3px 3px 25px 3px; - } -} diff --git a/app/assets/stylesheets/gl_bootstrap.scss b/app/assets/stylesheets/gl_bootstrap.scss index 8676f07b1a2..4271a7b310c 100644 --- a/app/assets/stylesheets/gl_bootstrap.scss +++ b/app/assets/stylesheets/gl_bootstrap.scss @@ -7,8 +7,9 @@ */ $font-size-base: 13px !default; -$nav-pills-active-link-hover-bg: $bg_style_color; -$pagination-active-bg: $bg_style_color; +$nav-pills-active-link-hover-bg: $bg_primary; +$pagination-active-bg: $bg_primary; +$list-group-active-bg: $bg_style_color; // Core variables and mixins @import "bootstrap/variables"; @@ -113,8 +114,7 @@ $pagination-active-bg: $bg_style_color; li { > a { - padding: 8px 20px; - margin-right: 7px; + margin-right: 5px; line-height: 20px; border-color: #EEE; color: #888; @@ -199,20 +199,6 @@ $pagination-active-bg: $bg_style_color; color: #3c763d; } -// Breadcrumb -ul.breadcrumb { - background: white; - border: none; - li { - display: inline; - text-shadow: 0 1px 0 white - } - - a { - font-size: 16px; - } -} - /** * fix to keep tooltips position in top navigation bar * @@ -221,3 +207,108 @@ ul.breadcrumb { position: relative; white-space: nowrap; } + +/** + * Add some extra stuff to panels + * + */ +.panel { + @include border-radius(0px); + + .panel-heading { + @include border-radius(0px); + font-size: 14px; + line-height: 18px; + + .panel-head-actions { + position: relative; + top: -7px; + float: right; + } + } + + .panel-body { + form { + margin: 0; + } + + .form-actions { + margin-bottom: 0; + background: #FFF; + } + } + + .panel-footer { + .pagination { + margin: 0; + } + } + + &.panel-small { + .panel-heading { + padding: 6px 15px; + font-size: 13px; + a { + color: #777; + } + } + } +} + +.panel-default { + .panel-heading { + background-color: #EEE; + } +} + +.panel-danger { + border-color: $border_danger; + .panel-heading { + color: #ffffff; + background-color: $bg_danger; + border-color: $border_danger; + a { + color: #FFF; + text-decoration: underline; + } + } +} + +.panel-success { + border-color: $border_success; + .panel-heading { + color: #ffffff; + background-color: $bg_success; + border-color: $border_success; + a { + color: #FFF; + text-decoration: underline; + } + } +} + +.panel-primary { + border-color: $border_primary; + .panel-heading { + color: #ffffff; + background-color: $bg_primary; + border-color: $border_primary; + a { + color: #FFF; + text-decoration: underline; + } + } +} + +.panel-warning { + border-color: $border_warning; + .panel-heading { + color: #ffffff; + background-color: $bg_warning; + border-color: $border_warning; + a { + color: #FFF; + text-decoration: underline; + } + } +} diff --git a/app/assets/stylesheets/main/mixins.scss b/app/assets/stylesheets/main/mixins.scss index 8143cfa2c81..93faf5ced65 100644 --- a/app/assets/stylesheets/main/mixins.scss +++ b/app/assets/stylesheets/main/mixins.scss @@ -118,8 +118,17 @@ @mixin page-title { color: #333; - font-size: 20px; line-height: 1.5; + font-weight: normal; margin-top: 0px; - margin-bottom: 15px; + margin-bottom: 10px; +} + +@mixin str-truncated($max_width: 82%) { + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: top; + white-space: nowrap; + max-width: $max_width; } diff --git a/app/assets/stylesheets/main/variables.scss b/app/assets/stylesheets/main/variables.scss index f133777de56..68f7f6b8581 100644 --- a/app/assets/stylesheets/main/variables.scss +++ b/app/assets/stylesheets/main/variables.scss @@ -1,37 +1,39 @@ -/** +/* * General Colors */ -$primary_color: #2FA0BB; -$link_color: #3A89A3; $style_color: #474D57; $bg_style_color: #2299BB; -$list-group-active-bg: $bg_style_color; $hover: #D9EDF7; /* + * Link colors + */ +$link_color: #446e9b; +$link_hover_color: #2FA0BB; + +/* * Success colors (green) */ -$border_success: #4cae4c; -$bg_success: #5cb85c; -$bg_light_success: #dff0d8; -$color_success: #3c763d; +$border_success: #019875; +$bg_success: #019875; /* * Danger colors (red) */ $border_danger: #d43f3a; $bg_danger: #d9534f; -$bg_light_danger: #f2dede; -$color_danger: #a94442; /* * Primary colors (blue) */ -$border_primary: #358ebd; -$bg_primary: #429bca; -$bg_light_primary: #d9edf7; -$color_primary: #31708f; +$border_primary: #446e9b; +$bg_primary: #446e9b; +/* + * Warning colors (yellow) + */ +$bg_warning: #EB9532; +$border_warning: #EB9532; /** * Commit Diff Colors diff --git a/app/assets/stylesheets/sections/admin.scss b/app/assets/stylesheets/sections/admin.scss index a558633d112..a51deee7970 100644 --- a/app/assets/stylesheets/sections/admin.scss +++ b/app/assets/stylesheets/sections/admin.scss @@ -21,12 +21,22 @@ } .admin-filter form { - label { width: 110px; } - .controls { margin-left: 130px; } - .form-actions { padding-left: 130px; background: #fff } - .visibility-levels { - .controls { - margin-bottom: 9px; + .select2-container { + width: 100% + } + + .controls { + margin-left: 130px; + } + + .form-actions { + padding-left: 130px; + background: #fff + } + + .visibility-levels { + .controls { + margin-bottom: 9px; } i { diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index 855bb4ea010..ef8c5f089b9 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -115,10 +115,6 @@ line-height: 2; } -.commit-breadcrumb { - padding: 0; -} - .commit-info-row { margin-bottom: 10px; .avatar { @@ -140,8 +136,6 @@ * COMMIT ROW */ li.commit { - padding: 8px; - .commit-row-title { font-size: 14px; margin-bottom: 2px; @@ -212,3 +206,10 @@ li.commit { } } } + +.commits-feed-holder { + float: right; + .btn { + padding: 4px 12px; + } +} diff --git a/app/assets/stylesheets/sections/dashboard.scss b/app/assets/stylesheets/sections/dashboard.scss index e70757e0406..6487e0acd91 100644 --- a/app/assets/stylesheets/sections/dashboard.scss +++ b/app/assets/stylesheets/sections/dashboard.scss @@ -1,10 +1,11 @@ .dashboard { .side { - .ui-box { - margin: 0px; - box-shadow: none; - - .nav-projects-tabs li { padding: 0; } + .panel { + .panel-heading { + background: #EEE; + border-top-left-radius: 0; + } + border-top-left-radius: 0; } } } @@ -24,9 +25,7 @@ .dashboard { .dash-filter { - margin: 7px 0; - padding: 4px 6px; - width: 220px; + width: 205px; float: left; height: inherit; } @@ -34,7 +33,7 @@ @media (max-width: 1200px) { .dashboard .dash-filter { - width: 150px; + width: 140px; } } @@ -61,7 +60,7 @@ } .project-row, .group-row { - padding: 8px 12px !important; + padding: 8px 15px !important; font-size: 14px; line-height: 24px; @@ -75,10 +74,8 @@ .arrow { float: right; - padding: 0px 5px; margin: 0; font-size: 20px; - color: #666; } .last-activity { @@ -112,6 +109,5 @@ .dash-project-access-icon { float: left; margin-right: 3px; - color: #999; width: 16px; } diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss index af44654d5da..f4926e2f523 100644 --- a/app/assets/stylesheets/sections/diff.scss +++ b/app/assets/stylesheets/sections/diff.scss @@ -11,7 +11,6 @@ > span { font-family: $monospace_font; - font-size: 14px; line-height: 2; } @@ -19,9 +18,7 @@ float: right; .btn { - background-color: #EEE; - color: #666; - font-weight: bolder; + background-color: #FFF; } } @@ -32,6 +29,7 @@ .file-mode { font-family: $monospace_font; + margin-left: 10px; } } .diff-content { @@ -51,6 +49,11 @@ } } + .file-mode-changed { + padding: 10px; + color: #777; + } + table { width: 100%; font-family: $monospace_font; @@ -330,3 +333,8 @@ } } } + +.file-content .diff-file { + margin: 0; + border: none; +} diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index b68f882220e..957af62c0ea 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -45,6 +45,7 @@ padding: 12px 0px; border-bottom: 1px solid #eee; .event-title { + @include str-truncated(72%); color: #333; font-weight: normal; font-size: 14px; @@ -135,6 +136,12 @@ } } } + + .event-item-timestamp { + float: right; + color: #999; + line-height: 22px; + } } /** @@ -166,3 +173,19 @@ } } } + +/* + * Last push widget + */ +.event-last-push { + .event-last-push-text { + @include str-truncated(75%); + line-height: 24px; + } +} + +@media (max-width: $screen-xs-max) { + .event-item .event-title { + @include str-truncated(65%); + } +} diff --git a/app/assets/stylesheets/sections/graph.scss b/app/assets/stylesheets/sections/graph.scss index 8a337a5e206..3d878d1e528 100644 --- a/app/assets/stylesheets/sections/graph.scss +++ b/app/assets/stylesheets/sections/graph.scss @@ -1,10 +1,10 @@ .project-network { border: 1px solid #CCC; - .tip { + .controls { color: #888; font-size: 14px; - padding: 10px; + padding: 5px; border-bottom: 1px solid #bbb; background: #EEE; } diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss index 1adbdfd9790..b811b0bc665 100644 --- a/app/assets/stylesheets/sections/header.scss +++ b/app/assets/stylesheets/sections/header.scss @@ -137,6 +137,7 @@ header { .profile-pic { position: relative; top: -1px; + padding-right: 0px !important; img { width: 26px; height: 26px; diff --git a/app/assets/stylesheets/sections/help.scss b/app/assets/stylesheets/sections/help.scss new file mode 100644 index 00000000000..90ed98ba25f --- /dev/null +++ b/app/assets/stylesheets/sections/help.scss @@ -0,0 +1,19 @@ +.documentation-index { + h1 { + margin: 0; + } + + h2 { + font-size: 20px; + } + + li { + line-height: 24px; + color: #888; + + a { + font-size: 14px; + margin-right: 3px; + } + } +} diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss index 02c9123178f..495a7cb3113 100644 --- a/app/assets/stylesheets/sections/issues.scss +++ b/app/assets/stylesheets/sections/issues.scss @@ -1,6 +1,6 @@ .issues-list { .issue { - padding: 10px; + padding: 10px 15px; position: relative; .issue-title { @@ -27,7 +27,7 @@ display: none; position: absolute; top: 10px; - right: 2px; + right: 15px; } &:hover { @@ -42,7 +42,7 @@ height: 32px; float: left; margin-right: 12px; - padding: 6px 10px; + padding: 6px 15px; border: 1px solid #ccc; @include border-radius(4px); } diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index 2d9a5e4bbe6..12044db6702 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -19,12 +19,17 @@ } } -.merge-request .nav-tabs{ +.merge-request .merge-request-tabs{ + border-bottom: 2px solid $border_primary; + margin: 20px 0; + li { a { - font-weight: bold; - padding: 8px 20px; - text-align: center; + padding: 15px 40px; + font-size: 14px; + margin-bottom: -2px; + border-bottom: 2px solid $border_primary; + @include border-radius(0px); } } } @@ -63,7 +68,7 @@ .mr-list { .merge-request { - padding: 10px; + padding: 10px 15px; position: relative; .merge-request-title { @@ -99,12 +104,6 @@ } .mr-state-widget { - @include border-radius(0px); - - .panel-heading { - @include border-radius(0px); - } - .panel-body { h4 { margin-top: 0px; @@ -119,3 +118,7 @@ .merge-request-show-labels .label { padding: 6px 10px; } + +.mr-commits .commit { + padding: 10px 15px; +} diff --git a/app/assets/stylesheets/sections/milestone.scss b/app/assets/stylesheets/sections/milestone.scss new file mode 100644 index 00000000000..d20391e38fd --- /dev/null +++ b/app/assets/stylesheets/sections/milestone.scss @@ -0,0 +1,3 @@ +.issues-sortable-list .str-truncated { + max-width: 70%; +} diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss index 88f16a21596..59eaaec9498 100644 --- a/app/assets/stylesheets/sections/nav.scss +++ b/app/assets/stylesheets/sections/nav.scss @@ -64,7 +64,7 @@ left: 50%; width: 0; height: 0; - border-color: transparent transparent #29b transparent; + border-color: transparent transparent $link_color transparent; border-style: solid; border-width: 6px; margin-left: -6px; @@ -116,7 +116,7 @@ padding: 5px 0; &.active { - background-color: $primary_color; + background-color: $link_hover_color; a { color: #fff; diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index 7e56781f56a..e8d6ec3e29a 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -37,7 +37,7 @@ ul.notes { font-weight: bold; font-size: 14px; &:hover { - color: $primary_color; + color: $link_hover_color; } } } @@ -83,6 +83,7 @@ ul.notes { overflow: hidden; display: block; position:relative; + border-bottom: 1px solid #eee; p { color: $style_color; } .avatar { @@ -98,22 +99,16 @@ ul.notes { .note-header { padding-bottom: 3px; } + + &:last-child { + border-bottom: none; + } } .note:target { -webkit-animation:target-note 2s linear; background: #fffff0; } - - // paint top or bottom borders depending on notes direction - &:not(.reversed) .note, - &:not(.reversed) .discussion { - border-bottom: 1px solid #eee; - } - &.reversed .note, - &.reversed .discussion { - border-top: 1px solid #eee; - } } .diff-file .notes_holder { @@ -140,10 +135,6 @@ ul.notes { border-width: 1px 0; padding-top: 0; vertical-align: top; - - li { - padding: 5px; - } } } @@ -181,7 +172,7 @@ ul.notes { @extend .cgray; &:hover { - color: $primary_color; + color: $link_hover_color; &.danger { @extend .cred; } } } @@ -271,29 +262,33 @@ ul.notes { .clearfix { margin-bottom: 0; } - .note_text_and_preview { - // makes the "absolute" position for links relative to this - position: relative; - // preview/edit buttons - > a { - position: absolute; - right: 5px; - bottom: -60px; - } - .note_preview { - background: #f5f5f5; - border: 1px solid #ddd; - @include border-radius(4px); - min-height: 80px; - padding: 4px 6px; + .note-preview-holder, + .note_text { + background: #FFF; + border: 1px solid #ddd; + min-height: 100px; + padding: 5px; + font-size: 14px; + box-shadow: none; + } + + .note-preview-holder { + > p { + overflow-x: auto; } - .note_text { + } + + .note_text { + width: 100%; + } + .nav-tabs { + margin-bottom: 0; + border: none; + + li a, + li.active a { border: 1px solid #DDD; - box-shadow: none; - font-size: 14px; - height: 80px; - width: 100%; } } } @@ -310,19 +305,16 @@ ul.notes { float: none; } - .common-note-form { margin: 0; background: #F9F9F9; - padding: 3px; + padding: 5px; border: 1px solid #DDD; } - .note-form-actions { background: #F9F9F9; height: 45px; - padding: 0 5px; .note-form-option { margin-top: 8px; @@ -333,6 +325,18 @@ ul.notes { .js-notify-commit-author { float: left; } + + .write-preview-btn { + // makes the "absolute" position for links relative to this + position: relative; + + // preview/edit buttons + > a { + position: absolute; + right: 5px; + top: 8px; + } + } } .note-edit-form { @@ -367,3 +371,8 @@ ul.notes { .parallel-comment { padding: 6px; } + +.error-alert > .alert { + margin-top: 5px; + margin-bottom: 5px; +} diff --git a/app/assets/stylesheets/sections/notifications.scss b/app/assets/stylesheets/sections/notifications.scss new file mode 100644 index 00000000000..f11c5dff4ab --- /dev/null +++ b/app/assets/stylesheets/sections/notifications.scss @@ -0,0 +1,22 @@ +.global-notifications-form .level-title { + font-size: 15px; + color: #333; + font-weight: bold; +} + +.notification-icon-holder { + width: 20px; + float: left; +} + +.ns-part { + color: $bg_primary; +} + +.ns-watch { + color: $bg_success; +} + +.ns-mute { + color: $bg_danger; +} diff --git a/app/assets/stylesheets/sections/profile.scss b/app/assets/stylesheets/sections/profile.scss index 67aaa369381..ed73e1630f2 100644 --- a/app/assets/stylesheets/sections/profile.scss +++ b/app/assets/stylesheets/sections/profile.scss @@ -1,9 +1,3 @@ -.update-notifications { - .radio-inline { - margin-right: 9%; - } -} - .account-page { fieldset { margin-bottom: 15px; @@ -114,14 +108,3 @@ height: 50px; } } - -.global-notifications-form .level-title { - font-size: 15px; - color: #333; - font-weight: bold; -} - -.notification-icon-holder { - width: 20px; - float: left; -} diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index 5757858a1ce..34dd3448f53 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -57,7 +57,7 @@ font-size: 17px; background: #f1f1f1; border-radius: 4px; - color: #888; + color: #444; position: absolute; margin-left: -55px; text-shadow: 0 1px 1px #FFF; @@ -85,7 +85,7 @@ .btn { background: none; - color: #29b; + color: $link_color; &.active { color: #333; @@ -179,11 +179,6 @@ ul.nav.nav-projects-tabs { font-weight: normal; } -.new-tag-btn { - position: relative; - top: -5px; -} - .public-projects .repo-info { color: #777; @@ -232,3 +227,27 @@ ul.nav.nav-projects-tabs { .deploy-project-label { margin: 1px; } + +.vs-public { + color: $bg_primary; +} + +.vs-internal { + color: $bg_warning; +} + +.vs-private { + color: $bg_success; +} + +.breadcrumb.repo-breadcrumb { + padding: 2px 0; + background: white; + border: none; + font-size: 16px; + + > li + li:before { + padding: 0 3px; + color: #999; + } +} diff --git a/app/assets/stylesheets/sections/snippets.scss b/app/assets/stylesheets/sections/snippets.scss index 84404b6ee36..d79591d9915 100644 --- a/app/assets/stylesheets/sections/snippets.scss +++ b/app/assets/stylesheets/sections/snippets.scss @@ -3,3 +3,6 @@ padding-top: 0; } +.snippet-form-holder .file-holder .file-title { + padding: 2px; +} diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss index 86e2a51641a..b08f94f55a0 100644 --- a/app/assets/stylesheets/sections/tree.scss +++ b/app/assets/stylesheets/sections/tree.scss @@ -53,10 +53,14 @@ vertical-align: middle; a { &:hover { - color: $primary_color; + color: $link_hover_color; } } + i { + color: $bg_primary; + } + img { position: relative; top:-1px; @@ -109,18 +113,17 @@ } } -.tree-btn-group { - top: 2px; - - .btn { - margin-right: 0px; - padding: 2px 10px; - } +.tree-download-holder .btn { + padding: 4px 12px; } .tree-ref-holder { float: left; - margin-top: 8px; + margin-right: 6px; + + .select2-container .select2-choice, .select2-container.select2-drop-above .select2-choice { + padding: 4px 12px; + } } .readme-holder { @@ -141,6 +144,8 @@ margin-bottom: 10px; .commit { + padding: 10px 15px; + .commit-row-title { font-size: 13px; diff --git a/app/assets/stylesheets/sections/wall.scss b/app/assets/stylesheets/sections/wall.scss deleted file mode 100644 index 3705afdb87c..00000000000 --- a/app/assets/stylesheets/sections/wall.scss +++ /dev/null @@ -1,55 +0,0 @@ -.wall-page { - .wall-note-form { - @extend .col-md-12; - - 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/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss index 67616a4a10d..308a03477db 100644 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ b/app/assets/stylesheets/themes/ui_modern.scss @@ -16,28 +16,28 @@ @extend .header-dark; &.navbar-gitlab { .navbar-inner { - background: #00AC7E; - border-bottom: 1px solid #00AC7E; + background: #019875; + border-bottom: 1px solid #019875; .app_logo, .navbar-toggle { &:hover { - background-color: #009C6E; + background-color: #018865; } } .separator { - background: #009C6F; - border-left: 1px solid #10BC8E; + background: #018865; + border-left: 1px solid #11A885; } .nav > li > a { color: #ADC; } .search-input { - border-color: #7fd5be; + border-color: #8ba; } } } } .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { - background: #00AC7E; + background: #019875; } } diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 4bb3cf07da0..1a523d081dd 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -8,6 +8,8 @@ class Admin::GroupsController < Admin::ApplicationController end def show + @members = @group.members.order("group_access DESC").page(params[:members_page]).per(30) + @projects = @group.projects.page(params[:projects_page]).per(30) end def new diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 92ef5963373..1c7c09d0cd4 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -4,10 +4,8 @@ class Admin::ProjectsController < Admin::ApplicationController before_filter :repository, only: [:show, :transfer] def index - owner_id = params[:owner_id] - user = User.find_by(id: owner_id) - - @projects = user ? user.owned_projects : Project.all + @projects = Project.all + @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? @projects = @projects.with_push if params[:with_push].present? @projects = @projects.abandoned if params[:abandoned].present? @@ -17,16 +15,17 @@ class Admin::ProjectsController < Admin::ApplicationController end def show + if @group + @group_members = @group.members.order("group_access DESC").page(params[:group_members_page]).per(30) + end + + @project_members = @project.users_projects.page(params[:project_members_page]).per(30) end def transfer - result = ::Projects::TransferService.new(@project, current_user, project: params).execute(:admin) + ::Projects::TransferService.new(@project, current_user, params.dup).execute - if result - redirect_to [:admin, @project] - else - render :show - end + redirect_to [:admin, @project.reload] end protected diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 5b06af79d5a..5ecdfbd807e 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -8,7 +8,8 @@ class Admin::UsersController < Admin::ApplicationController end def show - @projects = user.authorized_projects + @personal_projects = user.personal_projects + @joined_projects = user.projects.joined(@user) end def new diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2730e9942ec..603e89a5e29 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,6 @@ class ApplicationController < ActionController::Base before_filter :authenticate_user! before_filter :reject_blocked! before_filter :check_password_expiration - around_filter :set_current_user_for_thread before_filter :add_abilities before_filter :ldap_security_check before_filter :dev_tools if Rails.env == 'development' @@ -53,15 +52,6 @@ class ApplicationController < ActionController::Base end end - def set_current_user_for_thread - Thread.current[:current_user] = current_user - begin - yield - ensure - Thread.current[:current_user] = nil - end - end - def abilities @abilities ||= Six.new end @@ -174,10 +164,13 @@ class ApplicationController < ActionController::Base def add_gon_variables gon.default_issues_tracker = Project.issues_tracker.default_value gon.api_version = API::API.version - gon.api_token = current_user.private_token if current_user - gon.gravatar_url = request.ssl? || Gitlab.config.gitlab.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url gon.relative_url_root = Gitlab.config.gitlab.relative_url_root - gon.gravatar_enabled = Gitlab.config.gravatar.enabled + gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s + + if current_user + gon.current_user_id = current_user.id + gon.api_token = current_user.private_token + end end def check_password_expiration diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index bf30de565ed..7937454810d 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -14,4 +14,3 @@ class FilesController < ApplicationController end end end - diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index ddaae6f0e8c..a2629c51384 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -5,11 +5,11 @@ class GroupsController < ApplicationController # Authorize before_filter :authorize_read_group!, except: [:new, :create] - before_filter :authorize_admin_group!, only: [:edit, :update, :destroy] + before_filter :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] before_filter :authorize_create_group!, only: [:new, :create] # Load group projects - before_filter :projects, except: [:new, :create] + before_filter :load_projects, except: [:new, :create, :projects, :edit, :update] before_filter :default_filter, only: [:issues, :merge_requests] @@ -79,9 +79,13 @@ class GroupsController < ApplicationController def edit end + def projects + @projects = @group.projects.page(params[:page]) + end + def update if @group.update_attributes(params[:group]) - redirect_to @group, notice: 'Group was successfully updated.' + redirect_to edit_group_path(@group), notice: 'Group was successfully updated.' else render action: "edit" end @@ -99,17 +103,17 @@ class GroupsController < ApplicationController @group ||= Group.find_by(path: params[:id]) end - def projects + def load_projects @projects ||= ProjectsFinder.new.execute(current_user, group: group).sorted_by_activity.non_archived end def project_ids - projects.pluck(:id) + @projects.pluck(:id) end # Dont allow unauthorized access to group def authorize_read_group! - unless @group and (projects.present? or can?(current_user, :read_group, @group)) + unless @group and (@projects.present? or can?(current_user, :read_group, @group)) if current_user.nil? return authenticate_user! else diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 051cbdfaf05..fc498559d6b 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -2,12 +2,12 @@ class HelpController < ApplicationController def index end - def api + def show @category = params[:category] - @category = "README" if @category.blank? + @file = params[:file] - if File.exists?(Rails.root.join('doc', 'api', @category + '.md')) - render 'api' + if File.exists?(Rails.root.join('doc', @category, @file + '.md')) + render 'show' else not_found! end diff --git a/app/controllers/namespaces_controller.rb b/app/controllers/namespaces_controller.rb new file mode 100644 index 00000000000..c59a2401cef --- /dev/null +++ b/app/controllers/namespaces_controller.rb @@ -0,0 +1,18 @@ +class NamespacesController < ApplicationController + skip_before_filter :authenticate_user! + + def show + namespace = Namespace.find_by(path: params[:id]) + + unless namespace + return render_404 + end + + if namespace.type == "Group" + redirect_to group_path(namespace) + else + redirect_to user_path(namespace.owner) + end + end +end + diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 7131e0fe181..0c87fe0d9ae 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -20,7 +20,15 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # if the authentication to LDAP was successful. @user = Gitlab::LDAP::User.find_or_create(oauth) @user.remember_me = true if @user.persisted? - sign_in_and_redirect(@user) + + gitlab_ldap_access do |access| + if access.allowed?(@user) + sign_in_and_redirect(@user) + else + flash[:alert] = "Access denied for your LDAP account." + redirect_to new_user_session_path + end + end end private diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 6a6cbe48184..3c8e7ec73f6 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -4,11 +4,12 @@ class Projects::BranchesController < Projects::ApplicationController before_filter :require_non_empty_project before_filter :authorize_code_access! - before_filter :authorize_push!, only: [:create] - before_filter :authorize_admin_project!, only: [:destroy] + before_filter :authorize_push!, only: [:create, :destroy] def index - @branches = Kaminari.paginate_array(@repository.branches).page(params[:page]).per(30) + @sort = params[:sort] || 'name' + @branches = @repository.branches_sorted_by(@sort) + @branches = Kaminari.paginate_array(@branches).page(params[:page]).per(30) end def recent @@ -16,21 +17,18 @@ class Projects::BranchesController < Projects::ApplicationController end def create - CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user) + @branch = CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user) - redirect_to project_branches_path(@project) + redirect_to project_tree_path(@project, @branch.name) end def destroy - branch = @repository.find_branch(params[:id]) - - if branch && @repository.rm_branch(branch.name) - Event.create_ref_event(@project, current_user, branch, 'rm') - end + DeleteBranchService.new.execute(project, params[:id], current_user) + @branch_name = params[:id] respond_to do |format| format.html { redirect_to project_branches_path(@project) } - format.js { render nothing: true } + format.js end end end diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index c56df65dcba..860ab408299 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -12,7 +12,12 @@ class Projects::CommitController < Projects::ApplicationController return git_not_found! unless @commit @line_notes = project.notes.for_commit_id(commit.id).inline - @branches = project.repository.branch_names_contains(commit.id) + + @branches = begin + project.repository.branch_names_contains(commit.id) + rescue Grit::Git::GitTimeout + [] + end begin @suppress_diff = true if commit.diff_suppress? && !params[:force_show_diff] diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 4e7a716bfe4..ddea8901f9b 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -69,7 +69,9 @@ class Projects::IssuesController < Projects::ApplicationController render :new end end - format.js + format.js do |format| + @link = @issue.attachment.url.to_js + end end end @@ -85,6 +87,12 @@ class Projects::IssuesController < Projects::ApplicationController render :edit end end + format.json do + render json: { + saved: @issue.valid?, + assignee_avatar_url: @issue.assignee.try(:avatar_url) + } + end end end diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index b037cf56502..30fcb64cbb2 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -16,6 +16,8 @@ class Projects::LabelsController < Projects::ApplicationController redirect_to project_issues_path(@project) elsif params[:redirect] == 'merge_requests' redirect_to project_merge_requests_path(@project) + else + redirect_to project_labels_path(@project) end end diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index d8551db7b01..1abedc1f272 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -74,14 +74,26 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.source_branch ) + @compare_failed = false @commits = compare_action.commits - @commits.map! { |commit| Commit.new(commit) } - @commit = @commits.first + + if @commits + @commits.map! { |commit| Commit.new(commit) } + @commit = @commits.first + else + # false value because failed to get commits from satellite + @commits = [] + @compare_failed = true + end @diffs = compare_action.diffs @merge_request.title = @merge_request.source_branch.titleize.humanize @target_project = @merge_request.target_project @target_repo = @target_project.repository + + diff_line_count = Commit::diff_line_count(@diffs) + @suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count) + @force_suppress_diff = @suppress_diff end end @@ -160,7 +172,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def ci_status - status = @merge_request.source_project.gitlab_ci_service.commit_status(merge_request.last_commit.sha) + status = @merge_request.source_project.ci_service.commit_status(merge_request.last_commit.sha) response = {status: status} render json: response @@ -225,7 +237,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request_diff = @merge_request.merge_request_diff @allowed_to_merge = allowed_to_merge? @show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge - @allowed_to_remove_source_branch = allowed_to_remove_source_branch? @source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name) end @@ -238,11 +249,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController render 'invalid' end - def allowed_to_remove_source_branch? - allowed_to_push_code?(@merge_request.source_project, @merge_request.source_branch) && - !@merge_request.disallow_source_branch_removal? - end - def allowed_to_push_code?(project, branch) action = if project.protected_branch?(branch) :push_code_to_protected_branches diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 05237bbd2d2..c38c77d6b85 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -1,6 +1,6 @@ class Projects::MilestonesController < Projects::ApplicationController before_filter :module_enabled - before_filter :milestone, only: [:edit, :update, :destroy, :show] + before_filter :milestone, only: [:edit, :update, :destroy, :show, :sort_issues, :sort_merge_requests] # Allow read any milestone before_filter :authorize_read_milestone! @@ -37,7 +37,7 @@ class Projects::MilestonesController < Projects::ApplicationController end def create - @milestone = @project.milestones.new(params[:milestone]) + @milestone = Milestones::CreateService.new(project, current_user, params[:milestone]).execute if @milestone.save redirect_to project_milestone_path(@project, @milestone) @@ -47,7 +47,7 @@ class Projects::MilestonesController < Projects::ApplicationController end def update - @milestone.update_attributes(params[:milestone]) + @milestone = Milestones::UpdateService.new(project, current_user, params[:milestone]).execute(milestone) respond_to do |format| format.js @@ -72,6 +72,26 @@ class Projects::MilestonesController < Projects::ApplicationController end end + def sort_issues + @issues = @milestone.issues.where(id: params['sortable_issue']) + @issues.each do |issue| + issue.position = params['sortable_issue'].index(issue.id.to_s) + 1 + issue.save + end + + render json: { saved: true } + end + + def sort_merge_requests + @merge_requests = @milestone.merge_requests.where(id: params['sortable_merge_request']) + @merge_requests.each do |merge_request| + merge_request.position = params['sortable_merge_request'].index(merge_request.id.to_s) + 1 + merge_request.save + end + + render json: { saved: true } + end + protected def milestone diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb index cfc1bd99a20..e39e97af8dd 100644 --- a/app/controllers/projects/protected_branches_controller.rb +++ b/app/controllers/projects/protected_branches_controller.rb @@ -1,9 +1,9 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController # Authorize - before_filter :authorize_read_project! before_filter :require_non_empty_project + before_filter :authorize_admin_project! - before_filter :authorize_admin_project!, only: [:destroy, :create] + layout "project_settings" def index @branches = @project.protected_branches.to_a diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index 7b8026cff9f..8834a995081 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -31,9 +31,23 @@ class Projects::RefsController < Projects::ApplicationController end def logs_tree - contents = tree.entries - @logs = contents.map do |content| - file = params[:path] ? File.join(params[:path], content.name) : content.name + @offset = if params[:offset].present? + params[:offset].to_i + else + 0 + end + + @limit = 10 + + @path = params[:path] + + contents = [] + contents += tree.trees + contents += tree.blobs + contents += tree.submodules + + @logs = contents[@offset, @limit].to_a.map do |content| + file = @path ? File.join(@path, content.name) : content.name last_commit = @repo.last_commit_for_path(@commit.id, file) { file_name: content.name, diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index 0b99165bf62..e03a9f4d66d 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -13,11 +13,8 @@ class Projects::TagsController < Projects::ApplicationController end def create - @repository.add_tag(params[:tag_name], params[:ref]) - - if new_tag = @repository.find_tag(params[:tag_name]) - Event.create_ref_event(@project, current_user, new_tag, 'add', 'refs/tags') - end + @tag = CreateTagService.new.execute(@project, params[:tag_name], + params[:ref], current_user) redirect_to project_tags_path(@project) end diff --git a/app/controllers/projects/walls_controller.rb b/app/controllers/projects/walls_controller.rb deleted file mode 100644 index 834215a1473..00000000000 --- a/app/controllers/projects/walls_controller.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Projects::WallsController < Projects::ApplicationController - 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/projects_controller.rb b/app/controllers/projects_controller.rb index ebb8a90c630..9e14af62048 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -44,7 +44,7 @@ class ProjectsController < ApplicationController end def transfer - ::Projects::TransferService.new(project, current_user, params).execute + ::Projects::TransferService.new(project, current_user, params[:project]).execute end def show @@ -162,8 +162,29 @@ class ProjectsController < ApplicationController end end + def upload_image + link_to_image = ::Projects::ImageService.new(repository, params, root_url).execute + + respond_to do |format| + if link_to_image + format.json { render json: { link: link_to_image } } + else + format.json { render json: "Invalid file.", status: :unprocessable_entity } + end + end + end + private + def upload_path + base_dir = FileUploader.generate_dir + File.join(repository.path_with_namespace, base_dir) + end + + def accepted_images + %w(png jpg jpeg gif) + end + def set_title @title = 'New Project' end @@ -190,6 +211,6 @@ class ProjectsController < ApplicationController end def sorted(users) - users.uniq.sort_by(&:username).map { |user| { username: user.username, name: user.name } } + users.uniq.to_a.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } } end end diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 0dd941a48e2..4fe98f804dc 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -14,7 +14,7 @@ class SnippetsController < ApplicationController layout 'navless' def index - @snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20) + @snippets = Snippet.are_public.fresh.non_expired.page(params[:page]).per(20) end def user_index @@ -26,15 +26,15 @@ class SnippetsController < ApplicationController if @user == current_user @snippets = case params[:scope] - when 'public' then - @snippets.public - when 'private' then - @snippets.private + when 'are_public' then + @snippets.are_public + when 'are_private' then + @snippets.are_private else @snippets end else - @snippets = @snippets.public + @snippets = @snippets.are_public end @snippets = @snippets.page(params[:page]).per(20) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9461174b950..0b442f5383a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,12 +4,24 @@ class UsersController < ApplicationController def show @user = User.find_by_username!(params[:username]) - @projects = @user.authorized_projects.accessible_to(current_user) - if !current_user && @projects.empty? + + unless current_user || @user.public_profile? return authenticate_user! end - @groups = @user.groups.accessible_to(current_user) - @events = @user.recent_events.where(project_id: @projects.pluck(:id)).limit(20) + + # Projects user can view + authorized_projects_ids = ProjectsFinder.new.execute(current_user).pluck(:id) + + @projects = @user.personal_projects. + where(id: authorized_projects_ids) + + # Collect only groups common for both users + @groups = @user.groups & GroupsFinder.new.execute(current_user) + + # Get user activity feed for projects common for both users + @events = @user.recent_events. + where(project_id: authorized_projects_ids).limit(20) + @title = @user.name end diff --git a/app/finders/base_finder.rb b/app/finders/base_finder.rb index 7fc5840561c..7150bb2e31b 100644 --- a/app/finders/base_finder.rb +++ b/app/finders/base_finder.rb @@ -49,7 +49,7 @@ class BaseFinder elsif current_user && params[:authorized_only].presence klass.of_projects(current_user.authorized_projects).references(:project) else - klass.of_projects(Project.accessible_to(current_user)).references(:project) + klass.of_projects(ProjectsFinder.new.execute(current_user)).references(:project) end end diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb new file mode 100644 index 00000000000..d3597ef0901 --- /dev/null +++ b/app/finders/groups_finder.rb @@ -0,0 +1,38 @@ +class GroupsFinder + def execute(current_user, options = {}) + all_groups(current_user) + end + + private + + def all_groups(current_user) + if current_user + if current_user.authorized_groups.any? + # User has access to groups + # + # Return only: + # groups with public projects + # groups with internal projects + # groups with joined projects + # + group_ids = Project.public_and_internal_only.pluck(:namespace_id) + + current_user.authorized_groups.pluck(:id) + Group.where(id: group_ids) + else + # User has no group membership + # + # Return only: + # groups with public projects + # groups with internal projects + # + Group.where(id: Project.public_and_internal_only.pluck(:namespace_id)) + end + else + # Not authenticated + # + # Return only: + # groups with public projects + Group.where(id: Project.public_only.pluck(:namespace_id)) + end + end +end diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index bfaba758788..26898bad493 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -1,5 +1,5 @@ class ProjectsFinder - def execute(current_user, options) + def execute(current_user, options = {}) group = options[:group] if group @@ -56,8 +56,36 @@ class ProjectsFinder end end - def all_projects - # TODO: implement - raise 'Not implemented yet' + def all_projects(current_user) + if current_user + if current_user.authorized_projects.any? + # User has access to private projects + # + # Return only: + # public projects + # internal projects + # joined projects + # + Project.where( + "projects.id IN (?) OR projects.visibility_level IN (?)", + current_user.authorized_projects.pluck(:id), + Project.public_and_internal_levels + ) + else + # User has no access to private projects + # + # Return only: + # public projects + # internal projects + # + Project.public_and_internal_only + end + else + # Not authenticated + # + # Return only: + # public projects + Project.public_only + end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5f07cdf448c..c3d89eb1b82 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -60,23 +60,21 @@ module ApplicationHelper def avatar_icon(user_email = '', size = nil) user = User.find_by(email: user_email) - if user && user.avatar.present? - user.avatar.url + + if user + user.avatar_url(size) || default_avatar else gravatar_icon(user_email, size) end end def gravatar_icon(user_email = '', size = nil) - size = 40 if size.nil? || size <= 0 + GravatarService.new.execute(user_email, size) || + default_avatar + end - if !Gitlab.config.gravatar.enabled || user_email.blank? - '/assets/no_avatar.png' - else - gravatar_url = request.ssl? || gitlab_config.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url - user_email.strip! - sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size, email: user_email - end + def default_avatar + image_path('no_avatar.png') end def last_commit(project) @@ -226,9 +224,39 @@ module ApplicationHelper GitHub::Markup.render(file_name, file_content).html_safe end - def spinner(text = nil) - content_tag :div, class: 'loading hide' do + def spinner(text = nil, visible = false) + css_class = "loading" + css_class << " hide" unless visible + + content_tag :div, class: css_class do content_tag(:i, nil, class: 'icon-spinner icon-spin') + text end end + + def link_to(name = nil, options = nil, html_options = nil, &block) + begin + uri = URI(options) + host = uri.host + absolute_uri = uri.absolute? + rescue URI::InvalidURIError, ArgumentError + host = nil + absolute_uri = nil + end + + # Add "nofollow" only to external links + if host && host != Gitlab.config.gitlab.host && absolute_uri + if html_options + if html_options[:rel] + html_options[:rel] << " nofollow" + else + html_options.merge!(rel: "nofollow") + end + else + html_options = Hash.new + html_options[:rel] = "nofollow" + end + end + + super + end end diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb new file mode 100644 index 00000000000..11fbf1baae7 --- /dev/null +++ b/app/helpers/blob_helper.rb @@ -0,0 +1,18 @@ +module BlobHelper + def highlightjs_class(blob_name) + if blob_name.include?('.') + ext = blob_name.split('.').last + return 'language-' + ext + else + if no_highlight_files.include?(blob_name.downcase) + 'no-highlight' + else + blob_name.downcase + end + end + end + + def no_highlight_files + %w(credits changelog copying copyright license authors) + end +end diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb new file mode 100644 index 00000000000..2ec2cc96157 --- /dev/null +++ b/app/helpers/branches_helper.rb @@ -0,0 +1,22 @@ +module BranchesHelper + def can_remove_branch?(project, branch_name) + if project.protected_branch? branch_name + false + elsif branch_name == project.repository.root_ref + false + else + can?(current_user, :push_code, project) + end + end + + def can_push_branch?(project, branch_name) + return false unless project.repository.branch_names.include?(branch_name) + action = if project.protected_branch?(branch_name) + :push_code_to_protected_branches + else + :push_code + end + + current_user.can?(action, project) + end +end diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index c4abdbdabc7..4d27cf2851e 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -76,15 +76,13 @@ module CommitsHelper # 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)) + link_to(@project.path, 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('/'))) @@ -195,11 +193,11 @@ module CommitsHelper def commit_person_link(commit, options = {}) source_name = commit.send "#{options[:source]}_name".to_sym source_email = commit.send "#{options[:source]}_email".to_sym - + user = User.find_for_commit(source_email, source_name) person_name = user.nil? ? source_name : user.name person_email = user.nil? ? source_email : user.email - + text = if options[:avatar] avatar = image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{person_name}</span>} @@ -218,4 +216,8 @@ module CommitsHelper link_to(text.html_safe, user_path(user), options) end end + + def diff_file_mode_changed?(diff) + diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode + end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 929f9a9c381..d3904e16c11 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -109,8 +109,6 @@ module EventsHelper "#{event.note_target_type} ##{truncate event.note_target_iid}" end end - elsif event.wall_note? - link_to 'wall', project_wall_path(event.project) else content_tag :strong do "(deleted)" diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 69425bc171d..db5b4eacd1f 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -19,7 +19,7 @@ module GitlabMarkdownHelper escape_once(body) end - gfm_body = gfm(escaped_body, html_options) + gfm_body = gfm(escaped_body, @project, html_options) gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match| "</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1 @@ -59,90 +59,67 @@ module GitlabMarkdownHelper end end - # text - whole text from a markdown file - # project_path_with_namespace - namespace/projectname, eg. gitlabhq/gitlabhq - # ref - name of the branch or reference, eg. stable - # requested_path - path of request, eg. doc/api/README.md, used in special case when path is pointing to the .md file were the original request is coming from - def create_relative_links(text, project, ref, requested_path) - @path_to_satellite = project.satellite.path - project_path_with_namespace = project.path_with_namespace + def create_relative_links(text) paths = extract_paths(text) - paths.each do |file_path| - original_file_path = extract(file_path) - new_path = rebuild_path(project_path_with_namespace, original_file_path, requested_path, ref) - if reference_path?(file_path) - # Replacing old string with a new one that contains updated path - # eg. [some document]: document.md will be replaced with [some document] /namespace/project/master/blob/document.md - text.gsub!(file_path, file_path.gsub(original_file_path, "/#{new_path}")) - else - # Replacing old string with a new one with brackets ]() to prevent replacing occurence of a word - # e.g. If we have a markdown like [test](test) this will replace ](test) and not the word test - text.gsub!("](#{file_path})", "](/#{new_path})") - end - end - text - end - def extract_paths(markdown_text) - all_markdown_paths = pick_out_paths(markdown_text) - paths = remove_empty(all_markdown_paths) - select_relative(paths) - end + paths.uniq.each do |file_path| + new_path = rebuild_path(file_path) + # Finds quoted path so we don't replace other mentions of the string + # eg. "doc/api" will be replaced and "/home/doc/api/text" won't + text.gsub!("\"#{file_path}\"", "\"/#{new_path}\"") + end - # Split the markdown text to each line and find all paths, this will match anything with - ]("some_text") and [some text]: file.md - def pick_out_paths(markdown_text) - inline_paths = markdown_text.split("\n").map { |text| text.scan(/\]\(([^(]+)\)/) } - reference_paths = markdown_text.split("\n").map { |text| text.scan(/\[.*\]:.*/) } - inline_paths + reference_paths + text end - # Removes any empty result produced by not matching the regexp - def remove_empty(paths) - paths.reject{|l| l.empty? }.flatten + def extract_paths(text) + links = substitute_links(text) + image_links = substitute_image_links(text) + links + image_links end - # If a path is a reference style link we need to omit ]: - def extract(path) - path.split("]: ").last + def substitute_links(text) + links = text.scan(/<a href=\"([^"]*)\">/) + relative_links = links.flatten.reject{ |link| link_to_ignore? link } + relative_links end - # Reject any path that contains ignored protocol - # eg. reject "https://gitlab.org} but accept "doc/api/README.md" - def select_relative(paths) - paths.reject{|path| ignored_protocols.map{|protocol| path.include?(protocol)}.any?} + def substitute_image_links(text) + links = text.scan(/<img src=\"([^"]*)\"/) + relative_links = links.flatten.reject{ |link| link_to_ignore? link } + relative_links end - # Check whether a path is a reference-style link - def reference_path?(path) - path.include?("]: ") + def link_to_ignore?(link) + ignored_protocols.map{ |protocol| link.include?(protocol) }.any? end def ignored_protocols ["http://","https://", "ftp://", "mailto:"] end - def rebuild_path(path_with_namespace, path, requested_path, ref) + def rebuild_path(path) path.gsub!(/(#.*)/, "") id = $1 || "" - file_path = relative_file_path(path, requested_path) + file_path = relative_file_path(path) + file_path = sanitize_slashes(file_path) + [ - path_with_namespace, - path_with_ref(file_path, ref), + Gitlab.config.gitlab.relative_url_root, + @project.path_with_namespace, + path_with_ref(file_path), file_path - ].compact.join("/").gsub(/\/*$/, '') + id + ].compact.join("/").gsub(/^\/*|\/*$/, '') + id end - # Checks if the path exists in the repo - # eg. checks if doc/README.md exists, if not then link to blob - def path_with_ref(path, ref) - if file_exists?(path) - "#{local_path(path)}/#{correct_ref(ref)}" - else - "blob/#{correct_ref(ref)}" - end + def sanitize_slashes(path) + path[0] = "" if path.start_with?("/") + path.chop if path.end_with?("/") + path end - def relative_file_path(path, requested_path) + def relative_file_path(path) + requested_path = @path nested_path = build_nested_path(path, requested_path) return nested_path if file_exists?(nested_path) path @@ -166,6 +143,16 @@ module GitlabMarkdownHelper end end + # Checks if the path exists in the repo + # eg. checks if doc/README.md exists, if not then link to blob + def path_with_ref(path) + if file_exists?(path) + "#{local_path(path)}/#{correct_ref}" + else + "blob/#{correct_ref}" + end + end + def file_exists?(path) return false if path.nil? return @repository.blob_at(current_sha, path).present? || @repository.tree(current_sha, path).entries.any? @@ -179,10 +166,6 @@ module GitlabMarkdownHelper return "blob" end - def current_ref - @commit.nil? ? "master" : @commit.id - end - def current_sha if @commit @commit.id @@ -192,7 +175,7 @@ module GitlabMarkdownHelper end # We will assume that if no ref exists we can point to master - def correct_ref(ref) - ref ? ref : "master" + def correct_ref + @ref ? @ref : "master" end end diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 53d4a8f2e6e..f0f771b4ba0 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -1,7 +1,7 @@ module IconsHelper def boolean_to_icon(value) if value.to_s == "true" - content_tag :i, nil, class: 'icon-ok cgreen' + content_tag :i, nil, class: 'icon-circle cgreen' else content_tag :i, nil, class: 'icon-off clgray' end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 7c58908165c..2031519c32f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -13,76 +13,80 @@ module IssuesHelper OpenStruct.new(id: 0, title: 'None (backlog)', name: 'Unassigned') end - def url_for_project_issues - return "" if @project.nil? + def url_for_project_issues(project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - project_issues_path(@project) + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + project_issues_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) + 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? + def url_for_new_issue(project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - url = new_project_issue_path project_id: @project + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + 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) + issues_tracker = Gitlab.config.issues_tracker[project.issues_tracker] + url = 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_iid) - return "" if @project.nil? + def url_for_issue(issue_iid, project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - url = project_issue_url project_id: @project, id: issue_iid + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + url = project_issue_url project_id: project, id: issue_iid else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["issues_url"] - url.gsub(':id', issue_iid.to_s) - .gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) + url = Gitlab.config.issues_tracker[project.issues_tracker]['issues_url'] + url.gsub(':id', issue_iid.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_iid) - return "" if @project.nil? + def title_for_issue(issue_iid, project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? && issue = @project.issues.where(iid: issue_iid).first - issue.title - else - "" + if project.used_default_issues_tracker? + issue = project.issues.where(iid: issue_iid).first + return issue.title if issue end + + '' end # Checks if issues_tracker setting exists in gitlab.yml def external_issues_tracker_enabled? - if Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any? - true - else - false - end + Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any? end def bulk_update_milestone_options - options_for_select(["None (backlog)"]) + options_from_collection_for_select(project_active_milestones, "id", "title", params[:milestone_id]) + options_for_select(['None (backlog)']) + + options_from_collection_for_select(project_active_milestones, 'id', + 'title', params[:milestone_id]) end - def bulk_update_assignee_options - options_for_select(["None (unassigned)"]) + options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]) + def bulk_update_assignee_options(project = @project) + options_for_select(['None (unassigned)']) + + options_from_collection_for_select(project.team.members, 'id', + 'name', params[:assignee_id]) end - def assignee_options object - options_from_collection_for_select(@project.team.members.sort_by(&:name), 'id', 'name', object.assignee_id) + def assignee_options(object, project = @project) + options_from_collection_for_select(project.team.members.sort_by(&:name), + 'id', 'name', object.assignee_id) end def milestone_options object - options_from_collection_for_select(object.project.milestones.active, 'id', 'title', object.milestone_id) + options_from_collection_for_select(object.project.milestones.active, + 'id', 'title', object.milestone_id) end def issue_box_class(item) diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 00ec34ae547..cc63db2035e 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -32,7 +32,7 @@ module MergeRequestsHelper end def ci_build_details_path merge_request - merge_request.source_project.gitlab_ci_service.build_page(merge_request.last_commit.sha) + merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha) end def merge_path_description(merge_request, separator) @@ -42,4 +42,8 @@ module MergeRequestsHelper "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" end end + + def issues_sentence(issues) + issues.map { |i| "##{i.iid}" }.to_sentence + end end diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index c363c7ffd74..bf25dce2301 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -1,6 +1,6 @@ module NamespacesHelper def namespaces_options(selected = :current_user, scope = :default) - groups = current_user.owned_groups + groups = current_user.owned_groups + current_user.masters_groups users = [current_user.namespace] group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [g.human_name, g.id]} ] diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index 7ae104b8fd1..9ed38ba84b2 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -42,4 +42,23 @@ module NotesHelper project_id: noteable.project.id, }.to_json end + + def link_to_new_diff_note(line_code) + discussion_id = Note.build_discussion_id( + @comments_target[:noteable_type], + @comments_target[:noteable_id] || @comments_target[:commit_id], + line_code + ) + + data = { + noteable_type: @comments_target[:noteable_type], + noteable_id: @comments_target[:noteable_id], + commit_id: @comments_target[:commit_id], + line_code: line_code, + discussion_id: discussion_id + } + + link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button", + data: data, title: "Add a comment to this line" + end end diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index b2399bb6db1..6c43f97446b 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -1,13 +1,13 @@ module NotificationsHelper def notification_icon(notification) if notification.disabled? - content_tag :i, nil, class: 'icon-volume-off cred' + content_tag :i, nil, class: 'icon-volume-off ns-mute' elsif notification.participating? - content_tag :i, nil, class: 'icon-volume-down cblue' + content_tag :i, nil, class: 'icon-volume-down ns-part' elsif notification.watch? - content_tag :i, nil, class: 'icon-volume-up cgreen' + content_tag :i, nil, class: 'icon-volume-up ns-watch' else - content_tag :i, nil, class: 'icon-circle-blank cblue' + content_tag :i, nil, class: 'icon-circle-blank ns-default' end end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ef0460f8728..ba4c7068e90 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -139,7 +139,7 @@ module ProjectsHelper nav_tabs << :settings end - [:issues, :wiki, :wall, :snippets].each do |feature| + [:issues, :wiki, :snippets].each do |feature| nav_tabs << feature if project.send :"#{feature}_enabled" end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index d7f3da7e537..ecd8d3994d0 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -33,15 +33,15 @@ module SearchHelper # Autocomplete results for internal help pages def help_autocomplete [ - { 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: "help: API Help", url: help_page_path("api", "README") }, + { label: "help: Markdown Help", url: help_page_path("markdown", "markdown") }, + { label: "help: Permissions Help", url: help_page_path("permissions", "permissions") }, + { label: "help: Public Access Help", url: help_page_path("public_access", "public_access") }, + { label: "help: Rake Tasks Help", url: help_page_path("raketasks", "README") }, + { label: "help: SSH Keys Help", url: help_page_path("ssh", "README") }, + { label: "help: System Hooks Help", url: help_page_path("system_hooks", "system_hooks") }, + { label: "help: Web Hooks Help", url: help_page_path("web_hooks", "web_hooks") }, + { label: "help: Workflow Help", url: help_page_path("workflow", "README") }, ] end @@ -61,7 +61,6 @@ module SearchHelper { label: "#{prefix} - Milestones", url: project_milestones_path(@project) }, { label: "#{prefix} - Snippets", url: project_snippets_path(@project) }, { label: "#{prefix} - Team", url: project_team_index_path(@project) }, - { label: "#{prefix} - Wall", url: project_wall_path(@project) }, { label: "#{prefix} - Wiki", url: project_wikis_path(@project) }, ] else @@ -81,7 +80,7 @@ module SearchHelper # Autocomplete results for the current user's projects def projects_autocomplete(term, limit = 5) - Project.accessible_to(current_user).search_by_title(term).non_archived.limit(limit).map do |p| + ProjectsFinder.new.execute(current_user).search_by_title(term).non_archived.limit(limit).map do |p| { label: "project: #{search_result_sanitize(p.name_with_namespace)}", url: project_path(p) diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 09e5c08e621..09e5c08e621 100755..100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb index bd373c5f3cf..610175f8447 100644 --- a/app/helpers/tab_helper.rb +++ b/app/helpers/tab_helper.rb @@ -75,7 +75,7 @@ module TabHelper def project_tab_class return "active" if current_page?(controller: "/projects", action: :edit, id: @project) - if ['services', 'hooks', 'deploy_keys', 'team_members'].include? controller.controller_name + if ['services', 'hooks', 'deploy_keys', 'team_members', 'protected_branches'].include? controller.controller_name "active" end end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index f39d0081dce..2d82b6a0b47 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -25,8 +25,13 @@ module TreeHelper # # type - String type of the tree item; either 'folder' or 'file' def tree_icon(type) - image = type == 'folder' ? 'file_dir.png' : 'file_txt.png' - image_tag(image, size: '16x16') + icon_class = if type == 'folder' + 'icon-folder-close' + else + 'icon-file-alt' + end + + content_tag :i, nil, class: icon_class end def tree_hex_class(content) diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index 81e10f3685c..8b83b8ff640 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -2,11 +2,11 @@ module VisibilityLevelHelper def visibility_level_color(level) case level when Gitlab::VisibilityLevel::PRIVATE - 'cgreen' + 'vs-private' when Gitlab::VisibilityLevel::INTERNAL - 'camber' + 'vs-internal' when Gitlab::VisibilityLevel::PUBLIC - 'cblue' + 'vs-public' end end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 8d1f17b0f81..b7fedbd3707 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -31,14 +31,5 @@ module Emails to: recipient(recipient_id), subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) end - - def note_wall_email(recipient_id, note_id) - @note = Note.find(note_id) - @project = @note.project - @target_url = project_wall_url(@note.project, anchor: "note_#{@note.id}") - mail(from: sender(@note.author_id), - 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 index 9f99c11ea30..6b13a1d746d 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -25,13 +25,15 @@ module Emails @branch = branch if @commits.length > 1 @target_url = project_compare_url(@project, from: @commits.first, to: @commits.last) + @subject = "#{@commits.length} new commits pushed to repository" else @target_url = project_commit_url(@project, @commits.first) + @subject = @commits.first.title end mail(from: sender(author_id), to: recipient, - subject: subject("New push to repository")) + subject: subject(@subject)) end end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 1afe8a4638f..234578b5e18 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -51,7 +51,7 @@ class Ability nil end - if group && group.has_projects_accessible_to?(nil) + if group && group.public_profile? [:read_group] else [] @@ -71,16 +71,16 @@ class Ability team = project.team # Rules based on role in project - if team.masters.include?(user) + if team.master?(user) rules += project_master_rules - elsif team.developers.include?(user) + elsif team.developer?(user) rules += project_dev_rules - elsif team.reporters.include?(user) + elsif team.reporter?(user) rules += project_report_rules - elsif team.guests.include?(user) + elsif team.guest?(user) rules += project_guest_rules end @@ -188,6 +188,13 @@ class Ability rules << :read_group end + # Only group masters and group owners can create new projects in group + if group.has_master?(user) || group.has_owner?(user) || user.admin? + rules += [ + :create_projects, + ] + end + # Only group owner and administrators can manage group if group.has_owner?(user) || user.admin? rules += [ @@ -205,6 +212,7 @@ class Ability # Only namespace owner and administrators can manage it if namespace.owner == user || user.admin? rules += [ + :create_projects, :manage_namespace ] end @@ -228,7 +236,11 @@ class Ability :"modify_#{name}", ] else - subject.respond_to?(:project) ? project_abilities(user, subject.project) : [] + if subject.respond_to?(:project) + project_abilities(user, subject.project) + else + [] + end end end end diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 85ab7ed6ae8..ce8b7973cd9 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -20,8 +20,8 @@ class BroadcastMessage < ActiveRecord::Base validates :starts_at, presence: true validates :ends_at, presence: true - validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true - validates :font, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true + validates :color, format: { with: /\A\#[0-9A-Fa-f]{3}{1,2}+\Z/ }, allow_blank: true + validates :font, format: { with: /\A\#[0-9A-Fa-f]{3}{1,2}+\Z/ }, allow_blank: true def self.current where("ends_at > :now AND starts_at < :now", now: Time.zone.now).last diff --git a/app/models/commit.rb b/app/models/commit.rb index c313aeb7572..82876e10446 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -13,8 +13,8 @@ class Commit DIFF_SAFE_FILES = 100 DIFF_SAFE_LINES = 5000 # Commits above this size will not be rendered in HTML - DIFF_HARD_LIMIT_FILES = 500 - DIFF_HARD_LIMIT_LINES = 10000 + DIFF_HARD_LIMIT_FILES = 1000 + DIFF_HARD_LIMIT_LINES = 50000 class << self def decorate(commits) @@ -111,22 +111,10 @@ class Commit description.present? end - # Regular expression that identifies commit message clauses that trigger issue closing. - def issue_closing_regex - @issue_closing_regex ||= Regexp.new(Gitlab.config.gitlab.issue_closing_pattern) - end - # Discover issues should be closed when this commit is pushed to a project's # default branch. def closes_issues project - md = issue_closing_regex.match(safe_message) - if md - extractor = Gitlab::ReferenceExtractor.new - extractor.analyze(md[0]) - extractor.issues_for(project) - else - [] - end + Gitlab::ClosingIssueExtractor.closed_by_message_in_project(safe_message, project) end # Mentionable override. diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index de167f8803a..9a227fcef59 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -24,6 +24,8 @@ module Issuable scope :unassigned, -> { where("assignee_id IS NULL") } scope :of_projects, ->(ids) { where(project_id: ids) } scope :opened, -> { with_state(:opened, :reopened) } + scope :only_opened, -> { with_state(:opened) } + scope :only_reopened, -> { with_state(:reopened) } scope :closed, -> { with_state(:closed) } delegate :name, @@ -42,7 +44,7 @@ module Issuable module ClassMethods def search(query) - where("title like :query", query: "%#{query}%") + where("LOWER(title) like :query", query: "%#{query.downcase}%") end def sort(method) diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 5858fe1bb6f..a46a593c6e3 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -50,7 +50,7 @@ module Mentionable matches.each do |match| identifier = match.delete "@" if has_project - id = project.team.members.find { |u| u.username == identifier }.try(:id) + id = project.team.members.find_by(username: identifier).try(:id) else id = User.where(username: identifier).pluck(:id).first end diff --git a/app/models/event.rb b/app/models/event.rb index cf88e9f4afc..b88635ccb59 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -286,10 +286,6 @@ class Event < ActiveRecord::Base end.to_s end - def wall_note? - target.noteable_type.blank? - end - def note_target_type if target.noteable_type.present? target.noteable_type.titleize diff --git a/app/models/group.rb b/app/models/group.rb index 3cbf30a20df..e51e19ab60c 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -26,12 +26,6 @@ class Group < Namespace validates :avatar, file_size: { maximum: 100.kilobytes.to_i } mount_uploader :avatar, AttachmentUploader - - def self.accessible_to(user) - accessible_ids = Project.accessible_to(user).pluck(:namespace_id) - accessible_ids += user.groups.pluck(:id) if user - where(id: accessible_ids) - end def human_name name @@ -60,6 +54,10 @@ class Group < Namespace owners.include?(user) end + def has_master?(user) + members.masters.where(user_id: user).any? + end + def last_owner?(user) has_owner?(user) && owners.size == 1 end @@ -73,4 +71,8 @@ class Group < Namespace self.errors.add :avatar, "only images allowed" end end + + def public_profile? + projects.public_only.any? + end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 16d51345e5a..f0c2e552273 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -15,8 +15,12 @@ # milestone_id :integer # state :string(255) # iid :integer +# attachment :string(255) # +require 'carrierwave/orm/activerecord' +require 'file_size_validator' + class Issue < ActiveRecord::Base include Issuable include InternalId diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 061537132b3..bfea209bf6d 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -113,6 +113,7 @@ class MergeRequest < ActiveRecord::Base # Closed scope for merge request should return # both merged and closed mr's scope :closed, -> { with_states(:closed, :merged) } + scope :declined, -> { with_states(:closed) } def validate_branches if target_project == source_project && target_branch == source_branch @@ -212,10 +213,6 @@ class MergeRequest < ActiveRecord::Base target_project != source_project end - def disallow_source_branch_removal? - source_project.root_ref?(source_branch) || source_project.protected_branches.include?(source_branch) - end - def project target_project end @@ -223,7 +220,9 @@ class MergeRequest < ActiveRecord::Base # Return the set of issues that will be closed if this merge request is accepted. def closes_issues if target_branch == project.default_branch - commits.map { |c| c.closes_issues(project) }.flatten.uniq.sort_by(&:id) + issues = commits.flat_map { |c| c.closes_issues(project) } + issues += Gitlab::ClosingIssueExtractor.closed_by_message_in_project(description, project) + issues.uniq.sort_by(&:id) else [] end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 7973eef7e1c..446e5f04c63 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -47,14 +47,6 @@ class Namespace < ActiveRecord::Base def self.global_id 'GLN' end - - def projects_accessible_to(user) - projects.accessible_to(user) - end - - def has_projects_accessible_to?(user) - projects_accessible_to(user).present? - end def to_param path diff --git a/app/models/note.rb b/app/models/note.rb index cee10ec90d2..659cd752071 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -90,6 +90,22 @@ class Note < ActiveRecord::Base create(note_options, without_protection: true) end + def create_milestone_change_note(noteable, project, author, milestone) + body = if milestone.nil? + '_Milestone removed_' + else + "_Milestone changed to #{milestone.title}_" + end + + create({ + noteable: noteable, + project: project, + author: author, + note: body, + system: true + }, without_protection: true) + end + def create_assignee_change_note(noteable, project, author, assignee) body = assignee.nil? ? '_Assignee removed_' : "_Reassigned to @#{assignee.username}_" @@ -122,11 +138,15 @@ class Note < ActiveRecord::Base discussions end - end - # Determine whether or not a cross-reference note already exists. - def self.cross_reference_exists?(noteable, mentioner) - where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any? + def build_discussion_id(type, id, line_code) + [:discussion, type.try(:underscore), id, line_code].join("-").to_sym + end + + # Determine whether or not a cross-reference note already exists. + def cross_reference_exists?(noteable, mentioner) + where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any? + end end def commit_author @@ -194,7 +214,7 @@ class Note < ActiveRecord::Base end def discussion_id - @discussion_id ||= [:discussion, noteable_type.try(:underscore), noteable_id || commit_id, line_code].join("-").to_sym + @discussion_id ||= Note.build_discussion_id(noteable_type, noteable_id || commit_id, line_code) end # Returns true if this is a downvote note, @@ -231,10 +251,6 @@ class Note < ActiveRecord::Base for_merge_request? && for_diff_line? end - def for_wall? - noteable_type.blank? - end - # override to return commits, which are not active record def noteable if for_commit? @@ -275,8 +291,6 @@ class Note < ActiveRecord::Base def noteable_type_name if noteable_type.present? noteable_type.downcase - else - "wall" end end diff --git a/app/models/project.rb b/app/models/project.rb index 45e950f4807..762b540b7a3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -31,15 +31,15 @@ class Project < ActiveRecord::Base default_value_for :archived, false default_value_for :issues_enabled, true - default_value_for :wall_enabled, true default_value_for :merge_requests_enabled, true default_value_for :wiki_enabled, true + default_value_for :wall_enabled, false default_value_for :snippets_enabled, true ActsAsTaggableOn.strict_case_match = true attr_accessible :name, :path, :description, :issues_tracker, :label_list, - :issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, + :issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :wiki_enabled, :visibility_level, :import_url, :last_activity_at, as: [:default, :admin] attr_accessible :namespace_id, :creator_id, as: :admin @@ -54,6 +54,9 @@ class Project < ActiveRecord::Base belongs_to :namespace has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event', foreign_key: 'project_id' + + # Project services + has_many :services has_one :gitlab_ci_service, dependent: :destroy has_one :campfire_service, dependent: :destroy has_one :emails_on_push_service, dependent: :destroy @@ -95,7 +98,7 @@ class Project < ActiveRecord::Base exclusion: { in: Gitlab::Blacklist.path }, format: { with: Gitlab::Regex.path_regex, message: "only letters, digits & '_' '-' '.' allowed. Letter or digit should be first" } - validates :issues_enabled, :wall_enabled, :merge_requests_enabled, + validates :issues_enabled, :merge_requests_enabled, :wiki_enabled, inclusion: { in: [true, false] } validates :issues_tracker_id, length: { maximum: 255 }, allow_blank: true validates :namespace, presence: true @@ -161,12 +164,6 @@ class Project < ActiveRecord::Base where(visibility_level: visibility_levels) end - def accessible_to(user) - accessible_ids = publicish(user).pluck(:id) - accessible_ids += user.authorized_projects.pluck(:id) if user - where(id: accessible_ids) - end - def with_push includes(:events).where('events.action = ?', Event::PUSHED) end @@ -322,6 +319,14 @@ class Project < ActiveRecord::Base gitlab_ci_service && gitlab_ci_service.active end + def ci_services + services.select { |service| service.category == :ci } + end + + def ci_service + @ci_service ||= ci_services.select(&:activated?).first + end + # For compatibility with old code def code path @@ -376,10 +381,6 @@ class Project < ActiveRecord::Base end end - def transfer(new_namespace) - ProjectTransferService.new.transfer(self, new_namespace) - end - def execute_hooks(data, hooks_scope = :push_hooks) hooks.send(hooks_scope).each do |hook| hook.async_execute(data) diff --git a/app/models/project_services/ci_service.rb b/app/models/project_services/ci_service.rb new file mode 100644 index 00000000000..fd34a2a35ea --- /dev/null +++ b/app/models/project_services/ci_service.rb @@ -0,0 +1,34 @@ +# Base class for CI services +# List methods you need to implement to get your CI service +# working with GitLab Merge Requests +class CiService < Service + def category + :ci + end + + # Return complete url to build page + # + # Ex. + # http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c + # + def build_page(sha) + # implement inside child + end + + # Return string with build status or :error symbol + # + # Allowed states: 'success', 'failed', 'running', 'pending' + # + # + # Ex. + # @service.commit_status('13be4ac') + # # => 'success' + # + # @service.commit_status('2abe4ac') + # # => 'running' + # + # + def commit_status(sha) + # implement inside child + end +end diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb index ed1944f3373..ef395e0ec68 100644 --- a/app/models/project_services/gitlab_ci_service.rb +++ b/app/models/project_services/gitlab_ci_service.rb @@ -17,7 +17,7 @@ # api_key :string(255) # -class GitlabCiService < Service +class GitlabCiService < CiService attr_accessible :project_url validates :project_url, presence: true, if: :activated? diff --git a/app/models/project_team.rb b/app/models/project_team.rb index eca13e56061..0bbbd3d00e8 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -117,6 +117,33 @@ class ProjectTeam false end + def guest?(user) + max_tm_access(user.id) == Gitlab::Access::GUEST + end + + def reporter?(user) + max_tm_access(user.id) == Gitlab::Access::REPORTER + end + + def developer?(user) + max_tm_access(user.id) == Gitlab::Access::DEVELOPER + end + + def master?(user) + max_tm_access(user.id) == Gitlab::Access::MASTER + end + + def max_tm_access(user_id) + access = [] + access << project.users_projects.find_by(user_id: user_id).try(:access_field) + + if group + access << group.users_groups.find_by(user_id: user_id).try(:access_field) + end + + access.compact.max + end + private def fetch_members(level = nil) @@ -128,7 +155,10 @@ class ProjectTeam group_members = group_members.send(level) if group end - (project_members + group_members).map(&:user).uniq + user_ids = project_members.pluck(:user_id) + user_ids += group_members.pluck(:user_id) if group + + User.where(id: user_ids) end def group diff --git a/app/models/repository.rb b/app/models/repository.rb index eadc34127c2..00a1032b6c4 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -55,12 +55,6 @@ class Repository tags.find { |tag| tag.name == name } end - def recent_branches(limit = 20) - branches.sort do |a, b| - commit(b.target).committed_date <=> commit(a.target).committed_date - end[0..limit] - end - def add_branch(branch_name, ref) Rails.cache.delete(cache_key(:branch_names)) @@ -112,7 +106,7 @@ class Repository def commit_count Rails.cache.fetch(cache_key(:commit_count)) do begin - raw_repository.raw.commit_count + raw_repository.commit_count(self.root_ref) rescue 0 end @@ -220,4 +214,19 @@ class Repository def clean_old_archives Gitlab::Popen.popen(%W(find #{Gitlab.config.gitlab.repository_downloads_path} -mmin +120 -delete)) end + + def branches_sorted_by(value) + case value + when 'recently_updated' + branches.sort do |a, b| + commit(b.target).committed_date <=> commit(a.target).committed_date + end + when 'last_updated' + branches.sort do |a, b| + commit(a.target).committed_date <=> commit(b.target).committed_date + end + else + branches + end + end end diff --git a/app/models/service.rb b/app/models/service.rb index ea000395218..d655937079d 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -33,6 +33,10 @@ class Service < ActiveRecord::Base active end + def category + :common + end + def title # implement inside child end @@ -41,6 +45,10 @@ class Service < ActiveRecord::Base # implement inside child end + def help + # implement inside child + end + def to_param # implement inside child end diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 720accd73dc..9e4409daa1a 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -34,8 +34,8 @@ class Snippet < ActiveRecord::Base validates :content, presence: true # Scopes - scope :public, -> { where(private: false) } - scope :private, -> { where(private: true) } + scope :are_public, -> { where(private: false) } + scope :are_private, -> { where(private: true) } scope :fresh, -> { order("created_at DESC") } scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) } scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) } diff --git a/app/models/user.rb b/app/models/user.rb index 16961e5413b..2352f8c050b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -90,6 +90,8 @@ class User < ActiveRecord::Base has_many :users_groups, dependent: :destroy has_many :groups, through: :users_groups has_many :owned_groups, -> { where users_groups: { group_access: UsersGroup::OWNER } }, through: :users_groups, source: :group + has_many :masters_groups, -> { where users_groups: { group_access: UsersGroup::MASTER } }, through: :users_groups, source: :group + # Projects has_many :groups_projects, through: :groups, source: :projects has_many :personal_projects, through: :namespace, source: :projects @@ -476,4 +478,16 @@ class User < ActiveRecord::Base def generate_tmp_oauth_email self.email = "temp-email-for-oauth-#{username}@gitlab.localhost" end + + def public_profile? + authorized_projects.public_only.any? + end + + def avatar_url(size = nil) + if avatar.present? + URI::join(Gitlab.config.gitlab.url, avatar.url).to_s + else + GravatarService.new.execute(email, size) + end + end end diff --git a/app/observers/base_observer.rb b/app/observers/base_observer.rb index d685bd5d819..260d1f05db3 100644 --- a/app/observers/base_observer.rb +++ b/app/observers/base_observer.rb @@ -10,12 +10,4 @@ class BaseObserver < ActiveRecord::Observer def log_info message Gitlab::AppLogger.info message end - - def current_user - Thread.current[:current_user] - end - - def current_commit - Thread.current[:current_commit] - end end diff --git a/app/observers/milestone_observer.rb b/app/observers/milestone_observer.rb deleted file mode 100644 index a1a62a99a8f..00000000000 --- a/app/observers/milestone_observer.rb +++ /dev/null @@ -1,13 +0,0 @@ -class MilestoneObserver < BaseObserver - def after_create(milestone) - event_service.open_milestone(milestone, current_user) - end - - def after_close(milestone, transition) - event_service.close_milestone(milestone, current_user) - end - - def after_reopen(milestone, transition) - event_service.reopen_milestone(milestone, current_user) - end -end diff --git a/app/observers/note_observer.rb b/app/observers/note_observer.rb index 337bb1dc5ae..bb0b0876eca 100644 --- a/app/observers/note_observer.rb +++ b/app/observers/note_observer.rb @@ -3,12 +3,9 @@ class NoteObserver < BaseObserver notification.new_note(note) # Skip system notes, like status changes and cross-references. - # Skip wall notes to prevent spamming of dashboard - if note.noteable_type.present? && !note.system - event_service.leave_note(note, current_user) - end + unless note.system + event_service.leave_note(note, note.author) - unless note.system? # Create a cross-reference note if this Note contains GFM that names an # issue, merge request, or commit. note.references.each do |mentioned| @@ -18,6 +15,6 @@ class NoteObserver < BaseObserver end def after_update(note) - note.notice_added_references(note.project, current_user) + note.notice_added_references(note.project, note.author) end end diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb new file mode 100644 index 00000000000..97766677405 --- /dev/null +++ b/app/services/create_tag_service.rb @@ -0,0 +1,13 @@ +class CreateTagService + def execute(project, tag_name, ref, current_user) + repository = project.repository + repository.add_tag(tag_name, ref) + new_tag = repository.find_tag(tag_name) + + if new_tag + Event.create_ref_event(project, current_user, new_tag, 'add', 'refs/tags') + end + + new_tag + end +end diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb new file mode 100644 index 00000000000..ce2d8093dff --- /dev/null +++ b/app/services/delete_branch_service.rb @@ -0,0 +1,46 @@ +class DeleteBranchService + def execute(project, branch_name, current_user) + repository = project.repository + branch = repository.find_branch(branch_name) + + # No such branch + unless branch + return error('No such branch') + end + + if branch_name == repository.root_ref + return error('Cannot remove HEAD branch') + end + + # Dont allow remove of protected branch + if project.protected_branch?(branch_name) + return error('Protected branch cant be removed') + end + + # Dont allow user to remove branch if he is not allowed to push + unless current_user.can?(:push_code, project) + return error('You dont have push access to repo') + end + + if repository.rm_branch(branch_name) + Event.create_ref_event(project, current_user, branch, 'rm') + success('Branch was removed') + else + return error('Failed to remove branch') + end + end + + def error(message) + { + message: message, + state: :error + } + end + + def success(message) + { + message: message, + state: :success + } + end +end diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb new file mode 100644 index 00000000000..a69c7c78377 --- /dev/null +++ b/app/services/gravatar_service.rb @@ -0,0 +1,28 @@ +class GravatarService + def execute(email, size = nil) + if gravatar_config.enabled && email.present? + size = 40 if size.nil? || size <= 0 + + sprintf gravatar_url, + hash: Digest::MD5.hexdigest(email.strip.downcase), + size: size, + email: email.strip + end + end + + def gitlab_config + Gitlab.config.gitlab + end + + def gravatar_config + Gitlab.config.gravatar + end + + def gravatar_url + if gitlab_config.https + gravatar_config.ssl_url + else + gravatar_config.plain_url + end + end +end diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index 2e1e1f7e0f0..eac774210ae 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -10,5 +10,9 @@ module Issues def execute_hooks(issue) issue.project.execute_hooks(issue.to_hook_data, :issue_hooks) end + + def create_milestone_note(issue) + Note.create_milestone_change_note(issue, issue.project, current_user, issue.milestone) + end end end diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index b562c401fd4..b4a742b0037 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -1,7 +1,7 @@ module Issues class UpdateService < Issues::BaseService def execute(issue) - state = params.delete('state_event') + state = params.delete('state_event') || params.delete(:state_event) case state when 'reopen' @@ -13,6 +13,10 @@ module Issues if params.present? && issue.update_attributes(params) issue.reset_events_cache + if issue.previous_changes.include?('milestone_id') + create_milestone_note(issue) + end + if issue.previous_changes.include?('assignee_id') notification_service.reassigned_issue(issue, current_user) create_assignee_note(issue) diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index c77f5d664ef..2907f3587da 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -16,5 +16,9 @@ module MergeRequests merge_request.project.execute_hooks(merge_request.to_hook_data, :merge_request_hooks) end end + + def create_milestone_note(merge_request) + Note.create_milestone_change_note(merge_request, merge_request.project, current_user, merge_request.milestone) + end end end diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index bbedca6ffd6..f1aa8b73930 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -10,7 +10,7 @@ module MergeRequests params.delete(:source_project_id) params.delete(:target_project_id) - state = params.delete('state_event') + state = params.delete('state_event') || params.delete(:state_event) case state when 'reopen' @@ -22,6 +22,10 @@ module MergeRequests if params.present? && merge_request.update_attributes(params) merge_request.reset_events_cache + if merge_request.previous_changes.include?('milestone_id') + create_milestone_note(merge_request) + end + if merge_request.previous_changes.include?('assignee_id') notification_service.reassigned_merge_request(merge_request, current_user) create_assignee_note(merge_request) diff --git a/app/services/milestones/base_service.rb b/app/services/milestones/base_service.rb new file mode 100644 index 00000000000..176ab9f1ab5 --- /dev/null +++ b/app/services/milestones/base_service.rb @@ -0,0 +1,4 @@ +module Milestones + class BaseService < ::BaseService + end +end diff --git a/app/services/milestones/close_service.rb b/app/services/milestones/close_service.rb new file mode 100644 index 00000000000..608fc49d766 --- /dev/null +++ b/app/services/milestones/close_service.rb @@ -0,0 +1,11 @@ +module Milestones + class CloseService < Milestones::BaseService + def execute(milestone) + if milestone.close + event_service.close_milestone(milestone, current_user) + end + + milestone + end + end +end diff --git a/app/services/milestones/create_service.rb b/app/services/milestones/create_service.rb new file mode 100644 index 00000000000..b8e08c9f1eb --- /dev/null +++ b/app/services/milestones/create_service.rb @@ -0,0 +1,13 @@ +module Milestones + class CreateService < Milestones::BaseService + def execute + milestone = project.milestones.new(params) + + if milestone.save + event_service.open_milestone(milestone, current_user) + end + + milestone + end + end +end diff --git a/app/services/milestones/reopen_service.rb b/app/services/milestones/reopen_service.rb new file mode 100644 index 00000000000..573f9ee5c21 --- /dev/null +++ b/app/services/milestones/reopen_service.rb @@ -0,0 +1,11 @@ +module Milestones + class ReopenService < Milestones::BaseService + def execute(milestone) + if milestone.activate + event_service.reopen_milestone(milestone, current_user) + end + + milestone + end + end +end diff --git a/app/services/milestones/update_service.rb b/app/services/milestones/update_service.rb new file mode 100644 index 00000000000..307e96a2b36 --- /dev/null +++ b/app/services/milestones/update_service.rb @@ -0,0 +1,20 @@ +module Milestones + class UpdateService < Milestones::BaseService + def execute(milestone) + state = params.delete('state_event') || params.delete(:state_event) + + case state + when 'activate' + Milestones::ReopenService.new(project, current_user, {}).execute(milestone) + when 'close' + Milestones::CloseService.new(project, current_user, {}).execute(milestone) + end + + if params.present? + milestone.update_attributes(params) + end + + milestone + end + end +end diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index 06140c5afeb..650b6008db8 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -106,7 +106,6 @@ class NotificationService # TODO: split on methods and refactor # def new_note(note) - # ignore wall messages return true unless note.noteable_type.present? # ignore gitlab service messages @@ -254,7 +253,7 @@ class NotificationService # Remove users with disabled notifications from array # Also remove duplications and nil recipients def reject_muted_users(users, project = nil) - users = users.compact.uniq + users = users.to_a.compact.uniq users.reject do |user| next user.notification.disabled? unless project diff --git a/app/services/project_transfer_service.rb b/app/services/project_transfer_service.rb deleted file mode 100644 index 7055ef32aee..00000000000 --- a/app/services/project_transfer_service.rb +++ /dev/null @@ -1,46 +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 - - # Remove old satellite - project.satellite.destroy - - # Apply new namespace id - 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") - - # Create a new satellite (reload project from DB) - Project.find(project.id).ensure_satellite_exists - - # clear project cached events - project.reset_events_cache - - true - end - end -end - diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 11b65256502..3d2b9bf4875 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -19,7 +19,6 @@ module Projects default_opts = { issues_enabled: default_features.issues, wiki_enabled: default_features.wiki, - wall_enabled: default_features.wall, snippets_enabled: default_features.snippets, merge_requests_enabled: default_features.merge_requests, visibility_level: default_features.visibility_level @@ -97,7 +96,7 @@ module Projects def allowed_namespace?(user, namespace_id) namespace = Namespace.find_by(id: namespace_id) - current_user.can?(:manage_namespace, namespace) + current_user.can?(:create_projects, namespace) end end end diff --git a/app/services/projects/image_service.rb b/app/services/projects/image_service.rb new file mode 100644 index 00000000000..c79ddddd972 --- /dev/null +++ b/app/services/projects/image_service.rb @@ -0,0 +1,39 @@ +module Projects + class ImageService < BaseService + include Rails.application.routes.url_helpers + def initialize(repository, params, root_url) + @repository, @params, @root_url = repository, params.dup, root_url + end + + def execute + uploader = FileUploader.new('uploads', upload_path, accepted_images) + image = @params['markdown_img'] + + if image && correct_mime_type?(image) + alt = image.original_filename + uploader.store!(image) + link = { + 'alt' => File.basename(alt, '.*'), + 'url' => File.join(@root_url, uploader.url) + } + else + link = nil + end + end + + protected + + def upload_path + base_dir = FileUploader.generate_dir + File.join(@repository.path_with_namespace, base_dir) + end + + def accepted_images + %w(png jpg jpeg gif) + end + + def correct_mime_type?(image) + accepted_images.map{ |format| image.content_type.include? format }.any? + end + end +end diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index f8e27f6f1c6..d115e92a105 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -1,22 +1,71 @@ +# Projects::TransferService class +# +# Used for transfer project to another namespace +# +# Ex. +# # Move projects to namespace with ID 17 by user +# Projects::TransferService.new(project, user, namespace_id: 17).execute +# module Projects class TransferService < BaseService - 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.to_i != project.namespace_id - # Transfer to someone namespace - namespace = Namespace.find(namespace_id) - project.transfer(namespace) - end - end + include Gitlab::ShellAdapter + class TransferError < StandardError; end + + def execute + namespace_id = params.delete(:namespace_id) + namespace = Namespace.find_by(id: namespace_id) - rescue ProjectTransferService::TransferError => ex + if allowed_transfer?(current_user, project, namespace) + transfer(project, namespace) + else + project.errors.add(:namespace, 'is invalid') + false + end + rescue Projects::TransferService::TransferError => ex project.reload project.errors.add(:namespace_id, ex.message) false end + + 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 + + # Remove old satellite + project.satellite.destroy + + # Apply new namespace id + 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") + + # Create a new satellite (reload project from DB) + Project.find(project.id).ensure_satellite_exists + + # clear project cached events + project.reset_events_cache + + true + end + end + + def allowed_transfer?(current_user, project, namespace) + namespace && + can?(current_user, :change_namespace, project) && + namespace.id != project.namespace_id && + current_user.can?(:create_projects, namespace) + end end end - diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb index 8a1fce17ce7..21214511182 100644 --- a/app/services/search/global_service.rb +++ b/app/services/search/global_service.rb @@ -12,7 +12,7 @@ module Search return result unless query.present? group = Group.find_by(id: params[:group_id]) if params[:group_id].present? - projects = Project.accessible_to(current_user) + projects = ProjectsFinder.new.execute(current_user) projects = projects.where(namespace_id: group.id) if group project_ids = projects.pluck(:id) diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb new file mode 100644 index 00000000000..0fa987c93f6 --- /dev/null +++ b/app/uploaders/file_uploader.rb @@ -0,0 +1,41 @@ +# encoding: utf-8 +class FileUploader < CarrierWave::Uploader::Base + storage :file + + def initialize(base_dir, path = '', allowed_extensions = nil) + @base_dir = base_dir + @path = path + @allowed_extensions = allowed_extensions + end + + def base_dir + @base_dir + end + + def store_dir + File.join(@base_dir, @path) + end + + def cache_dir + File.join(@base_dir, 'tmp', @path) + end + + def extension_white_list + @allowed_extensions + end + + def store!(file) + @filename = self.class.generate_filename(file) + super + end + + def self.generate_filename(file) + original_filename = File.basename(file.original_filename, '.*') + extension = File.extname(file.original_filename) + new_filename = Digest::MD5.hexdigest(original_filename) + extension + end + + def self.generate_dir + SecureRandom.hex(5) + end +end diff --git a/app/views/admin/background_jobs/show.html.haml b/app/views/admin/background_jobs/show.html.haml index 32f77cc1a70..c79d1280dd9 100644 --- a/app/views/admin/background_jobs/show.html.haml +++ b/app/views/admin/background_jobs/show.html.haml @@ -3,9 +3,9 @@ %hr -.ui-box - .title Sidekiq running processes - .body +.panel.panel-default + .panel-heading Sidekiq running processes + .panel-body - if @sidekiq_processes.empty? %h4.cred %i.icon-warning-sign @@ -40,5 +40,5 @@ -.ui-box +.panel.panel-default %iframe{src: sidekiq_path, width: '100%', height: 900, style: "border: none"} diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml new file mode 100644 index 00000000000..31990ee5932 --- /dev/null +++ b/app/views/admin/groups/_form.html.haml @@ -0,0 +1,57 @@ += form_for [:admin, @group], html: { class: "form-horizontal" } do |f| + - if @group.errors.any? + .alert.alert-danger + %span= @group.errors.full_messages.first + .form-group.group_name_holder + = f.label :name, class: 'control-label' do + Group name + .col-sm-10 + = f.text_field :name, placeholder: "Example Group", class: "form-control" + + .form-group.group-description-holder + = f.label :description, "Details", class: 'control-label' + .col-sm-10 + = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 + + .form-group.group-description-holder + = f.label :avatar, "Group avatar", class: 'control-label' + .col-sm-10 + %a.choose-btn.btn.btn-small.js-choose-group-avatar-button + %i.icon-paper-clip + %span Choose File ... + + %span.file_name.js-avatar-filename File name... + = f.file_field :avatar, class: "js-group-avatar-input hidden" + .light The maximum file size allowed is 100KB. + + - if @group.new_record? + .form-group + .col-sm-2 + .col-sm-10 + .bs-callout.bs-callout-info + %ul + %li A group is a collection of several projects + %li Groups are private by default + %li Members of a group may only view projects they have permission to access + %li Group project URLs are prefixed with the group namespace + %li Existing projects may be moved into a group + .form-actions + = f.submit 'Create group', class: "btn btn-create" + = link_to 'Cancel', admin_groups_path, class: "btn btn-cancel" + + - else + .form-group.group_name_holder + = f.label :path, class: 'control-label' do + %span Group path + .col-sm-10 + = f.text_field :path, placeholder: "example-group", class: "form-control danger" + .bs-callout.bs-callout-danger + %ul + %li Changing group path can have unintended side effects. + %li Renaming group path will rename directory for all related projects + %li It will change web url for access group and group projects. + %li It will change the git path to repositories under this group. + .form-actions + = f.submit 'Save changes', class: "btn btn-primary" + = link_to 'Cancel', admin_group_path(@group), class: "btn btn-cancel" + diff --git a/app/views/admin/groups/edit.html.haml b/app/views/admin/groups/edit.html.haml index eb5c91050af..824e51c1cf1 100644 --- a/app/views/admin/groups/edit.html.haml +++ b/app/views/admin/groups/edit.html.haml @@ -1,31 +1,3 @@ -%h3.page-title Edit Group +%h3.page-title Edit group: #{@group.name} %hr -= form_for [:admin, @group], html: { class: "form-horizontal" } do |f| - - if @group.errors.any? - .alert.alert-danger - %span= @group.errors.full_messages.first - .form-group.group_name_holder - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: "Example Group", class: "form-control" - - .form-group.group-description-holder - = f.label :description, "Details", class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 - - .form-group.group_name_holder - = f.label :path, class: 'control-label' do - %span.cred Group path - .col-sm-10 - = f.text_field :path, placeholder: "example-group", class: "form-control danger" - %ul.cred - %li Changing group path can have unintended side effects. - %li Renaming group path will rename directory for all related projects - %li It will change web url for access group and group projects. - %li It will change the git path to repositories under this group. - - .form-actions - = f.submit 'Save changes', class: "btn btn-primary" - = link_to 'Cancel', admin_groups_path, class: "btn btn-cancel" += render 'form' diff --git a/app/views/admin/groups/new.html.haml b/app/views/admin/groups/new.html.haml index ae0604cf984..f46f45c5514 100644 --- a/app/views/admin/groups/new.html.haml +++ b/app/views/admin/groups/new.html.haml @@ -1,31 +1,3 @@ -%h3.page-title New Group +%h3.page-title New group %hr -= form_for [:admin, @group], html: { class: 'group-form form-horizontal' } do |f| - - if @group.errors.any? - .alert.alert-danger - %span= @group.errors.full_messages.first - .form-group - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control" - - .form-group.group-description-holder - = f.label :description, "Details", class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 - - .form-group - .col-sm-2 - .col-sm-10 - %ul - %li A group is a collection of several projects - %li Groups are private by default - %li Members of a group may only view projects they have permission to access - %li Group project URLs are prefixed with the group namespace - %li Existing projects may be moved into a group - - .form-actions - = f.submit 'Create group', class: "btn btn-create" - - += render 'form' diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 6055865b4cb..8634f46053d 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -1,17 +1,19 @@ %h3.page-title Group: #{@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 pull-right" do %i.icon-edit Edit %hr .row .col-md-6 - .ui-box - .title + .panel.panel-default + .panel-heading Group info: %ul.well-list %li + = image_tag group_icon(@group.path), class: "avatar s60" + %li %span.light Name: %strong= @group.name %li @@ -29,13 +31,14 @@ %strong = @group.created_at.stamp("March 1, 1999") - .ui-box - .title - Projects - %small - (#{@group.projects.count}) + .panel.panel-default + .panel-heading + %h3.panel-title + Projects + %span.badge + #{@group.projects.count} %ul.well-list - - @group.projects.sort_by(&:name).each do |project| + - @projects.each do |project| %li %strong = link_to project.name_with_namespace, [:admin, project] @@ -43,15 +46,17 @@ = repository_size(project) %span.pull-right.light %span.monospace= project.path_with_namespace + ".git" + .panel-footer + = paginate @projects, param_name: 'projects_page', theme: 'gitlab' .col-md-6 - .ui-box - .title + .panel.panel-default + .panel-heading Add user(s) to the group: - .body.form-holder + .panel-body.form-holder %p.light Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" + %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" = form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do %div @@ -60,14 +65,14 @@ = select_tag :group_access, options_for_select(UsersGroup.group_access_roles), class: "project-access-select select2" %hr = submit_tag 'Add users into group', class: "btn btn-create" - .ui-box - .title - %strong #{@group.name} - Group Members - %small - (#{@group.users_groups.count}) + .panel.panel-default + .panel-heading + %h3.panel-title + Members + %span.badge + #{@group.users_groups.count} %ul.well-list.group-users-list - - @group.users_groups.order('group_access DESC').each do |member| + - @members.each do |member| - user = member.user %li{class: dom_class(user)} .list-item-name @@ -77,3 +82,5 @@ = member.human_access = link_to group_users_group_path(@group, member), data: { confirm: remove_user_from_group_message(@group, user) }, method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do %i.icon-minus.icon-white + .panel-footer + = paginate @members, param_name: 'members_page', theme: 'gitlab' diff --git a/app/views/admin/hooks/index.html.haml b/app/views/admin/hooks/index.html.haml index 60773c20097..0c5db0805f9 100644 --- a/app/views/admin/hooks/index.html.haml +++ b/app/views/admin/hooks/index.html.haml @@ -2,7 +2,7 @@ System hooks %p.light - #{link_to "System hooks ", help_system_hooks_path, class: "vlink"} can be + #{link_to "System hooks ", help_page_path("system_hooks", "system_hooks"), class: "vlink"} can be used for binding events when GitLab creates a User or Project. %hr @@ -22,8 +22,8 @@ %hr -if @hooks.any? - .ui-box - .title + .panel.panel-default + .panel-heading System hooks (#{@hooks.count}) %ul.well-list - @hooks.each do |hook| diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 51ad702154f..5ca6090f8d3 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -1,5 +1,5 @@ .row - .col-md-4 + .col-md-3 .admin-filter = form_tag admin_projects_path, method: :get, class: '' do .form-group @@ -7,19 +7,21 @@ = text_field_tag :name, params[:name], class: "form-control" .form-group - = label_tag :owner_id, 'Owner:' - %div - = users_select_tag :owner_id, selected: params[:owner_id], class: 'input-large input-clamp' - .checkbox - = label_tag :with_push, 'Not empty' - = check_box_tag :with_push, 1, params[:with_push] - - %span.light Projects with push events - .checkbox - = label_tag :abandoned, 'Abandoned' - = check_box_tag :abandoned, 1, params[:abandoned] - - %span.light No activity over 6 month + = label_tag :namespace_id, "Namespace" + = namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large' + + .form-group + %strong Activity + .checkbox + = label_tag :with_push, 'Not empty' + = check_box_tag :with_push, 1, params[:with_push] + + %span.light Projects with push events + .checkbox + = label_tag :abandoned, 'Abandoned' + = check_box_tag :abandoned, 1, params[:abandoned] + + %span.light No activity over 6 month %fieldset %strong Visibility level: @@ -31,16 +33,16 @@ %span.descr = visibility_level_icon(level) = label - .form-actions - = hidden_field_tag :sort, params[:sort] - = submit_tag "Search", class: "btn submit btn-primary" - = link_to "Reset", admin_projects_path, class: "btn" + %hr + = hidden_field_tag :sort, params[:sort] + = submit_tag "Search", class: "btn submit btn-primary" + = link_to "Reset", admin_projects_path, class: "btn btn-cancel" - .col-md-8 - .ui-box - .title + .col-md-9 + .panel.panel-default + .panel-heading Projects (#{@projects.total_count}) - .pull-right + .panel-head-actions .dropdown.inline %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} %span.light sort: diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 11f07743ace..66a72449f40 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -6,8 +6,8 @@ %hr .row .col-md-6 - .ui-box - .title + .panel.panel-default + .panel-heading Project info: %ul.well-list %li @@ -75,10 +75,10 @@ = visibility_level_icon(@project.visibility_level) = visibility_level_label(@project.visibility_level) - .ui-box - .title + .panel.panel-default + .panel-heading Transfer project - .body + .panel-body = form_for @project, url: transfer_admin_project_path(@project), method: :put, html: { class: 'form-horizontal' } do |f| .form-group = f.label :namespace_id, "Namespace", class: 'control-label' @@ -92,19 +92,21 @@ .col-md-6 - if @group - .ui-box - .title + .panel.panel-default + .panel-heading %strong #{@group.name} group members (#{@group.users_groups.count}) .pull-right = link_to admin_group_path(@group), class: 'btn btn-small' do %i.icon-edit %ul.well-list - - @group.users_groups.order('group_access DESC').each do |member| + - @group_members.each do |member| = render 'users_groups/users_group', member: member, show_controls: false + .panel-footer + = paginate @group_members, param_name: 'group_members_page', theme: 'gitlab' - .ui-box - .title + .panel.panel-default + .panel-heading Project members %small (#{@project.users.count}) @@ -113,7 +115,7 @@ %i.icon-edit Manage Access %ul.well-list.team_members - - @project.users_projects.each do |users_project| + - @project_members.each do |users_project| - user = users_project.user %li.users_project .list-item-name @@ -126,3 +128,5 @@ %span.light= users_project.human_access = link_to project_team_member_path(@project, user), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, remote: true, class: "btn btn-small btn-remove" do %i.icon-remove + .panel-footer + = paginate @project_members, param_name: 'project_members_page', theme: 'gitlab' diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index b9e6382ea88..d00772d4dfe 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -1,5 +1,5 @@ .user_new - = form_for [:admin, @user], html: { class: 'form-horizontal' } do |f| + = form_for [:admin, @user], html: { class: 'form-horizontal fieldset-form' } do |f| -if @user.errors.any? #error_explanation .alert.alert-danger @@ -61,17 +61,14 @@ .col-sm-10 You cannot remove your own admin rights - else .col-sm-10= f.check_box :admin - - unless @user.new_record? || current_user == @user - .alert.alert-danger - - if @user.blocked? - %p This user is blocked and is not able to login to GitLab - = link_to 'Unblock User', unblock_admin_user_path(@user), method: :put, class: "btn 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(@user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-small btn-remove" %fieldset %legend Profile .form-group + = f.label :avatar, class: 'control-label' + .col-sm-10 + = f.file_field :avatar + + .form-group = f.label :skype, class: 'control-label' .col-sm-10= f.text_field :skype, class: 'form-control' .form-group diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml index 2a4f8c60546..d71d8189c51 100644 --- a/app/views/admin/users/edit.html.haml +++ b/app/views/admin/users/edit.html.haml @@ -1,6 +1,7 @@ %h3.page-title - #{@user.name} → - %i.icon-edit - Edit user + Edit user: #{@user.name} +.back-link + = link_to admin_user_path(@user) do + ← Back to user page %hr = render 'form' diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index f42ae7c6a01..b8a18224443 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -28,10 +28,10 @@ = link_to 'Reset', admin_users_path, class: "btn btn-cancel" .col-md-9 - .ui-box - .title + .panel.panel-default + .panel-heading Users (#{@users.total_count}) - .pull-right + .panel-head-actions = link_to 'New User', new_admin_user_path, class: "btn btn-new" %ul.well-list - @users.each do |user| diff --git a/app/views/admin/users/new.html.haml b/app/views/admin/users/new.html.haml index a1c90c48946..8fbb757f424 100644 --- a/app/views/admin/users/new.html.haml +++ b/app/views/admin/users/new.html.haml @@ -1,5 +1,4 @@ %h3.page-title - %i.icon-plus New user %hr = render 'form' diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 764b34499ab..a255c64fc27 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -1,5 +1,5 @@ %h3.page-title - %span.cgray User: + User: = @user.name - if @user.blocked? %span.cred (Blocked) @@ -11,115 +11,147 @@ %i.icon-edit Edit %hr +%ul.nav.nav-tabs + %li.active + %a{"data-toggle" => "tab", href: "#account"} Account + %li + %a{"data-toggle" => "tab", href: "#profile"} Profile + %li + %a{"data-toggle" => "tab", href: "#groups"} Groups + %li + %a{"data-toggle" => "tab", href: "#projects"} Projects -.row - .col-md-6 - .ui-box - .title - Account: - .pull-right - = image_tag avatar_icon(@user.email, 32), class: "avatar s32" - %ul.well-list - %li - %span.light Name: - %strong= @user.name - %li - %span.light Username: - %strong - = @user.username - %li - %span.light Email: - %strong - = mail_to @user.email - %li - %span.light Can create groups: - %strong - = @user.can_create_group ? "Yes" : "No" - %li - %span.light Personal projects limit: - %strong - = @user.projects_limit - %li - %span.light Member since: - %strong - = @user.created_at.stamp("Nov 12, 2031") - - if @user.confirmed_at - %li - %span.light Confirmed at: - %strong - = @user.confirmed_at.stamp("Nov 12, 2031") - - else - %li - %span.light Confirmed: - %strong.cred - No +.tab-content + #account.tab-pane.active + .row + .col-md-6 + .panel.panel-default + .panel-heading + Account: + %ul.well-list + %li + %span.light Name: + %strong= @user.name + %li + %span.light Username: + %strong + = @user.username + %li + %span.light Email: + %strong + = mail_to @user.email + - @user.emails.each do |email| + %li + %span.light Secondary email: + %strong= email.email - %li - %span.light Last sign-in at: - %strong - - if @user.last_sign_in_at - = @user.last_sign_in_at.stamp("Nov 12, 2031") + %li + %span.light Can create groups: + %strong + = @user.can_create_group ? "Yes" : "No" + %li + %span.light Personal projects limit: + %strong + = @user.projects_limit + %li + %span.light Member since: + %strong + = @user.created_at.stamp("Nov 12, 2031") + - if @user.confirmed_at + %li + %span.light Confirmed at: + %strong + = @user.confirmed_at.stamp("Nov 12, 2031") - else - never + %li + %span.light Confirmed: + %strong.cred + No + + %li + %span.light Last sign-in at: + %strong + - if @user.last_sign_in_at + = @user.last_sign_in_at.stamp("Nov 12, 2031") + - else + never - - if @user.ldap_user? - %li - %span.light LDAP uid: - %strong - = @user.extern_uid + - if @user.ldap_user? + %li + %span.light LDAP uid: + %strong + = @user.extern_uid - - if @user.created_by - %li - %span.light Created by: - %strong - = link_to @user.created_by.name, [:admin, @user.created_by] + - if @user.created_by + %li + %span.light Created by: + %strong + = link_to @user.created_by.name, [:admin, @user.created_by] - - unless @user == current_user - - if @user.blocked? - .alert.alert-info - %h4 This user is blocked - %p Blocking user has the following effects: - %ul - %li User will not be able to login - %li User will not be able to access git repositories - %li User will be removed from joined projects and groups - %li Personal projects will be left - %li Owned groups will be left - %br - = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' } - - else - .alert.alert-warning - %h4 Block this user - %p Blocking user has the following effects: - %ul - %li User will not be able to login - %li User will not be able to access git repositories - %li User will be removed from joined projects and groups - %li Personal projects will be left - %li Owned groups will be left - %br - = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove" + .col-md-6 + - unless @user == current_user + - if @user.blocked? + .alert.alert-info + %h4 This user is blocked + %p Blocking user has the following effects: + %ul + %li User will not be able to login + %li User will not be able to access git repositories + %li User will be removed from joined projects and groups + %li Personal projects will be left + %li Owned groups will be left + %br + = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' } + - else + .alert.alert-warning + %h4 Block this user + %p Blocking user has the following effects: + %ul + %li User will not be able to login + %li User will not be able to access git repositories + %li User will be removed from joined projects and groups + %li Personal projects will be left + %li Owned groups will be left + %br + = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove" - .alert.alert-danger - %h4 - Remove user - %p Deleting a user has the following effects: - %ul - %li All user content like authored issues, snippets, comments will be removed - - rp = @user.personal_projects.count - - unless rp.zero? - %li #{pluralize rp, 'personal project'} will be removed and cannot be restored - - if @user.solo_owned_groups.present? + .alert.alert-danger + %h4 + Remove user + %p Deleting a user has the following effects: + %ul + %li All user content like authored issues, snippets, comments will be removed + - rp = @user.personal_projects.count + - unless rp.zero? + %li #{pluralize rp, 'personal project'} will be removed and cannot be restored + - if @user.solo_owned_groups.present? + %li + Next groups with all content will be removed: + %strong #{@user.solo_owned_groups.map(&:name).join(', ')} + %br + = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove" + + #profile.tab-pane + .row + .col-md-6 + .panel.panel-default + .panel-heading + = @user.name + %ul.well-list + %li + = image_tag avatar_icon(@user.email, 60), class: "avatar s60" %li - Next groups with all content will be removed: - %strong #{@user.solo_owned_groups.map(&:name).join(', ')} - %br - = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove" + %span.light Profile page: + %strong + = link_to user_path(@user) do + = @user.username + .col-md-6 + = render 'users/profile', user: @user - .col-md-6 + #groups.tab-pane - if @user.users_groups.present? - .ui-box - .title Groups: + .panel.panel-default + .panel-heading Groups: %ul.well-list - @user.users_groups.each do |user_group| - group = user_group.group @@ -131,23 +163,42 @@ - unless user_group.owner? = link_to group_users_group_path(group, user_group), data: { confirm: remove_user_from_group_message(group, @user) }, method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do %i.icon-remove.icon-white + - else + .nothing-here-block This user has no groups. + + #projects.tab-pane + - if @user.groups.any? + .panel.panel-default + .panel-heading Group projects + %ul.well-list + - @user.groups.each do |group| + %li + %strong= group.name + – access to + #{pluralize(group.projects.count, 'project')} - .ui-box - .title Projects (#{@projects.count}) - %ul.well-list - - @projects.sort_by(&:name_with_namespace).each do |project| - - tm = project.team.find_tm(@user.id) - %li.users_project - = link_to admin_project_path(project), class: dom_class(project) do - = project.name_with_namespace + .row + .col-md-6 + = render 'users/projects', projects: @personal_projects - - if tm - .pull-right - - if tm.owner? - %span.light Owner - - else - %span.light= tm.human_access + .col-md-6 + .panel.panel-default + .panel-heading Joined projects (#{@joined_projects.count}) + %ul.well-list + - @joined_projects.sort_by(&:name_with_namespace).each do |project| + - tm = project.team.find_tm(@user.id) + %li.users_project + .list-item-name + = link_to admin_project_path(project), class: dom_class(project) do + = project.name_with_namespace + + - if tm + .pull-right + - if tm.owner? + %span.light Owner + - else + %span.light= tm.human_access - - if tm.respond_to? :project - = link_to project_team_member_path(project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do - %i.icon-remove + - if tm.respond_to? :project + = link_to project_team_member_path(project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do + %i.icon-remove diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml index a6bc946bedc..cb9c18b7966 100644 --- a/app/views/dashboard/_groups.html.haml +++ b/app/views/dashboard/_groups.html.haml @@ -1,5 +1,5 @@ -.ui-box - .title.clearfix +.panel.panel-default + .panel-heading.clearfix = search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter form-control' - if current_user.can_create_group? %span.pull-right diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml index 44c7a4b8c80..5a49bf0c6b1 100644 --- a/app/views/dashboard/_projects.html.haml +++ b/app/views/dashboard/_projects.html.haml @@ -1,5 +1,5 @@ -.ui-box - .title.clearfix +.panel.panel-default + .panel-heading.clearfix = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-filter form-control' - if current_user.can_create_project? %span.pull-right @@ -19,7 +19,7 @@ %li.bottom %span.light #{@projects_limit} of #{pluralize(@projects_count, 'project')} displayed. - .pull-right.append-right-10 + .pull-right = link_to projects_dashboard_path do Show all %i.icon-angle-right diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml index e0993293eab..ee086d88e3e 100644 --- a/app/views/dashboard/_zero_authorized_projects.html.haml +++ b/app/views/dashboard/_zero_authorized_projects.html.haml @@ -1,5 +1,5 @@ %h3.page-title Welcome to GitLab! -%p.light Self Hosted Git Management application. +%p.light Self hosted Git management application. %hr %div .dashboard-intro-icon @@ -11,9 +11,8 @@ - if current_user.can_create_project? You can create up to %strong= pluralize(current_user.projects_limit, "project") + "." - Click on the button below to add a new one - else - If you are added to a project, it will be displayed here + If you are added to a project, it will be displayed here. - if current_user.can_create_project? .link_holder @@ -29,7 +28,7 @@ %p.slead You can create a group for several dependent projects. %br - Groups are the best way to manage projects and members + Groups are the best way to manage projects and members. .link_holder = link_to new_group_path, class: "btn btn-new" do New group » diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index af627588ad9..9888da2f7f2 100755..100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -7,7 +7,9 @@ %hr .row - .col-md-3 + .fixed.sidebar-expand-button.hidden-lg.hidden-md + %i.icon-list.icon-2x + .col-md-3.responsive-side = render 'shared/filter', entity: 'issue' .col-md-9 = render 'shared/issues' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 550a93e178c..ee3bec2849d 100755..100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -7,7 +7,9 @@ List all merge requests from all projects you have access to. %hr .row - .col-md-3 + .fixed.sidebar-expand-button.hidden-lg.hidden-md + %i.icon-list.icon-2x + .col-md-3.responsive-side = render 'shared/filter', entity: 'merge_request' .col-md-9 = render 'shared/merge_requests' diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/show.html.haml index e5b7fbf097e..306b71717ef 100644 --- a/app/views/dashboard/show.html.haml +++ b/app/views/dashboard/show.html.haml @@ -2,8 +2,11 @@ .dashboard.row .activities.col-md-8 = render 'activities' - .side.col-md-4.hidden-sm.hidden-xs + .side.col-md-4.left.responsive-side = render 'sidebar' + .fixed.sidebar-expand-button.hidden-lg.hidden-md + %i.icon-list.icon-2x + - else = render "zero_authorized_projects" diff --git a/app/views/errors/access_denied.html.haml b/app/views/errors/access_denied.html.haml index 6aa78f0c2a8..e005a7c4409 100644 --- a/app/views/errors/access_denied.html.haml +++ b/app/views/errors/access_denied.html.haml @@ -2,4 +2,4 @@ %h3.page-title Access Denied %hr %p You are not allowed to access this page. -%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"} +%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "vlink"} diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index 135320da57e..0e03e116e7d 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -2,4 +2,4 @@ .commit-row-title = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id", alt: '' - = gfm event_commit_title(commit[:message]) + = gfm event_commit_title(commit[:message]), project diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index 8cf26671e3b..61383315373 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -1,6 +1,6 @@ - if event.proper? .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} - %span.cgray.pull-right + .event-item-timestamp #{time_ago_with_tooltip(event.created_at)} = cache event do diff --git a/app/views/events/_event_last_push.html.haml b/app/views/events/_event_last_push.html.haml index 6db05a1a5a6..4c9a39bcc27 100644 --- a/app/views/events/_event_last_push.html.haml +++ b/app/views/events/_event_last_push.html.haml @@ -1,11 +1,12 @@ - if show_last_push_widget?(event) .event-last-push - %span You pushed to - = link_to project_commits_path(event.project, event.ref_name) do - %strong= truncate(event.ref_name, length: 28) - at - %strong= link_to_project event.project - #{time_ago_with_tooltip(event.created_at)} + .event-last-push-text + %span You pushed to + = link_to project_commits_path(event.project, event.ref_name) do + %strong= event.ref_name + at + %strong= link_to_project event.project + #{time_ago_with_tooltip(event.created_at)} .pull-right = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-create btn-small" do diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml index f181df23eb4..1bca64c7d50 100644 --- a/app/views/events/event/_push.html.haml +++ b/app/views/events/event/_push.html.haml @@ -5,7 +5,7 @@ %strong= event.ref_name - else = link_to project_commits_path(event.project, event.ref_name) do - %strong= truncate(event.ref_name, length: 30) + %strong= event.ref_name at = link_to_project event.project diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml index bd4e3156af0..2ebff21b819 100644 --- a/app/views/groups/_projects.html.haml +++ b/app/views/groups/_projects.html.haml @@ -1,14 +1,14 @@ -.ui-box - .title +.panel.panel-default + .panel-heading Projects (#{projects.count}) - - if can? current_user, :manage_group, @group - %span.pull-right + - if can? current_user, :create_projects, @group + .panel-head-actions = link_to new_project_path(namespace_id: @group.id), class: "btn btn-new" do %i.icon-plus New project %ul.well-list - if projects.blank? - .nothing-here-block This groups has no projects yet + .nothing-here-block This group has no projects yet - projects.each do |project| %li.project-row = link_to project_path(project), class: dom_class(project) do @@ -16,6 +16,6 @@ = visibility_level_icon(project.visibility_level) %span.str-truncated %span.project-name - = truncate(project.name, length: 25) + = project.name %span.arrow %i.icon-angle-right diff --git a/app/views/groups/_settings_nav.html.haml b/app/views/groups/_settings_nav.html.haml new file mode 100644 index 00000000000..32eae31a47d --- /dev/null +++ b/app/views/groups/_settings_nav.html.haml @@ -0,0 +1,10 @@ +%ul.nav.nav-pills.nav-stacked.nav-stacked-menu + = nav_link(path: 'groups#edit') do + = link_to edit_group_path(@group) do + %i.icon-edit + Group + = nav_link(path: 'groups#projects') do + = link_to projects_group_path(@group) do + %i.icon-folder-close + Projects + diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index 500c37ab71d..97f22df044f 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -1,95 +1,56 @@ .row .col-md-2 - %ul.nav.nav-pills.nav-stacked.nav-stacked-menu - %li.active - = link_to '#tab-edit', 'data-toggle' => 'tab' do - %i.icon-edit - Group - %li - = link_to '#tab-projects', 'data-toggle' => 'tab' do - %i.icon-folder-close - Projects - %li - = link_to '#tab-remove', 'data-toggle' => 'tab' do - %i.icon-remove-sign - Remove - + = render 'settings_nav' .col-md-10 - .tab-content - .tab-pane.active#tab-edit - .ui-box - .title - %strong= @group.name - group settings: - %div.form-holder - = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f| - - if @group.errors.any? - .alert.alert-danger - %span= @group.errors.full_messages.first - .form-group - = f.label :name, class: 'control-label' do - Group name - .col-sm-10 - = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control left" - - .form-group.group-description-holder - = f.label :description, "Details", class: 'control-label' - .col-sm-10 - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 + .panel.panel-default + .panel-heading + %strong= @group.name + group settings: + .panel-body + = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f| + - if @group.errors.any? + .alert.alert-danger + %span= @group.errors.full_messages.first + .form-group + = f.label :name, class: 'control-label' do + Group name + .col-sm-10 + = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control left" - .form-group - .col-sm-2 - .col-sm-10 - = image_tag group_icon(@group.to_param), alt: '', class: 'avatar s160' - %p.light - - if @group.avatar? - You can change your group avatar here - - else - You can upload an group avatar here - %a.choose-btn.btn.btn-small.js-choose-group-avatar-button - %i.icon-paper-clip - %span Choose File ... - - %span.file_name.js-avatar-filename File name... - = f.file_field :avatar, class: "js-group-avatar-input hidden" - .light The maximum file size allowed is 100KB. - - if @group.avatar? - %hr - = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar" + .form-group.group-description-holder + = f.label :description, "Details", class: 'control-label' + .col-sm-10 + = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 - .form-actions - = f.submit 'Save group', class: "btn btn-save" + .form-group + .col-sm-2 + .col-sm-10 + = image_tag group_icon(@group.to_param), alt: '', class: 'avatar s160' + %p.light + - if @group.avatar? + You can change your group avatar here + - else + You can upload a group avatar here + %a.choose-btn.btn.btn-small.js-choose-group-avatar-button + %i.icon-paper-clip + %span Choose File ... + + %span.file_name.js-avatar-filename File name... + = f.file_field :avatar, class: "js-group-avatar-input hidden" + .light The maximum file size allowed is 100KB. + - if @group.avatar? + %hr + = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar" - .tab-pane#tab-projects - .ui-box - .title - %strong= @group.name - projects: - - if can? current_user, :manage_group, @group - %span.pull-right - = link_to new_project_path(namespace_id: @group.id), class: "btn btn-tiny" do - %i.icon-plus - New Project - %ul.well-list - - @group.projects.each do |project| - %li - .list-item-name - = visibility_level_icon(project.visibility_level) - = link_to project.name_with_namespace, project - .pull-right - = link_to 'Members', 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, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove" - - if @group.projects.blank? - .nothing-here-block This group has no projects yet + .form-actions + = f.submit 'Save group', class: "btn btn-save" - .tab-pane#tab-remove - .ui-box.ui-box-danger - .title Remove group - .body - %p - Removing group will cause all child projects and resources to be removed. - %p - %strong Removed group can not be restored! + .panel.panel-danger + .panel-heading Remove group + .panel-body + %p + Removing group will cause all child projects and resources to be removed. + %br + %strong Removed group can not be restored! - = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove" + = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove" diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 4b11d91dc98..0eec2d6be0b 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -11,7 +11,9 @@ %hr .row - .col-md-3 + .fixed.sidebar-expand-button.hidden-lg.hidden-md + %i.icon-list.icon-2x + .col-md-3.responsive-side = render 'shared/filter', entity: 'issue' .col-md-9 = render 'shared/issues' diff --git a/app/views/groups/members.html.haml b/app/views/groups/members.html.haml index fa44ee2ae1a..19819c96124 100644 --- a/app/views/groups/members.html.haml +++ b/app/views/groups/members.html.haml @@ -5,7 +5,7 @@ %p.light Members of group have access to all group projects. Read more about permissions - %strong= link_to "here", help_permissions_path, class: "vlink" + %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" %hr @@ -24,8 +24,8 @@ .js-toggle-content.hide.new-group-member-holder = render "new_group_member" -.ui-box.prepend-top-20 - .title +.panel.panel-default.prepend-top-20 + .panel-heading %strong #{@group.name} group members %small diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 209130ec444..71adb2c5516 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -10,7 +10,9 @@ To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page. %hr .row - .col-md-3 + .fixed.sidebar-expand-button.hidden-lg.hidden-md + %i.icon-list.icon-2x + .col-md-3.responsive-side = render 'shared/filter', entity: 'merge_request' .col-md-9 = render 'shared/merge_requests' diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml index 955a107e542..ebf5e8571aa 100644 --- a/app/views/groups/new.html.haml +++ b/app/views/groups/new.html.haml @@ -13,6 +13,17 @@ .col-sm-10 = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 + .form-group.group-description-holder + = f.label :avatar, "Group avatar", class: 'control-label' + .col-sm-10 + %a.choose-btn.btn.btn-small.js-choose-group-avatar-button + %i.icon-paper-clip + %span Choose File ... + + %span.file_name.js-avatar-filename File name... + = f.file_field :avatar, class: "js-group-avatar-input hidden" + .light The maximum file size allowed is 100KB. + .form-group .col-sm-2 .col-sm-10 diff --git a/app/views/groups/projects.html.haml b/app/views/groups/projects.html.haml new file mode 100644 index 00000000000..a5e752d776f --- /dev/null +++ b/app/views/groups/projects.html.haml @@ -0,0 +1,29 @@ +.row + .col-md-2 + = render 'settings_nav' + .col-md-10 + .panel.panel-default + .panel-heading + %strong= @group.name + projects: + - if can? current_user, :manage_group, @group + .panel-head-actions + = link_to new_project_path(namespace_id: @group.id), class: "btn btn-new" do + %i.icon-plus + New Project + %ul.well-list + - @projects.each do |project| + %li + .list-item-name + = visibility_level_icon(project.visibility_level) + %strong= link_to project.name_with_namespace, project + %span.label.label-gray + = repository_size(project) + .pull-right + = link_to 'Members', 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, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove" + - if @projects.blank? + .nothing-here-block This group has no projects yet + + = paginate @projects, theme: "gitlab" diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 0c62772a5c9..06183dd74a9 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -5,7 +5,10 @@ = link_to dashboard_path, class: 'btn btn-tiny' do ← To dashboard - %span.cgray You will only see events from projects in this group + %span.cgray + Currently you are only seeing events from the + = @group.name + group %hr = render 'shared/event_filter' - if @events.any? @@ -20,7 +23,8 @@ %h3.page-title = @group.name - if @group.description.present? - %p= @group.description + %p + = auto_link @group.description, link: :urls = render "projects", projects: @projects - if current_user .prepend-top-20 diff --git a/app/views/help/_api_layout.html.haml b/app/views/help/_api_layout.html.haml deleted file mode 100644 index af723f906d9..00000000000 --- a/app/views/help/_api_layout.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -.row - .col-md-3 - .append-bottom-20 - = link_to help_path, class: 'btn btn-small' do - %i.icon-angle-left - Back to help - %ul.nav.nav-pills.nav-stacked - - %w(README projects project_snippets repositories repository_files commits deploy_keys users groups session issues milestones merge_requests notes system_hooks).each do |file| - %li{class: file == @category ? 'active' : nil} - = link_to file.titleize, help_api_file_path(file) - - .col-md-9.pull-right - = yield diff --git a/app/views/help/_layout.html.haml b/app/views/help/_layout.html.haml deleted file mode 100644 index 201d63ca243..00000000000 --- a/app/views/help/_layout.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -.row - .col-md-3 - %h3.page-title Help - %ul.nav.nav-pills.nav-stacked - - links = {:"Workflow" => help_workflow_path, :"SSH Keys" => help_ssh_path, :"GitLab Markdown" => help_markdown_path, :"Permissions" => help_permissions_path, :"API" => help_api_path, :"Web Hooks" => help_web_hooks_path, :"Rake Tasks" => help_raketasks_path, :"System Hooks" => help_system_hooks_path, :"Public Access" => help_public_access_path, :"Security" => help_security_path} - - links.each do |title,path| - %li{class: current_page?(path) ? 'active' : nil} - = link_to title, path - - .col-md-9 - .wiki - = yield diff --git a/app/views/help/api.html.haml b/app/views/help/api.html.haml deleted file mode 100644 index 3d2cf50b7f2..00000000000 --- a/app/views/help/api.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -= render layout: 'help/api_layout' do - %h3.page-title - %span.light API - %span - \/ - = @category.titleize - - .file-holder - .file-title - %i.icon-file - = @category - .file-content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "api", "#{@category}.md")) diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 724fe1d6b3a..a89ccde7924 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -18,8 +18,8 @@ .row .col-md-4 - .ui-box - .title + .panel.panel-default + .panel-heading Quick help %ul.well-list %li @@ -33,53 +33,12 @@ Use = link_to "shortcuts", '#', onclick: "new Shortcuts()" - .col-md-4 - .ui-box - .title - User documentation - %ul.well-list - %li - %strong= link_to "Workflow", help_workflow_path - %p Learn how to use Git and GitLab together. - - %li - %strong= link_to "SSH keys", help_ssh_path - %p Setup secure access to your projects. - - %li - %strong= link_to "GitLab Markdown", help_markdown_path - %p Learn what you can do with GitLab's advanced formatting system. - - %li - %strong= link_to "Permissions", help_permissions_path - %p Get familiar with GitLab's permission levels. - - %li - %strong= link_to "API", help_api_file_path(category: 'README') - %p Explore how you can access GitLab via a simple and powerful API. - - %li - %strong= link_to "Web Hooks", help_web_hooks_path - %p Let GitLab notify you when new code has been pushed to your project. - - .col-md-4 - .ui-box - .title - Admin documentation - %ul.well-list - - %li - %strong= link_to "Rake Tasks", help_raketasks_path - %p Explore what GitLab has in store for you to make administration easier. - - %li - %strong= link_to "System Hooks", help_system_hooks_path - %p Let GitLab notify you when certain management tasks need to be carried out. - - %li - %strong= link_to "Public Access", help_public_access_path - %p Learn how you can allow public access to a project. - - %li - %strong= link_to "Security", help_security_path - %p Learn what you can do to secure your GitLab instance. + .col-md-8 + .panel.panel-default.documentation-index + .panel-heading Documentation + .panel-body + = preserve do + - readme_text = File.read(Rails.root.join("doc", "README.md")) + - text = readme_text.dup + - readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") } + = markdown text diff --git a/app/views/help/markdown.html.haml b/app/views/help/markdown.html.haml deleted file mode 100644 index ec9d13f2d6b..00000000000 --- a/app/views/help/markdown.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title GitLab Flavored Markdown - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "markdown", "markdown.md")) diff --git a/app/views/help/permissions.html.haml b/app/views/help/permissions.html.haml deleted file mode 100644 index 5d3ee4526fe..00000000000 --- a/app/views/help/permissions.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title Permissions - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "permissions", "permissions.md")) diff --git a/app/views/help/public_access.html.haml b/app/views/help/public_access.html.haml deleted file mode 100644 index d1ec3f5d5c1..00000000000 --- a/app/views/help/public_access.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title Public Access - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "public_access", "public_access.md")) diff --git a/app/views/help/raketasks.html.haml b/app/views/help/raketasks.html.haml deleted file mode 100644 index 17a02e913ee..00000000000 --- a/app/views/help/raketasks.html.haml +++ /dev/null @@ -1,63 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title GitLab Rake 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' - - .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#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#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/security.html.haml b/app/views/help/security.html.haml deleted file mode 100644 index 72f21e9f634..00000000000 --- a/app/views/help/security.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title Security - - %p.slead - If your GitLab instance is visible from the internet chances are it will be 'tested' by bots sooner or later. - %br - %br - %br - .file-holder - .file-title - %i.icon-file - Dealing with bruteforcing - .file-content.wiki - = preserve do - = markdown File.read(Rails.root.join("doc", "security", "rack_attack.md")) diff --git a/app/views/help/show.html.haml b/app/views/help/show.html.haml new file mode 100644 index 00000000000..67f9cc41cf3 --- /dev/null +++ b/app/views/help/show.html.haml @@ -0,0 +1,2 @@ +.documentation.wiki + = markdown File.read(Rails.root.join('doc', @category, @file + '.md')) diff --git a/app/views/help/ssh.html.haml b/app/views/help/ssh.html.haml deleted file mode 100644 index 75419c3dd01..00000000000 --- a/app/views/help/ssh.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title SSH Keys - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "ssh", "ssh.md")).gsub("$your_email", current_user.email) diff --git a/app/views/help/system_hooks.html.haml b/app/views/help/system_hooks.html.haml deleted file mode 100644 index e24f566121d..00000000000 --- a/app/views/help/system_hooks.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title System hooks - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "system_hooks", "system_hooks.md")) diff --git a/app/views/help/web_hooks.html.haml b/app/views/help/web_hooks.html.haml deleted file mode 100644 index 9e2b54ab6ec..00000000000 --- a/app/views/help/web_hooks.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title Project web hooks - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "web_hooks", "web_hooks.md")) diff --git a/app/views/help/workflow.html.haml b/app/views/help/workflow.html.haml deleted file mode 100644 index 47de4ad796c..00000000000 --- a/app/views/help/workflow.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -= render layout: 'help/layout' do - %h3.page-title Workflow - - .help_body - = preserve do - = markdown File.read(Rails.root.join("doc", "workflow", "workflow.md")) diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 53e0dbaef9b..c7a827555a7 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -10,3 +10,4 @@ .container .content= yield + = yield :embedded_scripts
\ No newline at end of file diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 1f70cf17987..dd48ff6ce38 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -8,7 +8,7 @@ = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref) - if project_nav_tab? :commits - = nav_link(controller: %w(commit commits compare repositories protected_branches tags branches)) do + = nav_link(controller: %w(commit commits compare repositories tags branches)) do = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref) - if project_nav_tab? :network @@ -36,10 +36,6 @@ = nav_link(controller: :wikis) do = link_to 'Wiki', project_wiki_path(@project, :home) - - if project_nav_tab? :wall - = nav_link(controller: :walls) do - = link_to 'Wall', project_wall_path(@project) - - if project_nav_tab? :snippets = nav_link(controller: :snippets) do = link_to 'Snippets', project_snippets_path(@project) diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml index 3ae4961b137..11c815c52a7 100644 --- a/app/views/layouts/projects.html.haml +++ b/app/views/layouts/projects.html.haml @@ -14,3 +14,4 @@ .container .content= yield + = yield :embedded_scripts
\ No newline at end of file diff --git a/app/views/notify/note_wall_email.html.haml b/app/views/notify/note_wall_email.html.haml deleted file mode 100644 index 2fa2f784661..00000000000 --- a/app/views/notify/note_wall_email.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render 'note_message' 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 ee0dc3db1db..00000000000 --- 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/profiles/emails/index.html.haml b/app/views/profiles/emails/index.html.haml index b5f1e438ccb..ca980db2f3c 100644 --- a/app/views/profiles/emails/index.html.haml +++ b/app/views/profiles/emails/index.html.haml @@ -9,8 +9,8 @@ %hr -.ui-box - .title +.panel.panel-default + .panel-heading Emails (#{@emails.count + 1}) %ul.well-list#emails-table %li diff --git a/app/views/profiles/groups/index.html.haml b/app/views/profiles/groups/index.html.haml index cebc0b6bccb..2efe72b1bb3 100644 --- a/app/views/profiles/groups/index.html.haml +++ b/app/views/profiles/groups/index.html.haml @@ -8,8 +8,8 @@ %p.light Group members have access to all a group's projects %hr -.ui-box - .title +.panel.panel-default + .panel-heading %strong Groups (#{@user_groups.count}) %ul.well-list diff --git a/app/views/profiles/keys/index.html.haml b/app/views/profiles/keys/index.html.haml index 71a4ca91d42..aabfd57c286 100644 --- a/app/views/profiles/keys/index.html.haml +++ b/app/views/profiles/keys/index.html.haml @@ -6,12 +6,12 @@ SSH keys allow you to establish a secure connection between your computer and GitLab %br Before you can add an SSH key you need to - = link_to "generate it", help_ssh_path + = link_to "generate it", help_page_path("ssh", "README") %hr -.ui-box - .title +.panel.panel-default + .panel-heading SSH Keys (#{@keys.count}) %ul.well-list#keys-table = render @keys diff --git a/app/views/profiles/keys/new.html.haml b/app/views/profiles/keys/new.html.haml index 3d5a947948d..126afa55540 100644 --- a/app/views/profiles/keys/new.html.haml +++ b/app/views/profiles/keys/new.html.haml @@ -1,6 +1,6 @@ %h3.page-title Add an SSH Key %p.light - Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_ssh_path}. + Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_page_path("ssh", "README")}. %hr = render 'form' diff --git a/app/views/profiles/keys/show.html.haml b/app/views/profiles/keys/show.html.haml index b6724a7cb5d..c4fc1bb269c 100644 --- a/app/views/profiles/keys/show.html.haml +++ b/app/views/profiles/keys/show.html.haml @@ -1,7 +1,7 @@ .row .col-md-4 - .ui-box - .title + .panel.panel-default + .panel-heading SSH Key %ul.well-list %li diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 69598e799e5..9a4c13af975 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -86,5 +86,11 @@ %hr = link_to 'Remove avatar', profile_avatar_path, data: { confirm: "Avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar" + - if @user.public_profile? + .bs-callout.bs-callout-info + %h4 Public profile + %p Your profile is publicly visible because you joined public project(s) + + .form-actions = f.submit 'Save changes', class: "btn btn-save" diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 82ec68c9165..81bb0e20a35 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -8,22 +8,22 @@ = @project.name_with_namespace .col-sm-6 - - unless empty_repo + - if current_user && !empty_repo .project-home-dropdown = render "dropdown" = render "shared/clone_panel" .project-home-extra.row - .col-md-8 + .col-md-7 .project-home-desc - if @project.description.present? - = @project.description + = auto_link @project.description, link: :urls - if can?(current_user, :admin_project, @project) – %strong= link_to 'Edit', edit_project_path - unless empty_repo - .col-md-4 + .col-md-5 .project-home-links = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref) = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project) diff --git a/app/views/projects/_settings_nav.html.haml b/app/views/projects/_settings_nav.html.haml index 4c7b088ae9a..9b73f06a5be 100644 --- a/app/views/projects/_settings_nav.html.haml +++ b/app/views/projects/_settings_nav.html.haml @@ -19,3 +19,7 @@ = link_to project_services_path(@project) do %i.icon-cogs Services + = nav_link(controller: :protected_branches) do + = link_to project_protected_branches_path(@project) do + %i.icon-lock + Protected branches diff --git a/app/views/projects/_visibility_level.html.haml b/app/views/projects/_visibility_level.html.haml index eb38fce0ecf..5f34e66b3ed 100644 --- a/app/views/projects/_visibility_level.html.haml +++ b/app/views/projects/_visibility_level.html.haml @@ -1,7 +1,7 @@ .form-group.project-visibility-level-holder = f.label :visibility_level, class: 'control-label' do Visibility Level - = link_to "(?)", help_public_access_path + = link_to "(?)", help_page_path("public_access", "public_access") .col-sm-10 - if can_change_visibility_level - Gitlab::VisibilityLevel.values.each do |level| diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml index 2f82bfe52f3..cabef3c19fe 100644 --- a/app/views/projects/blob/_actions.html.haml +++ b/app/views/projects/blob/_actions.html.haml @@ -14,6 +14,6 @@ = link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty? = link_to "history", project_commits_path(@project, @id), class: "btn btn-small" - - if allowed_tree_edit? - = link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do - remove +- if allowed_tree_edit? + = link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do + remove diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml index 863e4e3de53..87574d4648b 100644 --- a/app/views/projects/blob/_blob.html.haml +++ b/app/views/projects/blob/_blob.html.haml @@ -1,4 +1,4 @@ -%ul.breadcrumb +%ul.breadcrumb.repo-breadcrumb %li %i.icon-angle-right = link_to project_tree_path(@project, @ref) do @@ -8,7 +8,7 @@ - if path - if path.end_with?(@path) = link_to project_blob_path(@project, path) do - %span.cblue + %strong = truncate(title, length: 40) - else = link_to truncate(title, length: 40), project_tree_path(@project, path) diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index f0731977098..54a7b934dd7 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -1,13 +1,14 @@ - commit = @repository.commit(branch.target) -%li +%li(class="js-branch-#{branch.name}") %h4 - = link_to project_commits_path(@project, branch.name) do + = link_to project_tree_path(@project, branch.name) do %strong= truncate(branch.name, length: 60) - if branch.name == @repository.root_ref %span.label.label-info default - if @project.protected_branch? branch.name %span.label.label-success %i.icon-lock + protected .pull-right - if can?(current_user, :download_code, @project) = render 'projects/repositories/download_archive', ref: branch.name, btn_class: 'btn-grouped btn-group-small' @@ -16,18 +17,13 @@ %i.icon-copy Compare - - if can?(current_user, :admin_project, @project) && branch.name != @repository.root_ref - = link_to project_branch_path(@project, branch.name), class: 'btn btn-grouped btn-small remove-row', method: :delete, data: { confirm: 'Removed branch cannot be restored. Are you sure?'}, remote: true do + - if can_remove_branch?(@project, branch.name) + = link_to project_branch_path(@project, branch.name), class: 'btn btn-grouped btn-small btn-remove remove-row', method: :delete, data: { confirm: 'Removed branch cannot be restored. Are you sure?'}, remote: true do %i.icon-trash - if commit - %p - = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do - = commit.short_id - = image_tag avatar_icon(commit.author_email), class: "avatar s16", alt: '' - %span.light - = gfm escape_once(truncate(commit.title, length: 40)) - #{time_ago_with_tooltip(commit.committed_date)} + %ul.list-unstyled + = render 'projects/commits/inline_commit', commit: commit, project: @project - else %p Cant find HEAD commit for this branch diff --git a/app/views/projects/branches/_filter.html.haml b/app/views/projects/branches/_filter.html.haml deleted file mode 100644 index 7e1478292e0..00000000000 --- a/app/views/projects/branches/_filter.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -%ul.nav.nav-pills.nav-stacked - = nav_link(path: 'branches#recent') do - = link_to recent_project_branches_path(@project) do - Recent - .pull-right - = @repository.recent_branches.count - - = nav_link(path: 'protected_branches#index') do - = link_to project_protected_branches_path(@project) do - Protected - %i.icon-lock - .pull-right - = @project.protected_branches.count - - = nav_link(path: 'branches#index') do - = link_to project_branches_path(@project) do - All branches - .pull-right - = @repository.branch_names.count - - -%hr -- if can? current_user, :push_code, @project - = link_to new_project_branch_path(@project), class: 'btn btn-create' do - %i.icon-add-sign - New branch - diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml new file mode 100644 index 00000000000..ec1661c0aaa --- /dev/null +++ b/app/views/projects/branches/destroy.js.haml @@ -0,0 +1,3 @@ +:plain + $(".js-branch-#{@branch_name}").remove(); + $('.js-totalbranch-count').html("#{@repository.branches.size}") diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml index bee04eb013e..8bc4a8f7e98 100644 --- a/app/views/projects/branches/index.html.haml +++ b/app/views/projects/branches/index.html.haml @@ -1,10 +1,31 @@ = render "projects/commits/head" -.row - .col-md-3 - = render "filter" - .col-md-9 - - unless @branches.empty? - %ul.bordered-list.top-list.all-branches - - @branches.each do |branch| - = render "projects/branches/branch", branch: branch - = paginate @branches, theme: 'gitlab' +%h3.page-title + Branches + .pull-right + - if can? current_user, :push_code, @project + = link_to new_project_branch_path(@project), class: 'btn btn-create' do + %i.icon-add-sign + New branch + + .dropdown.inline + %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} + %span.light sort: + - if @sort.present? + = @sort.humanize + - else + Name + %b.caret + %ul.dropdown-menu + %li + = link_to project_branches_path(sort: nil) do + Name + = link_to project_branches_path(sort: 'recently_updated') do + Recently updated + = link_to project_branches_path(sort: 'last_updated') do + Last updated +%hr +- unless @branches.empty? + %ul.bordered-list.top-list.all-branches + - @branches.each do |branch| + = render "projects/branches/branch", branch: branch + = paginate @branches, theme: 'gitlab' diff --git a/app/views/projects/branches/recent.html.haml b/app/views/projects/branches/recent.html.haml deleted file mode 100644 index 37d7919121e..00000000000 --- a/app/views/projects/branches/recent.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -= render "projects/commits/head" -.row - .col-md-3 - = render "filter" - .col-md-9 - %ul.bordered-list.top-list - - @branches.each do |branch| - = render "projects/branches/branch", branch: branch diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml index e3411b62eb6..77f795f23f2 100644 --- a/app/views/projects/commits/_commits.html.haml +++ b/app/views/projects/commits/_commits.html.haml @@ -6,6 +6,6 @@ %span= day.stamp("28 Aug, 2010") %p= pluralize(commits.count, 'commit') .col-md-10 - %ul.well-list + %ul.bordered-list = render commits, project: @project %hr.lists-separator diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml index 466085139f9..a62f50776fa 100644 --- a/app/views/projects/commits/_diffs.html.haml +++ b/app/views/projects/commits/_diffs.html.haml @@ -6,16 +6,18 @@ %p To preserve performance the diff is not shown. - if current_controller?(:commit) or current_controller?(:merge_requests) - Please, download the diff as - if current_controller?(:commit) + Please, download the diff as = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link" or = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link" - - else + instead. + - elsif @merge_request && @merge_request.persisted? + Please, download the diff as = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link" or = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link" - instead. + instead. - unless @force_suppress_diff %p If you still want to see the diff @@ -40,7 +42,6 @@ .files - unless @suppress_diff - diffs.each_with_index do |diff, i| - - next if diff.diff.empty? - file = project.repository.blob_at(@commit.id, diff.new_path) - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file - next unless file @@ -56,7 +57,7 @@ %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 + - if diff_file_mode_changed?(diff) %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" .diff-btn-group diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml index 81e33743911..b636e8ffe16 100644 --- a/app/views/projects/commits/_head.html.haml +++ b/app/views/projects/commits/_head.html.haml @@ -1,15 +1,13 @@ %ul.nav.nav-tabs - %li= render partial: 'shared/ref_switcher', locals: {destination: 'commits'} - = nav_link(controller: [:commit, :commits]) do = link_to 'Commits', project_commits_path(@project, @repository.root_ref) = nav_link(controller: :compare) do = link_to 'Compare', project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref) = nav_link(html_options: {class: branches_tab_class}) do - = link_to recent_project_branches_path(@project) do + = link_to project_branches_path(@project) do Branches - %span.badge= @repository.branches.length + %span.badge.js-totalbranch-count= @repository.branches.size = nav_link(controller: :tags) do = link_to project_tags_path(@project) do @@ -19,9 +17,3 @@ = nav_link(controller: :repositories, action: :stats) do = link_to stats_project_repository_path(@project) do Stats - - - - if current_user && current_controller?(:commits) && current_user.private_token - %li.pull-right.hidden-sm - = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do - %i.icon-rss diff --git a/app/views/projects/commits/_text_file.html.haml b/app/views/projects/commits/_text_file.html.haml index ba83d2e5a0f..8ced4133294 100644 --- a/app/views/projects/commits/_text_file.html.haml +++ b/app/views/projects/commits/_text_file.html.haml @@ -13,7 +13,7 @@ %td.old_line = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code - if @comments_allowed - = render "projects/notes/diff_note_link", line_code: line_code + = link_to_new_diff_note(line_code) %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) @@ -22,3 +22,6 @@ - unless comments.empty? = render "projects/notes/diff_notes_with_reply", notes: comments, line: line +- if diff.diff.blank? && diff_file_mode_changed?(diff) + .file-mode-changed + File mode changed diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml index 3a4f304a255..482a845558f 100644 --- a/app/views/projects/commits/show.html.haml +++ b/app/views/projects/commits/show.html.haml @@ -1,10 +1,18 @@ = render "head" -- if @path.present? - %ul.breadcrumb.commit-breadcrumb - %li.light - History for - = commits_breadcrumbs +.tree-ref-holder + = render 'shared/ref_switcher', destination: 'commits' + +- if current_user && current_user.private_token + .commits-feed-holder.hidden-xs.hidden-sm + = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed", class: 'btn' do + %i.icon-rss + Commits feed + +%ul.breadcrumb.repo-breadcrumb + = commits_breadcrumbs + %li.active + commits %div{id: dom_id(@project)} #commits-list= render "commits" diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index 57331bff31b..88122a73bba 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -6,8 +6,8 @@ = render "form" - if @commits.present? - %div.ui-box - .title + %div.panel.panel-default + .panel-heading Commits (#{@commits.count}) - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE %ul.well-list diff --git a/app/views/projects/deploy_keys/_form.html.haml b/app/views/projects/deploy_keys/_form.html.haml index ebb92b36b47..162ef05b367 100644 --- a/app/views/projects/deploy_keys/_form.html.haml +++ b/app/views/projects/deploy_keys/_form.html.haml @@ -14,7 +14,7 @@ .col-sm-10 %p.light Paste a machine public key here. Read more about how to generate it - = link_to "here", help_ssh_path + = link_to "here", help_page_path("ssh", "README") = f.text_area :key, class: "form-control thin_area", rows: 5 .form-actions diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 10674ccae46..4195a491a0f 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -4,9 +4,9 @@ %div %h3.page-title Project settings: - %p.light Some settings, such as "Transfer Project", are hidden inside the danger area below + %p.light Some settings, such as "Transfer Project", are hidden inside the danger area below. %hr - .form-holder + .panel-body = form_for @project, remote: true, html: { class: "edit_project form-horizontal" } do |f| %fieldset .form-group.project_name_holder @@ -74,13 +74,6 @@ %span.descr Pages for project documentation .form-group - = f.label :wall_enabled, "Wall", class: 'control-label' - .col-sm-10 - .checkbox - = f.check_box :wall_enabled - %span.descr Simple chat system for broadcasting inside project - - .form-group = f.label :snippets_enabled, "Snippets", class: 'control-label' .col-sm-10 .checkbox @@ -101,18 +94,18 @@ %p Project settings below may result in data loss! = link_to '#', class: 'btn js-toggle-button' do - Show it to me + Show them to me %i.icon-chevron-down .js-toggle-content.hide - if can? current_user, :archive_project, @project - .ui-box.ui-box-danger - .title + .panel.panel-default.panel.panel-warning + .panel-heading - if @project.archived? Unarchive project - else Archive project - .body + .panel-body - if @project.archived? %p Unarchiving the project will mark its repository as active. @@ -132,15 +125,34 @@ %strong Archived projects cannot be committed to! = link_to 'Archive', archive_project_path(@project), data: { confirm: "Are you sure that you want to archive this project?\nAn archived project cannot be committed to." }, - method: :post, class: "btn btn-remove" + method: :post, class: "btn btn-warning" - else .nothing-here-block Only the project owner can archive a project + .panel.panel-default.panel.panel-warning + .panel-heading Rename repository + .errors-holder + .panel-body + = form_for(@project, html: { class: 'form-horizontal' }) do |f| + .form-group + = f.label :path, class: 'control-label' do + %span Path + .col-sm-9 + .form-group + .input-group + = f.text_field :path, class: 'form-control' + %span.input-group-addon .git + %ul + %li Be careful. Renaming a project's repository can have unintended side effects. + %li You will need to update your local repositories to point to the new location. + .form-actions + = f.submit 'Rename', class: "btn btn-warning" + - if can?(current_user, :change_namespace, @project) - .ui-box.ui-box-danger - .title Transfer project + .panel.panel-default.panel.panel-danger + .panel-heading Transfer project .errors-holder - .form-holder + .panel-body = form_for(@project, url: transfer_project_path(@project), method: :put, remote: true, html: { class: 'transfer-project form-horizontal' }) do |f| .form-group = f.label :namespace_id, class: 'control-label' do @@ -157,29 +169,10 @@ - else .nothing-here-block Only the project owner can transfer a project - .ui-box.ui-box-danger - .title Rename repository - .errors-holder - .form-holder - = form_for(@project, html: { class: 'form-horizontal' }) do |f| - .form-group - = f.label :path, class: 'control-label' do - %span Path - .col-sm-9 - .form-group - .input-group - = f.text_field :path, class: 'form-control' - %span.input-group-addon .git - %ul - %li Be careful. Renaming a project's repository can have unintended side effects. - %li You will need to update your local repositories to point to the new location. - .form-actions - = f.submit 'Rename', class: "btn btn-remove" - - if can?(current_user, :remove_project, @project) - .ui-box.ui-box-danger - .title Remove project - .body + .panel.panel-default.panel.panel-danger + .panel-heading Remove project + .panel-body %p Removing the project will delete its repository and all related resources including issues, merge requests etc. %br diff --git a/app/views/projects/edit_tree/preview.html.haml b/app/views/projects/edit_tree/preview.html.haml index fc6d3bfbc24..340f68cc05c 100644 --- a/app/views/projects/edit_tree/preview.html.haml +++ b/app/views/projects/edit_tree/preview.html.haml @@ -23,4 +23,4 @@ %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) - else - %p.nothing_here_message No changes. + .nothing-here-block No changes. diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index 93037ef9585..32a6d4ef36e 100644 --- a/app/views/projects/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml @@ -1,23 +1,26 @@ -%h3.page-title Edit mode .file-editor + %ul.nav.nav-tabs.js-edit-mode + %li.active + = link_to 'Edit', '#editor' + %li + = link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) + = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do .file-holder.file .file-title - .btn-group.js-edit-mode.left-options - = link_to 'Edit', '#editor', class: 'active hover btn btn-tiny' - = link_to editing_preview_title(@blob.name), '#preview', class: 'btn btn-tiny', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) %i.icon-file %span.file_name + %span.monospace.light #{@ref}: = @path - %small - on - %strong= @ref %span.options .btn-group.tree-btn-group = link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message } .file-content.code %pre.js-edit-mode-pane#editor= @blob.data .js-edit-mode-pane#preview.hide + %center + %h2 + %i.icon-spinner.icon-spin .form-group.commit_message-group = label_tag 'commit_message', class: "control-label" do @@ -61,14 +64,14 @@ paneId = currentLink.attr('href'), currentPane = editModePanes.filter(paneId); - editModeLinks.removeClass('active hover'); - currentLink.addClass('active hover'); + editModeLinks.parent().removeClass('active hover'); + currentLink.parent().addClass('active hover'); editModePanes.hide(); if (paneId == '#preview') { + currentPane.fadeIn(200); $.post(currentLink.data('preview-url'), { content: editor.getValue() }, function(response) { currentPane.empty().append(response); - currentPane.fadeIn(200); }) } else { currentPane.fadeIn(200); diff --git a/app/views/projects/hooks/index.html.haml b/app/views/projects/hooks/index.html.haml index 866fd6f6066..9a003c87f68 100644 --- a/app/views/projects/hooks/index.html.haml +++ b/app/views/projects/hooks/index.html.haml @@ -2,7 +2,7 @@ Web hooks %p.light - #{link_to "Web hooks ", help_web_hooks_path, class: "vlink"} can be + #{link_to "Web hooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be used for binding events when something is happening within the project. %hr.clearfix @@ -51,8 +51,8 @@ = f.submit "Add Web Hook", class: "btn btn-create" -if @hooks.any? - .ui-box - .title + .panel.panel-default + .panel-heading Web hooks (#{@hooks.count}) %ul.well-list - @hooks.each do |hook| diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 84703229fe6..d29a7973100 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -5,6 +5,7 @@ - contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name)) .alert.alert-info.col-sm-10.col-sm-offset-2 ="Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe + = form_for [@project, @issue], html: { class: 'form-horizontal issue-form' } do |f| -if @issue.errors.any? .alert.alert-danger @@ -19,8 +20,12 @@ .form-group = f.label :description, 'Description', class: 'control-label' .col-sm-10 - = f.text_area :description, class: "form-control js-gfm-input", rows: 14 - %p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + = f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 14 + .col-sm-12.hint + .pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. + .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. + .clearfix + .error-alert %hr .form-group .issue-assignee @@ -30,7 +35,7 @@ .col-sm-10 = project_users_select_tag('issue[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @issue.assignee_id) - = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' + = link_to 'Assign to me', '#', class: 'btn assign-to-me-link' .form-group .issue-milestone = f.label :milestone_id, class: 'control-label' do @@ -57,9 +62,6 @@ - cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue) = link_to "Cancel", cancel_path, class: 'btn btn-cancel' - - - :javascript $("#issue_label_list") .bind( "keydown", function( event ) { @@ -94,3 +96,5 @@ $('#issue_assignee_id').val("#{current_user.id}").trigger("change"); e.preventDefault(); }); + + window.project_image_path_upload = "#{upload_image_project_path @project}"; diff --git a/app/views/projects/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml index f1e866c8e9d..716ea7cefed 100644 --- a/app/views/projects/issues/_head.html.haml +++ b/app/views/projects/issues/_head.html.haml @@ -9,6 +9,11 @@ = nav_link(controller: :labels) do = link_to 'Labels', project_labels_path(@project), class: "tab" + - if current_controller?(:milestones) + %li.pull-right + %button.btn.btn-default.sidebar-expand-button + %i.icon.icon-list + - if current_controller?(:issues) - if current_user %li @@ -17,6 +22,8 @@ %li.pull-right .pull-right + %button.btn.btn-default.sidebar-expand-button + %i.icon.icon-list = form_tag project_issues_path(@project), method: :get, id: "issue_search_form", class: 'pull-left issue-search-form' do .append-right-10.hidden-xs.hidden-sm = search_field_tag :issue_search, nil, { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input input-mn-300' } diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml index 425dcb45ddf..d7987f43fbb 100644 --- a/app/views/projects/issues/_issue_context.html.haml +++ b/app/views/projects/issues/_issue_context.html.haml @@ -1,6 +1,6 @@ = form_for [@project, @issue], remote: true, html: {class: 'edit-issue inline-update'} do |f| .row - .col-md-6 + .col-sm-6 %strong.append-right-10 Assignee: @@ -11,7 +11,7 @@ - else None - .col-md-6.text-right + .col-sm-6.text-right %strong.append-right-10 Milestone: - if can?(current_user, :modify_issue, @issue) diff --git a/app/views/projects/issues/_issues.html.haml b/app/views/projects/issues/_issues.html.haml index e85ff3a7865..1d0dcd7f074 100644 --- a/app/views/projects/issues/_issues.html.haml +++ b/app/views/projects/issues/_issues.html.haml @@ -61,7 +61,7 @@ = hidden_field_tag :status, params[:status] = button_tag "Update issues", class: "btn update_selected_issues btn-save" -.ui-box +.panel.panel-default %ul.well-list.issues-list = render @issues - if @issues.blank? diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 51a8c911af8..2e66d059565 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -1,6 +1,8 @@ = render "head" .row - .col-md-3 + .fixed.fixed.sidebar-expand-button.hidden-lg.hidden-md.hidden-xs + %i.icon-list.icon-2x + .col-md-3.responsive-side = render 'shared/project_filter', project_entities_path: project_issues_path(@project), labels: true, redirect: 'issues' .col-md-9.issues-holder diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index b6d3a8edf4d..695eb225754 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -32,13 +32,13 @@ .issue-box{ class: issue_box_class(@issue) } .state.clearfix - .state-label.col-sm-2.col-xs-12 + .state-label - if @issue.closed? Closed - else Open - %span.creator.col-sm-9.col-xs-12 + .creator Created by #{link_to_member(@project, @issue.author)} #{time_ago_with_tooltip(@issue.created_at)} %h4.title diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 290a15e2664..9ef232b5268 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -22,8 +22,12 @@ .form-group = f.label :description, "Description", class: 'control-label' .col-sm-10 - = f.text_area :description, class: "form-control js-gfm-input", rows: 14 - %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 14 + .col-sm-12.hint + .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. + .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. + .clearfix + .error-alert %hr .form-group .issue-assignee @@ -33,7 +37,7 @@ .col-sm-10 = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id) - = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' + = link_to 'Assign to me', '#', class: 'btn assign-to-me-link' .form-group .issue-milestone = f.label :milestone_id, class: 'control-label' do @@ -98,3 +102,5 @@ return false; } }); + + window.project_image_path_upload = "#{upload_image_project_path @project}"; diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index a8b774a3cd1..f8f14a71a11 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -33,18 +33,23 @@ %div= msg - if @merge_request.source_branch.present? && @merge_request.target_branch.present? - .light-well - %center - %h4 - There isn't anything to merge. - %p.slead - - if @merge_request.source_branch == @merge_request.target_branch - You'll need to use different branch names to get a valid comparison. - - else - %span.label-branch #{@merge_request.source_branch} - and - %span.label-branch #{@merge_request.target_branch} - are the same. + - if @compare_failed + .alert.alert-danger + %h4 Compare failed + %p We can't compare selected branches. It may be because of huge diff or satellite timeout. Please try again or select different branches. + - else + .light-well + %center + %h4 + There isn't anything to merge. + %p.slead + - if @merge_request.source_branch == @merge_request.target_branch + You'll need to use different branch names to get a valid comparison. + - else + %span.label-branch #{@merge_request.source_branch} + and + %span.label-branch #{@merge_request.target_branch} + are the same. %hr diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index b5479be708b..34a30975e07 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -23,8 +23,11 @@ .form-group .light = f.label :description, "Description" - = f.text_area :description, class: "form-control js-gfm-input", rows: 10 - %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 10 + .clearfix.hint + .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. + .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. + .error-alert .form-group .issue-assignee = f.label :assignee_id do @@ -33,7 +36,7 @@ %div = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id) - = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' + = link_to 'Assign to me', '#', class: 'btn assign-to-me-link' .form-group .issue-milestone = f.label :milestone_id do @@ -54,8 +57,8 @@ = f.submit 'Submit merge request', class: "btn btn-create" .mr-compare - %div.ui-box - .title + %div.panel.panel-default + .panel-heading Commits (#{@commits.count}) - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE %ul.well-list @@ -80,3 +83,5 @@ $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); e.preventDefault(); }); + + window.project_image_path_upload = "#{upload_image_project_path @project}"; diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index 193c600f774..486454793ba 100644 --- a/app/views/projects/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -7,15 +7,17 @@ = render "projects/merge_requests/show/participants" - if @commits.present? - %ul.nav.nav-tabs + %ul.nav.nav-pills.merge-request-tabs %li.notes-tab{data: {action: 'notes'}} = link_to project_merge_request_path(@project, @merge_request) do %i.icon-comment Discussion + %span.badge= @merge_request.mr_and_commit_notes.count %li.diffs-tab{data: {action: 'diffs'}} = link_to diffs_project_merge_request_path(@project, @merge_request) do %i.icon-list-alt Changes + %span.badge= @merge_request.diffs.size - content_for :note_actions do - if can?(current_user, :modify_merge_request, @merge_request) @@ -24,11 +26,11 @@ - if @merge_request.closed? = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link", title: "Close merge request" - .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } - = render "projects/notes/notes_with_form" .diffs.tab-content - if current_page?(action: 'diffs') = render "projects/merge_requests/show/diffs" + .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } + = render "projects/notes/notes_with_form" .status :javascript @@ -38,7 +40,7 @@ url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}", check_enable: #{@merge_request.unchecked? ? "true" : "false"}, url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}", - ci_enable: #{@project.gitlab_ci? ? "true" : "false"}, + ci_enable: #{@project.ci_service ? "true" : "false"}, current_status: "#{@merge_request.merge_status_name}", action: "#{controller.action_name}" }); diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index 12a72edb224..4bb803eb6df 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -7,7 +7,9 @@ %span (#{@merge_requests.total_count}) %hr .row - .col-md-3 + .fixed.sidebar-expand-button.hidden-lg.hidden-md + %i.icon-list.icon-2x + .col-md-3.responsive-side = render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project), labels: true, redirect: 'merge_requests' .col-md-9 @@ -61,7 +63,7 @@ .pull-right = render 'shared/sort_dropdown' - .ui-box + .panel.panel-default %ul.well-list.mr-list = render @merge_requests - if @merge_requests.blank? diff --git a/app/views/projects/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml index f69146e1a37..92a7bb927e4 100644 --- a/app/views/projects/merge_requests/show/_commits.html.haml +++ b/app/views/projects/merge_requests/show/_commits.html.haml @@ -1,9 +1,9 @@ - if @commits.present? - .ui-box - .title + .panel.panel-default + .panel-heading %i.icon-list Commits (#{@commits.count}) - .commits + .commits.mr-commits - if @commits.count > 8 %ul.first-commits.well-list - @commits.first(8).each do |commit| diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml index 5c6734fd24b..ab00b34242a 100644 --- a/app/views/projects/merge_requests/show/_context.html.haml +++ b/app/views/projects/merge_requests/show/_context.html.haml @@ -1,6 +1,6 @@ = form_for [@project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f| .row - .col-md-6 + .col-sm-6 %strong.append-right-10 Assignee: @@ -11,7 +11,7 @@ - else None - .col-md-6.text-right + .col-sm-6.text-right %strong.append-right-10 Milestone: - if can?(current_user, :modify_merge_request, @merge_request) diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml index 1276489c2d9..07e05f55012 100644 --- a/app/views/projects/merge_requests/show/_mr_accept.html.haml +++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml @@ -38,7 +38,7 @@ .accept-group .pull-left = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request" - - unless @merge_request.disallow_source_branch_removal? + - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) .remove_branch_holder.pull-left = label_tag :should_remove_source_branch, class: "checkbox" do = check_box_tag :should_remove_source_branch diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml index 435e916c6dc..f1aaba2010d 100644 --- a/app/views/projects/merge_requests/show/_mr_box.html.haml +++ b/app/views/projects/merge_requests/show/_mr_box.html.haml @@ -1,6 +1,6 @@ .issue-box{ class: issue_box_class(@merge_request) } .state.clearfix - %span.state-label.col-sm-2.col-xs-12 + .state-label - if @merge_request.merged? Merged - elsif @merge_request.closed? @@ -8,7 +8,7 @@ - else Open - %span.creator.col-sm-9.col-xs-12 + .creator Created by #{link_to_member(@project, @merge_request.author)} #{time_ago_with_tooltip(@merge_request.created_at)} %h4.title diff --git a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml b/app/views/projects/merge_requests/show/_remove_source_branch.html.haml index f8f8b71f21d..491360af1bb 100644 --- a/app/views/projects/merge_requests/show/_remove_source_branch.html.haml +++ b/app/views/projects/merge_requests/show/_remove_source_branch.html.haml @@ -1,7 +1,7 @@ - if @source_branch.blank? Source branch has been removed -- elsif @allowed_to_remove_source_branch && @merge_request.merged? +- elsif can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && @merge_request.merged? .remove_source_branch_widget %p Changes merged into #{@merge_request.target_branch}. You can remove source branch now = link_to project_branch_path(@merge_request.source_project, @source_branch), remote: true, method: :delete, class: "btn btn-primary btn-small remove_source_branch" do diff --git a/app/views/projects/merge_requests/show/_state_widget.html.haml b/app/views/projects/merge_requests/show/_state_widget.html.haml index 80fe540489b..c30310f1258 100644 --- a/app/views/projects/merge_requests/show/_state_widget.html.haml +++ b/app/views/projects/merge_requests/show/_state_widget.html.haml @@ -1,5 +1,5 @@ .panel.mr-state-widget.panel-default - - if @merge_request.source_project.gitlab_ci? && @commits.any? + - if @merge_request.source_project.ci_service && @commits.any? .panel-heading = render "projects/merge_requests/show/mr_ci" .panel-body @@ -37,5 +37,5 @@ %i.icon-ok Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} = succeed '.' do - != gfm(@closes_issues.map { |i| "##{i.iid}" }.to_sentence) + != gfm(issues_sentence(@closes_issues)) diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml index d770bb5b371..979c27daa2b 100644 --- a/app/views/projects/milestones/_form.html.haml +++ b/app/views/projects/milestones/_form.html.haml @@ -21,8 +21,12 @@ .form-group = f.label :description, "Description", class: "control-label" .col-sm-10 - = f.text_area :description, maxlength: 2000, class: "form-control", rows: 10 - %p.hint Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + = f.text_area :description, maxlength: 2000, class: "form-control markdown-area", rows: 10 + .hint + .pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. + .pull-left Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. + .clearfix + .error-alert .col-md-6 .form-group = f.label :due_date, "Due Date", class: "control-label" @@ -45,3 +49,5 @@ dateFormat: "yy-mm-dd", onSelect: function(dateText, inst) { $("#milestone_due_date").val(dateText) } }).datepicker("setDate", $.datepicker.parseDate('yy-mm-dd', $('#milestone_due_date').val())); + + window.project_image_path_upload = "#{upload_image_project_path @project}"; diff --git a/app/views/projects/milestones/_issue.html.haml b/app/views/projects/milestones/_issue.html.haml new file mode 100644 index 00000000000..08ccd0cdc8a --- /dev/null +++ b/app/views/projects/milestones/_issue.html.haml @@ -0,0 +1,9 @@ +%li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid, 'data-url' => project_issue_path(@project, issue) } + %span.str-truncated + = link_to [@project, issue] do + %span.cgray ##{issue.iid} + = link_to_gfm issue.title, [@project, issue] + .pull-right.assignee-icon + - if issue.assignee + = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16" + diff --git a/app/views/projects/milestones/_issues.html.haml b/app/views/projects/milestones/_issues.html.haml index c277dcc5364..6e4df75a3df 100644 --- a/app/views/projects/milestones/_issues.html.haml +++ b/app/views/projects/milestones/_issues.html.haml @@ -1,11 +1,6 @@ -.ui-box - .title= title - %ul.well-list - - issues.each do |issue| - %li - = link_to [@project, issue] do - %span.label{class: issue.closed? ? 'label-danger' : 'label-info'} ##{issue.iid} - = link_to_gfm truncate(issue.title, length: 40), [@project, issue] - - if issue.assignee - .pull-right - = image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16" +.panel.panel-default + .panel-heading= title + %ul{ class: "well-list issues-sortable-list", id: "issues-list-#{id}", "data-state" => id } + - issues.sort_by(&:position).each do |issue| + = render 'issue', issue: issue + %li.light.ui-sort-disabled Drag and drop available diff --git a/app/views/projects/milestones/_merge_request.html.haml b/app/views/projects/milestones/_merge_request.html.haml index faa35a25f2f..d630c4518dd 100644 --- a/app/views/projects/milestones/_merge_request.html.haml +++ b/app/views/projects/milestones/_merge_request.html.haml @@ -1,5 +1,5 @@ -%li - = link_to [@project, merge_request] do - %span.label.label-info ##{merge_request.iid} - – - = link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request] +%li{ id: dom_id(merge_request, 'sortable'), class: 'mr-row', 'data-iid' => merge_request.iid, 'data-url' => project_merge_request_path(@project, merge_request) } + %span.str-truncated + = link_to [@project, merge_request] do + %span.cgray ##{merge_request.iid} + = link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request] diff --git a/app/views/projects/milestones/_merge_requests.html.haml b/app/views/projects/milestones/_merge_requests.html.haml new file mode 100644 index 00000000000..00889a5eb24 --- /dev/null +++ b/app/views/projects/milestones/_merge_requests.html.haml @@ -0,0 +1,6 @@ +.panel.panel-default + .panel-heading= title + %ul{ class: "well-list merge_requests-sortable-list", id: "merge_requests-list-#{id}", "data-state" => id } + - merge_requests.sort_by(&:position).each do |merge_request| + = render 'merge_request', merge_request: merge_request + %li.light.ui-sort-disabled Drag and drop available diff --git a/app/views/projects/milestones/index.html.haml b/app/views/projects/milestones/index.html.haml index 3537650ad43..f0e48a51777 100644 --- a/app/views/projects/milestones/index.html.haml +++ b/app/views/projects/milestones/index.html.haml @@ -8,7 +8,9 @@ New Milestone .row - .col-md-3.hidden-sm + .fixed.sidebar-expand-button.hidden-lg.hidden-md.hidden-xs + %i.icon-list.icon-2x + .col-md-3.responsive-side %ul.nav.nav-pills.nav-stacked %li{class: ("active" if (params[:f] == "active" || !params[:f]))} = link_to project_milestones_path(@project, f: "active") do @@ -20,7 +22,7 @@ = link_to project_milestones_path(@project, f: "all") do All .col-md-9 - .ui-box + .panel.panel-default %ul.well-list = render @milestones diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 0fe5ac25b5e..5cf7f332118 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -22,19 +22,25 @@ .issue-box{ class: issue_box_class(@milestone) } .state.clearfix - .state-label.col-sm-2.col-xs-12 + .state-label - if @milestone.closed? Closed - elsif @milestone.expired? Expired - else Open - %span.creator.col-sm-9.col-xs-12 + .creator = @milestone.expires_at %h4.title = gfm escape_once(@milestone.title) + - if @milestone.description.present? + .description + .wiki + = preserve do + = markdown @milestone.description + .context %p Progress: @@ -45,11 +51,6 @@ .progress.progress-info .progress-bar{style: "width: #{@milestone.percent_complete}%;"} - - if @milestone.description.present? - .description - .wiki - = preserve do - = markdown @milestone.description %ul.nav.nav-tabs %li.active @@ -75,25 +76,25 @@ .tab-pane.active#tab-issues .row .col-md-4 - = render('issues', title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned) + = render('issues', title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned, id: 'unassigned') .col-md-4 - = render('issues', title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned) + = render('issues', title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned, id: 'ongoing') .col-md-4 - = render('issues', title: 'Completed Issues (closed)', issues: @issues.closed) + = render('issues', title: 'Completed Issues (closed)', issues: @issues.closed, id: 'closed') .tab-pane#tab-merge-requests .row - .col-md-6 - .ui-box - .title Open - %ul.well-list - - @merge_requests.opened.each do |merge_request| - = render 'merge_request', merge_request: merge_request - .col-md-6 - .ui-box - .title Closed + .col-md-3 + = render('merge_requests', title: 'Work in progress (open and unassigned)', merge_requests: @merge_requests.opened.unassigned, id: 'unassigned') + .col-md-3 + = render('merge_requests', title: 'Waiting for merge (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing') + .col-md-3 + = render('merge_requests', title: 'Declined (closed)', merge_requests: @merge_requests.declined, id: 'closed') + .col-md-3 + .panel.panel-primary + .panel-heading Merged %ul.well-list - - @merge_requests.closed.each do |merge_request| + - @merge_requests.merged.each do |merge_request| = render 'merge_request', merge_request: merge_request .tab-pane#tab-participants diff --git a/app/views/projects/network/_head.html.haml b/app/views/projects/network/_head.html.haml index d61ff789b65..415c98ec6a6 100644 --- a/app/views/projects/network/_head.html.haml +++ b/app/views/projects/network/_head.html.haml @@ -1,15 +1,3 @@ -.row.append-bottom-20 - .col-md-2.append-bottom-10 - = render partial: 'shared/ref_switcher', locals: {destination: 'graph'} - .col-md-10 - = form_tag project_network_path(@project, @id), method: :get, class: 'form-inline network-form' do |f| - = label_tag :extended_sha1 , "Looking for", class: 'light inline-label' - = text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: "search-input form-control input-mx-250" - = button_tag type: 'submit', class: 'btn btn-success' do - %i.icon-search - - .inline.prepend-left-20 - .checkbox.light - = label_tag :filter_ref do - = check_box_tag :filter_ref, 1, @options[:filter_ref] - %span Begin with the selected commit +.append-bottom-20 + = render partial: 'shared/ref_switcher', locals: {destination: 'graph'} + .pull-right.visible-lg.light You can move around the graph by using the arrow keys. diff --git a/app/views/projects/network/show.html.haml b/app/views/projects/network/show.html.haml index da0cfa84c2d..5310822823d 100644 --- a/app/views/projects/network/show.html.haml +++ b/app/views/projects/network/show.html.haml @@ -1,9 +1,18 @@ = render "head" .project-network - .tip - You can move around the graph by using the arrow keys. + .controls + = form_tag project_network_path(@project, @id), method: :get, class: 'form-inline network-form' do |f| + = text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: "search-input form-control input-mx-250" + = button_tag type: 'submit', class: 'btn btn-success' do + %i.icon-search + .inline.prepend-left-20 + .checkbox.light + = label_tag :filter_ref do + = check_box_tag :filter_ref, 1, @options[:filter_ref] + %span Begin with the selected commit + .network-graph - = spinner + = spinner nil, true :javascript new Network({ diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 3db551e993b..b62aada3a9a 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -5,26 +5,28 @@ = f.hidden_field :noteable_id = f.hidden_field :noteable_type - .note_text_and_preview.js-toggler-container - %a.btn.js-note-preview-button.js-toggler-target.turn-off{ href: "javascript:;", data: {url: preview_project_notes_path(@project)} } - %i.icon-eye-open - Preview - %a.btn.btn-primary.js-note-edit-button.js-toggler-target.turn-off{ href: "javascript:;" } - %i.icon-edit - Write + %ul.nav.nav-tabs + %li.active + = link_to '#note-write-holder', class: 'js-note-write-button' do + Write + %li + = link_to '#note-preview-holder', class: 'js-note-preview-button', data: { url: preview_project_notes_path(@project) } do + Preview + %div + .note-write-holder + = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input markdown-area' - = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input turn-on' - .note_preview.js-note-preview.turn-off + .light.clearfix + .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'} + .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. - .hint - .pull-right Comments are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. - .clearfix + .note-preview-holder.hide + .js-note-preview .note-form-actions .buttons = f.submit 'Add Comment', class: "btn comment-btn btn-grouped js-comment-button" = yield(:note_actions) - %a.btn.grouped.js-close-discussion-note-form Cancel .note-form-option @@ -35,4 +37,5 @@ %span.file_name.js-attachment-filename File name... = f.file_field :attachment, class: "js-note-attachment-input hidden" - .clearfix +:javascript + window.project_image_path_upload = "#{upload_image_project_path @project}"; diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml index 4a6e8943a9f..a51a4cc224a 100644 --- a/app/views/projects/protected_branches/index.html.haml +++ b/app/views/projects/protected_branches/index.html.haml @@ -1,52 +1,50 @@ -= render "projects/commits/head" -.row - .col-md-3 - = render "projects/branches/filter" - .col-md-9 - .bs-callout.bs-callout-info - %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. - %p This ability allows: - %ul - %li keep stable branches secured - %li forced code review before merge to protected branches - %li prevents branch from force push - %p Read more about project permissions #{link_to "here", help_permissions_path, class: "underlined-link"} +%h3.page-title Protected branches +%p.light This ability allows to keep stable branches secured and force code review before merge to protected branches +%hr - - if can? current_user, :admin_project, @project - = form_for [@project, @protected_branch], html: { class: 'form-horizontal' } do |f| - -if @protected_branch.errors.any? - .alert.alert-danger - %ul - - @protected_branch.errors.full_messages.each do |msg| - %li= msg +.bs-callout.bs-callout-info + %p Protected branches designed to + %ul + %li prevent push for all except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"}. + %li prevent branch from force push + %li prevent branch from removal + %p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "underlined-link"} - .form-group - = f.label :name, "Branch", class: 'control-label' - .col-sm-10 - = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2"}) - .form-actions - = f.submit 'Protect', class: "btn-create btn" - - unless @branches.empty? - %h5 Already Protected: - %ul.bordered-list.protected-branches-list - - @branches.each do |branch| - %li - %h4 - = link_to project_commits_path(@project, branch.name) do - %strong= branch.name - - if @project.root_ref?(branch.name) - %span.label.label-info default - %span.label.label-success - %i.icon-lock - .pull-right - - if can? current_user, :admin_project, @project - = link_to 'Unprotect', [@project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-small" +- if can? current_user, :admin_project, @project + = form_for [@project, @protected_branch], html: { class: 'form-horizontal' } do |f| + -if @protected_branch.errors.any? + .alert.alert-danger + %ul + - @protected_branch.errors.full_messages.each do |msg| + %li= msg - - if commit = branch.commit - = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do - = commit.short_id - %span.light - = gfm escape_once(truncate(commit.title, length: 40)) - #{time_ago_with_tooltip(commit.committed_date)} - - else - (branch was removed from repository) + .form-group + = f.label :name, "Branch", class: 'control-label' + .col-sm-10 + = f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2"}) + .form-actions + = f.submit 'Protect', class: "btn-create btn" +- unless @branches.empty? + %h5 Already Protected: + %ul.bordered-list.protected-branches-list + - @branches.each do |branch| + %li + %h4 + = link_to project_commits_path(@project, branch.name) do + %strong= branch.name + - if @project.root_ref?(branch.name) + %span.label.label-info default + %span.label.label-success + %i.icon-lock + .pull-right + - if can? current_user, :admin_project, @project + = link_to 'Unprotect', [@project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-small" + + - if commit = branch.commit + = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do + = commit.short_id + %span.light + = gfm escape_once(truncate(commit.title, length: 40)) + #{time_ago_with_tooltip(commit.committed_date)} + - else + (branch was removed from repository) diff --git a/app/views/projects/refs/logs_tree.js.haml b/app/views/projects/refs/logs_tree.js.haml index e7343e0997f..948a21aa816 100644 --- a/app/views/projects/refs/logs_tree.js.haml +++ b/app/views/projects/refs/logs_tree.js.haml @@ -7,3 +7,13 @@ var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}"); row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}'); row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}'); + +- if @logs.present? + :plain + var current_url = location.href.replace(/\/?$/, '/'); + var log_url = '#{project_tree_url(@project, tree_join(@ref, @path || '/'))}'.replace(/\/?$/, '/'); + if(current_url == log_url) { + // Load 10 more commit log for each file in tree + // if we still on the same page + ajaxGet('#{logs_file_project_ref_path(@project, @ref, @path || '/', offset: (@offset + @limit))}'); + } diff --git a/app/views/projects/repositories/stats.html.haml b/app/views/projects/repositories/stats.html.haml index fd353978572..70db27d6444 100644 --- a/app/views/projects/repositories/stats.html.haml +++ b/app/views/projects/repositories/stats.html.haml @@ -5,7 +5,7 @@ %hr %p %b Total commits: - %span= @stats.commits_count + %span= @repository.commit_count %p %b Total files in #{@repository.root_ref}: %span= @stats.files_count diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml index 70b4537fd37..a5db7969a68 100644 --- a/app/views/projects/services/_form.html.haml +++ b/app/views/projects/services/_form.html.haml @@ -17,6 +17,9 @@ - @service.errors.full_messages.each do |msg| %li= msg + - if @service.help.present? + .bs-callout + = @service.help .form-group = f.label :active, "Active", class: "control-label" diff --git a/app/views/projects/snippets/_blob.html.haml b/app/views/projects/snippets/_blob.html.haml deleted file mode 100644 index af326a1a99a..00000000000 --- a/app/views/projects/snippets/_blob.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -.file-holder - .file-title - %i.icon-file - %strong= @snippet.file_name - %span.options - .btn-group.tree-btn-group.pull-right - - if can?(current_user, :admin_project_snippet, @project) || @snippet.author == current_user - = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-tiny", title: 'Edit Snippet' - = link_to "Raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-tiny", target: "_blank" - = render 'snippets/blob_content' diff --git a/app/views/projects/snippets/edit.html.haml b/app/views/projects/snippets/edit.html.haml index e28b7d4937e..f6a5bf9e4ff 100644 --- a/app/views/projects/snippets/edit.html.haml +++ b/app/views/projects/snippets/edit.html.haml @@ -1 +1,4 @@ -= render "projects/snippets/form", url: project_snippet_path(@project, @snippet) +%h3.page-title + Edit snippet +%hr += render "shared/snippets/form", url: project_snippet_path(@project, @snippet) diff --git a/app/views/projects/snippets/new.html.haml b/app/views/projects/snippets/new.html.haml index 460af34f676..10f684b6316 100644 --- a/app/views/projects/snippets/new.html.haml +++ b/app/views/projects/snippets/new.html.haml @@ -1 +1,4 @@ -= render "projects/snippets/form", url: project_snippets_path(@project, @snippet) +%h3.page-title + New snippet +%hr += render "shared/snippets/form", url: project_snippets_path(@project, @snippet) diff --git a/app/views/projects/snippets/show.html.haml b/app/views/projects/snippets/show.html.haml index ac32f4866b6..e4fdbd868c3 100644 --- a/app/views/projects/snippets/show.html.haml +++ b/app/views/projects/snippets/show.html.haml @@ -1,11 +1,37 @@ %h3.page-title = @snippet.title - %small.pull-right + .pull-right + = link_to new_project_snippet_path(@project), class: "btn btn-new", title: "New Snippet" do + Add new snippet + +%hr + +.append-bottom-20 + .pull-right = "##{@snippet.id}" %span.light by - = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16" - = @snippet.author_name -%div= render 'projects/snippets/blob' + = link_to user_path(@snippet.author) do + = image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16" + = @snippet.author_name + + .back-link + = link_to project_snippets_path(@project) do + ← project snippets + +.file-holder + .file-title + %i.icon-file + %span.file_name + = @snippet.file_name + .options + .btn-group + - if can?(current_user, :modify_project_snippet, @snippet) + = link_to "edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small", title: 'Edit Snippet' + = link_to "raw", raw_project_snippet_path(@project, @snippet), class: "btn btn-small", target: "_blank" + - if can?(current_user, :admin_project_snippet, @snippet) + = link_to "remove", project_snippet_path(@project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-small btn-remove", title: 'Delete Snippet' + = render 'shared/snippets/blob' + %div#notes= render "projects/notes/notes_with_form" diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index 6629e47ad38..9ed737b181f 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -5,18 +5,15 @@ %i.icon-tag = tag.name .pull-right - %small.cdark - %i.icon-calendar - #{time_ago_with_tooltip(commit.committed_date)} - %p.prepend-left-20 - = link_to commit.short_id(8), project_commit_path(@project, commit), class: "monospace" - – - = link_to_gfm truncate(commit.title, length: 70), project_commit_path(@project, commit.id), class: "cdark" - - %span.pull-right - if can? current_user, :download_code, @project = render 'projects/repositories/download_archive', ref: tag.name, btn_class: 'btn-grouped btn-group-small' - if can?(current_user, :admin_project, @project) - = link_to project_tag_path(@project, tag.name), class: 'btn btn-small remove-row grouped', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do + = link_to project_tag_path(@project, tag.name), class: 'btn btn-small btn-remove remove-row grouped', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do %i.icon-trash + - if commit + %ul.list-unstyled + = render 'projects/commits/inline_commit', commit: commit, project: @project + - else + %p + Cant find HEAD commit for this tag diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index 08122fb884f..dc3188d43b8 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -1,12 +1,14 @@ = render "projects/commits/head" -- if can? current_user, :push_code, @project - .pull-right - = link_to new_project_tag_path(@project), class: 'btn btn-create new-tag-btn' do - %i.icon-add-sign - New tag +%h3.page-title + Git Tags + - if can? current_user, :push_code, @project + .pull-right + = link_to new_project_tag_path(@project), class: 'btn btn-create new-tag-btn' do + %i.icon-add-sign + New tag -%p +%p.light Tags give the ability to mark specific points in history as being important %hr diff --git a/app/views/projects/team_members/_group_members.html.haml b/app/views/projects/team_members/_group_members.html.haml index eceec6627b9..83c4b6f87d5 100644 --- a/app/views/projects/team_members/_group_members.html.haml +++ b/app/views/projects/team_members/_group_members.html.haml @@ -1,6 +1,6 @@ - group_users_count = @group.users_groups.count -.ui-box - .title +.panel.panel-default + .panel-heading %strong #{@group.name} group members (#{group_users_count}) .pull-right diff --git a/app/views/projects/team_members/_team.html.haml b/app/views/projects/team_members/_team.html.haml index 2daf6847665..0e5b8176132 100644 --- a/app/views/projects/team_members/_team.html.haml +++ b/app/views/projects/team_members/_team.html.haml @@ -1,7 +1,7 @@ .team-table - can_admin_project = (can? current_user, :admin_project, @project) - .ui-box - .title + .panel.panel-default + .panel-heading %strong #{@project.name} project members (#{members.count}) %ul.well-list diff --git a/app/views/projects/team_members/index.html.haml b/app/views/projects/team_members/index.html.haml index 6eccaafe3de..ddb3b9d4a9d 100644 --- a/app/views/projects/team_members/index.html.haml +++ b/app/views/projects/team_members/index.html.haml @@ -10,7 +10,7 @@ %p.light Read more about project permissions - %strong= link_to "here", help_permissions_path, class: "vlink" + %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink" = render "team", members: @users_projects - if @group = render "group_members" diff --git a/app/views/projects/tree/_blob_item.html.haml b/app/views/projects/tree/_blob_item.html.haml index 6fee604b554..0971a426527 100644 --- a/app/views/projects/tree/_blob_item.html.haml +++ b/app/views/projects/tree/_blob_item.html.haml @@ -5,4 +5,4 @@ = link_to blob_item.name, project_blob_path(@project, tree_join(@id || @commit.id, blob_item.name)) %td.tree_time_ago.cgray = render 'spinner' - %td.tree_commit{ colspan: 2 } + %td.hidden-xs.tree_commit{ colspan: 2 } diff --git a/app/views/projects/tree/_submodule_item.html.haml b/app/views/projects/tree/_submodule_item.html.haml index ae87dbde67a..474604df654 100644 --- a/app/views/projects/tree/_submodule_item.html.haml +++ b/app/views/projects/tree/_submodule_item.html.haml @@ -1,7 +1,7 @@ - tree, commit = submodule_links(submodule_item) %tr{ class: "tree-item" } %td.tree-item-file-name - = image_tag "submodule.png" + %i.icon-archive %span = link_to truncate(submodule_item.name, length: 40), tree @ @@ -11,5 +11,4 @@ - else = link_to "#{submodule_item.id[0..10]}", commit %td - %td - %td + %td.hidden-xs diff --git a/app/views/projects/tree/_tree.html.haml b/app/views/projects/tree/_tree.html.haml index ee850e2bc1b..84c3682d7ab 100644 --- a/app/views/projects/tree/_tree.html.haml +++ b/app/views/projects/tree/_tree.html.haml @@ -1,6 +1,5 @@ -%ul.breadcrumb +%ul.breadcrumb.repo-breadcrumb %li - %i.icon-angle-right = link_to project_tree_path(@project, @ref) do = @project.path - tree_breadcrumbs(tree, 6) do |title, path| @@ -9,11 +8,11 @@ = link_to truncate(title, length: 40), project_tree_path(@project, path) - else = link_to title, '#' - - if current_user && @repository.branch_names.include?(@ref) && current_user.can?(:push_code, @project) + - if current_user && can_push_branch?(@project, @ref) %li = link_to project_new_tree_path(@project, @id), title: 'New file', id: 'new-file-link' do %small - %i.icon-plus.light + %i.icon-plus %div#tree-content-holder.tree-content-holder %table#tree-slider{class: "table_#{@hex_path} tree-table" } @@ -21,9 +20,9 @@ %tr %th Name %th Last Update - %th.hidden-sm - Last Commit - %span.last-commit + %th.hidden-xs + .pull-left Last Commit + .last-commit.hidden-sm.pull-left %i.icon-angle-right @@ -31,16 +30,14 @@ = link_to @commit.short_id, project_commit_path(@project, @commit) – = truncate(@commit.title, length: 50) - %th= link_to "history", project_commits_path(@project, @id), class: "pull-right" + = link_to "history", project_commits_path(@project, @id), class: "pull-right" - if @path.present? %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)) - %td - %td + = link_to "..", project_tree_path(@project, up_dir_path(tree)), class: 'prepend-left-10' %td + %td.hidden-xs = render_tree(tree) diff --git a/app/views/projects/tree/_tree_item.html.haml b/app/views/projects/tree/_tree_item.html.haml index 1b3900bcbae..760e95e84f0 100644 --- a/app/views/projects/tree/_tree_item.html.haml +++ b/app/views/projects/tree/_tree_item.html.haml @@ -5,4 +5,4 @@ = link_to tree_item.name, project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name)) %td.tree_time_ago.cgray = render 'spinner' - %td.tree_commit{ colspan: 2 } + %td.hidden-xs.tree_commit{ colspan: 2 } diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 6b33493b7d2..fc4616da6ec 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -1,6 +1,9 @@ -%div.tree-ref-holder +.tree-ref-holder = render 'shared/ref_switcher', destination: 'tree', path: @path + - if can? current_user, :download_code, @project - = render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-small tree-ref-holder pull-right', split_button: true -%div#tree-holder.tree-holder + .tree-download-holder + = render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-small pull-right hidden-xs hidden-sm', split_button: true + +#tree-holder.tree-holder.clearfix = render "tree", tree: @tree diff --git a/app/views/projects/walls/show.html.haml b/app/views/projects/walls/show.html.haml deleted file mode 100644 index 3e3c7c4f8dd..00000000000 --- a/app/views/projects/walls/show.html.haml +++ /dev/null @@ -1,23 +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" }, authenticity_token: true 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 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 hidden" - - .hint.pull-right CTRL + Enter to send message - .clearfix diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml index 0c2e33f2282..0a24e36ae84 100644 --- a/app/views/projects/wikis/_form.html.haml +++ b/app/views/projects/wikis/_form.html.haml @@ -15,7 +15,6 @@ .col-sm-2 .col-sm-10 %p.cgray - Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. To link to a (new) page you can just type %code [Link Title](page-slug) \. @@ -23,8 +22,12 @@ .form-group = f.label :content, class: 'control-label' .col-sm-10 - = f.text_area :content, class: 'form-control js-gfm-input', rows: 18 - + = f.text_area :content, class: 'form-control js-gfm-input markdown-area', rows: 18 + .col-sm-12.hint + .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'} + .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. + .clearfix + .error-alert .form-group = f.label :commit_message, class: 'control-label' .col-sm-10= f.text_field :message, class: 'form-control', rows: 18 @@ -36,3 +39,7 @@ - else = f.submit 'Create page', class: "btn-create btn" = link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel" + +:javascript + window.project_image_path_upload = "#{upload_image_project_path @project}"; + diff --git a/app/views/shared/_commit_message_container.html.haml b/app/views/shared/_commit_message_container.html.haml index cca7a0efc9b..4365947e701 100644 --- a/app/views/shared/_commit_message_container.html.haml +++ b/app/views/shared/_commit_message_container.html.haml @@ -1,5 +1,3 @@ .commit-message-container .max-width-marker - -# When the `ch` CSS length unit becomes widely supported `http://www.quirksmode.org/css/units-values` remove this workaround. - = 'a' * 72 = textarea diff --git a/app/views/shared/_file_hljs.html.haml b/app/views/shared/_file_hljs.html.haml index 338236c0752..ceee2c7527d 100644 --- a/app/views/shared/_file_hljs.html.haml +++ b/app/views/shared/_file_hljs.html.haml @@ -8,5 +8,5 @@ = i .highlight %pre - %code + %code{ class: highlightjs_class(blob.name) } = blob.data diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml index 0becf531cc3..19ecc458e29 100644 --- a/app/views/shared/_filter.html.haml +++ b/app/views/shared/_filter.html.haml @@ -1,4 +1,4 @@ -.side-filters.hidden-xs.hidden-sm +.side-filters = form_tag filter_path(entity), method: 'get' do - if current_user %fieldset.scope-filter diff --git a/app/views/shared/_issues.html.haml b/app/views/shared/_issues.html.haml index 087b6632e8d..e976f897dc9 100644 --- a/app/views/shared/_issues.html.haml +++ b/app/views/shared/_issues.html.haml @@ -1,8 +1,8 @@ - if @issues.any? - @issues.group_by(&:project).each do |group| - .ui-box.ui-box-small + .panel.panel-default.panel-small - project = group[0] - .title + .panel-heading = link_to_project project = link_to 'show all', project_issues_path(project), class: 'pull-right' diff --git a/app/views/shared/_merge_requests.html.haml b/app/views/shared/_merge_requests.html.haml index f40b7be4864..39a1ee38f8e 100644 --- a/app/views/shared/_merge_requests.html.haml +++ b/app/views/shared/_merge_requests.html.haml @@ -1,8 +1,8 @@ - if @merge_requests.any? - @merge_requests.group_by(&:target_project).each do |group| - .ui-box.ui-box-small + .panel.panel-default.panel-small - project = group[0] - .title + .panel-heading = link_to_project project = link_to 'show all', project_merge_requests_path(project), class: 'pull-right' %ul.well-list.mr-list diff --git a/app/views/shared/_project_filter.html.haml b/app/views/shared/_project_filter.html.haml index 7936a038be3..743b4fba542 100644 --- a/app/views/shared/_project_filter.html.haml +++ b/app/views/shared/_project_filter.html.haml @@ -1,4 +1,4 @@ -.side-filters.hidden-xs.hidden-sm +.side-filters = form_tag project_entities_path, method: 'get' do - if current_user %fieldset diff --git a/app/views/snippets/_blob_content.html.haml b/app/views/shared/snippets/_blob.html.haml index 8cec6168ab8..8cec6168ab8 100644 --- a/app/views/snippets/_blob_content.html.haml +++ b/app/views/shared/snippets/_blob.html.haml diff --git a/app/views/projects/snippets/_form.html.haml b/app/views/shared/snippets/_form.html.haml index 866346990d3..49ea8460e7d 100644 --- a/app/views/projects/snippets/_form.html.haml +++ b/app/views/shared/snippets/_form.html.haml @@ -1,9 +1,6 @@ -%h3.page-title - = @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}" -%hr .snippet-form-holder - = form_for [@project, @snippet], as: :project_snippet, url: url, html: {class: "form-horizontal snippet-form"} do |f| - -if @snippet.errors.any? + = form_for @snippet, url: url, html: { class: "form-horizontal snippet-form" } do |f| + - if @snippet.errors.any? .alert.alert-danger %ul - @snippet.errors.full_messages.each do |msg| @@ -12,6 +9,23 @@ .form-group = f.label :title, class: 'control-label' .col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true + + - unless @snippet.respond_to?(:project) + .form-group + = f.label "Access", class: 'control-label' + .col-sm-10 + = f.label :private_true, class: 'radio-label' do + = f.radio_button :private, true + %span + %strong Private + (only you can see this snippet) + %br + = f.label :private_false, class: 'radio-label' do + = f.radio_button :private, false + %span + %strong Public + (GitLab users can see this snippet) + .form-group .file-editor = f.label :file_name, "File", class: 'control-label' @@ -29,14 +43,13 @@ - else = f.submit 'Save', class: "btn-save btn" - - unless @snippet.new_record? - .pull-right.prepend-left-20 - = link_to 'Remove snippet', project_snippet_path(@project, @snippet), data: { confirm: 'Are you sure?' }, method: :delete, class: "btn pull-right btn-remove delete-snippet prepend-left-10", id: "destroy_snippet_#{@snippet.id}" - = link_to "Cancel", project_snippets_path(@project), class: "btn btn-cancel" + - if @snippet.respond_to?(:project) + = link_to "Cancel", project_snippets_path(@project), class: "btn btn-cancel" + - else + = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel" :javascript var editor = ace.edit("editor"); $(".snippet-form-holder form").submit(function(){ $(".snippet-file-content").val(editor.getValue()); }); - diff --git a/app/views/snippets/_blob.html.haml b/app/views/snippets/_blob.html.haml deleted file mode 100644 index 15867f071ef..00000000000 --- a/app/views/snippets/_blob.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.file-holder - .file-title - %i.icon-file - %strong= @snippet.file_name - %span.options - .btn-group.tree-btn-group.pull-right - - if @snippet.author == current_user - = link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet' - = link_to "Delete", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet' - = link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank" - = render 'snippets/blob_content' diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml deleted file mode 100644 index d466dc1af14..00000000000 --- a/app/views/snippets/_form.html.haml +++ /dev/null @@ -1,58 +0,0 @@ -%h3.page-title - = @snippet.new_record? ? "New Snippet" : "Edit Snippet ##{@snippet.id}" -%hr -.snippet-form-holder - = form_for @snippet, as: :personal_snippet, url: url, html: { class: "form-horizontal snippet-form" } do |f| - -if @snippet.errors.any? - .alert.alert-danger - %ul - - @snippet.errors.full_messages.each do |msg| - %li= msg - - .form-group - = f.label :title, class: 'control-label' - .col-sm-10= f.text_field :title, placeholder: "Example Snippet", class: 'form-control', required: true - .form-group - = f.label "Access", class: 'control-label' - .col-sm-10 - = f.label :private_true, class: 'radio-label' do - = f.radio_button :private, true - %span - %strong Private - (only you can see this snippet) - %br - = f.label :private_false, class: 'radio-label' do - = f.radio_button :private, false - %span - %strong Public - (GitLab users can see this snippet) - - .form-group - .file-editor - = f.label :file_name, "File", class: 'control-label' - .col-sm-10 - .file-holder.snippet - .file-title - = f.text_field :file_name, placeholder: "example.rb", class: 'form-control snippet-file-name', required: true - .file-content.code - %pre#editor= @snippet.content - = f.hidden_field :content, class: 'snippet-file-content' - - .form-actions - - if @snippet.new_record? - = f.submit 'Create snippet', class: "btn-create btn" - - else - = f.submit 'Save', class: "btn-save btn" - - - unless @snippet.new_record? - .pull-right.prepend-left-20 - = link_to 'Remove', snippet_path(@snippet), data: { confirm: 'Removed snippet cannot be restored! Are you sure?'}, method: :delete, class: "btn btn-remove delete-snippet", id: "destroy_snippet_#{@snippet.id}" - = link_to "Cancel", snippets_path(@project), class: "btn btn-cancel" - - -:javascript - var editor = ace.edit("editor"); - $(".snippet-form-holder form").submit(function(){ - $(".snippet-file-content").val(editor.getValue()); - }); - diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml index 90ddc7198f6..e3edd856983 100644 --- a/app/views/snippets/current_user_index.html.haml +++ b/app/views/snippets/current_user_index.html.haml @@ -18,16 +18,16 @@ All %span.pull-right = @user.snippets.count - = nav_tab :scope, 'private' do - = link_to user_snippets_path(@user, scope: 'private') do + = nav_tab :scope, 'are_private' do + = link_to user_snippets_path(@user, scope: 'are_private') do Private %span.pull-right - = @user.snippets.private.count - = nav_tab :scope, 'public' do - = link_to user_snippets_path(@user, scope: 'public') do + = @user.snippets.are_private.count + = nav_tab :scope, 'are_public' do + = link_to user_snippets_path(@user, scope: 'are_public') do Public %span.pull-right - = @user.snippets.public.count + = @user.snippets.are_public.count .col-md-9.my-snippets = render 'snippets' diff --git a/app/views/snippets/edit.html.haml b/app/views/snippets/edit.html.haml index 1b88a85faf1..7042d07d5e8 100644 --- a/app/views/snippets/edit.html.haml +++ b/app/views/snippets/edit.html.haml @@ -1 +1,4 @@ -= render "snippets/form", url: snippet_path(@snippet) +%h3.page-title + Edit snippet +%hr += render "shared/snippets/form", url: snippet_path(@snippet) diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml index 90e0a1f79da..694d7058317 100644 --- a/app/views/snippets/new.html.haml +++ b/app/views/snippets/new.html.haml @@ -1 +1,4 @@ -= render "snippets/form", url: snippets_path(@snippet) +%h3.page-title + New snippet +%hr += render "shared/snippets/form", url: snippets_path(@snippet) diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml index a680e5eb5b7..1d2e3d5ae4a 100644 --- a/app/views/snippets/show.html.haml +++ b/app/views/snippets/show.html.haml @@ -7,9 +7,9 @@ private .pull-right - = link_to new_snippet_path, class: "btn btn-new btn-small", title: "New Snippet" do + = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do Add new snippet - +%hr .append-bottom-20 .pull-right @@ -28,4 +28,16 @@ = link_to snippets_path do ← discover snippets -%div= render 'blob' +.file-holder + .file-title + %i.icon-file + %span.file_name + = @snippet.file_name + .options + .btn-group + - if can?(current_user, :modify_personal_snippet, @snippet) + = link_to "edit", edit_snippet_path(@snippet), class: "btn btn-small", title: 'Edit Snippet' + = link_to "raw", raw_snippet_path(@snippet), class: "btn btn-small", target: "_blank" + - if can?(current_user, :admin_personal_snippet, @snippet) + = link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-small btn-remove", title: 'Delete Snippet' + = render 'shared/snippets/blob' diff --git a/app/views/users/_profile.html.haml b/app/views/users/_profile.html.haml index 7ffd43e837d..3b44959baad 100644 --- a/app/views/users/_profile.html.haml +++ b/app/views/users/_profile.html.haml @@ -1,5 +1,5 @@ -.ui-box - .title +.panel.panel-default + .panel-heading Profile %ul.well-list %li diff --git a/app/views/users/_projects.html.haml b/app/views/users/_projects.html.haml index a61c6ba5b86..1d38f8e8ab8 100644 --- a/app/views/users/_projects.html.haml +++ b/app/views/users/_projects.html.haml @@ -1,6 +1,6 @@ -.ui-box - .title Projects +.panel.panel-default + .panel-heading Personal projects %ul.well-list - - @projects.each do |project| + - projects.each do |project| %li = link_to_project project diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index edcaf3acf98..60159a29b99 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -13,11 +13,14 @@ %br %small member since #{@user.created_at.stamp("Nov 12, 2031")} .clearfix - %h4 Groups: - = render 'groups', groups: @groups - %hr + + - if @groups.any? + %h4 Groups: + = render 'groups', groups: @groups + %hr %h4 User Activity: = render @events .col-md-4 = render 'profile', user: @user - = render 'projects' + - if @projects.present? + = render 'projects', projects: @projects diff --git a/script/background_jobs b/bin/background_jobs index e0140e9689b..c7ba4398cfb 100755 --- a/script/background_jobs +++ b/bin/background_jobs @@ -18,7 +18,7 @@ function stop function killall { - pkill -u $gitlab_user -f sidekiq + pkill -u $gitlab_user -f 'sidekiq [0-9]' } function restart diff --git a/script/check b/bin/check index c907a98b5d9..c907a98b5d9 100755 --- a/script/check +++ b/bin/check diff --git a/script/upgrade.rb b/bin/upgrade.rb index a5caecf8526..a5caecf8526 100644 --- a/script/upgrade.rb +++ b/bin/upgrade.rb diff --git a/config/application.rb b/config/application.rb index f087d3507bc..540426b6672 100644 --- a/config/application.rb +++ b/config/application.rb @@ -19,8 +19,7 @@ module Gitlab # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Activate observers that should always be running. - config.active_record.observers = :milestone_observer, - :project_activity_cache_observer, + config.active_record.observers = :project_activity_cache_observer, :note_observer, :project_observer, :system_hook_observer, diff --git a/config/environments/production.rb b/config/environments/production.rb index 47f7e17aeb6..2450d5719eb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -74,10 +74,6 @@ Gitlab::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - # config.active_record.auto_explain_threshold_in_seconds = 0.5 - config.action_mailer.delivery_method = :sendmail # Defaults to: # # config.action_mailer.sendmail_settings = { diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 7b53a065533..806984e8d40 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -35,8 +35,7 @@ production: &base # Email address used in the "From" field in mails sent by GitLab email_from: example@example.com - # Email address of your support contact (default: same as email_from) - support_email: support@example.com + # Email server smtp settings are in [a separate file](initializers/smtp_settings.rb.sample). ## User settings default_projects_limit: 10 @@ -74,7 +73,6 @@ production: &base issues: true merge_requests: true wiki: true - wall: false snippets: false visibility_level: "private" # can be "private" | "internal" | "public" @@ -116,8 +114,8 @@ production: &base gravatar: enabled: true # Use user avatar image from Gravatar.com (default: true) # gravatar urls: possible placeholders: %{hash} %{size} %{email} - # 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 + # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon + # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon # # 2. Auth settings diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 97f29546404..f55e69c08f6 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -79,7 +79,6 @@ Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 Settings.gitlab['relative_url_root'] ||= ENV['RAILS_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_home'] ||= begin @@ -96,7 +95,6 @@ Settings.gitlab['default_projects_features'] ||= {} Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil? Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil? Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil? -Settings.gitlab.default_projects_features['wall'] = false if Settings.gitlab.default_projects_features['wall'].nil? Settings.gitlab.default_projects_features['snippets'] = false if Settings.gitlab.default_projects_features['snippets'].nil? Settings.gitlab.default_projects_features['visibility_level'] = Settings.send(:verify_constant, Gitlab::VisibilityLevel, Settings.gitlab.default_projects_features['visibility_level'], Gitlab::VisibilityLevel::PRIVATE) Settings.gitlab['repository_downloads_path'] = File.absolute_path(Settings.gitlab['repository_downloads_path'] || 'tmp/repositories', Rails.root) @@ -106,8 +104,8 @@ Settings.gitlab['repository_downloads_path'] = File.absolute_path(Settings.gitla # 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' +Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon' +Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon' # # GitLab Shell diff --git a/config/initializers/acts_as_taggable_on_patch.rb b/config/initializers/acts_as_taggable_on_patch.rb new file mode 100644 index 00000000000..baa77fde392 --- /dev/null +++ b/config/initializers/acts_as_taggable_on_patch.rb @@ -0,0 +1,130 @@ +# This is a patch to address the issue in https://github.com/mbleigh/acts-as-taggable-on/issues/427 caused by +# https://github.com/rails/rails/commit/31a43ebc107fbd50e7e62567e5208a05909ec76c +# gem 'acts-as-taggable-on' has the fix included https://github.com/mbleigh/acts-as-taggable-on/commit/89bbed3864a9252276fb8dd7d535fce280454b90 +# but not in the currently used version of gem ('2.4.1') +# With replacement of 'acts-as-taggable-on' gem this file will become obsolete + +module ActsAsTaggableOn::Taggable + module Core + module ClassMethods + def tagged_with(tags, options = {}) + tag_list = ActsAsTaggableOn::TagList.from(tags) + empty_result = where("1 = 0") + + return empty_result if tag_list.empty? + + joins = [] + conditions = [] + having = [] + select_clause = [] + + context = options.delete(:on) + owned_by = options.delete(:owned_by) + alias_base_name = undecorated_table_name.gsub('.','_') + quote = ActsAsTaggableOn::Tag.using_postgresql? ? '"' : '' + + if options.delete(:exclude) + if options.delete(:wild) + tags_conditions = tag_list.map { |t| sanitize_sql(["#{ActsAsTaggableOn::Tag.table_name}.name #{like_operator} ? ESCAPE '!'", "%#{escape_like(t)}%"]) }.join(" OR ") + else + tags_conditions = tag_list.map { |t| sanitize_sql(["#{ActsAsTaggableOn::Tag.table_name}.name #{like_operator} ?", t]) }.join(" OR ") + end + + conditions << "#{table_name}.#{primary_key} NOT IN (SELECT #{ActsAsTaggableOn::Tagging.table_name}.taggable_id FROM #{ActsAsTaggableOn::Tagging.table_name} JOIN #{ActsAsTaggableOn::Tag.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.#{ActsAsTaggableOn::Tag.primary_key} AND (#{tags_conditions}) WHERE #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name, nil)})" + + if owned_by + joins << "JOIN #{ActsAsTaggableOn::Tagging.table_name}" + + " ON #{ActsAsTaggableOn::Tagging.table_name}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" + + " AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name, nil)}" + + " AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_id = #{owned_by.id}" + + " AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_type = #{quote_value(owned_by.class.base_class.to_s, nil)}" + end + + elsif options.delete(:any) + # get tags, drop out if nothing returned (we need at least one) + tags = if options.delete(:wild) + ActsAsTaggableOn::Tag.named_like_any(tag_list) + else + ActsAsTaggableOn::Tag.named_any(tag_list) + end + + return empty_result unless tags.length > 0 + + # setup taggings alias so we can chain, ex: items_locations_taggings_awesome_cool_123 + # avoid ambiguous column name + taggings_context = context ? "_#{context}" : '' + + taggings_alias = adjust_taggings_alias( + "#{alias_base_name[0..4]}#{taggings_context[0..6]}_taggings_#{sha_prefix(tags.map(&:name).join('_'))}" + ) + + tagging_join = "JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" + + " ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" + + " AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name, nil)}" + tagging_join << " AND " + sanitize_sql(["#{taggings_alias}.context = ?", context.to_s]) if context + + # don't need to sanitize sql, map all ids and join with OR logic + conditions << tags.map { |t| "#{taggings_alias}.tag_id = #{t.id}" }.join(" OR ") + select_clause = "DISTINCT #{table_name}.*" unless context and tag_types.one? + + if owned_by + tagging_join << " AND " + + sanitize_sql([ + "#{taggings_alias}.tagger_id = ? AND #{taggings_alias}.tagger_type = ?", + owned_by.id, + owned_by.class.base_class.to_s + ]) + end + + joins << tagging_join + else + tags = ActsAsTaggableOn::Tag.named_any(tag_list) + + return empty_result unless tags.length == tag_list.length + + tags.each do |tag| + taggings_alias = adjust_taggings_alias("#{alias_base_name[0..11]}_taggings_#{sha_prefix(tag.name)}") + tagging_join = "JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" + + " ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" + + " AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name, nil)}" + + " AND #{taggings_alias}.tag_id = #{tag.id}" + + tagging_join << " AND " + sanitize_sql(["#{taggings_alias}.context = ?", context.to_s]) if context + + if owned_by + tagging_join << " AND " + + sanitize_sql([ + "#{taggings_alias}.tagger_id = ? AND #{taggings_alias}.tagger_type = ?", + owned_by.id, + owned_by.class.base_class.to_s + ]) + end + + joins << tagging_join + end + end + + taggings_alias, tags_alias = adjust_taggings_alias("#{alias_base_name}_taggings_group"), "#{alias_base_name}_tags_group" + + if options.delete(:match_all) + joins << "LEFT OUTER JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" + + " ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" + + " AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name, nil)}" + + + group_columns = ActsAsTaggableOn::Tag.using_postgresql? ? grouped_column_names_for(self) : "#{table_name}.#{primary_key}" + group = group_columns + having = "COUNT(#{taggings_alias}.taggable_id) = #{tags.size}" + end + + select(select_clause) \ + .joins(joins.join(" ")) \ + .where(conditions.join(" AND ")) \ + .group(group) \ + .having(having) \ + .order(options[:order]) \ + .readonly(false) + end + end + end +end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index d5cb110e881..50669ece7a8 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -223,7 +223,6 @@ Devise.setup do |config| method: Gitlab.config.ldap['method'], bind_dn: Gitlab.config.ldap['bind_dn'], password: Gitlab.config.ldap['password'], - filter: Gitlab.config.ldap['user_filter'], name_proc: email_stripping_proc end @@ -245,4 +244,4 @@ Devise.setup do |config| config.omniauth provider['name'].to_sym, *provider_arguments end -end
\ No newline at end of file +end diff --git a/config/initializers/state_machine_patch.rb b/config/initializers/state_machine_patch.rb new file mode 100644 index 00000000000..72d010fa5de --- /dev/null +++ b/config/initializers/state_machine_patch.rb @@ -0,0 +1,9 @@ +# This is a patch to address the issue in https://github.com/pluginaweek/state_machine/issues/251 +# where gem 'state_machine' was not working for Rails 4.1 +module StateMachine + module Integrations + module ActiveModel + public :around_validation + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 7641fe43088..746e532a0ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,19 +31,10 @@ Gitlab::Application.routes.draw do # # Help # - get 'help' => 'help#index' - get 'help/api' => 'help#api' - get 'help/api/:category' => 'help#api', as: 'help_api_file' - get 'help/markdown' => 'help#markdown' - get 'help/permissions' => 'help#permissions' - get 'help/public_access' => 'help#public_access' - get 'help/raketasks' => 'help#raketasks' - get 'help/ssh' => 'help#ssh' - get 'help/system_hooks' => 'help#system_hooks' - get 'help/web_hooks' => 'help#web_hooks' - get 'help/workflow' => 'help#workflow' + + get 'help' => 'help#index' + get 'help/:category/:file' => 'help#show', as: :help_page get 'help/shortcuts' - get 'help/security' # # Global snippets @@ -136,8 +127,6 @@ Gitlab::Application.routes.draw do match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ }, via: :get - - # # Dashboard Area # @@ -157,6 +146,7 @@ Gitlab::Application.routes.draw do get :issues get :merge_requests get :members + get :projects end resources :users_groups, only: [:create, :update, :destroy] @@ -178,6 +168,7 @@ Gitlab::Application.routes.draw do post :fork post :archive post :unarchive + post :upload_image get :autocomplete_sources get :import put :retry_import @@ -218,12 +209,6 @@ Gitlab::Application.routes.draw do end end - resource :wall, only: [:show], constraints: {id: /\d+/} do - member do - get 'notes' - end - end - resource :repository, only: [:show] do member do get "stats" @@ -244,12 +229,7 @@ Gitlab::Application.routes.draw do end end - resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } do - collection do - get :recent, constraints: { id: Gitlab::Regex.git_reference_regex } - end - end - + resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } resources :tags, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } resources :protected_branches, only: [:index, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex } @@ -292,7 +272,12 @@ Gitlab::Application.routes.draw do end resources :team, controller: 'team_members', only: [:index] - resources :milestones, except: [:destroy], constraints: {id: /\d+/} + resources :milestones, except: [:destroy], constraints: {id: /\d+/} do + member do + put :sort_issues + put :sort_merge_requests + end + end resources :labels, only: [:index] do collection do @@ -329,7 +314,7 @@ Gitlab::Application.routes.draw do end end - get ':id' => "groups#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} + get ':id' => "namespaces#show", constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} root to: "dashboard#show" end diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index f6c0f09b51d..e88a4522338 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -34,6 +34,20 @@ listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64 listen "127.0.0.1:8080", :tcp_nopush => true # nuke workers after 30 seconds instead of 60 seconds (the default) +# +# NOTICE: git push over http depends on this value. +# If you want be able to push huge amount of data to git repository over http +# you will have to increase this value too. +# +# Example of output if you try to push 1GB repo to GitLab over http. +# -> git push http://gitlab.... master +# +# error: RPC failed; result=18, HTTP code = 200 +# fatal: The remote end hung up unexpectedly +# fatal: The remote end hung up unexpectedly +# +# For more information see http://stackoverflow.com/a/21682112/752049 +# timeout 30 # feel free to point this anywhere accessible on the filesystem diff --git a/db/fixtures/development/07_milestones.rb b/db/fixtures/development/07_milestones.rb index 72e6b3ad3d6..6fe7e246770 100644 --- a/db/fixtures/development/07_milestones.rb +++ b/db/fixtures/development/07_milestones.rb @@ -1,5 +1,3 @@ -ActiveRecord::Base.observers.disable(:milestone_observer) - Milestone.seed(:id, [ { id: 1, project_id: 1, title: 'v' + Faker::Address.zip_code }, { id: 2, project_id: 1, title: 'v' + Faker::Address.zip_code }, @@ -18,5 +16,3 @@ Milestone.all.map do |ml| ml.set_iid ml.save end - -ActiveRecord::Base.observers.enable(:milestone_observer) diff --git a/db/fixtures/development/12_snippets.rb b/db/fixtures/development/12_snippets.rb index dced2706264..ff91e8430a4 100644 --- a/db/fixtures/development/12_snippets.rb +++ b/db/fixtures/development/12_snippets.rb @@ -1,8 +1,8 @@ Gitlab::Seeder.quiet do contents = [ - `curl https://gist.github.com/randx/4275756/raw/da2f262920c96d1a970d48bf2e99147954b1f4bd/glus1204.sh`, - `curl https://gist.github.com/randx/3754594/raw/11026a295e6ef3a151c635707a3e1e8e15fc4725/gitlab_setup.sh `, - `curl https://gist.github.com/randx/3065552/raw/29fbd09f4605a5ea22a5a9095e35fd1938dea4d6/gistfile1.sh`, + `curl https://gist.githubusercontent.com/randx/4275756/raw/da2f262920c96d1a970d48bf2e99147954b1f4bd/glus1204.sh`, + `curl https://gist.githubusercontent.com/randx/3754594/raw/11026a295e6ef3a151c635707a3e1e8e15fc4725/gitlab_setup.sh`, + `curl https://gist.githubusercontent.com/randx/3065552/raw/29fbd09f4605a5ea22a5a9095e35fd1938dea4d6/gistfile1.sh`, ] (1..50).each do |i| diff --git a/db/migrate/20140611135229_add_position_to_merge_request.rb b/db/migrate/20140611135229_add_position_to_merge_request.rb new file mode 100644 index 00000000000..d5fdecd0c39 --- /dev/null +++ b/db/migrate/20140611135229_add_position_to_merge_request.rb @@ -0,0 +1,5 @@ +class AddPositionToMergeRequest < ActiveRecord::Migration + def change + add_column :merge_requests, :position, :integer, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 93837337afc..345b6fd3b68 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140502125220) do +ActiveRecord::Schema.define(version: 20140611135229) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -121,9 +121,9 @@ ActiveRecord::Schema.define(version: 20140502125220) do add_index "merge_request_diffs", ["merge_request_id"], name: "index_merge_request_diffs_on_merge_request_id", unique: true, using: :btree create_table "merge_requests", force: true do |t| - t.string "target_branch", null: false - t.string "source_branch", null: false - t.integer "source_project_id", null: false + t.string "target_branch", null: false + t.string "source_branch", null: false + t.integer "source_project_id", null: false t.integer "author_id" t.integer "assignee_id" t.string "title" @@ -132,9 +132,10 @@ ActiveRecord::Schema.define(version: 20140502125220) do t.integer "milestone_id" t.string "state" t.string "merge_status" - t.integer "target_project_id", null: false + t.integer "target_project_id", null: false t.integer "iid" t.text "description" + t.integer "position", default: 0 end add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree diff --git a/doc/README.md b/doc/README.md index b73d7bb38e1..f05078ee388 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,24 +1,26 @@ -**User documentation** +# Documentation -+ [API](api/README.md) Explore how you can access GitLab via a simple and powerful API. -+ [Markdown](markdown/markdown.md) Learn what you can do with GitLab's advanced formatting system. -+ [Permissions](permissions/permissions.md) Learn what each role in a project (guest/reporter/developer/master/owner) can do. -+ [Public access](public_access/public_access.md) Learn how you can allow public and internal access to a project. -+ [SSH](ssh/README.md) Setup your ssh keys and deploy keys for secure access to your projects. -+ [Web hooks](web_hooks/web_hooks.md) Let GitLab notify you when new code has been pushed to your project. -+ [Workflow](workflow/README.md) Learn how to use Git and GitLab together. +## User documentation -**Administrator documentation** +- [API](api/README.md) Explore how you can access GitLab via a simple and powerful API. +- [Markdown](markdown/markdown.md) Learn what you can do with GitLab's advanced formatting system. +- [Permissions](permissions/permissions.md) Learn what each role in a project (guest/reporter/developer/master/owner) can do. +- [Public access](public_access/public_access.md) Learn how you can allow public and internal access to a project. +- [SSH](ssh/README.md) Setup your ssh keys and deploy keys for secure access to your projects. +- [Web hooks](web_hooks/web_hooks.md) Let GitLab notify you when new code has been pushed to your project. +- [Workflow](workflow/README.md) Learn how to use Git and GitLab together. -+ [Install](install/README.md) Requirements, directory structures and manual installation. -+ [Integration](integration/README.md) How to integrate with systems such as JIRA, Redmine, LDAP and Twitter. -+ [Raketasks](raketasks/README.md) Explore what GitLab has in store for you to make administration easier. -+ [System hooks](system_hooks/system_hooks.md) Let GitLab notify you when certain management tasks need to be carried out. -+ [Security](security/README.md) Learn what you can do to further secure your GitLab instance. -+ [Update](update/README.md) Update guides to upgrade your installation. +## Administrator documentation -**Contributor documentation** +- [Install](install/README.md) Requirements, directory structures and manual installation. +- [Integration](integration/README.md) How to integrate with systems such as JIRA, Redmine, LDAP and Twitter. +- [Raketasks](raketasks/README.md) Explore what GitLab has in store for you to make administration easier. +- [System hooks](system_hooks/system_hooks.md) Let GitLab notify you when certain management tasks need to be carried out. +- [Security](security/README.md) Learn what you can do to further secure your GitLab instance. +- [Update](update/README.md) Update guides to upgrade your installation. -+ [Development](development/README.md) Explains the architecture and the guidelines for shell commands. -+ [Legal](legal/README.md) Contributor license agreements. -+ [Release](release/README.md) How to make the monthly and security releases. +## Contributor documentation + +- [Development](development/README.md) Explains the architecture and the guidelines for shell commands. +- [Legal](legal/README.md) Contributor license agreements. +- [Release](release/README.md) How to make the monthly and security releases. diff --git a/doc/api/README.md b/doc/api/README.md index acd2f524beb..e91d3af59d7 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -2,31 +2,31 @@ ## Resources -+ [Users](users.md) -+ [Session](session.md) -+ [Projects](projects.md) -+ [Project Snippets](project_snippets.md) -+ [Repositories](repositories.md) -+ [Repository Files](repository_files.md) -+ [Commits](commits.md) -+ [Branches](branches.md) -+ [Merge Requests](merge_requests.md) -+ [Issues](issues.md) -+ [Milestones](milestones.md) -+ [Notes](notes.md) (comments) -+ [Deploy Keys](deploy_keys.md) -+ [System Hooks](system_hooks.md) -+ [Groups](groups.md) +- [Users](users.md) +- [Session](session.md) +- [Projects](projects.md) +- [Project Snippets](project_snippets.md) +- [Repositories](repositories.md) +- [Repository Files](repository_files.md) +- [Commits](commits.md) +- [Branches](branches.md) +- [Merge Requests](merge_requests.md) +- [Issues](issues.md) +- [Milestones](milestones.md) +- [Notes](notes.md) (comments) +- [Deploy Keys](deploy_keys.md) +- [System Hooks](system_hooks.md) +- [Groups](groups.md) ## Clients -+ [php-gitlab-api](https://github.com/m4tthumphrey/php-gitlab-api) - PHP -+ [Laravel API Wrapper for GitLab CE](https://github.com/adamgoose/gitlab) - PHP / [Laravel](http://laravel.com) -+ [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby -+ [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python -+ [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java -+ [node-gitlab](https://github.com/moul/node-gitlab) - Node.js -+ [NGitLab](https://github.com/Scooletz/NGitLab) - .NET +- [php-gitlab-api](https://github.com/m4tthumphrey/php-gitlab-api) - PHP +- [Laravel API Wrapper for GitLab CE](https://github.com/adamgoose/gitlab) - PHP / [Laravel](http://laravel.com) +- [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby +- [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python +- [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java +- [node-gitlab](https://github.com/moul/node-gitlab) - Node.js +- [NGitLab](https://github.com/Scooletz/NGitLab) - .NET ## Introduction @@ -54,41 +54,35 @@ 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. +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. - +- `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 +- `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 ## Sudo + All API requests support performing an api call as if you were another user, if your private token is for an administration account. You need to pass `sudo` parameter by url or header with an id or username of the user you want to perform the operation as. If passed as header, the header name must be "SUDO" (capitals). If a non administrative `private_token` is provided then an error message will be returned with status code 403: @@ -112,16 +106,17 @@ Example of a valid API with sudo request: ``` GET http://example.com/api/v3/projects?private_token=QVy1PB7sTxfy4pqfZM1U&sudo=username ``` + ``` GET http://example.com/api/v3/projects?private_token=QVy1PB7sTxfy4pqfZM1U&sudo=23 ``` - Example for a valid API request with sudo using curl and authentication via header: ``` curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: username" "http://example.com/api/v3/projects" ``` + ``` curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: 23" "http://example.com/api/v3/projects" ``` @@ -130,24 +125,21 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --header "SUDO: 23" "http:// When listing resources you can pass the following parameters: -+ `page` (default: `1`) - page number -+ `per_page` (default: `20`, max: `100`) - number of items to list per page +- `page` (default: `1`) - page number +- `per_page` (default: `20`, max: `100`) - number of items to list per page -[Link headers](http://www.w3.org/wiki/LinkHeader) are send back with each response. -These have `rel` prev/next/first/last and contain the relevant url. -Please use these instead of generating your own urls. +[Link headers](http://www.w3.org/wiki/LinkHeader) are send back with each response. These have `rel` prev/next/first/last and contain the relevant URL. Please use these instead of generating your own urls. ## id vs iid -When you work with API you may notice two similar fields in api entites: id and iid. -The main difference between them is scope. Example: +When you work with API you may notice two similar fields in api entites: id and iid. The main difference between them is scope. Example: + +Issue: -Issue - id: 46 - iid: 5 + id: 46 + iid: 5 -* id - is uniq across all Issues table. It used for any api calls. -* iid - is uniq only in scope of single project. When you browse issues or merge requests with Web UI - you see iid. +- id - is uniq across all Issues table. It used for any api calls. +- iid - is uniq only in scope of single project. When you browse issues or merge requests with Web UI - you see iid. -So if you want to get issue with api you use `http://host/api/v3/.../issues/:id.json` -But when you want to create a link to web page - use `http:://host/project/issues/:iid.json` +So if you want to get issue with api you use `http://host/api/v3/.../issues/:id.json`. But when you want to create a link to web page - use `http:://host/project/issues/:iid.json` diff --git a/doc/api/branches.md b/doc/api/branches.md index da9d4193f20..f695b48fe2f 100644 --- a/doc/api/branches.md +++ b/doc/api/branches.md @@ -10,7 +10,7 @@ GET /projects/:id/repository/branches Parameters: -+ `id` (required) - The ID of a project +- `id` (required) - The ID of a project ```json [ @@ -52,8 +52,8 @@ GET /projects/:id/repository/branches/:branch Parameters: -+ `id` (required) - The ID of a project -+ `branch` (required) - The name of the branch +- `id` (required) - The ID of a project +- `branch` (required) - The name of the branch ```json { @@ -82,7 +82,6 @@ Parameters: } ``` - ## Protect repository branch Protects a single project repository branch. This is an idempotent function, protecting an already @@ -94,8 +93,8 @@ PUT /projects/:id/repository/branches/:branch/protect Parameters: -+ `id` (required) - The ID of a project -+ `branch` (required) - The name of the branch +- `id` (required) - The ID of a project +- `branch` (required) - The name of the branch ```json { @@ -124,7 +123,6 @@ Parameters: } ``` - ## Unprotect repository branch Unprotects a single project repository branch. This is an idempotent function, unprotecting an already @@ -136,8 +134,8 @@ PUT /projects/:id/repository/branches/:branch/unprotect Parameters: -+ `id` (required) - The ID of a project -+ `branch` (required) - The name of the branch +- `id` (required) - The ID of a project +- `branch` (required) - The name of the branch ```json { @@ -168,16 +166,15 @@ Parameters: ## Create repository branch - ``` POST /projects/:id/repository/branches ``` Parameters: -+ `id` (required) - The ID of a project -+ `branch_name` (required) - The name of the branch -+ `ref` (required) - Create branch from commit sha or existing branch +- `id` (required) - The ID of a project +- `branch_name` (required) - The name of the branch +- `ref` (required) - Create branch from commit sha or existing branch ```json { @@ -199,3 +196,17 @@ Parameters: "protected": false } ``` + +## Delete repository branch + + +``` +DELETE /projects/:id/repository/branches/:branch +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `branch` (required) - The name of the branch + +It return 200 if succeed or 405 if failed with error message explaining reason. diff --git a/doc/api/commits.md b/doc/api/commits.md index 241fe0e585a..d55b34c0c1f 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -10,8 +10,8 @@ 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 +- `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 ```json [ @@ -44,8 +44,8 @@ GET /projects/:id/repository/commits/:sha Parameters: -+ `id` (required) - The ID of a project -+ `sha` (required) - The commit hash or name of a repository branch or tag +- `id` (required) - The ID of a project +- `sha` (required) - The commit hash or name of a repository branch or tag ```json { @@ -63,7 +63,6 @@ Parameters: } ``` - ## Get the diff of a commit Get the diff of a commit in a project. @@ -74,8 +73,8 @@ GET /projects/:id/repository/commits/:sha/diff Parameters: -+ `id` (required) - The ID of a project -+ `sha` (required) - The name of a repository branch or tag or if not given the default branch +- `id` (required) - The ID of a project +- `sha` (required) - The name of a repository branch or tag or if not given the default branch ```json [ @@ -91,5 +90,3 @@ Parameters: } ] ``` - - diff --git a/doc/api/deploy_keys.md b/doc/api/deploy_keys.md index d6c0e624dfb..e4492fc609c 100644 --- a/doc/api/deploy_keys.md +++ b/doc/api/deploy_keys.md @@ -1,6 +1,6 @@ -## Deploy Keys +# Deploy Keys -### List deploy keys +## List deploy keys Get a list of a project's deploy keys. @@ -10,7 +10,7 @@ GET /projects/:id/keys Parameters: -+ `id` (required) - The ID of the project +- `id` (required) - The ID of the project ```json [ @@ -29,8 +29,7 @@ Parameters: ] ``` - -### Single deploy key +## Single deploy key Get a single key. @@ -40,8 +39,8 @@ GET /projects/:id/keys/:key_id Parameters: -+ `id` (required) - The ID of the project -+ `key_id` (required) - The ID of the deploy key +- `id` (required) - The ID of the project +- `key_id` (required) - The ID of the deploy key ```json { @@ -52,8 +51,7 @@ Parameters: } ``` - -### Add deploy key +## Add deploy key Creates a new deploy key for a project. If deploy key already exists in another project - it will be joined to project but only if original one was is accessible by same user @@ -64,12 +62,11 @@ POST /projects/:id/keys Parameters: -+ `id` (required) - The ID of the project -+ `title` (required) - New deploy key's title -+ `key` (required) - New deploy key +- `id` (required) - The ID of the project +- `title` (required) - New deploy key's title +- `key` (required) - New deploy key - -### Delete deploy key +## Delete deploy key Delete a deploy key from a project @@ -79,6 +76,5 @@ DELETE /projects/:id/keys/:key_id Parameters: -+ `id` (required) - The ID of the project -+ `key_id` (required) - The ID of the deploy key - +- `id` (required) - The ID of the project +- `key_id` (required) - The ID of the deploy key diff --git a/doc/api/groups.md b/doc/api/groups.md index f5f5d769050..1dbb93f9082 100644 --- a/doc/api/groups.md +++ b/doc/api/groups.md @@ -1,3 +1,5 @@ +# Groups + ## List project groups Get a list of groups. (As user: my groups, as admin: all groups) diff --git a/doc/api/issues.md b/doc/api/issues.md index d18506f9ce6..f775d502a6d 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -1,3 +1,5 @@ +# Issues + ## List issues Get all issues created by authenticated user. This function takes pagination parameters @@ -71,7 +73,6 @@ GET /issues ] ``` - ## List project issues Get a list of project issues. This function accepts pagination parameters `page` and `per_page` @@ -83,8 +84,7 @@ GET /projects/:id/issues Parameters: -+ `id` (required) - The ID of a project - +- `id` (required) - The ID of a project ## Single issue @@ -96,8 +96,8 @@ GET /projects/:id/issues/:issue_id Parameters: -+ `id` (required) - The ID of a project -+ `issue_id` (required) - The ID of a project issue +- `id` (required) - The ID of a project +- `issue_id` (required) - The ID of a project issue ```json { @@ -140,7 +140,6 @@ Parameters: } ``` - ## New issue Creates a new project issue. @@ -151,13 +150,12 @@ POST /projects/:id/issues Parameters: -+ `id` (required) - The ID of a project -+ `title` (required) - The title of an issue -+ `description` (optional) - The description of an issue -+ `assignee_id` (optional) - The ID of a user to assign issue -+ `milestone_id` (optional) - The ID of a milestone to assign issue -+ `labels` (optional) - Comma-separated label names for an issue - +- `id` (required) - The ID of a project +- `title` (required) - The title of an issue +- `description` (optional) - The description of an issue +- `assignee_id` (optional) - The ID of a user to assign issue +- `milestone_id` (optional) - The ID of a milestone to assign issue +- `labels` (optional) - Comma-separated label names for an issue ## Edit issue @@ -169,21 +167,18 @@ PUT /projects/:id/issues/:issue_id Parameters: -+ `id` (required) - The ID of a project -+ `issue_id` (required) - The ID of a project's issue -+ `title` (optional) - The title of an issue -+ `description` (optional) - The description of an issue -+ `assignee_id` (optional) - The ID of a user to assign issue -+ `milestone_id` (optional) - The ID of a milestone to assign issue -+ `labels` (optional) - Comma-separated label names for an issue -+ `state_event` (optional) - The state event of an issue ('close' to close issue and 'reopen' to reopen it) - +- `id` (required) - The ID of a project +- `issue_id` (required) - The ID of a project's issue +- `title` (optional) - The title of an issue +- `description` (optional) - The description of an issue +- `assignee_id` (optional) - The ID of a user to assign issue +- `milestone_id` (optional) - The ID of a milestone to assign issue +- `labels` (optional) - Comma-separated label names for an issue +- `state_event` (optional) - The state event of an issue ('close' to close issue and 'reopen' to reopen it) ## 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. +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 @@ -191,8 +186,8 @@ DELETE /projects/:id/issues/:issue_id Parameters: -+ `id` (required) - The project ID -+ `issue_id` (required) - The ID of the issue +- `id` (required) - The project ID +- `issue_id` (required) - The ID of the issue ## Comments on issues diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index d68f34971f1..27c0d644e11 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -1,10 +1,8 @@ +# Merge requests + ## List merge requests -Get all merge requests for this project. -The `state` parameter can be used to get only merge requests with a -given state (`opened`, `closed`, or `merged`) or all of them (`all`). -The pagination parameters `page` and `per_page` can be used to restrict the -list of merge requests. +Get all merge requests for this project. The `state` parameter can be used to get only merge requests with a given state (`opened`, `closed`, or `merged`) or all of them (`all`). The pagination parameters `page` and `per_page` can be used to restrict the list of merge requests. ``` GET /projects/:id/merge_requests @@ -14,8 +12,8 @@ GET /projects/:id/merge_requests?state=all Parameters: -+ `id` (required) - The ID of a project -+ `state` (optional) - Return `all` requests or just those that are `merged`, `opened` or `closed` +- `id` (required) - The ID of a project +- `state` (optional) - Return `all` requests or just those that are `merged`, `opened` or `closed` ```json [ @@ -49,7 +47,6 @@ Parameters: ] ``` - ## Get single MR Shows information about a single merge request. @@ -60,8 +57,8 @@ GET /projects/:id/merge_request/:merge_request_id Parameters: -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - The ID of MR +- `id` (required) - The ID of a project +- `merge_request_id` (required) - The ID of MR ```json { @@ -93,7 +90,6 @@ Parameters: } ``` - ## Create MR Creates a new merge request. @@ -104,12 +100,12 @@ POST /projects/:id/merge_requests Parameters: -+ `id` (required) - The ID of a project -+ `source_branch` (required) - The source branch -+ `target_branch` (required) - The target branch -+ `assignee_id` (optional) - Assignee user ID -+ `title` (required) - Title of MR -+ `target_project_id` (optional) - The target project (numeric id) +- `id` (required) - The ID of a project +- `source_branch` (required) - The source branch +- `target_branch` (required) - The target branch +- `assignee_id` (optional) - Assignee user ID +- `title` (required) - Title of MR +- `target_project_id` (optional) - The target project (numeric id) ```json { @@ -140,7 +136,6 @@ Parameters: } ``` - ## Update MR Updates an existing merge request. You can change branches, title, or even close the MR. @@ -151,13 +146,13 @@ PUT /projects/:id/merge_request/:merge_request_id Parameters: -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - ID of MR -+ `source_branch` - The source branch -+ `target_branch` - The target branch -+ `assignee_id` - Assignee user ID -+ `title` - Title of MR -+ `state_event` - New state (close|reopen|merge) +- `id` (required) - The ID of a project +- `merge_request_id` (required) - ID of MR +- `source_branch` - The source branch +- `target_branch` - The target branch +- `assignee_id` - Assignee user ID +- `title` - Title of MR +- `state_event` - New state (close|reopen|merge) ```json { @@ -188,13 +183,16 @@ Parameters: } ``` - ## Accept MR Merge changes submitted with MR usign this API. + If merge success you get 200 OK. + If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged' + If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed' + If you dont have permissions to accept this merge request - you get 401 ``` @@ -203,9 +201,9 @@ PUT /projects/:id/merge_request/:merge_request_id/merge Parameters: -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - ID of MR -+ `merge_commit_message` (optional) - Custom merge commit message +- `id` (required) - The ID of a project +- `merge_request_id` (required) - ID of MR +- `merge_commit_message` (optional) - Custom merge commit message ```json { @@ -236,7 +234,6 @@ Parameters: } ``` - ## Post comment to MR Adds a comment to a merge request. @@ -247,10 +244,9 @@ 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 -+ `note` (required) - Text of comment - +- `id` (required) - The ID of a project +- `merge_request_id` (required) - ID of merge request +- `note` (required) - Text of comment ```json { @@ -266,7 +262,6 @@ Parameters: } ``` - ## Get the comments on a MR Gets all the comments associated with a merge request. @@ -277,8 +272,8 @@ GET /projects/:id/merge_request/:merge_request_id/comments Parameters: -+ `id` (required) - The ID of a project -+ `merge_request_id` (required) - ID of merge request +- `id` (required) - The ID of a project +- `merge_request_id` (required) - ID of merge request ```json [ diff --git a/doc/api/milestones.md b/doc/api/milestones.md index 2a2ef4b79b1..2f525327504 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -1,3 +1,5 @@ +# Milestones + ## List project milestones Returns a list of project milestones. @@ -24,8 +26,7 @@ GET /projects/:id/milestones Parameters: -+ `id` (required) - The ID of a project - +- `id` (required) - The ID of a project ## Get single milestone @@ -37,9 +38,8 @@ GET /projects/:id/milestones/:milestone_id Parameters: -+ `id` (required) - The ID of a project -+ `milestone_id` (required) - The ID of a project milestone - +- `id` (required) - The ID of a project +- `milestone_id` (required) - The ID of a project milestone ## Create new milestone @@ -51,11 +51,10 @@ POST /projects/:id/milestones Parameters: -+ `id` (required) - The ID of a project -+ `title` (required) - The title of an milestone -+ `description` (optional) - The description of the milestone -+ `due_date` (optional) - The due date of the milestone - +- `id` (required) - The ID of a project +- `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 @@ -67,10 +66,9 @@ PUT /projects/:id/milestones/:milestone_id Parameters: -+ `id` (required) - The ID of a project -+ `milestone_id` (required) - The ID of a project milestone -+ `title` (optional) - The title of a milestone -+ `description` (optional) - The description of a milestone -+ `due_date` (optional) - The due date of the milestone -+ `state_event` (optional) - The state event of the milestone (close|activate) - +- `id` (required) - The ID of a project +- `milestone_id` (required) - The ID of a project milestone +- `title` (optional) - The title of a milestone +- `description` (optional) - The description of a milestone +- `due_date` (optional) - The due date of the milestone +- `state_event` (optional) - The state event of the milestone (close|activate) diff --git a/doc/api/notes.md b/doc/api/notes.md index e9ad6e00c73..e7f19965a30 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -1,65 +1,6 @@ -Notes can be wall notes or comments on snippets, issues or merge requests. - -## Wall - -### List project wall notes - -Get a list of project wall notes. - -``` -GET /projects/:id/notes -``` - -Parameters: - -+ `id` (required) - The ID of a project - -```json -[ - { - "id": 522, - "body": "The solution is rather tricky", - "attachment": null, - "author": { - "id": 1, - "username": "john_smith", - "email": "john@example.com", - "name": "John Smith", - "state": "active", - "created_at": "2012-05-23T08:00:58Z" - }, - "created_at": "2012-11-27T19:16:44Z" - } -] -``` - -### 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 +# Notes +Notes are comments on snippets, issues or merge requests. ## Issues diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md index e16e1e84596..47c81b6446c 100644 --- a/doc/api/project_snippets.md +++ b/doc/api/project_snippets.md @@ -1,3 +1,5 @@ +# Project snippets + ## List snippets Get a list of project snippets. @@ -8,8 +10,7 @@ GET /projects/:id/snippets Parameters: -+ `id` (required) - The ID of a project - +- `id` (required) - The ID of a project ## Single snippet @@ -21,8 +22,8 @@ GET /projects/:id/snippets/:snippet_id Parameters: -+ `id` (required) - The ID of a project -+ `snippet_id` (required) - The ID of a project's snippet +- `id` (required) - The ID of a project +- `snippet_id` (required) - The ID of a project's snippet ```json { @@ -43,7 +44,6 @@ Parameters: } ``` - ## Create new snippet Creates a new project snippet. The user must have permission to create new snippets. @@ -54,11 +54,10 @@ POST /projects/:id/snippets Parameters: -+ `id` (required) - The ID of a project -+ `title` (required) - The title of a snippet -+ `file_name` (required) - The name of a snippet file -+ `code` (required) - The content of a snippet - +- `id` (required) - The ID of a project +- `title` (required) - The title of a snippet +- `file_name` (required) - The name of a snippet file +- `code` (required) - The content of a snippet ## Update snippet @@ -70,12 +69,11 @@ PUT /projects/:id/snippets/:snippet_id Parameters: -+ `id` (required) - The ID of a project -+ `snippet_id` (required) - The ID of a project's snippet -+ `title` (optional) - The title of a snippet -+ `file_name` (optional) - The name of a snippet file -+ `code` (optional) - The content of a snippet - +- `id` (required) - The ID of a project +- `snippet_id` (required) - The ID of a project's snippet +- `title` (optional) - The title of a snippet +- `file_name` (optional) - The name of a snippet file +- `code` (optional) - The content of a snippet ## Delete snippet @@ -88,9 +86,8 @@ DELETE /projects/:id/snippets/:snippet_id Parameters: -+ `id` (required) - The ID of a project -+ `snippet_id` (required) - The ID of a project's snippet - +- `id` (required) - The ID of a project +- `snippet_id` (required) - The ID of a project's snippet ## Snippet content @@ -102,5 +99,5 @@ 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 +- `id` (required) - The ID of a project +- `snippet_id` (required) - The ID of a project's snippet diff --git a/doc/api/projects.md b/doc/api/projects.md index ffaba0af7fe..d32af678fcc 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1,4 +1,4 @@ -## Projects +# Projects ### List projects @@ -30,7 +30,6 @@ GET /projects "path_with_namespace": "diaspora/diaspora-client", "issues_enabled": true, "merge_requests_enabled": true, - "wall_enabled": false, "wiki_enabled": true, "snippets_enabled": false, "created_at": "2013-09-30T13: 46: 02Z", @@ -66,7 +65,6 @@ GET /projects "path_with_namespace": "brightbox/puppet", "issues_enabled": true, "merge_requests_enabled": true, - "wall_enabled": false, "wiki_enabled": true, "snippets_enabled": false, "created_at": "2013-09-30T13:46:02Z", @@ -136,7 +134,6 @@ Parameters: "path_with_namespace": "diaspora/diaspora-project-site", "issues_enabled": true, "merge_requests_enabled": true, - "wall_enabled": false, "wiki_enabled": true, "snippets_enabled": false, "created_at": "2013-09-30T13: 46: 02Z", @@ -252,7 +249,6 @@ Parameters: + `namespace_id` (optional) - namespace for the new project (defaults to user) + `description` (optional) - short project description + `issues_enabled` (optional) -+ `wall_enabled` (optional) + `merge_requests_enabled` (optional) + `wiki_enabled` (optional) + `snippets_enabled` (optional) @@ -276,7 +272,6 @@ Parameters: + `description` (optional) - short project description + `default_branch` (optional) - 'master' by default + `issues_enabled` (optional) -+ `wall_enabled` (optional) + `merge_requests_enabled` (optional) + `wiki_enabled` (optional) + `snippets_enabled` (optional) diff --git a/doc/api/repositories.md b/doc/api/repositories.md index 858fad0a0b5..26ae3e87232 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -1,3 +1,5 @@ +# Repositories + ## List project repository tags Get a list of repository tags from a project, sorted by name in reverse alphabetical order. @@ -35,6 +37,40 @@ Parameters: ] ``` +## Create a new tag + +Creates new tag in the repository that points to the supplied ref. + +``` +POST /projects/:id/repository/tags +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `tag_name` (required) - The name of a tag ++ `ref` (required) - Create tag using commit sha, another tag name, or branch name. + +```json +[ + { + "name": "v1.0.0", + "commit": { + "id": "2695effb5807a22ff3d138d593fd856244e155e7", + "parents": [], + "message": "Initial commit", + "authored_date": "2012-05-28T04:42:42-07:00", + "author_name": "John Smith", + "author email": "john@example.com", + "committer_name": "Jack Smith", + "committed_date": "2012-05-28T04:42:42-07:00", + "committer_email": "jack@example.com" + }, + "protected": false + } +] +``` + ## List repository tree Get a list of repository files and directories in a project. @@ -131,3 +167,56 @@ GET /projects/:id/repository/archive Parameters: + `id` (required) - The ID of a project + `sha` (optional) - The commit sha to download defaults to the tip of the default branch + + +## Compare branches, tags or commits + +``` +GET /projects/:id/repository/compare +``` + +Parameters: ++ `id` (required) - The ID of a project ++ `from` (required) - the commit sha or branch name ++ `to` (required) - the commit sha or branch name + + +``` +GET /projects/:id/repository/compare?from=master&to=feature +``` + +Response: + +```json + +{ + "commit": { + "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", + "short_id": "12d65c8dd2b", + "title": "JS fix", + "author_name": "Dmitriy Zaporozhets", + "author_email": "dmitriy.zaporozhets@gmail.com", + "created_at": "2014-02-27T10:27:00+02:00" + }, + "commits": [{ + "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", + "short_id": "12d65c8dd2b", + "title": "JS fix", + "author_name": "Dmitriy Zaporozhets", + "author_email": "dmitriy.zaporozhets@gmail.com", + "created_at": "2014-02-27T10:27:00+02:00" + }], + "diffs": [{ + "old_path": "files/js/application.js", + "new_path": "files/js/application.js", + "a_mode": null, + "b_mode": "100644", + "diff": "--- a/files/js/application.js\n+++ b/files/js/application.js\n@@ -24,8 +24,10 @@\n //= require g.raphael-min\n //= require g.bar-min\n //= require branch-graph\n-//= require highlightjs.min\n-//= require ace/ace\n //= require_tree .\n //= require d3\n //= require underscore\n+\n+function fix() { \n+ alert(\"Fixed\")\n+}", + "new_file": false, + "renamed_file": false, + "deleted_file": false + }], + "compare_timeout": false, + "compare_same_ref": false +} +``` diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md index b215cc25001..ae56b04b6ce 100644 --- a/doc/api/repository_files.md +++ b/doc/api/repository_files.md @@ -1,13 +1,14 @@ -# CRUD for repository files +# Repository files + +## CRUD for repository files ## Create, read, update and delete repository files using this API -- - - +--- ## Get file from repository -Allows you to receive information about file in repository like name, size, content. -Note that file content is Base64 encoded. +Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. ``` GET /projects/:id/repository/files @@ -30,8 +31,8 @@ Example response: Parameters: -+ `file_path` (required) - Full path to new file. Ex. lib/class.rb -+ `ref` (required) - The name of branch, tag or commit +- `file_path` (required) - Full path to new file. Ex. lib/class.rb +- `ref` (required) - The name of branch, tag or commit ## Create new file in repository @@ -50,11 +51,11 @@ Example response: Parameters: -+ `file_path` (required) - Full path to new file. Ex. lib/class.rb -+ `branch_name` (required) - The name of branch -+ `encoding` (optional) - 'text' or 'base64'. Text is default. -+ `content` (required) - File content -+ `commit_message` (required) - Commit message +- `file_path` (required) - Full path to new file. Ex. lib/class.rb +- `branch_name` (required) - The name of branch +- `encoding` (optional) - 'text' or 'base64'. Text is default. +- `content` (required) - File content +- `commit_message` (required) - Commit message ## Update existing file in repository @@ -73,11 +74,11 @@ Example response: Parameters: -+ `file_path` (required) - Full path to file. Ex. lib/class.rb -+ `branch_name` (required) - The name of branch -+ `encoding` (optional) - 'text' or 'base64'. Text is default. -+ `content` (required) - New file content -+ `commit_message` (required) - Commit message +- `file_path` (required) - Full path to file. Ex. lib/class.rb +- `branch_name` (required) - The name of branch +- `encoding` (optional) - 'text' or 'base64'. Text is default. +- `content` (required) - New file content +- `commit_message` (required) - Commit message ## Delete existing file in repository @@ -96,7 +97,6 @@ Example response: Parameters: -+ `file_path` (required) - Full path to file. Ex. lib/class.rb -+ `branch_name` (required) - The name of branch -+ `commit_message` (required) - Commit message - +- `file_path` (required) - Full path to file. Ex. lib/class.rb +- `branch_name` (required) - The name of branch +- `commit_message` (required) - Commit message diff --git a/doc/api/session.md b/doc/api/session.md index 0be5af79dad..2e717a2ea77 100644 --- a/doc/api/session.md +++ b/doc/api/session.md @@ -1,3 +1,5 @@ +# Session + Login to get private token ``` diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index d4c45ea9bbd..6483a73c7ec 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -1,6 +1,8 @@ +# System hooks + All methods require admin authorization. -The url endpoint of the system hooks can be configured in [the admin area under hooks](/admin/hooks). +The URL endpoint of the system hooks can be configured in [the admin area under hooks](/admin/hooks). ## List system hooks @@ -12,7 +14,7 @@ GET /hooks Parameters: -+ **none** +- **none** ```json [ @@ -32,8 +34,7 @@ POST /hooks Parameters: -+ `url` (required) - The hook URL - +- `url` (required) - The hook URL ## Test system hook @@ -43,7 +44,7 @@ GET /hooks/:id Parameters: -+ `id` (required) - The ID of hook +- `id` (required) - The ID of hook ```json { @@ -58,8 +59,7 @@ Parameters: ## 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. +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 @@ -67,4 +67,4 @@ DELETE /hooks/:id Parameters: -+ `id` (required) - The ID of hook +- `id` (required) - The ID of hook diff --git a/doc/api/users.md b/doc/api/users.md index 2b927c30777..4ddbf739774 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -1,8 +1,39 @@ +# Users + ## List users Get a list of users. + This function takes pagination parameters `page` and `per_page` to restrict the list of users. +### For normal users: + +``` +GET /users +``` + +```json +[ + { + "id": 1, + "username": "john_smith", + "name": "John Smith", + "state": "active", + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", + }, + { + "id": 2, + "username": "jack_smith", + "name": "Jack Smith", + "state": "blocked", + "avatar_url": "http://gravatar.com/../e32131cd8.jpeg", + } +] +``` + + +### For admins: + ``` GET /users ``` @@ -26,6 +57,7 @@ GET /users "theme_id": 1, "color_scheme_id": 2, "is_admin": false, + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "can_create_group": true }, { @@ -45,14 +77,14 @@ GET /users "theme_id": 1, "color_scheme_id": 3, "is_admin": false, + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "can_create_group": true, "can_create_project": true } ] ``` -You can search for a users by email or username with: -`/users?search=John` +You can search for a users by email or username with: `/users?search=John` Also see `def search query` in `app/models/user.rb`. @@ -60,13 +92,36 @@ Also see `def search query` in `app/models/user.rb`. Get a single user. +#### For user: + ``` GET /users/:id ``` Parameters: -+ `id` (required) - The ID of a user +- `id` (required) - The ID of a user + +```json +{ + "id": 1, + "username": "john_smith", + "name": "John Smith", + "state": "active", + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", +} +``` + + +#### For admin: + +``` +GET /users/:id +``` + +Parameters: + +- `id` (required) - The ID of a user ```json { @@ -91,7 +146,6 @@ Parameters: } ``` - ## User creation Creates a new user. Note only administrators can create new users. @@ -102,21 +156,20 @@ 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 -+ `website_url` (optional) - Website url -+ `projects_limit` (optional) - Number of projects user can create -+ `extern_uid` (optional) - External UID -+ `provider` (optional) - External provider name -+ `bio` (optional) - User's bio -+ `admin` (optional) - User is admin - true or false (default) -+ `can_create_group` (optional) - User can create groups - true or false - +- `email` (required) - Email +- `password` (required) - Password +- `username` (required) - Username +- `name` (required) - Name +- `skype` (optional) - Skype ID +- `linkedin` (optional) - Linkedin +- `twitter` (optional) - Twitter account +- `website_url` (optional) - Website url +- `projects_limit` (optional) - Number of projects user can create +- `extern_uid` (optional) - External UID +- `provider` (optional) - External provider name +- `bio` (optional) - User's bio +- `admin` (optional) - User is admin - true or false (default) +- `can_create_group` (optional) - User can create groups - true or false ## User modification @@ -128,30 +181,26 @@ PUT /users/:id Parameters: -+ `email` - Email -+ `username` - Username -+ `name` - Name -+ `password` - Password -+ `skype` - Skype ID -+ `linkedin` - Linkedin -+ `twitter` - Twitter account -+ `website_url` - Website url -+ `projects_limit` - Limit projects each user can create -+ `extern_uid` - External UID -+ `provider` - External provider name -+ `bio` - User's bio -+ `admin` (optional) - User is admin - true or false (default) -+ `can_create_group` (optional) - User can create groups - true or false - -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 existing one. - +- `email` - Email +- `username` - Username +- `name` - Name +- `password` - Password +- `skype` - Skype ID +- `linkedin` - Linkedin +- `twitter` - Twitter account +- `website_url` - Website url +- `projects_limit` - Limit projects each user can create +- `extern_uid` - External UID +- `provider` - External provider name +- `bio` - User's bio +- `admin` (optional) - User is admin - true or false (default) +- `can_create_group` (optional) - User can create groups - true or false + +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 existing 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. +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 @@ -159,8 +208,7 @@ DELETE /users/:id Parameters: -+ `id` (required) - The ID of the user - +- `id` (required) - The ID of the user ## Current user @@ -192,7 +240,6 @@ GET /user } ``` - ## List SSH keys Get a list of currently authenticated user's SSH keys. @@ -218,7 +265,7 @@ GET /user/keys Parameters: -+ **none** +- **none** ## List SSH keys for user @@ -230,8 +277,7 @@ GET /users/:uid/keys Parameters: -+ `uid` (required) - id of specified user - +- `uid` (required) - id of specified user ## Single SSH key @@ -243,7 +289,7 @@ GET /user/keys/:id Parameters: -+ `id` (required) - The ID of an SSH key +- `id` (required) - The ID of an SSH key ```json { @@ -253,7 +299,6 @@ Parameters: } ``` - ## Add SSH key Creates a new key owned by the currently authenticated user. @@ -264,9 +309,8 @@ POST /user/keys Parameters: -+ `title` (required) - new SSH Key's title -+ `key` (required) - new SSH key - +- `title` (required) - new SSH Key's title +- `key` (required) - new SSH key ## Add SSH key for user @@ -278,17 +322,15 @@ POST /users/:id/keys Parameters: -+ `id` (required) - id of specified user -+ `title` (required) - new SSH Key's title -+ `key` (required) - new SSH key +- `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. +Will return created key with status `201 Created` on success, or `404 Not found` on fail. -## Delete SSH key +## Delete SSH key for current user -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`. +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 /user/keys/:id @@ -296,9 +338,9 @@ DELETE /user/keys/:id Parameters: -+ `id` (required) - SSH key ID +- `id` (required) - SSH key ID -## Delete SSH key +## Delete SSH key for given user Deletes key owned by a specified user. Available only for admin. @@ -308,8 +350,7 @@ DELETE /users/:uid/keys/:id Parameters: -+ `uid` (required) - id of specified user -+ `id` (required) - SSH key ID +- `uid` (required) - id of specified user +- `id` (required) - SSH key ID Will return `200 Ok` on success, or `404 Not found` if either user or key cannot be found. - diff --git a/doc/development/README.md b/doc/development/README.md index eb88b6c860f..67ee828db6b 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -1,5 +1,5 @@ -## Development +# Development -+ [Architecture](architecture.md) of GitLab -+ [Shell commands](shell_commands.md) in the GitLab codebase -+ [Rake tasks](rake_tasks.md) for development +- [Architecture](architecture.md) of GitLab +- [Shell commands](shell_commands.md) in the GitLab codebase +- [Rake tasks](rake_tasks.md) for development diff --git a/doc/development/architecture.md b/doc/development/architecture.md index f2f7a3d5f0f..9d0d58b3db9 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -1,78 +1,54 @@ # GitLab Architecture Overview ---- -# Software delivery +## Software delivery -There are two editions of GitLab: [Enterprise Edition](https://www.gitlab.com/gitlab-ee/) (EE) and [Community Edition](https://www.gitlab.com/gitlab-ce/) (CE). -GitLab CE is delivered via git from the [gitlabhq repository](https://gitlab.com/gitlab-org/gitlab-ce/tree/master). -New versions of GitLab are released in stable branches and the master branch is for bleeding edge development. +There are two editions of GitLab: [Enterprise Edition](https://www.gitlab.com/gitlab-ee/) (EE) and [Community Edition](https://www.gitlab.com/gitlab-ce/) (CE). GitLab CE is delivered via git from the [gitlabhq repository](https://gitlab.com/gitlab-org/gitlab-ce/tree/master). New versions of GitLab are released in stable branches and the master branch is for bleeding edge development. -EE releases are available not long after CE releases. -To obtain the GitLab EE there is a [repository at gitlab.com](https://gitlab.com/subscribers/gitlab-ee). -For more information about the release process see the section 'New versions and upgrading' in the readme. +EE releases are available not long after CE releases. To obtain the GitLab EE there is a [repository at gitlab.com](https://gitlab.com/subscribers/gitlab-ee). For more information about the release process see the section 'New versions and upgrading' in the readme. -Both EE and CE require an add-on component called gitlab-shell. -It is obtained from the [gitlab-shell repository](https://gitlab.com/gitlab-org/gitlab-shell/tree/master). -New versions are usually tags but staying on the master branch will give you the latest stable version. -New releases are generally around the same time as GitLab CE releases with exception for informal security updates deemed critical. +Both EE and CE require an add-on component called gitlab-shell. It is obtained from the [gitlab-shell repository](https://gitlab.com/gitlab-org/gitlab-shell/tree/master). New versions are usually tags but staying on the master branch will give you the latest stable version. New releases are generally around the same time as GitLab CE releases with exception for informal security updates deemed critical. -# System Layout +## System Layout When referring to ~git in the pictures it means the home directory of the git user which is typically /home/git. -GitLab is primarily installed within the `/home/git` user home directory as `git` user. -Within the home directory is where the gitlabhq server software resides as well as the repositories (though the repository location is configurable). -The bare repositories are located in `/home/git/repositories`. -GitLab is a ruby on rails application so the particulars of the inner workings can be learned by studying how a ruby on rails application works. +GitLab is primarily installed within the `/home/git` user home directory as `git` user. Within the home directory is where the gitlabhq server software resides as well as the repositories (though the repository location is configurable). + +The bare repositories are located in `/home/git/repositories`. GitLab is a ruby on rails application so the particulars of the inner workings can be learned by studying how a ruby on rails application works. + To serve repositories over SSH there's an add-on application called gitlab-shell which is installed in `/home/git/gitlab-shell`. -## Components +### Components ![GitLab Diagram Overview](gitlab_diagram_overview.png) -A typical install of GitLab will be on Ubuntu Linux or RHEL/CentOS. -It uses Nginx or Apache as a web front end to proxypass the Unicorn web server. -By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. -The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and precompiled assets. -GitLab serves web pages and a [GitLab API](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api) using the Unicorn web server. -It uses Sidekiq as a job queue which, in turn, uses redis as a non-persistent database backend for job information, meta data, and incomming jobs. -The GitLab web app uses MySQL or PostgreSQL for persistent database information (e.g. users, permissions, issues, other meta data). -GitLab stores the bare git repositories it serves in `/home/git/repositories` by default. -It also keeps default branch and hook information with the bare repository. -`/home/git/gitlab-satellites` keeps checked out repositories when performing actions such as a merge request, editing files in the web interface, etc. -The satellite repository is used by the web interface for editing repositories and the wiki which is also a git repository. -When serving repositories over HTTP/HTTPS GitLab utilizes the GitLab API to resolve authorization and access as well as serving git objects. - -The add-on component gitlab-shell serves repositories over SSH. -It manages the SSH keys within `/home/git/.ssh/authorized_keys` which should not be manually edited. -gitlab-shell accesses the bare repositories directly to serve git objects and communicates with redis to submit jobs to Sidekiq for GitLab to process. - gitlab-shell queries the GitLab API to determine authorization and access. - -## Installation Folder Summary +A typical install of GitLab will be on Ubuntu Linux or RHEL/CentOS. It uses Nginx or Apache as a web front end to proxypass the Unicorn web server. By default, communication between Unicorn and the front end is via a Unix domain socket but forwarding requests via TCP is also supported. The web front end accesses `/home/git/gitlab/public` bypassing the Unicorn server to serve static pages, uploads (e.g. avatar images or attachments), and precompiled assets. GitLab serves web pages and a [GitLab API](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api) using the Unicorn web server. It uses Sidekiq as a job queue which, in turn, uses redis as a non-persistent database backend for job information, meta data, and incomming jobs. -To summarize here's the [directory structure of the `git` user home directory](../install/structure.md). +The GitLab web app uses MySQL or PostgreSQL for persistent database information (e.g. users, permissions, issues, other meta data). GitLab stores the bare git repositories it serves in `/home/git/repositories` by default. It also keeps default branch and hook information with the bare repository. `/home/git/gitlab-satellites` keeps checked out repositories when performing actions such as a merge request, editing files in the web interface, etc. + +The satellite repository is used by the web interface for editing repositories and the wiki which is also a git repository. When serving repositories over HTTP/HTTPS GitLab utilizes the GitLab API to resolve authorization and access as well as serving git objects. +The add-on component gitlab-shell serves repositories over SSH. It manages the SSH keys within `/home/git/.ssh/authorized_keys` which should not be manually edited. gitlab-shell accesses the bare repositories directly to serve git objects and communicates with redis to submit jobs to Sidekiq for GitLab to process. gitlab-shell queries the GitLab API to determine authorization and access. + +### Installation Folder Summary + +To summarize here's the [directory structure of the `git` user home directory](../install/structure.md). -## Processes +### Processes ps aux | grep '^git' -GitLab has several components to operate. -As a system user (i.e. any user that is not the `git` user) it requires a persistent database (MySQL/PostreSQL) and redis database. -It also uses Apache httpd or nginx to proxypass Unicorn. -As the `git` user it starts Sidekiq and Unicorn (a simple ruby HTTP server running on port `8080` by default). -Under the gitlab user there are normally 4 processes: `unicorn_rails master` (1 process), `unicorn_rails worker` (2 processes), `sidekiq` (1 process). +GitLab has several components to operate. As a system user (i.e. any user that is not the `git` user) it requires a persistent database (MySQL/PostreSQL) and redis database. It also uses Apache httpd or nginx to proxypass Unicorn. As the `git` user it starts Sidekiq and Unicorn (a simple ruby HTTP server running on port `8080` by default). Under the gitlab user there are normally 4 processes: `unicorn_rails master` (1 process), `unicorn_rails worker` (2 processes), `sidekiq` (1 process). -## Repository access +### Repository access -Repositories get accessed via HTTP or SSH. -HTTP cloning/push/pull utilizes the GitLab API and SSH cloning is handled by gitlab-shell (previously explained). +Repositories get accessed via HTTP or SSH. HTTP cloning/push/pull utilizes the GitLab API and SSH cloning is handled by gitlab-shell (previously explained). -# Troubleshooting +## Troubleshooting See the README for more information. -## Init scripts of the services +### Init scripts of the services The GitLab init script starts and stops Unicorn and Sidekiq. @@ -115,61 +91,59 @@ $ /etc/init.d/postgresql Usage: /etc/init.d/postgresql {start|stop|restart|reload|force-reload|status} [version ..] ``` -## Log locations of the services +### Log locations of the services Note: `/home/git/` is shorthand for `/home/git`. gitlabhq (includes Unicorn and Sidekiq logs) -* `/home/git/gitlab/log/` contains `application.log`, `production.log`, `sidekiq.log`, `unicorn.stdout.log`, `githost.log`, `satellites.log`, and `unicorn.stderr.log` normally. +- `/home/git/gitlab/log/` contains `application.log`, `production.log`, `sidekiq.log`, `unicorn.stdout.log`, `githost.log`, `satellites.log`, and `unicorn.stderr.log` normally. gitlab-shell -* `/home/git/gitlab-shell/gitlab-shell.log` +- `/home/git/gitlab-shell/gitlab-shell.log` ssh -* `/var/log/auth.log` auth log (on Ubuntu). -* `/var/log/secure` auth log (on RHEL). +- `/var/log/auth.log` auth log (on Ubuntu). +- `/var/log/secure` auth log (on RHEL). nginx -* `/var/log/nginx/` contains error and access logs. +- `/var/log/nginx/` contains error and access logs. Apache httpd -* [Explanation of apache logs](http://httpd.apache.org/docs/2.2/logs.html). -* `/var/log/apache2/` contains error and output logs (on Ubuntu). -* `/var/log/httpd/` contains error and output logs (on RHEL). +- [Explanation of apache logs](http://httpd.apache.org/docs/2.2/logs.html). +- `/var/log/apache2/` contains error and output logs (on Ubuntu). +- `/var/log/httpd/` contains error and output logs (on RHEL). redis -* `/var/log/redis/redis.log` there are also logrotated logs there. +- `/var/log/redis/redis.log` there are also logrotated logs there. PostgreSQL -* `/var/log/postgresql/*` +- `/var/log/postgresql/*` MySQL -* `/var/log/mysql/*` -* `/var/log/mysql.*` +- `/var/log/mysql/*` +- `/var/log/mysql.*` -## GitLab specific config files +### GitLab specific config files -GitLab has configuration files located in `/home/git/gitlab/config/*`. -Commonly referenced config files include: +GitLab has configuration files located in `/home/git/gitlab/config/*`. Commonly referenced config files include: -* `gitlab.yml` - GitLab configuration. -* `unicorn.rb` - Unicorn web server settings. -* `database.yml` - Database connection settings. +- `gitlab.yml` - GitLab configuration. +- `unicorn.rb` - Unicorn web server settings. +- `database.yml` - Database connection settings. gitlab-shell has a configuration file at `/home/git/gitlab-shell/config.yml`. -## Maintenance Tasks +### Maintenance Tasks -[GitLab](https://gitlab.com/gitlab-org/gitlab-ce/tree/master) provides rake tasks with which you see version information and run a quick check on your configuration to ensure it is configured properly within the application. -See [maintenance rake tasks](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/maintenance.md). +[GitLab](https://gitlab.com/gitlab-org/gitlab-ce/tree/master) provides rake tasks with which you see version information and run a quick check on your configuration to ensure it is configured properly within the application. See [maintenance rake tasks](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/raketasks/maintenance.md). In a nutshell, do the following: ``` @@ -179,5 +153,4 @@ bundle exec rake gitlab:env:info RAILS_ENV=production bundle exec rake gitlab:check RAILS_ENV=production ``` -Note: It is recommended to log into the `git` user using `sudo -i -u git` or `sudo su - git`. -While the sudo commands provided by gitlabhq work in Ubuntu they do not always work in RHEL.
\ No newline at end of file +Note: It is recommended to log into the `git` user using `sudo -i -u git` or `sudo su - git`. While the sudo commands provided by gitlabhq work in Ubuntu they do not always work in RHEL. diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md index af0d5ca4426..1f3908f4e27 100644 --- a/doc/development/shell_commands.md +++ b/doc/development/shell_commands.md @@ -8,9 +8,7 @@ ## Use File and FileUtils instead of shell commands -Sometimes we invoke basic Unix commands via the shell when there is also a Ruby API for doing it. -Use the Ruby API if it exists. -http://www.ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html#module-FileUtils-label-Module+Functions +Sometimes we invoke basic Unix commands via the shell when there is also a Ruby API for doing it. Use the Ruby API if it exists. <http://www.ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html#module-FileUtils-label-Module+Functions> ```ruby # Wrong @@ -30,12 +28,7 @@ This coding style could have prevented CVE-2013-4490. ## Bypass the shell by splitting commands into separate tokens -When we pass shell commands as a single string to Ruby, Ruby will let `/bin/sh` evaluate the entire string. -Essentially, we are asking the shell to evaluate a one-line script. -This creates a risk for shell injection attacks. -It is better to split the shell command into tokens ourselves. -Sometimes we use the scripting capabilities of the shell to change the working directory or set environment variables. -All of this can also be achieved securely straight from Ruby +When we pass shell commands as a single string to Ruby, Ruby will let `/bin/sh` evaluate the entire string. Essentially, we are asking the shell to evaluate a one-line script. This creates a risk for shell injection attacks. It is better to split the shell command into tokens ourselves. Sometimes we use the scripting capabilities of the shell to change the working directory or set environment variables. All of this can also be achieved securely straight from Ruby ```ruby # Wrong @@ -55,8 +48,7 @@ This coding style could have prevented CVE-2013-4546. ## Separate options from arguments with -- -Make the difference between options and arguments clear to the argument parsers of system commands with `--`. -This is supported by many but not all Unix commands. +Make the difference between options and arguments clear to the argument parsers of system commands with `--`. This is supported by many but not all Unix commands. To understand what `--` does, consider the problem below. @@ -68,9 +60,7 @@ cat: illegal option -- l usage: cat [-benstuv] [file ...] ``` -In the example above, the argument parser of `cat` assumes that `-l` is an option. -The solution in the example above is to make it clear to `cat` that `-l` is really an argument, not an option. -Many Unix command line tools follow the convention of separating options from arguments with `--`. +In the example above, the argument parser of `cat` assumes that `-l` is an option. The solution in the example above is to make it clear to `cat` that `-l` is really an argument, not an option. Many Unix command line tools follow the convention of separating options from arguments with `--`. ``` # Example (continued) @@ -91,9 +81,7 @@ This coding style could have prevented CVE-2013-4582. ## Do not use the backticks -Capturing the output of shell commands with backticks reads nicely, but you are forced to pass the command as one string to the shell. -We explained above that this is unsafe. -In the main GitLab codebase, the solution is to use `Gitlab::Popen.popen` instead. +Capturing the output of shell commands with backticks reads nicely, but you are forced to pass the command as one string to the shell. We explained above that this is unsafe. In the main GitLab codebase, the solution is to use `Gitlab::Popen.popen` instead. ```ruby # Wrong diff --git a/doc/install/README.md b/doc/install/README.md index ec80e3cd62a..239f5f301ec 100644 --- a/doc/install/README.md +++ b/doc/install/README.md @@ -1,4 +1,6 @@ -+ [Installation](installation.md) -+ [Requirements](requirements.md) -+ [Structure](structure.md) -+ [Database MySQL](database_mysql.md) +# Installation + +- [Installation](installation.md) +- [Requirements](requirements.md) +- [Structure](structure.md) +- [Database MySQL](database_mysql.md) diff --git a/doc/install/database_mysql.md b/doc/install/database_mysql.md index bf8183729e7..270ad3b0b86 100644 --- a/doc/install/database_mysql.md +++ b/doc/install/database_mysql.md @@ -1,3 +1,5 @@ +# Database Mysql + ## Note We do not recommend using MySQL due to various issues. For example, case [(in)sensitivity](https://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html) and [problems](http://bugs.mysql.com/bug.php?id=65830) that [suggested](http://bugs.mysql.com/bug.php?id=50909) [fixes](http://bugs.mysql.com/bug.php?id=65830) [have](http://bugs.mysql.com/bug.php?id=63164). diff --git a/doc/install/installation.md b/doc/install/installation.md index 44f5a28fde5..1b5139e8bb9 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -1,12 +1,14 @@ -# Select Version to Install -Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the branch (version) of GitLab you would like to install. In most cases -this should be the highest numbered stable branch (example shown below). +# Installation + +## Select Version to Install + +Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the branch (version) of GitLab you would like to install. In most cases this should be the highest numbered stable branch (example shown below). ![capture](http://i.imgur.com/d2AlIVj.png) If the highest number stable branch is unclear please check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version. -# Important notes +## Important notes This guide is long because it covers many cases and includes all commands you need, this is [one of the few installation scripts that actually works out of the box](https://twitter.com/robinvdvleuten/status/424163226532986880). @@ -18,21 +20,18 @@ The following steps have been known to work. Please **use caution when you devia If you find a bug/error in this guide please **submit a merge request** following the [contributing guide](../../CONTRIBUTING.md). -- - - - -# Overview +## Overview The GitLab installation consists of setting up the following components: 1. Packages / Dependencies -2. Ruby -3. System Users -4. Database -5. GitLab -6. Nginx +1. Ruby +1. System Users +1. Database +1. GitLab +1. Nginx - -# 1. Packages / Dependencies +## 1. Packages / Dependencies `sudo` is not installed on Debian by default. Make sure your system is up-to-date and install it. @@ -42,10 +41,7 @@ up-to-date and install it. apt-get upgrade -y apt-get install sudo -y -**Note:** -During this installation some files will need to be edited manually. -If you are familiar with vim set it as default editor with the commands below. -If you are not familiar with vim please skip this and keep using the default editor. +**Note:** During this installation some files will need to be edited manually. If you are familiar with vim set it as default editor with the commands below. If you are not familiar with vim please skip this and keep using the default editor. # Install vim and set as default editor sudo apt-get install -y vim @@ -53,14 +49,14 @@ If you are not familiar with vim please skip this and keep using the default edi Install the required packages (needed to compile Ruby and native extensions to Ruby gems): - sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate + sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils Make sure you have the right version of Git installed # Install Git sudo apt-get install -y git-core - # Make sure Git is version 1.7.10 or higher, for example 1.7.12 or 1.8.4 + # Make sure Git is version 1.7.10 or higher, for example 1.7.12 or 2.0.0 git --version Is the system packaged Git too old? Remove it and compile from source. @@ -73,24 +69,22 @@ Is the system packaged Git too old? Remove it and compile from source. # Download and compile from source cd /tmp - curl --progress https://git-core.googlecode.com/files/git-1.8.5.2.tar.gz | tar xz - cd git-1.8.5.2/ + curl --progress https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.gz | tar xz + cd git-2.0.0/ make prefix=/usr/local all # Install into /usr/local/bin sudo make prefix=/usr/local install - # When editing config/gitlab.yml (Step 6), change the git bin_path to /usr/local/bin/git + # When editing config/gitlab.yml (Step 5), change the git bin_path to /usr/local/bin/git -**Note:** In order to receive mail notifications, make sure to install a -mail server. By default, Debian is shipped with exim4 whereas Ubuntu -does not ship with one. The recommended mail server is postfix and you can install it with: +**Note:** In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 whereas Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with: sudo apt-get install -y postfix Then select 'Internet Site' and press enter to confirm the hostname. -# 2. Ruby +## 2. Ruby The use of ruby version managers such as [RVM](http://rvm.io/), [rbenv](https://github.com/sstephenson/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production frequently leads to hard to diagnose problems. For example, GitLab Shell is called from OpenSSH and having a version manager can prevent pushing and pulling over SSH. Version managers are not supported and we stronly advise everyone to follow the instructions below to use a system ruby. @@ -111,17 +105,15 @@ Install the Bundler Gem: sudo gem install bundler --no-ri --no-rdoc - -# 3. System Users +## 3. System Users Create a `git` user for Gitlab: sudo adduser --disabled-login --gecos 'GitLab' git -# 4. Database +## 4. Database -We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). -NOTE: because we need to make use of extensions you need at least pgsql 9.1. +We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). *Note*: because we need to make use of extensions you need at least pgsql 9.1. # Install the database packages sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev @@ -141,24 +133,22 @@ NOTE: because we need to make use of extensions you need at least pgsql 9.1. # Try connecting to the new database with the new user sudo -u git -H psql -d gitlabhq_production - -# 5. GitLab +## 5. GitLab # We'll install GitLab into home directory of the user "git" cd /home/git -## Clone the Source +### Clone the Source # Clone GitLab repository - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-9-stable gitlab + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-0-stable gitlab # Go to gitlab dir cd /home/git/gitlab -**Note:** -You can change `6-9-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! +**Note:** You can change `7-0-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! -## Configure it +### Configure it cd /home/git/gitlab @@ -168,6 +158,8 @@ You can change `6-9-stable` to `master` if you want the *bleeding edge* version, # Make sure to change "localhost" to the fully-qualified domain name of your # host serving GitLab where necessary # + # If you want to use https make sure that you set `https` to `true`. See #using-https for all necessary details. + # # If you installed Git from source, change the git bin_path to /usr/local/bin/git sudo -u git -H editor config/gitlab.yml @@ -179,7 +171,7 @@ You can change `6-9-stable` to `master` if you want the *bleeding edge* version, # Create directory for satellites sudo -u git -H mkdir /home/git/gitlab-satellites - sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites + sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites # Make sure GitLab can write to the tmp/pids/ and tmp/sockets/ directories sudo chmod -R u+rwX tmp/pids/ @@ -204,10 +196,9 @@ You can change `6-9-stable` to `master` if you want the *bleeding edge* version, sudo -u git -H git config --global user.email "example@example.com" sudo -u git -H git config --global core.autocrlf input -**Important Note:** -Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup. +**Important Note:** Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup. -## Configure GitLab DB settings +### Configure GitLab DB settings # PostgreSQL only: sudo -u git cp config/database.yml.postgresql config/database.yml @@ -227,14 +218,9 @@ Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup. # Make config/database.yml readable to git only sudo -u git -H chmod o-rwx config/database.yml -## Install Gems +### Install Gems -**Note:** As of bundler 1.5.2, you can invoke `bundle install -jN` -(where `N` the number of your processor cores) and enjoy the parallel gems installation with measurable -difference in completion time (~60% faster). Check the number of your cores with `nproc`. -For more information check this [post](http://robots.thoughtbot.com/parallel-gem-installing-using-bundler). -First make sure you have bundler >= 1.5.2 (run `bundle -v`) as it addresses some [issues](https://devcenter.heroku.com/changelog-items/411) -that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. +**Note:** As of bundler 1.5.2, you can invoke `bundle install -jN` (where `N` the number of your processor cores) and enjoy the parallel gems installation with measurable difference in completion time (~60% faster). Check the number of your cores with `nproc`. For more information check this [post](http://robots.thoughtbot.com/parallel-gem-installing-using-bundler). First make sure you have bundler >= 1.5.2 (run `bundle -v`) as it addresses some [issues](https://devcenter.heroku.com/changelog-items/411) that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. cd /home/git/gitlab @@ -244,7 +230,7 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. # Or if you use MySQL (note, the option says "without ... postgres") sudo -u git -H bundle install --deployment --without development test postgres aws -## Install GitLab shell +### Install GitLab shell GitLab Shell is an ssh access and repository management software developed specially for GitLab. @@ -252,13 +238,20 @@ GitLab Shell is an ssh access and repository management software developed speci cd /home/git/gitlab # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): - sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.4] REDIS_URL=redis://localhost:6379 RAILS_ENV=production + sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.6] REDIS_URL=redis://localhost:6379 RAILS_ENV=production - # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: + # By default, the gitlab-shell config is generated from your main gitlab config. + # + # Note: When using GitLab with HTTPS please change the following: + # - Provide paths to the certificates under `ca_file` and `ca_path options. + # - The `gitlab_url` option must point to the https endpoint of GitLab. + # - In case you are using self signed certificate set `self_signed_cert` to `true`. + # See #using-https for all necessary details. + # + # You can review (and modify) the gitlab-shell config as follows: sudo -u git -H editor /home/git/gitlab-shell/config.yml - -## Initialize Database and Activate Advanced Features +### Initialize Database and Activate Advanced Features sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production @@ -266,7 +259,7 @@ GitLab Shell is an ssh access and repository management software developed speci # When done you see 'Administrator account created:' -## Install Init Script +### Install Init Script Download the init script (will be /etc/init.d/gitlab): @@ -282,39 +275,36 @@ Make GitLab start on boot: sudo update-rc.d gitlab defaults 21 -## Set up logrotate +### Set up logrotate sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab -## Check Application Status +### Check Application Status Check if GitLab and its environment are configured correctly: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production -## Compile assets +### Compile assets sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production -## Start Your GitLab Instance +### Start Your GitLab Instance sudo service gitlab start # or sudo /etc/init.d/gitlab restart +## 6. Nginx -# 6. Nginx +**Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/). -**Note:** -Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the -[GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/). - -## Installation +### Installation sudo apt-get install -y nginx -## Site Configuration +### Site Configuration -Download an example site config: +Copy the example site config: sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab @@ -325,14 +315,15 @@ Make sure to edit the config file to match your setup: # domain name of your host serving GitLab. sudo editor /etc/nginx/sites-available/gitlab -## Restart +**Note:** If you want to use https, replace the `gitlab` nginx config with `gitlab-ssl`. See [Using HTTPS](#using-https) for all necessary details. - sudo service nginx restart +### Restart + sudo service nginx restart -# Done! +## Done! -## Double-check Application Status +### Double-check Application Status To make sure you didn't miss anything run a more thorough check with: @@ -340,51 +331,44 @@ To make sure you didn't miss anything run a more thorough check with: If all items are green, then congratulations on successfully installing GitLab! -## Initial Login +### Initial Login -Visit YOUR_SERVER in your web browser for your first GitLab login. -The setup has created an admin account for you. You can use it to log in: +Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has created an admin account for you. You can use it to log in: root 5iveL!fe -**Important Note:** -Please go over to your profile page and immediately change the password, so -nobody can access your GitLab by using this login information later on. +**Important Note:** Please go over to your profile page and immediately change the password, so nobody can access your GitLab by using this login information later on. **Enjoy!** +## Advanced Setup Tips -- - - +### Using HTTPS +To recapitulate what is needed to use GitLab with HTTPS: -# Advanced Setup Tips +1. In `gitlab.yml` set the `https` option to `true` +1. In the `config.yml` of gitlab-shell set the relevant options (see the [install GitLab Shell section](#install-gitlab-shell) of this document). +1. Use the `gitlab-ssl` nginx example config instead of the `gitlab` config. -## Additional markup styles +### Additional markup styles -Apart from the always supported markdown style there are other rich text files that GitLab can display. -But you might have to install a dependency to do so. -Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information. -For example, reStructuredText markup language support requires python-docutils: +Apart from the always supported markdown style there are other rich text files that GitLab can display. But you might have to install a dependency to do so. Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information. - sudo apt-get install -y python-docutils +### Custom Redis Connection -## Custom Redis Connection - -If you'd like Resque to connect to a Redis server on a non-standard port or on -a different host, you can configure its connection string via the -`config/resque.yml` file. +If you'd like Resque to connect to a Redis server on a non-standard port or on a different host, you can configure its connection string via the `config/resque.yml` file. # example production: redis://redis.example.tld:6379 -If you want to connect the Redis server via socket, then use the "unix:" URL scheme -and the path to the Redis socket file in the `config/resque.yml` file. +If you want to connect the Redis server via socket, then use the "unix:" URL scheme and the path to the Redis socket file in the `config/resque.yml` file. # example production: unix:/path/to/redis/socket -## Custom SSH Connection +### Custom SSH Connection If you are running SSH on a non-standard port, you must change the gitlab user's SSH config. @@ -396,39 +380,44 @@ 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 +### LDAP authentication You can configure LDAP authentication in config/gitlab.yml. Please restart GitLab after editing this file. -## Using Custom Omniauth Providers +### 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 +#### Steps These steps are fairly general and you will need to figure out the exact details from the Omniauth provider's documentation. -* Stop GitLab - `sudo service gitlab stop` +- Stop GitLab: + + sudo service gitlab stop -* Add provider specific configuration options to your `config/gitlab.yml` (you can use the [auth providers section of the example config](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example) as a reference) +- Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile): -* Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile) - `gem "omniauth-your-auth-provider"` -* If you're using MySQL, install the new Omniauth provider gem by running the following command: - `sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment` + gem "omniauth-your-auth-provider" -* If you're using PostgreSQL, install the new Omniauth provider gem by running the following command: - `sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment` +- If you're using MySQL, install the new Omniauth provider gem by running the following command: -> These are the same commands you used in the [Install Gems section](#install-gems) with `--path vendor/bundle --no-deployment` instead of `--deployment`. + sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment -* Start GitLab - `sudo service gitlab start` +- If you're using PostgreSQL, install the new Omniauth provider gem by running the following command: + sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment -### Examples + > These are the same commands you used in the [Install Gems section](#install-gems) with `--path vendor/bundle --no-deployment` instead of `--deployment`. + +- Start GitLab: + + `sudo service gitlab start` + +#### 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/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. diff --git a/doc/install/requirements.md b/doc/install/requirements.md index fd2dd16cd8e..d7c4c4da2ed 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -1,8 +1,10 @@ -# Operating Systems +# Requirements + +## Operating Systems GitLab is developed for the Linux operating system. For the installations options and instructions please see [the installation section of the readme](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/README.md#installation). -## Supported Linux distributions +### Supported Linux distributions - Ubuntu - Debian @@ -11,50 +13,54 @@ GitLab is developed for the Linux operating system. For the installations option - Scientific Linux - Oracle Linux -## Unsupported Linux distributions +### Unsupported Linux distributions - Arch Linux - Fedora - Gentoo -But on the above unsupported distributions is stll possible to install GitLab yourself with the [manual installation guide](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md). +But on the above unsupported distributions is still possible to install GitLab yourself with the [manual installation guide](https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md). -## Unsupported Unix operating systems +### Unsupported Unix operating systems There is nothing that prevents GitLab from running on other Unix operating systems. + This means you may get it to work on systems running FreeBSD or OS X. + If you want to do this, please be aware it could be a lot of work. + Please consider using a virtual machine to run GitLab. -## Other operating systems such as Windows +### Other operating systems such as 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. +## Ruby versions -# Ruby versions +GitLab requires Ruby (MRI) 2.0 or 2.1 -GitLab requires Ruby (MRI) 1.9.3 or 2.0+. You will have to use the standard MRI implementation of Ruby. -We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab needs several Gems that have native extensions. +We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab needs several Gems that have native extensions. -# Hardware requirements +## Hardware requirements -## CPU +### CPU - 1 core works supports up to 100 users but the application will not be responsive - **2 cores** is the **recommended** number of cores and supports up to 500 users - 4 cores supports up to 2,000 users - 8 cores supports up to 5,000 users -- 16 cores supports up to 10,0000 users -- 32 cores supports up to 20,0000 users -- 64 cores supports up to 40,0000 users +- 16 cores supports up to 10,000 users +- 32 cores supports up to 20,000 users +- 64 cores supports up to 40,000 users -## Memory +### Memory -- 512MB is the absolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this -- 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates using swap space) +- 512MB is the absolute minimum but we do not recommend this amount of memory, you'll need to configure a minimum swap of 256MB, you're memory will only allow you to run one slow unicorn worker, things will case only git ssh access to work because the git http access requires two running workers (one to receive the user request and one for the authorization check), +- 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates configuring swap space) - **2GB** is the **recommended** memory size and supports up to 500 users - 4GB supports up to 2,000 users - 8GB supports up to 5,000 users @@ -62,11 +68,9 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab - 32GB supports up to 20,000 users - 64GB supports up to 40,000 users -## Storage +### 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](structure.md) contain an extra copy of each repo. +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](structure.md) contain an extra copy of each repo. If you want to be flexible about growing your hard drive space in the future consider mounting it using LVM so you can add more hard drives when you need them. @@ -78,7 +82,7 @@ If you have enough RAM memory and a recent CPU the speed of GitLab is mainly lim If you want to run the database separately, the **recommended** database size is **1 MB per user** -# Supported webbrowsers +## Supported webbrowsers - Chrome (Latest stable version) - Firefox (Latest released version) diff --git a/doc/integration/README.md b/doc/integration/README.md index 4773dd8fffb..00c73afd872 100644 --- a/doc/integration/README.md +++ b/doc/integration/README.md @@ -1,11 +1,12 @@ # GitLab Integration GitLab integrates with multiple third-party services to allow external issue trackers and external authentication. + See the documentation below for details on how to configure these services. -+ [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc. -+ [LDAP](ldap.md) Set up sign in via LDAP -+ [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth. -+ [Slack](slack.md) Integrate with the Slack chat service +- [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc. +- [LDAP](ldap.md) Set up sign in via LDAP +- [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth. +- [Slack](slack.md) Integrate with the Slack chat service Jenkins support is [available in GitLab EE](http://doc.gitlab.com/ee/integration/jenkins.html). diff --git a/doc/integration/external-issue-tracker.md b/doc/integration/external-issue-tracker.md index 1b531aeeda7..6245836bef1 100644 --- a/doc/integration/external-issue-tracker.md +++ b/doc/integration/external-issue-tracker.md @@ -1,3 +1,5 @@ +# External issue tracker + GitLab has a great issue tracker but you can also use an external issue tracker such as JIRA or Redmine. This is something that you can turn on per GitLab project. If for example you configure JIRA it provides the following functionality: - the 'Issues' link on the GitLab project pages takes you to the appropriate JIRA issue index; diff --git a/doc/integration/github.md b/doc/integration/github.md index 672536b4daf..b53a7c12857 100644 --- a/doc/integration/github.md +++ b/doc/integration/github.md @@ -2,18 +2,24 @@ To enable the GitHub OmniAuth provider you must register your application with GitHub. GitHub will generate a client ID and secret key for you to use. -1. Sign in to GitHub. -2. Navigate to your individual user settings or an organization's settings, depending on how you want the application registered. It does not matter if the application is registered as an individual or an organization - that is entirely up to you. -3. Select "Applications" in the left menu. -4. Select "Register new application". -5. Provide the required details. - * Application name: This can be anything. Consider something like "\<Organization\>'s GitLab" or "\<Your Name\>'s GitLab" or something else descriptive. - * Homepage URL: The URL to your GitLab installation. 'https://gitlab.company.com' - * Application description: Fill this in if you wish. - * Authorization callback URL: 'https://gitlab.company.com/users/auth/github/callback' -6. Select "Register application". -7. You should now see a Client ID and Client Secret near the top right of the page (see screenshot). Keep this page open as you continue configuration. ![GitHub app](github_app.png) -8. On your GitLab server, open the configuration file. +1. Sign in to GitHub. + +1. Navigate to your individual user settings or an organization's settings, depending on how you want the application registered. It does not matter if the application is registered as an individual or an organization - that is entirely up to you. + +1. Select "Applications" in the left menu. + +1. Select "Register new application". + +1. Provide the required details. + - Application name: This can be anything. Consider something like "\<Organization\>'s GitLab" or "\<Your Name\>'s GitLab" or something else descriptive. + - Homepage URL: The URL to your GitLab installation. 'https://gitlab.company.com' + - Application description: Fill this in if you wish. + - Authorization callback URL: 'https://gitlab.company.com/users/auth/github/callback' +1. Select "Register application". + +1. You should now see a Client ID and Client Secret near the top right of the page (see screenshot). Keep this page open as you continue configuration. ![GitHub app](github_app.png) + +1. On your GitLab server, open the configuration file. ```sh cd /home/git/gitlab @@ -21,8 +27,9 @@ To enable the GitHub OmniAuth provider you must register your application with G sudo -u git -H editor config/gitlab.yml ``` -9. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details. -10. Under `providers:` uncomment (or add) lines that look like the following: +1. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details. + +1. Under `providers:` uncomment (or add) lines that look like the following: ``` - { name: 'github', app_id: 'YOUR APP ID', @@ -30,9 +37,12 @@ To enable the GitHub OmniAuth provider you must register your application with G args: { scope: 'user:email' } } ``` -11. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7. -12. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7. -13. Save the configuration file. -14. Restart GitLab for the changes to take effect. +1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7. + +1. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7. + +1. Save the configuration file. + +1. Restart GitLab for the changes to take effect. On the sign in page there should now be a GitHub icon below the regular sign in form. Click the icon to begin the authentication process. GitHub will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in. diff --git a/doc/integration/google.md b/doc/integration/google.md index 50f63502e79..3cf546bd77e 100644 --- a/doc/integration/google.md +++ b/doc/integration/google.md @@ -2,28 +2,38 @@ To enable the Google OAuth2 OmniAuth provider you must register your application with Google. Google will generate a client ID and secret key for you to use. -1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab. -2. Select "Create Project". -3. Provide the project information - * Project name: 'GitLab' works just fine here. - * Project ID: Must be unique to all Google Developer registered applications. Google provides a randomly generated Project ID by default. You can use the randomly generated ID or choose a new one. -4. Refresh the page. You should now see your new project in the list. Click on the project. -5. Select "APIs & auth" in the left menu. -6. Select "Credentials" in the submenu. -7. Select "Create New Client ID". -8. Fill in the required information - * Application type: "Web Application" - * Authorized JavaScript origins: This isn't really used by GitLab but go ahead and put 'https://gitlab.example.com' here. - * Authorized redirect URI: 'https://gitlab.example.com/users/auth/google_oauth2/callback' -9. Under the heading "Client ID for web application" you should see a Client ID and Client secret (see screenshot). Keep this page open as you continue configuration. ![Google app](google_app.png) -10. On your GitLab server, open the configuration file. +1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab. + +1. Select "Create Project". + +1. Provide the project information + - Project name: 'GitLab' works just fine here. + - Project ID: Must be unique to all Google Developer registered applications. Google provides a randomly generated Project ID by default. You can use the randomly generated ID or choose a new one. +1. Refresh the page. You should now see your new project in the list. Click on the project. + +1. Select "APIs & auth" in the left menu. + +1. Select "Credentials" in the submenu. + +1. Select "Create New Client ID". + +1. Fill in the required information + - Application type: "Web Application" + - Authorized JavaScript origins: This isn't really used by GitLab but go ahead and put 'https://gitlab.example.com' here. + - Authorized redirect URI: 'https://gitlab.example.com/users/auth/google_oauth2/callback' +1. Under the heading "Client ID for web application" you should see a Client ID and Client secret (see screenshot). Keep this page open as you continue configuration. ![Google app](google_app.png) + +1. On your GitLab server, open the configuration file. + ```sh cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` -11. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details. -12. Under `providers:` uncomment (or add) lines that look like the following: + +1. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details. + +1. Under `providers:` uncomment (or add) lines that look like the following: ``` - { name: 'google_oauth2', app_id: 'YOUR APP ID', @@ -31,10 +41,13 @@ To enable the Google OAuth2 OmniAuth provider you must register your application args: { access_type: 'offline', approval_prompt: '' } } ``` -13. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7. -14. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7. -15. Save the configuration file. -16. Restart GitLab for the changes to take effect. +1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7. + +1. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7. + +1. Save the configuration file. + +1. Restart GitLab for the changes to take effect. On the sign in page there should now be a Google icon below the regular sign in form. Click the icon to begin the authentication process. Google will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in. @@ -45,5 +58,5 @@ This further configuration is not required for Google authentication to function At this point, when users first try to authenticate to your GitLab installation with Google they will see a generic application name on the prompt screen. The prompt informs the user that "Project Default Service Account" would like to access their account. "Project Default Service Account" isn't very recognizable and may confuse or cause users to be concerned. This is easily changeable. 1. Select 'Consent screen' in the left menu. (See steps 1, 4 and 5 above for instructions on how to get here if you closed your window). -2. Scroll down until you find "Product Name". Change the product name to something more descriptive. -3. Add any additional information as you wish - homepage, logo, privacy policy, etc. None of this is required, but it may help your users. +1. Scroll down until you find "Product Name". Change the product name to something more descriptive. +1. Add any additional information as you wish - homepage, logo, privacy policy, etc. None of this is required, but it may help your users. diff --git a/doc/integration/ldap.md b/doc/integration/ldap.md index b52c4a4b5e4..62bb957d951 100644 --- a/doc/integration/ldap.md +++ b/doc/integration/ldap.md @@ -1,14 +1,19 @@ # GitLab LDAP integration GitLab can be configured to allow your users to sign with their LDAP credentials to integrate with e.g. Active Directory. + The first time a user signs in with LDAP credentials, GitLab will create a new GitLab user associated with the LDAP Distinguished Name (DN) of the LDAP user. + GitLab user attributes such as nickname and email will be copied from the LDAP user entry. ## Enabling LDAP sign-in for existing GitLab users When a user signs in to GitLab with LDAP for the first time, and their LDAP email address is the primary email address of an existing GitLab user, then the LDAP DN will be associated with the existing user. + If the LDAP email attribute is not found in GitLab's database, a new user is created. In other words, if an existing GitLab user wants to enable LDAP sign-in for themselves, they should check that their GitLab email address matches their LDAP email address, and then sign into GitLab via their LDAP credentials. + GitLab recognizes the following LDAP attributes as email addresses: `mail`, `email` and `userPrincipalName`. + If multiple LDAP email attributes are present, e.g. `mail: foo@bar.com` and `email: foo@example.com`, then the first attribute found wins -- in this case `foo@bar.com`. diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index 84a5a8e8c28..1b0bf9c5f64 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -1,18 +1,18 @@ # OmniAuth GitLab leverages OmniAuth to allow users to sign in using Twitter, GitHub, and other popular services. Configuring -OmniAuth does not prevent standard GitLab authentication or LDAP (if configured) from continuing to work. Users can -choose to sign in using any of the configured mechanisms. -+ [Initial OmniAuth Configuration](#initial-omniauth-configuration) -+ [Supported Providers](#supported-providers) -+ [Enable OmniAuth for an Existing User](#enable-omniauth-for-an-existing-user) +OmniAuth does not prevent standard GitLab authentication or LDAP (if configured) from continuing to work. Users can choose to sign in using any of the configured mechanisms. -### Initial OmniAuth Configuration +- [Initial OmniAuth Configuration](#initial-omniauth-configuration) +- [Supported Providers](#supported-providers) +- [Enable OmniAuth for an Existing User](#enable-omniauth-for-an-existing-user) + +## Initial OmniAuth Configuration Before configuring individual OmniAuth providers there are a few global settings that need to be verified. -1. Open the configuration file<br /> +1. Open the configuration file. ```sh cd /home/git/gitlab @@ -20,7 +20,7 @@ Before configuring individual OmniAuth providers there are a few global settings sudo -u git -H editor config/gitlab.yml ``` -2. Find the section dealing with OmniAuth. The section will look similar to the following.<br /> +1. Find the section dealing with OmniAuth. The section will look similar to the following. ``` ## OmniAuth settings @@ -52,32 +52,33 @@ Before configuring individual OmniAuth providers there are a few global settings # args: { scope: 'user:email' } } ``` -3. Change `enabled` to `true`. -4. Consider the next two configuration options: `allow_single_sign_on` and `block_auto_created_users`. - * `allow_single_sign_on` defaults to `false`. If `false` users must be created manually or they will not be able to +1. Change `enabled` to `true`. + +1. Consider the next two configuration options: `allow_single_sign_on` and `block_auto_created_users`. + + - `allow_single_sign_on` defaults to `false`. If `false` users must be created manually or they will not be able to sign in via OmniAuth. - * `block_auto_created_users` defaults to `true`. If `true` auto created users will be blocked by default and will + - `block_auto_created_users` defaults to `true`. If `true` auto created users will be blocked by default and will have to be unblocked by an administrator before they are able to sign in. - * **Note:** If you set `allow_single_sign_on` to `true` and `block_auto_created_users` to `false` please be aware + - **Note:** If you set `allow_single_sign_on` to `true` and `block_auto_created_users` to `false` please be aware that any user on the Internet will be able to successfully sign in to your GitLab without administrative approval. -5. Choose one or more of the Supported Providers below to continue configuration. -### Supported Providers +1. Choose one or more of the Supported Providers below to continue configuration. + +## Supported Providers -+ [GitHub](github.md) -+ [Google](google.md) -+ [Twitter](twitter.md) +- [GitHub](github.md) +- [Google](google.md) +- [Twitter](twitter.md) -### Enable OmniAuth for an Existing User +## Enable OmniAuth for an Existing User -Existing users can enable OmniAuth for specific providers after the account is created. For example, if the user -originally signed in with LDAP an OmniAuth provider such as Twitter can be enabled. Follow the steps below to enable an -OmniAuth provider for an existing user. +Existing users can enable OmniAuth for specific providers after the account is created. For example, if the user originally signed in with LDAP an OmniAuth provider such as Twitter can be enabled. Follow the steps below to enable an OmniAuth provider for an existing user. 1. Sign in normally - whether standard sign in, LDAP, or another OmniAuth provider. -2. Go to profile settings (the silhouette icon in the top right corner). -3. Select the "Account" tab. -4. Under "Social Accounts" select the desired OmniAuth provider, such as Twitter. -5. The user will be redirected to the provider. Once the user authorized GitLab they will be redirected back to GitLab. +1. Go to profile settings (the silhouette icon in the top right corner). +1. Select the "Account" tab. +1. Under "Social Accounts" select the desired OmniAuth provider, such as Twitter. +1. The user will be redirected to the provider. Once the user authorized GitLab they will be redirected back to GitLab. The chosen OmniAuth provider is now active and can be used to sign in to GitLab from then on. diff --git a/doc/integration/slack.md b/doc/integration/slack.md index 057871a4b8e..95cb0c6fae2 100644 --- a/doc/integration/slack.md +++ b/doc/integration/slack.md @@ -1,34 +1,36 @@ -# Slack integration +# Slack integration -### On Slack +## On Slack To enable Slack integration you must create an Incoming WebHooks integration on Slack; - -1. Sign in to [Slack](https://slack.com) (https://YOURSUBDOMAIN.slack.com/services) -2. Click on the Integrations menu at the top of the page. -3. Add a new Integration. -4. Pick Incoming WebHooks -5. Choose the channel name you want to send notifications to, in the Settings section -6. Add Integrations. - * Optional step; You can change bot's name and avatar by clicking "change the name of your bot", and "change the icon" after that you have to click "Save settings". +1. Sign in to [Slack](https://slack.com) (https://YOURSUBDOMAIN.slack.com/services) +1. Click on the Integrations menu at the top of the page. +1. Add a new Integration. +1. Pick Incoming WebHooks +1. Choose the channel name you want to send notifications to, in the Settings section +1. Add Integrations. + - Optional step; You can change bot's name and avatar by clicking "change the name of your bot", and "change the icon" after that you have to click "Save settings". Now, Slack is ready to get external hooks. Before you leave this page don't forget to get the Token that you'll need on GitLab. You can find it by clicking Expand button, located in the "Instructions for creating Incoming WebHooks" section. It's a random alpha-numeric text 24 characters long. -### On GitLab +## On GitLab After Slack is ready we need to setup GitLab. Here are the steps to achieve this. +1. Sign in to GitLab + +1. Pick the repository you want. + +1. Navigate to Settings -> Services -> Slack + +1. Fill in your Slack details -1. Sign in to GitLab -2. Pick the repository you want. -3. Navigate to Settings -> Services -> Slack -4. Fill in your Slack details - * Mark as active it - * Type your subdomain's prefix (If your subdomain is https://somedomain.slack.com you only have to type the somedomain) - * Type in the token you got from Slack - * Type in the channel name you want to use (eg. #announcements) + - Mark as active it + - Type your subdomain's prefix (If your subdomain is https://somedomain.slack.com you only have to type the somedomain) + - Type in the token you got from Slack + - Type in the channel name you want to use (eg. #announcements) Have fun :) -_P.S. You can set "branch,pushed,Compare changes" as highlight words on your Slack profile settings, so that you can be aware of new commits when somebody pushes them._ +*P.S. You can set "branch,pushed,Compare changes" as highlight words on your Slack profile settings, so that you can be aware of new commits when somebody pushes them.* diff --git a/doc/integration/twitter.md b/doc/integration/twitter.md index 0440e2f21f3..d1b52927d30 100644 --- a/doc/integration/twitter.md +++ b/doc/integration/twitter.md @@ -1,27 +1,37 @@ # Twitter OAuth2 OmniAuth Provider -To enable the Twitter OmniAuth provider you must register your application with Twitter. Twitter will generate a client -ID and secret key for you to use. - -1. Sign in to [Twitter Developers](https://dev.twitter.com/) area. -2. Hover over the avatar in the top right corner and select "My applications." -3. Select "Create new app" -4. Fill in the application details. - * Name: This can be anything. Consider something like "\<Organization\>'s GitLab" or "\<Your Name\>'s GitLab" or +To enable the Twitter OmniAuth provider you must register your application with Twitter. Twitter will generate a client ID and secret key for you to use. + +1. Sign in to [Twitter Developers](https://dev.twitter.com/) area. + +1. Hover over the avatar in the top right corner and select "My applications." + +1. Select "Create new app" + +1. Fill in the application details. + - Name: This can be anything. Consider something like "\<Organization\>'s GitLab" or "\<Your Name\>'s GitLab" or something else descriptive. - * Description: Create a description. - * Website: The URL to your GitLab installation. 'https://gitlab.example.com' - * Callback URL: 'https://gitlab.example.com/users/auth/github/callback' - * Agree to the "Rules of the Road." + - Description: Create a description. + - Website: The URL to your GitLab installation. 'https://gitlab.example.com' + - Callback URL: 'https://gitlab.example.com/users/auth/github/callback' + - Agree to the "Rules of the Road." + ![Twitter App Details](twitter_app_details.png) -6. Select "Create your Twitter application." -7. Select the "Settings" tab. -8. Underneath the Callback URL check the box next to "Allow this application to be used to Sign in the Twitter." -9. Select "Update settings" at the bottom to save changes. -10. Select the "API Keys" tab. -11. You should now see an API key and API secret (see screenshot). Keep this page open as you continue configuration. -![Twitter app](twitter_app_api_keys.png) -12. On your GitLab server, open the configuration file. +1. Select "Create your Twitter application." + +1. Select the "Settings" tab. + +1. Underneath the Callback URL check the box next to "Allow this application to be used to Sign in the Twitter." + +1. Select "Update settings" at the bottom to save changes. + +1. Select the "API Keys" tab. + +1. You should now see an API key and API secret (see screenshot). Keep this page open as you continue configuration. + + ![Twitter app](twitter_app_api_keys.png) + +1. On your GitLab server, open the configuration file. ```sh cd /home/git/gitlab @@ -29,19 +39,22 @@ ID and secret key for you to use. sudo -u git -H editor config/gitlab.yml ``` -13. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) +1. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details. -14. Under `providers:` uncomment (or add) lines that look like the following: + +1. Under `providers:` uncomment (or add) lines that look like the following: ``` - { name: 'twitter', app_id: 'YOUR APP ID', app_secret: 'YOUR APP SECRET' } ``` -15. Change 'YOUR APP ID' to the API key from Twitter page in step 11. -16. Change 'YOUR APP SECRET' to the API secret from the Twitter page in step 11. -17. Save the configuration file. -18. Restart GitLab for the changes to take effect. +1. Change 'YOUR APP ID' to the API key from Twitter page in step 11. + +1. Change 'YOUR APP SECRET' to the API secret from the Twitter page in step 11. + +1. Save the configuration file. + +1. Restart GitLab for the changes to take effect. -On the sign in page there should now be a Twitter icon below the regular sign in form. Click the icon to begin the -authentication process. Twitter will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in. +On the sign in page there should now be a Twitter icon below the regular sign in form. Click the icon to begin the authentication process. Twitter will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in. diff --git a/doc/legal/README.md b/doc/legal/README.md index ebfdad13540..56d72ae3859 100644 --- a/doc/legal/README.md +++ b/doc/legal/README.md @@ -1,2 +1,4 @@ -+ [Corporate contributor license agreement](corporate_contributor_license_agreement.md) -+ [Individual contributor license agreement](individual_contributor_license_agreement.md) +# Legal + +- [Corporate contributor license agreement](corporate_contributor_license_agreement.md) +- [Individual contributor license agreement](individual_contributor_license_agreement.md) diff --git a/doc/legal/corporate_contributor_license_agreement.md b/doc/legal/corporate_contributor_license_agreement.md index bbc274f3b0c..13bf15fcf45 100644 --- a/doc/legal/corporate_contributor_license_agreement.md +++ b/doc/legal/corporate_contributor_license_agreement.md @@ -1,25 +1,25 @@ -You accept and agree to the following terms and conditions for Your present and future Contributions submitted to GitLab.com. Except for the license granted herein to GitLab.com and recipients of software distributed by GitLab.com, You reserve all right, title, and interest in and to Your Contributions. +# Corporate contributor license agreement -1. Definitions. +You accept and agree to the following terms and conditions for Your present and future Contributions submitted to GitLab B.V.. Except for the license granted herein to GitLab B.V. and recipients of software distributed by GitLab B.V., You reserve all right, title, and interest in and to Your Contributions. - "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with GitLab.com. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +1. Definitions. - "Contribution" shall mean the code, documentation or other original works of authorship expressly identified in Schedule B, as well as any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to GitLab.com for inclusion in, or documentation of, any of the products owned or managed by GitLab.com (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to GitLab.com or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, GitLab.com for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." + "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with GitLab B.V.. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. -2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab.com and to recipients of software distributed by GitLab.com a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. + "Contribution" shall mean the code, documentation or other original works of authorship expressly identified in Schedule B, as well as any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to GitLab B.V. for inclusion in, or documentation of, any of the products owned or managed by GitLab B.V. (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to GitLab B.V. or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, GitLab B.V. for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." -3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab.com and to recipients of software distributed by GitLab.com a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. +2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab B.V. and to recipients of software distributed by GitLab B.V. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. -4. You represent that You are legally entitled to grant the above license. You represent further that each employee of the Corporation designated on Schedule A below (or in a subsequent written modification to that Schedule) is authorized to submit Contributions on behalf of the Corporation. +3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab B.V. and to recipients of software distributed by GitLab B.V. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. -5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). +4. You represent that You are legally entitled to grant the above license. You represent further that each employee of the Corporation designated on Schedule A below (or in a subsequent written modification to that Schedule) is authorized to submit Contributions on behalf of the Corporation. -6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. +5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). -7. Should You wish to submit work that is not Your original creation, You may submit it to GitLab.com separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]". +6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. -8. It is your responsibility to notify GitLab.com when any change is required to the list of designated employees authorized to submit Contributions on behalf of the Corporation, or to the Corporation's Point of Contact with GitLab.com. +7. Should You wish to submit work that is not Your original creation, You may submit it to GitLab B.V. separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]". ---------------------------------------- +8. It is your responsibility to notify GitLab B.V. when any change is required to the list of designated employees authorized to submit Contributions on behalf of the Corporation, or to the Corporation's Point of Contact with GitLab B.V.. This text is licensed under the [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/) and the original source is the Google Open Source Programs Office. diff --git a/doc/legal/individual_contributor_license_agreement.md b/doc/legal/individual_contributor_license_agreement.md index eaf5812ca4c..72b01433dd0 100644 --- a/doc/legal/individual_contributor_license_agreement.md +++ b/doc/legal/individual_contributor_license_agreement.md @@ -1,25 +1,25 @@ -You accept and agree to the following terms and conditions for Your present and future Contributions submitted to GitLab.com. Except for the license granted herein to GitLab.com and recipients of software distributed by GitLab.com, You reserve all right, title, and interest in and to Your Contributions. +# Individual contributor license agreement -1. Definitions. +You accept and agree to the following terms and conditions for Your present and future Contributions submitted to GitLab B.V.. Except for the license granted herein to GitLab B.V. and recipients of software distributed by GitLab B.V., You reserve all right, title, and interest in and to Your Contributions. - "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with GitLab.com. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +1. Definitions. - "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to GitLab.com for inclusion in, or documentation of, any of the products owned or managed by GitLab.com (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to GitLab.com or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, GitLab.com for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." + "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with GitLab B.V.. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. -2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab.com and to recipients of software distributed by GitLab.com a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. + "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to GitLab B.V. for inclusion in, or documentation of, any of the products owned or managed by GitLab B.V. (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to GitLab B.V. or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, GitLab B.V. for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution." -3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab.com and to recipients of software distributed by GitLab.com a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. +2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab B.V. and to recipients of software distributed by GitLab B.V. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works. -4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to GitLab.com, or that your employer has executed a separate Corporate CLA with GitLab.com. +3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to GitLab B.V. and to recipients of software distributed by GitLab B.V. a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed. -5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions. +4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to GitLab B.V., or that your employer has executed a separate Corporate CLA with GitLab B.V.. -6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. +5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions. -7. Should You wish to submit work that is not Your original creation, You may submit it to GitLab.com separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [[]named here]". +6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. -8. You agree to notify GitLab.com of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect. +7. Should You wish to submit work that is not Your original creation, You may submit it to GitLab B.V. separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [[]named here]". ---------------------------------------- +8. You agree to notify GitLab B.V. of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect. This text is licensed under the [Creative Commons Attribution 3.0 License](http://creativecommons.org/licenses/by/3.0/) and the original source is the Google Open Source Programs Office. diff --git a/doc/markdown/markdown.md b/doc/markdown/markdown.md index e7ebc613431..64f571b4351 100644 --- a/doc/markdown/markdown.md +++ b/doc/markdown/markdown.md @@ -1,9 +1,6 @@ ----------------------------------------------- +# Markdown -Table of Contents -================= - ----------------------------------------------- +## Table of Contents **[GitLab Flavored Markdown](#gitlab-flavored-markdown-gfm)** @@ -19,7 +16,6 @@ Table of Contents [Special GitLab references](#special-gitlab-references) - **[Standard Markdown](#standard-markdown)** [Headers](#headers) @@ -44,29 +40,23 @@ Table of Contents **[References](#references)** ----------------------------------------------- +## GitLab Flavored Markdown (GFM) -GitLab Flavored Markdown (GFM) -============================== -For GitLab we developed something we call "GitLab Flavored Markdown" (GFM). -It extends the standard Markdown in a few significant ways to add some useful functionality. +For GitLab we developed something we call "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few significant ways to add some useful functionality. You can use GFM in -* commit messages -* comments -* wall posts -* issues -* merge requests -* milestones -* wiki pages +- commit messages +- comments +- issues +- merge requests +- milestones +- wiki pages + +You can also use other rich text files in GitLab. You might have to install a depency to do so. Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information. -You can also use other rich text files in GitLab. -You might have to install a depency to do so. -Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information. +## Newlines -Newlines --------- GFM honors the markdown specification in how [paragraphs and line breaks are handled](http://daringfireball.net/projects/markdown/syntax#p). A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines.: @@ -81,8 +71,8 @@ Violets are blue Sugar is sweet -Multiple underscores in words ------------------------------ +## Multiple underscores in words + It is not reasonable to italicize just _part_ of a word, especially when you're dealing with code and names that often appear with multiple underscores. Therefore, GFM ignores multiple underscores in words. perform_complicated_task @@ -91,10 +81,9 @@ It is not reasonable to italicize just _part_ of a word, especially when you're perform_complicated_task do_this_and_do_that_and_another_thing -URL autolinking ---------------- -GFM will autolink standard URLs you copy and paste into your text. -So if you want to link to a URL (instead of a textural link), you can simply put the URL in verbatim and it will be turned into a link to that URL. +## URL autolinking + +GFM will autolink standard URLs you copy and paste into your text. So if you want to link to a URL (instead of a textural link), you can simply put the URL in verbatim and it will be turned into a link to that URL. http://www.google.com @@ -162,8 +151,7 @@ s = "There is no highlighting for this." But let's throw in a <b>tag</b>. ``` -Emoji ------ +## Emoji Sometimes you want to be :cool: and add some :sparkles: to your :speech_balloon:. Well we have a :gift: for you: @@ -185,26 +173,25 @@ If you are :new: to this, don't be :fearful:. You can easily join the emoji :cir Consult the [Emoji Cheat Sheet](http://www.emoji-cheat-sheet.com/) for a list of all supported emoji codes. :thumbsup: -Special GitLab References ------ +## Special GitLab References GFM recognized 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. GFM will recognize the following: -* @foo : for team members -* #123 : for issues -* !123 : for merge requests -* $123 : for snippets -* 1234567 : for commits -* \[file\](path/to/file) : for file references +- @foo : for team members +- #123 : for issues +- !123 : for merge requests +- $123 : for snippets +- 1234567 : for commits +- \[file\](path/to/file) : for file references ----------------------------------- # Standard Markdown ----------------------------------- ## Headers ```no-highlight @@ -247,12 +234,12 @@ On hover a link to those IDs becomes visible to make it easier to copy the link The IDs are generated from the content of the header according to the following rules: -1) remove the heading hashes `#` and process the rest of the line as it would be processed if it were not a header -2) from the result, remove all HTML tags, but keep their inner content -3) convert all characters to lowercase -4) convert all characters except `[a-z0-9_-]` into hyphens `-` -5) transform multiple adjacent hyphens into a single hyphen -6) remove trailing and heading hyphens +1. remove the heading hashes `#` and process the rest of the line as it would be processed if it were not a header +2. from the result, remove all HTML tags, but keep their inner content +3. convert all characters to lowercase +4. convert all characters except `[a-z0-9_-]` into hyphens `-` +5. transform multiple adjacent hyphens into a single hyphen +6. remove trailing and heading hyphens For example: @@ -375,8 +362,7 @@ Some text to show that the reference links can follow later. **Note** -Relative links do not allow referencing project files in a wiki page or wiki page in a project file. -The reason for this is that, in GitLab, wiki is always a separate git repository. For example: +Relative links do not allow referencing project files in a wiki page or wiki page in a project file. The reason for this is that, in GitLab, wiki is always a separate git repository. For example: `[I'm a reference-style link][style]` @@ -397,9 +383,11 @@ will point the link to `wikis/style` when the link is inside of a wiki markdown Here's our logo: Inline-style: + ![alt text](/assets/logo-white.png) Reference-style: + ![alt text][logo] [logo]: /assets/logo-white.png @@ -516,10 +504,8 @@ Code above produces next output: | cell 1 | cell 2 | | cell 3 | cell 4 | ------------- - ## References -* This document leveraged heavily from the [Markdown-Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet). -* The [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) at Daring Fireball is an excellent resource for a detailed explanation of standard markdown. -* [Dillinger.io](http://dillinger.io) is a handy tool for testing standard markdown. +- This document leveraged heavily from the [Markdown-Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet). +- The [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) at Daring Fireball is an excellent resource for a detailed explanation of standard markdown. +- [Dillinger.io](http://dillinger.io) is a handy tool for testing standard markdown. diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md index 9be6423f667..e01b02212b6 100644 --- a/doc/permissions/permissions.md +++ b/doc/permissions/permissions.md @@ -1,45 +1,47 @@ +# Permissions + Users have different abilities depending on the access level they have in a particular group or project. + If a user is both in a project group and in the project itself, the highest permission level is used. + If a user is a GitLab administrator they receive all permissions. ---- - -#### Project: - - -| Action| Guest | Reporter | Developer | Master | Owner| -|-------|-------|----------|-----------|--------|------| -|Create new issue|✓|✓|✓|✓|✓| -|Leave comments|✓|✓|✓|✓|✓| -|Write on project wall|✓|✓|✓|✓|✓| -|Pull project code| |✓|✓|✓|✓| -|Download project| |✓|✓|✓|✓| -|Create code snippets| |✓|✓|✓|✓| -|Create new merge request| ||✓|✓|✓| -|Create new branches| ||✓|✓|✓| -|Push to non-protected branches| ||✓|✓|✓| -|Remove non-protected branches| ||✓|✓|✓| -|Add tags| ||✓|✓|✓| -|Write a wiki| ||✓|✓|✓| -|Manage issue tracker| ||✓|✓|✓| -|Add new team members| |||✓|✓| -|Push to protected branches| |||✓|✓| -|Remove protected branches| |||✓|✓| -|Edit project| |||✓|✓| -|Add Deploy Keys to project| |||✓|✓| -|Configure Project Hooks| |||✓|✓| -|Switch visibility level| ||||✓| -|Transfer project to another namespace| ||||✓| -|Remove project| ||||✓| - -#### Group - -|Action|Guest|Reporter|Developer|Master|Owner| -|------|-----|--------|---------|------|-----| -|Browse group|✓|✓|✓|✓|✓| -|Edit group|||||✓| -|Create project in group|||||✓| -|Manage group members|||||✓| -|Remove group|||||✓| +## Project + + +| Action | Guest | Reporter | Developer | Master | Owner | +|---------------------------------------|---------|------------|-------------|----------|--------| +| Create new issue | ✓ | ✓ | ✓ | ✓ | ✓ | +| Leave comments | ✓ | ✓ | ✓ | ✓ | ✓ | +| Pull project code | | ✓ | ✓ | ✓ | ✓ | +| Download project | | ✓ | ✓ | ✓ | ✓ | +| Create code snippets | | ✓ | ✓ | ✓ | ✓ | +| Create new merge request | | | ✓ | ✓ | ✓ | +| Create new branches | | | ✓ | ✓ | ✓ | +| Push to non-protected branches | | | ✓ | ✓ | ✓ | +| Remove non-protected branches | | | ✓ | ✓ | ✓ | +| Add tags | | | ✓ | ✓ | ✓ | +| Write a wiki | | | ✓ | ✓ | ✓ | +| Manage issue tracker | | | ✓ | ✓ | ✓ | +| Add new team members | | | | ✓ | ✓ | +| Push to protected branches | | | | ✓ | ✓ | +| Enable/Disable branch protection | | | | ✓ | ✓ | +| Rewrite/remove git tags | | | | ✓ | ✓ | +| Edit project | | | | ✓ | ✓ | +| Add Deploy Keys to project | | | | ✓ | ✓ | +| Configure Project Hooks | | | | ✓ | ✓ | +| Switch visibility level | | | | | ✓ | +| Transfer project to another namespace | | | | | ✓ | +| Remove project | | | | | ✓ | + +## Group + +| Action | Guest | Reporter | Developer | Master | Owner | +|-------------------------|-------|----------|-----------|--------|-------| +| Browse group | ✓ | ✓ | ✓ | ✓ | ✓ | +| Edit group | | | | | ✓ | +| Create project in group | | | | ✓ | ✓ | +| Manage group members | | | | | ✓ | +| Remove group | | | | | ✓ | Any user can remove himself from a group, unless he is the last Owner of the group. diff --git a/doc/public_access/public_access.md b/doc/public_access/public_access.md index 76d83e6f3b6..493e59af225 100644 --- a/doc/public_access/public_access.md +++ b/doc/public_access/public_access.md @@ -1,28 +1,44 @@ +# Public access + Gitlab allows you to open selected projects to be accessed **publicly** or **internally**. -Projects with either of these visibility levels will be listen in the [public access directory](/public). + +Projects with either of these visibility levels will be listed in the [public access directory](/public). + Internal projects will only be available to authenticated users. -#### Public projects +## Public projects + Public projects can be cloned **without any** authentication. + It will also be listed on the [public access directory](/public). + **Any logged in user** will have [Guest](/help/permissions) permissions on the repository. -#### Internal projects +## Internal projects + Internal projects can be cloned by any logged in user. + It will also be listed on the [public access directory](/public) for logged in users. + Any logged in user will have [Guest](/help/permissions) permissions on the repository. -#### How to change project visibility +## How to change project visibility + 1. Go to your project dashboard -2. Click on the "Edit" tab -3. Change "Visibility Level" +1. Click on the "Edit" tab +1. Change "Visibility Level" + +## Visibility of users -#### Visibility of users The public page of users, located at `/u/username` is visible if either: -* You are logged in. -* You are logged out, and the target user is authorized to (is Guest, Reporter, etc.) at least one public project. +- You are logged in. +- You are logged out, and the target user is authorized to (is Guest, Reporter, etc.) at least one public project. Otherwise, you will be redirected to the sign in page. When visiting the public page of an user, you will only see listed projects which you can view yourself. + +## Restricting the use of public or internal projects + +In [gitlab.yml](https://gitlab.com/gitlab-org/gitlab-ce/blob/dbd88d453b8e6c78a423fa7e692004b1db6ea069/config/gitlab.yml.example#L64) you can disable public projects or public and internal projects for the entire GitLab installation to prevent people making code public by accident. diff --git a/doc/raketasks/README.md b/doc/raketasks/README.md index 6be24f0102a..9e2f697bca6 100644 --- a/doc/raketasks/README.md +++ b/doc/raketasks/README.md @@ -1,7 +1,6 @@ -+ [Backup restore](backup_restore.md) -+ [Cleanup](cleanup.md) -+ [Features](features.md) -+ [Maintenance](maintenance.md) and self-checks -+ [User management](user_management.md) -+ [Web hooks](web_hooks.md) -+ [Import](import.md) of git repositories in bulk +- [Backup restore](backup_restore.md) +- [Cleanup](cleanup.md) +- [Maintenance](maintenance.md) and self-checks +- [User management](user_management.md) +- [Web hooks](web_hooks.md) +- [Import](import.md) of git repositories in bulk diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index bdff6ad5da8..5c1594d13d8 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -1,6 +1,9 @@ -### Create a backup of the GitLab system +# Backup restore + +## Create a backup of the GitLab system Creates a backup archive of the database and all repositories. This archive will be saved in backup_path (see `config/gitlab.yml`). + The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup. ``` @@ -36,7 +39,7 @@ Deleting tmp directories...[DONE] Deleting old backups... [SKIPPING] ``` -### Restore a previously created backup +## Restore a previously created backup ``` bundle exec rake gitlab:backup:restore RAILS_ENV=production @@ -79,7 +82,7 @@ Restoring repositories: Deleting tmp directories...[DONE] ``` -### Configure cron to make daily backups +## Configure cron to make daily backups ``` cd /home/git/gitlab diff --git a/doc/raketasks/cleanup.md b/doc/raketasks/cleanup.md index 99809ef434d..4b3b6d71a75 100644 --- a/doc/raketasks/cleanup.md +++ b/doc/raketasks/cleanup.md @@ -1,4 +1,6 @@ -### Remove garbage from filesystem. Important! Data loss! +# Cleanup + +## Remove garbage from filesystem. Important! Data loss! Remove namespaces(dirs) from `/home/git/repositories` if they don't exist in GitLab database. @@ -11,4 +13,3 @@ Remove repositories (global only for now) from `/home/git/repositories` if they ``` bundle exec rake gitlab:cleanup:repos RAILS_ENV=production ``` - diff --git a/doc/raketasks/features.md b/doc/raketasks/features.md index 018817d219b..eaa9af5f962 100644 --- a/doc/raketasks/features.md +++ b/doc/raketasks/features.md @@ -1,23 +1,25 @@ -### Enable usernames and namespaces for user projects +# Features + +## Enable usernames and namespaces for user projects This command will enable the namespaces feature introduced in v4.0. It will move every project in its namespace folder. Note: -* Because the **repository location will change**, you will need to **update all your git url's** to point to the new location. -* Username can be changed at [Profile / Account](/profile/account) +- Because the **repository location will change**, you will need to **update all your git url's** to point to the new location. +- Username can be changed at [Profile / Account](/profile/account) **Example:** Old path: `git@example.org:myrepo.git` + New path: `git@example.org:username/myrepo.git` or `git@example.org:groupname/myrepo.git` ``` bundle exec rake gitlab:enable_namespaces RAILS_ENV=production ``` - -### Rebuild project satellites +## Rebuild project satellites 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**. diff --git a/doc/raketasks/import.md b/doc/raketasks/import.md index e11328dc5ce..628bd373b8d 100644 --- a/doc/raketasks/import.md +++ b/doc/raketasks/import.md @@ -1,3 +1,5 @@ +# Import + ### Import bare repositories into GitLab project instance Notes: diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index 907c9352c59..30276dd7629 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -1,7 +1,8 @@ -### Gather information about GitLab and the system it runs on +# Maintenance -This command gathers information about your GitLab installation and the System -it runs on. These may be useful when asking for help or reporting issues. +## Gather information about GitLab and the system it runs on + +This command gathers information about your GitLab installation and the System it runs on. These may be useful when asking for help or reporting issues. ``` bundle exec rake gitlab:env:info RAILS_ENV=production @@ -14,8 +15,8 @@ System information System: Debian 6.0.7 Current User: git Using RVM: no -Ruby Version: 1.9.3p392 -Gem Version: 1.8.23 +Ruby Version: 2.0.0-p481 +Gem Version: 1.8.23 Bundler Version:1.3.5 Rake Version: 10.0.4 @@ -37,15 +38,14 @@ Hooks: /home/git/gitlab-shell/hooks/ Git: /usr/bin/git ``` - -### Check GitLab configuration +## Check GitLab configuration Runs the following rake tasks: -* gitlab:env:check -* gitlab:gitlab_shell:check -* gitlab:sidekiq:check -* gitlab:app:check +- `gitlab:env:check` +- `gitlab:gitlab_shell:check` +- `gitlab:sidekiq:check` +- `gitlab:app:check` It will check that each component was setup according to the installation guide and suggest fixes for issues found. @@ -101,10 +101,10 @@ Redis version >= 2.0.0? ... yes Checking GitLab ... Finished ``` - -### (Re-)Create satellite repos +## (Re-)Create satellite repos This will create satellite repos for all your projects. + If necessary, remove the `tmp/repo_satellites` directory and rerun the command below. ``` diff --git a/doc/raketasks/user_management.md b/doc/raketasks/user_management.md index e8232082916..81378494c6b 100644 --- a/doc/raketasks/user_management.md +++ b/doc/raketasks/user_management.md @@ -1,32 +1,33 @@ -### Add user as a developer to all projects +# User management + +## Add user as a developer to all projects ```bash bundle exec rake gitlab:import:user_to_projects[username@domain.tld] ``` - -### Add all users to all projects +## Add all users to all projects Notes: -* admin users are added as masters +- admin users are added as masters ```bash bundle exec rake gitlab:import:all_users_to_all_projects ``` -### Add user as a developer to all groups +## Add user as a developer to all groups -``` +```bash bundle exec rake gitlab:import:user_to_groups[username@domain.tld] ``` -### Add all users to all groups +## Add all users to all groups Notes: -* admin users are added as owners so they can add additional users to the group +- admin users are added as owners so they can add additional users to the group -``` +```bash bundle exec rake gitlab:import:all_users_to_all_groups ``` diff --git a/doc/raketasks/web_hooks.md b/doc/raketasks/web_hooks.md index 1ca5bacb9d1..704473af2d9 100644 --- a/doc/raketasks/web_hooks.md +++ b/doc/raketasks/web_hooks.md @@ -1,31 +1,27 @@ -### Add a web hook for **ALL** projects: +# Web hooks - RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" +## Add a web hook for **ALL** projects: + RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" -### Add a web hook for projects in a given **NAMESPACE**: +## Add a web hook for projects in a given **NAMESPACE**: RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme - -### Remove a web hook from **ALL** projects using: +## Remove a web hook from **ALL** projects using: RAILS_ENV=production bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" - -### Remove a web hook from projects in a given **NAMESPACE**: +## Remove a web hook from projects in a given **NAMESPACE**: RAILS_ENV=production bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme - -### List **ALL** web hooks: +## List **ALL** web hooks: RAILS_ENV=production bundle exec rake gitlab:web_hook:list - -### List the web hooks from projects in a given **NAMESPACE**: +## List the web hooks from projects in a given **NAMESPACE**: RAILS_ENV=production bundle exec rake gitlab:web_hook:list NAMESPACE=/ > Note: `/` is the global namespace. - diff --git a/doc/release/README.md b/doc/release/README.md index 22510be3f18..1342b90f3b3 100644 --- a/doc/release/README.md +++ b/doc/release/README.md @@ -1,2 +1,6 @@ -+ [Monthly](monthly.md) -+ [Security](security.md) +GitLab has the following updates: + +- [Monthly release](monthly.md), every month on the 22nd. +- [Patch release](patch.md), if there are serious regressions. +- [Security](security.md), for security problems. +- [Master](master.md), update process for the master branch. diff --git a/doc/release/master.md b/doc/release/master.md new file mode 100644 index 00000000000..19070b46a0d --- /dev/null +++ b/doc/release/master.md @@ -0,0 +1,33 @@ +# How to push GitLab CE master branch to all remotes. + +The source code of GitLab is available on multiple servers (with GitLab.com as the canonical source). +Synchronization between the repo's is done by the lead developer if there is no rush. +This happens a few times per workday on average. +If somebody else with access to all repo's wants to do it the instructions are below. +This is just to distribute changes, not to make them. + +## Add this to `.bashrc` or [your dotfiles](https://github.com/dosire/dotfiles/commit/52803ce3ac60d57632164b7713ff0041e86fa26c) + +```bash +gpa () +{ + git push origin ${1:-master} && git push gh ${1:-master} && git push gl ${1:-master} +} +``` + +## Then add remotes to your local repo + +```bash +cd my-gitlab-ce-repo + +git remote add origin git@dev.gitlab.org:gitlab/gitlabhq.git +git remote add gh git@github.com:gitlabhq/gitlabhq.git +git remote add gl git@gitlab.com:gitlab-org/gitlab-ce.git +``` + +## Push to all remotes + +```bash +gpa +``` + diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 514d73517b2..45040084dfc 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -1,4 +1,5 @@ # Monthly Release + NOTE: This is a guide for GitLab developers. # **15th - Code Freeze & Release Manager** @@ -9,25 +10,38 @@ NOTE: This is a guide for GitLab developers. A release manager is selected that coordinates the entire release of this version. The release manager has to make sure all the steps below are done and delegated where necessary. This person should also make sure this document is kept up to date and issues are created and updated. +### **3. Update Changelog** + +Any changes not yet added to the changelog are added by lead developer and in that merge request the complete team is asked if there is anything missing. + # **18th - Releasing RC1** The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub. ### **1. Create an issue for RC1 release** +Consider naming the issue "Release x.x.x.rc1" to make it easier for later searches. + ### **2. Update the installation guide** 1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay) -2. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) -3. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) -4. There might be other changes. Ask around. +1. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) +1. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) +1. There might be other changes. Ask around. + +### **3. Create an update guides** -### **3. Create an update guide** +1. Create: CE update guide from previous version. Like `from-6-8-to-6.9` +1. Create: CE to EE update guide in EE repository for latest version. +1. Update: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.0-to-6.x.md to latest version. -It's best to copy paste the previous guide and make changes where necessary. The typical steps are listed below with any points you should specifically look at. +It's best to copy paste the previous guide and make changes where necessary. +The typical steps are listed below with any points you should specifically look at. #### 0. Any major changes? -List any major changes here, so the user is aware of them before starting to upgrade. For instance: + +List any major changes here, so the user is aware of them before starting to upgrade. For instance: + - Database updates - Web server changes - File structure changes @@ -52,42 +66,43 @@ List any major changes here, so the user is aware of them before starting to upg Check if any of these changed since last release: -* https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab -* https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example -* https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/gitlab.yml.example -* https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/unicorn.rb.example -* https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/database.yml.mysql -* https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/database.yml.postgresql +- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab> +- <https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example> +- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/gitlab.yml.example> +- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/unicorn.rb.example> +- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/database.yml.mysql> +- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/database.yml.postgresql> #### 8. Need to update init script? -Check if the init.d/gitlab script changed since last release: https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab +Check if the `init.d/gitlab` script changed since last release: <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab> #### 9. Start application #### 10. Check application status -### **4. Code quality indicatiors** +### **4. Code quality indicators** + Make sure the code quality indicators are green / good. -* [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) +- [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) -* [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://travis-ci.org/gitlabhq/gitlabhq) on travis-ci.org (master branch) +- [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://travis-ci.org/gitlabhq/gitlabhq) on travis-ci.org (master branch) -* [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.png)](https://codeclimate.com/github/gitlabhq/gitlabhq) +- [![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) this button can be yellow (small updates are available) but must not be red (a security fix or an important update is available) +- [![Dependency Status](https://gemnasium.com/gitlabhq/gitlabhq.png)](https://gemnasium.com/gitlabhq/gitlabhq) this button can be yellow (small updates are available) but must not be red (a security fix or an important update is available) -* [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) +- [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) ### **5. Set VERSION** -Set VERSION tot x.x.0.rc1 - +Change version in VERSION to `x.x.0.rc1`. ### **6. Tag** -Create an annotated tag that points to the version change commit. +Create an annotated tag that points to the version change commit: + ``` git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1' ``` @@ -98,16 +113,38 @@ Tweet about the RC release: > GitLab x.x.x.rc1 is out. This is a release candidate intended for testing only. Please let us know if you find regressions. -### **8. Update Cloud** +n +### **8. Update GitLab.com** -Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. +Merge the RC1 code into GitLab.com. Once the build is green, deploy in the morning. It is important to do this as soon as possible, so we can catch any errors before we release the full version. +# **21st - Preparation ** + +### **1. Prepare the blog post** + +- Check the changelog of CE and EE for important changes. Based on [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) fill in the important information. +- Create a WIP MR for the blog post and cc the team so everyone can give feedback. +- Ask Dmitriy to add screenshots to the WIP MR. +- Decide with team who will be the MVP user. +- Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. + +### **2. Q&A** + +Create issue on dev.gitlab.org `gitlab` repository, named "GitLab X.X release" in order to keep track of the progress. + +Use the omnibus packages of Enterprise Edition using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md). + +**NOTE** Upgrader can only be tested when tags are pushed to all repositories. Do not forget to confirm it is working before releasing. Note that in the issue. + +### **3. Fix anything coming out of the QA** + +Create an issue with description of a problem, if it is quick fix fix yourself otherwise contact the team for advice. # **22nd - Release CE and EE** -For GitLab EE, append -ee to the branches and tags. +For GitLab EE, append `-ee` to the branches and tags. `x-x-stable-ee` @@ -123,45 +160,80 @@ git push <remote> x-x-stable ``` ### **2. Build the Omnibus packages** + [Follow this guide](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md) -### **3. QA** -Use the omnibus packages to test using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md) +### **3. Set VERSION to x.x.x and push** + +Change the GITLAB_SHELL_VERSION file in `master` of the CE repository if the version changed. +Change the GITLAB_SHELL_VERSION file in `master` of the EE repository if the version changed. -### **4. Fix anything coming out of the QA** +Change the VERSION file in `master` branch of the CE repository and commit. Cherry-pick into the `x-x-stable` branch of CE. -### **5. Set VERSION to x.x.0** +Change the VERSION file in `master` branch of the EE repository and commit. Cherry-pick into the `x-x-stable-ee` branch of EE. + +### **4. Create annotated tag vx.x.x** + +In `x-x-stable` branch check for the SHA-1 of the commit with VERSION file changed. Tag that commit, -### **6. Create annotated tag vx.x.0** ``` -git tag -a vx.x.0 -m 'Version x.x.0' +git tag -a vx.x.0 -m 'Version x.x.0' xxxxx ``` -### **7. Push VERSION + Tag to master, merge into x-x-stable** +where `xxxxx` is SHA-1. + +### **5. Push the tag** + ``` -git push origin master +git push origin vx.x.0 ``` -Next, merge the VERSION into the x-x-stable branch. - -### **8. Push to remotes** +### **6. Push to remotes** For GitLab CE, push to dev, GitLab.com and GitHub. For GitLab EE, push to the subscribers repo. +Make sure the branch is marked 'protected' on each of the remotes you pushed to. + NOTE: You might not have the rights to push to master on dev. Ask Dmitriy. -### **9. Publish blog for new release** -* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. -* Select and thank the the Most Valuable Person (MVP) of this release. -* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. +### **7. Publish blog for new release** + +Merge the [blog merge request](#1-prepare-the-blog-post) in `www-gitlab-com` repository. -### **10. Tweet to blog** +### **8. Tweet to blog** Send out a tweet to share the good news with the world. List the features in short and link to the blog post. +Proposed tweet for CE "GitLab X.X.X CE is released! It brings *** <link-to-blogpost>" + +Proposed tweet for EE "GitLab X.X.X EE is released! It brings *** <link-to-blogpost>" + +### **9. Send out newsletter** + +In MailChimp replicate the former release newsletters to customers / newsletter subscribers (these are two separate things) and modify them accordingly. + +Include a link to the blog post and keep it short. + +Proposed email for CE: "We have released a new version of GitLab Community Edition and its packages. See our blog post(<link>) for more information." + +### **10. Create a regressions issue** + +On [the GitLab CE issue tracker on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/issues/) create an issue titled "GitLab X.X regressions" add the following text: + +This is a meta issue to discuss possible regressions in this monthly release and any patch versions. +Please do not raise issues directly in this issue but link to issues that might warrant a patch release. +The decision to create a patch release or not is with the release manager who is assigned to this issue. +The release manager will comment here about the plans for patch releases. + +Assign the issue to the release manager and /cc all the core-team members active on the issue tracker. If there are any known bugs in the release add them immediately. + # **23rd - Optional Patch Release** +# **24th - Update GitLab.com** + +Merge the stable release into GitLab.com. Once the build is green deploy the next morning. + # **25th - Release GitLab CI** diff --git a/doc/release/patch.md b/doc/release/patch.md index 30bb39b4e49..7762c9f0e11 100644 --- a/doc/release/patch.md +++ b/doc/release/patch.md @@ -1,25 +1,30 @@ # Things to do when doing a patch release + NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). ## When to do a patch release -Do a patch release when there is a critical regression that needs to be adresses before the next monthly release. +Do a patch release when there is a critical regression that needs to be addresses before the next monthly release. + Otherwise include it in the monthly release and note there was a regression fix in the release announcement. ## Release Procedure -1. Verify that the issue can be repoduced +1. Verify that the issue can be reproduced +1. Note in the 'GitLab X.X regressions' that you will create a patch 1. Create an issue on private GitLab development server 1. Name the issue "Release X.X.X CE and X.X.X EE", this will make searching easier 1. Fix the issue on a feature branch, do this on the private GitLab development server 1. Consider creating and testing workarounds 1. After the branch is merged into master, cherry pick the commit(s) into the current stable branch -1. In a separate commit in the stable branch, update the VERSION and CHANGELOG +1. In a separate commit in the stable branch update the CHANGELOG 1. For EE, update the CHANGELOG-EE if it is EE specific fix. Otherwise, merge the stable CE branch and add to CHANGELOG-EE "Merge community edition changes for version X.X.X" -1. Create an annotated tag vX.X.X for CE and another patch release for EE -1. Make sure that the build has passed and no tests are failing +1. In a separate commit in the stable branch update the VERSION +1. Create an annotated tag vX.X.X for CE and another patch release for EE `git tag -a vx.x.x -m 'Version x.x.x'` +1. Make sure that the build has passed and all tests are passing 1. Push the code and the tags to all the CE and EE repositories 1. Apply the patch to GitLab Cloud and the private GitLab development server -1. Send tweets about the release from @gitlabhq, tweet should include the most important feature that the release is addressing as well as the link to the changelog -1. Build new packages with the latest version - +1. [Build new packages with the latest version](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md) +1. Cherry-pick the changelog update back into master +1. Send tweets about the release from `@gitlabhq`, tweet should include the most important feature that the release is addressing as well as the link to the changelog +1. Note in the 'GitLab X.X regressions' issue that the patch was published(CE only) diff --git a/doc/release/security.md b/doc/release/security.md index 2fe0a948ad2..5265ca82eba 100644 --- a/doc/release/security.md +++ b/doc/release/security.md @@ -1,48 +1,51 @@ # Things to do when doing an out-of-bound security release + NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). ## When to do a security release -Do a security release when there is a critical issue that needs to be adresses before the next monthly release. Otherwise include it in the monthly release and note there was a security fix in the release announcement. +Do a security release when there is a critical issue that needs to be addresses before the next monthly release. Otherwise include it in the monthly release and note there was a security fix in the release announcement. ## Security vulnerability disclosure -Please report suspected security vulnerabilities in private to support@gitlab.com, also see the [disclosure section on the GitLab.com website](http://www.gitlab.com/disclosure/). Please do NOT create publicly viewable issues for suspected security vulnerabilities. +Please report suspected security vulnerabilities in private to <support@gitlab.com>, also see the [disclosure section on the GitLab.com website](http://www.gitlab.com/disclosure/). Please do NOT create publicly viewable issues for suspected security vulnerabilities. ## Release Procedure -1. Verify that the issue can be repoduced +1. Verify that the issue can be reproduced 1. Acknowledge the issue to the researcher that disclosed it 1. Do the steps from [patch release document](doc/release/patch.md), starting with "Create an issue on private GitLab development server" 1. Create feature branches for the blog post on GitLab.com and link them from the code branch 1. Merge and publish the blog posts -1. Send tweets about the release from @gitlabhq +1. Send tweets about the release from `@gitlabhq` 1. Send out an email to the subscribers mailing list on MailChimp 1. Send out an email to [the community google mailing list](https://groups.google.com/forum/#!forum/gitlabhq) 1. Send out an email to [the GitLab newsletter list](http://gitlab.us5.list-manage.com/subscribe?u=498dccd07cf3e9482bee33ba4&id=98a9a4992c) 1. Post a signed copy of our complete announcement to [oss-security](http://www.openwall.com/lists/oss-security/) and request a CVE number 1. Add the security researcher to the [Security Researcher Acknowledgments list](http://www.gitlab.com/vulnerability-acknowledgements/) 1. Thank the security researcher in an email for their cooperation -1. Update the blogpost and the CHANGELOG when we receive the CVE number +1. Update the blog post and the CHANGELOG when we receive the CVE number The timing of the code merge into master should be coordinated in advance. + After the merge we strive to publish the announcements within 60 minutes. ## Blog post template XXX Security Advisory for GitLab -A recently discovered critical vulnerability in GitLab allows [unauthenticated API access|remote code execution|unauthorized access to repositories|XXX|PICKSOMETHING]. All users should update GitLab and gitlab-shell immediately. -We [have|haven't|XXX|PICKSOMETHING|] heard of this vulnerability being actively exploited. +A recently discovered critical vulnerability in GitLab allows [unauthenticated API access|remote code execution|unauthorized access to repositories|XXX|PICKSOMETHING]. All users should update GitLab and gitlab-shell immediately. We [have|haven't|XXX|PICKSOMETHING|] heard of this vulnerability being actively exploited. ### Version affected GitLab Community Edition XXX and lower + GitLab Enterprise Edition XXX and lower ### Fixed versions GitLab Community Edition XXX and up + GitLab Enterprise Edition XXX and up ### Impact diff --git a/doc/security/README.md b/doc/security/README.md index f8dd1291b9b..b89e8cbe020 100644 --- a/doc/security/README.md +++ b/doc/security/README.md @@ -1,2 +1,4 @@ -+ [Password length limits](password_length_limits.md) -+ [Rack attack](rack_attack.md) +# Security + +- [Password length limits](password_length_limits.md) +- [Rack attack](rack_attack.md) diff --git a/doc/security/password_length_limits.md b/doc/security/password_length_limits.md index c8d66e9636c..d21b26a43e8 100644 --- a/doc/security/password_length_limits.md +++ b/doc/security/password_length_limits.md @@ -1,6 +1,7 @@ # Custom password length limits If you want to enforce longer user passwords you can create an extra Devise initializer with the steps below. + If you do not use the `devise_password_length.rb` initializer the password length is set to a minimum of 8 characters in `config/initializers/devise.rb`. ```bash diff --git a/doc/security/rack_attack.md b/doc/security/rack_attack.md index a0d02b1650f..92066997be8 100644 --- a/doc/security/rack_attack.md +++ b/doc/security/rack_attack.md @@ -1,19 +1,25 @@ +# Rack attack + To prevent abusive clients doing damage GitLab uses rack-attack gem. + If you installed or upgraded GitLab by following the official guides this should be enabled by default. + If you are missing `config/initializers/rack_attack.rb` the following steps need to be taken in order to enable protection for your GitLab instance: -1. In config/application.rb find and uncomment the following line: - config.middleware.use Rack::Attack -2. Rename config/initializers/rack_attack.rb.example to config/initializers/rack_attack.rb -3. Review the paths_to_be_protected and add any other path you need protecting -4. Restart GitLab instance +1. In config/application.rb find and uncomment the following line: + + config.middleware.use Rack::Attack + +1. Rename `config/initializers/rack_attack.rb.example` to `config/initializers/rack_attack.rb`. + +1. Review the `paths_to_be_protected` and add any other path you need protecting. + +1. Restart GitLab instance. -By default, user sign-in, user sign-up(if enabled) and user password reset is limited to 6 requests per minute. -After trying for 6 times, client will have to wait for the next minute to be able to try again. -These settings can be found in `config/initializers/rack_attack.rb` +By default, user sign-in, user sign-up(if enabled) and user password reset is limited to 6 requests per minute. After trying for 6 times, client will have to wait for the next minute to be able to try again. These settings can be found in `config/initializers/rack_attack.rb` If you want more restrictive/relaxed throttle rule change the `limit` or `period` values. For example, more relaxed throttle rule will be if you set limit: 3 and period: 1.second(this will allow 3 requests per second). You can also add other paths to the protected list by adding to `paths_to_be_protected` variable. If you change any of these settings do not forget to restart your GitLab instance. In case you find throttling is not enough to protect you against abusive clients, rack-attack gem offers IP whitelisting, blacklisting, Fail2ban style filter and tracking. -For more information on how to use these options check out [rack-attack README](https://github.com/kickstarter/rack-attack/blob/master/README.md).
\ No newline at end of file +For more information on how to use these options check out [rack-attack README](https://github.com/kickstarter/rack-attack/blob/master/README.md). diff --git a/doc/ssh/README.md b/doc/ssh/README.md index 76d9e8bb075..c87fffd7d2c 100644 --- a/doc/ssh/README.md +++ b/doc/ssh/README.md @@ -1,2 +1,4 @@ -+ [Deploy keys](deploy_keys.md) -+ [SSH](ssh.md) +# SSH + +- [Deploy keys](deploy_keys.md) +- [SSH](ssh.md) diff --git a/doc/ssh/deploy_keys.md b/doc/ssh/deploy_keys.md index c7125b7949e..dcca8bdc61a 100644 --- a/doc/ssh/deploy_keys.md +++ b/doc/ssh/deploy_keys.md @@ -1,12 +1,9 @@ +# Deploy keys + Deploy keys allow read-only access one or multiple projects with a single SSH key. -This is really useful for cloning repositories to your Continuous Integration (CI) server. -By using a deploy keys you don't have to setup a dummy user account. +This is really useful for cloning repositories to your Continuous Integration (CI) server. By using a deploy keys you don't have to setup a dummy user account. -If you are a project master or owner you can add a deploy key in the project settings under the section Deploy Keys. -Press the 'New Deploy Key' button and upload a public ssh key. -After this the machine that uses the corresponding private key has read-only access to the project. +If you are a project master or owner you can add a deploy key in the project settings under the section Deploy Keys. Press the 'New Deploy Key' button and upload a public ssh key. After this the machine that uses the corresponding private key has read-only access to the project. -You can't add the same deploy key twice with the 'New Deploy Key' option. -If you want to add the same key to another project please enable it in the list that says 'Deploy keys from projects available to you'. -All the deploy keys of all the projects you have access to are available. This project access can happen through being a direct member of the project or through a group. See `def accessible_deploy_keys` in `app/models/user.rb` for more information. +You can't add the same deploy key twice with the 'New Deploy Key' option. If you want to add the same key to another project please enable it in the list that says 'Deploy keys from projects available to you'. All the deploy keys of all the projects you have access to are available. This project access can happen through being a direct member of the project or through a group. See `def accessible_deploy_keys` in `app/models/user.rb` for more information. diff --git a/doc/ssh/ssh.md b/doc/ssh/ssh.md index 0a38bc16b49..d466c1bde72 100644 --- a/doc/ssh/ssh.md +++ b/doc/ssh/ssh.md @@ -1,12 +1,10 @@ -SSH key allows you to establish a secure connection between your computer and GitLab - +# SSH keys -Before generating an SSH key, check if your system already has one by running `cat ~/.ssh/id_rsa.pub` -If your see a long string starting with `ssh-rsa` or `ssh-dsa`, you can skip the ssh-keygen step. +SSH key allows you to establish a secure connection between your computer and GitLab +Before generating an SSH key, check if your system already has one by running `cat ~/.ssh/id_rsa.pub` If your see a long string starting with `ssh-rsa` or `ssh-dsa`, you can skip the ssh-keygen step. -To generate a new SSH key just open your terminal and use code below. The ssh-keygen command prompts you for a location and filename to store the key pair and for a password. -When prompted for the location and filename you can press enter to use the default. +To generate a new SSH key just open your terminal and use code below. The ssh-keygen command prompts you for a location and filename to store the key pair and for a password. When prompted for the location and filename you can press enter to use the default. It is a best practice to use a password for an SSH key but it is not required and you can skip creating a password by pressing enter. Note that the password you choose here can't be altered or retrieved. @@ -20,5 +18,4 @@ Use the code below to show your public key. cat ~/.ssh/id_rsa.pub ``` -Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. -Please copy the complete key starting with `ssh-` and ending with your username and host. +Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. Please copy the complete key starting with `ssh-` and ending with your username and host. diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md index 5c8daf466ab..47f17c1a080 100644 --- a/doc/system_hooks/system_hooks.md +++ b/doc/system_hooks/system_hooks.md @@ -1,8 +1,10 @@ +# System hooks + Your GitLab instance can perform HTTP POST requests on the following events: `create_project`, `delete_project`, `create_user`, `delete_user` and `change_team_member`. System hooks can be used, e.g. for logging or changing information in a LDAP server. -#### Hooks request example: +## Hooks request example **Project created:** @@ -71,23 +73,23 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser **User created:** ```json -{ +{ "created_at": "2012-07-21T07:44:07Z", "email": "js@gitlabhq.com", "event_name": "user_create", - "name": "John Smith", - "user_id": 41 + "name": "John Smith", + "user_id": 41 } ``` **User removed:** ```json -{ +{ "created_at": "2012-07-21T07:44:07Z", "email": "js@gitlabhq.com", "event_name": "user_destroy", "name": "John Smith", - "user_id": 41 + "user_id": 41 } ``` diff --git a/doc/update/2.6-to-3.0.md b/doc/update/2.6-to-3.0.md index d7047d8eb19..6aabbe095dc 100644 --- a/doc/update/2.6-to-3.0.md +++ b/doc/update/2.6-to-3.0.md @@ -1,10 +1,10 @@ # From 2.6 to 3.0 -### 1. Stop server & resque +## 1. Stop server & resque sudo service gitlab stop -### 2. Update code & db +## 2. Update code & db ```bash @@ -54,10 +54,8 @@ sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\\1'\.\*'/g" /home/g # Check app status sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production - ``` - -### 3. Start all +## 3. Start all sudo service gitlab start diff --git a/doc/update/2.9-to-3.0.md b/doc/update/2.9-to-3.0.md index af929e027a4..8af86b0dc98 100644 --- a/doc/update/2.9-to-3.0.md +++ b/doc/update/2.9-to-3.0.md @@ -1,10 +1,10 @@ # From 2.9 to 3.0 -### 1. Stop server & resque +## 1. Stop server & resque sudo service gitlab stop -### 2. Follow instructions +## 2. Follow instructions ```bash @@ -31,7 +31,6 @@ sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\\1"\.\*"/g' /home sudo -u gitlab -H bundle exec rake gitlab:app:status RAILS_ENV=production ``` - -### 3. Start all +## 3. Start all sudo service gitlab start diff --git a/doc/update/3.0-to-3.1.md b/doc/update/3.0-to-3.1.md index 5f06f818d10..3206df3499b 100644 --- a/doc/update/3.0-to-3.1.md +++ b/doc/update/3.0-to-3.1.md @@ -1,26 +1,22 @@ # From 3.0 to 3.1 -__IMPORTANT!__ +**IMPORTANT!** -In this release __we moved Resque jobs under own gitlab namespace__. +In this release **we moved Resque jobs under own gitlab namespace** -Despite a lot of advantages it requires from our users to __replace gitolite post-receive hook with new one__. +Despite a lot of advantages it requires from our users to **replace gitolite post-receive hook with new one**. -Most of projects has post-receive file as symlink to gitolite `/home/git/.gitolite/hooks/post-receive`. -But some of them may have a real file. In this case you should rewrite it with symlink to gitolite hook. +Most of projects has post-receive file as symlink to gitolite `/home/git/.gitolite/hooks/post-receive`. But some of them may have a real file. In this case you should rewrite it with symlink to gitolite hook. I wrote a bash script which will do it automatically for you. Just make sure all path inside is valid for you -- - - - -### 1. Stop server & resque +## 1. Stop server & resque sudo service gitlab stop -### 2. Update GitLab +## 2. Update GitLab ```bash - # Get latest code sudo -u gitlab -H git fetch sudo -u gitlab -H git checkout v3.1.0 @@ -35,12 +31,11 @@ sudo -u gitlab -H bundle install --without development test postgres sqlite # Migrate db sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production - ``` -### 3. Update post-receive hooks +## 3. Update post-receive hooks -#### Gitolite 3 +### Gitolite 3 Step 1: Rewrite post-receive hook @@ -60,7 +55,7 @@ sudo -u gitlab -H vim lib/support/rewrite-hooks.sh sudo -u git -H lib/support/rewrite-hooks.sh ``` -#### Gitolite v2 +### Gitolite v2 Step 1: rewrite post-receive hook for gitolite 2 @@ -71,7 +66,6 @@ sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive Step 2: Replace symlinks in project to valid place - #!/bin/bash src="/home/git/repositories" for dir in `ls "$src/"` @@ -90,19 +84,13 @@ Step 2: Replace symlinks in project to valid place fi done - -### 4. Check app status +## 4. Check app status ```bash - # Check APP Status sudo -u gitlab -H bundle exec rake gitlab:app:status RAILS_ENV=production - - - ``` - -### 5. Start all +## 5. Start all sudo service gitlab start diff --git a/doc/update/3.1-to-4.0.md b/doc/update/3.1-to-4.0.md index c5ae3a40a76..165f4e6a308 100644 --- a/doc/update/3.1-to-4.0.md +++ b/doc/update/3.1-to-4.0.md @@ -2,25 +2,22 @@ ## Important changes -* Support for SQLite was dropped -* Support for gitolite 2 was dropped -* Projects are organized in namespaces -* The GitLab post-receive hook needs to be updated -* The configuration file needs to be updated -* Availability of `python2` executable +- Support for SQLite was dropped +- Support for Gitolite 2 was dropped +- Projects are organized in namespaces +- The GitLab post-receive hook needs to be updated +- The configuration file needs to be updated +- Availability of `python2` executable -Most of projects has post-receive file as symlink to gitolite `/home/git/.gitolite/hooks/post-receive`. -But some of them may have a real file. In this case you should rewrite it with symlink to gitolite hook. +Most of projects has post-receive file as symlink to Gitolite `/home/git/.gitolite/hooks/post-receive`. But some of them may have a real file. In this case you should rewrite it with symlink to Gitolite hook. I wrote a bash script which will do it automatically for you. Just make sure all path inside is valid for you -- - - - -### 1. Stop GitLab & Resque +## 1. Stop GitLab & Resque sudo service gitlab stop -### 2. Update GitLab +## 2. Update GitLab ```bash @@ -43,8 +40,7 @@ sudo -u gitlab -H bundle exec rake gitlab:enable_namespaces RAILS_ENV=production ``` -### 3. Update post-receive hooks (Requires gitolite v3 ) - +## 3. Update post-receive hooks (Requires Gitolite v3 ) Step 1: Rewrite post-receive hook @@ -63,9 +59,7 @@ sudo -u gitlab -H vim lib/support/rewrite-hooks.sh sudo -u git -H lib/support/rewrite-hooks.sh ``` - -### 4. Replace config with new one - +## 4. Replace config with new one # backup old one sudo -u gitlab -H cp config/gitlab.yml config/gitlab.yml.old @@ -76,9 +70,7 @@ sudo -u git -H lib/support/rewrite-hooks.sh # edit it sudo -u gitlab -H vim config/gitlab.yml - -### 5. Disable ssh known_host check for own domain - +## 5. Disable ssh known_host check for own domain echo "Host localhost StrictHostKeyChecking no @@ -88,12 +80,10 @@ sudo -u git -H lib/support/rewrite-hooks.sh StrictHostKeyChecking no UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config - -### 6. Check GitLab's status +## 6. Check GitLab's status sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production - -### 7. Start GitLab & Resque +## 7. Start GitLab & Resque sudo service gitlab start diff --git a/doc/update/4.0-to-4.1.md b/doc/update/4.0-to-4.1.md index 324af7597b2..d5e5d62fb15 100644 --- a/doc/update/4.0-to-4.1.md +++ b/doc/update/4.0-to-4.1.md @@ -2,18 +2,16 @@ ## Important changes -* Resque replaced with Sidekiq -* New options for configuration file added -* Init.d script should be updated -* __requires ruby1.9.3-p327__ +- Resque replaced with Sidekiq +- New options for configuration file added +- Init.d script should be updated +- **requires ruby1.9.3-p327** -- - - - -### 1. Stop GitLab & Resque +## 1. Stop GitLab & Resque sudo service gitlab stop -### 2. Update GitLab +## 2. Update GitLab ```bash # Set the working directory @@ -31,7 +29,7 @@ sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production ``` -### 3. Replace init.d script with a new one +## 3. Replace init.d script with a new one ``` # backup old one @@ -43,15 +41,15 @@ sudo chmod +x /etc/init.d/gitlab ``` -### 4. Check GitLab's status +## 4. Check GitLab's status sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production -### 5. Start GitLab & Sidekiq +## 5. Start GitLab & Sidekiq sudo service gitlab start -### 6. Remove old init.d script +## 6. Remove old init.d script sudo rm /etc/init.d/gitlab.old diff --git a/doc/update/4.1-to-4.2.md b/doc/update/4.1-to-4.2.md index 3aaf17b7727..5ee8e8781e9 100644 --- a/doc/update/4.1-to-4.2.md +++ b/doc/update/4.1-to-4.2.md @@ -1,10 +1,10 @@ # From 4.1 to 4.2 -### 1. Stop server & resque +## 1. Stop server & Resque sudo service gitlab stop -### 2. Update code & db +## 2. Update code & DB ```bash @@ -24,15 +24,12 @@ sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production ``` - -### 3. Check GitLab's status +## 3. Check GitLab's status ```bash sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production ``` - - -### 4. Start all +## 4. Start all sudo service gitlab start diff --git a/doc/update/4.2-to-5.0.md b/doc/update/4.2-to-5.0.md index f8fb607e016..230c1e88b23 100644 --- a/doc/update/4.2-to-5.0.md +++ b/doc/update/4.2-to-5.0.md @@ -1,32 +1,32 @@ # From 4.2 to 5.0 ## Warning + GitLab 5.0 is affected by critical security vulnerability CVE-2013-4490. ## Important changes -* We don't use `gitlab` user any more. Everything will be moved to `git` user -* __requires ruby1.9.3__ - +- We don't use `gitlab` user any more. Everything will be moved to `git` user +- **requires ruby1.9.3** -__0. Stop gitlab__ +## 0. Stop gitlab sudo service gitlab stop -__1. add bash to git user__ +## 1. add bash to git user ``` sudo chsh -s /bin/bash git ``` -__2. git clone gitlab-shell__ +## 2. git clone gitlab-shell ``` cd /home/git/ sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git /home/git/gitlab-shell ``` -__3. setup gitlab-shell__ +## 3. setup gitlab-shell ```bash # chmod all repos and files under git @@ -55,7 +55,7 @@ ruby -v exit ``` -__4. Copy gitlab instance to git user__ +## 4. Copy gitlab instance to git user ```bash sudo cp -R /home/gitlab/gitlab /home/git/gitlab @@ -66,7 +66,7 @@ sudo rm -rf /home/gitlab/gitlab-satellites sudo rm /tmp/gitlab.socket ``` -__5. Update gitlab to recent version__ +## 5. Update gitlab to recent version ```bash cd /home/git/gitlab @@ -110,7 +110,7 @@ sudo chmod -R u+rwX /home/git/gitlab/tmp/pids ``` -__6. Update init.d script and nginx config__ +## 6. Update init.d script and nginx config ```bash # init.d @@ -127,14 +127,11 @@ sudo -u git -H cp /home/git/gitlab/config/unicorn.rb.example /home/git/gitlab/co sudo vim /etc/nginx/sites-enabled/gitlab sudo service nginx restart - ``` -__7. Start gitlab instance__ +## 7. Start GitLab instance ``` - - sudo service gitlab start # check if unicorn and sidekiq started @@ -145,7 +142,7 @@ ps aux | grep sidekiq ``` -__8. Check installation__ +## 8. Check installation ```bash @@ -164,5 +161,4 @@ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` - -__P.S. If everything works as expected you can remove gitlab user from system__ +**P.S. If everything works as expected you can remove gitlab user from system** diff --git a/doc/update/5.0-to-5.1.md b/doc/update/5.0-to-5.1.md index ba56507dd81..628d8bc7dfa 100644 --- a/doc/update/5.0-to-5.1.md +++ b/doc/update/5.0-to-5.1.md @@ -1,18 +1,19 @@ # From 5.0 to 5.1 ## Warning + GitLab 5.1 is affected by critical security vulnerability CVE-2013-4490. -## Release notes: +## Release notes -* `unicorn` replaced with `puma` -* merge request cached diff will be truncated +- `unicorn` replaced with `puma` +- merge request cached diff will be truncated -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -20,7 +21,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 5-1-stable ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -33,8 +34,7 @@ sudo -u git -H cp config.yml.example config.yml sudo -u git -H vi config.yml ``` - -### 4. Install libs, migrations etc +## 4. Install libs, migrations etc ```bash cd /home/git/gitlab @@ -47,7 +47,7 @@ sudo -u git -H bundle exec rake migrate_merge_requests RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 5. Update init.d script with a new one +## 5. Update init.d script with a new one ```bash # init.d @@ -56,9 +56,9 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-rec sudo chmod +x /etc/init.d/gitlab ``` -### 6. Mysql grant privileges +## 6. MySQL grant privileges -Only if you are using mysql: +Only if you are using MySQL: ```bash mysql -u root -p @@ -66,6 +66,6 @@ mysql> GRANT LOCK TABLES ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; mysql> \q ``` -### 7. Start application +## 7. Start application sudo service gitlab start diff --git a/doc/update/5.1-to-5.2.md b/doc/update/5.1-to-5.2.md index 466c815195f..c37f20ce55e 100644 --- a/doc/update/5.1-to-5.2.md +++ b/doc/update/5.1-to-5.2.md @@ -1,9 +1,10 @@ # From 5.1 to 5.2 ## Warning + GitLab 5.2 is affected by critical security vulnerabilities CVE-2013-4490 and CVE-2013-4489. -### 0. Backup +## 0. Backup It's useful to make a backup just in case things go south: (With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) @@ -13,11 +14,11 @@ cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -25,7 +26,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 5-2-stable ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -33,7 +34,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.4.0 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -49,12 +50,12 @@ sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 5. Update config files +## 5. Update config files -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-2-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-2-stable/config/puma.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-2-stable/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-2-stable/config/puma.rb.example but with your settings. -### 6. Update Init script +## 6. Update Init script ```bash cd /home/git/gitlab @@ -63,7 +64,7 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 7. Create uploads directory +## 7. Create uploads directory ```bash cd /home/git/gitlab @@ -71,12 +72,12 @@ sudo -u git -H mkdir public/uploads sudo chmod -R u+rwX public/uploads ``` -### 8. Start application +## 8. Start application sudo service gitlab start sudo service nginx restart -### 9. Check application status +## 9. Check application status Check if GitLab and its environment are configured correctly: @@ -91,10 +92,10 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (5.1) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration -(The backup is already migrated to the previous version) -### 2. Restore from the backup: +Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version). + +### 2. Restore from the backup ```bash cd /home/git/gitlab diff --git a/doc/update/5.1-to-5.4.md b/doc/update/5.1-to-5.4.md index 56f4854daf0..53dbfd00ad4 100644 --- a/doc/update/5.1-to-5.4.md +++ b/doc/update/5.1-to-5.4.md @@ -1,21 +1,21 @@ # From 5.1 to 5.4 + Also works starting from 5.2. -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south (with MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version): ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -23,7 +23,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 5-4-stable # Latest version of 5-4-stable addresses CVE-2013-4489 ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -31,7 +31,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 # Addresses multiple critical security vulnerabilities ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -47,12 +47,12 @@ sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 5. Update config files +## 5. Update config files -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/puma.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/puma.rb.example but with your settings. -### 6. Update Init script +## 6. Update Init script ```bash sudo rm /etc/init.d/gitlab @@ -60,7 +60,7 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 7. Create uploads directory +## 7. Create uploads directory ```bash cd /home/git/gitlab @@ -68,13 +68,12 @@ sudo -u git -H mkdir public/uploads sudo chmod -R u+rwX public/uploads ``` - -### 8. Start application +## 8. Start application sudo service gitlab start sudo service nginx restart -### 9. Check application status +## 9. Check application status Check if GitLab and its environment are configured correctly: @@ -89,8 +88,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (5.3) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/5.1-to-6.0.md b/doc/update/5.1-to-6.0.md index 5b74b1f893d..11afc75f0f3 100644 --- a/doc/update/5.1-to-6.0.md +++ b/doc/update/5.1-to-6.0.md @@ -1,26 +1,34 @@ # From 5.1 to 6.0 ## Warning + GitLab 6.0 is affected by critical security vulnerabilities CVE-2013-4490 and CVE-2013-4489. -### Deprecations +## Deprecations -#### Global projects +### Global projects The root (global) namespace for projects is deprecated. -So you need to move all your global projects under groups or users manually before update or they will be automatically moved to the project owner namespace during the update. When a project is moved all its members will receive an email with instructions how to update their git remote url. Please make sure you disable sending email when you do a test of the upgrade. -#### Teams +So you need to move all your global projects under groups or users manually before update or they will be automatically moved to the project owner namespace during the update. When a project is moved all its members will receive an email with instructions how to update their git remote URL. Please make sure you disable sending email when you do a test of the upgrade. + +### Teams We introduce group membership in 6.0 as a replacement for teams. + The old combination of groups and teams was confusing for a lot of people. + And when the members of a team where changed this wasn't reflected in the project permissions. + In GitLab 6.0 you will be able to add members to a group with a permission level for each member. + These group members will have access to the projects in that group. + Any changes to group members will immediately be reflected in the project permissions. + You can even have multiple owners for a group, greatly simplifying administration. -### 0. Backup +## 0. Backup It's useful to make a backup just in case things go south: (With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) @@ -30,11 +38,11 @@ cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -42,7 +50,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 6-0-stable ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -50,14 +58,14 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 ``` -### 4. Install additional packages +## 4. Install additional packages ```bash # For reStructuredText markup language support install required package: sudo apt-get install python-docutils ``` -### 5. Install libs, migrations, etc. +## 5. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -83,14 +91,14 @@ sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 6. Update config files +## 6. Update config files Note: We switched from Puma in GitLab 5.x to unicorn in GitLab 6.0. -* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/unicorn.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/masterconfig/unicorn.rb.example but with your settings. -### 7. Update Init script +## 7. Update Init script ```bash cd /home/git/gitlab @@ -99,7 +107,7 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 8. Create uploads directory +## 8. Create uploads directory ```bash cd /home/git/gitlab @@ -107,12 +115,12 @@ sudo -u git -H mkdir -p public/uploads sudo chmod -R u+rwX public/uploads ``` -### 9. Start application +## 9. Start application sudo service gitlab start sudo service nginx restart -### 10. Check application status +## 10. Check application status Check if GitLab and its environment are configured correctly: @@ -127,8 +135,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (5.1) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: @@ -137,20 +145,24 @@ cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` -### Troubleshooting +## Troubleshooting + The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following commands can be run in the rails console to look for 'bad' data. -All project owners should have an owner +All project owners should have an owner: + ``` Project.all.select { |project| project.owner.blank? } ``` -Every user should have a namespace +Every user should have a namespace: + ``` User.all.select { |u| u.namespace.blank? } ``` -Projects in the global namespace should not conflict with projects in the owner namespace +Projects in the global namespace should not conflict with projects in the owner namespace: + ``` Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? } ``` diff --git a/doc/update/5.2-to-5.3.md b/doc/update/5.2-to-5.3.md index e3c3016db64..e39e18d4211 100644 --- a/doc/update/5.2-to-5.3.md +++ b/doc/update/5.2-to-5.3.md @@ -1,23 +1,23 @@ # From 5.2 to 5.3 ## Warning + GitLab 5.3 is affected by critical security vulnerabilities CVE-2013-4490 and CVE-2013-4489. -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south (with MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version): ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -25,7 +25,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 5-3-stable ``` -### 3. Install libs, migrations, etc. +## 3. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -41,12 +41,12 @@ sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 4. Update config files +## 4. Update config files -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-3-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-3-stable/config/puma.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-3-stable/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-3-stable/config/puma.rb.example but with your settings. -### 5. Update Init script +## 5. Update Init script ```bash sudo rm /etc/init.d/gitlab @@ -54,12 +54,12 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5 sudo chmod +x /etc/init.d/gitlab ``` -### 6. Start application +## 6. Start application sudo service gitlab start sudo service nginx restart -### 7. Check application status +## 7. Check application status Check if GitLab and its environment are configured correctly: @@ -74,8 +74,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (5.2) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.1 to 5.2`](5.1-to-5.2.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 5.1 to 5.2`](5.1-to-5.2.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/5.3-to-5.4.md b/doc/update/5.3-to-5.4.md index 213ce77ec38..e1749f133b3 100644 --- a/doc/update/5.3-to-5.4.md +++ b/doc/update/5.3-to-5.4.md @@ -1,20 +1,19 @@ # From 5.3 to 5.4 -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south (with MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version): ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -22,7 +21,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 5-4-stable # Latest version of 5-4-stable addresses CVE-2013-4489 ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -30,7 +29,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 # Addresses multiple critical security vulnerabilities ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -46,12 +45,12 @@ sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 5. Update config files +## 5. Update config files -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/puma.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/puma.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/5-4-stable/config/puma.rb.example but with your settings. -### 6. Update Init script +## 6. Update Init script ```bash sudo rm /etc/init.d/gitlab @@ -59,12 +58,12 @@ sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5 sudo chmod +x /etc/init.d/gitlab ``` -### 7. Start application +## 7. Start application sudo service gitlab start sudo service nginx restart -### 8. Check application status +## 8. Check application status Check if GitLab and its environment are configured correctly: @@ -79,8 +78,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (5.3) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/5.4-to-6.0.md b/doc/update/5.4-to-6.0.md index c289fcb57fd..7bf7bce6aa0 100644 --- a/doc/update/5.4-to-6.0.md +++ b/doc/update/5.4-to-6.0.md @@ -1,40 +1,47 @@ # From 5.4 to 6.0 ## Warning + GitLab 6.0 is affected by critical security vulnerabilities CVE-2013-4490 and CVE-2013-4489. -### Deprecations +## Deprecations -#### Global projects +### Global projects The root (global) namespace for projects is deprecated. + So you need to move all your global projects under groups or users manually before update or they will be automatically moved to the project owner namespace during the update. When a project is moved all its members will receive an email with instructions how to update their git remote url. Please make sure you disable sending email when you do a test of the upgrade. -#### Teams +### Teams We introduce group membership in 6.0 as a replacement for teams. + The old combination of groups and teams was confusing for a lot of people. + And when the members of a team where changed this wasn't reflected in the project permissions. + In GitLab 6.0 you will be able to add members to a group with a permission level for each member. + These group members will have access to the projects in that group. + Any changes to group members will immediately be reflected in the project permissions. + You can even have multiple owners for a group, greatly simplifying administration. -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south (with MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version): ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -42,7 +49,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout 6-0-stable ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -50,14 +57,14 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 ``` -### 4. Install additional packages +## 4. Install additional packages ```bash # For reStructuredText markup language support install required package: sudo apt-get install python-docutils ``` -### 5. Install libs, migrations, etc. +## 5. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -83,14 +90,14 @@ sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production ``` -### 6. Update config files +## 6. Update config files Note: We switched from Puma in GitLab 5.4 to unicorn in GitLab 6.0. -* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example but with your settings. -### 7. Update Init script +## 7. Update Init script ```bash sudo rm /etc/init.d/gitlab @@ -98,12 +105,12 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 8. Start application +## 8. Start application sudo service gitlab start sudo service nginx restart -### 9. Check application status +## 9. Check application status Check if GitLab and its environment are configured correctly: @@ -115,20 +122,24 @@ To make sure you didn't miss anything run a more thorough check with: If all items are green, then congratulations upgrade complete! -### Troubleshooting +## Troubleshooting + The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following commands can be run in the rails console to look for 'bad' data. -All project owners should have an owner +All project owners should have an owner: + ``` Project.all.select { |project| project.owner.blank? } ``` -Every user should have a namespace +Every user should have a namespace: + ``` User.all.select { |u| u.namespace.blank? } ``` -Projects in the global namespace should not conflict with projects in the owner namespace +Projects in the global namespace should not conflict with projects in the owner namespace: + ``` Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? } ``` diff --git a/doc/update/6.0-to-6.1.md b/doc/update/6.0-to-6.1.md index b4cc9203587..36c7f04f635 100644 --- a/doc/update/6.0-to-6.1.md +++ b/doc/update/6.0-to-6.1.md @@ -1,32 +1,33 @@ # From 6.0 to 6.1 ## Warning + GitLab 6.1 is affected by critical security vulnerabilities CVE-2013-4490 and CVE-2013-4489. -# In 6.1 we remove a lot of deprecated code. -# You should update to 6.0 before installing 6.1 so all the necessary conversions are run. +**In 6.1 we remove a lot of deprecated code.** + +**You should update to 6.0 before installing 6.1 so all the necessary conversions are run.** -### Deprecations +## Deprecations -#### Global issue numbers +### Global issue numbers -In 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their url. If you use an old issue number url and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects. +In 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their URL. If you use an old issue number URL and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects. -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south (with MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version): ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -35,7 +36,7 @@ sudo -u git -H git checkout 6-1-stable # For GitLab Enterprise Edition: sudo -u git -H git checkout 6-1-stable-ee ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -43,7 +44,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -62,12 +63,12 @@ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production ``` -### 5. Update config files +## 5. Update config files -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-1-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-1-stable/config/unicorn.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-1-stable/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-1-stable/config/unicorn.rb.example but with your settings. -### 6. Update Init script +## 6. Update Init script ```bash sudo rm /etc/init.d/gitlab @@ -75,12 +76,12 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 7. Start application +## 7. Start application sudo service gitlab start sudo service nginx restart -### 8. Check application status +## 8. Check application status Check if GitLab and its environment are configured correctly: @@ -96,8 +97,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (6.0) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/6.0-to-6.8.md b/doc/update/6.0-to-7.0.md index 5c71e99aa52..b73adc8cfb3 100644 --- a/doc/update/6.0-to-6.8.md +++ b/doc/update/6.0-to-7.0.md @@ -1,15 +1,14 @@ -# From 6.0 to 6.8 +# From 6.0 to 7.0 -# In 6.1 we remove a lot of deprecated code. -# You should update to 6.0 before installing 6.1 or higher so all the necessary conversions are run. +## Deprecations -### Deprecations +The 'Wall' feature has been removed in GitLab 7.0. Existing wall comments will remain stored in the database after the upgrade. -#### Global issue numbers +## Global issue numbers -As of 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their url. If you use an old issue number url and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects. +As of 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their URL. If you use an old issue number URL and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects. -### 0. Backup +## 0. Backup It's useful to make a backup just in case things go south: (With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) @@ -19,21 +18,21 @@ cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab sudo -u git -H git fetch --all ``` -For Gitlab Community Edition: +For GitLab Community Edition: ```bash -sudo -u git -H git checkout 6-8-stable +sudo -u git -H git checkout 7-0-stable ``` OR @@ -41,18 +40,18 @@ OR For GitLab Enterprise Edition: ```bash -sudo -u git -H git checkout 6-8-stable-ee +sudo -u git -H git checkout 7-0-stable-ee ``` -### 3. Install additional packages +## 3. Install additional packages ```bash # Add support for lograte for better log file handling sudo apt-get install logrotate ``` -### 4. Update gitlab-shell +## 4. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -60,7 +59,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.9.3 # Addresses multiple critical security vulnerabilities ``` -### 5. Install libs, migrations, etc. +## 5. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -85,17 +84,17 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites ``` -### 6. Update config files +## 6. Update config files TIP: to see what changed in gitlab.yml.example in this release use next command: ``` -git diff 6-0-stable:config/gitlab.yml.example 6-8-stable:config/gitlab.yml.example +git diff 6-0-stable:config/gitlab.yml.example 7-0-stable:config/gitlab.yml.example ``` -* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/unicorn.rb.example but with your settings. -* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/lib/support/nginx/gitlab but with your settings. +* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/config/unicorn.rb.example but with your settings. +* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings. * Copy rack attack middleware config ```bash @@ -108,18 +107,18 @@ sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab ``` -### 7. Update Init script +## 7. Update Init script ```bash sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` -### 8. Start application +## 8. Start application sudo service gitlab start sudo service nginx restart -### 9. Check application status +## 9. Check application status Check if GitLab and its environment are configured correctly: @@ -135,8 +134,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (6.0) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: @@ -146,4 +145,5 @@ sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` ## Login issues after upgrade? -If running in https mode, be sure to read [Can't Verify csrf token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page) + +If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page) diff --git a/doc/update/6.1-to-6.2.md b/doc/update/6.1-to-6.2.md index c618e599dcb..9ab53aae24b 100644 --- a/doc/update/6.1-to-6.2.md +++ b/doc/update/6.1-to-6.2.md @@ -1,22 +1,21 @@ # From 6.1 to 6.2 -# You should update to 6.1 before installing 6.2 so all the necessary conversions are run. +**You should update to 6.1 before installing 6.2 so all the necessary conversions are run.** -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south: (With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version). ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -25,7 +24,7 @@ sudo -u git -H git checkout 6-2-stable # Latest version of 6-2-stable addresses # For GitLab Enterprise Edition: sudo -u git -H git checkout 6-2-stable-ee ``` -### 3. Update gitlab-shell +## 3. Update gitlab-shell ```bash cd /home/git/gitlab-shell @@ -33,14 +32,14 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 # Addresses multiple critical security vulnerabilities ``` -### 4. Install additional packages +## 4. Install additional packages ```bash # Add support for lograte for better log file handling sudo apt-get install logrotate ``` -### 5. Install libs, migrations, etc. +## 5. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -58,29 +57,33 @@ sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production ``` -### 6. Update config files +## 6. Update config files -TIP: to see what changed in gitlab.yml.example in this release use next command: +TIP: to see what changed in `gitlab.yml.example` in this release use next command: ``` git diff 6-1-stable:config/gitlab.yml.example 6-2-stable:config/gitlab.yml.example ``` -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-2-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-2-stable/config/unicorn.rb.example but with your settings. -* Copy rack attack middleware config +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-2-stable/config/gitlab.yml.example but with your settings. -```bash -sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb -``` -* Uncomment `config.middleware.use Rack::Attack` in `/home/git/gitlab/config/application.rb` -* Set up logrotate +- Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-2-stable/config/unicorn.rb.example but with your settings. + +- Copy rack attack middleware config: + + ```bash + sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb + ``` + +- Uncomment `config.middleware.use Rack::Attack` in `/home/git/gitlab/config/application.rb` + +- Set up logrotate. ```bash sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab ``` -### 7. Update Init script +## 7. Update Init script ```bash sudo rm /etc/init.d/gitlab @@ -88,12 +91,12 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 8. Start application +## 8. Start application sudo service gitlab start sudo service nginx restart -### 9. Check application status +## 9. Check application status Check if GitLab and its environment are configured correctly: @@ -108,8 +111,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (6.1) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.0 to 6.1`](6.0-to-6.1.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 6.0 to 6.1`](6.0-to-6.1.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/6.2-to-6.3.md b/doc/update/6.2-to-6.3.md index 7f916047369..dfe2e551b36 100644 --- a/doc/update/6.2-to-6.3.md +++ b/doc/update/6.2-to-6.3.md @@ -1,22 +1,21 @@ # From 6.2 to 6.3 -## Requires version: 6.1 or 6.2 +**Requires version: 6.1 or 6.2.** -### 0. Backup +## 0. Backup -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) +It's useful to make a backup just in case things go south: (With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -25,7 +24,7 @@ sudo -u git -H git checkout 6-3-stable # For GitLab Enterprise Edition: sudo -u git -H git checkout 6-3-stable-ee ``` -### 3. Update gitlab-shell (and its config) +## 3. Update gitlab-shell (and its config) ```bash cd /home/git/gitlab-shell @@ -33,9 +32,9 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.7.9 # Addresses multiple critical security vulnerabilities ``` -The Gitlab-shell config changed recently, so check for config file changes and make `/home/git/gitlab-shell/config.yml` the same as https://github.com/gitlabhq/gitlab-shell/blob/master/config.yml.example +The Gitlab-shell config changed recently, so check for config file changes and make `/home/git/gitlab-shell/config.yml` the same as <https://github.com/gitlabhq/gitlab-shell/blob/master/config.yml.example> -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -54,7 +53,7 @@ sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production ``` -### 5. Update config files +## 5. Update config files TIP: to see what changed in gitlab.yml.example in this release use next command: @@ -62,8 +61,8 @@ TIP: to see what changed in gitlab.yml.example in this release use next command: git diff 6-2-stable:config/gitlab.yml.example 6-3-stable:config/gitlab.yml.example ``` -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-3-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-3-stable/config/unicorn.rb.example but with your settings. +- Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-3-stable/config/gitlab.yml.example but with your settings. +- Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-3-stable/config/unicorn.rb.example but with your settings. ```bash # Copy rack attack middleware config @@ -71,19 +70,19 @@ cd /home/git/gitlab sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb ``` -### 6. Update Init script +## 6. Update Init script ```bash sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab ``` -### 7. Start application +## 7. Start application sudo service gitlab start sudo service nginx restart -### 8. Check application status +## 8. Check application status Check if GitLab and its environment are configured correctly: @@ -98,8 +97,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (6.2) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.1 to 6.2`](6.1-to-6.2.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 6.1 to 6.2`](6.1-to-6.2.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/6.3-to-6.4.md b/doc/update/6.3-to-6.4.md index cfe75a6f149..18dce9b5f93 100644 --- a/doc/update/6.3-to-6.4.md +++ b/doc/update/6.3-to-6.4.md @@ -1,19 +1,19 @@ # From 6.3 to 6.4 -### 0. Backup +## 0. Backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server ```bash sudo service gitlab stop ```` -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -22,7 +22,7 @@ sudo -u git -H git checkout 6-4-stable # For GitLab Enterprise Edition: sudo -u git -H git checkout 6-4-stable-ee ``` -### 3. Update gitlab-shell (and its config) +## 3. Update gitlab-shell (and its config) ```bash cd /home/git/gitlab-shell @@ -30,7 +30,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.8.0 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -52,14 +52,14 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` -### 5. Start application +## 5. Start application ```bash sudo service gitlab start sudo service nginx restart ``` -### 6. Check application status +## 6. Check application status Check if GitLab and its environment are configured correctly: @@ -78,8 +78,8 @@ If all items are green, then congratulations upgrade complete! ## Things went south? Revert to previous version (6.3) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.2 to 6.3`](6.2-to-6.3.md), except for the database migration -(The backup is already migrated to the previous version) + +Follow the [`upgrade guide from 6.2 to 6.3`](6.2-to-6.3.md), except for the database migration (the backup is already migrated to the previous version). ### 2. Restore from the backup: diff --git a/doc/update/6.4-to-6.5.md b/doc/update/6.4-to-6.5.md index c88be3582cf..1a95a98b6f2 100644 --- a/doc/update/6.4-to-6.5.md +++ b/doc/update/6.4-to-6.5.md @@ -1,24 +1,24 @@ # From 6.4 to 6.5 -### 0. Backup +## 0. Backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab sudo -u git -H git fetch --all ``` -For Gitlab Community Edition: +For GitLab Community Edition: ```bash sudo -u git -H git checkout 6-5-stable @@ -32,7 +32,7 @@ For GitLab Enterprise Edition: sudo -u git -H git checkout 6-5-stable-ee ``` -### 3. Update gitlab-shell (and its config) +## 3. Update gitlab-shell (and its config) ```bash cd /home/git/gitlab-shell @@ -40,7 +40,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.8.0 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -62,12 +62,12 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` -### 5. Start application +## 5. Start application sudo service gitlab start sudo service nginx restart -### 6. Check application status +## 6. Check application status Check if GitLab and its environment are configured correctly: @@ -82,13 +82,14 @@ If all items are green, then congratulations upgrade is complete! ## Things went south? Revert to previous version (6.4) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.3 to 6.4`](6.3-to-6.4.md), except for the database migration -(The backup is already migrated to the previous version) -### 2. Restore from the backup: +Follow the [`upgrade guide from 6.3 to 6.4`](6.3-to-6.4.md), except for the database migration (the backup is already migrated to the previous version). + +### 2. Restore from the backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` + If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. diff --git a/doc/update/6.5-to-6.6.md b/doc/update/6.5-to-6.6.md index 589c18c27c2..ee6a5a9bdf2 100644 --- a/doc/update/6.5-to-6.6.md +++ b/doc/update/6.5-to-6.6.md @@ -1,24 +1,24 @@ # From 6.5 to 6.6 -### 0. Backup +## 0. Backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab sudo -u git -H git fetch --all ``` -For Gitlab Community Edition: +For GitLab Community Edition: ```bash sudo -u git -H git checkout 6-6-stable @@ -32,7 +32,7 @@ For GitLab Enterprise Edition: sudo -u git -H git checkout 6-6-stable-ee ``` -### 3. Update gitlab-shell (and its config) +## 3. Update gitlab-shell (and its config) ```bash cd /home/git/gitlab-shell @@ -40,7 +40,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.8.0 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -62,12 +62,12 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` -### 5. Start application +## 5. Start application sudo service gitlab start sudo service nginx restart -### 6. Check application status +## 6. Check application status Check if GitLab and its environment are configured correctly: @@ -82,6 +82,7 @@ If all items are green, then congratulations upgrade is complete! ## Things went south? Revert to previous version (6.5) ### 1. Revert the code to the previous version + Follow the [`upgrade guide from 6.4 to 6.5`](6.4-to-6.5.md), except for the database migration (The backup is already migrated to the previous version) @@ -91,4 +92,5 @@ Follow the [`upgrade guide from 6.4 to 6.5`](6.4-to-6.5.md), except for the data cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` + If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. diff --git a/doc/update/6.6-to-6.7.md b/doc/update/6.6-to-6.7.md index 61a63057d08..1e3b7da12d4 100644 --- a/doc/update/6.6-to-6.7.md +++ b/doc/update/6.6-to-6.7.md @@ -1,17 +1,17 @@ # From 6.6 to 6.7 -### 0. Backup +## 0. Backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab @@ -32,7 +32,7 @@ For GitLab Enterprise Edition: sudo -u git -H git checkout 6-7-stable-ee ``` -### 3. Update gitlab-shell (and its config) +## 3. Update gitlab-shell (and its config) ```bash cd /home/git/gitlab-shell @@ -40,7 +40,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.9.1 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -69,16 +69,15 @@ sudo -u git -H gzip /home/git/gitlab/log/*.log.1 sudo -u git -H gzip /home/git/gitlab-shell/gitlab-shell.log.1 # Close access to gitlab-satellites for others -sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites +sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites ``` - -### 5. Start application +## 5. Start application sudo service gitlab start sudo service nginx restart -### 6. Check application status +## 6. Check application status Check if GitLab and its environment are configured correctly: @@ -93,13 +92,14 @@ If all items are green, then congratulations upgrade is complete! ## Things went south? Revert to previous version (6.6) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.5 to 6.6`](6.5-to-6.6.md), except for the database migration -(The backup is already migrated to the previous version) -### 2. Restore from the backup: +Follow the [`upgrade guide from 6.5 to 6.6`](6.5-to-6.6.md), except for the database migration (the backup is already migrated to the previous version). + +### 2. Restore from the backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` + If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md index cb19d235819..3c98896a9b2 100644 --- a/doc/update/6.7-to-6.8.md +++ b/doc/update/6.7-to-6.8.md @@ -1,26 +1,26 @@ # From 6.7 to 6.8 -### 0. Backup +## 0. Backup ```bash cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` -### 1. Stop server +## 1. Stop server ```bash sudo service gitlab stop ``` -### 2. Get latest code +## 2. Get latest code ```bash cd /home/git/gitlab sudo -u git -H git fetch --all ``` -For Gitlab Community Edition: +For GitLab Community Edition: ```bash sudo -u git -H git checkout 6-8-stable @@ -34,7 +34,7 @@ For GitLab Enterprise Edition: sudo -u git -H git checkout 6-8-stable-ee ``` -### 3. Update gitlab-shell (and its config) +## 3. Update gitlab-shell (and its config) ```bash cd /home/git/gitlab-shell @@ -42,7 +42,7 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.9.3 ``` -### 4. Install libs, migrations, etc. +## 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab @@ -65,12 +65,12 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab # Close access to gitlab-satellites for others -sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites +sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites ``` -### 5. Update config files +## 5. Update config files -#### New configuration options for gitlab.yml +### New configuration options for gitlab.yml There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired. @@ -78,24 +78,24 @@ There are new configuration options available for gitlab.yml. View them with the git diff 6-7-stable:config/gitlab.yml.example 6-8-stable:config/gitlab.yml.example ``` -#### MySQL? Remove reaping frequency +### MySQL? Remove reaping frequency If you are using MySQL as a database, remove `reaping_frequency` from you database.yml to prevent crashes. [Relevant commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/5163a8fcb9cfd63435560fda00173b76df2ccc93). -#### HTTPS? Disable gzip +### HTTPS? Disable gzip If you are using HTTPS, disable gzip as in [this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/563fec734912d81cd7caea6fa8ec2b397fb72a9b) to prevent BREACH attacks. -#### Turn on asset compression +### Turn on asset compression To improve performance, enable gzip asset compression as seen [in this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/8af94ed75505f0253823b9b2d44320fecea5b5fb). -### 6. Start application +## 6. Start application sudo service gitlab start sudo service nginx restart -### 7. Check application status +## 7. Check application status Check if GitLab and its environment are configured correctly: @@ -110,10 +110,10 @@ If all items are green, then congratulations upgrade is complete! ## Things went south? Revert to previous version (6.7) ### 1. Revert the code to the previous version -Follow the [`upgrade guide from 6.6 to 6.7`](6.6-to-6.7.md), except for the database migration -(The backup is already migrated to the previous version) -### 2. Restore from the backup: +Follow the [`upgrade guide from 6.6 to 6.7`](6.6-to-6.7.md), except for the database migration (the backup is already migrated to the previous version). + +### 2. Restore from the backup ```bash cd /home/git/gitlab diff --git a/doc/update/6.8-to-6.9.md b/doc/update/6.8-to-6.9.md index a5e644b8a07..4a3e45ae5ee 100644 --- a/doc/update/6.8-to-6.9.md +++ b/doc/update/6.8-to-6.9.md @@ -52,6 +52,12 @@ sudo -u git -H bundle install --without development test postgres --deployment # PostgreSQL installations (note: the line below states '--without ... mysql') sudo -u git -H bundle install --without development test mysql --deployment + +# Run database migrations +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production + +# Clean up assets and cache +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production ``` ### 5. Update config files diff --git a/doc/update/6.9-to-7.0.md b/doc/update/6.9-to-7.0.md new file mode 100644 index 00000000000..d6e9c9f3155 --- /dev/null +++ b/doc/update/6.9-to-7.0.md @@ -0,0 +1,102 @@ +# From 6.9 to 7.0 + +### 0. Backup + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 1. Stop server + +```bash +sudo service gitlab stop +``` + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch --all +``` + +For Gitlab Community Edition: + +```bash +sudo -u git -H git checkout 7-0-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +sudo -u git -H git checkout 7-0-stable-ee +``` + +### 3. Update gitlab-shell (and its config) + +```bash +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v1.9.6 +``` + +### 4. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL installations (note: the line below states '--without ... postgres') +sudo -u git -H bundle install --without development test postgres --deployment + +# PostgreSQL installations (note: the line below states '--without ... mysql') +sudo -u git -H bundle install --without development test mysql --deployment + +# Run database migrations +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production + +# Clean up assets and cache +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production +``` + +### 5. Update config files + +#### New configuration options for gitlab.yml + +There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired. + +``` +git diff 6-9-stable:config/gitlab.yml.example 7-0-stable:config/gitlab.yml.example +``` + +### 6. Start application + + sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -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 + +If all items are green, then congratulations upgrade is complete! + +## Things went south? Revert to previous version (6.9) + +### 1. Revert the code to the previous version +Follow the [`upgrade guide from 6.8 to 6.9`](6.8-to-6.9.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production +``` +If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. diff --git a/doc/update/README.md b/doc/update/README.md index 9ce48a019e8..8c0cf5f7b26 100644 --- a/doc/update/README.md +++ b/doc/update/README.md @@ -1,5 +1,5 @@ -+ [The individual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update) -+ [Upgrader](upgrader.md) -+ [Ruby](ruby.md) -+ [Patch versions](patch_versions.md) -+ [MySQL to PostgreSQL](mysql_to_postgresql.md) +- [The individual upgrade guides](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update) +- [Upgrader](upgrader.md) +- [Ruby](ruby.md) +- [Patch versions](patch_versions.md) +- [MySQL to PostgreSQL](mysql_to_postgresql.md) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index acd1e33f599..05c95679673 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -1,11 +1,6 @@ # Migrating GitLab from MySQL to Postgres -If you are replacing MySQL with Postgres while keeping GitLab on the same -server all you need to do is to export from MySQL, import into Postgres and -rebuild the indexes as described below. If you are also moving GitLab to -another server, or if you are switching to omnibus-gitlab, you may want to use -a GitLab backup file. The second part of this documents explains the procedure -to do this. +If you are replacing MySQL with Postgres while keeping GitLab on the same server all you need to do is to export from MySQL, import into Postgres and rebuild the indexes as described below. If you are also moving GitLab to another server, or if you are switching to omnibus-gitlab, you may want to use a GitLab backup file. The second part of this documents explains the procedure to do this. ## Export from MySQL and import into Postgres @@ -27,36 +22,54 @@ psql -f databasename.psql -d gitlabhq_production sudo service gitlab start ``` - ## Rebuild indexes -The lanyrd database converter script does not preserve all indexes, so we have -to recreate them ourselves after migrating from MySQL. It is not necessary to -shut down GitLab for this process. +The lanyrd database converter script does not preserve all indexes, so we have to recreate them ourselves after migrating from MySQL. It is not necessary to shut down GitLab for this process. + +### For non-omnibus installations + +On non-omnibus installations (distributed using Git) we retrieve the index declarations from version control using `git stash`. ``` # Clone the database converter on your Postgres-backed GitLab server cd /tmp git clone https://github.com/gitlabhq/mysql-postgresql-converter.git -# Stash changes to db/schema.rb to make sure we can find the right index statements cd /home/git/gitlab + +# Stash changes to db/schema.rb to make sure we can find the right index statements sudo -u git -H git stash -# Generate the `CREATE INDEX CONCURRENTLY` statements based on schema.rb -cd /tmp/mysql-to-postgresql-converter -ruby index_create_statements.rb /home/git/gitlab/db/schema.rb > index_create_statements.psql +# Generate add_index.rb +ruby /tmp/mysql-postgresql-converter/add_index_statements.rb db/schema.rb > /tmp/mysql-postgresql-converter/add_index.rb + +# Create the indexes +sudo -u git -H bundle exec rails runner -e production 'eval $stdin.read' < /tmp/mysql-postgresql-converter/add_index.rb +``` + +### For omnibus-gitlab installations + +On omnibus-gitlab we need to get the index declarations from a file called `schema.rb.bundled`. For versions older than 6.9, we need to download the file. + +``` +# Clone the database converter on your Postgres-backed GitLab server +cd /tmp +/opt/gitlab/embedded/bin/git clone https://github.com/gitlabhq/mysql-postgresql-converter.git +cd /tmp/mysql-postgresql-converter + +# Download schema.rb.bundled if necessary +test -e /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled || sudo /opt/gitlab/embedded/bin/curl -o /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled https://gitlab.com/gitlab-org/gitlab-ce/raw/v6.9.1/db/schema.rb + +# Generate add_index.rb +/opt/gitlab/embedded/bin/ruby add_index_statements.rb /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled > add_index.rb -# Execute the SQL statements against the GitLab database -sudo -u git psql -f index_create_statements.psql -d gitlabhq_production +# Create the indexes +/opt/gitlab/bin/gitlab-rails runner 'eval $stdin.read' < add_index.rb ``` ## Converting a GitLab backup file from MySQL to Postgres -GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using -the lanyrd database converter we can replace a MySQL database dump inside the -tar file with a Postgres database dump. This can be useful if you are moving to -another server. +GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using the lanyrd database converter we can replace a MySQL database dump inside the tar file with a Postgres database dump. This can be useful if you are moving to another server. ``` # Stop GitLab diff --git a/doc/update/patch_versions.md b/doc/update/patch_versions.md index 2b947adaa13..c4a77d12800 100644 --- a/doc/update/patch_versions.md +++ b/doc/update/patch_versions.md @@ -1,4 +1,6 @@ -# Universal update guide for patch versions. For example from 6.2.0 to 6.2.1, also see the [semantic versioning specification](http://semver.org/). +# Universal update guide for patch versions + +For example from 6.2.0 to 6.2.1, also see the [semantic versioning specification](http://semver.org/). ### 0. Backup diff --git a/doc/update/ruby.md b/doc/update/ruby.md index e98167f6b66..d1d9d3e77f5 100644 --- a/doc/update/ruby.md +++ b/doc/update/ruby.md @@ -2,28 +2,31 @@ This guide explains how to update Ruby in case you installed it from source according to the [instructions](../install/installation.md#2-ruby). -### 1. Look for Ruby versions +## 1. Look for Ruby versions + This guide will only update `/usr/local/bin/ruby`. You can see which Ruby binaries are installed on your system by running: ```bash ls -l $(which -a ruby) ``` -### 2. Stop GitLab +## 2. Stop GitLab ```bash sudo service gitlab stop ``` -### 3. Install or update dependencies +## 3. Install or update dependencies + Here we are assuming you are using Debian/Ubuntu. ```bash sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl ``` -### 4. Download, compile and install Ruby -Find the latest stable version of Ruby 1.9 or 2.0 at https://www.ruby-lang.org/en/downloads/ . We recommend at least 2.0.0-p353, which is patched against [CVE-2013-4164](https://www.ruby-lang.org/en/news/2013/11/22/heap-overflow-in-floating-point-parsing-cve-2013-4164/). +## 4. Download, compile and install Ruby + +Find the latest stable version of Ruby 1.9 or 2.0 at <https://www.ruby-lang.org/en/downloads/>. We recommend at least 2.0.0-p353, which is patched against [CVE-2013-4164](https://www.ruby-lang.org/en/news/2013/11/22/heap-overflow-in-floating-point-parsing-cve-2013-4164/). ```bash cd /tmp @@ -36,6 +39,7 @@ sudo gem install bundler ``` ### 5. Reinstall GitLab gem bundle + Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](../install/installation.md#install-gems). ```bash @@ -44,11 +48,12 @@ sudo -u git -H rm -rf vendor/bundle # remove existing Gem bundle sudo -u git -H bundle install --deployment --without development test mysql aws # Assuming PostgreSQL ``` -### 6. Start GitLab +## 6. Start GitLab + We are now ready to restart GitLab. ```bash sudo service gitlab start ``` -### Done +## Done diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md index 72a94f67b3c..00dc87e2f99 100644 --- a/doc/update/upgrader.md +++ b/doc/update/upgrader.md @@ -1,53 +1,68 @@ -# GitLab Upgrader +# GitLab Upgrader GitLab Upgrader - a ruby script that allows you easily upgrade GitLab to latest minor version. + For example it can update your application from 6.4 to latest GitLab 6 version (like 6.6.1). -You still need to create a a backup and manually restart GitLab after runnning the script but all other operations are done by this upgrade script. + +You still need to create a backup and manually restart GitLab after running the script but all other operations are done by this upgrade script. + If you have local changes to your GitLab repository the script will stash them and you need to use `git stash pop` after running the script. -__GitLab Upgrader is available only for GitLab version 6.4.2 or higher__ +**GitLab Upgrader is available only for GitLab version 6.4.2 or higher.** -### 0. Backup +## 0. Backup cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production -### 1. Stop server +## 1. Stop server sudo service gitlab stop -### 2. Run gitlab upgrade tool +## 2. Run GitLab upgrade tool + # Starting with GitLab version 7.0 upgrader script has been moved to bin directory cd /home/git/gitlab - sudo -u git -H ruby script/upgrade.rb + if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb; else sudo -u git -H ruby script/upgrade.rb; fi # to perform a non-interactive install (no user input required) you can add -y - # sudo -u git -H ruby script/upgrade.rb -y + # if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb -y; else sudo -u git -H ruby script/upgrade.rb -y; fi -### 3. Start application +## 3. Start application sudo service gitlab start sudo service nginx restart -### 4. Check application status +## 4. Check application status -Check if GitLab and its environment are configured correctly: - - sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production - -To make sure you didn't miss anything run a more thorough check with: +Check if GitLab and its dependencies are configured correctly: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production - + If all items are green, then congratulations upgrade is complete! +## 5. Upgrade GitLab Shell (if needed) + +If the `gitlab:check` task reports an outdated version of `gitlab-shell` you should upgrade it. + +Upgrade it by running the commands below after replacing 1.9.4 with the correct version number: + +``` +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v1.9.4 +``` + +## One line upgrade command -### One line upgrade command +You've read through the entire guide and probably already did all the steps one by one. -You've read through the entire guide, and probably did all the steps manually. Here is a one liner for convenience, the next time you upgrade: +Here is a one line command with step 1 to 4 for the next time you upgrade: ```bash cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \ - sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; \ + sudo service gitlab stop; \ + if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb -y; else sudo -u git -H ruby script/upgrade.rb -y; fi; \ + sudo service gitlab start; \ sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index 4c06bc4d444..ada21d23ac3 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -1,15 +1,14 @@ +# Web hooks + Project web hooks allow you to trigger an URL if new code is pushed or a new issue is created. ---- +You can configure web hooks to listen for specific events like pushes, issues or merge requests. GitLab will send a POST request with data to the web hook URL. -You can configure web hooks to listen for specific events like pushes, issues or merge requests. -GitLab will send a POST request with data to the web hook URL. 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. -If you send a web hook to an SSL endpoint [the certificate will not be verified](https://gitlab.com/gitlab-org/gitlab-ce/blob/ccd617e58ea71c42b6b073e692447d0fe3c00be6/app/models/web_hook.rb#L35) since many people use self-signed certificates. ---- +If you send a web hook to an SSL endpoint [the certificate will not be verified](https://gitlab.com/gitlab-org/gitlab-ce/blob/ccd617e58ea71c42b6b073e692447d0fe3c00be6/app/models/web_hook.rb#L35) since many people use self-signed certificates. -#### Push events +## Push events Triggered when you push to the repository except when pushing tags. @@ -55,7 +54,7 @@ Triggered when you push to the repository except when pushing tags. } ``` -#### Issues events +## Issues events Triggered when a new issue is created or an existing issue was updated/closed/reopened. @@ -82,7 +81,7 @@ Triggered when a new issue is created or an existing issue was updated/closed/re } ``` -#### Merge request events +## Merge request events Triggered when a new merge request is created or an existing merge request was updated/merged/closed. diff --git a/doc/workflow/README.md b/doc/workflow/README.md index efc28d06e71..c715f6e5943 100644 --- a/doc/workflow/README.md +++ b/doc/workflow/README.md @@ -1,2 +1,3 @@ -+ [Workflow](workflow/workflow.md) -+ [Project Features](workflow/project_features.md) +- [Workflow](workflow.md) +- [Project Features](project_features.md) +- [Authorization for merge requests](authorization_for_merge_requests.md) diff --git a/doc/workflow/authorization_for_merge_requests.md b/doc/workflow/authorization_for_merge_requests.md index 4e07d7c04c5..d1d6d94ec11 100644 --- a/doc/workflow/authorization_for_merge_requests.md +++ b/doc/workflow/authorization_for_merge_requests.md @@ -1,11 +1,17 @@ +# Authorization for Merge requests + There are two main ways to have a merge request flow with GitLab: working with protected branches in a single repository, or working with forks of an authoritative project. ## Protected branch flow With the protected branch flow everybody works within the same GitLab project. + The project maintainers get Master access and the regular developers get Developer access. + The maintainers mark the authoritative branches as 'Protected'. + The developers push feature branches to the project and create merge requests to have their feature branches reviewed and merged into one of the protected branches. + Only users with Master access can merge changes into a protected branch. ### Advantages @@ -20,7 +26,9 @@ Only users with Master access can merge changes into a protected branch. ## Forking workflow With the forking workflow the maintainers get Master access and the regular developers get Reporter access to the authoritative repository, which prohibits them from pushing any changes to it. + Developers create forks of the authoritative project and push their feature branches to their own forks. + To get their changes into master they need to create a merge request across forks. ### Advantages diff --git a/doc/workflow/project_features.md b/doc/workflow/project_features.md index 25fe4032570..48e86ee3ef5 100644 --- a/doc/workflow/project_features.md +++ b/doc/workflow/project_features.md @@ -1,35 +1,35 @@ +# Project features + When in a Project -> Settings, you will find Features on the bottom of the page that you can toggle. -Below you will find a more elaborate explanation of each of these. +Below you will find a more elaborate explanation of each of these. ## Issues Issues is a really powerful, but lightweight issue tracking system. + You can make tickets, assign them to people, file them under milestones, order them with labels and have discussion in them. -They integrate deeply into GitLab and are easily referenced from anywhere by using # and the issuenumber. -At GitLab.com, we use this for all our project management needs. + +They integrate deeply into GitLab and are easily referenced from anywhere by using `#` and the issue number. ## Merge Requests Using a merge request, you can review and discuss code before it is merged in the branch of your code. + As with issues, it can be assigned; people, issues, etc. can be refereced; milestones attached. -We see it as an integral part of working together on code and couldn't work without it. +We see it as an integral part of working together on code and couldn't work without it. ## Wiki This is a separate system for documentation, built right into GitLab. -It is source controlled and is very convenient if you don't want to keep you documentation in your source code, but you do want to keep it in your GitLab project. - - -## Wall - -For simple, project specific conversations, the wall can be used. -It's very lightweight and simple and works well if you're not interested in using issues, but still want to occasionally communicate within a project. +It is source controlled and is very convenient if you don't want to keep you documentation in your source code, but you do want to keep it in your GitLab project. ## Snippets Snippets are little bits of code or text. + This is a nice place to put code or text that is used semi-regularly within the project, but does not belong in source control. + For example, a specific config file that is used by > the team that is only valid for the people that work on the code. diff --git a/doc/workflow/workflow.md b/doc/workflow/workflow.md index bb232e9d5c5..ab29cfb670b 100644 --- a/doc/workflow/workflow.md +++ b/doc/workflow/workflow.md @@ -1,27 +1,31 @@ -1. Clone project +# Workflow - ```bash - git clone git@example.com:project-name.git - ``` +1. Clone project: -2. Create branch with your feature + ```bash + git clone git@example.com:project-name.git + ``` - ```bash - git checkout -b $feature_name - ``` +1. Create branch with your feature: -3. Write code. Commit changes + ```bash + git checkout -b $feature_name + ``` - ```bash - git commit -am "My feature is ready" - ``` +1. Write code. Commit changes: -4. Push your branch to GitLab + ```bash + git commit -am "My feature is ready" + ``` - ```bash - git push origin $feature_name - ``` +1. Push your branch to GitLab: -5. Review your code on commits page -6. Create a merge request -7. Your team lead will review the code & merge it to the main branch + ```bash + git push origin $feature_name + ``` + +1. Review your code on commits page. + +1. Create a merge request. + +1. Your team lead will review the code & merge it to the main branch. diff --git a/features/admin/active_tab.feature b/features/admin/active_tab.feature index 15fcda45e40..b28e16f0d6a 100644 --- a/features/admin/active_tab.feature +++ b/features/admin/active_tab.feature @@ -1,3 +1,4 @@ +@admin Feature: Admin active tab Background: Given I sign in as an admin diff --git a/features/admin/broadcast_messages.feature b/features/admin/broadcast_messages.feature index 5f16120b7cc..b2c3112320a 100644 --- a/features/admin/broadcast_messages.feature +++ b/features/admin/broadcast_messages.feature @@ -1,3 +1,4 @@ +@admin Feature: Admin Broadcast Messages Background: Given I sign in as an admin diff --git a/features/admin/groups.feature b/features/admin/groups.feature index 352c1b3803f..1a465c1be55 100644 --- a/features/admin/groups.feature +++ b/features/admin/groups.feature @@ -1,3 +1,4 @@ +@admin Feature: Admin Groups Background: Given I sign in as an admin diff --git a/features/admin/logs.feature b/features/admin/logs.feature index d07f0048080..ceb3bc34927 100644 --- a/features/admin/logs.feature +++ b/features/admin/logs.feature @@ -1,3 +1,4 @@ +@admin Feature: Admin Logs Background: Given I sign in as an admin diff --git a/features/admin/projects.feature b/features/admin/projects.feature index 4a4ee1c11e0..a6c3d6b7822 100644 --- a/features/admin/projects.feature +++ b/features/admin/projects.feature @@ -1,3 +1,4 @@ +@admin Feature: Admin Projects Background: Given I sign in as an admin @@ -11,3 +12,9 @@ Feature: Admin Projects When I visit admin projects page And I click on first project Then I should see project details + + Scenario: Transfer project + Given group 'Web' + And I visit admin project page + When I transfer project to group 'Web' + Then I should see project transfered diff --git a/features/admin/users.feature b/features/admin/users.feature index ce9f32f50d9..ce31aafd290 100644 --- a/features/admin/users.feature +++ b/features/admin/users.feature @@ -1,3 +1,4 @@ +@admin Feature: Admin Users Background: Given I sign in as an admin diff --git a/features/dashboard/active_tab.feature b/features/dashboard/active_tab.feature index 3e1cf5aa0ca..22dfa2f7840 100644 --- a/features/dashboard/active_tab.feature +++ b/features/dashboard/active_tab.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard active tab Background: Given I sign in as a user diff --git a/features/dashboard/archived_projects.feature b/features/dashboard/archived_projects.feature index 399c9b53d81..e23238d225c 100644 --- a/features/dashboard/archived_projects.feature +++ b/features/dashboard/archived_projects.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard with archived projects Background: Given I sign in as a user diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index e249f392de7..bebaa78e46c 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard Background: Given I sign in as a user diff --git a/features/dashboard/event_filters.feature b/features/dashboard/event_filters.feature index e0c6b84b008..41de0ae8317 100644 --- a/features/dashboard/event_filters.feature +++ b/features/dashboard/event_filters.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Event filters Background: Given I sign in as a user diff --git a/features/dashboard/help.feature b/features/dashboard/help.feature index 02ec688f804..56a0a860ab9 100644 --- a/features/dashboard/help.feature +++ b/features/dashboard/help.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Help Background: Given I sign in as a user diff --git a/features/dashboard/issues.feature b/features/dashboard/issues.feature index d316b2d9205..72627e43e05 100644 --- a/features/dashboard/issues.feature +++ b/features/dashboard/issues.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard Issues Background: Given I sign in as a user diff --git a/features/dashboard/merge_requests.feature b/features/dashboard/merge_requests.feature index de560300735..dcef1290e7e 100644 --- a/features/dashboard/merge_requests.feature +++ b/features/dashboard/merge_requests.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard Merge Requests Background: Given I sign in as a user diff --git a/features/dashboard/projects.feature b/features/dashboard/projects.feature index 7d8c129face..5214cfc28ef 100644 --- a/features/dashboard/projects.feature +++ b/features/dashboard/projects.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard projects Background: Given I sign in as a user diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature index 91d870f46f3..24c45028697 100644 --- a/features/dashboard/search.feature +++ b/features/dashboard/search.feature @@ -1,3 +1,4 @@ +@dashboard Feature: Dashboard Search Background: Given I sign in as a user diff --git a/features/profile/active_tab.feature b/features/profile/active_tab.feature index 475641a33ed..a99409d9fd7 100644 --- a/features/profile/active_tab.feature +++ b/features/profile/active_tab.feature @@ -1,3 +1,4 @@ +@profile Feature: Profile active tab Background: Given I sign in as a user diff --git a/features/profile/emails.feature b/features/profile/emails.feature index 148fc766081..19ed949f6ae 100644 --- a/features/profile/emails.feature +++ b/features/profile/emails.feature @@ -1,3 +1,4 @@ +@profile Feature: Profile Emails Background: Given I sign in as a user diff --git a/features/profile/group.feature b/features/profile/group.feature index 70b682e2913..e2fbfde77be 100644 --- a/features/profile/group.feature +++ b/features/profile/group.feature @@ -1,3 +1,4 @@ +@profile Feature: Profile Group Background: Given I sign in as "John Doe" diff --git a/features/profile/notifications.feature b/features/profile/notifications.feature index e7937953c1b..55997d44dec 100644 --- a/features/profile/notifications.feature +++ b/features/profile/notifications.feature @@ -1,3 +1,4 @@ +@profile Feature: Profile Notifications Background: Given I sign in as a user diff --git a/features/profile/profile.feature b/features/profile/profile.feature index 44bb190f624..d2125e013bc 100644 --- a/features/profile/profile.feature +++ b/features/profile/profile.feature @@ -1,3 +1,4 @@ +@profile Feature: Profile Background: Given I sign in as a user diff --git a/features/profile/ssh_keys.feature b/features/profile/ssh_keys.feature index 018d124e412..581503fc5f9 100644 --- a/features/profile/ssh_keys.feature +++ b/features/profile/ssh_keys.feature @@ -1,3 +1,4 @@ +@profile Feature: Profile SSH Keys Background: Given I sign in as a user diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 48c217fbea7..ce90a086688 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -35,11 +35,6 @@ Feature: Project active tab Then the active main tab should be Merge Requests And no other main tabs should be active - Scenario: On Project Wall - Given I visit my project's wall page - Then the active main tab should be Wall - And no other main tabs should be active - Scenario: On Project Wiki Given I visit my project's wiki page Then the active main tab should be Wiki diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature index fcf8b7694f4..abebef04fcd 100644 --- a/features/project/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -3,20 +3,17 @@ Feature: Project Browse branches Given I sign in as a user And I own project "Shop" And project "Shop" has protected branches - Given I visit project branches page - - Scenario: I can see project recent git branches - Then I should see "Shop" recent branches list Scenario: I can see project all git branches - Given I click link "All" + Given I visit project branches page Then I should see "Shop" all branches list Scenario: I can see project protected git branches - Given I click link "Protected" + Given I visit project protected branches page Then I should see "Shop" protected branches list Scenario: I create a branch - Given I click new branch link + Given I visit project branches page + And I click new branch link When I submit new branch form Then I should see new branch created diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index c5311544efa..191e8dcbe7f 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -68,6 +68,12 @@ Feature: Project Issues And I leave a comment with a header containing "Comment with a header" Then The comment with the header should not have an ID + @javascript + Scenario: Blocks inside comments should not build relative links + Given I visit issue page "Release 0.4" + And I leave a comment with code block + Then The code block should be unchanged + Scenario: Issues on empty project Given empty project "Empty Project" When I visit empty project page diff --git a/features/project/snippets.feature b/features/project/snippets.feature index dfaa02663a0..77e42a1a38b 100644 --- a/features/project/snippets.feature +++ b/features/project/snippets.feature @@ -30,6 +30,5 @@ Feature: Project Snippets Scenario: I destroy "Snippet one" Given I visit snippet page "Snippet one" - And I click link "Edit" And I click link "Remove Snippet" Then I should not see "Snippet one" in snippets diff --git a/features/project/source/multiselect_blob.feature b/features/project/source/multiselect_blob.feature index 3038c0814ad..0fdfe7ce938 100644 --- a/features/project/source/multiselect_blob.feature +++ b/features/project/source/multiselect_blob.feature @@ -2,8 +2,7 @@ Feature: Project Multiselect Blob Background: Given I sign in as a user And I own project "Shop" - And I visit project source page - And I click on "Gemfile.lock" file in repo + And I visit "Gemfile.lock" file in repo @javascript Scenario: I click line 1 in file @@ -83,4 +82,4 @@ Feature: Project Multiselect Blob And I go forward in history And I go forward in history Then I should see "L1-5" as URI fragment - And I should see lines 1-5 highlighted
\ No newline at end of file + And I should see lines 1-5 highlighted diff --git a/features/project/wall.feature b/features/project/wall.feature deleted file mode 100644 index c38d046a850..00000000000 --- a/features/project/wall.feature +++ /dev/null @@ -1,16 +0,0 @@ -Feature: Project Wall - In order to use Project Wall - A user should be able to read and write messages - - Background: - Given I sign in as a user - And I own project "Shop" - And I visit project "Shop" wall page - - @javascript - Scenario: Write comment - Given I write new comment "my special test message" - Then I should see project wall note "my special test message" - - Then I visit project "Shop" wall page - And I should see project wall note "my special test message" diff --git a/features/public/projects.feature b/features/public/projects.feature index 57fe834b4bf..c7bb3b4f8ce 100644 --- a/features/public/projects.feature +++ b/features/public/projects.feature @@ -1,3 +1,4 @@ +@public Feature: Public Projects Feature Background: Given public project "Community" diff --git a/features/public/public_groups.feature b/features/public/public_groups.feature index 7f1ec718e35..8bbda8cb6d4 100644 --- a/features/public/public_groups.feature +++ b/features/public/public_groups.feature @@ -1,3 +1,4 @@ +@public Feature: Public Projects Feature Background: Given group "TestGroup" has private project "Enterprise" diff --git a/features/snippets/discover.feature b/features/snippets/discover.feature index d6fd2cd7808..f0b8d3a408a 100644 --- a/features/snippets/discover.feature +++ b/features/snippets/discover.feature @@ -1,3 +1,4 @@ +@snippets Feature: Discover Snippets Background: Given I sign in as a user diff --git a/features/snippets/snippets.feature b/features/snippets/snippets.feature index 1119defa17d..38216dd5b7b 100644 --- a/features/snippets/snippets.feature +++ b/features/snippets/snippets.feature @@ -1,3 +1,4 @@ +@snippets Feature: Snippets Feature Background: Given I sign in as a user @@ -23,6 +24,5 @@ Feature: Snippets Feature Scenario: I destroy "Personal snippet one" Given I visit snippet page "Personal snippet one" - And I click link "Edit" And I click link "Destroy" Then I should not see "Personal snippet one" in snippets diff --git a/features/snippets/user.feature b/features/snippets/user.feature index 4c8a91501c4..d032a33686b 100644 --- a/features/snippets/user.feature +++ b/features/snippets/user.feature @@ -1,3 +1,4 @@ +@snippets Feature: User Snippets Background: Given I sign in as a user diff --git a/features/steps/admin/projects.rb b/features/steps/admin/projects.rb index b410b23851b..992aa46a8bc 100644 --- a/features/steps/admin/projects.rb +++ b/features/steps/admin/projects.rb @@ -19,4 +19,30 @@ class AdminProjects < Spinach::FeatureSteps page.should have_content(project.name_with_namespace) page.should have_content(project.creator.name) end + + step 'I visit admin project page' do + visit admin_project_path(project) + end + + step 'I transfer project to group \'Web\'' do + find(:xpath, "//input[@id='namespace_id']").set group.id + click_button 'Transfer' + end + + step 'group \'Web\'' do + create(:group, name: 'Web') + end + + step 'I should see project transfered' do + page.should have_content 'Web / ' + project.name + page.should have_content 'Namespace: Web' + end + + def project + @project ||= Project.first + end + + def group + Group.find_by(name: 'Web') + end end diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 820d0ef2a1f..f321428592f 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -38,22 +38,22 @@ class Groups < Spinach::FeatureSteps end Then 'I should see user "John Doe" in team list' do - projects_with_access = find(".ui-box .well-list") + projects_with_access = find(".panel .well-list") projects_with_access.should have_content("John Doe") end Then 'I should not see user "John Doe" in team list' do - projects_with_access = find(".ui-box .well-list") + projects_with_access = find(".panel .well-list") projects_with_access.should_not have_content("John Doe") end Then 'I should see user "Mary Jane" in team list' do - projects_with_access = find(".ui-box .well-list") + projects_with_access = find(".panel .well-list") projects_with_access.should have_content("Mary Jane") end Then 'I should not see user "Mary Jane" in team list' do - projects_with_access = find(".ui-box .well-list") + projects_with_access = find(".panel .well-list") projects_with_access.should_not have_content("Mary Jane") end @@ -89,7 +89,7 @@ class Groups < Spinach::FeatureSteps Then 'I should see newly created group "Samurai"' 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" + page.should have_content "Currently you are only seeing events from the" end And 'I change group "Owned" name to "new-name"' do diff --git a/features/steps/help.rb b/features/steps/help.rb index aa147fd65ce..67054e14303 100644 --- a/features/steps/help.rb +++ b/features/steps/help.rb @@ -8,14 +8,14 @@ class Spinach::Features::Help < Spinach::FeatureSteps end step 'I visit the "Rake Tasks" help page' do - visit help_raketasks_path + visit help_page_path("raketasks", "maintenance") end step 'I should see "Rake Tasks" page markdown rendered' do - page.should have_content "GitLab provides some specific rake tasks to enable special features or perform maintenance tasks" + page.should have_content "Gather information about GitLab and the system it runs on" end step 'Header "Rebuild project satellites" should have correct ids and links' do - header_should_have_correct_id_and_link(3, 'Rebuild project satellites', 'rebuild-project-satellites') + header_should_have_correct_id_and_link(2, '(Re-)Create satellite repos', 're-create-satellite-repos', '.documentation') end end diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb index 30c8cef80c8..7a0625952de 100644 --- a/features/steps/project/browse_branches.rb +++ b/features/steps/project/browse_branches.rb @@ -3,11 +3,6 @@ class ProjectBrowseBranches < Spinach::FeatureSteps include SharedProject include SharedPaths - step 'I should see "Shop" recent branches list' do - page.should have_content "Branches" - page.should have_content "master" - end - step 'I click link "All"' do click_link "All" end @@ -44,7 +39,7 @@ class ProjectBrowseBranches < Spinach::FeatureSteps end step 'I should see new branch created' do - within '.all-branches' do + within '.tree-ref-holder' do page.should have_content 'deploy_keys' end end diff --git a/features/steps/project/browse_commits.rb b/features/steps/project/browse_commits.rb index d667b58240f..bd944dee610 100644 --- a/features/steps/project/browse_commits.rb +++ b/features/steps/project/browse_commits.rb @@ -45,11 +45,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps Then 'I see breadcrumb links' do page.should have_selector('ul.breadcrumb') - page.should have_selector('ul.breadcrumb span.divider', count: 3) page.should have_selector('ul.breadcrumb a', count: 4) - - find('ul.breadcrumb li:nth-child(2) a')['href'].should match(/#{@project.path_with_namespace}\/commits\/master\z/) - find('ul.breadcrumb li:last a')['href'].should match(%r{master/app/models/project\.rb\z}) end Then 'I see commits stats' do diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb index d1f3ba25a21..d0b4aa6e080 100644 --- a/features/steps/project/issues.rb +++ b/features/steps/project/issues.rb @@ -163,4 +163,16 @@ class ProjectIssues < Spinach::FeatureSteps project = Project.find_by(name: 'Empty Project') visit project_issues_path(project) end + + step 'I leave a comment with code block' do + within(".js-main-target-form") do + fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" + click_button "Add Comment" + sleep 0.05 + end + end + + step 'The code block should be unchanged' do + page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```") + end end diff --git a/features/steps/project/milestones.rb b/features/steps/project/milestones.rb index 9ce18fbaabd..5562b523d1b 100644 --- a/features/steps/project/milestones.rb +++ b/features/steps/project/milestones.rb @@ -54,6 +54,6 @@ class ProjectMilestones < Spinach::FeatureSteps end Then "I should see 3 issues" do - page.should have_selector('#tab-issues li', count: 4) + page.should have_selector('#tab-issues li.issue-row', count: 4) end end diff --git a/features/steps/project/snippets.rb b/features/steps/project/snippets.rb index c3a76bea269..feae535fbea 100644 --- a/features/steps/project/snippets.rb +++ b/features/steps/project/snippets.rb @@ -48,7 +48,7 @@ class ProjectSnippets < Spinach::FeatureSteps end And 'I click link "Remove Snippet"' do - click_link "Remove snippet" + click_link "remove" end And 'I submit new snippet "Snippet three"' do diff --git a/features/steps/project/wall.rb b/features/steps/project/wall.rb deleted file mode 100644 index 7c61580eb2c..00000000000 --- a/features/steps/project/wall.rb +++ /dev/null @@ -1,18 +0,0 @@ -class ProjectWall < Spinach::FeatureSteps - include SharedAuthentication - 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/shared/diff_note.rb b/features/steps/shared/diff_note.rb index f80d8d06475..f917d7bde08 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -138,7 +138,7 @@ module SharedDiffNote Then 'I should see the diff comment edit button' do within(".diff-file") do - page.should have_css(".js-note-edit-button", visible: true) + page.should have_css(".js-note-write-button", visible: true) end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 36b81b74186..1c52d4c72d8 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -81,7 +81,7 @@ module SharedNote Then 'I should see the comment edit button' do within(".js-main-target-form") do - page.should have_css(".js-note-edit-button", visible: true) + page.should have_css(".js-note-write-button", visible: true) end end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index a0213815a78..2090b642059 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -204,10 +204,6 @@ module SharedPaths visit project_merge_requests_path(@project) end - step "I visit my project's wall page" do - visit project_wall_path(@project) - end - step "I visit my project's wiki page" do visit project_wiki_path(@project, :home) end @@ -240,6 +236,10 @@ module SharedPaths visit project_branches_path(@project) end + step 'I visit project protected branches page' do + visit project_protected_branches_path(@project) + end + step 'I visit compare refs page' do visit project_compare_index_path(@project) end @@ -260,6 +260,10 @@ module SharedPaths visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH)) end + step 'I visit "Gemfile.lock" file in repo' do + visit project_blob_path(@project, File.join(root_ref, 'Gemfile.lock')) + end + step 'I visit project source page for "8470d70"' do visit project_tree_path(@project, "8470d70") end @@ -311,10 +315,6 @@ module SharedPaths visit project_team_index_path(project) end - step 'I visit project "Shop" wall page' do - visit project_wall_path(project) - end - step 'I visit project wiki page' do visit project_wiki_path(@project, :home) end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index f8cb753b78f..40362fee0bc 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -102,24 +102,24 @@ module SharedProject page.should_not have_content "Community" end - step '"John Doe" is authorized to private project "Enterprise"' do + step '"John Doe" owns private project "Enterprise"' do user = user_exists("John Doe", username: "john_doe") project = Project.find_by(name: "Enterprise") - project ||= create(:project, name: "Enterprise", namespace: user.namespace) + project ||= create(:empty_project, name: "Enterprise", namespace: user.namespace) project.team << [user, :master] end - step '"John Doe" is authorized to internal project "Internal"' do + step '"John Doe" owns internal project "Internal"' do user = user_exists("John Doe", username: "john_doe") project = Project.find_by(name: "Internal") - project ||= create :project, :internal, name: 'Internal' + project ||= create :empty_project, :internal, name: 'Internal', namespace: user.namespace project.team << [user, :master] end - step '"John Doe" is authorized to public project "Community"' do + step '"John Doe" owns public project "Community"' do user = user_exists("John Doe", username: "john_doe") project = Project.find_by(name: "Community") - project ||= create :project, :public, name: 'Community' + project ||= create :empty_project, :public, name: 'Community', namespace: user.namespace project.team << [user, :master] end end diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb index fed54659ebc..040b5390a5a 100644 --- a/features/steps/snippets/snippets.rb +++ b/features/steps/snippets/snippets.rb @@ -19,7 +19,7 @@ class SnippetsFeature < Spinach::FeatureSteps end And 'I click link "Destroy"' do - click_link "Remove" + click_link "remove" end And 'I submit new snippet "Personal snippet three"' do diff --git a/features/support/env.rb b/features/support/env.rb index a5b297775db..3ab2ce0a3e6 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -28,7 +28,7 @@ WebMock.allow_net_connect! require 'capybara/poltergeist' Capybara.javascript_driver = :poltergeist Capybara.register_driver :poltergeist do |app| - Capybara::Poltergeist::Driver.new(app, :js_errors => false, :timeout => 60) + Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 90) end Spinach.hooks.on_tag("javascript") do ::Capybara.current_driver = ::Capybara.javascript_driver diff --git a/features/user.feature b/features/user.feature index d4198c08de9..a2167935fd2 100644 --- a/features/user.feature +++ b/features/user.feature @@ -1,13 +1,13 @@ Feature: User Background: Given User "John Doe" exists - And "John Doe" is authorized to private project "Enterprise" + And "John Doe" owns private project "Enterprise" # Signed out - Scenario: I visit user "John Doe" page while not signed in when he is authorized to a public project - Given "John Doe" is authorized to internal project "Internal" - And "John Doe" is authorized to public project "Community" + Scenario: I visit user "John Doe" page while not signed in when he owns a public project + Given "John Doe" owns internal project "Internal" + And "John Doe" owns public project "Community" When I visit user "John Doe" page Then I should see user "John Doe" page And I should not see project "Enterprise" @@ -15,15 +15,15 @@ Feature: User And I should see project "Community" Scenario: I visit user "John Doe" page while not signed in when he is not authorized to a public project - Given "John Doe" is authorized to internal project "Internal" + Given "John Doe" owns internal project "Internal" When I visit user "John Doe" page Then I should be redirected to sign in page # Signed in as someone else - Scenario: I visit user "John Doe" page while signed in as someone else when he is authorized to a public project - Given "John Doe" is authorized to public project "Community" - And "John Doe" is authorized to internal project "Internal" + Scenario: I visit user "John Doe" page while signed in as someone else when he owns a public project + Given "John Doe" owns public project "Community" + And "John Doe" owns internal project "Internal" And I sign in as a user When I visit user "John Doe" page Then I should see user "John Doe" page @@ -32,7 +32,7 @@ Feature: User And I should see project "Community" Scenario: I visit user "John Doe" page while signed in as someone else when he is not authorized to a public project - Given "John Doe" is authorized to internal project "Internal" + Given "John Doe" owns internal project "Internal" And I sign in as a user When I visit user "John Doe" page Then I should see user "John Doe" page @@ -51,8 +51,8 @@ Feature: User # Signed in as the user himself Scenario: I visit user "John Doe" page while signed in as "John Doe" when he has a public project - Given "John Doe" is authorized to internal project "Internal" - And "John Doe" is authorized to public project "Community" + Given "John Doe" owns internal project "Internal" + And "John Doe" owns public project "Community" And I sign in as "John Doe" When I visit user "John Doe" page Then I should see user "John Doe" page diff --git a/lib/api/branches.rb b/lib/api/branches.rb index d54f9371fbe..b32a4aa7bc2 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -84,6 +84,24 @@ module API present @branch, with: Entities::RepoObject, project: user_project end + + # Delete branch + # + # Parameters: + # id (required) - The ID of a project + # branch (required) - The name of the branch + # Example Request: + # DELETE /projects/:id/repository/branches/:branch + delete ":id/repository/branches/:branch" do + authorize_push_project + result = DeleteBranchService.new.execute(user_project, params[:branch], current_user) + + if result[:state] == :success + true + else + render_api_error!(result[:message], 405) + end + end end end end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 457af52fe9d..b190646a1e3 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1,28 +1,27 @@ module API module Entities - class User < Grape::Entity - expose :id, :username, :email, :name, :bio, :skype, :linkedin, :twitter, :website_url, - :theme_id, :color_scheme_id, :state, :created_at, :extern_uid, :provider - expose :is_admin?, as: :is_admin - expose :can_create_group?, as: :can_create_group - expose :can_create_project?, as: :can_create_project + class UserSafe < Grape::Entity + expose :name, :username + end - expose :avatar_url do |user, options| - if user.avatar.present? - user.avatar.url - end - end + class UserBasic < UserSafe + expose :id, :state, :avatar_url end - class UserSafe < Grape::Entity - expose :name, :username + class User < UserBasic + expose :created_at + expose :is_admin?, as: :is_admin + expose :bio, :skype, :linkedin, :twitter, :website_url end - class UserBasic < Grape::Entity - expose :id, :username, :email, :name, :state, :created_at + class UserFull < User + expose :email + expose :theme_id, :color_scheme_id, :extern_uid, :provider + expose :can_create_group?, as: :can_create_group + expose :can_create_project?, as: :can_create_project end - class UserLogin < User + class UserLogin < UserFull expose :private_token end @@ -48,7 +47,7 @@ module API expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group } expose :name, :name_with_namespace expose :path, :path_with_namespace - expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :snippets_enabled, :created_at, :last_activity_at + expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :snippets_enabled, :created_at, :last_activity_at expose :namespace expose :forked_from_project, using: Entities::ForkedFromProject, :if => lambda{ | project, options | project.forked? } end @@ -194,5 +193,30 @@ module API class Label < Grape::Entity expose :name end + + class RepoDiff < Grape::Entity + expose :old_path, :new_path, :a_mode, :b_mode, :diff + expose :new_file, :renamed_file, :deleted_file + end + + class Compare < Grape::Entity + expose :commit, using: Entities::RepoCommit do |compare, options| + if compare.commit + Commit.new compare.commit + end + end + expose :commits, using: Entities::RepoCommit do |compare, options| + Commit.decorate compare.commits + end + expose :diffs, using: Entities::RepoDiff do |compare, options| + compare.diffs + end + + expose :compare_timeout do |compare, options| + compare.timeout + end + + expose :same, as: :compare_same_ref + end end end diff --git a/lib/api/files.rb b/lib/api/files.rb index e0c46f92b84..e63e635a4d3 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -2,7 +2,6 @@ module API # Projects API class Files < Grape::API before { authenticate! } - before { authorize! :push_code, user_project } resource :projects do # Get file from repository @@ -28,6 +27,8 @@ module API # } # get ":id/repository/files" do + authorize! :download_code, user_project + required_attributes! [:file_path, :ref] attrs = attributes_for_keys [:file_path, :ref] ref = attrs.delete(:ref) @@ -68,6 +69,8 @@ module API # POST /projects/:id/repository/files # post ":id/repository/files" do + authorize! :push_code, user_project + required_attributes! [:file_path, :branch_name, :content, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message, :encoding] branch_name = attrs.delete(:branch_name) @@ -98,6 +101,8 @@ module API # PUT /projects/:id/repository/files # put ":id/repository/files" do + authorize! :push_code, user_project + required_attributes! [:file_path, :branch_name, :content, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message, :encoding] branch_name = attrs.delete(:branch_name) @@ -128,6 +133,8 @@ module API # DELETE /projects/:id/repository/files # delete ":id/repository/files" do + authorize! :push_code, user_project + required_attributes! [:file_path, :branch_name, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :commit_message] branch_name = attrs.delete(:branch_name) diff --git a/lib/api/groups.rb b/lib/api/groups.rb index 03f027706de..caa2ca97a3e 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -87,10 +87,12 @@ module API # POST /groups/:id/projects/:project_id post ":id/projects/:project_id" do authenticated_as_admin! - @group = Group.find(params[:id]) + group = Group.find(params[:id]) project = Project.find(params[:project_id]) - if project.transfer(@group) - present @group + result = ::Projects::TransferService.new(project, current_user, namespace_id: group.id).execute + + if result + present group else not_found! end diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 654c1f62c6c..b6a5806d646 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -36,16 +36,6 @@ module API end end - def set_current_user_for_thread - Thread.current[:current_user] = current_user - - begin - yield - ensure - Thread.current[:current_user] = nil - end - end - def user_project @project ||= find_project(params[:id]) @project || not_found! diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 06c66ba0b35..5850892df07 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -59,4 +59,3 @@ module API end end end - diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 017cb1f562e..fc1f1254a9e 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -184,21 +184,18 @@ module API # POST /projects/:id/merge_request/:merge_request_id/comments # post ":id/merge_request/:merge_request_id/comments" do - set_current_user_for_thread do - required_attributes! [:note] + 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 + 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 - if note.save - present note, with: Entities::MRNote - else - not_found! - end + if note.save + present note, with: Entities::MRNote + else + not_found! end end - end end end diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb index f7e63b23093..a4fdb752d69 100644 --- a/lib/api/milestones.rb +++ b/lib/api/milestones.rb @@ -40,17 +40,15 @@ module API # Example Request: # POST /projects/:id/milestones post ":id/milestones" do - set_current_user_for_thread do - authorize! :admin_milestone, user_project - required_attributes! [:title] + authorize! :admin_milestone, user_project + required_attributes! [:title] + attrs = attributes_for_keys [:title, :description, :due_date] + milestone = ::Milestones::CreateService.new(user_project, current_user, attrs).execute - attrs = attributes_for_keys [:title, :description, :due_date] - @milestone = user_project.milestones.new attrs - if @milestone.save - present @milestone, with: Entities::Milestone - else - not_found! - end + if milestone.valid? + present milestone, with: Entities::Milestone + else + not_found! end end @@ -66,16 +64,15 @@ module API # Example Request: # PUT /projects/:id/milestones/:milestone_id put ":id/milestones/:milestone_id" do - set_current_user_for_thread do - authorize! :admin_milestone, user_project + authorize! :admin_milestone, user_project + attrs = attributes_for_keys [:title, :description, :due_date, :state_event] + milestone = user_project.milestones.find(params[:milestone_id]) + milestone = ::Milestones::UpdateService.new(user_project, current_user, attrs).execute(milestone) - @milestone = user_project.milestones.find(params[:milestone_id]) - attrs = attributes_for_keys [:title, :description, :due_date, :state_event] - if @milestone.update_attributes attrs - present @milestone, with: Entities::Milestone - else - not_found! - end + if milestone.valid? + present milestone, with: Entities::Milestone + else + not_found! end end end diff --git a/lib/api/notes.rb b/lib/api/notes.rb index f21907b1ffc..413faf0cf2d 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -6,57 +6,6 @@ module API NOTEABLE_TYPES = [Issue, MergeRequest, Snippet] resource :projects do - # Get a list of project wall notes - # - # Parameters: - # id (required) - The ID of a project - # Example Request: - # 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 - - # Get a single project wall note - # - # Parameters: - # id (required) - The ID of a project - # note_id (required) - The ID of a note - # Example Request: - # GET /projects/:id/notes/:note_id - get ":id/notes/:note_id" do - @note = user_project.notes.common.find(params[:note_id]) - present @note, with: Entities::Note - end - - # Create a new project wall note - # - # Parameters: - # id (required) - The ID of a project - # body (required) - The content of a note - # Example Request: - # POST /projects/:id/notes - post ":id/notes" do - set_current_user_for_thread 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 - end - NOTEABLE_TYPES.each do |noteable_type| noteables_str = noteable_type.to_s.underscore.pluralize noteable_id_str = "#{noteable_type.to_s.underscore}_id" @@ -99,19 +48,17 @@ module API # POST /projects/:id/issues/:noteable_id/notes # POST /projects/:id/snippets/:noteable_id/notes post ":id/#{noteables_str}/:#{noteable_id_str}/notes" do - set_current_user_for_thread do - required_attributes! [:body] + 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 - @note.project = user_project + @noteable = user_project.send(:"#{noteables_str}").find(params[:"#{noteable_id_str}"]) + @note = @noteable.notes.new(note: params[:body]) + @note.author = current_user + @note.project = user_project - if @note.save - present @note, with: Entities::Note - else - not_found! - end + if @note.save + present @note, with: Entities::Note + else + not_found! end end end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 9d290c75ba9..732c969d7ef 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -71,7 +71,6 @@ module API # name (required) - name for new project # description (optional) - short project description # issues_enabled (optional) - # wall_enabled (optional) # merge_requests_enabled (optional) # wiki_enabled (optional) # snippets_enabled (optional) @@ -86,7 +85,6 @@ module API :path, :description, :issues_enabled, - :wall_enabled, :merge_requests_enabled, :wiki_enabled, :snippets_enabled, @@ -114,7 +112,6 @@ module API # description (optional) - short project description # default_branch (optional) - 'master' by default # issues_enabled (optional) - # wall_enabled (optional) # merge_requests_enabled (optional) # wiki_enabled (optional) # snippets_enabled (optional) @@ -129,7 +126,6 @@ module API :description, :default_branch, :issues_enabled, - :wall_enabled, :merge_requests_enabled, :wiki_enabled, :snippets_enabled, @@ -213,7 +209,7 @@ module API @users = User.where(id: user_project.team.users.map(&:id)) @users = @users.search(params[:search]) if params[:search].present? @users = paginate @users - present @users, with: Entities::User + present @users, with: Entities::UserBasic end # Get a project labels diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 076a9ceeb74..03806d9343b 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -15,6 +15,7 @@ module API not_found! end end + # Get a project repository tags # # Parameters: @@ -25,6 +26,22 @@ module API present user_project.repo.tags.sort_by(&:name).reverse, with: Entities::RepoObject, project: user_project end + # Create tag + # + # Parameters: + # id (required) - The ID of a project + # tag_name (required) - The name of the tag + # ref (required) - Create tag from commit sha or branch + # Example Request: + # POST /projects/:id/repository/tags + post ':id/repository/tags' do + authorize_push_project + @tag = CreateTagService.new.execute(user_project, params[:tag_name], + params[:ref], current_user) + + present @tag, with: Entities::RepoObject, project: user_project + end + # Get a project repository tree # # Parameters: @@ -118,6 +135,21 @@ module API not_found! end end + + # Compare two branches, tags or commits + # + # Parameters: + # id (required) - The ID of a project + # from (required) - the commit sha or branch name + # to (required) - the commit sha or branch name + # Example Request: + # GET /projects/:id/repository/compare?from=master&to=feature + get ':id/repository/compare' do + authorize! :download_code, user_project + required_attributes! [:from, :to] + compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE) + present compare, with: Entities::Compare + end end end end diff --git a/lib/api/users.rb b/lib/api/users.rb index 6ed2740c333..92dbe97f0a4 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -13,7 +13,12 @@ module API @users = @users.active if params[:active].present? @users = @users.search(params[:search]) if params[:search].present? @users = paginate @users - present @users, with: Entities::User + + if current_user.is_admin? + present @users, with: Entities::UserFull + else + present @users, with: Entities::UserBasic + end end # Get a single user @@ -24,7 +29,12 @@ module API # GET /users/:id get ":id" do @user = User.find(params[:id]) - present @user, with: Entities::User + + if current_user.is_admin? + present @user, with: Entities::UserFull + else + present @user, with: Entities::UserBasic + end end # Create user. Available only for admin @@ -53,7 +63,7 @@ module API admin = attrs.delete(:admin) user.admin = admin unless admin.nil? if user.save - present user, with: Entities::User + present user, with: Entities::UserFull else not_found! end @@ -87,7 +97,7 @@ module API admin = attrs.delete(:admin) user.admin = admin unless admin.nil? if user.update_attributes(attrs, as: :admin) - present user, with: Entities::User + present user, with: Entities::UserFull else not_found! end diff --git a/lib/email_validator.rb b/lib/email_validator.rb new file mode 100644 index 00000000000..0a67ebcd795 --- /dev/null +++ b/lib/email_validator.rb @@ -0,0 +1,21 @@ +# Based on https://github.com/balexand/email_validator +# +# Extended to use only strict mode with following allowed characters: +# ' - apostrophe +# +# See http://www.remote.org/jochen/mail/info/chars.html +# +class EmailValidator < ActiveModel::EachValidator + @@default_options = {} + + def self.default_options + @@default_options + end + + def validate_each(record, attribute, value) + options = @@default_options.merge(self.options) + unless value =~ /\A\s*([-a-z0-9+._']{1,64})@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*\z/i + record.errors.add(attribute, options[:message] || :invalid) + end + end +end diff --git a/lib/gitlab/closing_issue_extractor.rb b/lib/gitlab/closing_issue_extractor.rb new file mode 100644 index 00000000000..90f1370c209 --- /dev/null +++ b/lib/gitlab/closing_issue_extractor.rb @@ -0,0 +1,16 @@ +module Gitlab + module ClosingIssueExtractor + ISSUE_CLOSING_REGEX = Regexp.new(Gitlab.config.gitlab.issue_closing_pattern) + + def self.closed_by_message_in_project(message, project) + md = ISSUE_CLOSING_REGEX.match(message) + if md + extractor = Gitlab::ReferenceExtractor.new + extractor.analyze(md[0]) + extractor.issues_for(project) + else + [] + end + end + end +end diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 4f49ca4189e..38b3d82e2f4 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -44,14 +44,21 @@ module Gitlab def push_allowed?(user, project, ref, oldrev, newrev, forced_push) if user && user_allowed?(user) action = if project.protected_branch?(ref) - if forced_push.to_s == 'true' - :force_push_code_to_protected_branches - else - :push_code_to_protected_branches - end - else - :push_code - end + # we dont allow force push to protected branch + if forced_push.to_s == 'true' + :force_push_code_to_protected_branches + # and we dont allow remove of protected branch + elsif newrev =~ /0000000/ + :remove_protected_branches + else + :push_code_to_protected_branches + end + elsif project.repository && project.repository.tag_names.include?(ref) + # Prevent any changes to existing git tag unless user has permissions + :admin_project + else + :push_code + end user.can?(action, project) else false diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb index 01d86430f02..be3fcc4f035 100644 --- a/lib/gitlab/ldap/user.rb +++ b/lib/gitlab/ldap/user.rb @@ -50,7 +50,9 @@ module Gitlab # we look for user by extracting part of their email if !user && email && ldap_conf['allow_username_or_email_login'] uname = email.partition('@').first - user = model.find_by(username: uname) + # Strip apostrophes since they are disallowed as part of username + username = uname.gsub("'", "") + user = model.find_by(username: username) end user diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index dca3d7a7bed..c04be788f07 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -33,10 +33,9 @@ module Gitlab # Public: Parse the provided text with GitLab-Flavored Markdown # # text - the source text + # project - extra options for the reference links as given to link_to # html_options - extra options for the reference links as given to link_to - # - # Note: reference links will only be generated if @project is set - def gfm(text, html_options = {}) + def gfm(text, project = @project, html_options = {}) return text if text.nil? # Duplicate the string so we don't alter the original, then call to_str @@ -56,14 +55,19 @@ module Gitlab # TODO: add popups with additional information - text = parse(text) + text = parse(text, project) # Insert pre block extractions text.gsub!(/\{gfm-extraction-(\h{32})\}/) do insert_piece($1) end - sanitize text.html_safe, attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class), tags: ActionView::Base.sanitized_allowed_tags + %w(table tr td th) + allowed_attributes = ActionView::Base.sanitized_allowed_attributes + allowed_tags = ActionView::Base.sanitized_allowed_tags + + sanitize text.html_safe, + attributes: allowed_attributes + %w(id class), + tags: allowed_tags + %w(table tr td th) end private @@ -84,11 +88,9 @@ module Gitlab # # text - Text to parse # - # Note: reference links will only be generated if @project is set - # # Returns parsed text - def parse(text) - parse_references(text) if @project + def parse(text, project = @project) + parse_references(text, project) if project parse_emoji(text) text @@ -110,7 +112,7 @@ module Gitlab TYPES = [:user, :issue, :merge_request, :snippet, :commit].freeze - def parse_references(text) + def parse_references(text, project = @project) # parse reference links text.gsub!(REFERENCE_PATTERN) do |match| prefix = $~[:prefix] @@ -123,7 +125,7 @@ module Gitlab # Avoid HTML entities if prefix && suffix && prefix[0] == '&' && suffix[-1] == ';' match - elsif ref_link = reference_link(type, identifier) + elsif ref_link = reference_link(type, identifier, project) "#{prefix}#{ref_link}#{suffix}" else match @@ -153,7 +155,7 @@ module Gitlab # # Returns boolean def valid_emoji?(emoji) - Emoji.find_by_name emoji + Emoji.find_by_name(emoji) end # Private: Dispatches to a dedicated processing method based on reference @@ -162,52 +164,77 @@ module Gitlab # identifier - Object identifier (Issue ID, SHA hash, etc.) # # Returns string rendered by the processing method - def reference_link(type, identifier) - send("reference_#{type}", identifier) + def reference_link(type, identifier, project = @project) + send("reference_#{type}", identifier, project) end - def reference_user(identifier) - if user = User.find_by_username(identifier) - link_to("@#{identifier}", user_url(identifier), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) + def reference_user(identifier, project = @project) + if user = User.find_by(username: identifier) + options = html_options.merge( + class: "gfm gfm-team_member #{html_options[:class]}" + ) + link_to("@#{identifier}", user_url(identifier), options) end end - def reference_issue(identifier) - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - if @project.issue_exists? identifier - url = url_for_issue(identifier) + def reference_issue(identifier, project = @project) + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + if project.issue_exists? identifier + url = url_for_issue(identifier, project) title = title_for_issue(identifier) + options = html_options.merge( + title: "Issue: #{title}", + class: "gfm gfm-issue #{html_options[:class]}" + ) - link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + link_to("##{identifier}", url, options) end - else - reference_jira_issue(identifier) if @project.issues_tracker == "jira" + elsif project.issues_tracker == 'jira' + reference_jira_issue(identifier, project) end end - def reference_merge_request(identifier) - if merge_request = @project.merge_requests.where(iid: identifier).first - link_to("!#{identifier}", project_merge_request_url(@project, merge_request), html_options.merge(title: "Merge Request: #{merge_request.title}", class: "gfm gfm-merge_request #{html_options[:class]}")) + def reference_merge_request(identifier, project = @project) + if merge_request = project.merge_requests.find_by(iid: identifier) + options = html_options.merge( + title: "Merge Request: #{merge_request.title}", + class: "gfm gfm-merge_request #{html_options[:class]}" + ) + url = project_merge_request_url(project, merge_request) + link_to("!#{identifier}", url, options) end end - def reference_snippet(identifier) - if snippet = @project.snippets.where(id: identifier).first - link_to("$#{identifier}", project_snippet_url(@project, snippet), html_options.merge(title: "Snippet: #{snippet.title}", class: "gfm gfm-snippet #{html_options[:class]}")) + def reference_snippet(identifier, project = @project) + if snippet = project.snippets.find_by(id: identifier) + options = html_options.merge( + title: "Snippet: #{snippet.title}", + class: "gfm gfm-snippet #{html_options[:class]}" + ) + link_to("$#{identifier}", project_snippet_url(project, snippet), + options) end end - 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]}")) + def reference_commit(identifier, project = @project) + if project.valid_repo? && commit = project.repository.commit(identifier) + options = html_options.merge( + title: commit.link_title, + class: "gfm gfm-commit #{html_options[:class]}" + ) + link_to(identifier, project_commit_url(project, commit), options) end end - def reference_jira_issue(identifier) + def reference_jira_issue(identifier, project = @project) url = url_for_issue(identifier) - title = Gitlab.config.issues_tracker[@project.issues_tracker]["title"] + title = Gitlab.config.issues_tracker[project.issues_tracker]["title"] - link_to("#{identifier}", url, html_options.merge(title: "Issue in #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + options = html_options.merge( + title: "Issue in #{title}", + class: "gfm gfm-issue #{html_options[:class]}" + ) + link_to("#{identifier}", url, options) end end end diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb index d154bd8600b..c5be884a895 100644 --- a/lib/gitlab/oauth/user.rb +++ b/lib/gitlab/oauth/user.rb @@ -39,7 +39,9 @@ module Gitlab # So we use part of email as username for new user # For LDAP, username is already set to the user's # uid/userid/sAMAccountName. - user.username = email.match(/^[^@]*/)[0] + email_username = email.match(/^[^@]*/)[0] + # Strip apostrophes since they are disallowed as part of username + user.username = email_username.gsub("'", "") end user.save! diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 94b01e808d9..1eda614807f 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -51,7 +51,7 @@ module Gitlab private - def reference_link type, identifier + def reference_link(type, identifier, project) # Append identifier to the appropriate collection. send("#{type}s") << identifier end diff --git a/lib/gitlab/satellite/files/file_action.rb b/lib/gitlab/satellite/files/file_action.rb index 7701a6d5d60..6446b14568a 100644 --- a/lib/gitlab/satellite/files/file_action.rb +++ b/lib/gitlab/satellite/files/file_action.rb @@ -4,7 +4,7 @@ module Gitlab attr_accessor :file_path, :ref def initialize(user, project, ref, file_path) - super user, project, git_timeout: 10.seconds + super user, project @file_path = file_path @ref = ref end diff --git a/lib/gitlab/seeder.rb b/lib/gitlab/seeder.rb index 39de1223b18..31aa3528c4c 100644 --- a/lib/gitlab/seeder.rb +++ b/lib/gitlab/seeder.rb @@ -9,12 +9,7 @@ module Gitlab end def self.by_user(user) - begin - Thread.current[:current_user] = user - yield - ensure - Thread.current[:current_user] = nil - end + yield end def self.mute_mailer diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 7d9428ff27d..bb225f1acd8 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -6,8 +6,6 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML def initialize(template, options = {}) @template = template @project = @template.instance_variable_get("@project") - @ref = @template.instance_variable_get("@ref") - @request_path = @template.instance_variable_get("@path") @options = options.dup super options end @@ -45,23 +43,10 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML end end - def preprocess(full_document) - if is_wiki? - full_document - elsif @project - h.create_relative_links(full_document, @project, @ref, @request_path) - else - full_document - end - end - def postprocess(full_document) - h.gfm(full_document) - end - - def is_wiki? - if @template.instance_variable_get("@project_wiki") - @template.instance_variable_get("@page") + unless @template.instance_variable_get("@project_wiki") || @project.nil? + full_document = h.create_relative_links(full_document) end + h.gfm(full_document) end end diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab index 3dd4465a6d8..b066a1a6935 100755 --- a/lib/support/init.d/gitlab +++ b/lib/support/init.d/gitlab @@ -12,6 +12,7 @@ # Default-Stop: 0 1 6 # Short-Description: GitLab git repository management # Description: GitLab git repository management +# chkconfig: - 85 14 ### END INIT INFO @@ -167,14 +168,14 @@ start_gitlab() { # Remove old socket if it exists rm -f "$socket_path"/gitlab.socket 2>/dev/null # Start the web server - RAILS_ENV=$RAILS_ENV script/web start + RAILS_ENV=$RAILS_ENV bin/web start fi # If sidekiq is already running, don't start it again. if [ "$sidekiq_status" = "0" ]; then echo "The Sidekiq job dispatcher is already running with pid $spid, not restarting" else - RAILS_ENV=$RAILS_ENV script/background_jobs start & + RAILS_ENV=$RAILS_ENV bin/background_jobs start & fi # Wait for the pids to be planted @@ -197,11 +198,11 @@ stop_gitlab() { # If the Unicorn web server is running, tell it to stop; if [ "$web_status" = "0" ]; then - RAILS_ENV=$RAILS_ENV script/web stop + RAILS_ENV=$RAILS_ENV bin/web stop fi # And do the same thing for the Sidekiq. if [ "$sidekiq_status" = "0" ]; then - RAILS_ENV=$RAILS_ENV script/background_jobs stop + RAILS_ENV=$RAILS_ENV bin/background_jobs stop fi # If something needs to be stopped, lets wait for it to stop. Never use SIGKILL in a script. @@ -253,10 +254,10 @@ reload_gitlab(){ exit 1 fi printf "Reloading GitLab Unicorn configuration... " - RAILS_ENV=$RAILS_ENV script/web reload + RAILS_ENV=$RAILS_ENV bin/web reload echo "Done." echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..." - RAILS_ENV=$RAILS_ENV script/background_jobs restart + RAILS_ENV=$RAILS_ENV bin/background_jobs restart wait_for_pids print_status diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index 98c91637390..36306eeb3a6 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -54,6 +54,7 @@ server { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Frame-Options SAMEORIGIN; proxy_pass http://gitlab; } diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl new file mode 100644 index 00000000000..22e923b377c --- /dev/null +++ b/lib/support/nginx/gitlab-ssl @@ -0,0 +1,164 @@ +## GitLab +## Contributors: randx, yin8086, sashkab, orkoden, axilleas +## +## Modified from nginx http version +## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/ +## +## Lines starting with two hashes (##) are comments containing information +## for configuration. One hash (#) comments are actual configuration parameters +## which you can comment/uncomment to your liking. +## +################################### +## SSL configuration ## +################################### +## +## Optimal configuration is taken from: +## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html +## Make sure to read it and understand what each option does. +## +## [Optional] Generate a self-signed ssl certificate: +## mkdir /etc/nginx/ssl/ +## cd /etc/nginx/ssl/ +## sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key +## sudo chmod o-r gitlab.key +## +## Edit `gitlab-shell/config.yml`: +## 1) Set "gitlab_url" param in `gitlab-shell/config.yml` to `https://git.example.com` +## 2) Set "ca_file" to `/etc/nginx/ssl/gitlab.crt` +## 3) Set "self_signed_cert" to `true` +## Edit `gitlab/config/gitlab.yml`: +## 1) Define port for http "port: 443" +## 2) Enable https "https: true" +## 3) Update ssl for gravatar "ssl_url: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm" +## +################################## +## CHUNKED TRANSFER ## +################################## +## +## It is a known issue that Git-over-HTTP requires chunked transfer encoding [0] +## which is not supported by Nginx < 1.3.9 [1]. As a result, pushing a large object +## with Git (i.e. a single large file) can lead to a 411 error. In theory you can get +## around this by tweaking this configuration file and either: +## - installing an old version of Nginx with the chunkin module [2] compiled in, or +## - using a newer version of Nginx. +## +## At the time of writing we do not know if either of these theoretical solutions works. As a workaround +## users can use Git over SSH to push large files. +## +## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99 +## [1] https://github.com/agentzh/chunkin-nginx-module#status +## [2] https://github.com/agentzh/chunkin-nginx-module + + +upstream gitlab { + + ## Uncomment if you have set up unicorn to listen on a unix socket (recommended). + server unix:/home/git/gitlab/tmp/sockets/gitlab.socket; + + ## Uncomment if unicorn is configured to listen on a tcp port. + ## Check the port number in /home/git/gitlab/config/unicorn.rb + # server 127.0.0.1:8080; +} + +## This is a normal HTTP host which redirects all traffic to the HTTPS host. +server { + listen *:80; + ## Replace git.example.com with your FQDN. + server_name git.example.com; + server_tokens off; + ## root doesn't have to be a valid path since we are redirecting + root /nowhere; + rewrite ^ https://$server_name$request_uri permanent; +} + +server { + listen 443 ssl; + ## Replace git.example.com with your FQDN. + server_name git.example.com; + server_tokens off; + root /home/git/gitlab/public; + + ## Increase this if you want to upload large attachments + ## Or if you want to accept large git objects over http + client_max_body_size 20m; + + ## Strong SSL Security + ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html + ssl on; + ssl_certificate /etc/nginx/ssl/gitlab.crt; + ssl_certificate_key /etc/nginx/ssl/gitlab.key; + + ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4'; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_session_cache builtin:1000 shared:SSL:10m; + + ## Enable OCSP stapling to reduce the overhead and latency of running SSL. + ## Replace with your ssl_trusted_certificate. For more info see: + ## - https://medium.com/devops-programming/4445f4862461 + ## - https://www.ruby-forum.com/topic/4419319 + ssl_stapling on; + ssl_stapling_verify on; + ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt; + resolver 208.67.222.222 208.67.222.220 valid=300s; + resolver_timeout 10s; + + ssl_prefer_server_ciphers on; + ## [Optional] Generate a stronger DHE parameter (recommended): + ## cd /etc/ssl/certs + ## openssl dhparam -out dhparam.pem 2048 + ## + # ssl_dhparam /etc/ssl/certs/dhparam.pem; + + add_header Strict-Transport-Security max-age=63072000; + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + + ## Individual nginx logs for this GitLab vhost + access_log /var/log/nginx/gitlab_access.log; + error_log /var/log/nginx/gitlab_error.log; + + location / { + ## Serve static files from defined root folder. + ## @gitlab is a named location for the upstream fallback, see below. + try_files $uri $uri/index.html $uri.html @gitlab; + } + + ## If a file, which is not found in the root folder is requested, + ## then the proxy pass the request to the upsteam (gitlab unicorn). + location @gitlab { + + ## If you use https make sure you disable gzip compression + ## to be safe against BREACH attack. + gzip off; + + ## https://github.com/gitlabhq/gitlabhq/issues/694 + ## Some requests take more than 30 seconds. + proxy_read_timeout 300; + proxy_connect_timeout 300; + proxy_redirect off; + + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Ssl on; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Frame-Options SAMEORIGIN; + + proxy_pass http://gitlab; + } + + ## Enable gzip compression as per rails guide: + ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression + ## WARNING: If you are using relative urls do remove the block below + ## See config/application.rb under "Relative url support" for the list of + ## other files that need to be changed for relative url support + location ~ ^/(assets)/ { + root /home/git/gitlab/public; + gzip_static on; # to serve pre-gzipped version + expires max; + add_header Cache-Control public; + } + + error_page 502 /502.html; +} diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 0387795fa48..34116568e99 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -123,6 +123,11 @@ namespace :gitlab do def check_init_script_exists print "Init script exists? ... " + if omnibus_gitlab? + puts 'skipped (omnibus-gitlab has no init script)'.magenta + return + end + script_path = "/etc/init.d/gitlab" if File.exists?(script_path) @@ -142,6 +147,11 @@ namespace :gitlab do def check_init_script_up_to_date print "Init script up-to-date? ... " + if omnibus_gitlab? + puts 'skipped (omnibus-gitlab has no init script)'.magenta + return + end + recipe_path = Rails.root.join("lib/support/init.d/", "gitlab") script_path = "/etc/init.d/gitlab" @@ -458,7 +468,7 @@ namespace :gitlab do else puts "no".red try_fixing_it( - "sudo chmod u+rwx,g+rx,o-rwx #{satellites_path}", + "sudo chmod u+rwx,g=rx,o-rwx #{satellites_path}", ) for_more_information( see_installation_guide_section "GitLab" @@ -606,6 +616,22 @@ namespace :gitlab do Gitlab::Shell.new.version end + def required_gitlab_shell_version + File.read(File.join(Rails.root, "GITLAB_SHELL_VERSION")).strip + end + + def gitlab_shell_major_version + required_gitlab_shell_version.split(".")[0].to_i + end + + def gitlab_shell_minor_version + required_gitlab_shell_version.split(".")[1].to_i + end + + def gitlab_shell_patch_version + required_gitlab_shell_version.split(".")[2].to_i + end + def has_gitlab_shell3? gitlab_shell_version.try(:start_with?, "v3.") end @@ -637,7 +663,7 @@ namespace :gitlab do else puts "no".red try_fixing_it( - sudo_gitlab("RAILS_ENV=production script/background_jobs start") + sudo_gitlab("RAILS_ENV=production bin/background_jobs start") ) for_more_information( see_installation_guide_section("Install Init Script"), @@ -779,7 +805,7 @@ namespace :gitlab do end def check_gitlab_shell - required_version = Gitlab::VersionInfo.new(1, 9, 4) + required_version = Gitlab::VersionInfo.new(gitlab_shell_major_version, gitlab_shell_minor_version, gitlab_shell_patch_version) current_version = Gitlab::VersionInfo.parse(gitlab_shell_version) print "GitLab Shell version >= #{required_version} ? ... " @@ -807,4 +833,8 @@ namespace :gitlab do fix_and_rerun end end + + def omnibus_gitlab? + Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails' + end end diff --git a/lib/tasks/gitlab/enable_namespaces.rake b/lib/tasks/gitlab/enable_namespaces.rake deleted file mode 100644 index 201f34ab546..00000000000 --- a/lib/tasks/gitlab/enable_namespaces.rake +++ /dev/null @@ -1,111 +0,0 @@ -namespace :gitlab do - desc "GITLAB | Enable usernames and namespaces for user projects" - task enable_namespaces: :environment do - warn_user_is_not_gitlab - - migrate_user_namespaces - migrate_groups - migrate_projects - end - - def migrate_user_namespaces - puts "\nGenerate usernames for users without one: ".blue - User.find_each(batch_size: 500) do |user| - if user.namespace - print '-'.cyan - next - end - - username = if user.username.present? - # if user already has username filled - user.username - else - build_username(user) - end - - begin - User.transaction do - user.update_attributes!(username: username) - print '.'.green - end - rescue - print 'F'.red - end - end - puts "\nDone" - end - - def build_username(user) - username = nil - - # generate username - username = user.email.match(/^[^@]*/)[0] - username.gsub!("+", ".") - - # return username if no matches - return username unless User.find_by(username: username) - - # look for same username - (1..10).each do |i| - suffixed_username = "#{username}#{i}" - - return suffixed_username unless User.find_by(username: suffixed_username) - end - end - - def migrate_groups - puts "\nCreate directories for groups: ".blue - - Group.find_each(batch_size: 500) do |group| - begin - if group.dir_exists? - print '-'.cyan - else - if group.ensure_dir_exist - print '.'.green - else - print 'F'.red - end - end - rescue - print 'F'.red - end - end - puts "\nDone" - end - - def migrate_projects - git_path = Gitlab.config.gitlab_shell.repos_path - puts "\nMove projects in groups into respective directories ... ".blue - Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project| - next unless project.group - - group = project.group - - print "#{project.name_with_namespace.yellow} ... " - - new_path = File.join(git_path, project.path_with_namespace + '.git') - - if File.exists?(new_path) - puts "already at #{new_path}".green - next - end - - old_path = File.join(git_path, project.path + '.git') - - unless File.exists?(old_path) - puts "couldn't find it at #{old_path}".red - next - end - - begin - project.transfer(group.path) - puts "moved to #{new_path}".green - rescue - puts "failed moving to #{new_path}".red - end - end - - puts "\nDone" - end -end diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake index 9516210e205..5b937ce0a28 100644 --- a/lib/tasks/gitlab/test.rake +++ b/lib/tasks/gitlab/test.rake @@ -8,9 +8,7 @@ namespace :gitlab do ] cmds.each do |cmd| - result = system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) - - raise "#{cmd} failed!" unless result + system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!") end end -end +end
\ No newline at end of file diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake index ba806e53ccf..e4bd6545755 100644 --- a/lib/tasks/sidekiq.rake +++ b/lib/tasks/sidekiq.rake @@ -1,21 +1,21 @@ namespace :sidekiq do desc "GITLAB | Stop sidekiq" task :stop do - system *%W(script/background_jobs stop) + system *%W(bin/background_jobs stop) end desc "GITLAB | Start sidekiq" task :start do - system *%W(script/background_jobs start) + system *%W(bin/background_jobs start) end desc 'GitLab | Restart sidekiq' task :restart do - system *%W(script/background_jobs restart) + system *%W(bin/background_jobs restart) end desc "GITLAB | Start sidekiq with launchd on Mac OS X" task :launchd do - system *%W(script/background_jobs start_no_deamonize) + system *%W(bin/background_jobs start_no_deamonize) end end diff --git a/lib/tasks/spec.rake b/lib/tasks/spec.rake index 49fbe1bd47a..bee22300298 100644 --- a/lib/tasks/spec.rake +++ b/lib/tasks/spec.rake @@ -40,7 +40,6 @@ end def run_commands(cmds) cmds.each do |cmd| - system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) - raise "#{cmd} failed!" unless $?.exitstatus.zero? + system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!") end end diff --git a/lib/tasks/spinach.rake b/lib/tasks/spinach.rake index c23d0e0e188..507b315759d 100644 --- a/lib/tasks/spinach.rake +++ b/lib/tasks/spinach.rake @@ -6,9 +6,29 @@ task :spinach do %W(rake gitlab:setup), %W(spinach), ] + run_commands(cmds) +end + +desc "GITLAB | Run project spinach features" +task :spinach_project do + cmds = [ + %W(rake gitlab:setup), + %W(spinach --tags ~@admin,~@dashboard,~@profile,~@public,~@snippets), + ] + run_commands(cmds) +end + +desc "GITLAB | Run other spinach features" +task :spinach_other do + cmds = [ + %W(rake gitlab:setup), + %W(spinach --tags @admin,@dashboard,@profile,@public,@snippets), + ] + run_commands(cmds) +end +def run_commands(cmds) cmds.each do |cmd| - system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) - raise "#{cmd} failed!" unless $?.exitstatus.zero? + system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!") end end diff --git a/script/rails b/script/rails deleted file mode 100755 index f8da2cffd4d..00000000000 --- a/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/spec/controllers/commits_controller_spec.rb b/spec/controllers/commits_controller_spec.rb index fbf4f29acfd..0c19d755eb1 100644 --- a/spec/controllers/commits_controller_spec.rb +++ b/spec/controllers/commits_controller_spec.rb @@ -6,7 +6,6 @@ describe Projects::CommitsController do before do sign_in(user) - project.team << [user, :master] end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb new file mode 100644 index 00000000000..944df5314bd --- /dev/null +++ b/spec/controllers/projects_controller_spec.rb @@ -0,0 +1,43 @@ +require('spec_helper') + +describe ProjectsController do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') } + let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } + + describe "POST #upload_image" do + before do + sign_in(user) + project.team << [user, :developer] + end + + context "without params['markdown_img']" do + it "returns an error" do + post :upload_image, id: project.to_param, format: :json + expect(response.status).to eq(422) + end + end + + context "with invalid file" do + before do + post :upload_image, id: project.to_param, markdown_img: txt, format: :json + end + + it "returns an error" do + expect(response.status).to eq(422) + end + end + + context "with valid file" do + before do + post :upload_image, id: project.to_param, markdown_img: jpg, format: :json + end + + it "returns a content with original filename and new link." do + expect(response.body).to match "\"alt\":\"rails_sample\"" + expect(response.body).to match "\"url\":\"http://test.host/uploads/#{project.path_with_namespace}" + end + end + end +end diff --git a/spec/factories.rb b/spec/factories.rb index 148477d6389..41cc99cbcb9 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -201,7 +201,7 @@ FactoryGirl.define do end trait :with_attachment do - attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png") } + attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "`/png") } end end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index e62517ad710..d7f3f3a302c 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -248,7 +248,7 @@ describe "Issues", feature: true do find('.edit-issue.inline-update').select(milestone.title, from: 'issue_milestone_id') click_button 'Update Issue' - page.should have_content "Milestone" + page.should have_content "Milestone changed to #{milestone.title}" page.has_select?('issue_assignee_id', :selected => milestone.title) end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index cfb6deb1834..3fe11849660 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -32,21 +32,6 @@ describe "On a merge request", js: true, feature: true do within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: true) } end 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 'should have text and visible edit button' do - within(".js-main-target-form") { should have_css(".js-note-preview", text: "This is awesome", visible: true) } - within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } - within(".js-main-target-form") { should have_css(".js-note-edit-button", visible: true) } - end - end end describe "when posting a note" do @@ -132,7 +117,7 @@ describe "On a merge request", js: true, feature: true do end end -describe "On a merge request diff", js: true do +describe "On a merge request diff", js: true, feature: true do let(:merge_request) { create(:merge_request, :with_diffs, :simple) } let(:project) { merge_request.source_project } @@ -210,9 +195,3 @@ describe "On a merge request diff", js: true do end end end - -describe "On merge request discussion", js: true do - describe "with merge request diff note" - describe "with commit note" - describe "with commit diff note" -end diff --git a/spec/features/security/group/group_access_spec.rb b/spec/features/security/group/group_access_spec.rb index b65e1d2dbf6..44de499e6d2 100644 --- a/spec/features/security/group/group_access_spec.rb +++ b/spec/features/security/group/group_access_spec.rb @@ -82,5 +82,17 @@ describe "Group access", feature: true do it { should be_denied_for :user } it { should be_denied_for :visitor } end + + describe "GET /groups/:path/projects" do + subject { projects_group_path(group) } + + it { should be_allowed_for owner } + it { should be_denied_for master } + it { should be_denied_for reporter } + it { should be_allowed_for :admin } + it { should be_denied_for guest } + it { should be_denied_for :user } + it { should be_denied_for :visitor } + end end end diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index f6ab47ed91b..f86b3db32eb 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -87,17 +87,6 @@ describe "Internal Project Access", feature: true do it { should be_denied_for :visitor } end - describe "GET /:project_path/wall" do - subject { project_wall_path(project) } - - it { should be_allowed_for master } - it { should be_allowed_for reporter } - it { should be_allowed_for :admin } - it { should be_allowed_for guest } - it { should be_allowed_for :user } - it { should be_denied_for :visitor } - end - describe "GET /:project_path/blob" do before do commit = project.repository.commit @@ -190,17 +179,6 @@ describe "Internal Project Access", feature: true do it { should be_denied_for :visitor } end - describe "GET /:project_path/branches/recent" do - subject { recent_project_branches_path(project) } - - it { should be_allowed_for master } - it { should be_allowed_for reporter } - it { should be_allowed_for :admin } - it { should be_allowed_for guest } - it { should be_allowed_for :user } - it { should be_denied_for :visitor } - end - describe "GET /:project_path/branches" do subject { project_branches_path(project) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index 8a0fcb8e9ff..a27361f4d15 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -87,17 +87,6 @@ describe "Private Project Access", feature: true do it { should be_denied_for :visitor } end - describe "GET /:project_path/wall" do - subject { project_wall_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 guest } - it { should be_denied_for :user } - it { should be_denied_for :visitor } - end - describe "GET /:project_path/blob" do before do commit = project.repository.commit @@ -168,17 +157,6 @@ describe "Private Project Access", feature: true do it { should be_denied_for :visitor } end - describe "GET /:project_path/branches/recent" do - subject { recent_project_branches_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 guest } - it { should be_denied_for :user } - it { should be_denied_for :visitor } - end - describe "GET /:project_path/branches" do subject { project_branches_path(project) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index eb511bfefe0..f114965bd4a 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -92,17 +92,6 @@ describe "Public Project Access", feature: true do it { should be_denied_for :visitor } end - describe "GET /:project_path/wall" do - subject { project_wall_path(project) } - - it { should be_allowed_for master } - it { should be_allowed_for reporter } - it { should be_allowed_for :admin } - it { should be_allowed_for guest } - it { should be_allowed_for :user } - it { should be_allowed_for :visitor } - end - describe "GET /:project_path/blob" do before do commit = project.repository.commit @@ -195,17 +184,6 @@ describe "Public Project Access", feature: true do it { should be_denied_for :visitor } end - describe "GET /:project_path/branches/recent" do - subject { recent_project_branches_path(project) } - - it { should be_allowed_for master } - it { should be_allowed_for reporter } - it { should be_allowed_for :admin } - it { should be_allowed_for guest } - it { should be_allowed_for :user } - it { should be_allowed_for :visitor } - end - describe "GET /:project_path/branches" do subject { project_branches_path(project) } diff --git a/spec/fixtures/banana_sample.gif b/spec/fixtures/banana_sample.gif Binary files differnew file mode 100644 index 00000000000..1322ac92d14 --- /dev/null +++ b/spec/fixtures/banana_sample.gif diff --git a/spec/fixtures/doc_sample.txt b/spec/fixtures/doc_sample.txt new file mode 100644 index 00000000000..45dbc1aadde --- /dev/null +++ b/spec/fixtures/doc_sample.txt @@ -0,0 +1,3 @@ +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
\ No newline at end of file diff --git a/spec/fixtures/rails_sample.jpg b/spec/fixtures/rails_sample.jpg Binary files differnew file mode 100644 index 00000000000..a847b193325 --- /dev/null +++ b/spec/fixtures/rails_sample.jpg diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 0376e0aadf0..053a1fe22f5 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -67,10 +67,9 @@ describe ApplicationHelper do end it "should call gravatar_icon when no avatar is present" do - user = create(:user) + user = create(:user, email: 'test@example.com') user.save! - allow(self).to receive(:gravatar_icon).and_return('gravatar_method_called') - avatar_icon(user.email).to_s.should == "gravatar_method_called" + avatar_icon(user.email).to_s.should == "http://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=40&d=identicon" end end @@ -79,20 +78,20 @@ describe ApplicationHelper do it "should return a generic avatar path when Gravatar is disabled" do Gitlab.config.gravatar.stub(:enabled).and_return(false) - gravatar_icon(user_email).should == '/assets/no_avatar.png' + gravatar_icon(user_email).should match('no_avatar.png') end it "should return a generic avatar path when email is blank" do - gravatar_icon('').should == '/assets/no_avatar.png' + gravatar_icon('').should match('no_avatar.png') end it "should return default gravatar url" do - allow(self).to receive(:request).and_return(double(:ssl? => false)) + Gitlab.config.gitlab.stub(https: false) gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118') end it "should use SSL when appropriate" do - allow(self).to receive(:request).and_return(double(:ssl? => true)) + Gitlab.config.gitlab.stub(https: true) gravatar_icon(user_email).should match('https://secure.gravatar.com') end @@ -195,4 +194,27 @@ describe ApplicationHelper do simple_sanitize(input).should == a_tag end end + + describe "link_to" do + + it "should not include rel=nofollow for internal links" do + expect(link_to("Home", root_path)).to eq("<a href=\"/\">Home</a>") + end + + it "should include rel=nofollow for external links" do + expect(link_to("Example", "http://www.example.com")).to eq("<a href=\"http://www.example.com\" rel=\"nofollow\">Example</a>") + end + + it "should include re=nofollow for external links and honor existing html_options" do + expect( + link_to("Example", "http://www.example.com", class: "toggle", data: {toggle: "dropdown"}) + ).to eq("<a class=\"toggle\" data-toggle=\"dropdown\" href=\"http://www.example.com\" rel=\"nofollow\">Example</a>") + end + + it "should include rel=nofollow for external links and preserver other rel values" do + expect( + link_to("Example", "http://www.example.com", rel: "noreferrer") + ).to eq("<a href=\"http://www.example.com\" rel=\"noreferrer nofollow\">Example</a>") + end + end end diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 49b48d26e2b..fc9d1ac90c0 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -41,7 +41,8 @@ describe GitlabMarkdownHelper do end it "should forward HTML options to links" do - gfm("Fixed in #{commit.id}", class: "foo").should have_selector("a.gfm.foo") + gfm("Fixed in #{commit.id}", @project, class: 'foo'). + should have_selector('a.gfm.foo') end describe "referencing a commit" do diff --git a/spec/helpers/merge_requests_helper.rb b/spec/helpers/merge_requests_helper.rb new file mode 100644 index 00000000000..5a317c4886b --- /dev/null +++ b/spec/helpers/merge_requests_helper.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe MergeRequestsHelper do + describe :issues_sentence do + subject { issues_sentence(issues) } + let(:issues) do + [build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)] + end + + it { should eq('#1, #2, and #3') } + end +end diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb index dce28525ca4..3ecabbaf045 100644 --- a/spec/helpers/notifications_helper_spec.rb +++ b/spec/helpers/notifications_helper_spec.rb @@ -8,7 +8,7 @@ describe NotificationsHelper do before { notification.stub(disabled?: true) } it "has a red icon" do - notification_icon(notification).should match('class="icon-volume-off cred"') + notification_icon(notification).should match('class="icon-volume-off ns-mute"') end end @@ -16,7 +16,7 @@ describe NotificationsHelper do before { notification.stub(participating?: true) } it "has a blue icon" do - notification_icon(notification).should match('class="icon-volume-down cblue"') + notification_icon(notification).should match('class="icon-volume-down ns-part"') end end @@ -24,12 +24,12 @@ describe NotificationsHelper do before { notification.stub(watch?: true) } it "has a green icon" do - notification_icon(notification).should match('class="icon-volume-up cgreen"') + notification_icon(notification).should match('class="icon-volume-up ns-watch"') end end it "has a blue icon" do - notification_icon(notification).should match('class="icon-circle-blank cblue"') + notification_icon(notification).should match('class="icon-circle-blank ns-default"') end end end diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb index 20378b1b17d..41c9f038c26 100644 --- a/spec/helpers/submodule_helper_spec.rb +++ b/spec/helpers/submodule_helper_spec.rb @@ -16,7 +16,8 @@ describe SubmoduleHelper do end it 'should detect ssh on standard port' do - Gitlab.config.gitlab.stub(ssh_port: 22) # set this just to be sure + Gitlab.config.gitlab_shell.stub(ssh_port: 22) # set this just to be sure + Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix)) stub_url([ config.user, '@', config.host, ':gitlab-org/gitlab-ce.git' ].join('')) submodule_links(submodule_item).should == [ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ] end diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 547268d44f0..224b613b477 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -402,22 +402,6 @@ describe Notify do end end - describe 'on a project wall' do - let(:note_on_the_wall_path) { project_wall_path(project, anchor: "note_#{note.id}") } - - subject { Notify.note_wall_email(recipient.id, note.id) } - - it_behaves_like 'a note email' - - it 'has the correct subject' do - should have_subject /#{project.name}/ - end - - it 'contains a link to the wall note' do - should have_body_text /#{note_on_the_wall_path}/ - end - end - describe 'on a commit' do let(:commit) { project.repository.commit } @@ -542,7 +526,7 @@ describe Notify do end it 'has the correct subject' do - should have_subject /New push to repository/ + should have_subject /#{commits.length} new commits pushed to repository/ end it 'includes commits list' do @@ -578,7 +562,7 @@ describe Notify do end it 'has the correct subject' do - should have_subject /New push to repository/ + should have_subject /#{commits.first.title}/ end it 'includes commits list' do diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index a10673fda9c..1148df87ab7 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -82,25 +82,6 @@ describe MergeRequest do end end - describe '#allow_source_branch_removal?' do - it 'should not allow removal when mr is a fork' do - - subject.disallow_source_branch_removal?.should be_true - end - it 'should not allow removal when the mr is not a fork, but the source branch is the root reference' do - subject.target_project = subject.source_project - subject.source_branch = subject.source_project.repository.root_ref - subject.disallow_source_branch_removal?.should be_true - end - - it 'should not disallow removal when the mr is not a fork, and but source branch is not the root reference' do - subject.target_project = subject.source_project - subject.source_branch = "Something Different #{subject.source_project.repository.root_ref}" - subject.for_fork?.should be_false - subject.disallow_source_branch_removal?.should be_false - end - end - describe 'detection of issues to be closed' do let(:issue0) { create :issue, project: subject.project } let(:issue1) { create :issue, project: subject.project } @@ -124,6 +105,14 @@ describe MergeRequest do subject.closes_issues.should be_empty end + + it 'detects issues mentioned in the description' do + issue2 = create(:issue, project: subject.project) + subject.description = "Closes ##{issue2.iid}" + subject.project.stub(default_branch: subject.target_branch) + + subject.closes_issues.should include(issue2) + end end it_behaves_like 'an editable mentionable' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index b42d7bfe606..a2519fbd684 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -84,7 +84,6 @@ describe Project do it { should respond_to(:satellite) } it { should respond_to(:update_merge_requests) } it { should respond_to(:execute_hooks) } - it { should respond_to(:transfer) } it { should respond_to(:name_with_namespace) } it { should respond_to(:owner) } it { should respond_to(:path_with_namespace) } diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb index 3e3543e85e1..34c1a686c96 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/project_team_spec.rb @@ -1,15 +1,66 @@ require "spec_helper" describe ProjectTeam do - let(:team) { create(:project).team } + let(:master) { create(:user) } + let(:reporter) { create(:user) } + let(:guest) { create(:user) } + let(:nonmember) { create(:user) } - describe "Respond to" do - subject { team } + context 'personal project' do + let(:project) { create(:empty_project) } - it { should respond_to(:developers) } - it { should respond_to(:masters) } - it { should respond_to(:reporters) } - it { should respond_to(:guests) } + before do + project.team << [master, :master] + project.team << [reporter, :reporter] + project.team << [guest, :guest] + end + + describe 'members collection' do + it { project.team.masters.should include(master) } + it { project.team.masters.should_not include(guest) } + it { project.team.masters.should_not include(reporter) } + it { project.team.masters.should_not include(nonmember) } + end + + describe 'access methods' do + it { project.team.master?(master).should be_true } + it { project.team.master?(guest).should be_false } + it { project.team.master?(reporter).should be_false } + it { project.team.master?(nonmember).should be_false } + end + end + + context 'group project' do + let(:group) { create(:group) } + let(:project) { create(:empty_project, group: group) } + + before do + group.add_user(master, Gitlab::Access::MASTER) + group.add_user(reporter, Gitlab::Access::REPORTER) + group.add_user(guest, Gitlab::Access::GUEST) + + # If user is a group and a project member - GitLab uses highest permission + # So we add group guest as master and add group master as guest + # to this project to test highest access + project.team << [guest, :master] + project.team << [master, :guest] + end + + describe 'members collection' do + it { project.team.reporters.should include(reporter) } + it { project.team.masters.should include(master) } + it { project.team.masters.should include(guest) } + it { project.team.masters.should_not include(reporter) } + it { project.team.masters.should_not include(nonmember) } + end + + describe 'access methods' do + it { project.team.reporter?(reporter).should be_true } + it { project.team.master?(master).should be_true } + it { project.team.master?(guest).should be_true } + it { project.team.master?(reporter).should be_false } + it { project.team.master?(nonmember).should be_false } + end end end diff --git a/spec/models/system_hook_spec.rb b/spec/models/system_hook_spec.rb index 73144397301..47d6d861d70 100644 --- a/spec/models/system_hook_spec.rb +++ b/spec/models/system_hook_spec.rb @@ -59,7 +59,7 @@ describe SystemHook do user = create(:user) project = create(:project) project.team << [user, :master] - project.users_projects.clear + project.users_projects.destroy_all WebMock.should have_requested(:post, @system_hook.url).with(body: /user_remove_from_team/).once end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 34a5bcfb4a5..4e0ebb584d1 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -83,11 +83,17 @@ describe User do user = build(:user, email: 'info@example.com') expect(user).to be_valid end + it 'accepts info+test@example.com' do user = build(:user, email: 'info+test@example.com') expect(user).to be_valid end + it "accepts o'reilly@example.com" do + user = build(:user, email: "o'reilly@example.com") + expect(user).to be_valid + end + it 'rejects test@test@example.com' do user = build(:user, email: 'test@test@example.com') expect(user).to be_invalid @@ -97,6 +103,11 @@ describe User do user = build(:user, email: 'mailto:test@example.com') expect(user).to be_invalid end + + it "rejects lol!'+=?><#$%^&*()@gmail.com" do + user = build(:user, email: "lol!'+=?><#$%^&*()@gmail.com") + expect(user).to be_invalid + end end end diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index abf6a8646ec..72589da5d40 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -91,7 +91,6 @@ describe API::API, api: true do end end - describe "POST /projects/:id/repository/branches" do it "should create a new branch" do post api("/projects/#{project.id}/repository/branches", user), @@ -112,4 +111,26 @@ describe API::API, api: true do response.status.should == 403 end end + + describe "DELETE /projects/:id/repository/branches/:branch" do + before { Repository.any_instance.stub(rm_branch: true) } + + it "should remove branch" do + delete api("/projects/#{project.id}/repository/branches/new_design", user) + response.status.should == 200 + end + + it "should remove protected branch" do + project.protected_branches.create(name: 'new_design') + delete api("/projects/#{project.id}/repository/branches/new_design", user) + response.status.should == 405 + json_response['message'].should == 'Protected branch cant be removed' + end + + it "should not remove HEAD branch" do + delete api("/projects/#{project.id}/repository/branches/master", user) + response.status.should == 405 + json_response['message'].should == 'Cannot remove HEAD branch' + end + end end diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 6fcab85335a..f27a60e4bc0 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -147,7 +147,7 @@ describe API::API, api: true do describe "POST /groups/:id/projects/:project_id" do let(:project) { create(:project) } before(:each) do - project.stub(:transfer).and_return(true) + Projects::TransferService.any_instance.stub(execute: true) Project.stub(:find).and_return(project) end @@ -160,8 +160,8 @@ describe API::API, api: true do 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) + response.status.should == 201 end end end diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 81576f7c235..2875db04ee4 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -13,58 +13,8 @@ describe API::API, api: true do 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] } - describe "GET /projects/:id/notes" do - context "when unauthenticated" do - it "should return authentication error" do - get api("/projects/#{project.id}/notes") - response.status.should == 401 - end - end - - context "when authenticated" do - it "should return project wall notes" do - get api("/projects/#{project.id}/notes", user) - response.status.should == 200 - json_response.should be_an Array - json_response.first['body'].should == wall_note.note - end - end - end - - describe "GET /projects/:id/notes/:note_id" do - it "should return a wall note by id" do - get api("/projects/#{project.id}/notes/#{wall_note.id}", user) - 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 - it "should create a new wall note" do - post api("/projects/#{project.id}/notes", user), body: 'hi!' - 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 context "when noteable is an Issue" do it "should return an array of issue notes" do @@ -143,7 +93,7 @@ describe API::API, api: true do post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' response.status.should == 201 json_response['body'].should == 'hi!' - json_response['author']['email'].should == user.email + json_response['author']['username'].should == user.username end it "should return a 400 bad request error if body not given" do @@ -162,7 +112,7 @@ describe API::API, api: true do post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user), body: 'hi!' response.status.should == 201 json_response['body'].should == 'hi!' - json_response['author']['email'].should == user.email + json_response['author']['username'].should == user.username end it "should return a 400 bad request error if body not given" do diff --git a/spec/requests/api/project_members_spec.rb b/spec/requests/api/project_members_spec.rb index ec2d6e85096..032f850010c 100644 --- a/spec/requests/api/project_members_spec.rb +++ b/spec/requests/api/project_members_spec.rb @@ -21,7 +21,7 @@ describe API::API, api: true do response.status.should == 200 json_response.should be_an Array json_response.count.should == 2 - json_response.map { |u| u['email'] }.should include user.email + json_response.map { |u| u['username'] }.should include user.username end it "finds team members with query string" do @@ -29,7 +29,7 @@ describe API::API, api: true do response.status.should == 200 json_response.should be_an Array json_response.count.should == 1 - json_response.first['email'].should == user.email + json_response.first['username'].should == user.username end it "should return a 404 error if id not found" do @@ -44,7 +44,7 @@ describe API::API, api: true do it "should return project team member" do get api("/projects/#{project.id}/members/#{user.id}", user) response.status.should == 200 - json_response['email'].should == user.email + json_response['username'].should == user.username json_response['access_level'].should == UsersProject::MASTER end @@ -62,7 +62,7 @@ describe API::API, api: true do }.to change { UsersProject.count }.by(1) response.status.should == 201 - json_response['email'].should == user2.email + json_response['username'].should == user2.username json_response['access_level'].should == UsersProject::DEVELOPER end @@ -75,7 +75,7 @@ describe API::API, api: true do }.not_to change { UsersProject.count }.by(1) response.status.should == 201 - json_response['email'].should == user2.email + json_response['username'].should == user2.username json_response['access_level'].should == UsersProject::DEVELOPER end @@ -101,7 +101,7 @@ describe API::API, api: true do it "should update project team member" do put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER response.status.should == 200 - json_response['email'].should == user3.email + json_response['username'].should == user3.username json_response['access_level'].should == UsersProject::MASTER end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 81e6abbb0d7..415735091c3 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -37,7 +37,7 @@ describe API::API, api: true do response.status.should == 200 json_response.should be_an Array json_response.first['name'].should == project.name - json_response.first['owner']['email'].should == user.email + json_response.first['owner']['username'].should == user.username end end end @@ -65,7 +65,7 @@ describe API::API, api: true do response.status.should == 200 json_response.should be_an Array json_response.first['name'].should == project.name - json_response.first['owner']['email'].should == user.email + json_response.first['owner']['username'].should == user.username end end end @@ -126,7 +126,6 @@ describe API::API, api: true do project = attributes_for(:project, { description: Faker::Lorem.sentence, issues_enabled: false, - wall_enabled: false, merge_requests_enabled: false, wiki_enabled: false }) @@ -208,7 +207,6 @@ describe API::API, api: true do project = attributes_for(:project, { description: Faker::Lorem.sentence, issues_enabled: false, - wall_enabled: false, merge_requests_enabled: false, wiki_enabled: false }) @@ -272,7 +270,7 @@ describe API::API, api: true do get api("/projects/#{project.id}", user) response.status.should == 200 json_response['name'].should == project.name - json_response['owner']['email'].should == user.email + json_response['owner']['username'].should == user.username end it "should return a project by path name" do diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 5a5222ed3c5..5afb3bddcb7 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -23,6 +23,24 @@ describe API::API, api: true do end end + describe 'POST /projects/:id/repository/tags' do + it 'should create a new tag' do + post api("/projects/#{project.id}/repository/tags", user), + tag_name: 'v1.0.0', + ref: 'master' + + response.status.should == 201 + json_response['name'].should == 'v1.0.0' + end + it 'should deny for user without push access' do + post api("/projects/#{project.id}/repository/tags", user2), + tag_name: 'v1.0.0', + ref: '621491c677087aa243f165eab467bfdfbee00be1' + + response.status.should == 403 + end + end + describe "GET /projects/:id/repository/tree" do context "authorized user" do before { project.team << [user2, :reporter] } @@ -112,4 +130,43 @@ describe API::API, api: true do response.status.should == 404 end end + + describe 'GET /GET /projects/:id/repository/compare' do + it "should compare branches" do + get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'simple_merge_request' + response.status.should == 200 + json_response['commits'].should be_present + json_response['diffs'].should be_present + end + + it "should compare tags" do + get api("/projects/#{project.id}/repository/compare", user), from: 'v1.0.1', to: 'v1.0.2' + response.status.should == 200 + json_response['commits'].should be_present + json_response['diffs'].should be_present + end + + it "should compare commits" do + get api("/projects/#{project.id}/repository/compare", user), from: 'b1e6a9dbf1c85', to: '1e689bfba395' + response.status.should == 200 + json_response['commits'].should be_empty + json_response['diffs'].should be_empty + json_response['compare_same_ref'].should be_false + end + + it "should compare commits in reverse order" do + get api("/projects/#{project.id}/repository/compare", user), from: '1e689bfba395', to: 'b1e6a9dbf1c85' + response.status.should == 200 + json_response['commits'].should be_present + json_response['diffs'].should be_present + end + + it "should compare same refs" do + get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'master' + response.status.should == 200 + json_response['commits'].should be_empty + json_response['diffs'].should be_empty + json_response['compare_same_ref'].should be_true + end + end end diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index a6d300b099b..c3eec56d133 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -20,7 +20,18 @@ describe API::API, api: true do get api("/users", user) response.status.should == 200 json_response.should be_an Array - json_response.first['email'].should == user.email + json_response.first['username'].should == user.username + end + end + + context "when admin" do + it "should return an array of users" do + get api("/users", admin) + response.status.should == 200 + json_response.should be_an Array + json_response.first.keys.should include 'email' + json_response.first.keys.should include 'extern_uid' + json_response.first.keys.should include 'can_create_project' end end end @@ -29,7 +40,7 @@ describe API::API, api: true do it "should return a user by id" do get api("/users/#{user.id}", user) response.status.should == 200 - json_response['email'].should == user.email + json_response['username'].should == user.username end it "should return a 401 if unauthenticated" do diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index fa9762625d7..4b2eb42c709 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -56,7 +56,6 @@ end # projects POST /projects(.:format) projects#create # new_project GET /projects/new(.:format) projects#new # fork_project POST /:id/fork(.:format) projects#fork -# wall_project GET /:id/wall(.:format) projects#wall # files_project GET /:id/files(.:format) projects#files # edit_project GET /:id/edit(.:format) projects#edit # project GET /:id(.:format) projects#show @@ -75,10 +74,6 @@ describe ProjectsController, "routing" do post("/gitlab/gitlabhq/fork").should route_to('projects#fork', id: 'gitlab/gitlabhq') end - it "to #wall" do - get("/gitlab/gitlabhq/wall").should route_to('projects/walls#show', project_id: 'gitlab/gitlabhq') - end - it "to #edit" do get("/gitlab/gitlabhq/edit").should route_to('projects#edit', id: 'gitlab/gitlabhq') end diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index a2d2a35140c..1e92cf62dd5 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -79,35 +79,35 @@ describe HelpController, "routing" do end it "to #permissions" do - get("/help/permissions").should route_to('help#permissions') + get("/help/permissions/permissions").should route_to('help#show', category: "permissions", file: "permissions") end it "to #workflow" do - get("/help/workflow").should route_to('help#workflow') + get("/help/workflow/README").should route_to('help#show', category: "workflow", file: "README") end it "to #api" do - get("/help/api").should route_to('help#api') + get("/help/api/README").should route_to('help#show', category: "api", file: "README") end it "to #web_hooks" do - get("/help/web_hooks").should route_to('help#web_hooks') + get("/help/web_hooks/web_hooks").should route_to('help#show', category: "web_hooks", file: "web_hooks") end it "to #system_hooks" do - get("/help/system_hooks").should route_to('help#system_hooks') + get("/help/system_hooks/system_hooks").should route_to('help#show', category: "system_hooks", file: "system_hooks") end it "to #markdown" do - get("/help/markdown").should route_to('help#markdown') + get("/help/markdown/markdown").should route_to('help#show',category: "markdown", file: "markdown") end it "to #ssh" do - get("/help/ssh").should route_to('help#ssh') + get("/help/ssh/README").should route_to('help#show', category: "ssh", file: "README") end it "to #raketasks" do - get("/help/raketasks").should route_to('help#raketasks') + get("/help/raketasks/README").should route_to('help#show', category: "raketasks", file: "README") end end @@ -245,7 +245,7 @@ describe "Groups", "routing" do end it "also display group#show on the short path" do - get("/1").should route_to('groups#show', id: '1') + get('/1').should route_to('namespaces#show', id: '1') end end diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 38aae452c3c..0eac6bed74b 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -65,7 +65,6 @@ describe Projects::CreateService do @settings.stub(:issues) { true } @settings.stub(:merge_requests) { true } @settings.stub(:wiki) { true } - @settings.stub(:wall) { true } @settings.stub(:snippets) { true } stub_const("Settings", Class.new) @restrictions = double("restrictions") @@ -108,7 +107,6 @@ describe Projects::CreateService do @settings.stub(:issues) { true } @settings.stub(:merge_requests) { true } @settings.stub(:wiki) { true } - @settings.stub(:wall) { true } @settings.stub(:snippets) { true } @settings.stub(:visibility_level) { Gitlab::VisibilityLevel::PRIVATE } stub_const("Settings", Class.new) diff --git a/spec/services/projects/image_service_spec.rb b/spec/services/projects/image_service_spec.rb new file mode 100644 index 00000000000..070c21698cf --- /dev/null +++ b/spec/services/projects/image_service_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +describe Projects::ImageService do + before(:each) { enable_observers } + after(:each) { disable_observers } + + describe 'Image service' do + before do + @user = create :user + @project = create :project, creator_id: @user.id, namespace: @user.namespace + end + + context 'for valid gif file' do + before do + gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') + @link_to_image = upload_image(@project.repository, { 'markdown_img' => gif }, "http://test.example/") + end + + it { expect(@link_to_image).to have_key("alt") } + it { expect(@link_to_image).to have_key("url") } + it { expect(@link_to_image).to have_value("banana_sample") } + it { expect(@link_to_image["url"]).to match("http://test.example/uploads/#{@project.path_with_namespace}") } + it { expect(@link_to_image["url"]).to match("banana_sample.gif") } + end + + context 'for valid png file' do + before do + png = fixture_file_upload(Rails.root + 'spec/fixtures/dk.png', 'image/png') + @link_to_image = upload_image(@project.repository, { 'markdown_img' => png }, "http://test.example/") + end + + it { expect(@link_to_image).to have_key("alt") } + it { expect(@link_to_image).to have_key("url") } + it { expect(@link_to_image).to have_value("dk") } + it { expect(@link_to_image["url"]).to match("http://test.example/uploads/#{@project.path_with_namespace}") } + it { expect(@link_to_image["url"]).to match("dk.png") } + end + + context 'for valid jpg file' do + before do + jpg = fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') + @link_to_image = upload_image(@project.repository, { 'markdown_img' => jpg }, "http://test.example/") + end + + it { expect(@link_to_image).to have_key("alt") } + it { expect(@link_to_image).to have_key("url") } + it { expect(@link_to_image).to have_value("rails_sample") } + it { expect(@link_to_image["url"]).to match("http://test.example/uploads/#{@project.path_with_namespace}") } + it { expect(@link_to_image["url"]).to match("rails_sample.jpg") } + end + + context 'for txt file' do + before do + txt = fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') + @link_to_image = upload_image(@project.repository, { 'markdown_img' => txt }, "http://test.example/") + end + + it { expect(@link_to_image).to be_nil } + end + end + + def upload_image(repository, params, root_url) + Projects::ImageService.new(repository, params, root_url).execute + end +end diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 109b429967e..563a8b0c01c 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -1,16 +1,20 @@ require 'spec_helper' -describe ProjectTransferService do +describe Projects::TransferService do before(:each) { enable_observers } after(:each) {disable_observers} - context 'namespace -> namespace' do - let(:user) { create(:user) } - let(:group) { create(:group) } - let(:project) { create(:project, namespace: user.namespace) } + let(:user) { create(:user) } + let(:group) { create(:group) } + let(:group2) { create(:group) } + let(:project) { create(:project, namespace: user.namespace) } + context 'namespace -> namespace' do before do - @result = service.transfer(project, group) + group.add_owner(user) + @service = Projects::TransferService.new(project, user, namespace_id: group.id) + @service.gitlab_shell.stub(mv_repository: true) + @result = @service.execute end it { @result.should be_true } @@ -18,16 +22,25 @@ describe ProjectTransferService do end context 'namespace -> no namespace' do - let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + before do + group.add_owner(user) + @service = Projects::TransferService.new(project, user, namespace_id: nil) + @service.gitlab_shell.stub(mv_repository: true) + @result = @service.execute + end - it { lambda{service.transfer(project, nil)}.should raise_error(ActiveRecord::RecordInvalid) } + it { @result.should be_false } + it { project.namespace.should == user.namespace } end - def service - service = ProjectTransferService.new - service.gitlab_shell.stub(mv_repository: true) - service + context 'namespace -> not allowed namespace' do + before do + @service = Projects::TransferService.new(project, user, namespace_id: group2.id) + @service.gitlab_shell.stub(mv_repository: true) + @result = @service.execute + end + + it { @result.should be_false } + it { project.namespace.should == user.namespace } end end - diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e6b1f816df0..65a641bcf12 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,6 +27,8 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} WebMock.disable_net_connect!(allow_localhost: true) RSpec.configure do |config| + config.use_transactional_fixtures = false + config.use_instantiated_fixtures = false config.mock_with :rspec config.include LoginHelpers, type: :feature @@ -39,7 +41,6 @@ RSpec.configure do |config| # 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(:suite) do TestEnv.init(observers: false, init_repos: true, repos: false) diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb index 8c9c74f14bd..d2d532d9738 100644 --- a/spec/support/db_cleaner.rb +++ b/spec/support/db_cleaner.rb @@ -1,22 +1,39 @@ -require 'database_cleaner' +# RSpec.configure do |config| +# config.around(:each) do |example| +# DatabaseCleaner.strategy = :transaction +# DatabaseCleaner.clean_with(:truncation) +# DatabaseCleaner.cleaning do +# example.run +# end +# end + +# config.around(:each, js: true) do |example| +# DatabaseCleaner.strategy = :truncation +# DatabaseCleaner.clean_with(:truncation) +# DatabaseCleaner.cleaning do +# example.run +# end +# end +# end RSpec.configure do |config| - config.before do - if example.metadata[:js] - DatabaseCleaner.strategy = :truncation - Capybara::Selenium::Driver::DEFAULT_OPTIONS[:resynchronize] = true - else - DatabaseCleaner.strategy = :transaction - end + config.before(:suite) do + DatabaseCleaner.clean_with(:truncation) + end + + config.before(:each) do + DatabaseCleaner.strategy = :transaction + end + + config.before(:each, :js => true) do + DatabaseCleaner.strategy = :truncation + end - unless example.metadata[:no_db] - DatabaseCleaner.start - end + config.before(:each) do + DatabaseCleaner.start end - config.after do - unless example.metadata[:no_db] - DatabaseCleaner.clean - end + config.after(:each) do + DatabaseCleaner.clean end end diff --git a/vendor/assets/javascripts/jquery.scrollto.js b/vendor/assets/javascripts/jquery.scrollto.js deleted file mode 100644 index 7f10b7f1082..00000000000 --- a/vendor/assets/javascripts/jquery.scrollto.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @depends jquery - * @name jquery.scrollto - * @package jquery-scrollto {@link http://balupton.com/projects/jquery-scrollto} - */ - -/** - * jQuery Aliaser - */ -(function(window,undefined){ - // Prepare - var jQuery, $, ScrollTo; - jQuery = $ = window.jQuery; - - /** - * jQuery ScrollTo (balupton edition) - * @version 1.2.0 - * @date July 9, 2012 - * @since 0.1.0, August 27, 2010 - * @package jquery-scrollto {@link http://balupton.com/projects/jquery-scrollto} - * @author Benjamin "balupton" Lupton {@link http://balupton.com} - * @copyright (c) 2010 Benjamin Arthur Lupton {@link http://balupton.com} - * @license MIT License {@link http://creativecommons.org/licenses/MIT/} - */ - ScrollTo = $.ScrollTo = $.ScrollTo || { - /** - * The Default Configuration - */ - config: { - duration: 400, - easing: 'swing', - callback: undefined, - durationMode: 'each', - offsetTop: 0, - offsetLeft: 0 - }, - - /** - * Configure ScrollTo - */ - configure: function(options){ - // Apply Options to Config - $.extend(ScrollTo.config, options||{}); - - // Chain - return this; - }, - - /** - * Perform the Scroll Animation for the Collections - * We use $inline here, so we can determine the actual offset start for each overflow:scroll item - * Each collection is for each overflow:scroll item - */ - scroll: function(collections, config){ - // Prepare - var collection, $container, container, $target, $inline, position, - containerScrollTop, containerScrollLeft, - containerScrollTopEnd, containerScrollLeftEnd, - startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted, - startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted, - scrollOptions, - callback; - - // Determine the Scroll - collection = collections.pop(); - $container = collection.$container; - container = $container.get(0); - $target = collection.$target; - - // Prepare the Inline Element of the Container - $inline = $('<span/>').css({ - 'position': 'absolute', - 'top': '0px', - 'left': '0px' - }); - position = $container.css('position'); - - // Insert the Inline Element of the Container - $container.css('position','relative'); - $inline.appendTo($container); - - // Determine the top offset - startOffsetTop = $inline.offset().top; - targetOffsetTop = $target.offset().top; - targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10); - - // Determine the left offset - startOffsetLeft = $inline.offset().left; - targetOffsetLeft = $target.offset().left; - targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10); - - // Determine current scroll positions - containerScrollTop = container.scrollTop; - containerScrollLeft = container.scrollLeft; - - // Reset the Inline Element of the Container - $inline.remove(); - $container.css('position',position); - - // Prepare the scroll options - scrollOptions = {}; - - // Prepare the callback - callback = function(event){ - // Check - if ( collections.length === 0 ) { - // Callback - if ( typeof config.callback === 'function' ) { - config.callback.apply(this,[event]); - } - } - else { - // Recurse - ScrollTo.scroll(collections,config); - } - // Return true - return true; - }; - - // Handle if we only want to scroll if we are outside the viewport - if ( config.onlyIfOutside ) { - // Determine current scroll positions - containerScrollTopEnd = containerScrollTop + $container.height(); - containerScrollLeftEnd = containerScrollLeft + $container.width(); - - // Check if we are in the range of the visible area of the container - if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) { - targetOffsetTopAdjusted = containerScrollTop; - } - if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) { - targetOffsetLeftAdjusted = containerScrollLeft; - } - } - - // Determine the scroll options - if ( targetOffsetTopAdjusted !== containerScrollTop ) { - scrollOptions.scrollTop = targetOffsetTopAdjusted; - } - if ( targetOffsetLeftAdjusted !== containerScrollLeft ) { - scrollOptions.scrollLeft = targetOffsetLeftAdjusted; - } - - // Perform the scroll - if ( $.browser.safari && container === document.body ) { - window.scrollTo(scrollOptions.scrollLeft, scrollOptions.scrollTop); - callback(); - } - else if ( scrollOptions.scrollTop || scrollOptions.scrollLeft ) { - $container.animate(scrollOptions, config.duration, config.easing, callback); - } - else { - callback(); - } - - // Return true - return true; - }, - - /** - * ScrollTo the Element using the Options - */ - fn: function(options){ - // Prepare - var collections, config, $container, container; - collections = []; - - // Prepare - var $target = $(this); - if ( $target.length === 0 ) { - // Chain - return this; - } - - // Handle Options - config = $.extend({},ScrollTo.config,options); - - // Fetch - $container = $target.parent(); - container = $container.get(0); - - // Cycle through the containers - while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) { - // Check Container for scroll differences - var scrollTop, scrollLeft; - scrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight; - scrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth; - if ( scrollTop || scrollLeft ) { - // Push the Collection - collections.push({ - '$container': $container, - '$target': $target - }); - // Update the Target - $target = $container; - } - // Update the Container - $container = $container.parent(); - container = $container.get(0); - } - - // Add the final collection - collections.push({ - '$container': $( - ($.browser.msie || $.browser.mozilla) ? 'html' : 'body' - ), - '$target': $target - }); - - // Adjust the Config - if ( config.durationMode === 'all' ) { - config.duration /= collections.length; - } - - // Handle - ScrollTo.scroll(collections,config); - - // Chain - return this; - } - }; - - // Apply our jQuery Prototype Function - $.fn.ScrollTo = $.ScrollTo.fn; - -})(window); |