Class: GithubBackup::Repository
- Inherits:
-
Object
- Object
- GithubBackup::Repository
- Defined in:
- lib/github-backup/repository.rb
Instance Attribute Summary collapse
-
#sawyer_resource ⇒ Object
readonly
Returns the value of attribute sawyer_resource.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
- #backup(backup_root) ⇒ Object
- #backup_path ⇒ Object
- #clone_url ⇒ Object
-
#initialize(sawyer_resource, opts = {}) ⇒ Repository
constructor
A new instance of Repository.
Constructor Details
#initialize(sawyer_resource, opts = {}) ⇒ Repository
Returns a new instance of Repository.
5 6 7 8 |
# File 'lib/github-backup/repository.rb', line 5 def initialize(sawyer_resource, opts = {}) @sawyer_resource = sawyer_resource @shell = opts[:shell] || Shell.new end |
Instance Attribute Details
#sawyer_resource ⇒ Object (readonly)
Returns the value of attribute sawyer_resource.
3 4 5 |
# File 'lib/github-backup/repository.rb', line 3 def sawyer_resource @sawyer_resource end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
3 4 5 |
# File 'lib/github-backup/repository.rb', line 3 def shell @shell end |
Instance Method Details
#backup(backup_root) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/github-backup/repository.rb', line 10 def backup(backup_root) full_backup_path = File.join(backup_root, backup_path) puts "Backing up #{ full_backup_path }" if File.exist?(full_backup_path) backup_repository_incremental(full_backup_path) else backup_repository_initial(full_backup_path) end end |
#backup_path ⇒ Object
26 27 28 |
# File 'lib/github-backup/repository.rb', line 26 def backup_path "#{ sawyer_resource.full_name }.git" end |
#clone_url ⇒ Object
22 23 24 |
# File 'lib/github-backup/repository.rb', line 22 def clone_url sawyer_resource.ssh_url end |