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



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

def build_path(build, *path)
  warn "#build_path is deprecated, use #commit_path instead"
  commit_path build.commit, *path
end

#build_url(build) ⇒ Object



43
44
45
46
# File 'lib/integrity/helpers/urls.rb', line 43

def build_url(build)
  warn "#build_url is deprecated, use #commit_url instead"
  commit_url build.commit
end

#commit_path(commit, *path) ⇒ Object



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

def commit_path(commit, *path)
  project_path(commit.project, "commits", commit.identifier, *path)
end

#commit_url(commit) ⇒ Object



39
40
41
# File 'lib/integrity/helpers/urls.rb', line 39

def commit_url(commit)
  url commit_path(commit)
end

#project_path(project, *path) ⇒ Object



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

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

#project_url(project, *path) ⇒ Object



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

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

#push_url_for(project) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/integrity/helpers/urls.rb', line 20

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_urlObject



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

def root_url
  url("/")
end

#url(path) ⇒ Object



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

def url(path)
  Addressable::URI.parse(request.url).join(path).to_s
end