trinidad_daemon_extension 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -2
- data/History.txt +7 -0
- data/LICENSE +1 -1
- data/README.md +2 -1
- data/Rakefile +11 -96
- data/lib/trinidad_daemon_extension.rb +0 -2
- data/lib/trinidad_daemon_extension/jars.rb +2 -2
- data/lib/trinidad_daemon_extension/tomcat_wrapper.rb +3 -3
- data/lib/trinidad_daemon_extension/version.rb +1 -1
- data/spec/spec_helper.rb +7 -5
- data/spec/trinidad_daemon_extension_spec.rb +14 -14
- data/trinidad-libs/akuma.jar +0 -0
- data/trinidad_daemon_extension.gemspec +5 -10
- metadata +25 -19
data/Gemfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 0.4.0 (2013-01-14)
|
2
|
+
|
3
|
+
* Update akuma.jar to 1.8
|
4
|
+
* load jars instead of requiring them (polluting LOADED_FEATURES)
|
5
|
+
* Avoid akuma chdir-ing to root (#10)
|
6
|
+
* gem depends explicitly on the trinidad gem
|
7
|
+
|
1
8
|
== 0.3.1 (2012-05-06)
|
2
9
|
|
3
10
|
* Update jna.jar 3.4.0 from https://github.com/twall/jna/downloads (#9)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -46,4 +46,5 @@ http://wiki.github.com/calavera/trinidad/extensions
|
|
46
46
|
|
47
47
|
## Copyright
|
48
48
|
|
49
|
-
Copyright (c)
|
49
|
+
Copyright (c) 2013 [Team Trinidad](https://github.com/trinidad).
|
50
|
+
See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.
|
data/Rakefile
CHANGED
@@ -1,36 +1,10 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
# Helper functions
|
8
|
-
#
|
9
|
-
#############################################################################
|
10
|
-
|
11
|
-
def name
|
12
|
-
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
-
end
|
14
|
-
|
15
|
-
def version
|
16
|
-
line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
|
17
|
-
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
|
-
end
|
19
|
-
|
20
|
-
def gemspec_file
|
21
|
-
"#{name}.gemspec"
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError => e
|
4
|
+
require('rubygems') && retry
|
5
|
+
raise e
|
22
6
|
end
|
23
7
|
|
24
|
-
def gem_file
|
25
|
-
"#{name}-#{version}.gem"
|
26
|
-
end
|
27
|
-
|
28
|
-
#############################################################################
|
29
|
-
#
|
30
|
-
# Standard tasks
|
31
|
-
#
|
32
|
-
#############################################################################
|
33
|
-
|
34
8
|
task :default => :spec
|
35
9
|
|
36
10
|
require 'rspec/core/rake_task'
|
@@ -38,70 +12,11 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
38
12
|
spec.rspec_opts = ['--color', "--format documentation"]
|
39
13
|
end
|
40
14
|
|
41
|
-
|
42
|
-
task :coverage do
|
43
|
-
require 'rcov'
|
44
|
-
sh "rm -fr coverage"
|
45
|
-
sh "rcov test/test_*.rb"
|
46
|
-
sh "open coverage/index.html"
|
47
|
-
end
|
48
|
-
|
49
|
-
require 'rake/rdoctask'
|
50
|
-
Rake::RDocTask.new do |rdoc|
|
51
|
-
rdoc.rdoc_dir = 'rdoc'
|
52
|
-
rdoc.title = "#{name} #{version}"
|
53
|
-
rdoc.rdoc_files.include('README*')
|
54
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
55
|
-
end
|
56
|
-
|
57
|
-
desc "Open an irb session preloaded with this library"
|
58
|
-
task :console do
|
59
|
-
sh "irb -rubygems -r ./lib/#{name}.rb"
|
60
|
-
end
|
61
|
-
|
62
|
-
#############################################################################
|
63
|
-
#
|
64
|
-
# Custom tasks (add your own tasks here)
|
65
|
-
#
|
66
|
-
#############################################################################
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
#############################################################################
|
71
|
-
#
|
72
|
-
# Packaging tasks
|
73
|
-
#
|
74
|
-
#############################################################################
|
75
|
-
|
76
|
-
task :release => :build do
|
77
|
-
unless `git branch` =~ /^\* master$/
|
78
|
-
puts "You must be on the master branch to release!"
|
79
|
-
exit!
|
80
|
-
end
|
81
|
-
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
82
|
-
sh "git tag v#{version}"
|
83
|
-
sh "git push origin master --tags"
|
84
|
-
sh "gem push pkg/#{name}-#{version}.gem"
|
85
|
-
end
|
86
|
-
|
87
|
-
task :build => :validate do
|
88
|
-
sh "mkdir -p pkg"
|
89
|
-
sh "gem build #{gemspec_file}"
|
90
|
-
sh "mv #{gem_file} pkg"
|
91
|
-
end
|
92
|
-
|
93
|
-
task :install => :build do
|
94
|
-
sh "gem install pkg/#{name}-#{version}.gem"
|
95
|
-
end
|
15
|
+
require 'bundler/gem_tasks'
|
96
16
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
exit!
|
102
|
-
end
|
103
|
-
unless Dir['VERSION*'].empty?
|
104
|
-
puts "A `VERSION` file at root level violates Gem best practices."
|
105
|
-
exit!
|
106
|
-
end
|
17
|
+
desc "Clear out all built (pkg/* and *.gem) artifacts"
|
18
|
+
task :clear do
|
19
|
+
rm Dir["*.gem"]
|
20
|
+
rm_r Dir["pkg/*"] if File.exist?("pkg")
|
107
21
|
end
|
22
|
+
task :clean => :clear
|
@@ -5,5 +5,5 @@ trinidad_libs =
|
|
5
5
|
Trinidad::Extensions::Daemon::TRINIDAD_LIBS :
|
6
6
|
File.expand_path('../../../trinidad-libs', __FILE__)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
load File.join(trinidad_libs, 'akuma.jar')
|
9
|
+
load File.join(trinidad_libs, 'jna.jar')
|
@@ -32,7 +32,7 @@ module Trinidad
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def start
|
35
|
-
daemon = com.sun.akuma.Daemon.new
|
35
|
+
daemon = com.sun.akuma.Daemon::WithoutChdir.new
|
36
36
|
if daemon.isDaemonized
|
37
37
|
pid = com.sun.akuma.CLibrary::LIBC.getpid
|
38
38
|
puts "Starting Trinidad as a daemon"
|
@@ -74,7 +74,7 @@ module Trinidad
|
|
74
74
|
if arg.to_java.startsWith("-Xbootclasspath")
|
75
75
|
# add here the custom arguments, otherwhise are added after
|
76
76
|
# trinidad script and break optionParser
|
77
|
-
jvm_args.each { |custom| args.add(custom) }
|
77
|
+
jvm_args.each { |custom| args.add(custom) } if jvm_args
|
78
78
|
end
|
79
79
|
# I don't understand this hack but without it the daemon goes off,
|
80
80
|
# could be others
|
@@ -86,4 +86,4 @@ module Trinidad
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
89
|
-
end
|
89
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
begin
|
2
2
|
require 'rspec'
|
3
|
+
rescue LoadError => e
|
4
|
+
require('rubygems') && retry
|
5
|
+
raise e
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'mocha/api'
|
3
9
|
rescue LoadError
|
4
|
-
require '
|
5
|
-
gem 'rspec'
|
6
|
-
require 'rspec'
|
10
|
+
require 'mocha'
|
7
11
|
end
|
8
12
|
|
9
|
-
require 'mocha'
|
10
|
-
|
11
13
|
RSpec.configure do |config|
|
12
14
|
config.mock_with :mocha
|
13
15
|
end
|
@@ -57,6 +57,10 @@ end
|
|
57
57
|
|
58
58
|
describe Trinidad::Extensions::Daemon::TomcatWrapper do
|
59
59
|
|
60
|
+
let(:tomcat_wrapper) do
|
61
|
+
Trinidad::Extensions::Daemon::TomcatWrapper.new Trinidad::Tomcat::Tomcat.new
|
62
|
+
end
|
63
|
+
|
60
64
|
it "responds to tomcat methods" do
|
61
65
|
tomcat_wrapper.respond_to?(:start).should be true
|
62
66
|
tomcat_wrapper.respond_to?(:stop).should be true
|
@@ -86,10 +90,6 @@ describe Trinidad::Extensions::Daemon::TomcatWrapper do
|
|
86
90
|
tomcat.host.app_base.should == '/app-base'
|
87
91
|
end
|
88
92
|
|
89
|
-
def tomcat_wrapper
|
90
|
-
Trinidad::Extensions::Daemon::TomcatWrapper.new Trinidad::Tomcat::Tomcat.new
|
91
|
-
end
|
92
|
-
|
93
93
|
context "mocked" do
|
94
94
|
|
95
95
|
@@tmpdir = nil
|
@@ -102,27 +102,27 @@ describe Trinidad::Extensions::Daemon::TomcatWrapper do
|
|
102
102
|
ENV['TMPDIR'] = @@tmpdir
|
103
103
|
end
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
105
|
+
let(:tomcat) { mock('tomcat') }
|
106
|
+
let(:tomcat_wrapper) do
|
107
|
+
Trinidad::Extensions::Daemon::TomcatWrapper.new tomcat
|
108
|
+
end
|
109
109
|
|
110
110
|
it "starts tomcat" do
|
111
111
|
current_pid = $$
|
112
|
-
com.sun.akuma.Daemon.expects(:new).returns daemon = mock("daemon")
|
112
|
+
com.sun.akuma.Daemon::WithoutChdir.expects(:new).returns daemon = mock("daemon")
|
113
113
|
daemon.expects(:isDaemonized).returns true
|
114
114
|
daemon.expects(:init).with("#{File.dirname(__FILE__)}/trinidad.pid")
|
115
115
|
|
116
|
-
|
117
|
-
|
116
|
+
tomcat.expects(:start)
|
117
|
+
tomcat.expects(:server).returns server = mock("tomcat.server")
|
118
118
|
server.expects(:await)
|
119
119
|
|
120
|
-
|
120
|
+
tomcat_wrapper.start
|
121
121
|
end
|
122
122
|
|
123
123
|
it "stops tomcat" do
|
124
|
-
|
125
|
-
|
124
|
+
tomcat.expects(:stop)
|
125
|
+
tomcat_wrapper.stop
|
126
126
|
end
|
127
127
|
|
128
128
|
end
|
data/trinidad-libs/akuma.jar
CHANGED
Binary file
|
@@ -3,16 +3,12 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
require 'trinidad_daemon_extension/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.specification_version = 2 if s.respond_to? :specification_version=
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.rubygems_version = '1.3.5'
|
9
|
-
|
10
6
|
s.name = 'trinidad_daemon_extension'
|
11
7
|
s.version = Trinidad::Extensions::Daemon::VERSION
|
12
8
|
s.rubyforge_project = 'trinidad_daemon_extension'
|
13
9
|
|
14
|
-
s.summary = "
|
15
|
-
s.description = "Trinidad extension to run the Apache Tomcat server as a daemon"
|
10
|
+
s.summary = "Daemon extension for Trinidad"
|
11
|
+
s.description = "Trinidad extension to run the Apache Tomcat server as a daemon (for Unix only)."
|
16
12
|
|
17
13
|
s.authors = ["David Calavera"]
|
18
14
|
s.email = 'calavera@apache.org'
|
@@ -22,15 +18,14 @@ Gem::Specification.new do |s|
|
|
22
18
|
|
23
19
|
s.require_paths = %w[lib]
|
24
20
|
|
25
|
-
s.add_dependency('
|
21
|
+
s.add_dependency('trinidad', ">= 1.3.5")
|
26
22
|
|
27
|
-
s.add_development_dependency('rspec', '~> 2.
|
28
|
-
s.add_development_dependency('mocha', '>= 0.
|
23
|
+
s.add_development_dependency('rspec', '~> 2.10')
|
24
|
+
s.add_development_dependency('mocha', '>= 0.11')
|
29
25
|
|
30
26
|
s.files = `git ls-files`.split("\n").sort.
|
31
27
|
reject { |file| file =~ /^\./ }.
|
32
28
|
reject { |file| file =~ /^(rdoc|pkg|src|git-hooks)/ }
|
33
29
|
|
34
30
|
s.test_files = s.files.select { |path| path =~ /^spec\/.*_spec\.rb/ }
|
35
|
-
|
36
31
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: trinidad_daemon_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.4.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- David Calavera
|
@@ -10,42 +10,42 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2013-01-14 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
name: trinidad
|
17
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
19
18
|
none: false
|
20
19
|
requirements:
|
21
20
|
- - ">="
|
22
21
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
22
|
+
version: 1.3.5
|
23
|
+
requirement: *id001
|
24
|
+
prerelease: false
|
24
25
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
|
29
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
28
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
30
29
|
none: false
|
31
30
|
requirements:
|
32
31
|
- - ~>
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: "2.
|
33
|
+
version: "2.10"
|
34
|
+
requirement: *id002
|
35
|
+
prerelease: false
|
35
36
|
type: :development
|
36
|
-
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: mocha
|
39
|
-
|
40
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
39
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
42
|
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
44
|
+
version: "0.11"
|
45
|
+
requirement: *id003
|
46
|
+
prerelease: false
|
46
47
|
type: :development
|
47
|
-
|
48
|
-
description: Trinidad extension to run the Apache Tomcat server as a daemon
|
48
|
+
description: Trinidad extension to run the Apache Tomcat server as a daemon (for Unix only).
|
49
49
|
email: calavera@apache.org
|
50
50
|
executables: []
|
51
51
|
|
@@ -82,19 +82,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
+
hash: 2
|
86
|
+
segments:
|
87
|
+
- 0
|
85
88
|
version: "0"
|
86
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
90
|
none: false
|
88
91
|
requirements:
|
89
92
|
- - ">="
|
90
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 2
|
95
|
+
segments:
|
96
|
+
- 0
|
91
97
|
version: "0"
|
92
98
|
requirements: []
|
93
99
|
|
94
100
|
rubyforge_project: trinidad_daemon_extension
|
95
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.24
|
96
102
|
signing_key:
|
97
|
-
specification_version:
|
98
|
-
summary:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Daemon extension for Trinidad
|
99
105
|
test_files:
|
100
106
|
- spec/trinidad_daemon_extension_spec.rb
|