socky 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.textile CHANGED
@@ -1,5 +1,18 @@
1
1
  h1. Changelog
2
2
 
3
+ h2. 0.0.9 / 2010-06-20
4
+
5
+ *IMPORTANT! This version will not work with plugin version lower than 0.0.9*
6
+
7
+ * new features:
8
+ ** support for next version of em-websocket debug options(based on mloughran branch)
9
+ ** support for websocket draft 76
10
+ ** support for wss/SSL connections
11
+ ** socky can now be started in 'daemon' mode
12
+ ** socky now sending all messages in JSON format
13
+ * bugfixes:
14
+ ** socky will no longer crash when when request query is invalid - i.e. chrome 6.0.*(with websocket draft76) and em-websocket 0.0.6
15
+
3
16
  h2. 0.0.8 / 2010-06-06
4
17
 
5
18
  * new features:
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ begin
17
17
  gemspec.email = "b.potocki@imanel.org"
18
18
  gemspec.homepage = "http://github.com/imanel/socky_gem"
19
19
  gemspec.authors = ["Bernard Potocki"]
20
- gemspec.add_dependency('em-websocket', '>= 0.0.6')
20
+ gemspec.add_dependency('em-websocket', '>= 0.1.2')
21
21
  gemspec.add_dependency('em-http-request')
22
22
  gemspec.files.exclude ".gitignore"
23
23
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -1,4 +1,10 @@
1
- EventMachine::WebSocket::Connection.class_eval do
1
+ if defined?(EventMachine::WebSocket::Debugger)
2
+ klass = EventMachine::WebSocket::Debugger
3
+ else
4
+ klass = EventMachine::WebSocket::Connection
5
+ end
6
+
7
+ klass.class_eval do
2
8
 
3
9
  def debug(*data)
4
10
  if @debug
data/lib/socky.rb CHANGED
@@ -34,7 +34,11 @@ module Socky
34
34
  end
35
35
 
36
36
  def log_path
37
- options[:log_path] || File.join(%w( / var run socky.log ))
37
+ options[:log_path] || nil
38
+ end
39
+
40
+ def pid_path
41
+ options[:pid_path] || File.join(%w( / var run socky.pid ))
38
42
  end
39
43
 
40
44
  def config_path
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require 'socky/connection/authentication'
2
3
  require 'socky/connection/finders'
3
4
 
@@ -19,20 +20,24 @@ module Socky
19
20
  @socket = socket
20
21
  end
21
22
 
23
+ def query
24
+ socket.request["Query"] || {}
25
+ end
26
+
22
27
  def admin
23
- ["true","1"].include?(socket.request["Query"]["admin"])
28
+ ["true","1"].include?(query["admin"])
24
29
  end
25
30
 
26
31
  def client
27
- socket.request["Query"]["client_id"]
32
+ query["client_id"]
28
33
  end
29
34
 
30
35
  def secret
31
- socket.request["Query"]["client_secret"]
36
+ query["client_secret"]
32
37
  end
33
38
 
34
39
  def channels
35
- @channels ||= socket.request["Query"]["channels"].to_s.split(",").collect(&:strip).reject(&:empty?)
40
+ @channels ||= query["channels"].to_s.split(",").collect(&:strip).reject(&:empty?)
36
41
  end
37
42
 
38
43
  def subscribe
@@ -46,7 +51,7 @@ module Socky
46
51
  end
47
52
 
48
53
  def process_message(msg)
49
- if admin
54
+ if admin && authenticated?
50
55
  Socky::Message.process(self, msg)
51
56
  else
52
57
  self.send_message "You are not authorized to post messages"
@@ -54,8 +59,12 @@ module Socky
54
59
  end
55
60
 
56
61
  def send_message(msg)
57
- debug [self.name, "sending message", msg.inspect]
58
- socket.send msg
62
+ send_data({:type => :message, :body => msg})
63
+ end
64
+
65
+ def send_data(data)
66
+ debug [self.name, "sending data", data.inspect]
67
+ socket.send data.to_json
59
68
  end
60
69
 
61
70
  def disconnect
@@ -13,7 +13,7 @@ module Socky
13
13
  debug [self.name, "authentication failed"]
14
14
  disconnect
15
15
  end
16
- end unless authenticated?
16
+ end unless admin || authenticated?
17
17
  end
18
18
 
19
19
  def unsubscribe_request
@@ -28,7 +28,7 @@ module Socky
28
28
  end
29
29
 
