Class: Dflat::Version::Delta

Inherits:
Dir
  • Object
show all
Defined in:
lib/dflat/version.rb

Constant Summary collapse

DATA_DIR =
'delta'

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dir

load, #manifest, #manifest!, #version

Constructor Details

#initialize(path) ⇒ Delta

Returns a new instance of Delta.



137
138
139
140
# File 'lib/dflat/version.rb', line 137

def initialize path
  super path
  @redd = ReDD::Dir.new File.join(path, DATA_DIR)
end

Class Method Details

.mkdir(path, integer = 0777, args = {}) ⇒ Object



130
131
132
133
134
135
# File 'lib/dflat/version.rb', line 130

def self.mkdir path, integer = 0777, args = {}
  super path, integer
	d = Delta.new path
	@redd = ReDD::Dir.mkdir File.join(d.path, DATA_DIR)
  d
end

Instance Method Details

#add(source, dest, options = {}) ⇒ Object



142
143
144
145
146
147
148
149
150
151
# File 'lib/dflat/version.rb', line 142

def add source, dest, options = {}
  manifest!
  f = @redd.add source, dest, options
  m = manifest.add dest, :base => File.join(data_path, 'add')
  File.open(File.join(path, 'manifest.txt'), 'w') do |f|
    f.write(m.to_s)
  end
  
	f
end

#remove(list, options = {}) ⇒ Object



153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/dflat/version.rb', line 153

def remove list, options = {}
  list = [list] if list.instance_of? String
  @redd.remove list.map { |x| x }, options
  m = manifest!
  list.each do |l|
    m = m.remove l
  end

  File.open(File.join(path, 'manifest.txt'), 'w') do |f|
    f.write(m.to_s)
  end
end