Class: DarcsConnection

Inherits:
Object
  • Object
show all
Defined in:
app/reporters/darcs_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings = DarcsSettingsProvider.new, runner = Runner.new, temp_repo = DarcsTempRepo.new) ⇒ DarcsConnection

Returns a new instance of DarcsConnection.



27
28
29
30
31
32
# File 'app/reporters/darcs_connection.rb', line 27

def initialize(settings=DarcsSettingsProvider.new,
               runner=Runner.new,
               temp_repo = DarcsTempRepo.new)
  @settings = settings
  @runner = ChdirRunner.new(temp_repo.path, runner)
end

Instance Method Details

#changes(options = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'app/reporters/darcs_connection.rb', line 34

def changes(options=nil)
  command = 'darcs changes --xml'
  if options.nil?
    command += " --last=#{@settings.package_size}"
  elsif :all != options
    command += " --from-match=\"hash #{options}\"" +
               " --to-match=\"hash #{options}\""
  end
  @runner.run(command)
end

#diff(patch_hash) ⇒ Object



49
50
51
# File 'app/reporters/darcs_connection.rb', line 49

def diff(patch_hash)
  @runner.run("darcs diff -u --match \"hash #{patch_hash}\"")
end

#pullObject



45
46
47
# File 'app/reporters/darcs_connection.rb', line 45

def pull
  @runner.run("darcs pull -a #{@settings.repo_url}")
end