30
30
  def authenticate_as_admin
31
- admin
31
+ options[:secret].nil? || secret == options[:secret]
32
32
  end
33
33
 
34
34
  def authenticate_as_user
data/lib/socky/message.rb CHANGED
@@ -16,7 +16,7 @@ module Socky
16
16
  message.process
17
17
  rescue SockyError => error
18
18
  error connection.name, error
19
- connection.send_message(error.message.to_json)
19
+ connection.send_message(error.message)
20
20
  end
21
21
  end
22
22
 
@@ -28,16 +28,6 @@ module Socky
28
28
  def process
29
29
  debug [self.name, "processing", params.inspect]
30
30
 
31
- verify_secret!
32
-
33
- execute
34
- end
35
-
36
- def verify_secret!
37
- raise(UnauthorisedQuery, "invalid secret") unless options[:secret].nil? || options[:secret] == params[:secret]
38
- end
39
-
40
- def execute
41
31
  case params[:command].to_sym
42
32
  when :broadcast then broadcast
43
33
  when :query then query
@@ -93,7 +83,7 @@ module Socky
93
83
  end
94
84
 
95
85
  def respond(message)
96
- creator.send_message(message.to_json)
86
+ creator.send_message(message)
97
87
  end
98
88
 
99
89
  end
data/lib/socky/misc.rb CHANGED
@@ -21,6 +21,10 @@ module Socky
21
21
  Socky.log_path
22
22
  end
23
23
 
24
+ def pid_path
25
+ Socky.pid_path
26
+ end
27
+
24
28
  def config_path
25
29
  Socky.config_path
26
30
  end
data/lib/socky/options.rb CHANGED
@@ -12,11 +12,12 @@ module Socky
12
12
  :port => 8080,
13
13
  :debug => false,
14
14
  :deep_debug => false,
15
+ :secure => false,
15
16
  :log_path => log_path
16
17
  }
17
18
 
18
19
  parsed_options = Parser.parse(argv)
19
- config_options = Config.read(parsed_options[:config_path] || config_path)
20
+ config_options = Config.read(parsed_options[:config_path] || config_path, :kill => parsed_options[:kill])
20
21
 
21
22
  self.options.merge!(config_options)
22
23
  self.options.merge!(parsed_options)
@@ -21,14 +21,18 @@ module Socky
21
21
  end
22
22
 
23
23
  class << self
24
- def read(path)
24
+ def read(path, args = {})
25
25
  raise(NoConfigFile, "You must generate a config file (socky -g filename.yml)") unless File.exists?(path)
26
26
  result = YAML::load(ERB.new(IO.read(path)).result)
27
27
  raise(InvalidConfig, "Provided config file is invalid.") unless result.is_a?(Hash)
28
28
  result
29
29
  rescue SockyError => error
30
- puts error.message
31
- exit
30
+ if args[:kill]
31
+ return {}
32
+ else
33
+ puts error.message
34
+ exit
35
+ end
32
36
  end
33
37
 
34
38
  def generate(path)
@@ -51,7 +55,12 @@ module Socky
51
55
 
52
56
  :secret: my_secret_key
53
57
 
58
+ :secure: false
59
+
54
60
  # :timeout: 3
61
+
62
+ # :log_path: /var/log/socky.log
63
+ # :pid_path: /var/run/socky.pid
55
64
  EOF
56
65
  end
57
66
 
@@ -29,9 +29,27 @@ module Socky
29
29
  result[:port] = port
30
30
  end
31
31
 
32
+ opts.on("-s", "--secure", "Run in wss/ssl mode") do
33
+ result[:secure] = true
34
+ end
35
+
36
+ opts.separator ""; opts.separator "Daemonization:"
37
+
38
+ opts.on("-d", "--daemon", "Daemonize mode") do
39
+ result[:daemonize] = true
40
+ end
41
+
42
+ opts.on("-P", "--pid FILE", String, "Path to PID file when using -d option") do |path|
43
+ result[:pid_path] = File.expand_path(path)
44
+ end
45
+
46
+ opts.on("-k", "--kill", "Kill daemon from specified pid file path") do
47
+ result[:kill] = true
48
+ end
49
+
32
50
  opts.separator ""; opts.separator "Logging:"
33
51
 
34
- opts.on("-l", "--log FILE", String, "Path to print debugging information.", "(default: #{Socky.log_path})") do |path|
52
+ opts.on("-l", "--log FILE", String, "Path to print debugging information.", "(Print to STDOUT if empty)") do |path|
35
53
  result[:log_path] = File.expand_path(path)
