Module: Integrity::Helpers::Urls
- Included in:
- Integrity::Helpers
- Defined in:
- lib/integrity/helpers/urls.rb
Instance Method Summary collapse
- #build_path(build) ⇒ Object
- #build_url(build) ⇒ Object
- #project_path(project, *path) ⇒ Object
- #project_url(project, *path) ⇒ Object
- #push_url_for(project) ⇒ Object
- #root_url ⇒ Object
- #url(path) ⇒ Object
Instance Method Details
#build_path(build) ⇒ Object
38 39 40 |
# File 'lib/integrity/helpers/urls.rb', line 38 def build_path(build) "/#{build.project.permalink}/builds/#{build.commit_identifier}" end |
#build_url(build) ⇒ Object
42 43 44 |
# File 'lib/integrity/helpers/urls.rb', line 42 def build_url(build) url build_path(build) end |
#project_path(project, *path) ⇒ Object
20 21 22 |
# File 'lib/integrity/helpers/urls.rb', line 20 def project_path(project, *path) "/" << [project.permalink, *path].join("/") end |
#project_url(project, *path) ⇒ Object
24 25 26 |
# File 'lib/integrity/helpers/urls.rb', line 24 def project_url(project, *path) url project_path(project, *path) end |
#push_url_for(project) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/integrity/helpers/urls.rb', line 28 def push_url_for(project) Addressable::URI.parse(project_url(project, "push")).tap do |url| if Integrity.config[:use_basic_auth] url.user = Integrity.config[:admin_username] url.password = Integrity.config[:hash_admin_password] ? "<password>" : Integrity.config[:admin_password] end end.to_s end |
#root_url ⇒ Object
16 17 18 |
# File 'lib/integrity/helpers/urls.rb', line 16 def root_url url("/") end |
#url(path) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/integrity/helpers/urls.rb', line 4 def url(path) url = "#{request.scheme}://#{request.host}" if request.scheme == "https" && request.port != 443 || request.scheme == "http" && request.port != 80 url << ":#{request.port}" end url << "/" unless path.index("/").zero? url << path end |