diff options
author | Robert Speicher <rspeicher@gmail.com> | 2012-09-26 21:38:14 +0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2012-09-27 00:32:26 +0400 |
commit | f8c02f6e39d0a1f752583cc1942bb5e4c53df9c1 (patch) | |
tree | 805bf1eac2433b83775261fa24d01628ae90edfd /app/roles | |
parent | 2df3b310f9727956c3ce84322928f3360616f5ad (diff) |
Add branches and tags Repo methods
Simplifies the actions in RepositoriesController
Diffstat (limited to 'app/roles')
-rw-r--r-- | app/roles/repository.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/roles/repository.rb b/app/roles/repository.rb index e7e57b0e0c9..1f44481e4f3 100644 --- a/app/roles/repository.rb +++ b/app/roles/repository.rb @@ -50,11 +50,21 @@ module Repository repo.branches.collect(&:name).sort end + # Returns an Array of Branches + def branches + repo.branches.sort_by(&:name) + end + # Returns an Array of tag names def tag_names repo.tags.collect(&:name).sort.reverse end + # Returns an Array of Tags + def tags + repo.tags.sort_by(&:name).reverse + end + # Returns an Array of branch and tag names def ref_names [branch_names + tag_names].flatten |