Module: Integrity::Helpers::Urls

Included in:
Integrity::Helpers
Defined in:
lib/integrity/helpers/urls.rb

Instance Method Summary collapse

Instance Method Details

#build_path(build, *path) ⇒ Object



28
29
30
31
# File 'lib/integrity/helpers/urls.rb', line 28

def build_path(build, *path)
  warn "#build_path is deprecated, use #commit_path instead (#{caller[0]})"
  commit_path build.commit, *path
end

#build_url(build) ⇒ Object



33
34
35
36
# File 'lib/integrity/helpers/urls.rb', line 33

def build_url(build)
  warn "#build_url is deprecated, use #commit_url instead (#{caller[0]})"
  commit_url build.commit
end

#commit_path(commit, *path) ⇒ Object



24
25
26
# File 'lib/integrity/helpers/urls.rb', line 24

def commit_path(commit, *path)
  commit_url(commit, *path).path
end

#commit_url(commit, *path) ⇒ Object



20
21
22
# File 'lib/integrity/helpers/urls.rb', line 20

def commit_url(commit, *path)
  project_url(commit.project, ["commits", commit.identifier, *path].flatten)
end

#project_path(project, *path) ⇒ Object



16
17
18
# File 'lib/integrity/helpers/urls.rb', line 16

def project_path(project, *path)
  project_url(project, path).path
end

#project_url(project, *path) ⇒ Object



12
13
14
# File 'lib/integrity/helpers/urls.rb', line 12

def project_url(project, *path)
  url("/" << [project.permalink, *path].flatten.join("/"))
end

#push_url_for(project) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/integrity/helpers/urls.rb', line 38

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_path(path = "") ⇒ Object



8
9
10
# File 'lib/integrity/helpers/urls.rb', line 8

def root_path(path="")
  url(path).path
end

#root_urlObject



4
5
6
# File 'lib/integrity/helpers/urls.rb', line 4

def root_url
  @url ||= Addressable::URI.parse(base_url)
end