trinidad_daemon_extension 0.2.10 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.3.0 (2012-03-06)
2
+
3
+ * Update akuma.jar to latest release 1.7 - fixes init exec issue
4
+ * Update jna.jar to 3.4.0 (no longer included as part of akuma.jar)
5
+ * Replaced the (java) daemonizer implementation org.jruby.trinidad.TrinidadDaemon
6
+ with a ruby class Trinidad::Extensions::Daemon::TomcatWrapper
7
+
1
8
  == 0.2.10 (2012-01-09)
2
9
 
3
10
  * Add engine method to the proxy
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Trinidad Daemon Extension
2
+
3
+ Extension to run Trinidad server as a daemon.
4
+
5
+ ## Installation
6
+
7
+ jruby -S gem install trinidad_daemon_extension
8
+
9
+ ## Usage
10
+
11
+ This extension can be enabled from the Trinidad's configuration file or from the
12
+ command line. It uses a temporal directory to write the pid file but its path
13
+ can be overridden.
14
+
15
+ ### Configuration file
16
+
17
+ Configure the daemon in the "extensions" section of the *trinidad.yml* file :
18
+
19
+ ---
20
+ extensions:
21
+ daemon:
22
+ # optional by default the pid is written into a temporal directory :
23
+ pid_file: ./trinidad.pid
24
+
25
+ The extension also allows tuning JVM arguments to run the daemon with.
26
+ They just need to be added into the *jvm_args* configuration section:
27
+
28
+ ---
29
+ extensions:
30
+ daemon:
31
+ jvm_args: '-XX:MaxPermSize=512m'
32
+
33
+ **NOTE:** Be aware that *jvm_args* are bare `java` options and not ones
34
+ accepted by the `jruby` command !
35
+
36
+ ### Command line
37
+
38
+ To enable the extension from the command line you have to load the extension
39
+ first and then use it's `--daemonize [PID_FILE]` option :
40
+
41
+ $ jruby -S trinidad --load daemon --daemonize ./trinidad.pid
42
+
43
+
44
+ You can find further information on how to write your own extension in the wiki:
45
+ http://wiki.github.com/calavera/trinidad/extensions
46
+
47
+ ## Copyright
48
+
49
+ Copyright (c) 2010-2012 David Calavera. See LICENSE for details.
data/Rakefile CHANGED
@@ -13,18 +13,10 @@ def name
13
13
  end
14
14
 
15
15
  def version
16
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
16
+ line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
17
17
  line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
18
  end
19
19
 
20
- def date
21
- Date.today.to_s
22
- end
23
-
24
- def rubyforge_project
25
- name
26
- end
27
-
28
20
  def gemspec_file
29
21
  "#{name}.gemspec"
30
22
  end
@@ -33,10 +25,6 @@ def gem_file
33
25
  "#{name}-#{version}.gem"
34
26
  end
35
27
 
36
- def replace_header(head, header_name)
37
- head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
38
- end
39
-
40
28
  #############################################################################
41
29
  #
42
30
  # Standard tasks
@@ -45,14 +33,11 @@ end
45
33
 
46
34
  task :default => :spec
47
35
 
48
- require 'spec/rake/spectask'
49
- Spec::Rake::SpecTask.new(:spec) do |spec|
50
- spec.libs << 'lib' << 'spec'
51
- spec.spec_opts = ['--options', 'spec/spec.opts']
52
- spec.spec_files = FileList['spec/**/*_spec.rb']
36
+ require 'rspec/core/rake_task'
37
+ RSpec::Core::RakeTask.new(:spec) do |spec|
38
+ spec.rspec_opts = ['--color', "--format documentation"]
53
39
  end
54
40
 
55
-
56
41
  desc "Generate RCov test coverage and open in your browser"
57
42
  task :coverage do
58
43
  require 'rcov'
@@ -95,12 +80,11 @@ task :release => :build do
95
80
  end
96
81
  sh "git commit --allow-empty -a -m 'Release #{version}'"
97
82
  sh "git tag v#{version}"
98
- sh "git push origin master"
99
- sh "git push --tags"
83
+ sh "git push origin master --tags"
100
84
  sh "gem push pkg/#{name}-#{version}.gem"
101
85
  end
102
86
 
103
- task :build => ['ant:build', 'gemspec'] do
87
+ task :build => :validate do
104
88
  sh "mkdir -p pkg"