36
54
  end
37
55
 
data/lib/socky/runner.rb CHANGED
@@ -5,7 +5,14 @@ module Socky
5
5
  class << self
6
6
  def run(argv = ARGV)
7
7
  server = self.new(argv)
8
- server.start
8
+
9
+ if options[:kill]
10
+ server.kill_pid
11
+ elsif options[:daemonize]
12
+ server.daemonize
13
+ else
14
+ server.start
15
+ end
9
16
  end
10
17
  end
11
18
 
@@ -21,8 +28,8 @@ module Socky
21
28
  trap("TERM") { stop }
22
29
  trap("INT") { stop }
23
30
 
24
- EventMachine::start_server("0.0.0.0", options[:port],
25
- EventMachine::WebSocket::Connection, :debug => options[:deep_debug]) do |ws|
31
+ EventMachine::start_server("0.0.0.0", options[:port], EventMachine::WebSocket::Connection,
32
+ :debug => options[:deep_debug], :secure => options[:secure]) do |ws|
26
33
 
27
34
  connection = Socky::Connection.new(ws)
28
35
  ws.onopen { connection.subscribe }
@@ -40,5 +47,38 @@ module Socky
40
47
  EventMachine.stop
41
48
  end
42
49
 
50
+ def store_pid(pid)
51
+ FileUtils.mkdir_p(File.dirname(pid_path))
52
+ File.open(pid_path, 'w'){|f| f.write("#{pid}\n")}
53
+ rescue => e
54
+ puts e
55
+ exit
56
+ end
57
+
58
+ def daemonize
59
+ fork do
60
+ Process.setsid
61
+ exit if fork
62
+ store_pid(Process.pid)
63
+ # Dir.chdir "/" # Mucks up logs
64
+ File.umask 0000
65
+ STDIN.reopen "/dev/null"
66
+ STDOUT.reopen "/dev/null", "a"
67
+ STDERR.reopen STDOUT
68
+ start
69
+ end
70
+ end
71
+
72
+ def kill_pid
73
+ begin
74
+ pid = IO.read(pid_path).chomp.to_i
75
+ FileUtils.rm pid_path
76
+ Process.kill(9, pid)
77
+ puts "killed PID: #{pid}"
78
+ rescue => e
79
+ puts e
80
+ end
81
+ exit
82
+ end
43
83
  end
44
84
  end
@@ -5,3 +5,5 @@
5
5
  :unsubscribe_url: http://localhost:3000/socky/unsubscribe
6
6
 
7
7
  :secret: my_secret_key
8
+
9
+ :secure: false
@@ -5,6 +5,9 @@ describe Socky::Connection::Authentication do
5
5
 
6
6
  context "instance" do
7
7
  context "#subscribe_request" do
8
+ before(:each) do
9
+ stub!(:admin).and_return(false)
10
+ end
8
11
  it "should not call #send_subscribe_request if already authenticated" do
9
12
  stub!(:authenticated?).and_return(true)
10
13
  should_not_receive(:send_subscribe_request)
@@ -29,7 +32,6 @@ describe Socky::Connection::Authentication do
29
32
  authenticated_by_url?.should be_true
30
33
  end
31
34
  it "should disconnect if #send_subscribe_request block is false" do
32
- stub!(:admin).and_return(false)
33
35
  stub!(:send_subscribe_request).and_yield(false)
34
36
  should_receive(:disconnect)
35
37
  subscribe_request
@@ -75,14 +77,21 @@ describe Socky::Connection::Authentication do
75
77
  end
76
78
  end
77
79
  context "#authenticate_as_admin" do
78
- it "should return true if admin" do
79
- stub!(:admin).and_return(true)
80
+ it "should return true if client secret is equal server secret" do
81
+ stub!(:secret).and_return("test")
82
+ Socky.stub!(:options).and_return({:secret => "test"})
80
83
  authenticate_as_admin.should be_true
81
84
  end
82
- it "should return false if not admin" do
83
- stub!(:admin).and_return(false)
85
+ it "should return false if client secret is not equal server secret" do
86
+ stub!(:secret).and_return("abstract")
87
+ Socky.stub!(:options).and_return({:secret => "test"})
84
88
  authenticate_as_admin.should be_false
85
89
  end
