Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Commit

Permalink
Rename to jetpack.
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviershay committed Jan 19, 2012
1 parent 232c8c7 commit e0a2413
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 41 deletions.
16 changes: 8 additions & 8 deletions README.markdown
@@ -1,31 +1,31 @@
# Preflight
# Jetpack

Preflight prepares your (j)ruby project for jvm deployment.
Jetpack prepares your (j)ruby project for jvm deployment.

Preflight, as much as possible, uses standard ruby-world tools to prepare the app for deployment, and then presents the ruby app to jetty as a Java EE web application.
Jetpack, as much as possible, uses standard ruby-world tools to prepare the app for deployment, and then presents the ruby app to jetty as a Java EE web application.

## Install

Deploys need to be performed using MRI. Here is a sample section of a project Gemfile:

platforms :ruby_19 do
gem 'preflight'
gem 'jetpack'
end


Create `config/preflight.yml` in your project:
Create `config/jetpack.yml` in your project:

jruby: "http://jruby.org.s3.amazonaws.com/downloads/1.6.5.1/jruby-complete-1.6.5.1.jar"
jetty: "http://dist.codehaus.org/jetty/jetty-hightide-7.4.5/jetty-hightide-7.4.5.v20110725.zip"
jruby-rack: "http://repository.codehaus.org/org/jruby/rack/jruby-rack/1.0.10/jruby-rack-1.0.10.jar"
app_user: "myapp"
app_root: "/usr/local/myapp/myapp"

Run preflight:
Run jetpack:

gem install preflight
gem install jetpack

preflight [your project directory]
jetpack [your project directory]

Of note, you'll now have:

Expand Down
24 changes: 12 additions & 12 deletions bin/preflight → bin/jetpack
Expand Up @@ -14,7 +14,7 @@ $LOAD_PATH << local_lib_dir if File.directory?(local_lib_dir)
#Cleanse the environment of these vars so that jruby is not affected.
ENV.delete_if{|k,v|k =~ /(^RUBY|^BUNDLE)/}

require "preflight/settings"
require "jetpack/settings"

include FileUtils

Expand All @@ -29,17 +29,17 @@ def x!(cmd)
end


halt("usage: preflight <project_path>") unless ARGV.length==1 && File.directory?(ARGV[0])
halt("usage: jetpack <project_path>") unless ARGV.length==1 && File.directory?(ARGV[0])

@path_to_project = ARGV.shift
@created = []

@settings = Preflight::Settings.load_from_project(@path_to_project)
@settings = Jetpack::Settings.load_from_project(@path_to_project)

puts @settings.inspect

