Skip to content

Commit

Permalink
cleanup code and leave maven options for the time being
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
mkristian committed Jun 17, 2012
1 parent d70ae19 commit 6361b01
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 42 deletions.
36 changes: 31 additions & 5 deletions README.md
@@ -1,16 +1,42 @@
# jetty run [![Build Status](https://secure.travis-ci.org/mkristian/jetty-run.png)](http://travis-ci.org/mkristian/jetty-run) #
#

jetty-run will use Gemfile/Gemfile.lock and Jarfile/Jarfile.lock to setup an environment to start rails in development mode with jetty. it uses ruby-maven to achieve this, i.e. all missing jar dependencies (jetty and all) will be downloaded on the first run (that can take time since it is a lot).
## install ##

first uninstall older ruby-maven (< 3.0.4.0.29.0) if present, they will otherwise conflict with jetty-run command

$ gem uninstall ruby-maven
$ gem install jetty-run

## usage ##

$ cd my_rails_app
$ jruby -S bundle install
$ jetty-run

for `bundle install` you need to use JRuby since Gemfile.lock needs to be for the java platform. `jetty-run` works with both MRS and JRUBY - MRI starts up slightly faster.

jetty-run will use Gemfile/Gemfile.lock and Jarfile/Jarfile.lock to setup an environment to start rails in development mode with jetty. it uses ruby-maven to achieve this, i.e. all missing jar dependencies (jetty and all) will be downloaded on the first run (that can take time since it first needs to download all the jetty related jars).

jetty will start with port 8080 (none ssl) and 8443 (ssl). the ssl certificate is ./src/test/resources/server.keystore with password '123456' - it will be copied there on the first run.

to customize jetty you can use _Mavenfile_ which allows to reconfigure jetty-maven-plugin with a ruby DSL:
to customize jetty you can use the _Mavenfile_ which allows to reconfigure jetty-maven-plugin:

properties['jetty.version'] = '7.5.1.v20110908'
properties['jetty.version'] = '7.5.1.v20110908'

TODO more advanced example and current config

## running any given war-file ##

jetty-war war /path/to/war-file

with this you warble your warfile and use jetty-run to start it with jetty.

## more ##

see

jetty-run help
# note #

most functionality is hidden inside 'maven-tools' gem and de.saumya.mojo:ruby-tools jar (from jruby-maven-plugins). it was first part of these jruby-maven-plugins and slowly the functionality moved to the ruby side of things. so things are on the move . . .
orginally the code was part the jruby-maven-plugins and slowly the functionality moved to the ruby side of things. so things are on the move and there is room for improvements . . .
43 changes: 6 additions & 37 deletions bin/jetty-run
@@ -1,36 +1,4 @@
#!/usr/bin/env ruby
# if ARGV.size > 4 || ARGV[0] == "--help" || ARGV[0] == "-h" || ARGV[0] == "-?"
# puts "usage: #{File.basename($0)} [-e <environment>] [--war [<path/to/warfile>]]"
# puts "\tdefault environment: development"
# exit 1
# end

# args = [__FILE__.gsub(/-/, ':').gsub(/.*[\/\\]/, '')]
# if ARGV.size == 2 && ARGV[0] == "-e"
# args << "-Drails.env=#{ARGV[1]}"
# args << "-Prun"
# elsif ARGV.size == 1 && ARGV[0] == "--war"
# args = ["jetty:run-war", "-Pwar"]
# elsif ARGV.size == 2 && ARGV[0] == "--war"
# args = ["jetty:deploy-war", "-DwebApp=#{ARGV[1]}", "-Pwar"]
# elsif ARGV.size == 3 && ARGV[0] == "-e" && ARGV[2] == "--war"
# args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[1]}"]
# elsif ARGV.size == 3 && ARGV[1] == "-e" && ARGV[0] == "--war"
# args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[2]}"]
# elsif ARGV.size == 4 && ARGV[0] == "-e" && ARGV[2] == "--war"
# args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[3]}", "-Drails.env=#{ARGV[1]}"]
# elsif ARGV.size == 4 && ARGV[2] == "-e" && ARGV[0] == "--war"
# args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[1]}", "-Drails.env=#{ARGV[3]}"]
# end
# ARGV.replace(args)
# if !File.exists?(File.join('config', 'web.xml')) && !File.exists?(File.join('src', 'main', 'webapp', 'WEB-INF', 'web.xml'))
# require 'fileutils'
# web_xml = Gem.find_files( 'maven/jetty/web.xml').first
# FileUtils.cp(web_xml, 'config')
# end
# load Gem.bin_path('ruby-maven', 'rmvn')


require 'maven/jetty/ruby_maven'
require 'thor'

Expand Down Expand Up @@ -97,11 +65,12 @@ class JettyCommand < Thor
when 'war'
'deploy-war'
end
if goal
puts
puts "Maven Options: (from jetty maven plugin)"
exec ["jetty:help", "-Ddetail=true", "-Dgoal=#{goal}"]
end
# TODO not sure whether or not these options are needed/helpful
# if goal
# puts
# puts "Maven Options: (from jetty maven plugin)"
# exec ["jetty:help", "-Ddetail=true", "-Dgoal=#{goal}"]
# end
end

end
Expand Down

0 comments on commit 6361b01

Please sign in to comment.