diff options
137 files changed, 995 insertions, 995 deletions
diff --git a/.travis.yml b/.travis.yml index 868a6c6c238..ad00ded07cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,7 @@ services: before_script: - "cp config/database.yml.$DB config/database.yml" - "cp config/gitlab.yml.example config/gitlab.yml" - - "bundle exec rake db:create RAILS_ENV=test" - - "bundle exec rake db:migrate RAILS_ENV=test" + - "bundle exec rake db:setup RAILS_ENV=test" - "bundle exec rake db:seed_fu RAILS_ENV=test" - "sh -e /etc/init.d/xvfb start" script: "bundle exec rake travis --trace" diff --git a/CHANGELOG b/CHANGELOG index 73933e0be4b..95ed6e8db1c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,15 @@ v 4.0.0 + - Reorganized settings + - Fixed commits compare + - Refactored scss + - Improve status checks + - Validates presence of User#name + - Fixed postgres support + - Removed sqlite support + - Modified post-receive hook + - Milestones can be closed now + - Show comment events on dashboard + - Quick add team members via group#people page - [API] expose created date for hooks and SSH keys - [API] list, create issue notes - [API] list, create snippet notes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 822baa032aa..00304dd3d64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,32 +1,26 @@ -## Usage & Configuration +# Contact & support -Do you have a question related to usage or configuration, please head over to the [Support Forum](https://groups.google.com/forum/#!forum/gitlabhq). +If you want quick help, head over to our [Support Forum](https://groups.google.com/forum/#!forum/gitlabhq). +Otherwise you can follow our [Issue Submission Guide](https://github.com/gitlabhq/gitlabhq/wiki/Issue-Submission-Guide) for a more systematic and thorough guide to solving your issues. -## Contribute to GitLab +# Contribute to GitLab -If you want to contribute to GitLab, follow this process: +## Recipes -1. Fork the project -2. Create a feature branch -3. Code -4. Create a pull request +We collect user submitted installation scripts and config file templates for platforms we don't support officially. +We believe there is merit in allowing a certain amount of diversity. +You can get and submit your solution to running/configuring GitLab with your favorite OS/distro, database, web server, cloud hoster, configuration management tool, etc. -We will only accept pull requests if: +Help us improve the collection of [GitLab Recipes](https://github.com/gitlabhq/gitlab-recipes/) -* Your code has proper tests and all tests pass -* Your code can be merged w/o problems -* It won't break existing functionality -* It's quality code -* We like it :) -For examples of feedback on pull requests please look at the [closed pull requests](https://github.com/gitlabhq/gitlabhq/pulls?direction=desc&page=1&sort=created&state=closed). +## Feature suggestions -## Installation +Follow the [Issue Submission Guide](https://github.com/gitlabhq/gitlabhq/wiki/Issue-Submission-Guide) and support other peoples ideas or propose your own. -Install the Gitlab development in a virtual machine with the [Gitlab Vagrant virtual machine](https://github.com/gitlabhq/gitlab-vagrant-vm). Installing it in a virtual machine makes it much easier to set up all the dependencies for integration testing. -## Running tests +## Code -For more information on running the tests please read the [development tips](https://github.com/gitlabhq/gitlabhq/blob/master/doc/development.md) +Follow our [Developer Guide](https://github.com/gitlabhq/gitlabhq/wiki/Developer-Guide) to set you up for hacking on GitLab. @@ -124,7 +124,7 @@ group :development, :test do gem "capybara" gem "pry" gem "awesome_print" - gem "database_cleaner" + gem "database_cleaner", ref: "f89c34300e114be99532f14c115b2799a3380ac6", git: "https://github.com/bmabey/database_cleaner.git" gem "launchy" gem 'factory_girl_rails' diff --git a/Gemfile.lock b/Gemfile.lock index 7afacfce9cd..d8be14ba80a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,4 +1,11 @@ GIT + remote: https://github.com/bmabey/database_cleaner.git + revision: f89c34300e114be99532f14c115b2799a3380ac6 + ref: f89c34300e114be99532f14c115b2799a3380ac6 + specs: + database_cleaner (0.9.1) + +GIT remote: https://github.com/ctran/annotate_models.git revision: be4e26825b521f0b2d86b181e2dff89901aa9b1e specs: @@ -140,7 +147,6 @@ GEM colorize (0.5.8) crack (0.3.1) daemons (1.1.9) - database_cleaner (0.9.1) devise (2.1.2) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) @@ -458,7 +464,7 @@ DEPENDENCIES chosen-rails (= 0.9.8) coffee-rails (~> 3.2.2) colored - database_cleaner + database_cleaner! devise (~> 2.1.0) draper (~> 0.18.0) email_spec @@ -1 +1 @@ -4.0.0pre +4.0.0rc1 diff --git a/app/assets/images/switch_icon.png b/app/assets/images/switch_icon.png Binary files differnew file mode 100644 index 00000000000..7c11f206593 --- /dev/null +++ b/app/assets/images/switch_icon.png diff --git a/app/assets/javascripts/issues.js b/app/assets/javascripts/issues.js index e2fe1075903..719d2c176c1 100644 --- a/app/assets/javascripts/issues.js +++ b/app/assets/javascripts/issues.js @@ -1,43 +1,3 @@ -function switchToNewIssue(){ - $(".issues_content").hide("fade", { direction: "left" }, 150, function(){ - $('select#issue_assignee_id').chosen(); - $('select#issue_milestone_id').chosen(); - $("#new_issue_dialog").show("fade", { direction: "right" }, 150); - $('.top-tabs .add_new').hide(); - disableButtonIfEmptyField("#issue_title", ".save-btn"); - GitLab.GfmAutoComplete.setup(); - }); -} - -function switchToEditIssue(){ - $(".issues_content").hide("fade", { direction: "left" }, 150, function(){ - $('select#issue_assignee_id').chosen(); - $('select#issue_milestone_id').chosen(); - $("#edit_issue_dialog").show("fade", { direction: "right" }, 150); - $('.add_new').hide(); - disableButtonIfEmptyField("#issue_title", ".save-btn"); - GitLab.GfmAutoComplete.setup(); - }); -} - -function switchFromNewIssue(){ - backToIssues(); -} - -function switchFromEditIssue(){ - backToIssues(); -} - -function backToIssues(){ - $("#edit_issue_dialog, #new_issue_dialog").hide("fade", { direction: "right" }, 150, function(){ - $(".issues_content").show("fade", { direction: "left" }, 150, function() { - $("#edit_issue_dialog").html(""); - $("#new_issue_dialog").html(""); - $('.add_new').show(); - }); - }); -} - function initIssuesSearch() { var href = $('#issue_search_form').attr('action'); var last_terms = ''; @@ -76,23 +36,15 @@ function issuesPage(){ $(this).closest("form").submit(); }); - $("#new_issue_link").click(function(){ - updateNewIssueURL(); - }); - - $('body').on('ajax:success', '.close_issue, .reopen_issue, #new_issue', function(){ + $('body').on('ajax:success', '.close_issue, .reopen_issue', function(){ var t = $(this), totalIssues, - reopen = t.hasClass('reopen_issue'), - newIssue = false; - if( this.id == 'new_issue' ){ - newIssue = true; - } - $('.issue_counter, #new_issue').each(function(){ + reopen = t.hasClass('reopen_issue'); + $('.issue_counter').each(function(){ var issue = $(this); totalIssues = parseInt( $(this).html(), 10 ); - if( newIssue || ( reopen && issue.closest('.main_menu').length ) ){ + if( reopen && issue.closest('.main_menu').length ){ $(this).html( totalIssues+1 ); }else { $(this).html( totalIssues-1 ); @@ -126,20 +78,3 @@ function issuesCheckChanged() { $('.issues_filters').show(); } } - -function updateNewIssueURL(){ - var new_issue_link = $("#new_issue_link"); - var milestone_id = $("#milestone_id").val(); - var assignee_id = $("#assignee_id").val(); - var new_href = ""; - if(milestone_id){ - new_href = "issue[milestone_id]=" + milestone_id + "&"; - } - if(assignee_id){ - new_href = new_href + "issue[assignee_id]=" + assignee_id; - } - if(new_href.length){ - new_href = new_issue_link.attr("href") + "?" + new_href; - new_issue_link.attr("href", new_href); - } -}; diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee index 3334439ca87..f6c398c0acf 100644 --- a/app/assets/javascripts/main.js.coffee +++ b/app/assets/javascripts/main.js.coffee @@ -13,6 +13,12 @@ window.errorMessage = (message) -> ehtml.html(message) ehtml +window.split = (val) -> + return val.split( /,\s*/ ) + +window.extractLast = (term) -> + return split( term ).pop() + # Disable button if text field is empty window.disableButtonIfEmptyField = (field_selector, button_selector) -> field = $(field_selector) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index a23d4532915..00000000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,10 +0,0 @@ -/* - * This is a manifest file that'll automatically include all the stylesheets available in this directory - * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at - * the top of the compiled file, but it's generally better to create a new file per style scope. - *= require jquery.ui.gitlab - *= require jquery.atwho - *= require chosen - *= require_self - *= require main -*/ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 00000000000..54690e73f81 --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -0,0 +1,47 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require jquery.ui.gitlab + *= require jquery.atwho + *= require chosen + *= require_self +*/ + +/** + * GitLab bootstrap: + */ +@import "gitlab_bootstrap.scss"; + +@import "common.scss"; +@import "ref_select.scss"; + +@import "sections/header.scss"; +@import "sections/nav.scss"; +@import "sections/commits.scss"; +@import "sections/issues.scss"; +@import "sections/projects.scss"; +@import "sections/snippets.scss"; +@import "sections/votes.scss"; +@import "sections/merge_requests.scss"; +@import "sections/graph.scss"; +@import "sections/events.scss"; +@import "sections/themes.scss"; +@import "sections/tree.scss"; +@import "sections/notes.scss"; +@import "sections/profile.scss"; +@import "sections/login.scss"; +@import "sections/editor.scss"; + +@import "highlight/white.scss"; +@import "highlight/dark.scss"; + +/** + * UI themes: + */ +@import "themes/ui_basic.scss"; +@import "themes/ui_mars.scss"; +@import "themes/ui_modern.scss"; +@import "themes/ui_gray.scss"; +@import "themes/ui_color.scss"; + diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index d38aa1738a3..2f32845e90f 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -281,33 +281,6 @@ p.time { border: 2px solid #ddd; } -.leftbar { - h5, .title { - padding: 5px 10px; - } - - h4 { - font-size: 14px; - padding: 2px 10px; - color: #666; - border-bottom: 1px solid #f1f1f1; - } - a:last-child h4 { border: none; } - - a:hover { - h4 { - color: #111; - background: $hover; - border-color: #CCC; - .ico.project { - background-position:-209px -21px; - } - } - } - .bottom { - padding: 10px; - } -} /* Fix for readme code (stopped it from being yellow) */ @@ -321,7 +294,6 @@ p.time { } } - .highlight_word { background: #EEDC94; } diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss new file mode 100644 index 00000000000..f53e0e50bab --- /dev/null +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -0,0 +1,26 @@ +/** Override bootstrap variables **/ +$baseFontSize: 13px !default; +$baseLineHeight: 18px !default; + +// BOOTSTRAP +@import "bootstrap"; +@import "bootstrap/responsive-utilities"; +@import "bootstrap/responsive-1200px-min"; + +@import "font-awesome"; + +/** + * GitLab bootstrap. + * Overrides some styles of twitter bootstrap. + * Also give some common classes for GitLab app + */ +@import "gitlab_bootstrap/variables.scss"; +@import "gitlab_bootstrap/fonts.scss"; +@import "gitlab_bootstrap/mixins.scss"; +@import "gitlab_bootstrap/common.scss"; +@import "gitlab_bootstrap/typography.scss"; +@import "gitlab_bootstrap/buttons.scss"; +@import "gitlab_bootstrap/blocks.scss"; +@import "gitlab_bootstrap/files.scss"; +@import "gitlab_bootstrap/tables.scss"; +@import "gitlab_bootstrap/lists.scss"; diff --git a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss index f1d2b85f137..f9c8b7b05ea 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss @@ -152,19 +152,6 @@ } } - li, .wll { - padding: 10px; - &:first-child { - @include border-radius(4px 4px 0 0); - border-top: none; - } - - &:last-child { - @include border-radius(0 0 4px 4px); - border: none; - } - } - .ui-box-body { padding: 10px; } diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index b8e89e7c78a..3bb7cdbf706 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -10,11 +10,6 @@ /** COMMON CLASSES **/ .left { float:left } .right { float:right!important } -.width-50p { width:50% } -.width-49p { width:49% } -.width-30p { width:30% } -.width-65p { width:65% } -.width-100p { width:100% } .append-bottom-10 { margin-bottom:10px } .append-bottom-20 { margin-bottom:20px } .prepend-top-10 { margin-top:10px } diff --git a/app/assets/stylesheets/fonts.scss b/app/assets/stylesheets/gitlab_bootstrap/fonts.scss index 88c966d18f7..88c966d18f7 100644 --- a/app/assets/stylesheets/fonts.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/fonts.scss diff --git a/app/assets/stylesheets/gitlab_bootstrap/lists.scss b/app/assets/stylesheets/gitlab_bootstrap/lists.scss index fc97af43339..edaf3cef2cf 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/lists.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/lists.scss @@ -1,23 +1,38 @@ -/** LISTS **/ - -ul { - /** - * List li block element #1 - * - */ - .wll { +/** + * Well styled list + * + */ +.well-list { + margin: 0; + list-style: none; + li { background-color: #FFF; - padding: 10px 5px; + padding: 10px; min-height: 20px; border-bottom: 1px solid #eee; border-bottom: 1px solid rgba(0, 0, 0, 0.05); + &.disabled { + color: #888; + } + &.smoke { background-color: #f5f5f5; } + &:hover { background: $hover; border-bottom: 1px solid #ADF; } - &:last-child { border:none } + + &:first-child { + @include border-radius(4px 4px 0 0); + border-top: none; + } + + &:last-child { + @include border-radius(0 0 4px 4px); + border: none; + } + .author { color: #999; } p { @@ -29,6 +44,11 @@ ul { top: 3px; } } + + .well-title { + font-size: 14px; + line-height: 18px; + } } } diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss index 81830368c4c..81830368c4c 100644 --- a/app/assets/stylesheets/mixins.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/mixins.scss diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/gitlab_bootstrap/variables.scss index 869eb168c0d..869eb168c0d 100644 --- a/app/assets/stylesheets/variables.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/variables.scss diff --git a/app/assets/stylesheets/highlight/dark.scss b/app/assets/stylesheets/highlight/dark.scss index 4196ea7ad29..178bd583aec 100644 --- a/app/assets/stylesheets/highlight/dark.scss +++ b/app/assets/stylesheets/highlight/dark.scss @@ -2,6 +2,7 @@ pre { background-color: #333; color: #eee; + float: left; } .hll { display: block; background-color: darken($hover, 65%) } diff --git a/app/assets/stylesheets/jquery.ui.gitlab.css b/app/assets/stylesheets/jquery.ui.gitlab.css index 171857657b6..5c51600ba67 100644 --- a/app/assets/stylesheets/jquery.ui.gitlab.css +++ b/app/assets/stylesheets/jquery.ui.gitlab.css @@ -1,27 +1,3 @@ -/* - * jQuery UI CSS Framework 1.8.7 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - /* Interaction Cues ----------------------------------*/ .ui-state-disabled { cursor: default !important; } @@ -141,26 +117,6 @@ .ui-widget-overlay { background: #262b33; opacity: .70;filter:Alpha(Opacity=70); } .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #000000; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } /* - * jQuery UI Resizable 1.8.7 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute; font-size: 0.1px; z-index: 999; display: block;} -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} -/* * jQuery UI Selectable 1.8.7 * * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) @@ -240,34 +196,7 @@ cursor: pointer; font-weight: bold; } -/* - * jQuery UI Slider 1.8.7 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; background: #d7d7d7; z-index: 1; } -.ui-slider { -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.5) inset; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.5) inset; box-shadow: 0 1px 2px rgba(0,0,0,0.5) inset; } -.ui-slider .ui-slider-handle { background: url(slider_handles.png) 0px -23px no-repeat; position: absolute; z-index: 2; width: 23px; height: 23px; cursor: default; border: none; outline: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } -.ui-slider .ui-state-hover, .ui-slider .ui-state-active { background-position: 0 0; } -.ui-slider .ui-slider-range { background: #a3cae0; position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } -.ui-slider .ui-slider-range { -moz-box-shadow: 0 1px 2px rgba(17,35,45,0.6) inset; -webkit-box-shadow: 0 1px 2px rgba(17,35,45,0.6) inset; box-shadow: 0 1px 2px rgba(17,35,45,0.6) inset; } - -.ui-slider-horizontal { height: 5px; } -.ui-slider-horizontal .ui-slider-handle { top: -8px; margin-left: -13px; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: 5px; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -8px; margin-left: 0; margin-bottom: -13px; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; } /* * jQuery UI Datepicker 1.8.7 * @@ -326,45 +255,3 @@ .ui-datepicker table .ui-state-highlight { border-color: #ADE; } .ui-datepicker-calendar .ui-state-default { background: transparent; border-color: #FFF; } .ui-datepicker-calendar .ui-state-active { background: #D9EDF7; border-color: #ADE; color: #3A89A3; font-weight: bold; text-shadow: 0 1px 1px #fff; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } - - -/* Extra Input Field Styling */ -.ui-form textarea, .ui-form input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) { - padding: 3px; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - border: 1px solid #cecece; - outline: none; - -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.1) inset, 0 1px 0 rgba(255,255,255,0.2); - -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.1) inset, 0 1px 0 rgba(255,255,255,0.2); - box-shadow: 0 1px 3px rgba(0,0,0,0.1) inset, 0 1px 0 rgba(255,255,255,0.2); - -webkit-transition: all 250ms ease-in-out; - -moz-transition: all 250ms ease-in-out; - -o-transition: all 250ms ease-in-out; - transition: all 250ms ease-in-out; -} -.ui-form textarea:hover, .ui-form input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):hover { - border: 1px solid #bdbdbd; - -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.2) inset, 0 1px 0 rgba(255,255,255,0.2); - -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.2) inset, 0 1px 0 rgba(255,255,255,0.2); - box-shadow: 0 1px 3px rgba(0,0,0,0.2) inset, 0 1px 0 rgba(255,255,255,0.2); -} -.ui-form textarea:focus, .ui-form input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):focus { - border: 1px solid #95bdd4; - -webkit-box-shadow: 0 2px 3px rgba(161,202,226,0.5) inset, 0 1px 0 rgba(255,255,255,0.2); - -moz-box-shadow: 0 2px 3px rgba(161,202,226,0.5) inset, 0 1px 0 rgba(255,255,255,0.2); - box-shadow: 0 2px 3px rgba(161,202,226,0.5) inset, 0 1px 0 rgba(255,255,255,0.2); -} diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss deleted file mode 100644 index ccae351eb8f..00000000000 --- a/app/assets/stylesheets/main.scss +++ /dev/null @@ -1,141 +0,0 @@ -/** Override bootstrap variables **/ -$baseFontSize: 13px !default; -$baseLineHeight: 18px !default; - -// BOOTSTRAP -@import "bootstrap"; -@import "bootstrap/responsive-utilities"; -@import "bootstrap/responsive-1200px-min"; - -// FONT AWESOME -@import "font-awesome"; - -/** - * Variables - * Contains colors - */ -@import "variables.scss"; - -/** - * Custom fonts - * Contains @font-face font Korolev and default $monotype - */ -@import "fonts.scss"; - -/** - * General mixins. - * Contains rounded borders, gradients and shades - */ -@import "mixins.scss"; - -/** - * Header of application. - * Contain application logo, search panel, profile icon - */ -@import "sections/header.scss"; - -/** - * Navigation menu of application. - * Panel with links to pages depends on project, profile or admin area - */ -@import "sections/nav.scss"; - -/** - * This file represent some UI that can be changed - * during web app restyle or theme select. - * - * Next items should be placed there - * - link, button colors - * - header restyles - * - main menu restyles - * - */ -@import "themes/ui_basic.scss"; - -/** - * UI themes: - */ -@import "themes/ui_mars.scss"; -@import "themes/ui_modern.scss"; -@import "themes/ui_gray.scss"; -@import "themes/ui_color.scss"; - -/** - * GitLab bootstrap. - * Overrides some styles of twitter bootstrap. - * Also give some common classes for GitLab app - */ -@import "gitlab_bootstrap/common.scss"; -@import "gitlab_bootstrap/typography.scss"; -@import "gitlab_bootstrap/buttons.scss"; -@import "gitlab_bootstrap/blocks.scss"; -@import "gitlab_bootstrap/files.scss"; -@import "gitlab_bootstrap/tables.scss"; -@import "gitlab_bootstrap/lists.scss"; - - -/** - * Most of application styles placed here. - * This file represent common UI that should not be changed between themes - * or project restyling like form width or user avatar class or commit title - * - * TODO: clean it - */ -@import "common.scss"; - -/** - * Styles related to specific part of app - */ -@import "sections/commits.scss"; -@import "sections/issues.scss"; -@import "sections/projects.scss"; -@import "sections/snippets.scss"; -@import "sections/votes.scss"; -@import "sections/merge_requests.scss"; -@import "sections/graph.scss"; -@import "sections/events.scss"; -@import "sections/themes.scss"; - -/** - * This scss file redefine chozen selectbox styles for - * project Branch/Tag select element - */ -@import "ref_select.scss"; - -/** - * Code (files list) styles. Browsing project files there - */ -@import "sections/tree.scss"; - -/** - * This file represent notes(comments) styles - */ -@import "sections/notes.scss"; - -/** - * This file represent profile styles - */ -@import "sections/profile.scss"; - -/** - * Devise styles - */ -@import "sections/login.scss"; - -/** - * CODE HIGHTLIGHT BASE - * - */ -@import "highlight/white.scss"; - -/** - * CODE HIGHTLIGHT DARK schema - * - */ -@import "highlight/dark.scss"; - -/** - * File Editor styles - * - */ -@import "sections/editor.scss"; diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index bf405bfcd51..7ed53333f8c 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -229,8 +229,6 @@ /** COMMIT ROW **/ .commit { - @extend .wll; - .browse_code_link_holder { @extend .span2; float: right; @@ -302,3 +300,17 @@ color: #fff; font-family: $monospace; } + + +.commits-compare-switch{ + background: url("switch_icon.png") no-repeat center center; + width: 16px; + height: 18px; + text-indent: -9999px; + float: left; + margin-right: 9px; + border: 1px solid #DDD; + @include border-radius(4px); + padding: 4px; + background-color: #EEE; +} diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index 710426441fe..071a9c35468 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -76,7 +76,6 @@ padding: 16px 5px; &:last-child { border:none } - .wll:hover { background:none } .event_commits { margin-top: 5px; diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss index ef3821f23ef..fd995728978 100644 --- a/app/assets/stylesheets/sections/issues.scss +++ b/app/assets/stylesheets/sections/issues.scss @@ -121,12 +121,3 @@ input.check_all_issues { #update_status { width: 100px; } - - -/** - * Milestones list - * - */ -.milestone { - @extend .wll; -} diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index 3f4b591a5dd..717f85024cc 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -8,7 +8,7 @@ .groups_box, .projects_box { - h5 { + > h5 { color: $style_color; font-size: 16px; text-shadow: 0 1px 1px #fff; @@ -16,37 +16,22 @@ line-height: 32px; font-size: 14px; } - ul { - li { - padding: 0; - a { - display: block; - .group_name { - font-size: 14px; - line-height: 18px; - } - .project_name { - color: #4fa2bd; - font-size: 14px; - line-height: 18px; - } - .arrow { - float: right; - padding: 10px; - margin: 0; - } - .last_activity { - padding-top: 5px; - display: block; - span, strong { - font-size: 12px; - color: #666; - } - } + .nav-projects-tabs li { padding: 0; } + .well-list { + .arrow { + float: right; + padding: 10px; + margin: 0; + } + .last_activity { + padding-top: 5px; + display: block; + span, strong { + font-size: 12px; + color: #666; } } } - @extend .leftbar; @extend .ui-box; } } diff --git a/app/assets/stylesheets/themes/ui_basic.scss b/app/assets/stylesheets/themes/ui_basic.scss index fee179899ce..b377727779a 100644 --- a/app/assets/stylesheets/themes/ui_basic.scss +++ b/app/assets/stylesheets/themes/ui_basic.scss @@ -4,18 +4,6 @@ * */ .ui_basic { - /* - * Common styles - * - */ - a { - color: $link_color; - &:hover { - text-decoration: none; - color: $primary_color; - } - } - .app_logo { .separator { margin-left: 0; diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 5614aaa2a67..5f259bd7e27 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -30,7 +30,7 @@ class Admin::UsersController < AdminController def new - @admin_user = User.new({ projects_limit: Gitlab.config.default_projects_limit }, as: :admin) + @admin_user = User.new({ projects_limit: Gitlab.config.gitlab.default_projects_limit }, as: :admin) end def edit diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 0f28fc3a111..5a1ce2cfcc4 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -1,6 +1,6 @@ class IssuesController < ProjectResourceController before_filter :module_enabled - before_filter :issue, only: [:edit, :update, :destroy, :show] + before_filter :issue, only: [:edit, :update, :show] # Allow read any issue before_filter :authorize_read_issue! @@ -11,9 +11,6 @@ class IssuesController < ProjectResourceController # Allow modify issue before_filter :authorize_modify_issue!, only: [:edit, :update] - # Allow destroy issue - before_filter :authorize_admin_issue!, only: [:destroy] - respond_to :js, :html def index @@ -77,15 +74,6 @@ class IssuesController < ProjectResourceController end end - def destroy - @issue.destroy - - respond_to do |format| - format.html { redirect_to project_issues_path } - format.js { render nothing: true } - end - end - def sort return render_404 unless can?(current_user, :admin_issue, @project) diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb index 72f6445a593..fa4eaff8469 100644 --- a/app/controllers/merge_requests_controller.rb +++ b/app/controllers/merge_requests_controller.rb @@ -1,6 +1,6 @@ class MergeRequestsController < ProjectResourceController before_filter :module_enabled - before_filter :merge_request, only: [:edit, :update, :destroy, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status] + before_filter :merge_request, only: [:edit, :update, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status] before_filter :validates_merge_request, only: [:show, :diffs] before_filter :define_show_vars, only: [:show, :diffs] @@ -13,9 +13,6 @@ class MergeRequestsController < ProjectResourceController # Allow modify merge_request before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] - # Allow destroy merge_request - before_filter :authorize_admin_merge_request!, only: [:destroy] - def index @merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute end @@ -85,14 +82,6 @@ class MergeRequestsController < ProjectResourceController end end - def destroy - @merge_request.destroy - - respond_to do |format| - format.html { redirect_to project_merge_requests_url(@project) } - end - end - def branch_from @commit = project.commit(params[:ref]) @commit = CommitDecorator.decorate(@commit) diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 2fb783b289b..c4ebf0e4889 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -1,5 +1,5 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController - Gitlab.config.omniauth_providers.each do |provider| + Gitlab.config.omniauth.providers.each do |provider| define_method provider['name'] do handle_omniauth end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 571c0cb71b6..52715a265bd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -34,10 +34,10 @@ module ApplicationHelper def gravatar_icon(user_email = '', size = nil) size = 40 if size.nil? || size <= 0 - if Gitlab.config.disable_gravatar? || user_email.blank? + if !Gitlab.config.gravatar.enabled || user_email.blank? 'no_avatar.png' else - gravatar_url = request.ssl? ? Gitlab.config.gravatar_ssl_url : Gitlab.config.gravatar_url + gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url user_email.strip! sprintf(gravatar_url, {:hash => Digest::MD5.hexdigest(user_email.downcase), :email => URI.escape(user_email), :size => size}) end @@ -48,7 +48,7 @@ module ApplicationHelper end def web_app_url - "#{request_protocol}://#{Gitlab.config.web_host}/" + "#{request_protocol}://#{Gitlab.config.gitlab.host}/" end def last_commit(project) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 6b21f463c4c..2825787fd2f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -30,4 +30,14 @@ module IssuesHelper open: "open" } end + + def labels_autocomplete_source + labels = @project.issues_labels.order('count DESC') + labels = labels.map{ |l| { label: l.name, value: l.name } } + labels.to_json + end + + def issues_active_milestones + @project.milestones.active.order("id desc").all + end end diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 29cebadaf94..5cd9b82900c 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -3,11 +3,11 @@ class Notify < ActionMailer::Base add_template_helper ApplicationHelper add_template_helper GitlabMarkdownHelper - default_url_options[:host] = Gitlab.config.web_host - default_url_options[:protocol] = Gitlab.config.web_protocol - default_url_options[:port] = Gitlab.config.web_port if Gitlab.config.web_custom_port? + default_url_options[:host] = Gitlab.config.gitlab.host + default_url_options[:protocol] = Gitlab.config.gitlab.protocol + default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port? - default from: Gitlab.config.email_from + default from: Gitlab.config.gitlab.email_from @@ -31,6 +31,7 @@ class Notify < ActionMailer::Base def issue_status_changed_email(recipient_id, issue_id, status, updated_by_user_id) @issue = Issue.find issue_id @issue_status = status + @project = @issue.project @updated_by = User.find updated_by_user_id mail(to: recipient(recipient_id), subject: subject("changed issue ##{@issue.id}", @issue.title)) @@ -102,6 +103,12 @@ class Notify < ActionMailer::Base end + def project_was_moved_email(user_project_id) + @users_project = UsersProject.find user_project_id + @project = @users_project.project + mail(to: @users_project.user.email, + subject: subject("project was moved")) + end # # User diff --git a/app/models/commit.rb b/app/models/commit.rb index 200c915a335..ee16bf084de 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -87,14 +87,10 @@ class Commit last = project.commit(from.try(:strip)) if first && last - commits = [first, last].sort_by(&:created_at) - younger = commits.first - older = commits.last - - result[:same] = (younger.id == older.id) - result[:commits] = project.repo.commits_between(younger.id, older.id).map {|c| Commit.new(c)} - result[:diffs] = project.repo.diff(younger.id, older.id) rescue [] - result[:commit] = Commit.new(older) + result[:same] = (first.id == last.id) + result[:commits] = project.repo.commits_between(last.id, first.id).map {|c| Commit.new(c)} + result[:diffs] = project.repo.diff(last.id, first.id) rescue [] + result[:commit] = Commit.new(first) end result diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 2409fb80acb..052e0850d96 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -204,7 +204,7 @@ class MergeRequest < ActiveRecord::Base def mr_and_commit_notes commit_ids = commits.map(&:id) - Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids) + Note.where("(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))", mr_id: id, commit_ids: commit_ids) end # Returns the raw diff for this merge request diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 4be0873658a..4fac9bec259 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -62,7 +62,11 @@ class Milestone < ActiveRecord::Base end def can_be_closed? - issues.count > 0 && open? && issues.opened.count.zero? + open? && issues.opened.count.zero? + end + + def is_empty? + total_items_count.zero? end def open? diff --git a/app/models/namespace.rb b/app/models/namespace.rb index e1c24de949a..8c90f5aee26 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -48,23 +48,30 @@ class Namespace < ActiveRecord::Base end def ensure_dir_exist - namespace_dir_path = File.join(Gitlab.config.git_base_path, path) + namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path) system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path) end def move_dir if path_changed? - old_path = File.join(Gitlab.config.git_base_path, path_was) - new_path = File.join(Gitlab.config.git_base_path, path) + old_path = File.join(Gitlab.config.gitolite.repos_path, path_was) + new_path = File.join(Gitlab.config.gitolite.repos_path, path) if File.exists?(new_path) raise "Already exists" end - system("mv #{old_path} #{new_path}") + + if system("mv #{old_path} #{new_path}") + send_update_instructions + end end end def rm_dir - dir_path = File.join(Gitlab.config.git_base_path, path) + dir_path = File.join(Gitlab.config.gitolite.repos_path, path) system("rm -rf #{dir_path}") end + + def send_update_instructions + projects.each(&:send_move_instructions) + end end diff --git a/app/models/note.rb b/app/models/note.rb index 219ed9b9332..28b3879239f 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -20,7 +20,7 @@ require 'file_size_validator' class Note < ActiveRecord::Base attr_accessible :note, :noteable, :noteable_id, :noteable_type, :project_id, - :attachment, :line_code + :attachment, :line_code, :commit_id attr_accessor :notify attr_accessor :notify_author @@ -35,10 +35,14 @@ class Note < ActiveRecord::Base validates :note, :project, presence: true validates :attachment, file_size: { maximum: 10.megabytes.to_i } + validates :noteable_id, presence: true, if: ->(n) { n.noteable_type.present? && n.noteable_type != 'Commit' } + validates :commit_id, presence: true, if: ->(n) { n.noteable_type == 'Commit' } + mount_uploader :attachment, AttachmentUploader # Scopes - scope :common, ->{ where(noteable_id: nil) } + scope :for_commits, ->{ where(noteable_type: "Commit") } + scope :common, ->{ where(noteable_id: nil, commit_id: nil) } scope :today, ->{ where("created_at >= :date", date: Date.today) } scope :last_week, ->{ where("created_at >= :date", date: (Date.today - 7.days)) } scope :since, ->(day) { where("created_at >= :date", date: (day)) } @@ -66,7 +70,7 @@ class Note < ActiveRecord::Base # override to return commits, which are not active record def noteable if for_commit? - project.commit(noteable_id) + project.commit(commit_id) else super end diff --git a/app/models/project.rb b/app/models/project.rb index 5871bc67f69..3e5c912e0b4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -195,7 +195,7 @@ class Project < ActiveRecord::Base end def web_url - [Gitlab.config.url, path_with_namespace].join("/") + [Gitlab.config.gitlab.url, path_with_namespace].join("/") end def common_notes @@ -203,15 +203,15 @@ class Project < ActiveRecord::Base end def build_commit_note(commit) - notes.new(noteable_id: commit.id, noteable_type: "Commit") + notes.new(commit_id: commit.id, noteable_type: "Commit") end def commit_notes(commit) - notes.where(noteable_id: commit.id, noteable_type: "Commit", line_code: nil) + notes.where(commit_id: commit.id, noteable_type: "Commit", line_code: nil) end def commit_line_notes(commit) - notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL") + notes.where(commit_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL") end def public? @@ -259,4 +259,10 @@ class Project < ActiveRecord::Base merge_requests end end + + def send_move_instructions + self.users_projects.each do |member| + Notify.project_was_moved_email(member.id).deliver + end + end end diff --git a/app/observers/issue_observer.rb b/app/observers/issue_observer.rb index 9f9762aea07..131336be8b6 100644 --- a/app/observers/issue_observer.rb +++ b/app/observers/issue_observer.rb @@ -16,7 +16,7 @@ class IssueObserver < ActiveRecord::Observer if status Note.create_status_change_note(issue, current_user, status) [issue.author, issue.assignee].compact.each do |recipient| - Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user) + Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user.id).deliver end end end diff --git a/app/observers/project_observer.rb b/app/observers/project_observer.rb index bd41e51e8e4..b1c694569d7 100644 --- a/app/observers/project_observer.rb +++ b/app/observers/project_observer.rb @@ -3,7 +3,8 @@ class ProjectObserver < ActiveRecord::Observer project.update_repository end - def after_save(project) + def after_update(project) + project.send_move_instructions if project.namespace_id_changed? end def after_destroy(project) diff --git a/app/roles/note_event.rb b/app/roles/note_event.rb index 884ab432ec8..db4ced0c095 100644 --- a/app/roles/note_event.rb +++ b/app/roles/note_event.rb @@ -1,6 +1,6 @@ module NoteEvent def note_commit_id - target.noteable_id + target.commit_id end def note_short_commit_id @@ -16,7 +16,11 @@ module NoteEvent end def note_target_id - target.noteable_id + if note_commit? + target.commit_id + else + target.noteable_id.to_s + end end def wall_note? diff --git a/app/roles/push_observer.rb b/app/roles/push_observer.rb index 0b3d57f48a7..dda18267207 100644 --- a/app/roles/push_observer.rb +++ b/app/roles/push_observer.rb @@ -114,7 +114,7 @@ module PushObserver id: commit.id, message: commit.safe_message, timestamp: commit.date.xmlschema, - url: "#{Gitlab.config.url}/#{path_with_namespace}/commit/#{commit.id}", + url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{commit.id}", author: { name: commit.author_name, email: commit.author_email diff --git a/app/roles/repository.rb b/app/roles/repository.rb index 4e80d50cc72..78190ca96d0 100644 --- a/app/roles/repository.rb +++ b/app/roles/repository.rb @@ -97,7 +97,7 @@ module Repository end def path_to_repo - File.join(Gitlab.config.git_base_path, "#{path_with_namespace}.git") + File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git") end def namespace_dir @@ -199,7 +199,7 @@ module Repository end def http_url_to_repo - http_url = [Gitlab.config.url, "/", path_with_namespace, ".git"].join('') + http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('') end # Check if current branch name is marked as protected in the system diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml index 1b02475fa80..41f6d9b3516 100644 --- a/app/views/admin/groups/show.html.haml +++ b/app/views/admin/groups/show.html.haml @@ -22,7 +22,7 @@ %b Path: %td - %span.monospace= File.join(Gitlab.config.git_base_path, @group.path) + %span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path) %tr %td %b diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml index e33c5468555..25644d6321a 100644 --- a/app/views/admin/logs/show.html.haml +++ b/app/views/admin/logs/show.html.haml @@ -3,6 +3,8 @@ = link_to "githost.log", "#githost", 'data-toggle' => 'tab' %li = link_to "application.log", "#application", 'data-toggle' => 'tab' + %li + = link_to "production.log", "#production", 'data-toggle' => 'tab' %p.light To prevent perfomance issues admin logs output the last 2000 lines .tab-content @@ -34,3 +36,17 @@ - Gitlab::AppLogger.read_latest.each do |line| %li %p= line + .tab-pane#production + .file_holder#README + .file_title + %i.icon-file + production.log + .right + = link_to '#', class: 'log-bottom' do + %i.icon-arrow-down + Scroll down + .file_content.logs + %ol + - Gitlab::Logger.read_latest_for('production.log').each do |line| + %li + %p= line diff --git a/app/views/commits/_commits.html.haml b/app/views/commits/_commits.html.haml index c3c7d49ce74..c9217989884 100644 --- a/app/views/commits/_commits.html.haml +++ b/app/views/commits/_commits.html.haml @@ -3,4 +3,4 @@ %h5.small %i.icon-calendar = day.stamp("28 Aug, 2010") - %ul.unstyled= render commits + %ul.well-list= render commits diff --git a/app/views/compare/_form.html.haml b/app/views/compare/_form.html.haml index 07f1c818e4d..7e3a2a0e1f5 100644 --- a/app/views/compare/_form.html.haml +++ b/app/views/compare/_form.html.haml @@ -1,23 +1,30 @@ %div - %p.slead - Fill input field with commit id like - %code.label_branch 4eedf23 - or branch/tag name like - %code.label_branch master - and press compare button for commits list, code diff. + - unless params[:to] + %p.slead + Fill input field with commit id like + %code.label_branch 4eedf23 + or branch/tag name like + %code.label_branch master + and press compare button for commits list, code diff. - %br + %br = form_tag project_compare_index_path(@project), method: :post do .clearfix - = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge" - = "..." - = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" + .pull-left + - if params[:to] && params[:from] + = link_to 'switch', {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has_tooltip', title: 'Switch base of comparison'} + = text_field_tag :from, params[:from], placeholder: "master", class: "xlarge" + = "..." + = text_field_tag :to, params[:to], placeholder: "aa8b4ef", class: "xlarge" + .pull-left + + = submit_tag "Compare", class: "btn primary wide commits-compare-btn" - if @refs_are_same .alert %span Refs are the same - .actions - = submit_tag "Compare", class: "btn primary wide commits-compare-btn" + + :javascript $(function() { diff --git a/app/views/compare/show.html.haml b/app/views/compare/show.html.haml index 528c8b44af4..2abbd3fc0ee 100644 --- a/app/views/compare/show.html.haml +++ b/app/views/compare/show.html.haml @@ -9,7 +9,7 @@ - if @commits.present? %div.ui-box %h5.small Commits (#{@commits.count}) - %ul.unstyled= render @commits + %ul.well-list= render @commits - unless @diffs.empty? %h4 Diff diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml index 0ef054155b6..9e3401e51b8 100644 --- a/app/views/dashboard/_groups.html.haml +++ b/app/views/dashboard/_groups.html.haml @@ -8,11 +8,11 @@ = link_to new_admin_group_path, class: "btn very_small info" do %i.icon-plus New Group - %ul.unstyled + %ul.well-list - groups.each do |group| - %li.wll + %li = link_to group_path(id: group.path), class: dom_class(group) do - %strong.group_name= truncate(group.name, length: 35) + %strong.well-title= truncate(group.name, length: 35) %span.arrow → %span.last_activity diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml index d92983ff6a5..cffafb5445c 100644 --- a/app/views/dashboard/_projects.html.haml +++ b/app/views/dashboard/_projects.html.haml @@ -16,14 +16,14 @@ = nav_tab :scope, 'joined' do = link_to "Joined", dashboard_path(scope: 'joined') - %ul.unstyled + %ul.well-list - projects.each do |project| - %li.wll + %li = link_to project_path(project), class: dom_class(project) do - if project.namespace = project.namespace.human_name \/ - %strong.project_name + %strong.well-title = truncate(project.name, length: 25) %span.arrow → @@ -31,6 +31,6 @@ %strong Last activity: %span= project_last_activity(project) - if projects.blank? - %li.wll + %li %h3.nothing_here_message There are no projects here. .bottom= paginate projects, theme: "gitlab" diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index c2c124980f4..52863229644 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -14,7 +14,7 @@ %div.ui-box - @project = group[0] %h5= link_to_project @project - %ul.unstyled.issues_table + %ul.well-list.issues_table - group[1].each do |issue| = render(partial: 'issues/show', locals: {issue: issue}) %hr diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index ce9438405c8..ea7c8c9a3d5 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -10,11 +10,12 @@ .span9 - if @merge_requests.any? - @merge_requests.group_by(&:project).each do |group| - %ul.unstyled.ui-box + .ui-box - @project = group[0] %h5= link_to_project @project - - group[1].each do |merge_request| - = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) + %ul.well-list + - group[1].each do |merge_request| + = render(partial: 'merge_requests/merge_request', locals: {merge_request: merge_request}) %hr = paginate @merge_requests, theme: "gitlab" diff --git a/app/views/errors/gitolite.html.haml b/app/views/errors/gitolite.html.haml index 6eec95836d6..590bca71dd4 100644 --- a/app/views/errors/gitolite.html.haml +++ b/app/views/errors/gitolite.html.haml @@ -21,5 +21,5 @@ Permissions: %pre = preserve do - sudo chown -R git:git #{Gitlab.config.git_base_path} - sudo chmod -R ug+rwXs #{Gitlab.config.git_base_path} + sudo chown -R git:git #{Gitlab.config.gitolite.repos_path} + sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path} diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml index 8d0718ad650..119b8e828d0 100644 --- a/app/views/events/event/_push.html.haml +++ b/app/views/events/event/_push.html.haml @@ -12,7 +12,7 @@ - if event.push_with_commits? - project = event.project .event-body - %ul.unstyled.event_commits + %ul.well-list.event_commits - few_commits = event.commits[0...2] - few_commits.each do |commit| = render "events/commit", commit: commit, project: project diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml index 39c0b6af685..0b491879fe0 100644 --- a/app/views/groups/_projects.html.haml +++ b/app/views/groups/_projects.html.haml @@ -8,13 +8,13 @@ = link_to new_project_path(namespace_id: @group.id), class: "btn very_small info" do %i.icon-plus New Project - %ul.unstyled + %ul.well-list - if projects.blank? %p.nothing_here_message This groups has no projects yet - projects.each do |project| - %li.wll + %li = link_to project_path(project), class: dom_class(project) do - %strong.project_name= truncate(project.name, length: 25) + %strong.well-title= truncate(project.name, length: 25) %span.arrow → %span.last_activity diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index cc488d57e9e..0daf4d752a8 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -10,7 +10,7 @@ %div.ui-box - @project = group[0] %h5= @project.name - %ul.unstyled.issues_table + %ul.well-list.issues_table - group[1].each do |issue| = render(partial: 'issues/show', locals: {issue: issue}) %hr diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 23a7e7222d7..72aa4ad11e1 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -6,7 +6,7 @@ %br - if @merge_requests.any? - @merge_requests.group_by(&:project).each do |group| - %ul.unstyled.ui-box + %ul.well-list.ui-box - @project = group[0] %h5= @project.name - group[1].each do |merge_request| diff --git a/app/views/groups/people.html.haml b/app/views/groups/people.html.haml index 68102b6a85a..be3dd7a4d78 100644 --- a/app/views/groups/people.html.haml +++ b/app/views/groups/people.html.haml @@ -9,9 +9,9 @@ Team %small (#{@users.size}) - %ul.unstyled + %ul.well-list - @users.each do |user| - %li.wll + %li = image_tag gravatar_icon(user.email, 16), class: "avatar s16" %strong= user.name %span.cgray= user.email diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index 670b4e059f4..030f797c088 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -1,18 +1,18 @@ %div.issue-form-holder %h3.page_title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}" - = form_for [@project, @issue], remote: request.xhr? do |f| + = form_for [@project, @issue] do |f| -if @issue.errors.any? .alert-message.block-message.error - %ul - - @issue.errors.full_messages.each do |msg| - %li= msg + - @issue.errors.full_messages.each do |msg| + %span= msg + %br .issue_form_box .issue_title .clearfix = f.label :title do %strong= "Subject *" .input - = f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true + = f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true, required: true .issue_middle_block .issue_assignee = f.label :assignee_id do @@ -47,11 +47,38 @@ -else = f.submit 'Save changes', class: "save-btn btn" - - cancel_class = 'btn cancel-btn' - - if request.xhr? - = link_to "Cancel", "#back", onclick: "backToIssues();", class: cancel_class - - else - - if @issue.new_record? - = link_to "Cancel", project_issues_path(@project), class: cancel_class - - else - = link_to "Cancel", project_issue_path(@project, @issue), class: cancel_class + - cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue) + = link_to "Cancel", cancel_path, class: 'btn cancel-btn' + + + + +:javascript + $(function(){ + $("#issue_label_list") + .bind( "keydown", function( event ) { + if ( event.keyCode === $.ui.keyCode.TAB && + $( this ).data( "autocomplete" ).menu.active ) { + event.preventDefault(); + } + }) + .autocomplete({ + minLength: 0, + source: function( request, response ) { + response( $.ui.autocomplete.filter( + #{raw labels_autocomplete_source}, extractLast( request.term ) ) ); + }, + focus: function() { + return false; + }, + select: function(event, ui) { + var terms = split( this.value ); + terms.pop(); + terms.push( ui.item.value ); + terms.push( "" ); + this.value = terms.join( ", " ); + return false; + } + }); + }); + diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml index f82ae8bde58..d7ba4300ce7 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/issues/_issues.html.haml @@ -6,7 +6,7 @@ .row .span7= paginate @issues, remote: true, theme: "gitlab" .span3.right - %span.cgray.right + %span.cgray.right %span.issue_counter #{@issues.total_count} issues for this filter - else diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index ca8cdf704a9..4641e8bdc63 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -1,4 +1,4 @@ -%li.wll{ id: dom_id(issue), class: issue_css_classes(issue), url: project_issue_path(issue.project, issue) } +%li{ id: dom_id(issue), class: issue_css_classes(issue), url: project_issue_path(issue.project, issue) } - if controller.controller_name == 'issues' .issue_check = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue", disabled: !can?(current_user, :modify_issue, issue) @@ -16,7 +16,7 @@ = link_to 'Reopen', project_issue_path(issue.project, issue, issue: {closed: false }, status_only: true), method: :put, class: "btn small grouped reopen_issue", remote: true - else = link_to 'Close', project_issue_path(issue.project, issue, issue: {closed: true }, status_only: true), method: :put, class: "btn small grouped close_issue", remote: true - = link_to edit_project_issue_path(issue.project, issue), class: "btn small edit-issue-link grouped", remote: true do + = link_to edit_project_issue_path(issue.project, issue), class: "btn small edit-issue-link grouped" do %i.icon-edit Edit diff --git a/app/views/issues/create.js.haml b/app/views/issues/create.js.haml deleted file mode 100644 index d90cbf0d30c..00000000000 --- a/app/views/issues/create.js.haml +++ /dev/null @@ -1,10 +0,0 @@ -- if @issue.valid? - :plain - switchFromNewIssue(); - $("#issues-table").prepend("#{escape_javascript(render(partial: 'show', locals: {issue: @issue}))}"); - $.ajax({type: "GET", url: location.href, dataType: "script"}); -- else - :plain - $("#new_issue_dialog").empty(); - $("#new_issue_dialog").append("#{escape_javascript(render('form'))}"); - $('select#issue_assignee_id').chosen(); diff --git a/app/views/issues/edit.js.haml b/app/views/issues/edit.js.haml deleted file mode 100644 index a994572f9b9..00000000000 --- a/app/views/issues/edit.js.haml +++ /dev/null @@ -1,4 +0,0 @@ -:plain - $("#edit_issue_dialog").html("#{escape_javascript(render('form'))}"); - switchToEditIssue(); - diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index d89b183d360..08d4393b201 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -6,7 +6,7 @@ .right .span5 - if can? current_user, :write_issue, @project - = link_to new_project_issue_path(@project), class: "right btn", title: "New Issue", remote: true, id: "new_issue_link" do + = link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "right btn", title: "New Issue", id: "new_issue_link" do %i.icon-plus New Issue = form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do @@ -27,7 +27,7 @@ .left = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") + = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") = hidden_field_tag 'update[issues_ids]', [] = hidden_field_tag :f, params[:f] = button_tag "Save", class: "btn update_selected_issues" @@ -51,16 +51,13 @@ = form_tag project_issues_path(@project), method: :get, class: :right do = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels") = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") = hidden_field_tag :f, params[:f] .clearfix - %ul#issues-table.unstyled.issues_table + %ul#issues-table.well-list.issues_table = render "issues" -#new_issue_dialog -#edit_issue_dialog - :javascript $(function(){ issuesPage(); diff --git a/app/views/issues/new.js.haml b/app/views/issues/new.js.haml deleted file mode 100644 index 4cbcc563e28..00000000000 --- a/app/views/issues/new.js.haml +++ /dev/null @@ -1,3 +0,0 @@ -:plain - $("#new_issue_dialog").html("#{escape_javascript(render('form'))}"); - switchToNewIssue(); diff --git a/app/views/issues/update.js.haml b/app/views/issues/update.js.haml index 44722895025..7f66022a2de 100644 --- a/app/views/issues/update.js.haml +++ b/app/views/issues/update.js.haml @@ -2,13 +2,3 @@ - if @issue.valid? :plain $("##{dom_id(@issue)}").fadeOut(); -- else - - if @issue.valid? - :plain - updatePage(); - switchFromEditIssue(); - - else - :plain - $("#edit_issue_dialog").empty(); - $("#edit_issue_dialog").append("#{escape_javascript(render('form'))}"); - $('select#issue_assignee_id').chosen(); diff --git a/app/views/labels/_label.html.haml b/app/views/labels/_label.html.haml index 8a465a9e02c..6e223e8e61d 100644 --- a/app/views/labels/_label.html.haml +++ b/app/views/labels/_label.html.haml @@ -1,4 +1,4 @@ -%li.wll +%li %strong %i.icon-tag = label.name diff --git a/app/views/labels/index.html.haml b/app/views/labels/index.html.haml index 4e41d375d6a..6eb2c00e56d 100644 --- a/app/views/labels/index.html.haml +++ b/app/views/labels/index.html.haml @@ -4,7 +4,7 @@ Labels %br %div.ui-box - %ul.unstyled.labels-table + %ul.well-list.labels-table - @labels.each do |label| = render 'label', label: label diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index 35bf5577e1c..c418e1dbc68 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -3,14 +3,7 @@ %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} %title GitLab - :css - .header h1 {color: #BBBBBB !important; font: bold 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;} - .header p {color: #c6c6c6; font: normal 12px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 18px;} - .content h2 {color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; } - .content p {color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif;} - .content a {color: #0eb6ce; text-decoration: none;} - .footer p {font-size: 11px; color:#7d7a7a; margin: 0; padding: 0; font-family: Helvetica, Arial, sans-serif;} - .footer a {color: #0eb6ce; text-decoration: none;} + %body{bgcolor: "#EAEAEA", style: "margin: 0; padding: 0; background: #EAEAEA"} %table{align: "center", border: "0", cellpadding: "0", cellspacing: "0", style: "padding: 35px 0; background: #EAEAEA;", width: "100%"} %tr @@ -19,11 +12,11 @@ %tr %td{style: "font-size: 0px;", width: "20"} \Â - %td{align: "left", style: "padding: 18px 0 10px;", width: "580"} - %h1{style: "color: #BBBBBB; font: normal 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"} + %td{align: "left", style: "padding: 10px 0", width: "580"} + %h1{style: "font-size: 24px; color: #BBBBBB; font: normal 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"} GITLAB - if @project - | #{@project.name} + → #{@project.name_with_namespace} %table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"} %tr= yield %tr @@ -35,5 +28,5 @@ %p{style: "font-size: 11px; color:#7d7a7a; margin: 0; padding: 0; font-family: Helvetica, Arial, sans-serif;"} You're receiving this notification because you are a member of the - if @project - #{@project.name} + #{@project.name_with_namespace} project team. diff --git a/app/views/merge_requests/_form.html.haml b/app/views/merge_requests/_form.html.haml index 302e75cfb00..9606e2e53b3 100644 --- a/app/views/merge_requests/_form.html.haml +++ b/app/views/merge_requests/_form.html.haml @@ -32,7 +32,7 @@ .top_box_content = f.label :title do %strong= "Title *" - .input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5 + .input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5, required: true .merge_requests_middle_box .merge_requests_assignee = f.label :assignee_id do diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index 4f68c5f2620..7369f3dd061 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -1,4 +1,4 @@ -%li.wll{ class: mr_css_classes(merge_request) } +%li{ class: mr_css_classes(merge_request) } .right .left - if merge_request.merged? diff --git a/app/views/merge_requests/index.html.haml b/app/views/merge_requests/index.html.haml index 7bcb7a81e1a..5b234bfbe02 100644 --- a/app/views/merge_requests/index.html.haml +++ b/app/views/merge_requests/index.html.haml @@ -30,7 +30,7 @@ = hidden_field_tag :f, params[:f] .clearfix - %ul.unstyled + %ul.well-list = render @merge_requests - if @merge_requests.blank? %li diff --git a/app/views/merge_requests/show/_commits.html.haml b/app/views/merge_requests/show/_commits.html.haml index d25e707c64e..796922776d9 100644 --- a/app/views/merge_requests/show/_commits.html.haml +++ b/app/views/merge_requests/show/_commits.html.haml @@ -5,19 +5,19 @@ Commits (#{@commits.count}) .merge-request-commits - if @commits.count > 8 - %ul.first_mr_commits.unstyled + %ul.first_mr_commits.well-list - @commits.first(8).each do |commit| = render "commits/commit", commit: commit %li.bottom 8 of #{@commits.count} commits displayed. %strong %a.mr_show_all_commits Click here to show all - %ul.all_mr_commits.hide.unstyled + %ul.all_mr_commits.hide.well-list - @commits.each do |commit| = render "commits/commit", commit: commit - else - %ul.unstyled + %ul.well-list - @commits.each do |commit| = render "commits/commit", commit: commit diff --git a/app/views/milestones/_milestone.html.haml b/app/views/milestones/_milestone.html.haml index 462b9e395a1..3864792f7e8 100644 --- a/app/views/milestones/_milestone.html.haml +++ b/app/views/milestones/_milestone.html.haml @@ -10,15 +10,18 @@ %span.cred (Expired) %small = milestone.expires_at - .row - .span4 - .progress.progress-info - .bar{style: "width: #{milestone.percent_complete}%;"} - .span6 - = link_to project_issues_path(milestone.project, milestone_id: milestone.id) do - = pluralize milestone.issues.count, 'Issue' - - = link_to project_merge_requests_path(milestone.project, milestone_id: milestone.id) do - = pluralize milestone.merge_requests.count, 'Merge Request' - - %span.light #{milestone.percent_complete}% complete + - if milestone.is_empty? + %span.muted Empty + - else + .row + .span4 + .progress.progress-info + .bar{style: "width: #{milestone.percent_complete}%;"} + .span6 + = link_to project_issues_path(milestone.project, milestone_id: milestone.id) do + = pluralize milestone.issues.count, 'Issue' + + = link_to project_merge_requests_path(milestone.project, milestone_id: milestone.id) do + = pluralize milestone.merge_requests.count, 'Merge Request' + + %span.light #{milestone.percent_complete}% complete diff --git a/app/views/milestones/index.html.haml b/app/views/milestones/index.html.haml index 813fb362e25..3089595fe0b 100644 --- a/app/views/milestones/index.html.haml +++ b/app/views/milestones/index.html.haml @@ -18,7 +18,7 @@ = link_to project_milestones_path(@project, f: "all") do All - %ul.unstyled + %ul.well-list = render @milestones - if @milestones.present? diff --git a/app/views/notes/_common_form.html.haml b/app/views/notes/_common_form.html.haml index 0725082d504..d76be75bc27 100644 --- a/app/views/notes/_common_form.html.haml +++ b/app/views/notes/_common_form.html.haml @@ -7,6 +7,7 @@ %div= msg = f.hidden_field :noteable_id + = f.hidden_field :commit_id = f.hidden_field :noteable_type = f.text_area :note, size: 255, class: 'note-text js-gfm-input' #preview-note.preview_note.hide diff --git a/app/views/notes/_per_line_form.html.haml b/app/views/notes/_per_line_form.html.haml index c8d79850162..ff80ad4e0d5 100644 --- a/app/views/notes/_per_line_form.html.haml +++ b/app/views/notes/_per_line_form.html.haml @@ -11,6 +11,7 @@ %div= msg = f.hidden_field :noteable_id + = f.hidden_field :commit_id = f.hidden_field :noteable_type = f.hidden_field :line_code = f.text_area :note, size: 255, class: 'line-note-text js-gfm-input' diff --git a/app/views/notify/issue_status_changed_email.html.haml b/app/views/notify/issue_status_changed_email.html.haml index 59130f79d6c..c433e80c9e5 100644 --- a/app/views/notify/issue_status_changed_email.html.haml +++ b/app/views/notify/issue_status_changed_email.html.haml @@ -9,7 +9,7 @@ %tr %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %td{align: "left", style: "padding: 20px 0 0;"} - %h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} = "Issue ##{@issue.id}" = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title %br diff --git a/app/views/notify/new_issue_email.html.haml b/app/views/notify/new_issue_email.html.haml index 654d6cd12be..fba4b865487 100644 --- a/app/views/notify/new_issue_email.html.haml +++ b/app/views/notify/new_issue_email.html.haml @@ -9,7 +9,7 @@ %tr %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %td{align: "left", style: "padding: 20px 0 0;"} - %h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} = "Issue ##{@issue.id}" = link_to_gfm truncate(@issue.title, length: 45), project_issue_url(@issue.project, @issue), title: @issue.title %br diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index 151aac451fb..9819767011e 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -5,7 +5,8 @@ %td{align: "left", style: "padding: 20px 0 0;"} %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "New Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, length: 16), project_merge_request_url(@merge_request.project, @merge_request) + %p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "} + = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.project, @merge_request) %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/project_access_granted_email.html.haml b/app/views/notify/project_access_granted_email.html.haml index 72b3f0658fc..11117bf0b33 100644 --- a/app/views/notify/project_access_granted_email.html.haml +++ b/app/views/notify/project_access_granted_email.html.haml @@ -1,14 +1,15 @@ %td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{align: "left", style: "padding: 20px 0 0;"} - %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} + %td{width: "21"} + %td + %h2{style: "color:#646464;" } = "You have been granted #{@users_project.project_access_human} access to project" %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr - %td{style: "font-size: 1px; line-height: 1px;", width: "21"} - %td{align: "left", style: "padding: 20px 0 0;"} - %h2{style: "color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} - = link_to_gfm truncate(@project.name, length: 45), project_url(@project), title: @project.name + %td{width: "21"} + %td + %h3 + = link_to project_url(@project) do + = @project.name_with_namespace %br diff --git a/app/views/notify/project_was_moved_email.html.haml b/app/views/notify/project_was_moved_email.html.haml new file mode 100644 index 00000000000..222bd0fecea --- /dev/null +++ b/app/views/notify/project_was_moved_email.html.haml @@ -0,0 +1,25 @@ +%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"} + %table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #555; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"} + %tr + %td{width: "21"} + %td + %h2 + = "Project was moved to another location" + %td{width: "21"} + %tr + %td{width: "21"} + %td + %p + The project is now located under + = link_to project_url(@project) do + = @project.name_with_namespace + %p + To update the remote url in your local repository run: + %br + %table{border: "0", cellpadding: "0", cellspacing: "0", width: "558"} + %tr + %td{valign: "top"} + %p{ style: "background:#f5f5f5; padding:10px; border:1px solid #ddd" } + git remote set-url origin #{@project.ssh_url_to_repo} + %br + %td{ width: "21"} diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml index c7896af3a54..31a5d23242c 100644 --- a/app/views/notify/reassigned_issue_email.html.haml +++ b/app/views/notify/reassigned_issue_email.html.haml @@ -5,7 +5,7 @@ %td{align: "left", style: "padding: 20px 0 0;"} %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Reassigned Issue ##{@issue.id}" - = link_to_gfm truncate(@issue.title, length: 16), project_issue_url(@issue.project, @issue) + = link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue) %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml index e49b783635c..8f7308b3dba 100644 --- a/app/views/notify/reassigned_merge_request_email.html.haml +++ b/app/views/notify/reassigned_merge_request_email.html.haml @@ -5,7 +5,7 @@ %td{align: "left", style: "padding: 20px 0 0;"} %h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "} = "Reassigned Merge Request !#{@merge_request.id}" - = link_to_gfm truncate(@merge_request.title, length: 16), project_merge_request_url(@merge_request.project, @merge_request) + = link_to_gfm truncate(@merge_request.title, length: 30), project_merge_request_url(@merge_request.project, @merge_request) %td{style: "font-size: 1px; line-height: 1px;", width: "21"} %tr %td{style: "font-size: 1px; line-height: 1px;", width: "21"} diff --git a/app/views/profiles/account.html.haml b/app/views/profiles/account.html.haml index 1c51f48f401..3c290948d6c 100644 --- a/app/views/profiles/account.html.haml +++ b/app/views/profiles/account.html.haml @@ -1,4 +1,4 @@ -- if Gitlab.config.omniauth_enabled? +- if Gitlab.config.omniauth.enabled %fieldset %legend Social Accounts .oauth_select_holder @@ -71,6 +71,9 @@ %span.update-failed.cred.hide %i.icon-ok Failed + %ul.cred + %li It will change web url for personal projects. + %li It will change the git path to repositories for personal projects. .input = f.submit 'Save username', class: "btn save-btn" diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index ac36fa3aa55..934c1fdf7c4 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -33,11 +33,11 @@ %ul %li %p You can change your password on Account page - -unless Gitlab.config.disable_gravatar? + - if Gitlab.config.gravatar.enabled %li %p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"} - - if Gitlab.config.omniauth_enabled? && @user.provider? + - if Gitlab.config.omniauth.enabled && @user.provider? %li %p You can login through #{@user.provider.titleize}! diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml index ae3dbef97ad..2c94f965eec 100644 --- a/app/views/services/index.html.haml +++ b/app/views/services/index.html.haml @@ -2,24 +2,28 @@ %h3.page_title Services %br -%ul.unstyled.ui-box - %li.wll - %h4 +%ul.ui-box.well-list + %li + %h4.cgreen = link_to edit_project_service_path(@project, :gitlab_ci) do GitLab CI %small Continuous integration server from GitLab .right - if @gitlab_ci_service.try(:active) - %small.cgreen Enabled + %small.cgreen + %i.icon-ok + Enabled - else - %small.cgray Disabled - %li.wll + %small.cgray + %i.icon-off + Disabled + %li.disabled %h4 Jenkins CI %small An extendable open source continuous integration server .right %small Not implemented yet - %li.wll + %li.disabled %h4 Campfire %small Web-based group chat tool diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml index f632e1221f9..e283d9b3085 100644 --- a/app/views/shared/_clone_panel.html.haml +++ b/app/views/shared/_clone_panel.html.haml @@ -1,4 +1,4 @@ .input-prepend.project_clone_holder %button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH - %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase + %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge" diff --git a/app/views/team_members/_show.html.haml b/app/views/team_members/_show.html.haml index 8938c7d8a6d..8082f47fca8 100644 --- a/app/views/team_members/_show.html.haml +++ b/app/views/team_members/_show.html.haml @@ -1,6 +1,6 @@ - user = member.user - allow_admin = can? current_user, :admin_project, @project -%li.wll{id: dom_id(member), class: "team_member_row user_#{user.id}"} +%li{id: dom_id(member), class: "team_member_row user_#{user.id}"} .row .span6 = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do diff --git a/app/views/team_members/_team.html.haml b/app/views/team_members/_team.html.haml index e5fc4316279..462e75af183 100644 --- a/app/views/team_members/_team.html.haml +++ b/app/views/team_members/_team.html.haml @@ -1,9 +1,9 @@ - grouper_project_members(@project).each do |access, members| - %fieldset - %legend + .ui-box + %h5 = Project.access_options.key(access).pluralize %small= members.size - %ul.unstyled + %ul.well-list - members.sort_by(&:user_name).each do |up| = render(partial: 'team_members/show', locals: {member: up}) diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb index 11281b8b656..1414ed490c9 100644 --- a/app/workers/post_receive.rb +++ b/app/workers/post_receive.rb @@ -2,7 +2,7 @@ class PostReceive @queue = :post_receive def self.perform(repo_path, oldrev, newrev, ref, identifier) - repo_path.gsub!(Gitlab.config.git_base_path.to_s, "") + repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "") repo_path.gsub!(/.git$/, "") repo_path.gsub!(/^\//, "") @@ -10,7 +10,7 @@ class PostReceive return false if project.nil? # Ignore push from non-gitlab users - user = if identifier.eql? Gitlab.config.gitolite_admin_key + user = if identifier.eql? Gitlab.config.gitolite.admin_key email = project.commit(newrev).author.email rescue nil User.find_by_email(email) if email elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) diff --git a/config/database.yml.postgresql b/config/database.yml.postgresql index 17b38f3d385..0e873d2b8fb 100644 --- a/config/database.yml.postgresql +++ b/config/database.yml.postgresql @@ -9,6 +9,7 @@ production: username: postgres password: # host: localhost + # port: 5432 # socket: /tmp/postgresql.sock # diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 7fcfc5b7cf3..067dbd9b72b 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -1,57 +1,65 @@ -# # # # # # # # # # # # # # # # # # +# # # # # # # # # # # # # # # # # # # Gitlab application config file # # # # # # # # # # # # # # # # # # # # -# 1. Common settings +# 1. GitLab app settings # ========================== -# Web application specific settings -web: +## GitLab settings +gitlab: + ## Web server settings host: localhost port: 80 https: false -# Email used for notification -# about new issues, comments -email: - from: notify@localhost + ## Email settings + # Email address used in the "From" field in mails sent by GitLab + email_from: gitlab@localhost -# Application specific settings -# Like default project limit for user etc -app: + ## Project settings default_projects_limit: 10 - # backup_path: "/vol/backups" # default: Rails.root + backups/ - # backup_keep_time: 604800 # default: 0 (forever) (in seconds) - # disable_gravatar: true # default: false - Disable user avatars from Gravatar.com - # gravatar_url: "http://" # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm - # gravatar_ssl_url: "https://" # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm + +## Gravatar +gravatar: + enabled: true # Use user avatar images from Gravatar.com (default: true) + # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm + # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm + # # 2. Auth settings # ========================== -ldap: + +## LDAP settings +ldap: enabled: false host: '_your_ldap_server' base: '_the_base_where_you_search_for_users' port: 636 uid: 'sAMAccountName' - method: 'ssl' # plain + method: 'ssl' # "ssl" or "plain" bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' password: '_the_password_of_the_bind_user' +## Omniauth settings omniauth: # Enable ability for users - # to login via twitter, google .. + # Allow logging in via Twitter, Google, etc. using Omniauth providers enabled: false - # IMPORTANT! - # It allows user to login without having user account + # CAUTION! + # This allows users to login without having a user account first (default: false) + # User accounts will be created automatically when authentication was successful. allow_single_sign_on: false + # Locks down those users until they have been cleared by the admin (default: true) block_auto_created_users: true - # Auth providers + ## Auth providers + # Uncomment the lines and fill in the data of the auth provider you want to use + # If your favorite auth provider is not listed you can user others: + # see https://github.com/gitlabhq/gitlabhq/wiki/Using-Custom-Omniauth-Providers providers: # - { name: 'google_oauth2', app_id: 'YOUR APP ID', # app_secret: 'YOUR APP SECRET', @@ -62,29 +70,36 @@ omniauth: # app_secret: 'YOUR APP SECRET' } + # -# 3. Advanced settings: +# 3. Advanced settings # ========================== -# Git Hosting configuration -git_host: +## Backup settings +backup: + path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) + # keep_time: 604800 # default: 0 (forever) (in seconds) + +## Gitolite settings +gitolite: admin_uri: git@localhost:gitolite-admin - base_path: /home/git/repositories/ + repos_path: /home/git/repositories/ hooks_path: /home/git/.gitolite/hooks/ - gitolite_admin_key: gitlab - git_user: git + admin_key: gitlab upload_pack: true receive_pack: true - # host: localhost + ssh_user: git + ssh_host: localhost + # ssh_port: 22 # config_file: gitolite.conf - # port: 22 -# Git settings -# Use default values unless you understand it +## Git settings +# CAUTION! +# Use the default values unless you really know what you are doing git: - path: /usr/bin/git + bin_path: /usr/bin/git # Max size of git object like commit, in bytes # This value can be increased if you have a very large commits - git_max_size: 5242880 # 5.megabytes + max_size: 5242880 # 5.megabytes # Git timeout to read commit, in seconds - git_timeout: 10 + timeout: 10 diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index e684f37857d..4fe3ced4d8d 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -2,23 +2,43 @@ class Settings < Settingslogic source "#{Rails.root}/config/gitlab.yml" class << self + # FIXME: Deprecated: remove for 4.1 def web_protocol + ActiveSupport::Deprecation.warn("Settings.web_protocol is deprecated and will be removed from GitLab 4.1", caller) + gitlab.protocol + rescue Settingslogic::MissingSetting self.web['protocol'] ||= web.https ? "https" : "http" end + # FIXME: Deprecated: remove for 4.1 def web_host + ActiveSupport::Deprecation.warn("Settings.web_host is deprecated and will be removed from GitLab 4.1", caller) + gitlab.host + rescue Settingslogic::MissingSetting self.web['host'] ||= 'localhost' end + # FIXME: Deprecated: remove for 4.1 def email_from + ActiveSupport::Deprecation.warn("Settings.email_from is deprecated and will be removed from GitLab 4.1", caller) + gitlab.email_from + rescue Settingslogic::MissingSetting self.email['from'] ||= ("notify@" + web_host) end + # FIXME: Deprecated: remove for 4.1 def url + ActiveSupport::Deprecation.warn("Settings.url is deprecated and will be removed from GitLab 4.1", caller) + gitlab.url + rescue Settingslogic::MissingSetting self['url'] ||= build_url end + # FIXME: Deprecated: remove for 4.1 def web_port + ActiveSupport::Deprecation.warn("Settings.web_port is deprecated and will be removed from GitLab 4.1", caller) + gitlab.port.to_i + rescue Settingslogic::MissingSetting if web.https web['port'] = 443 else @@ -26,11 +46,17 @@ class Settings < Settingslogic end.to_i end + # FIXME: Deprecated: remove for 4.1 def web_custom_port? + ActiveSupport::Deprecation.warn("Settings.web_custom_port? is deprecated and will be removed from GitLab 4.1", caller) + gitlab_on_non_standard_port? + rescue Settingslogic::MissingSetting ![443, 80].include?(web_port) end + # FIXME: Deprecated: remove for 4.1 def build_url + ActiveSupport::Deprecation.warn("Settings.build_url is deprecated and will be removed from GitLab 4.1", caller) if web_custom_port? custom_port = ":#{web_port}" else @@ -44,19 +70,35 @@ class Settings < Settingslogic ].join('') end + # FIXME: Deprecated: remove for 4.1 def ssh_port + ActiveSupport::Deprecation.warn("Settings.ssh_port is deprecated and will be removed from GitLab 4.1", caller) + gitolite.ssh_port + rescue Settingslogic::MissingSetting git_host['port'] || 22 end + # FIXME: Deprecated: remove for 4.1 def ssh_user + ActiveSupport::Deprecation.warn("Settings.ssh_user is deprecated and will be removed from GitLab 4.1", caller) + gitolite.ssh_user + rescue Settingslogic::MissingSetting git_host['git_user'] || 'git' end + # FIXME: Deprecated: remove for 4.1 def ssh_host + ActiveSupport::Deprecation.warn("Settings.ssh_host is deprecated and will be removed from GitLab 4.1", caller) + gitolite.ssh_host + rescue Settingslogic::MissingSetting git_host['host'] || web_host || 'localhost' end + # FIXME: Deprecated: remove for 4.1 def ssh_path + ActiveSupport::Deprecation.warn("Settings.ssh_path is deprecated and will be removed from GitLab 4.1", caller) + gitolite.ssh_path_prefix + rescue Settingslogic::MissingSetting if ssh_port != 22 "ssh://#{ssh_user}@#{ssh_host}:#{ssh_port}/" else @@ -64,15 +106,27 @@ class Settings < Settingslogic end end + # FIXME: Deprecated: remove for 4.1 def git_base_path + ActiveSupport::Deprecation.warn("Settings.git_base_path is deprecated and will be removed from GitLab 4.1", caller) + gitolite.repos_path + rescue Settingslogic::MissingSetting git_host['base_path'] || '/home/git/repositories/' end + # FIXME: Deprecated: remove for 4.1 def git_hooks_path + ActiveSupport::Deprecation.warn("Settings.git_hooks_path is deprecated and will be removed from GitLab 4.1", caller) + gitolite.hooks_path + rescue Settingslogic::MissingSetting git_host['hooks_path'] || '/home/git/share/gitolite/hooks/' end + # FIXME: Deprecated: remove for 4.1 def git_upload_pack + ActiveSupport::Deprecation.warn("Settings.git_upload_pack is deprecated and will be removed from GitLab 4.1", caller) + gitolite.upload_pack + rescue Settingslogic::MissingSetting if git_host['upload_pack'] != false true else @@ -80,7 +134,11 @@ class Settings < Settingslogic end end + # FIXME: Deprecated: remove for 4.1 def git_receive_pack + ActiveSupport::Deprecation.warn("Settings.git_receive_pack is deprecated and will be removed from GitLab 4.1", caller) + gitolite.receive_pack + rescue Settingslogic::MissingSetting if git_host['receive_pack'] != false true else @@ -88,71 +146,207 @@ class Settings < Settingslogic end end + # FIXME: Deprecated: remove for 4.1 def git_bin_path + ActiveSupport::Deprecation.warn("Settings.git_bin_path is deprecated and will be removed from GitLab 4.1", caller) + git.bin_path + rescue Settingslogic::MissingSetting git['path'] || '/usr/bin/git' end + # FIXME: Deprecated: remove for 4.1 def git_max_size + ActiveSupport::Deprecation.warn("Settings.git_max_size is deprecated and will be removed from GitLab 4.1", caller) + git.max_size + rescue Settingslogic::MissingSetting git['git_max_size'] || 5242880 # 5.megabytes end + # FIXME: Deprecated: remove for 4.1 def git_timeout + ActiveSupport::Deprecation.warn("Settings.git_timeout is deprecated and will be removed from GitLab 4.1", caller) + git.timeout + rescue Settingslogic::MissingSetting git['git_timeout'] || 10 end + # FIXME: Deprecated: remove for 4.1 def gitolite_admin_uri + ActiveSupport::Deprecation.warn("Settings.gitolite_admin_uri is deprecated and will be removed from GitLab 4.1", caller) + gitolite.admin_uri + rescue Settingslogic::MissingSetting git_host['admin_uri'] || 'git@localhost:gitolite-admin' end + # FIXME: Deprecated: remove for 4.1 def gitolite_config_file + ActiveSupport::Deprecation.warn("Settings.gitolite_config_file is deprecated and will be removed from GitLab 4.1", caller) + gitolite.config_file + rescue Settingslogic::MissingSetting git_host['config_file'] || 'gitolite.conf' end + # FIXME: Deprecated: remove for 4.1 def gitolite_admin_key + ActiveSupport::Deprecation.warn("Settings.gitolite_admin_key is deprecated and will be removed from GitLab 4.1", caller) + gitolite.admin_key + rescue Settingslogic::MissingSetting git_host['gitolite_admin_key'] || 'gitlab' end + # FIXME: Deprecated: remove for 4.1 def default_projects_limit + ActiveSupport::Deprecation.warn("Settings.default_projects_limit is deprecated and will be removed from GitLab 4.1", caller) + gitlab.default_projects_limit + rescue Settingslogic::MissingSetting app['default_projects_limit'] || 10 end + # FIXME: Deprecated: remove for 4.1 def backup_path - t = app['backup_path'] || "backups/" - t = /^\//.match(t) ? t : Rails.root .join(t) - t + ActiveSupport::Deprecation.warn("Settings.backup_path is deprecated and will be removed from GitLab 4.1", caller) + backup.path + rescue Settingslogic::MissingSetting + File.expand_path(app['backup_path'] || "backups/", Rails.root) end + # FIXME: Deprecated: remove for 4.1 def backup_keep_time + ActiveSupport::Deprecation.warn("Settings.backup_keep_time is deprecated and will be removed from GitLab 4.1", caller) + backup.keep_time + rescue Settingslogic::MissingSetting app['backup_keep_time'] || 0 end + # FIXME: Deprecated: remove for 4.1 def ldap_enabled? - ldap && ldap['enabled'] + ActiveSupport::Deprecation.warn("Settings.ldap_enabled? is deprecated and will be removed from GitLab 4.1", caller) + ldap.enabled rescue Settingslogic::MissingSetting false end + # FIXME: Deprecated: remove for 4.1 def omniauth_enabled? - omniauth && omniauth['enabled'] + ActiveSupport::Deprecation.warn("Settings.omniauth_enabled? is deprecated and will be removed from GitLab 4.1", caller) + omniauth.enabled rescue Settingslogic::MissingSetting false end + # FIXME: Deprecated: remove for 4.1 def omniauth_providers - (omniauth_enabled? && omniauth['providers']) || [] + ActiveSupport::Deprecation.warn("Settings.omniauth_providers is deprecated and will be removed from GitLab 4.1", caller) + omniauth.providers + rescue Settingslogic::MissingSetting + [] end + # FIXME: Deprecated: remove for 4.1 def disable_gravatar? + ActiveSupport::Deprecation.warn("Settings.disable_gravatar? is deprecated and will be removed from GitLab 4.1", caller) + !gravatar.enabled + rescue Settingslogic::MissingSetting app['disable_gravatar'] || false end + # FIXME: Deprecated: remove for 4.1 def gravatar_url + ActiveSupport::Deprecation.warn("Settings.gravatar_url is deprecated and will be removed from GitLab 4.1", caller) + gravatar.plain_url + rescue Settingslogic::MissingSetting app['gravatar_url'] || 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' end + # FIXME: Deprecated: remove for 4.1 def gravatar_ssl_url + ActiveSupport::Deprecation.warn("Settings.gravatar_ssl_url is deprecated and will be removed from GitLab 4.1", caller) + gravatar.ssl_url + rescue Settingslogic::MissingSetting app['gravatar_ssl_url'] || 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' end + + + def gitlab_on_non_standard_port? + ![443, 80].include?(gitlab.port.to_i) + end + + private + + def build_gitolite_ssh_path_prefix + if gitolite.ssh_port != 22 + "ssh://#{gitolite.ssh_user}@#{gitolite.ssh_host}:#{gitolite.ssh_port}/" + else + "#{gitolite.ssh_user}@#{gitolite.ssh_host}:" + end + end + + def build_gitlab_url + if gitlab_on_non_standard_port? + custom_port = ":#{gitlab.port}" + else + custom_port = nil + end + [ gitlab.protocol, + "://", + gitlab.host, + custom_port + ].join('') + end end end + + +# Default settings + +# FIXME: Deprecated: remove for 4.1 +# all Settings.web ... +# all Settings.app ... +# all Settings.email ... +# all Settings.git_host ... +Settings['pre_40_config'] ||= Settings['web'].present? + +Settings['ldap'] ||= Settingslogic.new({}) +Settings.ldap['enabled'] ||= false + +Settings['omniauth'] ||= Settingslogic.new({}) +Settings.omniauth['enabled'] ||= false +Settings.omniauth['providers'] ||= [] + +Settings['gitlab'] ||= Settingslogic.new({}) +Settings.gitlab['default_projects_limit'] ||= Settings.pre_40_config ? Settings.default_projects_limit : 10 +Settings.gitlab['host'] ||= Settings.pre_40_config ? Settings.web_host : 'localhost' +Settings.gitlab['https'] ||= Settings.pre_40_config ? Settings.web.https : false +Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 +Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" +Settings.gitlab['email_from'] ||= Settings.pre_40_config ? Settings.email_from : "gitlab@#{Settings.gitlab.host}" +Settings.gitlab['url'] ||= Settings.pre_40_config ? Settings.url : Settings.send(:build_gitlab_url) + +Settings['gravatar'] ||= Settingslogic.new({}) +Settings.gravatar['enabled'] ||= Settings.pre_40_config ? !Settings.disable_gravatar? : true +Settings.gravatar['plain_url'] ||= Settings.pre_40_config ? Settings.gravatar_url : 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' +Settings.gravatar['ssl_url'] ||= Settings.pre_40_config ? Settings.gravatar_ssl_url : 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' + +Settings['gitolite'] ||= Settingslogic.new({}) +Settings.gitolite['admin_key'] ||= Settings.pre_40_config ? Settings.gitolite_admin_key : 'gitlab' +Settings.gitolite['admin_uri'] ||= Settings.pre_40_config ? Settings.gitolite_admin_uri : 'git@localhost:gitolite-admin' +Settings.gitolite['config_file'] ||= Settings.pre_40_config ? Settings.gitolite_config_file : 'gitolite.conf' +Settings.gitolite['hooks_path'] ||= Settings.pre_40_config ? Settings.git_hooks_path : '/home/git/share/gitolite/hooks/' +Settings.gitolite['receive_pack'] ||= Settings.pre_40_config ? Settings.git_receive_pack : (Settings.gitolite['receive_pack'] != false) +Settings.gitolite['repos_path'] ||= Settings.pre_40_config ? Settings.git_base_path : '/home/git/repositories/' +Settings.gitolite['upload_pack'] ||= Settings.pre_40_config ? Settings.git_upload_pack : (Settings.gitolite['upload_pack'] != false) +Settings.gitolite['ssh_host'] ||= Settings.pre_40_config ? Settings.ssh_host : (Settings.gitlab.host || 'localhost') +Settings.gitolite['ssh_port'] ||= Settings.pre_40_config ? Settings.ssh_port : 22 +Settings.gitolite['ssh_user'] ||= Settings.pre_40_config ? Settings.ssh_user : 'git' +Settings.gitolite['ssh_path_prefix'] ||= Settings.pre_40_config ? Settings.ssh_path : Settings.send(:build_gitolite_ssh_path_prefix) + +Settings['backup'] ||= Settingslogic.new({}) +Settings.backup['keep_time'] ||= Settings.pre_40_config ? Settings.backup_keep_time : 0 +Settings.backup['path'] = Settings.pre_40_config ? Settings.backup_path : File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) + +Settings['git'] ||= Settingslogic.new({}) +Settings.git['max_size'] ||= Settings.pre_40_config ? Settings.git_max_size : 5242880 # 5.megabytes +Settings.git['bin_path'] ||= Settings.pre_40_config ? Settings.git_bin_path : '/usr/bin/git' +Settings.git['timeout'] ||= Settings.pre_40_config ? Settings.git_timeout : 10 +Settings.git['path'] ||= Settings.git.bin_path # FIXME: Deprecated: remove for 4.1 diff --git a/config/initializers/3_grit_ext.rb b/config/initializers/3_grit_ext.rb index d114ea6cc8b..097c301a06a 100644 --- a/config/initializers/3_grit_ext.rb +++ b/config/initializers/3_grit_ext.rb @@ -1,8 +1,8 @@ require 'grit' require 'pygments' -Grit::Git.git_timeout = Gitlab.config.git_timeout -Grit::Git.git_max_size = Gitlab.config.git_max_size +Grit::Git.git_timeout = Gitlab.config.git.timeout +Grit::Git.git_max_size = Gitlab.config.git.max_size Grit::Blob.class_eval do include Linguist::BlobHelper diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 8f3cef5a2ac..ed3ab71862a 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -4,7 +4,7 @@ Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class with default "from" parameter. - config.mailer_sender = Gitlab.config.email_from + config.mailer_sender = Gitlab.config.gitlab.email_from # Configure the class responsible to send e-mails. # config.mailer = "Devise::Mailer" @@ -205,20 +205,18 @@ Devise.setup do |config| # manager.default_strategies(:scope => :user).unshift :some_external_strategy # end - gl = Gitlab.config - - if gl.ldap_enabled? + if Gitlab.config.ldap.enabled config.omniauth :ldap, - :host => gl.ldap['host'], - :base => gl.ldap['base'], - :uid => gl.ldap['uid'], - :port => gl.ldap['port'], - :method => gl.ldap['method'], - :bind_dn => gl.ldap['bind_dn'], - :password => gl.ldap['password'] + :host => Gitlab.config.ldap['host'], + :base => Gitlab.config.ldap['base'], + :uid => Gitlab.config.ldap['uid'], + :port => Gitlab.config.ldap['port'], + :method => Gitlab.config.ldap['method'], + :bind_dn => Gitlab.config.ldap['bind_dn'], + :password => Gitlab.config.ldap['password'] end - gl.omniauth_providers.each do |gl_provider| - config.omniauth gl_provider['name'].to_sym, gl_provider['app_id'], gl_provider['app_secret'] + Gitlab.config.omniauth.providers.each do |provider| + config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'] end end diff --git a/config/routes.rb b/config/routes.rb index 6e20ae77398..e08bfebc020 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,10 +14,10 @@ Gitlab::Application.routes.draw do # Enable Grack support mount Grack::Bundle.new({ - git_path: Gitlab.config.git_bin_path, - project_root: Gitlab.config.git_base_path, - upload_pack: Gitlab.config.git_upload_pack, - receive_pack: Gitlab.config.git_receive_pack + git_path: Gitlab.config.git.bin_path, + project_root: Gitlab.config.gitolite.repos_path, + upload_pack: Gitlab.config.gitolite.upload_pack, + receive_pack: Gitlab.config.gitolite.receive_pack }), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ } # @@ -164,7 +164,7 @@ Gitlab::Application.routes.draw do end end - resources :merge_requests, constraints: {id: /\d+/} do + resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do member do get :diffs get :automerge @@ -200,9 +200,9 @@ Gitlab::Application.routes.draw do :via => [:get, :post], constraints: {from: /.+/, to: /.+/} resources :team, controller: 'team_members', only: [:index] - resources :milestones + resources :milestones, except: [:destroy] resources :labels, only: [:index] - resources :issues do + resources :issues, except: [:destroy] do collection do post :sort post :bulk_update diff --git a/db/migrate/20121218164840_move_noteable_commit_to_own_field.rb b/db/migrate/20121218164840_move_noteable_commit_to_own_field.rb new file mode 100644 index 00000000000..6f2da4136a3 --- /dev/null +++ b/db/migrate/20121218164840_move_noteable_commit_to_own_field.rb @@ -0,0 +1,20 @@ +class MoveNoteableCommitToOwnField < ActiveRecord::Migration + def up + add_column :notes, :commit_id, :string, null: true + add_column :notes, :new_noteable_id, :integer, null: true + Note.where(noteable_type: 'Commit').update_all('commit_id = noteable_id') + + if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' + Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = CAST (noteable_id AS INTEGER)') + else + Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = noteable_id') + end + + remove_column :notes, :noteable_id + rename_column :notes, :new_noteable_id, :noteable_id + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/migrate/20121219095402_indices_for_notes.rb b/db/migrate/20121219095402_indices_for_notes.rb new file mode 100644 index 00000000000..4c5d041ce81 --- /dev/null +++ b/db/migrate/20121219095402_indices_for_notes.rb @@ -0,0 +1,6 @@ +class IndicesForNotes < ActiveRecord::Migration + def change + add_index :notes, :commit_id + add_index :notes, [:project_id, :noteable_type] + end +end diff --git a/db/schema.rb b/db/schema.rb index 923d2c5543e..7de5593285a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20121205201726) do +ActiveRecord::Schema.define(:version => 20121219095402) do create_table "events", :force => true do |t| t.string "target_type" @@ -124,7 +124,6 @@ ActiveRecord::Schema.define(:version => 20121205201726) do create_table "notes", :force => true do |t| t.text "note" - t.string "noteable_id" t.string "noteable_type" t.integer "author_id" t.datetime "created_at", :null => false @@ -132,11 +131,14 @@ ActiveRecord::Schema.define(:version => 20121205201726) do t.integer "project_id" t.string "attachment" t.string "line_code" + t.string "commit_id" + t.integer "noteable_id" end + add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" add_index "notes", ["created_at"], :name => "index_notes_on_created_at" - add_index "notes", ["noteable_id"], :name => "index_notes_on_noteable_id" add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" + add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" add_index "notes", ["project_id"], :name => "index_notes_on_project_id" create_table "projects", :force => true do |t| diff --git a/doc/development.md b/doc/development.md deleted file mode 100644 index b7213adc1e0..00000000000 --- a/doc/development.md +++ /dev/null @@ -1,36 +0,0 @@ -## Development tips: - - -### Installation - -Install the Gitlab development in a virtual machine with the [Gitlab Vagrant virtual machine](https://github.com/gitlabhq/gitlab-vagrant-vm). Installing it in a virtual machine makes it much easier to set up all the dependencies for integration testing. - - -### Start application in development mode - -#### 1. Via foreman - - bundle exec foreman start -p 3000 - -#### 2. Manually - - bundle exec rails s - bundle exec rake environment resque:work QUEUE=* VVERBOSE=1 - - -### Test DB setup & seed - - bundle exec rake db:setup RAILS_ENV=test - bundle exec rake db:seed_fu RAILS_ENV=test - - -### Run the Tests - - # All in one - bundle exec rake gitlab:test - - # Rspec - bundle exec rake spec - - # Spinach - bundle exec rake spinach diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index 575467b4371..bbfeeb716fa 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -4,7 +4,7 @@ Creates a backup archive of the database and all repositories. This archive will The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup. ``` -bundle exec rake gitlab:app:backup_create +bundle exec rake gitlab:backup:create ``` Example output: @@ -40,7 +40,7 @@ Deleting old backups... [SKIPPING] ### Restore a previously created backup ``` -bundle exec rake gitlab:app:backup_restore +bundle exec rake gitlab:backup:restore ``` Options: diff --git a/doc/raketasks/features.md b/doc/raketasks/features.md index 2a66b1caca7..7a2a4b668bd 100644 --- a/doc/raketasks/features.md +++ b/doc/raketasks/features.md @@ -1,6 +1,6 @@ ### Enable usernames and namespaces for user projects -This command will enable the namespace feature introduced in v4.0. It will move every project in its namespace folder. +This command will enable the namespaces feature introduced in v4.0. It will move every project in its namespace folder. Note: @@ -13,7 +13,7 @@ Old path: `git@example.org:myrepo.git` New path: `git@example.org:username/myrepo.git` or `git@example.org:groupname/myrepo.git` ``` -bundle exec rake gitlab:activate_namespaces +bundle exec rake gitlab:enable_namespaces ``` @@ -22,7 +22,7 @@ bundle exec rake gitlab:activate_namespaces This command will enable the auto merge feature. After this you will be able to **merge a merge request** via GitLab and use the **online editor**. ``` -bundle exec rake gitlab:app:enable_automerge +bundle exec rake gitlab:enable_automerge ``` Example output: diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index 7be631a773d..bb8e1ed29f7 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -139,6 +139,16 @@ Checking GitLab ... Finished ``` +### (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. + +``` +bundle exec rake gitlab:satellites:create +``` + + ### Rebuild each key at gitolite config This will send all users ssh public keys to gitolite and grant them access (based on their permission) to their projects. diff --git a/doc/raketasks/user_management.md b/doc/raketasks/user_management.md index e4ca5280b78..021ce35931f 100644 --- a/doc/raketasks/user_management.md +++ b/doc/raketasks/user_management.md @@ -1,7 +1,7 @@ ### Add user to as a developer to all projects ``` -bundle exec rake add_user_to_project_teams[username@domain.tld] +bundle exec rake gitlab:import:user_to_projects[username@domain.tld] ``` @@ -12,5 +12,5 @@ Notes: * admin users are added as masters ``` -bundle exec rake add_users_to_project_teams +bundle exec rake gitlab:import:all_users_to_all_projects ``` diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index 99529373d4d..d6ef384c9a6 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -24,11 +24,9 @@ Feature: Project Issues Given I click link "Release 0.4" Then I should see issue "Release 0.4" - @javascript Scenario: I submit new unassigned issue Given I click link "New Issue" And I submit new issue "500 error on profile" - Given I click link "500 error on profile" Then I should see issue "500 error on profile" @javascript @@ -57,26 +55,19 @@ Feature: Project Issues Then I should see "Release 0.3" in issues And I should not see "Release 0.4" in issues - # TODO: find out solution for poltergeist/phantomjs or remove - # @javascript - # Scenario: I clear search - # Given I click link "All" - # And I fill in issue search with "Something" - # And I fill in issue search with "" - # Then I should see "Release 0.4" in issues - # And I should see "Release 0.3" in issues + # Disable this two cause of random failing + # TODO: fix after v4.0 released + #@javascript + #Scenario: I create Issue with pre-selected milestone + #Given project "Shop" has milestone "v2.2" + #And project "Shop" has milestone "v3.0" + #And I visit project "Shop" issues page + #When I select milestone "v3.0" + #And I click link "New Issue" + #Then I should see selected milestone with title "v3.0" - @javascript - Scenario: I create Issue with pre-selected milestone - Given project "Shop" has milestone "v2.2" - And project "Shop" has milestone "v3.0" - And I visit project "Shop" issues page - When I select milestone "v3.0" - And I click link "New Issue" - Then I should see selected milestone with title "v3.0" - - @javascript - Scenario: I create Issue with pre-selected assignee - When I select first assignee from "Shop" project - And I click link "New Issue" - Then I should see first assignee from "Shop" as selected assignee + #@javascript + #Scenario: I create Issue with pre-selected assignee + #When I select first assignee from "Shop" project + #And I click link "New Issue" + #Then I should see first assignee from "Shop" as selected assignee diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb index 6bf164e2c8f..2c03ce14fc1 100644 --- a/features/steps/project/project_browse_commits.rb +++ b/features/steps/project/project_browse_commits.rb @@ -32,8 +32,8 @@ class ProjectBrowseCommits < Spinach::FeatureSteps end And 'I fill compare fields with refs' do - fill_in "from", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" - fill_in "to", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812" + fill_in "from", with: "8716fc78f3c65bbf7bcf7b574febd583bc5d2812" + fill_in "to", with: "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" click_button "Compare" end diff --git a/features/steps/project/project_issues.rb b/features/steps/project/project_issues.rb index cc0acb5b481..2103aeb1715 100644 --- a/features/steps/project/project_issues.rb +++ b/features/steps/project/project_issues.rb @@ -95,7 +95,7 @@ class ProjectIssues < Spinach::FeatureSteps end Then 'I should see selected milestone with title "v3.0"' do - issues_milestone_selector = "#milestone_id_chzn > a" + issues_milestone_selector = "#issue_milestone_id_chzn > a" page.find(issues_milestone_selector).should have_content("v3.0") end @@ -106,7 +106,7 @@ class ProjectIssues < Spinach::FeatureSteps end Then 'I should see first assignee from "Shop" as selected assignee' do - issues_assignee_selector = "#assignee_id_chzn > a" + issues_assignee_selector = "#issue_assignee_id_chzn > a" project = Project.find_by_name "Shop" assignee_name = project.users.first.name page.find(issues_assignee_selector).should have_content(assignee_name) diff --git a/features/support/env.rb b/features/support/env.rb index a30b357718e..500de0f3e20 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -33,11 +33,9 @@ DatabaseCleaner.strategy = :truncation Spinach.hooks.before_scenario do # Use tmp dir for FS manipulations - Gitlab.config.stub(git_base_path: Rails.root.join('tmp', 'test-git-base-path')) - FileUtils.rm_rf Gitlab.config.git_base_path - FileUtils.mkdir_p Gitlab.config.git_base_path - - DatabaseCleaner.start + Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path')) + FileUtils.rm_rf Gitlab.config.gitolite.repos_path + FileUtils.mkdir_p Gitlab.config.gitolite.repos_path end Spinach.hooks.after_scenario do diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 056fb034daf..8c45c93557e 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -38,7 +38,7 @@ module Gitlab email: email, password: password, password_confirmation: password, - projects_limit: Gitlab.config.default_projects_limit, + projects_limit: Gitlab.config.gitlab.default_projects_limit, }, as: :admin) if Gitlab.config.omniauth['block_auto_created_users'] && !ldap @user.blocked = true diff --git a/lib/gitlab/backend/gitolite.rb b/lib/gitlab/backend/gitolite.rb index 7c3861bdd13..3b8a2090f73 100644 --- a/lib/gitlab/backend/gitolite.rb +++ b/lib/gitlab/backend/gitolite.rb @@ -38,7 +38,7 @@ module Gitlab end def url_to_repo path - Gitlab.config.ssh_path + "#{path}.git" + Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git" end def enable_automerge diff --git a/lib/gitlab/backend/gitolite_config.rb b/lib/gitlab/backend/gitolite_config.rb index 70ccc4782c6..a2bc4ca8d74 100644 --- a/lib/gitlab/backend/gitolite_config.rb +++ b/lib/gitlab/backend/gitolite_config.rb @@ -16,7 +16,7 @@ module Gitlab def ga_repo @ga_repo ||= ::Gitolite::GitoliteAdmin.new( File.join(config_tmp_dir,'gitolite'), - conf: Gitlab.config.gitolite_config_file + conf: Gitlab.config.gitolite.config_file ) end @@ -167,7 +167,7 @@ module Gitlab # Enable access to all repos for gitolite admin. # We use it for accept merge request feature def admin_all_repo - owner_name = Gitlab.config.gitolite_admin_key + owner_name = Gitlab.config.gitolite.admin_key # @ALL repos premission for gitolite owner repo_name = "@all" @@ -189,7 +189,7 @@ module Gitlab def pull tmp_dir Dir.mkdir tmp_dir - `git clone #{Gitlab.config.gitolite_admin_uri} #{tmp_dir}/gitolite` + `git clone #{Gitlab.config.gitolite.admin_uri} #{tmp_dir}/gitolite` unless File.exists?(File.join(tmp_dir, 'gitolite', 'conf', 'gitolite.conf')) raise PullError, "unable to clone gitolite-admin repo" diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb index 8b4eee5da06..389eef3395f 100644 --- a/lib/gitlab/logger.rb +++ b/lib/gitlab/logger.rb @@ -14,6 +14,11 @@ module Gitlab logs = `tail -n 2000 #{path}`.split("\n") end + def self.read_latest_for filename + path = Rails.root.join("log", filename) + logs = `tail -n 2000 #{path}`.split("\n") + end + def self.build new(Rails.root.join("log", file_name)) end diff --git a/lib/gitlab/project_mover.rb b/lib/gitlab/project_mover.rb index eeab22ae6e7..def6e90001b 100644 --- a/lib/gitlab/project_mover.rb +++ b/lib/gitlab/project_mover.rb @@ -15,10 +15,10 @@ module Gitlab def execute # Create new dir if missing - new_dir_path = File.join(Gitlab.config.git_base_path, new_dir) + new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir) system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path) - old_path = File.join(Gitlab.config.git_base_path, old_dir, "#{project.path}.git") + old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git") new_path = File.join(new_dir_path, "#{project.path}.git") if File.exists? new_path diff --git a/lib/tasks/bulk_add_permission.rake b/lib/tasks/bulk_add_permission.rake deleted file mode 100644 index bf08ace8e9c..00000000000 --- a/lib/tasks/bulk_add_permission.rake +++ /dev/null @@ -1,20 +0,0 @@ -desc "Add all users to all projects (admin users are added as masters)" -task :add_users_to_project_teams => :environment do |t, args| - user_ids = User.where(:admin => false).pluck(:id) - admin_ids = User.where(:admin => true).pluck(:id) - - Project.find_each do |project| - puts "Importing #{user_ids.size} users into #{project.code}" - UsersProject.bulk_import(project, user_ids, UsersProject::DEVELOPER) - puts "Importing #{admin_ids.size} admins into #{project.code}" - UsersProject.bulk_import(project, admin_ids, UsersProject::MASTER) - end -end - -desc "Add user to as a developer to all projects" -task :add_user_to_project_teams, [:email] => :environment do |t, args| - user = User.find_by_email args.email - project_ids = Project.pluck(:id) - - UsersProject.user_bulk_import(user, project_ids, UsersProject::DEVELOPER) -end diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index c01fe479dba..b7a64394ad0 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -1,14 +1,14 @@ require 'active_record/fixtures' namespace :gitlab do - namespace :app do + namespace :backup do # Create backup of GitLab system desc "GITLAB | Create a backup of the GitLab system" - task :backup_create => :environment do - Rake::Task["gitlab:app:db_dump"].invoke - Rake::Task["gitlab:app:repo_dump"].invoke + task :create => :environment do + Rake::Task["gitlab:backup:db:create"].invoke + Rake::Task["gitlab:backup:repo:create"].invoke - Dir.chdir(Gitlab.config.backup_path) + Dir.chdir(Gitlab.config.backup.path) # saving additional informations s = {} @@ -17,7 +17,7 @@ namespace :gitlab do s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") - File.open("#{Gitlab.config.backup_path}/backup_information.yml", "w+") do |file| + File.open("#{Gitlab.config.backup.path}/backup_information.yml", "w+") do |file| file << s.to_yaml.gsub(/^---\n/,'') end @@ -39,10 +39,10 @@ namespace :gitlab do # delete backups print "Deleting old backups... " - if Gitlab.config.backup_keep_time > 0 + if Gitlab.config.backup.keep_time > 0 file_list = Dir.glob("*_gitlab_backup.tar").map { |f| f.split(/_/).first.to_i } file_list.sort.each do |timestamp| - if Time.at(timestamp) < (Time.now - Gitlab.config.backup_keep_time) + if Time.at(timestamp) < (Time.now - Gitlab.config.backup.keep_time) %x{rm #{timestamp}_gitlab_backup.tar} end end @@ -54,15 +54,15 @@ namespace :gitlab do # Restore backup of GitLab system desc "GITLAB | Restore a previously created backup" - task :backup_restore => :environment do - Dir.chdir(Gitlab.config.backup_path) + task :restore => :environment do + Dir.chdir(Gitlab.config.backup.path) # check for existing backups in the backup dir file_list = Dir.glob("*_gitlab_backup.tar").each.map { |f| f.split(/_/).first.to_i } puts "no backups found" if file_list.count == 0 if file_list.count > 1 && ENV["BACKUP"].nil? puts "Found more than one backup, please specify which one you want to restore:" - puts "rake gitlab:app:backup_restore BACKUP=timestamp_of_backup" + puts "rake gitlab:backup:restore BACKUP=timestamp_of_backup" exit 1; end @@ -93,8 +93,8 @@ namespace :gitlab do exit 1 end - Rake::Task["gitlab:app:db_restore"].invoke - Rake::Task["gitlab:app:repo_restore"].invoke + Rake::Task["gitlab:backup:db:restore"].invoke + Rake::Task["gitlab:backup:repo:restore"].invoke # cleanup: remove tmp files print "Deleting tmp directories..." @@ -110,82 +110,86 @@ namespace :gitlab do ################################# REPOSITORIES ################################# - task :repo_dump => :environment do - backup_path_repo = File.join(Gitlab.config.backup_path, "repositories") - FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo) - puts "Dumping repositories:" - project = Project.all.map { |n| [n.path, n.path_to_repo] } - project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")] - project.each do |project| - print "- Dumping repository #{project.first}... " - if Kernel.system("cd #{project.second} > /dev/null 2>&1 && git bundle create #{backup_path_repo}/#{project.first}.bundle --all > /dev/null 2>&1") - puts "[DONE]".green - else - puts "[FAILED]".red + namespace :repo do + task :create => :environment do + backup_path_repo = File.join(Gitlab.config.backup.path, "repositories") + FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo) + puts "Dumping repositories:" + project = Project.all.map { |n| [n.path, n.path_to_repo] } + project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")] + project.each do |project| + print "- Dumping repository #{project.first}... " + if Kernel.system("cd #{project.second} > /dev/null 2>&1 && git bundle create #{backup_path_repo}/#{project.first}.bundle --all > /dev/null 2>&1") + puts "[DONE]".green + else + puts "[FAILED]".red + end end end - end - task :repo_restore => :environment do - backup_path_repo = File.join(Gitlab.config.backup_path, "repositories") - puts "Restoring repositories:" - project = Project.all.map { |n| [n.path, n.path_to_repo] } - project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")] - project.each do |project| - print "- Restoring repository #{project.first}... " - FileUtils.rm_rf(project.second) if File.dirname(project.second) # delete old stuff - if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1") - permission_commands = [ - "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", - "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}" - ] - permission_commands.each { |command| Kernel.system(command) } - puts "[DONE]".green - else - puts "[FAILED]".red + task :restore => :environment do + backup_path_repo = File.join(Gitlab.config.backup.path, "repositories") + puts "Restoring repositories:" + project = Project.all.map { |n| [n.path, n.path_to_repo] } + project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")] + project.each do |project| + print "- Restoring repository #{project.first}... " + FileUtils.rm_rf(project.second) if File.dirname(project.second) # delete old stuff + if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1") + permission_commands = [ + "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", + "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}" + ] + permission_commands.each { |command| Kernel.system(command) } + puts "[DONE]".green + else + puts "[FAILED]".red + end end end end ###################################### DB ###################################### - task :db_dump => :environment do - backup_path_db = File.join(Gitlab.config.backup_path, "db") - FileUtils.mkdir_p(backup_path_db) unless Dir.exists?(backup_path_db) - - puts "Dumping database tables:" - ActiveRecord::Base.connection.tables.each do |tbl| - print "- Dumping table #{tbl}... " - count = 1 - File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file| - ActiveRecord::Base.connection.select_all("SELECT * FROM `#{tbl}`").each do |line| - line.delete_if{|k,v| v.blank?} - output = {tbl + '_' + count.to_s => line} - file << output.to_yaml.gsub(/^---\n/,'') + "\n" - count += 1 + namespace :db do + task :create => :environment do + backup_path_db = File.join(Gitlab.config.backup.path, "db") + FileUtils.mkdir_p(backup_path_db) unless Dir.exists?(backup_path_db) + + puts "Dumping database tables:" + ActiveRecord::Base.connection.tables.each do |tbl| + print "- Dumping table #{tbl}... " + count = 1 + File.open(File.join(backup_path_db, tbl + ".yml"), "w+") do |file| + ActiveRecord::Base.connection.select_all("SELECT * FROM `#{tbl}`").each do |line| + line.delete_if{|k,v| v.blank?} + output = {tbl + '_' + count.to_s => line} + file << output.to_yaml.gsub(/^---\n/,'') + "\n" + count += 1 + end + puts "[DONE]".green end - puts "[DONE]".green end end - end - task :db_restore=> :environment do - backup_path_db = File.join(Gitlab.config.backup_path, "db") + task :restore=> :environment do + backup_path_db = File.join(Gitlab.config.backup.path, "db") - puts "Restoring database tables:" - Rake::Task["db:reset"].invoke + puts "Restoring database tables:" + Rake::Task["db:reset"].invoke - Dir.glob(File.join(backup_path_db, "*.yml") ).each do |dir| - fixture_file = File.basename(dir, ".*" ) - print "- Loading fixture #{fixture_file}..." - if File.size(dir) > 0 - ActiveRecord::Fixtures.create_fixtures(backup_path_db, fixture_file) - puts "[DONE]".green - else - puts "[SKIPPING]".yellow + Dir.glob(File.join(backup_path_db, "*.yml") ).each do |dir| + fixture_file = File.basename(dir, ".*" ) + print "- Loading fixture #{fixture_file}..." + if File.size(dir) > 0 + ActiveRecord::Fixtures.create_fixtures(backup_path_db, fixture_file) + puts "[DONE]".green + else + puts "[SKIPPING]".yellow + end end end end - end # namespace end: app + end # namespace end: backup end # namespace end: gitlab diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake new file mode 100644 index 00000000000..36c51d060bc --- /dev/null +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -0,0 +1,24 @@ +namespace :gitlab do + namespace :import do + desc "GITLAB | Add all users to all projects (admin users are added as masters)" + task :all_users_to_all_projects => :environment do |t, args| + user_ids = User.where(:admin => false).pluck(:id) + admin_ids = User.where(:admin => true).pluck(:id) + + Project.find_each do |project| + puts "Importing #{user_ids.size} users into #{project.code}" + UsersProject.bulk_import(project, user_ids, UsersProject::DEVELOPER) + puts "Importing #{admin_ids.size} admins into #{project.code}" + UsersProject.bulk_import(project, admin_ids, UsersProject::MASTER) + end + end + + desc "GITLAB | Add a specific user to all projects (as a developer)" + task :user_to_projects, [:email] => :environment do |t, args| + user = User.find_by_email args.email + project_ids = Project.pluck(:id) + + UsersProject.user_bulk_import(user, project_ids, UsersProject::DEVELOPER) + end + end +end
\ No newline at end of file diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index f70a3e7bbcf..baa706d2bee 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -90,7 +90,7 @@ namespace :gitlab do end def check_gitlab_config_not_outdated - print "GitLab config not outdated? ... " + print "GitLab config outdated? ... " gitlab_config_file = Rails.root.join("config", "gitlab.yml") unless File.exists?(gitlab_config_file) @@ -98,11 +98,12 @@ namespace :gitlab do end # omniauth or ldap could have been deleted from the file - if File.read(gitlab_config_file) =~ /^web:/ - puts "yes".green + unless Gitlab.config.pre_40_config + puts "no".green else - puts "no".red + puts "yes".red try_fixing_it( + "Backup your config/gitlab.yml", "Copy config/gitlab.yml.example to config/gitlab.yml", "Update config/gitlab.yml to match your setup" ) @@ -191,7 +192,9 @@ namespace :gitlab do else puts "no".red try_fixing_it( - "sudo -u gitlab -H bundle exec rake gitlab:app:enable_automerge" + "sudo -u gitlab -H bundle exec rake gitlab:satellites:create", + "If necessary, remove the tmp/repo_satellites directory ...", + "... and rerun the above command" ) for_more_information( "doc/raketasks/maintenance.md " @@ -268,7 +271,7 @@ namespace :gitlab do options = { "user.name" => "GitLab", - "user.email" => Gitlab.config.email_from + "user.email" => Gitlab.config.gitlab.email_from } correct_options = options.map do |name, value| run("git config --global --get #{name}").try(:squish) == value @@ -290,7 +293,7 @@ namespace :gitlab do end def check_gitlab_in_git_group - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user print "gitlab user is in #{gitolite_ssh_user} group? ... " if run_and_match("id -rnG", /\Wgit\W/) @@ -309,10 +312,10 @@ namespace :gitlab do # see https://github.com/gitlabhq/gitlabhq/issues/1059 def check_issue_1056_shell_profile_error - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... " - profile_file = File.expand_path("~#{Gitlab.config.ssh_user}/.profile") + profile_file = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.profile") unless File.read(profile_file) =~ /^-e PATH/ puts "yes".green @@ -414,7 +417,7 @@ namespace :gitlab do test_path = "/tmp/gitlab_gitolite_admin_test" FileUtils.rm_rf(test_path) - `git clone -q #{Gitlab.config.gitolite_admin_uri} #{test_path}` + `git clone -q #{Gitlab.config.gitolite.admin_uri} #{test_path}` raise unless $?.success? puts "yes".green @@ -423,7 +426,7 @@ namespace :gitlab do try_fixing_it( "Make sure the \"admin_uri\" is set correctly in config/gitlab.yml", "Try cloning it yourself with:", - " git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite-admin", + " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin", "Make sure Gitolite is installed correctly." ) for_more_information( @@ -452,7 +455,7 @@ namespace :gitlab do puts "no".red try_fixing_it( "Try committing to it yourself with:", - " git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite-admin", + " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin", " touch foo", " git add foo", " git commit -m \"foo\"", @@ -469,7 +472,7 @@ namespace :gitlab do def check_dot_gitolite_exists print "Config directory exists? ... " - gitolite_config_path = File.expand_path("~#{Gitlab.config.ssh_user}/.gitolite") + gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite") if File.directory?(gitolite_config_path) puts "yes".green @@ -490,7 +493,7 @@ namespace :gitlab do def check_dot_gitolite_permissions print "Config directory access is drwxr-x---? ... " - gitolite_config_path = File.expand_path("~#{Gitlab.config.ssh_user}/.gitolite") + gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite") unless File.exists?(gitolite_config_path) puts "can't check because of previous errors".magenta return @@ -512,7 +515,7 @@ namespace :gitlab do end def check_dot_gitolite_user_and_group - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... " gitolite_config_path = File.expand_path("~#{gitolite_ssh_user}/.gitolite") @@ -615,9 +618,9 @@ namespace :gitlab do print "post-receive hook exists? ... " hook_file = "post-receive" - gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common") + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file) @@ -639,10 +642,10 @@ namespace :gitlab do print "post-receive hook up-to-date? ... " hook_file = "post-receive" - gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common") + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) gitolite_hook_content = File.read(gitolite_hook_file) - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user unless File.exists?(gitolite_hook_file) puts "can't check because of previous errors".magenta @@ -669,7 +672,7 @@ namespace :gitlab do def check_repo_base_exists print "Repo base directory exists? ... " - repo_base_path = Gitlab.config.git_base_path + repo_base_path = Gitlab.config.gitolite.repos_path if File.exists?(repo_base_path) puts "yes".green @@ -691,7 +694,7 @@ namespace :gitlab do def check_repo_base_permissions print "Repo base access is drwsrws---? ... " - repo_base_path = Gitlab.config.git_base_path + repo_base_path = Gitlab.config.gitolite.repos_path unless File.exists?(repo_base_path) puts "can't check because of previous errors".magenta return @@ -713,10 +716,10 @@ namespace :gitlab do end def check_repo_base_user_and_group - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_ssh_user}? ... " - repo_base_path = Gitlab.config.git_base_path + repo_base_path = Gitlab.config.gitolite.repos_path unless File.exists?(repo_base_path) puts "can't check because of previous errors".magenta return @@ -777,9 +780,9 @@ namespace :gitlab do print "post-receive hooks in repos are links: ... " hook_file = "post-receive" - gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common") + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common") gitolite_hook_file = File.join(gitolite_hooks_path, hook_file) - gitolite_ssh_user = Gitlab.config.ssh_user + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user unless File.exists?(gitolite_hook_file) puts "can't check because of previous errors".magenta @@ -828,7 +831,7 @@ namespace :gitlab do ######################## def gitolite_home - File.expand_path("~#{Gitlab.config.ssh_user}") + File.expand_path("~#{Gitlab.config.gitolite.ssh_user}") end def gitolite_version diff --git a/lib/tasks/gitlab/enable_automerge.rake b/lib/tasks/gitlab/enable_automerge.rake index 13b4bab6edc..ed3d6368a99 100644 --- a/lib/tasks/gitlab/enable_automerge.rake +++ b/lib/tasks/gitlab/enable_automerge.rake @@ -1,17 +1,20 @@ namespace :gitlab do - namespace :app do - desc "GITLAB | Enable auto merge" - task :enable_automerge => :environment do - Gitlab::Gitolite.new.enable_automerge + desc "GITLAB | Enable auto merge" + task :enable_automerge => :environment do + Gitlab::Gitolite.new.enable_automerge - Project.find_each do |project| - if project.repo_exists? && !project.satellite.exists? - puts "Creating satellite for #{project.name}...".green - project.satellite.create - end + Project.find_each do |project| + if project.repo_exists? && !project.satellite.exists? + puts "Creating satellite for #{project.name}...".green + project.satellite.create end - - puts "Done!".green end + + puts "Done!".green + end + + namespace :satellites do + desc "GITLAB | Create satellite repos" + task create: 'gitlab:enable_automerge' end end diff --git a/lib/tasks/gitlab/activate_namespaces.rake b/lib/tasks/gitlab/enable_namespaces.rake index 08df0a8040b..1be9ba6469d 100644 --- a/lib/tasks/gitlab/activate_namespaces.rake +++ b/lib/tasks/gitlab/enable_namespaces.rake @@ -1,6 +1,6 @@ namespace :gitlab do desc "GITLAB | Enable usernames and namespaces for user projects" - task activate_namespaces: :environment do + task enable_namespaces: :environment do print "\nUsernames for users:".yellow User.find_each(batch_size: 500) do |user| @@ -27,7 +27,7 @@ namespace :gitlab do end print "\n\nMove projects from groups under groups dirs:".yellow - git_path = Gitlab.config.git_base_path + git_path = Gitlab.config.gitolite.repos_path Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project| next unless project.group diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 09f0dc9e459..81f66e2e406 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -12,7 +12,7 @@ namespace :gitlab do desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance" task :repos => :environment do - git_base_path = Gitlab.config.git_base_path + git_base_path = Gitlab.config.gitolite.repos_path repos_to_import = Dir.glob(git_base_path + '/*') repos_to_import.each do |repo_path| diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake index 2f633974c83..85458fe2c43 100644 --- a/lib/tasks/gitlab/info.rake +++ b/lib/tasks/gitlab/info.rake @@ -46,7 +46,7 @@ namespace :gitlab do http_clone_url = project.http_url_to_repo ssh_clone_url = project.ssh_url_to_repo - omniauth_providers = Gitlab.config.omniauth_providers + omniauth_providers = Gitlab.config.omniauth.providers omniauth_providers.map! { |provider| provider['name'] } puts "" @@ -55,17 +55,17 @@ namespace :gitlab do puts "Revision:\t#{Gitlab::Revision}" puts "Directory:\t#{Rails.root}" puts "DB Adapter:\t#{database_adapter}" - puts "URL:\t\t#{Gitlab.config.url}" + puts "URL:\t\t#{Gitlab.config.gitlab.url}" puts "HTTP Clone URL:\t#{http_clone_url}" puts "SSH Clone URL:\t#{ssh_clone_url}" - puts "Using LDAP:\t#{Gitlab.config.ldap_enabled? ? "yes".green : "no"}" - puts "Using Omniauth:\t#{Gitlab.config.omniauth_enabled? ? "yes".green : "no"}" - puts "Omniauth Providers: #{omniauth_providers.map(&:magenta).join(', ')}" if Gitlab.config.omniauth_enabled? + puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".green : "no"}" + puts "Using Omniauth:\t#{Gitlab.config.omniauth.enabled ? "yes".green : "no"}" + puts "Omniauth Providers: #{omniauth_providers.map(&:magenta).join(', ')}" if Gitlab.config.omniauth.enabled # check Gitolite version - gitolite_version_file = "#{Gitlab.config.git_base_path}/../gitolite/src/VERSION" + gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitolite/src/VERSION" if File.exists?(gitolite_version_file) && File.readable?(gitolite_version_file) gitolite_version = File.read(gitolite_version_file) end @@ -73,11 +73,11 @@ namespace :gitlab do puts "" puts "Gitolite information".yellow puts "Version:\t#{gitolite_version || "unknown".red}" - puts "Admin URI:\t#{Gitlab.config.gitolite_admin_uri}" - puts "Admin Key:\t#{Gitlab.config.gitolite_admin_key}" - puts "Repositories:\t#{Gitlab.config.git_base_path}" - puts "Hooks:\t\t#{Gitlab.config.git_hooks_path}" - puts "Git:\t\t#{Gitlab.config.git.path}" + puts "Admin URI:\t#{Gitlab.config.gitolite.admin_uri}" + puts "Admin Key:\t#{Gitlab.config.gitolite.admin_key}" + puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}" + puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}" + puts "Git:\t\t#{Gitlab.config.git.bin_path}" end diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake index 08f35c7e3f0..572a22aa1f6 100644 --- a/lib/tasks/gitlab/setup.rake +++ b/lib/tasks/gitlab/setup.rake @@ -4,7 +4,7 @@ namespace :gitlab do task :setup => [ 'db:setup', 'db:seed_fu', - 'gitlab:app:enable_automerge' + 'gitlab:enable_automerge' ] end end diff --git a/lib/tasks/travis.rake b/lib/tasks/travis.rake index 13e32135c66..e04bfbaf1c0 100644 --- a/lib/tasks/travis.rake +++ b/lib/tasks/travis.rake @@ -1,5 +1,5 @@ task :travis do - ["spinach", "rspec spec"].each do |cmd| + ["rake spinach", "rake spec"].each do |cmd| puts "Starting to run #{cmd}..." system("export DISPLAY=:99.0 && bundle exec #{cmd}") raise "#{cmd} failed!" unless $?.exitstatus == 0 diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index df66e3b48bd..ba1af08421b 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -43,7 +43,7 @@ describe ApplicationHelper do let(:user_email) { 'user@email.com' } it "should return a generic avatar path when Gravatar is disabled" do - Gitlab.config.stub(:disable_gravatar?).and_return(true) + Gitlab.config.gravatar.stub(:enabled).and_return(false) gravatar_icon(user_email).should == 'no_avatar.png' end @@ -63,7 +63,7 @@ describe ApplicationHelper do it "should return custom gravatar path when gravatar_url is set" do stub!(:request).and_return(double(:ssl? => false)) - Gitlab.config.stub(:gravatar_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') + Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' end diff --git a/spec/lib/gitolite_spec.rb b/spec/lib/gitolite_spec.rb index cc8ce8b2cce..8075b99ed99 100644 --- a/spec/lib/gitolite_spec.rb +++ b/spec/lib/gitolite_spec.rb @@ -16,7 +16,7 @@ describe Gitlab::Gitolite do it { should respond_to :create_repository } it { should respond_to :remove_repository } - it { gitolite.url_to_repo('diaspora').should == Gitlab.config.ssh_path + "diaspora.git" } + it { gitolite.url_to_repo('diaspora').should == Gitlab.config.gitolite.ssh_path_prefix + "diaspora.git" } it "should call config update" do gitolite_config.should_receive(:update_project!) diff --git a/spec/lib/project_mover_spec.rb b/spec/lib/project_mover_spec.rb index af24635d82b..2362bc2667b 100644 --- a/spec/lib/project_mover_spec.rb +++ b/spec/lib/project_mover_spec.rb @@ -6,7 +6,7 @@ describe Gitlab::ProjectMover do before do FileUtils.rm_rf base_path if File.exists? base_path - Gitlab.config.stub(git_base_path: base_path) + Gitlab.config.gitolite.stub(repos_path: base_path) @project = create(:project) end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index d70647f668d..a0849401254 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -42,7 +42,7 @@ describe MergeRequest do before do merge_request.stub(:commits) { [merge_request.project.commit] } - create(:note, noteable: merge_request.commits.first) + create(:note, commit_id: merge_request.commits.first.id, noteable_type: 'Commit') create(:note, noteable: merge_request) end diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 4f9352b9a14..61aaf6455eb 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -81,18 +81,18 @@ describe Note do describe "Commit notes" do before do @note = create(:note, - noteable_id: commit.id, + commit_id: commit.id, noteable_type: "Commit") end it "should be accessible through #noteable" do - @note.noteable_id.should == commit.id + @note.commit_id.should == commit.id @note.noteable.should be_a(Commit) @note.noteable.should == commit end it "should save a valid note" do - @note.noteable_id.should == commit.id + @note.commit_id.should == commit.id @note.noteable == commit end @@ -104,13 +104,13 @@ describe Note do describe "Pre-line commit notes" do before do @note = create(:note, - noteable_id: commit.id, + commit_id: commit.id, noteable_type: "Commit", line_code: "0_16_1") end it "should save a valid note" do - @note.noteable_id.should == commit.id + @note.commit_id.should == commit.id @note.noteable.id.should == commit.id end diff --git a/spec/models/project_hooks_spec.rb b/spec/models/project_hooks_spec.rb index 39a628a9436..df6a3831e30 100644 --- a/spec/models/project_hooks_spec.rb +++ b/spec/models/project_hooks_spec.rb @@ -108,7 +108,7 @@ describe Project, "Hooks" do it { should include(id: @commit.id) } it { should include(message: @commit.safe_message) } it { should include(timestamp: @commit.date.xmlschema) } - it { should include(url: "#{Gitlab.config.url}/#{project.code}/commit/#{@commit.id}") } + it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.code}/commit/#{@commit.id}") } context "with a author" do subject { @data[:commits].first[:author] } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index b9eafc7fa1e..83a76976098 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -148,7 +148,7 @@ describe Project do it "should return valid url to repo" do project = Project.new(path: "somewhere") - project.url_to_repo.should == Gitlab.config.ssh_path + "somewhere.git" + project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git" end it "should return path to repo" do @@ -158,7 +158,7 @@ describe Project do it "returns the full web URL for this repo" do project = Project.new(path: "somewhere") - project.web_url.should == "#{Gitlab.config.url}/somewhere" + project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere" end describe "last_activity methods" do diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index a4b026862ef..0814108523b 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -11,7 +11,7 @@ describe "Issues" do project.add_access(user2, :read, :write) end - describe "Edit issue", js: true do + describe "Edit issue" do let!(:issue) do create(:issue, author: @user, @@ -91,13 +91,13 @@ describe "Issues" do title: title) end - issue = Issue.first # with title 'foobar' - issue.milestone = create(:milestone, project: project) - issue.assignee = nil - issue.save + @issue = Issue.first # with title 'foobar' + @issue.milestone = create(:milestone, project: project) + @issue.assignee = nil + @issue.save end - let(:issue) { Issue.first } + let(:issue) { @issue } it "should allow filtering by issues with no specified milestone" do visit project_issues_path(project, milestone_id: '0') diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 25db2f91d4d..09e11588164 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -245,6 +245,7 @@ describe MergeRequestsController, "routing" do it_behaves_like "RESTful project resources" do let(:controller) { 'merge_requests' } + let(:actions) { [:index, :create, :new, :edit, :show, :update] } end end @@ -325,6 +326,7 @@ end describe MilestonesController, "routing" do it_behaves_like "RESTful project resources" do let(:controller) { 'milestones' } + let(:actions) { [:index, :create, :new, :edit, :show, :update] } end end @@ -360,6 +362,7 @@ describe IssuesController, "routing" do it_behaves_like "RESTful project resources" do let(:controller) { 'issues' } + let(:actions) { [:index, :create, :new, :edit, :show, :update] } end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7728b1e9d84..9f066c0e7f3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -42,8 +42,8 @@ RSpec.configure do |config| # ActiveRecord::Base.observers.enable(:all) # Use tmp dir for FS manipulations - Gitlab.config.stub(git_base_path: Rails.root.join('tmp', 'test-git-base-path')) - FileUtils.rm_rf Gitlab.config.git_base_path - FileUtils.mkdir_p Gitlab.config.git_base_path + Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path')) + FileUtils.rm_rf Gitlab.config.gitolite.repos_path + FileUtils.mkdir_p Gitlab.config.gitolite.repos_path end end diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index b0f554c52ab..26b461c3825 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -39,6 +39,6 @@ describe PostReceive do end def pwd(project) - File.join(Gitlab.config.git_base_path, project.path_with_namespace) + File.join(Gitlab.config.gitolite.repos_path, project.path_with_namespace) end end |