Class: Nailgun::NgCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ng_command.rb

Constant Summary collapse

JAVAPATH =
Nailgun::NailgunConfig.options[:java_bin]
NGJAR =
File.expand_path(File.join(File.dirname(__FILE__), 'java','jar','nailgun-0.7.1.jar'))

Class Method Summary collapse

Class Method Details

.add_cps(paths, config = {}) ⇒ Object



37
38
39
# File 'lib/ng_command.rb', line 37

def self.add_cps(paths, config={})
  paths.each { |path| ng_cp path, config }
end

.ng_alias(alias_name, class_name, config = {}) ⇒ Object



47
48
49
50
51
# File 'lib/ng_command.rb', line 47

def self.ng_alias(alias_name, class_name, config={})
  execute_command config do |p, s|
    "#{NGPATH} --nailgun-port #{p} --nailgun-server #{s} ng-alias #{alias_name} #{class_name}"
  end
end

.ng_cp(absolute_jar_path = "", config = {}) ⇒ Object



41
42
43
44
45
# File 'lib/ng_command.rb', line 41

def self.ng_cp(absolute_jar_path="", config={})
  execute_command config do |p, s|
    "#{NGPATH} --nailgun-port #{p} --nailgun-server #{s} ng-cp #{absolute_jar_path}"
  end
end

.ng_versionObject



53
54
55
# File 'lib/ng_command.rb', line 53

def self.ng_version
  system "#{NGPATH} --nailgun-version"
end

.start_server(config = {}) ⇒ Object



25
26
27
28
29
# File 'lib/ng_command.rb', line 25

def self.start_server(config={})
  execute_command config do |p, s|
    "nohup #{JAVAPATH} -jar #{NGJAR} #{s}:#{p} > /dev/null 2>&1 &"
  end
end

.stop_server(config = {}) ⇒ Object



31
32
33
34
35
# File 'lib/ng_command.rb', line 31

def self.stop_server(config={})
  execute_command config do |p, s|
    "#{NGPATH} --nailgun-port #{p} --nailgun-server #{s} ng-stop"
  end
end