90
+ it "should return true if server secret is nil" do
91
+ stub!(:secret).and_return("abstract")
92
+ Socky.stub!(:options).and_return({:secret => nil})
93
+ authenticate_as_admin.should be_true
94
+ end
86
95
  end
87
96
  it "#authenticate_as_user should call #authenticated_by_url?" do
88
97
  should_receive(:authenticated_by_url?)
@@ -37,6 +37,10 @@ describe Socky::Connection do
37
37
  @connection.admin.should be_false
38
38
  end
39
39
  end
40
+ it "should return false if socket request data is nil" do
41
+ @connection.socket.request["Query"] = nil
42
+ @connection.admin.should be_false
43
+ end
40
44
  end
41
45
  it "#client should return client_id from socket request data" do
42
46
  @connection.socket.request["Query"]["client_id"] = "abstract"
@@ -92,11 +96,15 @@ describe Socky::Connection do
92
96
  @connection.process_message("abstract")
93
97
  end
94
98
  end
95
- it "#send_message should send message by socket" do
96
- @connection.socket.stub!(:send)
97
- @connection.socket.should_receive(:send).with("abstract")
99
+ it "#send_message should call #send_data with hashed form of message" do
100
+ @connection.should_receive(:send_data).with({:type => :message, :body => "abstract"})
98
101
  @connection.send_message("abstract")
99
102
  end
103
+ it "#send_data should send message by socket in json format" do
104
+ @connection.socket.stub!(:send)
105
+ @connection.socket.should_receive(:send).with({:test => "abstract"}.to_json)
106
+ @connection.send_data({:test => "abstract"})
107
+ end
100
108
  it "#disconnect should close connection after writing" do
101
109
  @connection.socket.stub!(:close_connection_after_writing)
102
110
  @connection.socket.should_receive(:close_connection_after_writing)
@@ -47,61 +47,31 @@ describe Socky::Message do
47
47
  context "instance" do
48
48
  before(:each) { @message = described_class.new(@connection, {}.to_json) }
49
49
  context "#process" do
50
- before(:each) do
51
- @message.stub!(:verify_secret!)
52
- @message.stub!(:execute)
53
- end
54
- it "should verify secret" do
55
- @message.should_receive(:verify_secret!)
56
- @message.process
57
- end
58
- it "should execute" do
59
- @message.should_receive(:execute)
60
- @message.process
61
- end
62
- end
63
- context "#verify_secret!" do
64
- it "should not raise error if socky option :secret is nil" do
65
- Socky.stub!(:options).and_return({:secret => nil})
66
- lambda{ @message.verify_secret! }.should_not raise_error Socky::SockyError
67
- end
68
- it "should raise error if socky options :secret is not nil but message secret have different value" do
69
- Socky.stub!(:options).and_return({:secret => "test"})
70
- @message.stub!(:options).and_return({:secret => "another"})
71
- lambda{ @message.verify_secret! }.should raise_error Socky::SockyError
72
- end
73
- it "should not raise error if socky options :secret is not nil and message secret have the some value" do
74
- Socky.stub!(:options).and_return({:secret => "test"})
75
- @message.stub!(:params).and_return({:secret => "test"})
76
- lambda{ @message.verify_secret! }.should_not raise_error Socky::SockyError
77
- end
78
- end
79
- context "#execute" do
80
50
  it "should call #broadcast if message command is :broadcast" do
81
51
  @message.stub!(:params).and_return({:command => :broadcast})
82
52
  @message.stub!(:broadcast)
83
53
  @message.should_receive(:broadcast)
84
- @message.execute
54
+ @message.process
85
55
  end
86
56
  it "should not distinguish between string and symbol in command" do
87
57
  @message.stub!(:params).and_return({:command => 'broadcast'})
88
58
  @message.stub!(:broadcast)
89
59
  @message.should_receive(:broadcast)
90
- @message.execute
60
+ @message.process
91
61
  end
92
62
  it "should call #query if message command is :query" do
93
63
  @message.stub!(:params).and_return({:command => :query})
94
64
  @message.stub!(:query)
95
65
  @message.should_receive(:query)
96
- @message.execute
66
+ @message.process
97
67
  end
98
68
  it "should raise error if message command is nil" do
99
69
  @message.stub!(:params).and_return({:command => nil})
100
- lambda {@message.execute}.should raise_error Socky::SockyError
70
+ lambda {@message.process}.should raise_error Socky::SockyError
101
71
  end
102
72
  it "should raise error if message command is neither :broadcast nor :query" do
103
73
  @message.stub!(:params).and_return({:command => "invalid"})
