module Docks::Helpers::Github

Public Instance Methods

github_issue_message() click to toggle source
# File lib/docks/helpers/github_helper.rb, line 12
def github_issue_message
  root = Docks.config.root.to_s
  files = @pattern.files.map { |file| file.sub(root, "") }

  file_checklist = relative_pattern_files.map { |file| "- [#{@pattern.files.length == 1 ? "x" : " "}] [#{file}](#{github_url(file)})" }.join("\n")
  "\n\n\n---\n\nThis issue is related to the following files:\n\n#{file_checklist}"
end
github_root_url() click to toggle source
# File lib/docks/helpers/github_helper.rb, line 24
def github_root_url
  @github_root_url ||= Docks.config.github_repo.sub(/(.)\/?$/, '\1')
end
github_url(file) click to toggle source
# File lib/docks/helpers/github_helper.rb, line 8
def github_url(file)
  "#{github_root_url}/blob/master/#{url_encode(file).gsub("%2F", "/").sub(/^\//, "")}"
end
has_github?() click to toggle source
# File lib/docks/helpers/github_helper.rb, line 4
def has_github?
  !(Docks.config.github_repo.nil? || Docks.config.github_repo.empty? || @pattern.files.empty?)
end
relative_pattern_files() click to toggle source
# File lib/docks/helpers/github_helper.rb, line 20
def relative_pattern_files
  @relative_pattern_files ||= @pattern.files.map { |file| file.sub(Docks.config.root.to_s, "") }
end