105
89
  sh "gem build #{gemspec_file}"
106
90
  sh "mv #{gem_file} pkg"
@@ -109,34 +93,6 @@ end
109
93
  task :install => :build do
110
94
  sh "gem install pkg/#{name}-#{version}.gem"
111
95
  end
112
- task :gemspec => :validate do
113
- # read spec file and split out manifest section
114
- spec = File.read(gemspec_file)
115
- head, manifest, tail = spec.split(" # = MANIFEST =\n")
116
-
117
- # replace name version and date
118
- replace_header(head, :name)
119
- replace_header(head, :version)
120
- replace_header(head, :date)
121
- #comment this out if your rubyforge_project has a different name
122
- replace_header(head, :rubyforge_project)
123
-
124
- # determine file list from git ls-files
125
- files = `git ls-files`.
126
- split("\n").
127
- sort.
128
- reject { |file| file =~ /^\./ }.
129
- reject { |file| file =~ /^(rdoc|pkg|src|git-hooks)/ }.
130
- reject { |file| file =~ /tomcat-core.jar/ }.
131
- map { |file| " #{file}" }.
132
- join("\n")
133
-
134
- # piece file back together and write
135
- manifest = " s.files = %w[\n#{files}\n ]\n"
136
- spec = [head, manifest, tail].join(" # = MANIFEST =\n")
137
- File.open(gemspec_file, 'w') { |io| io.write(spec) }
138
- puts "Updated #{gemspec_file}"
139
- end
140
96
 
141
97
  task :validate do
142
98
  libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
@@ -0,0 +1,89 @@
1
+ require 'tmpdir'
2
+
3
+ module Trinidad
4
+ module Extensions
5
+ module Daemon
6
+ class TomcatWrapper
7
+
8
+ attr_reader :pid_file, :jvm_args
9
+
10
+ def initialize(tomcat, pid_file = nil, jvm_args = nil)
11
+ @tomcat = tomcat
12
+ # Dir.tmpdir allows overriding /tmp location from ENV
13
+ pid_file ||= File.join(Dir.tmpdir, 'trinidad.pid')
14
+ @pid_file = java.io.File.new(pid_file).getAbsolutePath
15
+ @jvm_args = jvm_args
16
+ end
17
+
18
+ def server
19
+ @tomcat.server # getServer()
20
+ end
21
+
22
+ def service
23
+ @tomcat.service # getService()
24
+ end
25
+
26
+ def engine
27
+ @tomcat.engine # getEngine()
28
+ end
29
+
30
+ def host
31
+ @tomcat.host # getHost()
32
+ end
33
+
34
+ def start
35
+ daemon = com.sun.akuma.Daemon.new
36
+ if daemon.isDaemonized
37
+ pid = com.sun.akuma.CLibrary::LIBC.getpid
38
+ puts "Starting Trinidad as a daemon"
39
+ puts "To stop it, kill -s SIGINT #{pid}"
40
+ daemon.init(pid_file)
41
+ else
42
+ daemon.daemonize(configure_jvm_args)
43
+ java.lang.System.exit(0)
44
+ end
45
+ @tomcat.start
46
+ @tomcat.server.await
47
+ rescue java.lang.Exception => e
48
+ java.lang.System.err.println("Error daemonizing Trinidad: " + e.getMessage())
49
+ e.printStackTrace(java.lang.System.err)
50
+ java.lang.System.exit(1)
51
+ end
52
+
53
+ def stop
54
+ @tomcat.stop
55
+ end
56
+
57
+ def respond_to?(name)
58
+ super || @tomcat.respond_to?(name)
59
+ end
60
+
61
+ def method_missing(name, *args, &block)
62
+ if @tomcat.respond_to?(name)
63
+ @tomcat.send(name, *args, &block)
64
+ else
65
+ super
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+ def configure_jvm_args
72
+ args = com.sun.akuma.JavaVMArguments.new
73
+ com.sun.akuma.JavaVMArguments.current.each do |arg|
74
+ if arg.to_java.startsWith("-Xbootclasspath")
75
+ # add here the custom arguments, otherwhise are added after
76
+ # trinidad script and break optionParser
77
+ jvm_args.each { |custom| args.add(custom) }
78
+ end
79
+ # I don't understand this hack but without it the daemon goes off,
80
+ # could be others
81
+ args.add(arg) unless arg.to_java.endsWith("java")
82
+ end
83
+ args
84
+ end
85
+
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,7 @@
1
+ module Trinidad
2
+ module Extensions
3
+ module Daemon
4
+ VERSION = '0.3.0'
5
+ end
6
+ end
7
+ end
@@ -1,34 +1,41 @@
1
1
  require 'rubygems'