104
- lambda {@message.execute}.should raise_error Socky::SockyError
74
+ lambda {@message.process}.should raise_error Socky::SockyError
105
75
  end
106
76
  end
107
77
  context "#broadcast" do
@@ -250,10 +220,6 @@ describe Socky::Message do
250
220
  @connection.should_receive(:send_message)
251
221
  @message.respond({:test => true})
252
222
  end
253
- it "should convert message to json" do
254
- @connection.should_receive(:send_message).with({:test => true}.to_json)
255
- @message.respond({:test => true})
256
- end
257
223
  end
258
224
 
259
225
  end
@@ -18,6 +18,10 @@ describe Socky::Options::Config do
18
18
  described_class.should_receive(:puts).with("Provided config file is invalid.")
19
19
  lambda { described_class.read(FILES_DIR + "/invalid.yml") }.should raise_error SystemExit
20
20
  end
21
+ it "should not raise error if :kill option is provided" do
22
+ described_class.should_not_receive(:puts).with("Provided config file is invalid.")
23
+ lambda { described_class.read(FILES_DIR + "/invalid.yml", :kill => true) }.should_not raise_error SystemExit
24
+ end
21
25
  it "should return valid options if file is valid" do
22
26
  lambda { described_class.read(FILES_DIR + "/default.yml") }.should_not raise_error SystemExit
23
27
  described_class.read(FILES_DIR + "/default.yml").should eql(default_options)
@@ -55,13 +59,16 @@ describe Socky::Options::Config do
55
59
  end
56
60
  end
57
61
  end
58
- end
59
-
60
- def default_options
61
- { :port => 8080,
62
- :debug => false,
63
- :subscribe_url => "http://localhost:3000/socky/subscribe",
64
- :unsubscribe_url => "http://localhost:3000/socky/unsubscribe",
65
- :secret => "my_secret_key"
66
- }
62
+
63
+ def default_options
64
+ {
65
+ :port => 8080,
66
+ :debug => false,
67
+ :subscribe_url => "http://localhost:3000/socky/subscribe",
68
+ :unsubscribe_url => "http://localhost:3000/socky/unsubscribe",
69
+ :secret => "my_secret_key",
70
+ :secure => false
71
+ }
72
+ end
73
+
67
74
  end
@@ -28,7 +28,24 @@ describe Socky::Options::Parser do
28
28
  end
29
29
  end
30
30
  it "on -p or --port should set port" do
31
- described_class.parse(["-p","222"]).should eql({:port => 222})
31
+ ["-p","--port"].each do |function|
32
+ described_class.parse([function,"222"]).should eql({:port => 222})
33
+ end
34
+ end
35
+ it "on -s or --secure should set secure mode on" do
36
+ ["-s","--secure"].each do |function|
37
+ described_class.parse([function]).should eql({:secure => true})
38
+ end
39
+ end
40
+ it "on -P or --pid should set pid_path to provided path" do
41
+ ["-P","--pid"].each do |function|
42
+ described_class.parse([function,"/tmp/socky.pid"]).should eql({:pid_path => "/tmp/socky.pid"})
43
+ end
44
+ end
45
+ it "on -d or --daemon should set daemon mode on" do
46
+ ["-d","--daemon"].each do |function|
47
+ described_class.parse([function]).should eql({:daemonize => true})
48
+ end
32
49
  end
33
50
  it "on -l or --log should set log_path to provided path" do
34
51
  ["-l","--log"].each do |function|
@@ -20,46 +20,41 @@ describe Socky::Options do
20
20
  Socky::Options.prepare([:a,:b,:c])
21
21
  end
22
22
  it "should call read_config with patch" do
23
- Socky::Options::Config.should_receive(:read).with("/var/run/socky.yml")
23
+ Socky::Options::Config.should_receive(:read).with("/var/run/socky.yml", :kill => nil)
24
24
  Socky::Options.prepare([])
25
25
  end
26
26
  it "should set Socky options to default hash when parse_options and read_config don't do anything" do
27
27
  Socky::Options.prepare([])
28
- Socky.options.should eql({:port=>8080,
29
- :log_path=>"/var/run/socky.log",
30
- :debug=>false,
31
- :deep_debug=>false,
32
- :config_path=>"/var/run/socky.yml"})
28
+ Socky.options.should eql(default_options)
33
29
  end
34
30
  it "should value parse_options over default values" do
35
31
  Socky::Options::Parser.stub!(:parse).and_return(:log_path => "parsed")
