Module: Orefs

Defined in:
lib/orefs.rb,
lib/orefs/dir.rb,
lib/orefs/diff.rb,
lib/orefs/link.rb,
lib/orefs/file.rb,
lib/orefs/info.rb,
lib/orefs/copier.rb,
lib/orefs/digest.rb,
lib/orefs/remote.rb,
lib/orefs/statjob.rb,
lib/orefs/crypter.rb,
lib/orefs/planner.rb,
lib/orefs/fetcher.rb,
lib/orefs/version.rb,
lib/orefs/syncjob.rb,
lib/orefs/digester.rb,
lib/orefs/statfixer.rb,
lib/orefs/dirsyncjob.rb,
lib/orefs/syncstarter.rb

Defined Under Namespace

Classes: Copier, Crypter, Diff, Digest, Digester, Dir, DirSyncJob, Fetcher, File, Info, Link, Planner, Remote, StatFixer, StatJob, SyncJob, SyncStarter

Constant Summary

VERSION =

Current version of the module.

'0.1.0'

Class Method Summary (collapse)

Class Method Details

+ (Object) info_from_remotes(local_dir, remote)



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/orefs.rb', line 4

def self.info_from_remotes(local_dir, remote)
  orig_pass_file = remote.pass_file
  local_dir = ::File.expand_path(local_dir)
  remotes_file = ::File.join(::File.expand_path('~'), '.orefs', 'remotes')
  if ::File.file?(remotes_file)
    ::File.readlines(remotes_file).each do |line|
      l,r = line.split(':', 2)
      l = ::File.expand_path(l)
      if l == local_dir || local_dir.start_with?(l + '/')
        remote.update(r)
        remote.dir = remote.dir + remote.dir[l.size..-1] if l != local_dir && !remote.dir.nil?
        if remote.pass_file != orig_pass_file && !::File.file?(remote.pass_file)
          remote.pass_file = ::File.join(::File.expand_path('~'), '.orefs', remote.pass_file)
        end
        break
      end
    end
  end
end