From f24c6e835314676aec02f9349fedfd2f3d61b4a7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 18 Jul 2013 19:32:13 +0300 Subject: [PATCH 1/6] Doc for update from 5.3 to 5.4 --- doc/update/5.3-to-5.4.md | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 doc/update/5.3-to-5.4.md diff --git a/doc/update/5.3-to-5.4.md b/doc/update/5.3-to-5.4.md new file mode 100644 index 00000000000..67f32f66a97 --- /dev/null +++ b/doc/update/5.3-to-5.4.md @@ -0,0 +1,80 @@ +# From 5.3 to 5.4 + +### 0. Backup + +It's useful to make a backup just in case things go south: +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) + +```bash +cd /home/git/gitlab +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create +``` + +### 1. Stop server + + sudo service gitlab stop + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch +sudo -u git -H git checkout 5-4-stable +``` + +### 3. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL +sudo -u git -H bundle install --without development test postgres --deployment + +#PostgreSQL +sudo -u git -H bundle install --without development test mysql --deployment + +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production +``` + +### 4. Update config files + +* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-4-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-4-stable/config/puma.rb.example but with your settings. + +### 5. Update Init script + +```bash +sudo rm /etc/init.d/gitlab +sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-4-stable/lib/support/init.d/gitlab +sudo chmod +x /etc/init.d/gitlab +``` + +### 6. Start application + + sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade complete! + +## Things went south? Revert to previous version (5.3) + +### 1. Revert the code to the previous version +Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:restore +``` -- GitLab From 7a165d2056941c90ed806e6a79941445df385ab9 Mon Sep 17 00:00:00 2001 From: Lukas Schauer Date: Thu, 18 Jul 2013 18:52:24 +0200 Subject: [PATCH 2/6] Update installation.md fixed branch-name (5-3 -> 5-4) --- doc/install/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 6cad280acaf..d8a18c12058 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -150,7 +150,7 @@ To setup the MySQL/PostgreSQL database and dependencies please see [`doc/install cd /home/git/gitlab # Checkout to stable release - sudo -u git -H git checkout 5-3-stable + sudo -u git -H git checkout 5-4-stable **Note:** You can change `5-3-stable` to `master` if you want the *bleeding edge* version, but do so with caution! -- GitLab From 7d5baae24d78649c5a0840535842bfa9404100f8 Mon Sep 17 00:00:00 2001 From: Bin Date: Fri, 19 Jul 2013 18:38:34 +0800 Subject: [PATCH 3/6] Fixed link for submodule --- app/views/projects/tree/_submodule_item.html.haml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/projects/tree/_submodule_item.html.haml b/app/views/projects/tree/_submodule_item.html.haml index 092a024afbc..fe6d3e310c1 100644 --- a/app/views/projects/tree/_submodule_item.html.haml +++ b/app/views/projects/tree/_submodule_item.html.haml @@ -1,11 +1,12 @@ - url = submodule_item.url(@ref) rescue '' - name = submodule_item.basename - return '' unless url +- submodule_path = url.split(":")[1][0...-4] %tr{ class: "tree-item", url: url } %td.tree-item-file-name = image_tag "submodule.png" - %strong= truncate(name, length: 40) + %strong= link_to truncate(name, length: 40), '/' + submodule_path + '/tree/master' %td - %code= submodule_item.id[0..10] + %code= link_to submodule_item.id[0..10], '/' + submodule_path + '/tree/' + submodule_item.id %td{ colspan: 2 } - = link_to truncate(url, length: 40), url + = link_to truncate(url, length: 40), '/' + submodule_path + '/tree/' + submodule_item.id -- GitLab From 868f83e5d2ca5c23e57b6fa75db714f854890a08 Mon Sep 17 00:00:00 2001 From: Bin Date: Wed, 31 Jul 2013 16:16:17 +0800 Subject: [PATCH 4/6] Support table and toc in markdown --- lib/gitlab/markdown.rb | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index e9c4df220c9..e45a4568fd3 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -63,7 +63,11 @@ module Gitlab insert_piece($1) end - sanitize text.html_safe, attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class) + sanitize( + text.html_safe, + attributes: ActionView::Base.sanitized_allowed_attributes + %w(id class), + tags: ActionView::Base.sanitized_allowed_tags + %w(table thead th tr td) + ) end private @@ -90,6 +94,7 @@ module Gitlab def parse(text) parse_references(text) if @project parse_emoji(text) + text = parse_toc(text) text end @@ -146,6 +151,36 @@ module Gitlab end end + # If the user wants TOC we run a Render::HTML_TOC + # See http://dev.af83.com/2012/02/27/howto-extend-the-redcarpet2-markdown-lib.html + # TODO: Allow TOC to be placed in the middle of the document, not only at top + def parse_toc(text) + if text.length > 0 && text.lines.first.match("~toc~") != nil + html_text = text.dup.to_str + + # First we must convert HTML headers back to Markdown headers + html_text.gsub!(/]*>/, "# ") + html_text.gsub!(/]*>/, "## ") + html_text.gsub!(/]*>/, "### ") + html_text.gsub!(/]*>/, "#### ") + html_text.gsub!(/]*>/, "##### ") + html_text.gsub!(/]*>/, "###### ") + + html_text.gsub!(/<\/?h\d[^>]*>/, "") + + + html_toc = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC, space_after_headers: true) + toc = html_toc.render(html_text) + + text["~toc~"]= "" + + toc + text + else + text + end + end + + # Private: Checks if an emoji icon exists in the image asset directory # # emoji - Identifier of the emoji as a string (e.g., "+1", "heart") -- GitLab From 1254af1456970a95862850d29d0194ad7fda5439 Mon Sep 17 00:00:00 2001 From: Bin Date: Wed, 31 Jul 2013 16:17:55 +0800 Subject: [PATCH 5/6] Fix CRLF --- app/assets/javascripts/lib/utf8_encode.js | 140 +++++++++++----------- doc/api/system_hooks.md | 98 +++++++-------- 2 files changed, 119 insertions(+), 119 deletions(-) diff --git a/app/assets/javascripts/lib/utf8_encode.js b/app/assets/javascripts/lib/utf8_encode.js index 39ffe44dae0..c61c16e9a22 100644 --- a/app/assets/javascripts/lib/utf8_encode.js +++ b/app/assets/javascripts/lib/utf8_encode.js @@ -1,70 +1,70 @@ -function utf8_encode (argString) { - // http://kevin.vanzonneveld.net - // + original by: Webtoolkit.info (http://www.webtoolkit.info/) - // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // + improved by: sowberry - // + tweaked by: Jack - // + bugfixed by: Onno Marsman - // + improved by: Yves Sucaet - // + bugfixed by: Onno Marsman - // + bugfixed by: Ulrich - // + bugfixed by: Rafal Kukawski - // + improved by: kirilloid - // + bugfixed by: kirilloid - // * example 1: utf8_encode('Kevin van Zonneveld'); - // * returns 1: 'Kevin van Zonneveld' - - if (argString === null || typeof argString === "undefined") { - return ""; - } - - var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n"); - var utftext = '', - start, end, stringl = 0; - - start = end = 0; - stringl = string.length; - for (var n = 0; n < stringl; n++) { - var c1 = string.charCodeAt(n); - var enc = null; - - if (c1 < 128) { - end++; - } else if (c1 > 127 && c1 < 2048) { - enc = String.fromCharCode( - (c1 >> 6) | 192, - ( c1 & 63) | 128 - ); - } else if (c1 & 0xF800 != 0xD800) { - enc = String.fromCharCode( - (c1 >> 12) | 224, - ((c1 >> 6) & 63) | 128, - ( c1 & 63) | 128 - ); - } else { // surrogate pairs - if (c1 & 0xFC00 != 0xD800) { throw new RangeError("Unmatched trail surrogate at " + n); } - var c2 = string.charCodeAt(++n); - if (c2 & 0xFC00 != 0xDC00) { throw new RangeError("Unmatched lead surrogate at " + (n-1)); } - c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000; - enc = String.fromCharCode( - (c1 >> 18) | 240, - ((c1 >> 12) & 63) | 128, - ((c1 >> 6) & 63) | 128, - ( c1 & 63) | 128 - ); - } - if (enc !== null) { - if (end > start) { - utftext += string.slice(start, end); - } - utftext += enc; - start = end = n + 1; - } - } - - if (end > start) { - utftext += string.slice(start, stringl); - } - - return utftext; -} +function utf8_encode (argString) { + // http://kevin.vanzonneveld.net + // + original by: Webtoolkit.info (http://www.webtoolkit.info/) + // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // + improved by: sowberry + // + tweaked by: Jack + // + bugfixed by: Onno Marsman + // + improved by: Yves Sucaet + // + bugfixed by: Onno Marsman + // + bugfixed by: Ulrich + // + bugfixed by: Rafal Kukawski + // + improved by: kirilloid + // + bugfixed by: kirilloid + // * example 1: utf8_encode('Kevin van Zonneveld'); + // * returns 1: 'Kevin van Zonneveld' + + if (argString === null || typeof argString === "undefined") { + return ""; + } + + var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + var utftext = '', + start, end, stringl = 0; + + start = end = 0; + stringl = string.length; + for (var n = 0; n < stringl; n++) { + var c1 = string.charCodeAt(n); + var enc = null; + + if (c1 < 128) { + end++; + } else if (c1 > 127 && c1 < 2048) { + enc = String.fromCharCode( + (c1 >> 6) | 192, + ( c1 & 63) | 128 + ); + } else if (c1 & 0xF800 != 0xD800) { + enc = String.fromCharCode( + (c1 >> 12) | 224, + ((c1 >> 6) & 63) | 128, + ( c1 & 63) | 128 + ); + } else { // surrogate pairs + if (c1 & 0xFC00 != 0xD800) { throw new RangeError("Unmatched trail surrogate at " + n); } + var c2 = string.charCodeAt(++n); + if (c2 & 0xFC00 != 0xDC00) { throw new RangeError("Unmatched lead surrogate at " + (n-1)); } + c1 = ((c1 & 0x3FF) << 10) + (c2 & 0x3FF) + 0x10000; + enc = String.fromCharCode( + (c1 >> 18) | 240, + ((c1 >> 12) & 63) | 128, + ((c1 >> 6) & 63) | 128, + ( c1 & 63) | 128 + ); + } + if (enc !== null) { + if (end > start) { + utftext += string.slice(start, end); + } + utftext += enc; + start = end = n + 1; + } + } + + if (end > start) { + utftext += string.slice(start, stringl); + } + + return utftext; +} diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index dca22c43f83..97b4629d39d 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -1,49 +1,49 @@ -All methods require admin authorization. - -## List system hooks - -Get list of system hooks - -``` -GET /hooks -``` - -Parameters: - -+ **none** - - -## Add new system hook hook - -``` -POST /hooks -``` - -Parameters: - -+ `url` (required) - The hook URL - - -## Test system hook - -``` -GET /hooks/:id -``` - -Parameters: - -+ `id` (required) - The ID of hook - - -## Delete system hook - -Deletes a system hook. This is an idempotent API function and returns `200 Ok` even if the hook -is not available. If the hook is deleted it is also returned as JSON. - -``` -DELETE /hooks/:id -``` - -Parameters: - -+ `id` (required) - The ID of hook +All methods require admin authorization. + +## List system hooks + +Get list of system hooks + +``` +GET /hooks +``` + +Parameters: + ++ **none** + + +## Add new system hook hook + +``` +POST /hooks +``` + +Parameters: + ++ `url` (required) - The hook URL + + +## Test system hook + +``` +GET /hooks/:id +``` + +Parameters: + ++ `id` (required) - The ID of hook + + +## Delete system hook + +Deletes a system hook. This is an idempotent API function and returns `200 Ok` even if the hook +is not available. If the hook is deleted it is also returned as JSON. + +``` +DELETE /hooks/:id +``` + +Parameters: + ++ `id` (required) - The ID of hook -- GitLab From 18fec9419770979bfabf9a2492fee4e9bdcbcb17 Mon Sep 17 00:00:00 2001 From: Bin Date: Wed, 31 Jul 2013 16:21:01 +0800 Subject: [PATCH 6/6] Fix CRLF --- doc/update/5.4-to-6.0.md | 166 +++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/doc/update/5.4-to-6.0.md b/doc/update/5.4-to-6.0.md index 42b9ee50d56..c7c153c9d96 100644 --- a/doc/update/5.4-to-6.0.md +++ b/doc/update/5.4-to-6.0.md @@ -1,84 +1,84 @@ -# From 5.4 to 6.0 - -### Deprecations - -#### Global projects - -We deprecated root(global) namespace for projects. -So you need to move all your global projects under group/users manually before update or it will be moved automatically to owner namespace during update. - -#### Teams - -We drop teams support as separate entity for 6.0 in favor of group membership. -So now you will be able to manage group members in order to provide access to corresponding projects. - - -### 0. Backup - -It's useful to make a backup just in case things go south: -(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) - -```bash -cd /home/git/gitlab -sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create -``` - -### 1. Stop server - - sudo service gitlab stop - -### 2. Get latest code - -```bash -cd /home/git/gitlab -sudo -u git -H git fetch -sudo -u git -H git checkout 6-0-dev -``` - -### 3. Install libs, migrations, etc. - -```bash -cd /home/git/gitlab - -# MySQL -sudo -u git -H bundle install --without development test postgres --deployment - -#PostgreSQL -sudo -u git -H bundle install --without development test mysql --deployment - -sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production -sudo -u git -H bundle exec rake migrate_groups RAILS_ENV=production -sudo -u git -H bundle exec rake migrate_global_projects RAILS_ENV=production -sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production - -``` - -### 4. Update config files - -* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/config/puma.rb.example but with your settings. - -### 5. Update Init script - -```bash -sudo rm /etc/init.d/gitlab -sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab -sudo chmod +x /etc/init.d/gitlab -``` - -### 6. Start application - - sudo service gitlab start - sudo service nginx restart - -### 7. Check application status - -Check if GitLab and its environment are configured correctly: - - sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production - -To make sure you didn't miss anything run a more thorough check with: - - sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production - +# From 5.4 to 6.0 + +### Deprecations + +#### Global projects + +We deprecated root(global) namespace for projects. +So you need to move all your global projects under group/users manually before update or it will be moved automatically to owner namespace during update. + +#### Teams + +We drop teams support as separate entity for 6.0 in favor of group membership. +So now you will be able to manage group members in order to provide access to corresponding projects. + + +### 0. Backup + +It's useful to make a backup just in case things go south: +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) + +```bash +cd /home/git/gitlab +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create +``` + +### 1. Stop server + + sudo service gitlab stop + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch +sudo -u git -H git checkout 6-0-dev +``` + +### 3. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL +sudo -u git -H bundle install --without development test postgres --deployment + +#PostgreSQL +sudo -u git -H bundle install --without development test mysql --deployment + +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_groups RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_global_projects RAILS_ENV=production +sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production + +``` + +### 4. Update config files + +* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/config/puma.rb.example but with your settings. + +### 5. Update Init script + +```bash +sudo rm /etc/init.d/gitlab +sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab +sudo chmod +x /etc/init.d/gitlab +``` + +### 6. Start application + + sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + If all items are green, then congratulations upgrade complete! \ No newline at end of file -- GitLab