2
- gem 'trinidad_jars'
3
- require 'trinidad/extensions'
2
+
3
+ require 'trinidad'
4
4
  require 'trinidad/jars'
5
+ require 'trinidad/extensions'
6
+
7
+ require 'java'
5
8
 
6
9
  require File.expand_path('../../trinidad-libs/akuma', __FILE__)
7
- require File.expand_path('../../trinidad-libs/trinidad-daemon-extension', __FILE__)
10
+ require File.expand_path('../../trinidad-libs/jna', __FILE__)
11
+
12
+ require 'trinidad_daemon_extension/version'
13
+ require 'trinidad_daemon_extension/tomcat_wrapper'
8
14
 
9
15
  module Trinidad
10
16
  module Extensions
11
- module Daemon
12
- VERSION = '0.2.10'
13
- end
14
-
15
17
  class DaemonServerExtension < ServerExtension
16
18
  def configure(tomcat)
17
- org.jruby.trinidad.TrinidadDaemon.new(tomcat, @options[:pid_file], jvm_args)
19
+ Trinidad::Extensions::Daemon::TomcatWrapper.new(tomcat, pid_file, jvm_args)
18
20
  end
19
21
 
20
22
  def override_tomcat?; true; end
21
23
 
24
+ def pid_file
25
+ @options[:pid_file]
26
+ end
27
+
22
28
  def jvm_args
23
- (@options[:jvm_args] ? @options[:jvm_args].split : []).to_java(:string)
29
+ @options[:jvm_args] ? @options[:jvm_args].split : []
24
30
  end
25
31
  end
26
32
 
27
33
  class DaemonOptionsExtension < OptionsExtension
28
34
  def configure(parser, default_options)
29
- parser.on('--daemonize', '--daemonize [PID_FILE]', 'run Trinidad as a daemon, pid_file by default is ENV[$TMPDIR]/trinidad.pid') do |pid|
35
+ message = 'run Trinidad as a daemon, PID_FILE defaults to ENV[TMPDIR]/trinidad.pid'
36
+ parser.on('--daemonize', '--daemonize [PID_FILE]', message) do |pid|
30
37
  extensions = default_options[:extensions] || {}
31
- extensions[:daemon] = {:pid_file => pid}
38
+ extensions[:daemon] = { :pid_file => pid }
32
39
  default_options[:extensions] = extensions
33
40
  end
34
41
  end
data/spec/spec_helper.rb CHANGED
@@ -1,17 +1,16 @@
1
1
  begin
2
- require 'spec'
2
+ require 'rspec'
3
3
  rescue LoadError
4
4
  require 'rubygems'
5
5
  gem 'rspec'
6
- require 'spec'
6
+ require 'rspec'
7
7
  end
8
8
 
9
- $:.unshift(File.dirname(__FILE__) + '/../lib')
10
-
11
- require 'java'
12
- require 'trinidad_daemon_extension'
13
9
  require 'mocha'
14
10
 
15
- Spec::Runner.configure do |config|
11
+ RSpec.configure do |config|
16
12
  config.mock_with :mocha
17
13
  end
14
+
15
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
16
+ require 'trinidad_daemon_extension'
@@ -11,7 +11,7 @@ describe Trinidad::Extensions::DaemonServerExtension do
11
11
  it "bypass the control to the daemon" do
12
12
  daemon = subject.configure(@tomcat)
13
13
  daemon.should_not be_nil
14
- daemon.should be_instance_of(org.jruby.trinidad.TrinidadDaemon)
14
+ daemon.should be_instance_of(Trinidad::Extensions::Daemon::TomcatWrapper)
15
15
  end
16
16
 
17
17
  it "uses a temporal directory to write the pid file by default" do
@@ -47,3 +47,84 @@ describe Trinidad::Extensions::DaemonOptionsExtension do
47
47
  options[:extensions][:daemon][:pid_file].should == '/tmp/trinidad.pid'
