trinidad_init_services 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eba0572bd277127f8bd63d447aa351dc206931e8
4
- data.tar.gz: 93784996ee1140fa3fd1a1d69f39877079a9d77c
3
+ metadata.gz: b9c7a3f4c19960b876a0eb77476b3671a9381898
4
+ data.tar.gz: a4245f606d7e1efe6bb5d13eb3c668760288b0e3
5
5
  SHA512:
6
- metadata.gz: 2b2f768bf987bd52589a4bcc0f00fbfdf1f4310c47405eefb938f2557e7c5bf187318a5136f4f890254f6040be05392d5a95b5e8864b50d60d9cc8c76ba43986
7
- data.tar.gz: 82739292c9a61af042a06168954deb467f9836b959e8f0ba57b1afa38cc5cc42ed14e2b43f020fb7cebd3a6480f7e69e9f245b1d9c78a52357e403cbe0e1a7d6
6
+ metadata.gz: 3e4fb893a3e6830ff6f78227846dc66f99e3813e636561cb3de2a97661a407846df2c69e0e9a013b8fe3ec7eab9e03772f305e3cd925306146fb99c00ab2e66e
7
+ data.tar.gz: fa587bd61e50c68c0341ef3842425a282b7e2e5bb86e888be318301a6d81860ff9b202b799a7b3fd306ec9c5b60517819c5466433f04823e2b88a1ca49ec5831
@@ -1,3 +1,9 @@
1
+ ## 1.3.1 (2014-07-26)
2
+
3
+ * make sure generated init.d script is valid shell (bash) script ... (fixes #43)
4
+ * fix wrong user instruction for installing service (thanks @davidhq at #43)
5
+ * normalize ruby compat version before setting it (user can input '2.0' now)
6
+
1
7
  ## 1.3.0 (2014-07-03)
2
8
 
3
9
  * `--no-ask` is now known as `--know`
@@ -119,7 +119,7 @@ if [ -z "$JAVA_OPTS" ] ; then
119
119
  else
120
120
  for opt in Xmx Xss; do
121
121
  if case ${JAVA_OPTS} in *"-${opt}"*) true;; *) false;; esac ; then
122
- # JAVA_OPTS contains option - do no thing
122
+ : # JAVA_OPTS contains option - do no-thing
123
123
  else
124
124
  if [ "${opt}" == "Xmx" ] ; then
125
125
  JAVA_OPTS="$JAVA_OPTS $JAVA_MEM $JAVA_MEM_MIN"
@@ -70,7 +70,8 @@ module Trinidad
70
70
  end
71
71
 
72
72
  @jruby_home = defaults['jruby_home'] || ask_path('JRuby home', default_jruby_home)
73
- @ruby_compat_version = defaults["ruby_compat_version"] || default_ruby_compat_version
73
+ ruby_compat_version = defaults['ruby_compat_version'] || default_ruby_compat_version
74
+ @ruby_compat_version = normalize_ruby_compat_version(ruby_compat_version)
74
75
  @jruby_opts = configure_jruby_opts(@jruby_home, @ruby_compat_version)
75
76
  initialize_paths(@jruby_home)
76
77
 
@@ -253,7 +254,7 @@ module Trinidad
253
254
  if chkconfig?
254
255
  command = "chkconfig #{@service_id} on"
255
256
  else
256
- command = "update-rc.d -f #{@service_id} remove"
257
+ command = "update-rc.d -f #{@service_id} defaults"
257
258
  end
258
259
  if service_file.start_with?('/etc')
259
260
  unless exec_system(command, :allow_failure)
@@ -487,6 +488,14 @@ module Trinidad
487
488
 
488
489
  def default_ruby_compat_version; current_ruby_compat_version end
489
490
 
491
+ def normalize_ruby_compat_version(version)
492
+ # e.g. '2.0' -> 'RUBY2_0'
493
+ if version.start_with?('RUBY')
494
+ version = version[4..-1]
495
+ end
496
+ "RUBY#{version.sub('.','_')}"
497
+ end
498
+
490
499
  def current_ruby_compat_version
491
500
  # deprecated on 9k but still working (returns RUBY2_1)
492
501
  JRuby.runtime.getInstanceConfig.getCompatVersion.to_s
@@ -1,5 +1,5 @@
1
1
  module Trinidad
