trinidad_daemon 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ == 0.4.2 (2011-05-17)
2
+
3
+ * fix several minor bugs
4
+
1
5
  == 0.4.1 (2011-01-18)
2
6
 
3
7
  * Ensure the unix script is executable by default.
@@ -30,27 +30,32 @@ MAIN_CLASS=com.msp.jsvc.JRubyDaemon
30
30
 
31
31
  CLASSPATH=<%= @classpath.join(":") %>
32
32
 
33
+ if [ -z "$JRUBY_OPTS" ] ; then
34
+ JRUBY_OPTS=""
35
+ fi
36
+
33
37
  # TODO: Allow configuration or detect from the OS
34
38
  JAVA_NATIVE_PROPS="-Djna.boot.library.path=$JRUBY_HOME/lib/native/linux-i386:$JRUBY_HOME/lib/native/linux-amd64 \
35
- -Djffi.boot.library.path=$JRUBY_HOME/lib/native/i386-Linux:$JRUBY_HOME/lib/native/s390x-Linux:$JRUBY_HOME/lib/native/x86_64-Linux"
39
+ -Djffi.boot.library.path=$JRUBY_HOME/lib/native/i386-Linux:$JRUBY_HOME/lib/native/s390x-Linux:$JRUBY_HOME/lib/native/x86_64-Linux"
36
40
 
37
41
  JAVA_PROPS="$JAVA_PROPS -Djruby.memory.max=500m \
38
- -Djruby.stack.max=1024k \
39
- $JAVA_NATIVE_PROPS \
40
- -Djruby.shell=/bin/sh \
41
- <%= @jruby_opts.join(' ') %>"
42
+ -Djruby.stack.max=1024k \
43
+ $JAVA_NATIVE_PROPS \
44
+ -Djruby.shell=/bin/sh \
45
+ <%= @jruby_opts.join(' ') %> \
46
+ $JRUBY_OPTS"
42
47
 
43
48
  JAVA_OPTS="-Xmx500m -Xss1024k -Xbootclasspath/a:$JRUBY_HOME/lib/jruby.jar"
44
49
 
45
50
  JSVC_ARGS="-home $JAVA_HOME \
46
- $JSVC_ARGS_EXTRA \
47
- -wait 20 \
48
- -pidfile $PIDFILE \
49
- -user $USER \
50
- -procname jsvc-$SCRIPT_NAME \
51
- -jvm server
52
- -outfile $LOG_FILE \
53
- -errfile &1"
51
+ $JSVC_ARGS_EXTRA \
52
+ -wait 20 \
53
+ -pidfile $PIDFILE \
54
+ -user $USER \
55
+ -procname jsvc-$SCRIPT_NAME \
56
+ -jvm server
57
+ -outfile $LOG_FILE \
58
+ -errfile &1"
54
59
 
55
60
  #
56
61
  # Stop/Start
@@ -3,7 +3,7 @@ require 'trinidad'
3
3
 
4
4
  module Trinidad
5
5
  module Daemon
6
- VERSION = '0.4.1'
6
+ VERSION = '0.4.2'
7
7
 
8
8
  def init
9
9
  end
@@ -11,33 +11,45 @@ module Trinidad
11
11
  @stdout = stdout
12
12
  end
13
13
 
14
+ def initialize_paths
15
+ @trinidad_daemon_path = File.expand_path('../../trinidad_daemon.rb', __FILE__)
16
+ @jars_path = File.expand_path('../../../trinidad-libs', __FILE__)
17
+
18
+ @classpath = ['jruby-jsvc.jar', 'commons-daemon.jar'].map { |jar| File.join(@jars_path, jar) }
19
+ @classpath << File.join(@jruby_home, 'lib', 'jruby.jar')
20
+ end
21
+
22
+ def collect_windows_opts(options_ask)
23
+ options_ask << '(separated by `;`)'
24
+ name_ask = 'Service name? {Alphanumeric and spaces only}'
25
+ name_default = 'Trinidad'
26
+ @trinidad_name = ask(name_ask, name_default)
27
+ end
28
+
29
+ def configure_jruby_opts
30
+ opts = []
31
+ opts << "-Djruby.home=#{@jruby_home}"
32
+ opts << "-Djruby.lib=#{File.join(@jruby_home, 'lib')}"
33
+ opts << "-Djruby.script=jruby"
34
+ opts << "-Djruby.daemon.module.name=Trinidad"
35
+ opts << "-Djruby.compat.version=#{@ruby_compat_version}"
36
+ opts
37
+ end
38
+
14
39
  def configure
15
40
  @app_path = ask_path('Application path?')
16
41
  @trinidad_options = ["-d #{@app_path}"]
17
42
  options_ask = 'Trinidad options?'
18
43
  options_default = '-e production'
19
- if windows?
20
- options_ask << '(separated by `;`)'
21
- options_default = ''
22
- end
23
- @trinidad_options << ask(options_ask, options_default)
44
+ collect_windows_opts(options_ask) if windows?
24
45
 
46
+ @trinidad_options << ask(options_ask, options_default)
25
47
  @jruby_home = ask_path('JRuby home?', default_jruby_home)
26
- @jruby_opts = ["-Djruby.home=#{@jruby_home}", "-Djruby.lib=#{File.join(@jruby_home, 'lib')}",
27
- "-Djruby.script=jruby", "-Djruby.daemon.module.name=Trinidad"]
28
-
29
- @trinidad_daemon_path = File.expand_path('../../trinidad_daemon.rb', __FILE__)
30
- @jars_path = File.expand_path('../../../trinidad-libs', __FILE__)
31
-
32
- @classpath = ['jruby-jsvc.jar', 'commons-daemon.jar'].map {|jar| File.join(@jars_path, jar)}
33
- @classpath << File.join(@jruby_home, 'lib', 'jruby.jar')
34
-
35
- if windows?
36
- configure_windows_service
37
- else
38
- configure_unix_daemon
39
- end
48
+ @ruby_compat_version = ask('Ruby 1.8.x or 1.9.x compatibility?', default_ruby_compat_version)
49
+ @jruby_opts = configure_jruby_opts
50
+ initialize_paths
40
51
 
52
+ windows? ? configure_windows_service : configure_unix_daemon
41
53
  puts 'Done.'
42
54
  end
43
55
 
@@ -65,19 +77,20 @@ module Trinidad
65
77
 
66
78
  def configure_windows_service
67
79
  prunsrv = File.join(@jars_path, 'prunsrv.exe')
68
- command = %Q{//IS//Trinidad --DisplayName="Trinidad" \
80
+ command = %Q{//IS//Trinidad --DisplayName="#{@trinidad_name}" \
69
81
  --Install="#{prunsrv}" --Jvm=auto --StartMode=jvm --StopMode=jvm \
70
82
  --StartClass=com.msp.procrun.JRubyService --StartMethod=start \
71
83
  --StartParams="#{@trinidad_daemon_path};#{@trinidad_options.join(";")}" \
72
84
  --StopClass=com.msp.procrun.JRubyService --StopMethod=stop --Classpath="#{@classpath.join(";")}" \
73
85
  --StdOutput=auto --StdError=auto \
74
- --LogPrefix="trinidad" \
86
+ --LogPrefix="#{@trinidad_name.downcase.gsub(/\W/,'')}" \
75
87
  ++JvmOptions="#{@jruby_opts.join(";")}"
76
88
  }
77
89
  system "#{prunsrv} #{command}"
78
90
  end
79
91
 
80
92
  private
93
+
81
94
  def default_jruby_home
82
95
  Java::JavaLang::System.get_property("jruby.home")
83
96
  end
@@ -86,6 +99,10 @@ module Trinidad
86
99
  Java::JavaLang::System.get_property("java.home")
87
100
  end
88
101
 
102
+ def default_ruby_compat_version
103
+ "RUBY1_8"
104
+ end
105
+
89
106
  def windows?
90
107
  RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
91
108
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'trinidad_daemon'
16
- s.version = '0.4.1'
17
- s.date = '2011-01-18'
16
+ s.version = '0.4.2'
17
+ s.date = '2011-05-17'
18
18
  s.rubyforge_project = 'trinidad_daemon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinidad_daemon
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 1
9
- version: 0.4.1
4
+ prerelease:
5
+ version: 0.4.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - David Calavera
@@ -14,20 +10,17 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-18 00:00:00 +01:00
13
+ date: 2011-05-17 00:00:00 -04:00
18
14
  default_executable: trinidad_daemon_install
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: trinidad
22
18
  prerelease: false
23
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
24
21
  requirements:
25
22
  - - ">="
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
- - 5
31
24
  version: 1.0.5
32
25
  type: :runtime
33
26
  version_requirements: *id001
@@ -74,23 +67,21 @@ rdoc_options:
74
67
  require_paths:
75
68
  - lib
76
69
  required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
77
71
  requirements:
78
72
  - - ">="
79
73
  - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
74
  version: "0"
83
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
84
77
  requirements:
85
78
  - - ">="
86
79
  - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
80
  version: "0"
90
81
  requirements: []
91
82
 
92
83
  rubyforge_project: trinidad_daemon
93
- rubygems_version: 1.3.6
84
+ rubygems_version: 1.5.1
94
85
  signing_key:
95
86
  specification_version: 2
96
87
  summary: Trinidad daemon based on Apache Commons Daemon