48
48
  end
49
49
  end
50
+
51
+ class Java::OrgApacheCatalinaStartup::Tomcat
52
+
53
+ field_reader :basedir # only setBaseDir
54
+ field_reader :port, :hostname # only setters
55
+
56
+ end
57
+
58
+ describe Trinidad::Extensions::Daemon::TomcatWrapper do
59
+
60
+ it "responds to tomcat methods" do
61
+ tomcat_wrapper.respond_to?(:start).should be true
62
+ tomcat_wrapper.respond_to?(:stop).should be true
63
+
64
+ tomcat_wrapper.respond_to?(:base_dir=).should be true
65
+ tomcat_wrapper.respond_to?(:setBaseDir).should be true
66
+
67
+ tomcat_wrapper.respond_to?(:port=).should be true
68
+ tomcat_wrapper.respond_to?(:setPort).should be true
69
+ end
70
+
71
+ it "configures a real tomcat" do
72
+ wrapper = tomcat_wrapper
73
+ tomcat = wrapper.instance_variable_get(:'@tomcat')
74
+
75
+ wrapper.base_dir = '/base_dir'
76
+ wrapper.hostname = 'local-host1'
77
+ wrapper.server.address = 'local-host2'
78
+ wrapper.port = 42
79
+ wrapper.host.app_base = '/app-base'
80
+ wrapper.enable_naming
81
+
82
+ tomcat.basedir.should == '/base_dir'
83
+ tomcat.hostname.should == 'local-host1'
84
+ tomcat.server.address.should == 'local-host2'
85
+ tomcat.port.should == 42
86
+ tomcat.host.app_base.should == '/app-base'
87
+ end
88
+
89
+ def tomcat_wrapper
90
+ Trinidad::Extensions::Daemon::TomcatWrapper.new Trinidad::Tomcat::Tomcat.new
91
+ end
92
+
93
+ context "mocked" do
94
+
95
+ @@tmpdir = nil
96
+ before :all do
97
+ @@tmpdir = ENV['TMPDIR']
98
+ ENV['TMPDIR'] = File.dirname(__FILE__)
99
+ end
100
+
101
+ after :all do
102
+ ENV['TMPDIR'] = @@tmpdir
103
+ end
104
+
105
+ before :each do
106
+ @tomcat = mock('tomcat')
107
+ @tomcat_wrapper = Trinidad::Extensions::Daemon::TomcatWrapper.new(@tomcat)
108
+ end
109
+
110
+ it "starts tomcat" do
111
+ current_pid = $$
112
+ com.sun.akuma.Daemon.expects(:new).returns daemon = mock("daemon")
113
+ daemon.expects(:isDaemonized).returns true
114
+ daemon.expects(:init).with("#{File.dirname(__FILE__)}/trinidad.pid")
115
+
116
+ @tomcat.expects(:start)
117
+ @tomcat.expects(:server).returns server = mock("tomcat.server")
118
+ server.expects(:await)
119
+
120
+ @tomcat_wrapper.start
121
+ end
122
+
123
+ it "stops tomcat" do
124
+ @tomcat.expects(:stop)
125
+ @tomcat_wrapper.stop
126
+ end
127
+
128
+ end
129
+
130
+ end
Binary file
Binary file
@@ -1,73 +1,37 @@
1
- ## This is the rakegem gemspec template. Make sure you read and understand
2
- ## all of the comments. Some sections require modification, and others can
3
- ## be deleted if you don't need them. Once you understand the contents of
4
- ## this file, feel free to delete any comments that begin with two hash marks.
5
- ## You can find comprehensive Gem::Specification documentation, at
6
- ## http://docs.rubygems.org/read/chapter/20
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'trinidad_daemon_extension/version'
4
+
7
5
  Gem::Specification.new do |s|
8
6
  s.specification_version = 2 if s.respond_to? :specification_version=
9
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
8
  s.rubygems_version = '1.3.5'
11
-
12
- ## Leave these as is they will be modified for you by the rake gemspec task.
13
- ## If your rubyforge_project name is different, then edit it and comment out
14
- ## the sub! line in the Rakefile
9
+
15
10
  s.name = 'trinidad_daemon_extension'
