rocket-server 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,43 +1,9 @@
1
1
  # -*- ruby -*-
2
- $:.unshift(File.expand_path('../lib', __FILE__))
3
- $:.unshift(File.expand_path('../../rocket/lib', __FILE__))
4
- require 'rspec/core/rake_task'
5
- require 'rake/rdoctask'
2
+ require File.expand_path('../../load_paths', __FILE__)
6
3
  require 'rocket/version'
7
4
 
8
- RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = 'spec/**/*_spec.rb'
10
- t.rspec_opts = %q[-I../rocket-core/lib -I../rocket/lib -Ilib -c -b]
11
- end
5
+ $LIB_BASENAME = "rocket-server"
6
+ $LIB_FULLNAME = "#{$LIB_BASENAME}-#{Rocket.version}"
7
+ $LIB_TITLE = "Rocket Server #{Rocket.version}"
12
8
 
13
- RSpec::Core::RakeTask.new(:rcov) do |t|
14
- t.rcov = true
15
- t.rspec_opts = %q[-I../rocket-core/lib -I../rocket/lib -Ilib -c -b]
16
- t.rcov_opts = %q[-I../rocket-core/lib -I../rocket/lib -Ilib -T -x "spec"]
17
- end
18
-
19
- Rake::RDocTask.new do |rdoc|
20
- rdoc.title = "Rocket Server #{Rocket.version}"
21
- rdoc.rdoc_dir = 'rdoc'
22
- rdoc.rdoc_files.include('README*')
23
- rdoc.rdoc_files.include('lib/**/*.rb')
24
- end
25
-
26
- desc "Build current version as a rubygem"
27
- task :build do
28
- sh "gem build rocket-server.gemspec"
29
- sh "mkdir -p pkg"
30
- sh "mv rocket-server-*.gem pkg/"
31
- end
32
-
33
- desc "Relase current version to rubygems.org"
34
- task :release => :build do
35
- sh "gem push pkg/rocket-server-#{Rocket.version}.gem"
36
- end
37
-
38
- desc "Perform installation via rubygems"
39
- task :install => :build do
40
- sh "gem install pkg/rocket-server-#{Rocket.version}.gem"
41
- end
42
-
43
- task :default => :spec
9
+ load File.expand_path('../../Rakefile.common', __FILE__)
@@ -1,3 +1,11 @@
1
+ begin
2
+ require 'fastthread'
3
+ rescue LoadError
4
+ puts "WARNING: You don't have fastthread gem installed. It's recommended" +
5
+ "to use it for better performance."
6
+ require 'thread'
7
+ end
8
+
1
9
  require "konfigurator"
2
10
  require 'eventmachine'
3
11
  require 'em-websocket'
@@ -28,8 +36,8 @@ module Rocket
28
36
  disable :verbose
29
37
  disable :quiet
30
38
  disable :daemon
31
- set :pid, nil
32
- set :log, nil
39
+ set :pid, "/var/run/rocket/server.pid"
40
+ set :log, "/var/log/rocket/server.log"
33
41
  set :tls_options, {}
34
42
  set :apps, []
35
43
  set :plugins, []
@@ -8,29 +8,30 @@ module Rocket
8
8
 
9
9
  desc "Show used version of Rocket server"
10
10
  def version
11
- puts "Rocket v#{Rocket.version}"
11
+ puts "Rocket Server v#{Rocket.version}"
12
12
  end
13
13
 
14
14
  desc "Start Rocket server on given host and port"
15
- opt "config", :short_name => "c", :default => "/etc/rocket/default.yml", :desc => "Path to configuration file"
16
- opt "host", :short_name => "h", :default => "localhost", :desc => "Specify server host"
17
- opt "port", :short_name => "p", :default => 9772, :desc => "Specify server port"
18
- opt "plugins", :short_name => "r", :default => [], :desc => "Require ruby extensions at runtime"
19
- opt "secure", :short_name => "s", :default => false, :desc => "Switch between wss/ws modes"
20
- opt "verbose", :short_name => "v", :default => false, :desc => "Increase verbosity"
21
- opt "quiet", :short_name => "q", :default => false, :desc => "Decrease verbosity"
22
- opt "debug", :short_name => "D", :default => false, :desc => "Run server in debug mode"
23
- opt "daemon", :short_name => "d", :default => false, :desc => "Run server as a daemon"
24
- opt "pid", :short_name => "P", :default => "/var/run/rocket/server.pid", :desc => "Path to PID file (only when daemonized)"
25
- opt "log", :short_name => "l", :default => nil, :desc => "Path to log file"
15
+ opt "config", :short_name => "c", :desc => "Path to configuration file"
16
+ opt "host", :short_name => "h", :desc => "Specify server host"
17
+ opt "port", :short_name => "p", :desc => "Specify server port"
18
+ opt "plugins", :short_name => "r", :desc => "Require ruby extensions at runtime"
19
+ opt "secure", :short_name => "s", :desc => "Switch between wss/ws modes"
20
+ opt "verbose", :short_name => "v", :desc => "Increase verbosity"
21
+ opt "quiet", :short_name => "q", :desc => "Decrease verbosity"
22
+ opt "debug", :short_name => "D", :desc => "Run server in debug mode"
23
+ opt "daemon", :short_name => "d", :desc => "Run server as a daemon"
24
+ opt "pid", :short_name => "P", :desc => "Path to PID file (only when daemonized)"
25
+ opt "log", :short_name => "l", :desc => "Path to log file"
26
26
  def start
27
- Rocket::Server.load_settings(params.delete('config'), symbolize_keys(params))
27
+ config_file = params.delete('config') || '/etc/rocket/default.yml'
28
+ Rocket::Server.load_settings(config_file, symbolize_keys(params))
28
29
  Rocket::Server::Runner.new(Rocket::Server.settings).start!
29
30
  end
30
31
 
31
32
  desc "Stop daemonized instance of Rocket server"
32
- opt "config", :short_name => "c", :default => "/etc/rocket/default.yml", :desc => "Path to configuration file"
33
- opt "pid", :short_name => "P", :default => "/var/run/rocket/server.pid", :desc => "Path to PID file (only when daemonized)"
33
+ opt "config", :short_name => "c", :desc => "Path to configuration file"
34
+ opt "pid", :short_name => "P", :desc => "Path to PID file (only when daemonized)"
34
35
  def stop
35
36
  Rocket::Server.load_settings(params.delete('config'), symbolize_keys(params))
36
37
 
@@ -56,7 +56,7 @@ module Rocket
56
56
  Process.kill(9, pid)
57
57
  pid
58
58
  end
59
- rescue => e
59
+ rescue Object => e
60
60
  # nothing to show
61
61
  end
62
62
 
@@ -68,7 +68,7 @@ module Rocket
68
68
  def save_pid
69
69
  FileUtils.mkdir_p(File.dirname(pidfile))
70
70
  File.open(pidfile, "w+"){|f| f.write("#{Process.pid}\n")}
71
- rescue => e
71
+ rescue Object => e
72
72
  puts e.to_s
73
73
  exit 1
74
74
  end
@@ -1,4 +1,5 @@
1
- require 'rubygems'
1
+ require File.expand_path("../../../load_paths", __FILE__)
2
+
2
3
  require 'mocha'
3
4
  require 'rspec'
4
5
  require 'fileutils'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket-server
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Araneo Ltd.
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-09 00:00:00 +01:00
19
+ date: 2010-11-29 00:00:00 +01:00
20
20
  default_executable: rocket-server
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,12 +27,12 @@ dependencies:
27
27
  requirements:
28
28
  - - "="
29
29
  - !ruby/object:Gem::Version
30
- hash: 27
30
+ hash: 25
31
31
  segments:
32
32
  - 0
33
33
  - 0
34
- - 2
35
- version: 0.0.2
34
+ - 3
35
+ version: 0.0.3
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency