Module: RestyTest

Defined in:
lib/resty_test.rb

Defined Under Namespace

Classes: Config, Installer, Paths

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.runningObject (readonly)

Returns the value of attribute running.



12
13
14
# File 'lib/resty_test.rb', line 12

def running
  @running
end

Class Method Details

.configObject



18
19
20
# File 'lib/resty_test.rb', line 18

def config
  self::Config.instance
end

.configure {|config| ... } ⇒ Object

Yields:



14
15
16
# File 'lib/resty_test.rb', line 14

def configure
  yield config
end

.installerObject



22
23
24
# File 'lib/resty_test.rb', line 22

def installer
  self::Installer.instance
end

.loggerObject



30
31
32
# File 'lib/resty_test.rb', line 30

def logger
  config.logger
end

.pathsObject



26
27
28
# File 'lib/resty_test.rb', line 26

def paths
  RestyTest::Paths.instance
end

.reload!Object



46
47
48
49
# File 'lib/resty_test.rb', line 46

def reload!
  return unless File.file?(paths.nginx_bin) && running
  system "#{paths.nginx_bin} -s reload"
end

.start!Object



34
35
36
37
38
# File 'lib/resty_test.rb', line 34

def start!
  installer.install!
  system "#{paths.nginx_bin} -c #{config.config_file}"
  @running = true
end

.stop!Object



40
41
42
43
44
# File 'lib/resty_test.rb', line 40

def stop!
  return unless File.file?(paths.nginx_bin) && running
  system "#{paths.nginx_bin} -s stop"
  @running = nil
end