16
- s.version = '0.2.10'
17
- s.date = '2012-01-09'
11
+ s.version = Trinidad::Extensions::Daemon::VERSION
18
12
  s.rubyforge_project = 'trinidad_daemon_extension'
19
-
20
- ## Make sure your summary is short. The description may be as long
21
- ## as you like.
13
+
22
14
  s.summary = "Trinidad daemon extension"
23
15
  s.description = "Trinidad extension to run the Apache Tomcat server as a daemon"
24
-
25
- ## List the primary authors. If there are a bunch of authors, it's probably
26
- ## better to set the email to an email list or something. If you don't have
27
- ## a custom homepage, consider using your GitHub URL or the like.
16
+
28
17
  s.authors = ["David Calavera"]
29
18
  s.email = 'calavera@apache.org'
30
- s.homepage = 'http://github.com/calavera/trinidad_daemon_extension'
31
-
32
- ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
33
- ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
34
- s.require_paths = %w[lib]
35
-
36
- ## Specify any RDoc options here. You'll want to add your README and
37
- ## LICENSE files to the extra_rdoc_files list.
19
+ s.homepage = 'http://github.com/trinidad/trinidad_daemon_extension'
38
20
  s.rdoc_options = ["--charset=UTF-8"]
39
- s.extra_rdoc_files = %w[README LICENSE]
40
-
41
- ## List your runtime dependencies here. Runtime dependencies are those
42
- ## that are needed for an end user to actually USE your code.
43
- s.add_dependency('trinidad_jars', [">= 0.1.1"])
44
-
45
- ## List your development dependencies here. Development dependencies are
46
- ## those that are only needed during development
47
- s.add_development_dependency('rspec')
48
- s.add_development_dependency('mocha')
49
-
50
- ## Leave this section as-is. It will be automatically generated from the
51
- ## contents of your Git repository via the gemspec task. DO NOT REMOVE
52
- ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
53
- # = MANIFEST =
54
- s.files = %w[
55
- History.txt
56
- LICENSE
57
- README
58
- Rakefile
59
- lib/trinidad_daemon_extension.rb
60
- rakelib/build.rake
61
- spec/spec.opts
62
- spec/spec_helper.rb
63
- spec/trinidad_daemon_extension_spec.rb
64
- trinidad-libs/akuma.jar
65
- trinidad-libs/trinidad-daemon-extension.jar
66
- trinidad_daemon_extension.gemspec
67
- ]
68
- # = MANIFEST =
69
-
70
- ## Test files will be grabbed from the file list. Make sure the path glob
71
- ## matches what you actually use.
21
+ s.extra_rdoc_files = %w[README.md LICENSE]
22
+
23
+ s.require_paths = %w[lib]
24
+
25
+ s.add_dependency('trinidad_jars', ">= 1.0.0")
26
+
27
+ s.add_development_dependency('rspec', '~> 2.8')
28
+ s.add_development_dependency('mocha', '>= 0.10.4')
29
+
30
+ s.files = `git ls-files`.split("\n").sort.
31
+ reject { |file| file =~ /^\./ }.
32
+ reject { |file| file =~ /^(rdoc|pkg|src|git-hooks)/ }.
33
+ reject { |file| file =~ /tomcat-core.jar/ } # only for compiling !
34
+
72
35
  s.test_files = s.files.select { |path| path =~ /^spec\/.*_spec\.rb/ }
36
+
73
37
  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.2.10
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Calavera
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-09 00:00:00 Z
13
+ date: 2012-03-06 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: trinidad_jars
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.1.1
23
+ version: 1.0.0
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
@@ -29,9 +29,9 @@ dependencies:
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
- - - ">="
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: "0"
34
+ version: "2.8"
35
35
  type: :development
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: "0"
45
+ version: 0.10.4
46
46
  type: :development
47
47
  version_requirements: *id003
48
48
  description: Trinidad extension to run the Apache Tomcat server as a daemon
@@ -52,22 +52,23 @@ executables: []
52
52
  extensions: []
53
53
 
54
54
  extra_rdoc_files:
55
- - README
55
+ - README.md
56
56
  - LICENSE
57
57
  files:
58
+ - Gemfile
58
59
  - History.txt
59
60
  - LICENSE
60
- - README
61
+ - README.md
61
62
  - Rakefile
62
63
  - lib/trinidad_daemon_extension.rb
