Module: Ghoul::UrlHelpers

Included in:
Application
Defined in:
lib/ghoul/lib/url_helpers.rb

Instance Method Summary collapse

Instance Method Details

#blob_for_commit_path(repository, commit, splat = "", name = "") ⇒ Object Also known as: tree_for_commit_path



39
40
41
42
# File 'lib/ghoul/lib/url_helpers.rb', line 39

def blob_for_commit_path(repository, commit, splat="", name="")
  parts = [repository, commit, "tree", splat, name].find_all { |i| i != ""}.map {|i| i && URI.escape(i)}
  url "/repository/#{parts.join("/")}"
end

#clone_url(repository) ⇒ Object



27
28
29
# File 'lib/ghoul/lib/url_helpers.rb', line 27

def clone_url(repository)
  return "http://#{@request.host_with_port}/repo/#{URI.escape repository}"
end

#commit_path(repository, commit) ⇒ Object



35
36
37
# File 'lib/ghoul/lib/url_helpers.rb', line 35

def commit_path(repository, commit)
  url "/repository/#{URI.escape repository}/commits/#{commit}"
end

#commits_path(repository, page = 1) ⇒ Object



31
32
33
# File 'lib/ghoul/lib/url_helpers.rb', line 31

def commits_path(repository, page=1)
  url "/repository/#{URI.escape repository}/commits/#{page}"
end

#diff_for_commit_path(repository, commit) ⇒ Object



50
51
52
# File 'lib/ghoul/lib/url_helpers.rb', line 50

def diff_for_commit_path(repository, commit)
  url "/repository/#{URI.escape repository}/#{commit}/diff"
end

#guide_path(guide) ⇒ Object



7
8
9
# File 'lib/ghoul/lib/url_helpers.rb', line 7

def guide_path(guide)
  return "/guides/#{guide}"
end

#guides_pathObject



3
4
5
# File 'lib/ghoul/lib/url_helpers.rb', line 3

def guides_path
  return "/guides"
end

#raw_blob_for_commit_path(repository, commit, splat = "", name = "") ⇒ Object



45
46
47
48
# File 'lib/ghoul/lib/url_helpers.rb', line 45

def raw_blob_for_commit_path(repository, commit, splat="", name="")
  parts = [repository, commit, "raw", splat, name].find_all { |i| i != ""}.map {|i| i && URI.escape(i)}
  url "/repository/#{parts.join("/")}"
end

#repositories_pathObject



11
12
13
# File 'lib/ghoul/lib/url_helpers.rb', line 11

def repositories_path
  url "/repositories"
end

#repository_git_url(repository) ⇒ Object



19
20
21
# File 'lib/ghoul/lib/url_helpers.rb', line 19

def repository_git_url(repository)
  return "http://#{@request.host_with_port}/repo/#{URI.escape repository}"
end

#repository_path(repository) ⇒ Object



15
16
17
# File 'lib/ghoul/lib/url_helpers.rb', line 15

def repository_path(repository)
  url "/repository/#{URI.escape repository}/trunk/tree"
end

#repository_settings_path(repository) ⇒ Object



23
24
25
# File 'lib/ghoul/lib/url_helpers.rb', line 23

def repository_settings_path(repository)
  url "/repository/#{URI.escape repository}/settings"
end