2
2
  module InitServices
3
- VERSION = '1.3.0'
3
+ VERSION = '1.3.1'
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('spec_helper', File.join(File.dirname(__FILE__), '..'))
1
+ require File.expand_path('../spec_helper', File.dirname(__FILE__))
2
2
 
3
3
  require 'yaml'
4
4
  require 'fileutils'
@@ -15,11 +15,13 @@ describe Trinidad::InitServices::Configuration do
15
15
  after :each do
16
16
  FileUtils.rm_r init_dir
17
17
  Dir.rmdir(tmp_dir) if Dir.entries(tmp_dir) == [ '.', '..' ]
18
- ENV_JAVA.update @@env_java
18
+ ENV_JAVA.clear; ENV_JAVA.update @@env_java
19
19
  end
20
20
 
21
21
  before(:all) { @@env_java = ENV_JAVA.dup }
22
22
 
23
+ before(:each) { subject.ask = false } # do not ask by default
24
+
23
25
  it "creates the init.d file" do
24
26
  subject.configure config_defaults.merge 'java_home' => 'tmp/java', 'jruby_home' => 'tmp/jruby'
25
27
 
@@ -40,6 +42,15 @@ describe Trinidad::InitServices::Configuration do
40
42
  expect( init_file_content ).to match(/RUN_USER=""/)
41
43
  end
42
44
 
45
+ it "creates a (source) valid init.d file" do
46
+ subject.configure config_defaults.merge 'java_opts' => '-Xmx512M -Xss1024k'
47
+
48
+ expect( File.exist?(init_file) ).to be true
49
+
50
+ fail('not a valid bash source (see output above)') unless system "bash -n #{init_file}"
51
+
52
+ end unless (`which bash` rescue '').chomp.empty?
53
+
43
54
  it "configures memory requirements using JAVA_OPTS (Java 6)" do
44
55
  ENV_JAVA['java.version'] = '1.6.0_43'
45
56
  ENV_JAVA['os.arch'] = 'x64'
@@ -222,7 +233,7 @@ describe Trinidad::InitServices::Configuration do
222
233
  subject = windows_configuration
223
234
  config_options = {
224
235
  'app_path' => "C:/MyApp",
225
- 'ruby_compat_version' => "RUBY1_9",
236
+ 'ruby_compat_version' => "1.9",
226
237
  'service_id' => "TrinidadService",
227
238
  'service_name' => "Trinidad",
228
239
  'service_desc' => "Trinidad Service Description",
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinidad_init_services
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Calavera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-03 00:00:00.000000000 Z
11
+ date: 2014-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: trinidad
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.5
14
20
  requirement: !ruby/object:Gem::Requirement
15
21
  requirements:
16
22
  - - '>='
17
23
  - !ruby/object:Gem::Version
18
24
  version: 1.3.5
19
- name: trinidad
20
25
  prerelease: false
21
26
  type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
22
29
  version_requirements: !ruby/object:Gem::Requirement
23
30
  requirements:
24
- - - '>='
31
+ - - ~>
25
32
  - !ruby/object:Gem::Version
26
- version: 1.3.5
27
- - !ruby/object:Gem::Dependency
33
+ version: '2.14'
28
34
  requirement: !ruby/object:Gem::Requirement
29
35
  requirements:
30
36
  - - ~>
31
37
  - !ruby/object:Gem::Version
32
38
  version: '2.14'
33
- name: rspec
34
39
  prerelease: false
35
40
  type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: mocha
36
43
  version_requirements: !ruby/object:Gem::Requirement
37
44
  requirements:
38
45
  - - ~>
39
46
  - !ruby/object:Gem::Version
40
- version: '2.14'
41
- - !ruby/object:Gem::Dependency
47
+ version: 1.1.0
42
48
  requirement: !ruby/object:Gem::Requirement
43
49
  requirements:
44
50
  - - ~>
45
51
  - !ruby/object:Gem::Version
46
52
  version: 1.1.0
47
- name: mocha
48
53
  prerelease: false
49
54
  type: :development
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 1.1.0
55
55
  description: Trinidad init service scripts on Apache Commons Daemon and JRuby-Jsvc, compatible with Unix and Windows services
56
56
  email: calavera@apache.org
57
57
  executables: