Class: DropGit::App
- Inherits:
-
Object
- Object
- DropGit::App
- Defined in:
- lib/dropgit.rb
Instance Method Summary collapse
- #git(name) ⇒ Object
-
#help ⇒ Object
Show usage.
-
#init(remote) ⇒ Object
Initialize repository for current directory.
-
#initialize ⇒ App
constructor
Constructor.
- #list ⇒ Object
-
#run ⇒ Object
debug daemon.
-
#start ⇒ Object
start daemon.
- #stop ⇒ Object
Constructor Details
Instance Method Details
#git(name) ⇒ Object
33 34 35 |
# File 'lib/dropgit.rb', line 33 def git(name) repo = DropGit.settings.repositories.select { |data| data['name'] == name } end |
#help ⇒ Object
Show usage
23 24 |
# File 'lib/dropgit.rb', line 23 def help end |
#init(remote) ⇒ Object
Initialize repository for current directory
27 28 29 30 31 |
# File 'lib/dropgit.rb', line 27 def init(remote) raise "Specify a remote repository" unless remote new_repo = Repository.create(Dir.pwd, remote) DropGit.settings.add_repo new_repo end |
#list ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/dropgit.rb', line 37 def list repos = DropGit.settings.repositories length = {} repos.each do |repo| repo.each do |key, val| if length[key] if val.length > length[key] length[key] = val.length end else length[key] = val.length end end end head = "|" length.each do |key, val| head << " " << key.ljust(val + 2) << "|" end puts "-" * head.length puts head puts "-" * head.length repos.each do |repo| line = "|" repo.each do |key, val| line << " " << val.ljust(length[key] + 2) << "|" end puts line end end |