Skip to content

Commit

Permalink
Merge pull request #29 from Bauer-Xcel-Media/fix_unrecognized_datatyp…
Browse files Browse the repository at this point in the history
…es_inside_array_in_decorate_method

Fix unrecognized datatypes inside array in decorate method
  • Loading branch information
tobru committed Sep 29, 2015
2 parents 7c68cb0 + 4e40e90 commit f7b7162
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ spec/fixtures
.bundle
vendor
Gemfile.lock

# ignore Intellij project files
/*.iml
.idea
2 changes: 1 addition & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
it { is_expected.to contain_file('/etc/gitlab/gitlab.rb') \
.with_content(/^\s*gitlab_rails\['ldap_enabled'\] = true$/)
.with_content(/^\s*gitlab_rails\['ldap_servers'\] = {"main"=>{"label"=>"LDAP", "host"=>"_your_ldap_server", "port"=>(")?389(")?, "uid"=>"sAMAccountName", "method"=>"plain", "bind_dn"=>"_the_full_dn_of_the_user_you_will_bind_with", "password"=>"_the_password_of_the_bind_user", "active_directory"=>true, "allow_username_or_email_login"=>false, "block_auto_created_users"=>false, "base"=>"", "user_filter"=>""}}$/)
.with_content(/^\s*gitlab_rails\['omniauth_providers'\] = \["{"name"=>"google_oauth2", "app_id"=>"YOUR APP ID", "app_secret"=>"YOUR APP SECRET", "args"=>{"access_type"=>"offline", "approval_prompt"=>""}}"\]$/)
.with_content(/^\s*gitlab_rails\['omniauth_providers'\] = \[{"name"=>"google_oauth2", "app_id"=>"YOUR APP ID", "app_secret"=>"YOUR APP SECRET", "args"=>{"access_type"=>"offline", "approval_prompt"=>""}}\]$/)
}
end
describe 'gitlab_git_http_server with hash value' do
Expand Down
27 changes: 15 additions & 12 deletions templates/gitlab.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
# for all possible paramters, see:
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template
<%- def decorate(v)
if v =~ /\AYAML/
return v
elsif v.is_a?(String)
return "'#{v}'"
elsif v.is_a?(Array)
vedit = v.map { |s| "\"#{s}\"" }
return "[#{vedit.join(',')}]"
elsif v.is_a?(Hash)
return v.inspect
else
return v
end
if v =~ /\AYAML/
return v
elsif v.is_a?(String)
return "'#{v}'"
elsif v.is_a?(Array)
temp = []
v.each { |elem|
temp.push(decorate(elem))
}
return "[#{temp.join(',')}]"
elsif v.is_a?(Hash)
return v.inspect
else
return v
end
end -%>

## Url on which GitLab will be reachable.
Expand Down

0 comments on commit f7b7162

Please sign in to comment.