Class: Six::Updater::RsyncRepo
- Inherits:
-
Object
- Object
- Six::Updater::RsyncRepo
- Defined in:
- lib/six/updater/rsyncrepo.rb
Instance Method Summary collapse
- #clone(opts = {}) ⇒ Object
- #config ⇒ Object
- #config=(cnfg) ⇒ Object
- #convert(opts = {}) ⇒ Object
-
#initialize(repositories, path, depth = 1) ⇒ RsyncRepo
constructor
A new instance of RsyncRepo.
- #log ⇒ Object
- #open(opts = {}) ⇒ Object
- #repository(opts = {:log => log}) ⇒ Object
- #reset(opts = {}) ⇒ Object
- #status(force = false) ⇒ Object
- #update(opts = {}) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(repositories, path, depth = 1) ⇒ RsyncRepo
Returns a new instance of RsyncRepo.
6 7 8 9 10 11 |
# File 'lib/six/updater/rsyncrepo.rb', line 6 def initialize(repositories, path, depth = 1) @repositories = repositories @path = path @changed = false @installed = false end |
Instance Method Details
#clone(opts = {}) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/six/updater/rsyncrepo.rb', line 55 def clone(opts = {}) done = false opts = opts.merge({:path => File.dirname(@path), :depth => @depth, :log => log}) @repository = Rsync.clone(@repositories, File.basename(@path), opts) true end |
#config ⇒ Object
29 30 31 32 33 |
# File 'lib/six/updater/rsyncrepo.rb', line 29 def config f = File.join(@path, '.rsync', 'config.yml') cfg = File.exists?(f) ? YAML::load_file(f) : nil cfg ? cfg : nil end |
#config=(cnfg) ⇒ Object
23 24 25 26 27 |
# File 'lib/six/updater/rsyncrepo.rb', line 23 def config=(cnfg) f = File.join(@path, '.rsync', 'config.yml') #cfg = File.exists?(f) ? YAML::load_file(f) : nil File.exists?(f) ? File.open(f, 'w') {|f| f.puts cnfg.to_yaml} : nil end |
#convert(opts = {}) ⇒ Object
35 36 37 |
# File 'lib/six/updater/rsyncrepo.rb', line 35 def convert(opts = {}) @repository = Six::Repositories::Rsync.convert(@path, :log => log) end |
#open(opts = {}) ⇒ Object
39 40 41 |
# File 'lib/six/updater/rsyncrepo.rb', line 39 def open(opts = {}) repository(opts) end |
#repository(opts = {:log => log}) ⇒ Object
51 52 53 |
# File 'lib/six/updater/rsyncrepo.rb', line 51 def repository(opts = {:log => log}) @repository || Six::Repositories::Rsync.open(@path, opts) end |
#reset(opts = {}) ⇒ Object
43 44 45 |
# File 'lib/six/updater/rsyncrepo.rb', line 43 def reset(opts = {}) repository.reset(opts) end |
#status(force = false) ⇒ Object
47 48 49 |
# File 'lib/six/updater/rsyncrepo.rb', line 47 def status(force = false) [] end |
#update(opts = {}) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/six/updater/rsyncrepo.rb', line 62 def update(opts = {}) # # Update the config file with our hosts list #file = File.join(@path, '.rsync/config.yml') opts[:hosts] = @repositories # Update! repository.update(opts) true end |
#version ⇒ Object
17 18 19 20 21 |
# File 'lib/six/updater/rsyncrepo.rb', line 17 def version f = File.join(@path, '.rsync', '.repository.yml') cfg = File.exists?(f) ? YAML::load_file(f) : nil cfg ? cfg[:version] : nil end |