From 9583631666072a2242a10b53768cac41eb6cdca5 Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Thu, 6 Mar 2014 15:55:57 +0100 Subject: Add envrc to git-ignore envrc files are created when you use direnv (Its recommended in combination with spring, see: https://github.com/rails/spring#setup) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4c25c8abf82..aa822771ec2 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ doc/code/* *.log public/uploads.* public/assets/ +.envrc -- cgit v1.2.1 From 30f8713aa1e35abdd33a90c0a8e691a9b6befbf4 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 7 Mar 2014 21:05:56 -0500 Subject: Respect custom gitlab_shell path in gitlab:gitlab_shell:check task Prior to this change, if I customized the config value of `gitlab.gitlab_shell.path`, the check would ignore this value in favor of `"~/gitlab-shell/"` resulting in a failed check when the configuration was otherwise valid. --- lib/tasks/gitlab/check.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 7bcd4759484..a9ea41c15ab 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -489,7 +489,7 @@ namespace :gitlab do "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}" ) for_more_information( - "#{gitlab_shell_user_home}/gitlab-shell/support/rewrite-hooks.sh" + "#{gitlab_shell_path}/support/rewrite-hooks.sh" ) fix_and_rerun next @@ -513,7 +513,7 @@ namespace :gitlab do end def check_gitlab_shell_self_test - gitlab_shell_repo_base = File.expand_path('gitlab-shell', gitlab_shell_user_home) + gitlab_shell_repo_base = gitlab_shell_path check_cmd = File.expand_path('bin/check', gitlab_shell_repo_base) puts "Running #{check_cmd}" if system(check_cmd, chdir: gitlab_shell_repo_base) @@ -559,8 +559,8 @@ namespace :gitlab do # Helper methods ######################## - def gitlab_shell_user_home - File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}") + def gitlab_shell_path + Gitlab.config.gitlab_shell.path end def gitlab_shell_version -- cgit v1.2.1 From 29db8efaa4666ea479d927593540ee6f27dddf54 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 8 Mar 2014 23:58:56 -0500 Subject: Add version_sorter gem --- Gemfile | 1 + Gemfile.lock | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 922b617e72a..dc7b60dd380 100644 --- a/Gemfile +++ b/Gemfile @@ -114,6 +114,7 @@ gem 'settingslogic' # Misc gem "foreman" +gem 'version_sorter' # Cache gem "redis-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 70cb8b9ec4c..709f5711916 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -537,6 +537,7 @@ GEM raindrops (~> 0.7) unicorn-worker-killer (0.4.2) unicorn (~> 4) + version_sorter (1.1.0) virtus (1.0.1) axiom-types (~> 0.0.5) coercible (~> 1.0) @@ -662,4 +663,5 @@ DEPENDENCIES underscore-rails (~> 1.4.4) unicorn (~> 4.6.3) unicorn-worker-killer + version_sorter webmock -- cgit v1.2.1 From a37c67940092d6d5ca82a12be76d4264034ccc6d Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 8 Mar 2014 23:59:43 -0500 Subject: Remove arguments from grouped_options_refs Must have been left over from a previous revision, but the argument wasn't used anywhere in the method. --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 240477b5b73..523c2020747 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -89,7 +89,7 @@ module ApplicationHelper "Never" end - def grouped_options_refs(destination = :tree) + def grouped_options_refs repository = @project.repository options = [ -- cgit v1.2.1 From 74d2085cdfab5c929ca68f37375af6d3d3345bba Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sun, 9 Mar 2014 00:00:43 -0500 Subject: Sort tag names using VersionSorter --- app/helpers/application_helper.rb | 5 ++--- spec/helpers/application_helper_spec.rb | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 523c2020747..bdaf6ba8abb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -94,11 +94,10 @@ module ApplicationHelper options = [ ["Branches", repository.branch_names], - ["Tags", repository.tag_names] + ["Tags", VersionSorter.rsort(repository.tag_names)] ] - # If reference is commit id - - # we should add it to branch/tag selectbox + # If reference is commit id - we should add it to branch/tag selectbox if(@ref && !options.flatten.include?(@ref) && @ref =~ /^[0-9a-zA-Z]{6,52}$/) options << ["Commit", [@ref]] diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index c285a9360bb..61c561335e5 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -116,7 +116,45 @@ describe ApplicationHelper do allow(self).to receive(:request).and_return(double(:ssl? => false)) gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + " ") end + end + + describe "grouped_options_refs" do + # Override Rails' grouped_options_for_select helper since HTML is harder to work with + def grouped_options_for_select(options, *args) + options + end + + let(:options) { grouped_options_refs } + + before do + # Must be an instance variable + @project = create(:project) + end + + it "includes a list of branch names" do + options[0][0].should == 'Branches' + options[0][1].should include('master', 'stable') + end + + it "includes a list of tag names" do + options[1][0].should == 'Tags' + options[1][1].should include('v0.9.4','v1.2.0') + end + + it "includes a specific commit ref if defined" do + # Must be an instance variable + @ref = '2ed06dc41dbb5936af845b87d79e05bbf24c73b8' + options[2][0].should == 'Commit' + options[2][1].should == [@ref] + end + + it "sorts tags in a natural order" do + # Stub repository.tag_names to make sure we get some valid testing data + expect(@project.repository).to receive(:tag_names).and_return(["v1.0.9", "v1.0.10", "v2.0", "v3.1.4.2", "v1.0.9a"]) + + options[1][1].should == ["v3.1.4.2", "v2.0", "v1.0.10", "v1.0.9a", "v1.0.9"] + end end describe "user_color_scheme_class" do -- cgit v1.2.1 From efd860d1da9df2a6e35e5f7f280eebd13a9f70a1 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Mon, 10 Mar 2014 03:44:49 -0400 Subject: Remove extra whitespace --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bdaf6ba8abb..90b05027155 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -94,7 +94,7 @@ module ApplicationHelper options = [ ["Branches", repository.branch_names], - ["Tags", VersionSorter.rsort(repository.tag_names)] + ["Tags", VersionSorter.rsort(repository.tag_names)] ] # If reference is commit id - we should add it to branch/tag selectbox -- cgit v1.2.1