36
32
  Socky::Options.prepare([])
37
- Socky.options.should eql({:port=>8080,
38
- :log_path=>"parsed",
39
- :debug=>false,
40
- :deep_debug=>false,
41
- :config_path=>"/var/run/socky.yml"})
33
+ Socky.options.should eql(default_options.merge(:log_path=>"parsed"))
42
34
  end
43
35
  it "should value read_config over default values" do
44
36
  Socky::Options::Config.stub!(:read).and_return(:log_path => "from config")
45
37
  Socky::Options.prepare([])
46
- Socky.options.should eql({:port=>8080,
47
- :log_path=>"from config",
48
- :debug=>false,
49
- :deep_debug=>false,
50
- :config_path=>"/var/run/socky.yml"})
38
+ Socky.options.should eql(default_options.merge(:log_path=>"from config"))
51
39
  end
52
40
  it "should value parse_options over read_config" do
53
41
  Socky::Options::Config.stub!(:read).and_return(:log_path => "from config")
54
42
  Socky::Options::Parser.stub!(:parse).and_return(:log_path => "parsed")
55
43
  Socky::Options.prepare([])
56
- Socky.options.should eql({:port=>8080,
57
- :log_path=>"parsed",
58
- :debug=>false,
59
- :deep_debug=>false,
60
- :config_path=>"/var/run/socky.yml"})
44
+ Socky.options.should eql(default_options.merge(:log_path=>"parsed"))
61
45
  end
62
46
  end
63
47
  end
48
+
49
+ def default_options
50
+ {
51
+ :port => 8080,
52
+ :log_path => nil,
53
+ :debug => false,
54
+ :deep_debug => false,
55
+ :secure => false,
56
+ :config_path => "/var/run/socky.yml"
57
+ }
58
+ end
64
59
 
65
60
  end
@@ -12,10 +12,21 @@ describe Socky::Runner do
12
12
  described_class.should_receive(:new).with("some args")
13
13
  described_class.run("some args")
14
14
  end
15
- it "should call #start on new instance of self" do
15
+ it "should call #start on new instance of self if daemonize option is false" do
16
+ Socky.stub(:options).and_return({:daemonize => false})
16
17
  @server.should_receive(:start)
17
18
  described_class.run
18
19
  end
20
+ it "should call #daemonize on new instance of self if daemonize option is true" do
21
+ Socky.stub(:options).and_return({:daemonize => true})
22
+ @server.should_receive(:daemonize)
23
+ described_class.run
24
+ end
25
+ it "should call #kill_pid on new instance of self if kill option is true" do
26
+ Socky.stub(:options).and_return({:kill => true})
27
+ @server.should_receive(:kill_pid)
28
+ described_class.run
29
+ end
19
30
  end
20
31
  context "#new" do
21
32
  it "should prepare options from args" do
data/spec/socky_spec.rb CHANGED
@@ -50,9 +50,8 @@ describe Socky do
50
50
  Socky.logger = nil
51
51
  end
52
52
  end
53
- it "should have default log path" do
54
- Socky.log_path.should_not be_nil
55
- Socky.log_path.should eql("/var/run/socky.log")
53
+ it "should not have default log path" do
54
+ Socky.log_path.should be_nil
56
55
  end
57
56
  it "should be able to change log path by settion log_path option" do
58
57
  Socky.stub!(:options).and_return({:log_path => "abstract"})
@@ -68,6 +67,14 @@ describe Socky do
68
67
  Socky.options = {}
69
68
  end
70
69
  end
70
+ it "should have default pid path" do
71
+ Socky.pid_path.should_not be_nil
72
+ Socky.pid_path.should eql("/var/run/socky.pid")
73
+ end
74
+ it "should be able to change pid path by settion pid_path option" do
75
+ Socky.stub!(:options).and_return({:pid_path => "abstract"})
76
+ Socky.pid_path.should eql("abstract")
77
+ end
71
78
  it "should have default config path" do
72
79
  Socky.config_path.should_not be_nil
73
80
  Socky.config_path.should eql("/var/run/socky.yml")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bernard Potocki
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-06 00:00:00 +02:00
17
+ date: 2010-06-20 00:00:00 +02:00
18
18
  default_executable: socky
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -26,9 +26,9 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
28
  - 0
29
- - 0
30
- - 6
31
- version: 0.0.6
29
+ - 1
30
+ - 2
31
+ version: 0.1.2
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency