trinidad_init_services 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 1.1.5 (2012-03-06)
2
+
3
+ * Not working arch detection on Windows + missing 32-bit prunsrv.exe
4
+
1
5
  == 1.1.4 (2012-03-01)
2
6
 
3
7
  * JSVC sources packaged along the gem and compiled on demand (@see #6)
data/Rakefile CHANGED
@@ -81,7 +81,7 @@ task :release => :build do
81
81
  end
82
82
 
83
83
  desc 'Build gem'
84
- task :build => :validate do
84
+ task :build do
85
85
  sh "mkdir -p pkg"
86
86
  sh "gem build #{gemspec_file}"
87
87
  sh "mv #{gem_file} pkg"
@@ -3,9 +3,7 @@ require 'trinidad'
3
3
 
4
4
  module Trinidad
5
5
  module Daemon
6
- require 'trinidad_init_services/version'
7
- VERSION = Trinidad::InitServices::VERSION
8
-
6
+
9
7
  def init
10
8
  end
11
9
 
@@ -13,19 +13,12 @@ module Trinidad
13
13
  @stdout = stdout
14
14
  end
15
15
 
16
- def initialize_paths
16
+ def initialize_paths(jruby_home = default_jruby_home)
17
17
  @trinidad_daemon_path = File.expand_path('../../trinidad/daemon.rb', __FILE__)
18
18
  @jars_path = File.expand_path('../../../trinidad-libs', __FILE__)
19
19
 
20
20
  @classpath = ['jruby-jsvc.jar', 'commons-daemon.jar'].map { |jar| File.join(@jars_path, jar) }
21
- @classpath << File.join(@jruby_home, 'lib', 'jruby.jar')
22
- end
23
-
24
- def collect_windows_opts(options_ask, defaults)
25
- options_ask << '(separated by `;`)'
26
- name_ask = 'Service name? {Alphanumeric and spaces only}'
27
- name_default = 'Trinidad'
28
- @trinidad_name = defaults["trinidad_name"] || ask(name_ask, name_default)
21
+ @classpath << File.join(jruby_home, 'lib', 'jruby.jar')
29
22
  end
30
23
 
31
24
  def configure_jruby_opts
@@ -49,7 +42,7 @@ module Trinidad
49
42
  @jruby_home = defaults["jruby_home"] || ask_path('JRuby home?', default_jruby_home)
50
43
  @ruby_compat_version = defaults["ruby_compat_version"] || ask('Ruby 1.8.x or 1.9.x compatibility?', default_ruby_compat_version)
51
44
  @jruby_opts = configure_jruby_opts
52
- initialize_paths
45
+ initialize_paths(@jruby_home)
53
46
 
54
47
  windows? ? configure_windows_service : configure_unix_daemon(defaults)
55
48
  puts 'Done.'
@@ -92,6 +85,13 @@ module Trinidad
92
85
  FileUtils.chmod(@run_user == '' ? 0744 : 0755, trinidad_file)
93
86
  end
94
87
 
88
+ def collect_windows_opts(options_ask, defaults)
89
+ options_ask << '(separated by `;`)'
90
+ name_ask = 'Service name? {Alphanumeric and spaces only}'
91
+ name_default = 'Trinidad'
92
+ @trinidad_name = defaults["trinidad_name"] || ask(name_ask, name_default)
93
+ end
94
+
95
95
  def configure_windows_service
96
96
  srv_path = bundled_prunsrv_path
97
97
  trinidad_service_id = @trinidad_name.gsub(/\W/, '')
@@ -138,11 +138,7 @@ module Trinidad
138
138
  RbConfig::CONFIG['host_os'] =~ /darwin/i
139
139
  end
140
140
 
141
- def ia64?
142
- RbConfig::CONFIG['arch'] =~ /i686|ia64/i
143
- end
144
-
145
- def bundled_jsvc_path
141
+ def bundled_jsvc_path # only called on *nix
146
142
  jsvc = 'jsvc_' + (macosx? ? 'darwin' : 'linux')
147
143
  jsvc_path = File.join(@jars_path, jsvc)
148
144
  # linux version is no longer bundled - as long as it is not present jsvc
@@ -150,7 +146,7 @@ module Trinidad
150
146
  File.exist?(jsvc_path) ? jsvc_path : nil
151
147
  end
152
148
 
153
- def detect_jsvc_path
149
+ def detect_jsvc_path # only called on *nix
154
150
  jsvc_path = `which jsvc` # "/usr/bin/jsvc\n"
155
151
  jsvc_path.chomp!
156
152
  jsvc_path.empty? ? bundled_jsvc_path : jsvc_path
@@ -210,9 +206,16 @@ module Trinidad
210
206
  nil
211
207
  end
212
208
 
213
- def bundled_prunsrv_path
214
- prunsrv = 'prunsrv_' + (ia64? ? 'ia64' : 'amd64') + '.exe'
215
- File.join(@jars_path, prunsrv)
209
+ def bundled_prunsrv_path(arch = java.lang.System.getProperty("os.arch"))
210
+ # "amd64", "i386", "x86", "x86_64"
211
+ path = 'windows'
212
+ if arch =~ /amd64/i # amd64
213
+ path += '/amd64'
214
+ elsif arch =~ /64/i # x86_64
215
+ path += '/ia64'
216
+ # else "i386", "x86"
217
+ end
218
+ File.join(@jars_path, path, 'prunsrv.exe')
216
219
  end
217
220
 
218
221
  def make_path_dir(path, error = nil)
@@ -1,5 +1,5 @@
1
1
  module Trinidad
2
2
  module InitServices
3
- VERSION = '1.1.4'
3
+ VERSION = '1.1.5'
4
4
  end
5
5
  end
@@ -1,7 +1,6 @@
1
1
  require File.expand_path('spec_helper', File.join(File.dirname(__FILE__), '..'))
2
2
 
3
3
  require 'yaml'
4
- require 'rbconfig'
5
4
  require 'fileutils'
6
5
  require 'java'
7
6
 
@@ -32,7 +31,7 @@ describe Trinidad::InitServices::Configuration do
32
31
 
33
32
  init_file_content.match(/RUN_USER=""/).should be_true
34
33
  end
35
-
34
+
36
35
  it "makes pid_file and log_file dirs" do
37
36
  pids_dir = File.join(tmp_dir, "pids")
38
37
  logs_dir = File.join(tmp_dir, "logs")
@@ -54,7 +53,7 @@ describe Trinidad::InitServices::Configuration do
54
53
  end
55
54
  end
56
55
 
57
- if RbConfig::CONFIG['host_os'] !~ /mswin|mingw/i
56
+ if java.lang.System.getProperty('os.name') !~ /windows/i
58
57
 
59
58
  it "fails for non-existing run user" do
60
59
  username = random_username
@@ -103,6 +102,25 @@ describe Trinidad::InitServices::Configuration do
103
102
 
104
103
  end
105
104
 
105
+ it "resolves bundled bundled prunsrv.exe based on system arch" do
106
+ trinidad_libs = File.expand_path('trinidad-libs', File.join(File.dirname(__FILE__), '../..'))
107
+ subject = Trinidad::InitServices::Configuration.new
108
+ subject.initialize_paths
109
+
110
+ path = subject.send :bundled_prunsrv_path, "amd64"
111
+ path.should == File.join(trinidad_libs, 'windows/amd64/prunsrv.exe')
112
+
113
+ path = subject.send :bundled_prunsrv_path, "x86_64"
114
+ path.should == File.join(trinidad_libs, 'windows/ia64/prunsrv.exe')
115
+
116
+ path = subject.send :bundled_prunsrv_path, "i386"
117
+ path.should == File.join(trinidad_libs, 'windows/prunsrv.exe')
118
+
119
+ path = subject.send :bundled_prunsrv_path, "x86"
120
+ path.should == File.join(trinidad_libs, 'windows/prunsrv.exe')
121
+ end
122
+
123
+
106
124
  private
107
125
 
108
126
  def config_defaults
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
 
47
47
  s.post_install_message = <<TEXT
48
48
 
49
- ------------------------------------------------------------------------------------
49
+ --------------------------------------------------------------------------------
50
50
 
51
51
  Please now run:
52
52
 
@@ -54,7 +54,7 @@ Please now run:
54
54
 
55
55
  to complete the installation.
56
56
 
57
- ------------------------------------------------------------------------------------
57
+ --------------------------------------------------------------------------------
58
58
 
59
59
  TEXT
60
60
  end
metadata CHANGED
@@ -1,132 +1,152 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinidad_init_services
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease:
5
- version: 1.1.4
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 5
10
+ version: 1.1.5
6
11
  platform: ruby
7
12
  authors:
8
- - David Calavera
13
+ - David Calavera
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2012-03-01 00:00:00 Z
18
+ date: 2012-03-06 00:00:00 Z
14
19
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: trinidad
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.3.2
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rspec
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 2.7.1
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: mocha
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0.10"
46
- type: :development
47
- version_requirements: *id003
20
+ - !ruby/object:Gem::Dependency
21
+ name: trinidad
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 31
29
+ segments:
30
+ - 1
31
+ - 3
32
+ - 2
33
+ version: 1.3.2
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 17
45
+ segments:
46
+ - 2
47
+ - 7
48
+ - 1
49
+ version: 2.7.1
50
+ type: :development
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: mocha
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 31
61
+ segments:
62
+ - 0
63
+ - 10
64
+ version: "0.10"
65
+ type: :development
66
+ version_requirements: *id003
48
67
  description: Trinidad init service scripts on Apache Commons Daemon and JRuby-Jsvc, compatible with Unix and Windows services
49
68
  email: calavera@apache.org
50
69
  executables:
51
- - trinidad_init_service
70
+ - trinidad_init_service
52
71
  extensions: []
53
72
 
54
73
  extra_rdoc_files:
55
- - README.md
56
- - LICENSE
74
+ - README.md
75
+ - LICENSE
57
76
  files:
58
- - .gitignore
59
- - Gemfile
60
- - History.txt
61
- - LICENSE
62
- - README.md
63
- - Rakefile
64
- - bin/trinidad_init_service
65
- - init.d/trinidad.erb
66
- - jsvc-unix-src/CHANGES.txt
67
- - jsvc-unix-src/INSTALL.txt
68
- - jsvc-unix-src/Makedefs.in
69
- - jsvc-unix-src/Makefile.in
70
- - jsvc-unix-src/configure
71
- - jsvc-unix-src/configure.in
72
- - jsvc-unix-src/man/README
73
- - jsvc-unix-src/man/fetch.sh
74
- - jsvc-unix-src/man/jsvc.1.xml
75
- - jsvc-unix-src/native/.indent.pro
76
- - jsvc-unix-src/native/Makefile.in
77
- - jsvc-unix-src/native/arguments.c
78
- - jsvc-unix-src/native/arguments.h
79
- - jsvc-unix-src/native/debug.c
80
- - jsvc-unix-src/native/debug.h
81
- - jsvc-unix-src/native/dso-dlfcn.c
82
- - jsvc-unix-src/native/dso-dyld.c
83
- - jsvc-unix-src/native/dso.h
84
- - jsvc-unix-src/native/help.c
85
- - jsvc-unix-src/native/help.h
86
- - jsvc-unix-src/native/home.c
87
- - jsvc-unix-src/native/home.h
88
- - jsvc-unix-src/native/java.c
89
- - jsvc-unix-src/native/java.h
90
- - jsvc-unix-src/native/jsvc-unix.c
91
- - jsvc-unix-src/native/jsvc.h
92
- - jsvc-unix-src/native/location.c
93
- - jsvc-unix-src/native/location.h
94
- - jsvc-unix-src/native/locks.c
95
- - jsvc-unix-src/native/locks.h
96
- - jsvc-unix-src/native/replace.c
97
- - jsvc-unix-src/native/replace.h
98
- - jsvc-unix-src/native/signals.c
99
- - jsvc-unix-src/native/signals.h
100
- - jsvc-unix-src/native/version.h
101
- - jsvc-unix-src/support/apfunctions.m4
102
- - jsvc-unix-src/support/apjava.m4
103
- - jsvc-unix-src/support/apsupport.m4
104
- - jsvc-unix-src/support/buildconf.sh
105
- - jsvc-unix-src/support/config.guess
106
- - jsvc-unix-src/support/config.sub
107
- - jsvc-unix-src/support/install.sh
108
- - jsvc-unix-src/support/mkdist.sh
109
- - lib/trinidad/daemon.rb
110
- - lib/trinidad_init_services.rb
111
- - lib/trinidad_init_services/configuration.rb
112
- - lib/trinidad_init_services/version.rb
113
- - spec/spec_helper.rb
114
- - spec/stubs/trinidad.rb
115
- - spec/stubs/trinidad.yml
116
- - spec/trinidad_daemon_spec.rb
117
- - spec/trinidad_init_services/configuration_spec.rb
118
- - trinidad-libs/commons-daemon.jar
119
- - trinidad-libs/jruby-jsvc.jar
120
- - trinidad-libs/jsvc_darwin
121
- - trinidad-libs/prunsrv_amd64.exe
122
- - trinidad-libs/prunsrv_ia64.exe
123
- - trinidad_init_services.gemspec
77
+ - .gitignore
78
+ - Gemfile
79
+ - History.txt
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - bin/trinidad_init_service
84
+ - init.d/trinidad.erb
85
+ - jsvc-unix-src/CHANGES.txt
86
+ - jsvc-unix-src/INSTALL.txt
87
+ - jsvc-unix-src/Makedefs.in
88
+ - jsvc-unix-src/Makefile.in
89
+ - jsvc-unix-src/configure
90
+ - jsvc-unix-src/configure.in
91
+ - jsvc-unix-src/man/README
92
+ - jsvc-unix-src/man/fetch.sh
93
+ - jsvc-unix-src/man/jsvc.1.xml
94
+ - jsvc-unix-src/native/.indent.pro
95
+ - jsvc-unix-src/native/Makefile.in
96
+ - jsvc-unix-src/native/arguments.c
97
+ - jsvc-unix-src/native/arguments.h
98
+ - jsvc-unix-src/native/debug.c
99
+ - jsvc-unix-src/native/debug.h
100
+ - jsvc-unix-src/native/dso-dlfcn.c
101
+ - jsvc-unix-src/native/dso-dyld.c
102
+ - jsvc-unix-src/native/dso.h
103
+ - jsvc-unix-src/native/help.c
104
+ - jsvc-unix-src/native/help.h
105
+ - jsvc-unix-src/native/home.c
106
+ - jsvc-unix-src/native/home.h
107
+ - jsvc-unix-src/native/java.c
108
+ - jsvc-unix-src/native/java.h
109
+ - jsvc-unix-src/native/jsvc-unix.c
110
+ - jsvc-unix-src/native/jsvc.h
111
+ - jsvc-unix-src/native/location.c
112
+ - jsvc-unix-src/native/location.h
113
+ - jsvc-unix-src/native/locks.c
114
+ - jsvc-unix-src/native/locks.h
115
+ - jsvc-unix-src/native/replace.c
116
+ - jsvc-unix-src/native/replace.h
117
+ - jsvc-unix-src/native/signals.c
118
+ - jsvc-unix-src/native/signals.h
119
+ - jsvc-unix-src/native/version.h
120
+ - jsvc-unix-src/support/apfunctions.m4
121
+ - jsvc-unix-src/support/apjava.m4
122
+ - jsvc-unix-src/support/apsupport.m4
123
+ - jsvc-unix-src/support/buildconf.sh
124
+ - jsvc-unix-src/support/config.guess
125
+ - jsvc-unix-src/support/config.sub
126
+ - jsvc-unix-src/support/install.sh
127
+ - jsvc-unix-src/support/mkdist.sh
128
+ - lib/trinidad/daemon.rb
129
+ - lib/trinidad_init_services.rb
130
+ - lib/trinidad_init_services/configuration.rb
131
+ - lib/trinidad_init_services/version.rb
132
+ - spec/spec_helper.rb
133
+ - spec/stubs/trinidad.rb
134
+ - spec/stubs/trinidad.yml
135
+ - spec/trinidad_daemon_spec.rb
136
+ - spec/trinidad_init_services/configuration_spec.rb
137
+ - trinidad-libs/commons-daemon.jar
138
+ - trinidad-libs/jruby-jsvc.jar
139
+ - trinidad-libs/jsvc_darwin
140
+ - trinidad-libs/windows/amd64/prunsrv.exe
141
+ - trinidad-libs/windows/ia64/prunsrv.exe
142
+ - trinidad-libs/windows/prunsrv.exe
143
+ - trinidad_init_services.gemspec
124
144
  homepage: http://github.com/trinidad/trinidad_init_services
125
145
  licenses: []
126
146
 
127
147
  post_install_message: |+
128
148
 
129
- ------------------------------------------------------------------------------------
149
+ --------------------------------------------------------------------------------
130
150
 
131
151
  Please now run:
132
152
 
@@ -134,24 +154,30 @@ post_install_message: |+
134
154
 
135
155
  to complete the installation.
136
156
 
137
- ------------------------------------------------------------------------------------
157
+ --------------------------------------------------------------------------------
138
158
 
139
159
  rdoc_options:
140
- - --charset=UTF-8
160
+ - --charset=UTF-8
141
161
  require_paths:
142
- - lib
162
+ - lib
143
163
  required_ruby_version: !ruby/object:Gem::Requirement
144
164
  none: false
145
165
  requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- version: "0"
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ hash: 3
169
+ segments:
170
+ - 0
171
+ version: "0"
149
172
  required_rubygems_version: !ruby/object:Gem::Requirement
150
173
  none: false
151
174
  requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: "0"
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ hash: 3
178
+ segments:
179
+ - 0
180
+ version: "0"
155
181
  requirements: []
156
182
 
157
183
  rubyforge_project: trinidad_init_services