Class: Dolt::RepoActions
- Inherits:
-
Object
- Object
- Dolt::RepoActions
- Defined in:
- lib/libdolt/repo_actions.rb
Instance Method Summary collapse
- #archive(repo, ref, format) ⇒ Object
- #blame(repo, ref, path) ⇒ Object
- #blob(repo, ref, path) ⇒ Object
- #history(repo, ref, path, count) ⇒ Object
-
#initialize(repo_resolver, archiver = nil) ⇒ RepoActions
constructor
A new instance of RepoActions.
- #refs(repo) ⇒ Object
- #repositories ⇒ Object
- #resolve_repository(repo) ⇒ Object
- #rev_parse_oid(repo, ref) ⇒ Object
- #tree(repo, ref, path) ⇒ Object
- #tree_entry(repo, ref, path) ⇒ Object
- #tree_history(repo, ref, path, count) ⇒ Object
Constructor Details
#initialize(repo_resolver, archiver = nil) ⇒ RepoActions
Returns a new instance of RepoActions.
25 26 27 28 |
# File 'lib/libdolt/repo_actions.rb', line 25 def initialize(repo_resolver, archiver = nil) @repo_resolver = repo_resolver @archiver = archiver end |
Instance Method Details
#archive(repo, ref, format) ⇒ Object
66 67 68 69 |
# File 'lib/libdolt/repo_actions.rb', line 66 def archive(repo, ref, format) repository = resolve_repository(repo) @archiver.archive(repository, ref, format) end |
#blame(repo, ref, path) ⇒ Object
45 46 47 |
# File 'lib/libdolt/repo_actions.rb', line 45 def blame(repo, ref, path) repo_action(repo, ref, path, :blame, :blame, ref, path) end |
#blob(repo, ref, path) ⇒ Object
30 31 32 |
# File 'lib/libdolt/repo_actions.rb', line 30 def blob(repo, ref, path) repo_action(repo, ref, path, :blob, :rev_parse, "#{ref}:#{path}") end |
#history(repo, ref, path, count) ⇒ Object
49 50 51 |
# File 'lib/libdolt/repo_actions.rb', line 49 def history(repo, ref, path, count) repo_action(repo, ref, path, :commits, :log, ref, path, count) end |
#refs(repo) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/libdolt/repo_actions.rb', line 53 def refs(repo) repository = resolve_repository(repo) names = repository.refs.map(&:name) { :tags => (repository, names, :tags), :heads => (repository, names, :heads) }.merge(repository.to_hash) end |
#repositories ⇒ Object
71 72 73 |
# File 'lib/libdolt/repo_actions.rb', line 71 def repositories repo_resolver.all end |
#resolve_repository(repo) ⇒ Object
75 76 77 |
# File 'lib/libdolt/repo_actions.rb', line 75 def resolve_repository(repo) ResolvedRepository.new(repo, repo_resolver.resolve(repo)) end |
#rev_parse_oid(repo, ref) ⇒ Object
79 80 81 |
# File 'lib/libdolt/repo_actions.rb', line 79 def rev_parse_oid(repo, ref) resolve_repository(repo).rev_parse_oid(ref) end |
#tree(repo, ref, path) ⇒ Object
34 35 36 |
# File 'lib/libdolt/repo_actions.rb', line 34 def tree(repo, ref, path) repo_action(repo, ref, path, :tree, :tree, ref, path) end |
#tree_entry(repo, ref, path) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/libdolt/repo_actions.rb', line 38 def tree_entry(repo, ref, path) repository = resolve_repository(repo) result = repository.tree_entry(ref, path) key = result.class.to_s.match(/Blob/) ? :blob : :tree tpl_data(repository, ref, path, { key => result, :type => key }) end |
#tree_history(repo, ref, path, count) ⇒ Object
62 63 64 |
# File 'lib/libdolt/repo_actions.rb', line 62 def tree_history(repo, ref, path, count) repo_action(repo, ref, path, :tree, :tree_history, ref, path, count) end |