63
- - rakelib/build.rake
64
- - spec/spec.opts
64
+ - lib/trinidad_daemon_extension/tomcat_wrapper.rb
65
+ - lib/trinidad_daemon_extension/version.rb
65
66
  - spec/spec_helper.rb
66
67
  - spec/trinidad_daemon_extension_spec.rb
67
68
  - trinidad-libs/akuma.jar
68
- - trinidad-libs/trinidad-daemon-extension.jar
69
+ - trinidad-libs/jna.jar
69
70
  - trinidad_daemon_extension.gemspec
70
- homepage: http://github.com/calavera/trinidad_daemon_extension
71
+ homepage: http://github.com/trinidad/trinidad_daemon_extension
71
72
  licenses: []
72
73
 
73
74
  post_install_message:
@@ -90,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  requirements: []
91
92
 
92
93
  rubyforge_project: trinidad_daemon_extension
93
- rubygems_version: 1.8.9
94
+ rubygems_version: 1.8.15
94
95
  signing_key:
95
96
  specification_version: 2
96
97
  summary: Trinidad daemon extension
data/README DELETED
@@ -1,49 +0,0 @@
1
- Trinidad Daemon Extension
2
- =======
3
-
4
- # DESCRIPTION
5
-
6
- Extension to run Trinidad server as a daemon.
7
-
8
- [WARNING] This extension only works with Trinidad 0.8.3 or above.
9
-
10
- # INSTALLATION
11
-
12
- jruby -S gem install trinidad_daemon_extension
13
-
14
- # USAGE
15
-
16
- This extension can be enabled from the Trinidad's configuration file or from the command line.
17
- It uses a temporal directory to write the pid file but its route can be overrided.
18
-
19
- * To enable it from the configuration file you have to add a section "extensions" to the root of the file and the section "daemon" to this one. The pid file can be specified there:
20
-
21
- ---
22
- extensions:
23
- daemon:
24
- pid_file: ./trinidad.pid # this is optional by default the extension writes the pid file into a temporal directory.
25
-
26
- * To enable it from the command line you have to load the extension first and then add one of these options:
27
-
28
- --daemonize [PID_FILE]
29
-
30
- for instance:
31
-
32
- $ jruby -S trinidad --load daemon --daemonize ./trinidad.pid
33
-
34
- The extension also allows to add new JVM arguments to run the daemon with. They just need to be added into the configuration file:
35
-
36
- ---
37
- extensions:
38
- daemon:
39
- jvm_args: '-XX:MaxPermSize=512m'
40
-
41
- You can find further information on how to write your own extension in the wiki: http://wiki.github.com/calavera/trinidad/extensions
42
-
43
- # DEVELOPMENT
44
-
45
- Copy the hooks into git-hooks directory to .git/hooks to make sure the jar file is updated when the java code is modified.
46
-
47
- # Copyright
48
-
49
- Copyright (c) 2010-2012 David Calavera. See LICENSE for details.
data/rakelib/build.rake DELETED
@@ -1,38 +0,0 @@
1
- require 'ant'
2
- require 'fileutils'
3
- include FileUtils
4
-
5
- TARGET_DIR = 'target'
6
- LIBS_DIR = 'trinidad-libs'
7
- JAR_NAME = 'trinidad-daemon-extension.jar'
8
-
9
- namespace :ant do
10
- desc 'Clean the java target directory'
11
- task :clean do
12
- rm_f TARGET_DIR
13
- rm_f "#{LIBS_DIR}/#{JAR_NAME}"
14
- end
15
-
16
- desc 'Compile the java classes'
17
- task :compile => :clean do
18
- opts = {
19
- :fork => 'true',
20
- :failonerror => 'true',
21
- :srcdir => 'src/main/java',
22
- :destdir => TARGET_DIR,
23
- :classpath => Dir.glob('trinidad-libs/*.jar').join(':')
24
- }
25
-
26
- mkdir_p TARGET_DIR
27
- ant.javac(opts)
28
- end
29
-
30
- desc 'Create the jar file'
31
- task :build => :compile do
32
- opts = {
33
- :destfile => "#{LIBS_DIR}/#{JAR_NAME}",
34
- :basedir => TARGET_DIR
35
- }
36
- ant.jar(opts)
37
- end
38
- end
data/spec/spec.opts DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --format specdoc