Commit 4524ba20b804dacccbaca3c37e781adc82c5e0d3
1 parent
21191318
Exists in
master
and in
4 other branches
First step with rugged
Showing
3 changed files
with
10 additions
and
3 deletions
Show diff stats
Gemfile
Gemfile.lock
... | ... | @@ -397,6 +397,7 @@ GEM |
397 | 397 | ruby-progressbar (1.0.2) |
398 | 398 | rubyntlm (0.1.1) |
399 | 399 | rubyzip (0.9.9) |
400 | + rugged (0.17.0.b7) | |
400 | 401 | sanitize (2.0.3) |
401 | 402 | nokogiri (>= 1.4.4, < 1.6) |
402 | 403 | sass (3.2.7) |
... | ... | @@ -565,6 +566,7 @@ DEPENDENCIES |
565 | 566 | redcarpet (~> 2.2.2) |
566 | 567 | redis-rails |
567 | 568 | rspec-rails |
569 | + rugged (~> 0.17.0.b7) | |
568 | 570 | sass-rails (~> 3.2.5) |
569 | 571 | sdoc |
570 | 572 | seed-fu | ... | ... |
app/models/repository.rb
... | ... | @@ -34,6 +34,10 @@ class Repository |
34 | 34 | @repo ||= Grit::Repo.new(path_to_repo) |
35 | 35 | end |
36 | 36 | |
37 | + def rugged | |
38 | + @rugged ||= Rugged::Repository.new(path_to_repo) | |
39 | + end | |
40 | + | |
37 | 41 | def commit(commit_id = nil) |
38 | 42 | Commit.find_or_first(repo, commit_id, root_ref) |
39 | 43 | end |
... | ... | @@ -64,17 +68,17 @@ class Repository |
64 | 68 | |
65 | 69 | # Returns an Array of branch names |
66 | 70 | def branch_names |
67 | - repo.branches.collect(&:name).sort | |
71 | + branches.map(&:name).sort | |
68 | 72 | end |
69 | 73 | |
70 | 74 | # Returns an Array of Branches |
71 | 75 | def branches |
72 | - repo.branches.sort_by(&:name) | |
76 | + rugged.branches.sort_by(&:name) | |
73 | 77 | end |
74 | 78 | |
75 | 79 | # Returns an Array of tag names |
76 | 80 | def tag_names |
77 | - repo.tags.collect(&:name).sort.reverse | |
81 | + rugged.tags.sort.reverse | |
78 | 82 | end |
79 | 83 | |
80 | 84 | # Returns an Array of Tags | ... | ... |