unless @settings.jruby?
halt(%{Your config/preflight.yml must at least contain a pointer to the desired jruby-complete jar.
halt(%{Your config/jetpack.yml must at least contain a pointer to the desired jruby-complete jar.
Ex:
jruby: http://jruby.org.s3.amazonaws.com/downloads/1.6.4/jruby-complete-1.6.4.jar
Expand All @@ -50,7 +50,7 @@ end
script_start_time = Time.now

@jruby_jar_file = "vendor/jruby.jar"
@preflight_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
@jetpack_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))

@gem_home = "file:" + File.expand_path(File.join(@settings.app_root, @jruby_jar_file)) + "!/META-INF/jruby.home/lib/ruby/gems/1.8"
@gem_path = @gem_home + ":vendor/bundler_gem"
Expand All @@ -72,7 +72,7 @@ end

def install_bundler_gem
unless File.exists?("#{@path_to_project}/vendor/bundler_gem")
jruby! " -S gem install #{@preflight_dir}/gems/bundler-1.1.rc.gem -i vendor/bundler_gem --no-rdoc --no-ri"
jruby! " -S gem install #{@jetpack_dir}/gems/bundler-1.1.rc.gem -i vendor/bundler_gem --no-rdoc --no-ri"
end
end

Expand Down Expand Up @@ -144,7 +144,7 @@ end
bin_dir = File.join(@path_to_project, "bin")
mkdir_p bin_dir
overlay_files File.join(@preflight_dir, "bin_files"), bin_dir
overlay_files File.join(@jetpack_dir, "bin_files"), bin_dir
vendor_dir = File.join(@path_to_project, "vendor")
mkdir_p vendor_dir
Expand All @@ -155,16 +155,16 @@ if @settings.jetty?
jetty_dir = install_jetty(vendor_dir)
install_jruby_rack_jar vendor_dir #raise if jar not found
overlay_files File.join(@preflight_dir, "jetty_files"), File.join(@path_to_project, "vendor/jetty")
overlay_files File.join(@jetpack_dir, "jetty_files"), File.join(@path_to_project, "vendor/jetty")
web_inf_dir = File.join(@path_to_project, "WEB-INF")
mkdir_p web_inf_dir
overlay_files File.join(@preflight_dir, "web_inf_files"), web_inf_dir
overlay_files File.join(@jetpack_dir, "web_inf_files"), web_inf_dir
end
config_preflight_dir_in_project = File.join(@path_to_project, "config/preflight_files")
if File.directory?(config_preflight_dir_in_project)
overlay_files config_preflight_dir_in_project, @path_to_project
config_jetpack_dir_in_project = File.join(@path_to_project, "config/jetpack_files")
if File.directory?(config_jetpack_dir_in_project)
overlay_files config_jetpack_dir_in_project, @path_to_project
end
elapsed_seconds = (Time.now - script_start_time).to_i
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions jetty_files/jetty-init.erb
Expand Up @@ -151,7 +151,7 @@ ensure_rails_env_set()
ACTION=$1
shift
ARGS="$*"
# CONFIGS="" -- Not used in preflight. Rely on start.ini instead.
# CONFIGS="" -- Not used in jetpack. Rely on start.ini instead.
NO_START=0

##################################################
Expand Down Expand Up @@ -266,7 +266,7 @@ then
exit 1
fi

# !!!!!!! Not used in preflight. Rely on start.ini instead. !!!!!!!!!!
# !!!!!!! Not used in jetpack. Rely on start.ini instead. !!!!!!!!!!
###########################################################
# Get the list of config.xml files from the command line.
###########################################################
Expand Down Expand Up @@ -316,7 +316,7 @@ then
fi
fi

# -- Not used in preflight. Rely on start.ini instead.
# -- Not used in jetpack. Rely on start.ini instead.
##################################################
# Read the configuration file if one exists
##################################################
Expand Down Expand Up @@ -466,7 +466,7 @@ JAVA_VERSION=`expr "$($JAVA -version 2>&1 | head -1)" : '.*1\.\([0-9]\)'`
#
# PREFLIGHT NOTE:
# We do not allow the init script to set jetty.port
# when using preflight, as preflight sets this via
# when using jetpack, as jetpack sets this via
# jetty.xml, and setting port in both places causes
# jetty to attempt to bind to the same port.
#
Expand Down Expand Up @@ -672,9 +672,9 @@ case "$ACTION" in
echo "JETTY_ARGS = $JETTY_ARGS"
echo "JETTY_RUN = $JETTY_RUN"
echo "JETTY_PID = $JETTY_PID"
#echo "JETTY_PORT = $JETTY_PORT" JETTY_PORT is not used with preflight, see note elsewhere in this file.
#echo "JETTY_PORT = $JETTY_PORT" JETTY_PORT is not used with jetpack, see note elsewhere in this file.
echo "JETTY_LOGS = $JETTY_LOGS"
#echo "CONFIGS = $CONFIGS" -- Not used with preflight. Rely on start.ini instead.
#echo "CONFIGS = $CONFIGS" -- Not used with jetpack. Rely on start.ini instead.
echo "RAILS_ENV = $RAILS_ENV"
echo "JAVA_OPTIONS = $JAVA_OPTIONS"
echo "JAVA = $JAVA"
Expand Down
4 changes: 2 additions & 2 deletions lib/preflight/settings.rb → lib/jetpack/settings.rb
Expand Up @@ -2,10 +2,10 @@
require "yaml"
require "erb"

module Preflight
module Jetpack
class Settings < OpenStruct
def self.load_from_project(project_dir)
config_file = File.join(project_dir, "config/preflight.yml")
config_file = File.join(project_dir, "config/jetpack.yml")
raise("#{config_file} not found") unless File.exists?(config_file)
yaml = YAML.load(ERB.new(File.read(config_file)).result)
Settings.new(project_dir, yaml)
Expand Down
2 changes: 1 addition & 1 deletion script/ci
Expand Up @@ -48,7 +48,7 @@ function prepare_and_run() {
}

function tag_green_build() {
tag_name="ci-preflight-master/latest"
tag_name="ci-jetpack-master/latest"
git tag -f -m "tagging green build" "$tag_name"
git push -f origin "$tag_name"
}
Expand Down
4 changes: 2 additions & 2 deletions spec/basics_spec.rb
@@ -1,12 +1,12 @@
require "spec_helper"
require "tmpdir"

describe "preflight - basics" do
describe "jetpack - basics" do
let(:project) { "spec/sample_projects/no_dependencies" }

before(:all) do
reset
@result = x!("bin/preflight #{project}")
@result = x!("bin/jetpack #{project}")
end
after(:all) do
reset
Expand Down
10 changes: 5 additions & 5 deletions spec/bundler_spec.rb
@@ -1,12 +1,12 @@
require "spec_helper"

describe "preflight - bundler and gems" do
describe "jetpack - bundler and gems" do

before(:all) do
reset
rm_rf("spec/sample_projects/has_gems_via_bundler/vendor/bundle")
rm_rf("spec/sample_projects/has_gems_via_bundler/vendor/bundler_gem")
x!("bin/preflight spec/sample_projects/has_gems_via_bundler")
x!("bin/jetpack spec/sample_projects/has_gems_via_bundler")
end

after(:all) do
Expand Down Expand Up @@ -98,14 +98,14 @@

it "regenerates the Gemfile.lock and prints out a warning message" do
File.read("spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile.lock").should_not include("java")
preflight_result = x("bin/preflight spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock")
preflight_result[:stderr].gsub("\n", "").squeeze(" ").should include(%{
jetpack_result = x("bin/jetpack spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock")
jetpack_result[:stderr].gsub("\n", "").squeeze(" ").should include(%{
WARNING: Your Gemfile.lock does not contain PLATFORM java.
Automtically regenerating and overwriting Gemfile.lock using jruby
- because otherwise, jruby-specific gems would not be installed by bundler.
To make this message go away, you must re-generate your Gemfile.lock using jruby.
}.gsub("\n", "").squeeze(" "))
preflight_result[:exitstatus].should == 0
jetpack_result[:exitstatus].should == 0

File.read("spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile.lock").should include("java")

Expand Down
4 changes: 2 additions & 2 deletions spec/ruby_19_spec.rb
@@ -1,13 +1,13 @@
require "spec_helper"

describe "preflight - bundler and gems in 1.9 mode" do
describe "jetpack - bundler and gems in 1.9 mode" do
let(:project) { 'has_gems_via_bundler_19' }

before(:all) do
reset
rm_rf("spec/sample_projects/#{project}/vendor/bundle")
rm_rf("spec/sample_projects/#{project}/vendor/bundler_gem")
x!("bin/preflight spec/sample_projects/#{project}")
x!("bin/jetpack spec/sample_projects/#{project}")
end

after(:all) do
Expand Down
6 changes: 3 additions & 3 deletions spec/web_spec.rb
@@ -1,10 +1,10 @@
require "spec_helper"
require "yaml"

describe "preflight - web start" do
describe "jetpack - web start" do
before(:all) do
reset
@result = x!("bin/preflight spec/sample_projects/webapp")
@result = x!("bin/jetpack spec/sample_projects/webapp")
end

after(:all) do
Expand Down Expand Up @@ -32,7 +32,7 @@

it "respects the maximun number of concurrent connections" do
jetty_xml = "spec/sample_projects/webapp/vendor/jetty/etc/jetty.xml"
settings = YAML.load_file("spec/sample_projects/webapp/config/preflight.yml")
settings = YAML.load_file("spec/sample_projects/webapp/config/jetpack.yml")
max_threads_setting = /<Set name="maxThreads">#{settings["max_concurrent_connections"]}<\/Set>/

File.exists?(jetty_xml).should == true
Expand Down

0 comments on commit e0a2413

Please sign in to comment.