Class: Eh::Proxy::Settings::Svn

Inherits:
Object
  • Object
show all
Defined in:
lib/eh/proxy/settings/svn.rb

Instance Method Summary collapse

Constructor Details

#initialize(stage, verbose = true) ⇒ Svn

Returns a new instance of Svn.



6
7
8
9
# File 'lib/eh/proxy/settings/svn.rb', line 6

def initialize(stage, verbose = true)
  @stage = stage
  @verbose = verbose
end

Instance Method Details

#set(value) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/eh/proxy/settings/svn.rb', line 28

def set(value)
  uri = URI.parse("http://#{trim_url(value)}")

  Deployer::Executor.new(stage, verbose: verbose?) do |executor|
    executor.download("~/.subversion/servers", temporary_config_file)
    config = ParseConfig.new(temporary_config_file)
    config['global']['http-proxy-host'] = uri.host
    config['global']['http-proxy-port'] = uri.port
    File.open(temporary_config_file, 'w') do |file|
      config.write(file, false)
    end
    executor.upload(temporary_config_file, "~/.subversion/servers")
  end

end

#unsetObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eh/proxy/settings/svn.rb', line 11

def unset
  Deployer::Executor.new(stage, verbose: verbose?) do |executor|
    executor.download("~/.subversion/servers", temporary_config_file)
    config = ParseConfig.new(temporary_config_file)

    config['global'].delete('http-proxy-host')
    config['global'].delete('http-proxy-port')
    config['global'].delete('http-proxy-username')
    config['global'].delete('http-proxy-password')
    File.open(temporary_config_file, 'w') do |file|
      config.write(file, false)
    end
    executor.upload(temporary_config_file, "~/.subversion/servers")
  end

end