Class: Dolt::RepoActions

Inherits:
Object
  • Object
show all
Defined in:
lib/dolt/repo_actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo_resolver) ⇒ RepoActions

Returns a new instance of RepoActions.



22
23
24
# File 'lib/dolt/repo_actions.rb', line 22

def initialize(repo_resolver)
  @repo_resolver = repo_resolver
end

Instance Method Details

#blame(repo, ref, path, &block) ⇒ Object



34
35
36
# File 'lib/dolt/repo_actions.rb', line 34

def blame(repo, ref, path, &block)
  repo_action(repo, ref, path, :blame, :blame, ref, path, &block)
end

#blob(repo, ref, path, &block) ⇒ Object



26
27
28
# File 'lib/dolt/repo_actions.rb', line 26

def blob(repo, ref, path, &block)
  repo_action(repo, ref, path, :blob, :rev_parse, "#{ref}:#{path}", &block)
end

#history(repo, ref, path, count, &block) ⇒ Object



38
39
40
# File 'lib/dolt/repo_actions.rb', line 38

def history(repo, ref, path, count, &block)
  repo_action(repo, ref, path, :commits, :log, ref, path, count, &block)
end

#refs(repo, &block) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/dolt/repo_actions.rb', line 42

def refs(repo, &block)
  repository = repo_resolver.resolve(repo)
  d = repository.refs
  d.callback do |refs|
    names = refs.map(&:name)
    block.call(nil, {
                 :repository => repo,
                 :tags => stripped_ref_names(names, :tags),
                 :heads => stripped_ref_names(names, :heads)
               })
  end
  d.errback { |err| block.call(err, nil) }
end

#repositoriesObject



56
57
58
# File 'lib/dolt/repo_actions.rb', line 56

def repositories
  repo_resolver.all
end

#tree(repo, ref, path, &block) ⇒ Object



30
31
32
# File 'lib/dolt/repo_actions.rb', line 30

def tree(repo, ref, path, &block)
  repo_action(repo, ref, path, :tree, :rev_parse, "#{ref}:#{path}", &block)
end