trinidad 1.4.6 → 1.5.0.B1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +22 -3
- data/LICENSE +1 -1
- data/README.md +79 -67
- data/Rakefile +20 -16
- data/bin/trinidad +3 -3
- data/lib/trinidad.rb +28 -14
- data/lib/trinidad/{command_line_parser.rb → cli.rb} +26 -20
- data/lib/trinidad/configuration.rb +10 -43
- data/lib/trinidad/extensions.rb +25 -23
- data/lib/trinidad/helpers.rb +63 -8
- data/lib/trinidad/lifecycle/base.rb +10 -9
- data/lib/trinidad/lifecycle/host.rb +16 -19
- data/lib/trinidad/lifecycle/host/rolling_reload.rb +33 -21
- data/lib/trinidad/lifecycle/web_app/default.rb +50 -19
- data/lib/trinidad/lifecycle/web_app/shared.rb +8 -0
- data/lib/trinidad/lifecycle/web_app/war.rb +2 -2
- data/lib/trinidad/logging.rb +8 -0
- data/lib/trinidad/server.rb +17 -12
- data/lib/trinidad/version.rb +1 -1
- data/lib/trinidad/web_app.rb +138 -133
- data/trinidad.gemspec +5 -8
- metadata +12 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9f931542c2c97ff175af70b7cfa4d7aa032c645
|
4
|
+
data.tar.gz: f55ee60e3b061ea7a91889e9ed1e9438581f3091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03cc89e6b175adbd918d099ed5224edca53e4cdb8bc8ee0d45276cf171e473bb0c09086930340201cf9f7aeb4ede770d7f34564c7a6bdf330d2758f8f78f5888
|
7
|
+
data.tar.gz: 66b2f839079014480fd298cfd6c3798909449fa6a3ee281bb45e3c37678407fd8e863ac2df08225756c4e6c4cb16cf4ede87be6dc0aac6e8461a4bf4df9b05eb
|
data/Gemfile
CHANGED
@@ -13,10 +13,29 @@ if (jars = ENV['trinidad_jars']) && jars != 'false'
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
gem '
|
16
|
+
gem 'rake', '< 10.2.0', :require => nil, :groups => [ :development, :test ]
|
17
|
+
group :development do
|
18
|
+
jruby_version = ENV['JRUBY_VERSION']
|
19
|
+
jruby_version = JRUBY_VERSION if jruby_version == 'current'
|
20
|
+
jruby_version ||= '1.6.8' # by default compiling against JRuby 1.6.8
|
21
|
+
gem 'jruby-jars', jruby_version, :require => nil # only for _javac_
|
22
|
+
|
23
|
+
if jruby_rack_version = ENV['JRUBY_RACK_VERSION']
|
24
|
+
gem 'jruby-rack', jruby_rack_version, :require => false
|
25
|
+
end
|
26
|
+
end
|
17
27
|
|
18
28
|
group :integration do
|
19
|
-
|
20
|
-
|
29
|
+
if sinatra_version = ENV['SINATRA_VERSION']
|
30
|
+
gem 'sinatra', sinatra_version, :require => nil, :group => :test
|
31
|
+
else
|
32
|
+
gem 'sinatra', :require => nil, :group => :test
|
33
|
+
end
|
34
|
+
if rails_version = ENV['RAILS_VERSION']
|
35
|
+
gem 'rails', rails_version, :require => nil, :group => :test
|
36
|
+
else
|
37
|
+
gem 'rails', :require => nil, :group => :test
|
38
|
+
end
|
39
|
+
gem 'jruby-openssl' if JRUBY_VERSION < '1.7.0'
|
21
40
|
# eval(File.read("spec/integration/rails32/Gemfile"), binding)
|
22
41
|
end
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== Trinidad
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2014 Team Trinidad and contributors http://github.com/trinidad
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
# Trinidad
|
2
2
|
|
3
|
-
Trinidad allows you to run Rails and/or Rack applications within an embedded
|
3
|
+
Trinidad allows you to run Rails and/or Rack applications within an embedded
|
4
4
|
Tomcat container. Apache Tomcat (formerly also Jakarta Tomcat) is an open source
|
5
|
-
web server and Servlet container with a long history that dates back to the
|
5
|
+
web server and Servlet container with a long history that dates back to the
|
6
6
|
previous millenia.
|
7
7
|
|
8
8
|
Trinidad's goals with bringing Tomcat into JRuby land are mostly the following :
|
9
9
|
|
10
|
-
- **flexibility** especially in terms of configuration it allows you to tune
|
10
|
+
- **flexibility** especially in terms of configuration it allows you to tune
|
11
11
|
(almost) everything from a simple *trinidad.yml* (or .rb) configuration file
|
12
12
|
- **portability** there's no vendor lock-in as we use `JRuby::Rack`, thus even
|
13
|
-
if you do some Java integration or use it's Rack Servlet extensions you're
|
13
|
+
if you do some Java integration or use it's Rack Servlet extensions you're
|
14
14
|
still able to migrate to a standalone Tomcat or any other Servlet container
|
15
15
|
- easy Java integration (just in-case you need it, it's there)
|
16
|
-
- **extensions** such as connection pooling (sharing pools between deployed
|
16
|
+
- **extensions** such as connection pooling (sharing pools between deployed
|
17
17
|
Rails apps) and (threaded) worker adapters for `Resque` and `Delayed::Job`
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
21
|
+
[![gem version](https://badge.fury.io/rb/trinidad.png)](http://rubygems.org/gems/trinidad)
|
22
|
+
|
21
23
|
```
|
22
24
|
$ jruby -S gem install trinidad
|
23
25
|
```
|
@@ -44,8 +46,8 @@ and than run `trinidad` - keep in mind a server is not an application dependency
|
|
44
46
|
|
45
47
|
### Rails
|
46
48
|
|
47
|
-
Trinidad supports the same Rails version as the JRuby-Rack it founds (or is
|
48
|
-
specified/locked in your *Gemfile*), which is **2.3**, **3.x** as well as
|
49
|
+
Trinidad supports the same Rails version as the JRuby-Rack it founds (or is
|
50
|
+
specified/locked in your *Gemfile*), which is **2.3**, **3.x** as well as
|
49
51
|
**4.0** for JRuby-Rack 1.1.x (and the coming 1.2). Merb is not supported.
|
50
52
|
|
51
53
|
```
|
@@ -104,20 +106,20 @@ the same way as JRuby-Rack (since it boots all applications), that is :
|
|
104
106
|
- otherwise the rack (gem) version might be specified using a magic comment in
|
105
107
|
*config.ru* as `# rack.version: ~>1.4.0` (or the latest installed gem is used)
|
106
108
|
|
107
|
-
**NOTE:** We do recommend to use the plain `trinidad` mode for running apps
|
109
|
+
**NOTE:** We do recommend to use the plain `trinidad` mode for running apps
|
108
110
|
(in production), since it supports runtime pooling while the "rackup" mode does
|
109
111
|
not, it also provides you with better Java integration possibilities.
|
110
112
|
|
111
113
|
Also note that Trinidad does not mimic JRuby-Rack's (1.1.x) backwards compatible
|
112
|
-
behavior of starting a pool for Rails but booting a thread-safe runtime for
|
113
|
-
plain Rack applications by default. Currently, runtime pooling is the default
|
114
|
-
with Trinidad and stays the same no matter the type of the application.
|
115
|
-
We expect this default to (most likely) change in a future version of Trinidad
|
114
|
+
behavior of starting a pool for Rails but booting a thread-safe runtime for
|
115
|
+
plain Rack applications by default. Currently, runtime pooling is the default
|
116
|
+
with Trinidad and stays the same no matter the type of the application.
|
117
|
+
We expect this default to (most likely) change in a future version of Trinidad
|
116
118
|
as thread-safe gets more adopted by (stable) releases of Rails 4.0.
|
117
119
|
|
118
120
|
## Configuration
|
119
121
|
|
120
|
-
Trinidad allows you to configure parameters from the command line, the following
|
122
|
+
Trinidad allows you to configure parameters from the command line, the following
|
121
123
|
is a list of the currently supported options (try `trinidad -h`):
|
122
124
|
|
123
125
|
```
|
@@ -141,18 +143,18 @@ is a list of the currently supported options (try `trinidad -h`):
|
|
141
143
|
* -g, --log LEVEL => set logging level
|
142
144
|
```
|
143
145
|
|
144
|
-
You can also specify a default *web.xml* to configure your web application.
|
146
|
+
You can also specify a default *web.xml* to configure your web application.
|
145
147
|
By default the server tries to load the file *config/web.xml* but you can change
|
146
148
|
the path by adding the option `default_web_xml` within your configuration file.
|
147
149
|
|
148
150
|
### YAML Configuration
|
149
151
|
|
150
|
-
The server can be configured from a .yml file. By default, if a file is
|
152
|
+
The server can be configured from a .yml file. By default, if a file is
|
151
153
|
not specified, the server tries to load **config/trinidad.yml**.
|
152
|
-
Within this file you can specify options available on the command line and tune
|
154
|
+
Within this file you can specify options available on the command line and tune
|
153
155
|
server settings or configure multiple applications to be hosted on the server.
|
154
156
|
|
155
|
-
Advanced configuration options are explained in the wiki:
|
157
|
+
Advanced configuration options are explained in the wiki:
|
156
158
|
http://wiki.github.com/trinidad/trinidad/advanced-configuration
|
157
159
|
|
158
160
|
|
@@ -168,8 +170,8 @@ $ jruby -S trinidad --config my_trinidad.yml
|
|
168
170
|
|
169
171
|
### Ruby Configuration
|
170
172
|
|
171
|
-
As an alternative to the *config/trinidad.yml* file, a .rb configuration file
|
172
|
-
might be used to setup Trinidad. It follows the same convention as the YAML
|
173
|
+
As an alternative to the *config/trinidad.yml* file, a .rb configuration file
|
174
|
+
might be used to setup Trinidad. It follows the same convention as the YAML
|
173
175
|
configuration - the file **config/trinidad.rb** is loaded by default if exists.
|
174
176
|
|
175
177
|
```ruby
|
@@ -193,41 +195,41 @@ Context with name [/] has started rolling
|
|
193
195
|
Context with name [/] has completed rolling
|
194
196
|
```
|
195
197
|
|
196
|
-
It also prints warnings and error messages on error output, while application
|
198
|
+
It also prints warnings and error messages on error output, while application
|
197
199
|
specific log messages (e.g. logs from `Rails.logger`) always go into the expected
|
198
|
-
file location at *log/{environment}.log*.
|
200
|
+
file location at *log/{environment}.log*.
|
199
201
|
|
200
|
-
Application logging performs daily file rolling out of the box and only prints
|
202
|
+
Application logging performs daily file rolling out of the box and only prints
|
201
203
|
messages to the console while it runs in development mode, that means you won't
|
202
204
|
see any application specific output on the console say in production !
|
203
205
|
|
204
|
-
Please note that these logging details as well as the logging format will be
|
206
|
+
Please note that these logging details as well as the logging format will be
|
205
207
|
configurable with *trinidad.yml/.rb* within the next **1.4.x** release.
|
206
208
|
|
207
|
-
If you plan to use a slice of Java with your JRuby and require a logger, consider
|
208
|
-
using `ServletContext#log`. By default it is setup in a way that logging with
|
209
|
-
`ServletContext` ends up in the same location as the Rails log.
|
209
|
+
If you plan to use a slice of Java with your JRuby and require a logger, consider
|
210
|
+
using `ServletContext#log`. By default it is setup in a way that logging with
|
211
|
+
`ServletContext` ends up in the same location as the Rails log.
|
210
212
|
If this is not enough you can still configure a Java logging library e.g. SLF4J,
|
211
|
-
just make sure you tell Trinidad to use it as well, if needed, using the
|
213
|
+
just make sure you tell Trinidad to use it as well, if needed, using the
|
212
214
|
**jruby.rack.logging** context parameter in *web.xml*.
|
213
215
|
|
214
216
|
### Context Configuration
|
215
217
|
|
216
|
-
For slightly advanced (and "dirty" XML :)) application configuration Trinidad
|
217
|
-
also supports the exact same *context.xml* format as Tomcat. Each web app is
|
218
|
-
represented as a context instance and might be configured as such. You do not
|
219
|
-
need to repeat configuring the same parameters you have already setup with the
|
220
|
-
Trinidad configuration. This is meant to be mostly for those familiar with
|
218
|
+
For slightly advanced (and "dirty" XML :)) application configuration Trinidad
|
219
|
+
also supports the exact same *context.xml* format as Tomcat. Each web app is
|
220
|
+
represented as a context instance and might be configured as such. You do not
|
221
|
+
need to repeat configuring the same parameters you have already setup with the
|
222
|
+
Trinidad configuration. This is meant to be mostly for those familiar with
|
221
223
|
Tomcat internals.
|
222
|
-
Currently the application's *context.xml* is expected to be located on the
|
224
|
+
Currently the application's *context.xml* is expected to be located on the
|
223
225
|
class-path under your *[classes]/META-INF* directory.
|
224
226
|
|
225
227
|
Context Doc: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
|
226
228
|
|
227
229
|
### Serving Assets
|
228
230
|
|
229
|
-
Trinidad uses Tomcat's built-in capabilities to server your public files.
|
230
|
-
We do recommend compiling assets up front and disabling the asset server (in
|
231
|
+
Trinidad uses Tomcat's built-in capabilities to server your public files.
|
232
|
+
We do recommend compiling assets up front and disabling the asset server (in
|
231
233
|
production) if you're using the asset pipeline in a Rails application.
|
232
234
|
If you do not put a web-server such as Apache in front of Trinidad you might
|
233
235
|
want to configure the resource caching (on by default for env != development)
|
@@ -235,7 +237,7 @@ for maximum performance e.g. by default it's configured as follows :
|
|
235
237
|
|
236
238
|
```yml
|
237
239
|
---
|
238
|
-
public:
|
240
|
+
public:
|
239
241
|
root: public # same as the above "public: public" setting
|
240
242
|
cached: true # enable (in-memory) asset caching on for env != 'development'
|
241
243
|
cache_ttl: 5000 # cache TTL in millis (might want to increase this)
|
@@ -245,37 +247,48 @@ for maximum performance e.g. by default it's configured as follows :
|
|
245
247
|
#/home: /var/local/www
|
246
248
|
```
|
247
249
|
|
248
|
-
Note that this configuration applies to (server-side) resource caching on top
|
249
|
-
of the "public" file-system. You do not need to worry about client side caching,
|
250
|
+
Note that this configuration applies to (server-side) resource caching on top
|
251
|
+
of the "public" file-system. You do not need to worry about client side caching,
|
250
252
|
it is handled out of the box with *ETag* and *Last-Modified* headers being set.
|
251
253
|
|
252
254
|
You might also "mount" file-system directories as aliases to your resources
|
253
255
|
root to be served by your application (as if they were in the public folder).
|
254
256
|
|
255
|
-
**NOTE:** In development mode if you ever happen to `rake assets:precompile`
|
257
|
+
**NOTE:** In development mode if you ever happen to `rake assets:precompile`
|
256
258
|
make sure to remove your *public/assets* directory later, otherwise requests
|
257
259
|
such as **/assets/application.js?body=1.0** might not hit the Rails runtime.
|
258
260
|
|
259
261
|
## Hot Deployment
|
260
262
|
|
261
|
-
Trinidad supports monitoring a file to reload applications, when the file
|
262
|
-
*tmp/restart.txt* is updated (e.g. `touch tmp/restart.txt`
|
263
|
-
|
263
|
+
Trinidad supports monitoring a file to reload applications, when the file
|
264
|
+
*tmp/restart.txt* is updated (e.g. `touch tmp/restart.txt` on Unix or
|
265
|
+
`type nul >>tmp\restart.txt & copy /b tmp\restart.txt +,,` on Windows),
|
266
|
+
the server reloads the application the monitor file belongs to.
|
264
267
|
This monitor file can be customized with the `monitor` configuration option.
|
265
268
|
|
266
269
|
Since version **1.4.0** Trinidad supports 2 reload strategies :
|
267
270
|
|
268
|
-
* **restart** (default) synchronous reloading
|
269
|
-
|
270
|
-
|
271
|
-
|
271
|
+
* **restart** (default) synchronous reloading. This strategy pauses incoming
|
272
|
+
requests while it reloads the application and then serves them once ready
|
273
|
+
(or timeouts if it takes too long). It is the default strategy since **1.4.0**
|
274
|
+
due it's more predictable memory requirements.
|
272
275
|
|
273
|
-
* **rolling** "zero-downtime" (asynchronous) reloading strategy similar to
|
276
|
+
* **rolling** a.k.a. "zero-downtime" (asynchronous) reloading strategy similar to
|
274
277
|
Passenger's rolling reloads. This has been the default since **1.1.0** up till
|
275
278
|
the **1.3.x** line. If you use this you should account that your JVM memory
|
276
279
|
requirements might increase quite a lot (esp. if you reload under heavy loads)
|
277
280
|
since requests are being served while there's another version of the
|
278
|
-
application being loaded.
|
281
|
+
application being loaded.
|
282
|
+
|
283
|
+
**NOTE:** due the way class-loaders where setup internally, Trinidad might have
|
284
|
+
failed releasing memory with reloads. This has been fixed in **1.5.0** please
|
285
|
+
consider updating, it is meant to be backwards compatible.
|
286
|
+
|
287
|
+
If you're on Java 6 you will likely need to tune your JAVA_OPTS / JRUBY_OPTS
|
288
|
+
for the JVM to do class unloading (consult the [wiki][] for more information) :
|
289
|
+
```
|
290
|
+
JRUBY_OPTS="$JRUBY_OPTS -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled"
|
291
|
+
```
|
279
292
|
|
280
293
|
Configure the reload strategy per web application or globally e.g. :
|
281
294
|
|
@@ -288,11 +301,11 @@ Configure the reload strategy per web application or globally e.g. :
|
|
288
301
|
|
289
302
|
## Virtual Hosts
|
290
303
|
|
291
|
-
It's possible to use Trinidad with multiple hosts and load the applications under
|
304
|
+
It's possible to use Trinidad with multiple hosts and load the applications under
|
292
305
|
them automatically. A (virtual) host represents an association of a network name
|
293
306
|
(such as "www.example.com" with the particular server on which Tomcat is running.
|
294
307
|
Please remember that each host must have its applications in a different directory.
|
295
|
-
You can find out more at Tomcat's [documentation][
|
308
|
+
You can find out more at Tomcat's [documentation][4].
|
296
309
|
|
297
310
|
```ruby
|
298
311
|
Trinidad.configure do |config|
|
@@ -306,7 +319,7 @@ Trinidad.configure do |config|
|
|
306
319
|
end
|
307
320
|
```
|
308
321
|
|
309
|
-
Detailed host configuration is also possible using supported [host options][
|
322
|
+
Detailed host configuration is also possible using supported [host options][4] :
|
310
323
|
|
311
324
|
```yaml
|
312
325
|
---
|
@@ -318,10 +331,10 @@ Detailed host configuration is also possible using supported [host options][5] :
|
|
318
331
|
unpackWARs: true
|
319
332
|
```
|
320
333
|
|
321
|
-
If applications are configured via the `web_apps` section, the host for each
|
322
|
-
application can be added with the `host` (or `hosts`) key, if a specified host
|
334
|
+
If applications are configured via the `web_apps` section, the host for each
|
335
|
+
application can be added with the `host` (or `hosts`) key, if a specified host
|
323
336
|
does not exists (e.g. not configured or not "localhost") it will be created.
|
324
|
-
If several applications belong to the same host, they are expected to reside
|
337
|
+
If several applications belong to the same host, they are expected to reside
|
325
338
|
under the same parent directory e.g. :
|
326
339
|
|
327
340
|
```ruby
|
@@ -345,7 +358,7 @@ end
|
|
345
358
|
|
346
359
|
## Extensions
|
347
360
|
|
348
|
-
Trinidad allows to extend itself with more (not just Tomcat) features using
|
361
|
+
Trinidad allows to extend itself with more (not just Tomcat) features using
|
349
362
|
extensions, they're essentially components hooked into Tomcat's life-cycle.
|
350
363
|
Here is a list of the available extensions that are "officially supported" :
|
351
364
|
|
@@ -357,7 +370,7 @@ Here is a list of the available extensions that are "officially supported" :
|
|
357
370
|
http://github.com/trinidad/trinidad_init_services
|
358
371
|
* Scheduler, based on Quartz :
|
359
372
|
http://github.com/trinidad/trinidad_scheduler_extension
|
360
|
-
* Worker, threaded workers (supports Resque, Delayed::Job) :
|
373
|
+
* Worker, threaded workers (supports Resque, Delayed::Job) :
|
361
374
|
http://github.com/trinidad/trinidad_worker_extension
|
362
375
|
* Logging, enhance Trinidad's logging system :
|
363
376
|
http://github.com/trinidad/trinidad_logging_extension
|
@@ -365,30 +378,29 @@ Here is a list of the available extensions that are "officially supported" :
|
|
365
378
|
http://github.com/trinidad/trinidad_lifecycle_extension
|
366
379
|
* Valves - components inserted into the request pipeline (e.g. Access Log) :
|
367
380
|
http://github.com/trinidad/trinidad_valve_extension
|
368
|
-
*
|
369
|
-
http://github.com/trinidad/
|
381
|
+
* Application/Deployment Monitoring based on PSI-Probe :
|
382
|
+
http://github.com/trinidad/trinidad_probe_extension
|
370
383
|
* Enable remote JMX monitoring capabilities for Trinidad :
|
371
384
|
http://github.com/trinidad/trinidad_jmx_remote_extension
|
372
385
|
|
373
|
-
You can find further information on how to write extensions in the [wiki][
|
386
|
+
You can find further information on how to write extensions in the [wiki][5].
|
374
387
|
|
375
388
|
## Support
|
376
389
|
|
377
390
|
* Contact [kares][0] if your team needs JRuby or Trinidad help and support
|
378
391
|
* [Logic Haus][1] provides JRuby related training and development services
|
379
|
-
* [Engine Yard][2] has PaaS cloud support with JRuby and Trinidad
|
380
392
|
* Mailing List: http://groups.google.com/group/rails-trinidad
|
381
|
-
* Bug Tracker:
|
393
|
+
* Bug Tracker: https://github.com/trinidad/trinidad/issues
|
382
394
|
* IRC [Channel on FreeNode][3]: #trinidad (or ask in #jruby)
|
383
395
|
|
384
396
|
## Copyright
|
385
397
|
|
386
|
-
Copyright (c)
|
398
|
+
Copyright (c) 2014 [Team Trinidad](https://github.com/trinidad).
|
387
399
|
See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.
|
388
400
|
|
389
|
-
[0]: http://
|
401
|
+
[0]: http://kares.org
|
390
402
|
[1]: http://logichaus.com/jruby.html
|
391
|
-
[
|
392
|
-
[
|
393
|
-
[
|
394
|
-
[
|
403
|
+
[3]: http://webchat.freenode.net/?channels=jruby
|
404
|
+
[4]: http://tomcat.apache.org/tomcat-7.0-doc/config/host.html
|
405
|
+
[5]: https://github.com/trinidad/trinidad/wiki/extensions
|
406
|
+
[6]: https://github.com/trinidad/trinidad/wiki/JOPTS
|
data/Rakefile
CHANGED
@@ -9,7 +9,8 @@ task :default => :spec
|
|
9
9
|
|
10
10
|
require 'rspec/core/rake_task'
|
11
11
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
12
|
-
spec.rspec_opts = ['--color'
|
12
|
+
spec.rspec_opts = ['--color']
|
13
|
+
spec.rspec_opts << '--format documentation' if ENV['CI'] == 'true'
|
13
14
|
end
|
14
15
|
|
15
16
|
desc "Remove all build artifacts"
|
@@ -46,14 +47,17 @@ TOMCAT_CORE_JAR = File.expand_path('../trinidad-libs/tomcat-core.jar', __FILE__)
|
|
46
47
|
TRINIDAD_RB_JAR = File.expand_path('../trinidad-libs/trinidad-rb.jar', __FILE__)
|
47
48
|
|
48
49
|
module TrinidadRakeHelpers
|
49
|
-
|
50
|
+
|
50
51
|
def javac(source_dir, target_dir, class_path = TOMCAT_CORE_JAR)
|
52
|
+
source = '1.6'; target = '1.6' # java-compiler settings
|
51
53
|
FileUtils.mkdir target_dir unless File.exist?(target_dir)
|
52
|
-
|
53
|
-
|
54
|
+
class_path = class_path.join(':') unless class_path.is_a?(String)
|
55
|
+
sh "javac -Xlint:deprecation -Xlint:unchecked " <<
|
56
|
+
" -g -source #{source} -target #{target} " <<
|
57
|
+
" -classpath #{class_path} -d #{target_dir} " <<
|
54
58
|
Dir["#{source_dir}/**/*.java"].join(" ")
|
55
59
|
end
|
56
|
-
|
60
|
+
|
57
61
|
def jar(entries, jar_path)
|
58
62
|
work_dir = Dir.pwd
|
59
63
|
if entries.is_a?(String) && File.directory?(entries)
|
@@ -67,36 +71,36 @@ module TrinidadRakeHelpers
|
|
67
71
|
%x{jar #{options} #{jar_path} #{entries.join(' ')}}
|
68
72
|
end
|
69
73
|
end
|
70
|
-
|
71
|
-
def log(msg)
|
72
|
-
|
73
|
-
end
|
74
|
-
|
74
|
+
|
75
|
+
def log(msg); puts msg end
|
76
|
+
|
75
77
|
end
|
76
78
|
|
77
79
|
namespace :'trinidad-rb' do
|
78
80
|
include TrinidadRakeHelpers
|
79
|
-
|
81
|
+
|
80
82
|
TRINIDAD_RB_TARGET_DIR = File.expand_path('../target/trinidad-rb', __FILE__)
|
81
|
-
|
83
|
+
|
82
84
|
desc "Compile trinidad-rb java sources"
|
83
85
|
task :compile do
|
84
|
-
|
86
|
+
require 'jruby-jars'
|
87
|
+
class_path = [ TOMCAT_CORE_JAR, JRubyJars.core_jar_path ]
|
88
|
+
javac "src/trinidad-rb/java", TRINIDAD_RB_TARGET_DIR, class_path
|
85
89
|
end
|
86
|
-
|
90
|
+
|
87
91
|
desc "Package trinidad-rb.jar"
|
88
92
|
task :jar => :compile do
|
89
93
|
rm TRINIDAD_RB_JAR if File.exist?(TRINIDAD_RB_JAR)
|
90
94
|
jar TRINIDAD_RB_TARGET_DIR, TRINIDAD_RB_JAR
|
91
95
|
end
|
92
|
-
|
96
|
+
|
93
97
|
desc "Remove trinidad-rb.jar"
|
94
98
|
task :clear do
|
95
99
|
rm_r TRINIDAD_RB_TARGET_DIR if File.exist?(TRINIDAD_RB_TARGET_DIR)
|
96
100
|
rm TRINIDAD_RB_JAR if File.exist?(TRINIDAD_RB_JAR)
|
97
101
|
end
|
98
102
|
task :clean => :clear
|
99
|
-
|
103
|
+
|
100
104
|
end
|
101
105
|
|
102
106
|
task :build => 'trinidad:build'
|