BigW Consortium Gitlab

Commit d8a40d8c by Sato Hiroyuki

Move graph module from lib or vendor directory to app directory.

Because not autoloading lib directory at development mode.
parent c9b1df12
......@@ -20,7 +20,7 @@ class GraphController < ProjectResourceController
respond_to do |format|
format.html
format.json do
graph = Gitlab::Graph::JsonBuilder.new(project, @ref, @commit)
graph = Graph::JsonBuilder.new(project, @ref, @commit)
render :json => graph.to_json
end
end
......
require Rails.root.join('lib', 'gitlab', 'graph', 'json_builder')
class ProjectsController < ProjectResourceController
skip_before_filter :project, only: [:new, :create]
skip_before_filter :repository, only: [:new, :create]
......
require "grit"
module Gitlab
module Graph
class Commit
include ActionView::Helpers::TagHelper
module Graph
class Commit
include ActionView::Helpers::TagHelper
attr_accessor :time, :space, :refs, :parent_spaces
attr_accessor :time, :space, :refs, :parent_spaces
def initialize(commit)
@_commit = commit
@time = -1
@space = 0
@parent_spaces = []
end
def initialize(commit)
@_commit = commit
@time = -1
@space = 0
@parent_spaces = []
end
def method_missing(m, *args, &block)
@_commit.send(m, *args, &block)
end
def method_missing(m, *args, &block)
@_commit.send(m, *args, &block)
end
def to_graph_hash
h = {}
h[:parents] = self.parents.collect do |p|
[p.id,0,0]
end
h[:author] = {
name: author.name,
email: author.email
}
h[:time] = time
h[:space] = space
h[:parent_spaces] = parent_spaces
h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil?
h[:id] = sha
h[:date] = date
h[:message] = message
h
def to_graph_hash
h = {}
h[:parents] = self.parents.collect do |p|
[p.id,0,0]
end
h[:author] = {
name: author.name,
email: author.email
}
h[:time] = time
h[:space] = space
h[:parent_spaces] = parent_spaces
h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil?
h[:id] = sha
h[:date] = date
h[:message] = message
h
end
def add_refs(ref_cache, repo)
if ref_cache.empty?
repo.refs.each do |ref|
ref_cache[ref.commit.id] ||= []
ref_cache[ref.commit.id] << ref
end
def add_refs(ref_cache, repo)
if ref_cache.empty?
repo.refs.each do |ref|
ref_cache[ref.commit.id] ||= []
ref_cache[ref.commit.id] << ref
end
@refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
@refs ||= []
end
@refs = ref_cache[@_commit.id] if ref_cache.include?(@_commit.id)
@refs ||= []
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment