jetpack 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.wrong +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +23 -0
- data/README.markdown +35 -0
- data/Rakefile +16 -0
- data/bin/preflight +175 -0
- data/bin_files/.rake_runner.erb +36 -0
- data/bin_files/rake.erb +12 -0
- data/bin_files/ruby.erb +4 -0
- data/gems/bundler-1.0.18.gem +0 -0
- data/gems/bundler-1.1.rc.gem +0 -0
- data/gems/jruby-openssl-0.7.4.gem +0 -0
- data/install_gem.sh +5 -0
- data/jetpack.gemspec +19 -0
- data/jetty_files/etc/fake.p12 +0 -0
- data/jetty_files/etc/jetty.xml.erb +113 -0
- data/jetty_files/jetty-init.erb +702 -0
- data/jetty_files/run/.gitkeep +0 -0
- data/jetty_files/start.ini +69 -0
- data/jetty_files/webapps/.gitkeep +0 -0
- data/lib/preflight/settings.rb +48 -0
- data/script/ci +57 -0
- data/spec/basics_spec.rb +84 -0
- data/spec/bundler_spec.rb +120 -0
- data/spec/ruby_19_spec.rb +34 -0
- data/spec/sample_projects/has_gems_via_bundler/Gemfile +4 -0
- data/spec/sample_projects/has_gems_via_bundler/Gemfile.lock +13 -0
- data/spec/sample_projects/has_gems_via_bundler/Rakefile +18 -0
- data/spec/sample_projects/has_gems_via_bundler/config/preflight.yml +1 -0
- data/spec/sample_projects/has_gems_via_bundler/true} +0 -0
- data/spec/sample_projects/has_gems_via_bundler_19/Gemfile +8 -0
- data/spec/sample_projects/has_gems_via_bundler_19/Gemfile.lock +13 -0
- data/spec/sample_projects/has_gems_via_bundler_19/Rakefile +18 -0
- data/spec/sample_projects/has_gems_via_bundler_19/config/preflight.yml +2 -0
- data/spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile +4 -0
- data/spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Rakefile +18 -0
- data/spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/config/preflight.yml +1 -0
- data/spec/sample_projects/no_dependencies/Rakefile +30 -0
- data/spec/sample_projects/no_dependencies/config/preflight.yml +1 -0
- data/spec/sample_projects/webapp/Gemfile +3 -0
- data/spec/sample_projects/webapp/Gemfile.lock +88 -0
- data/spec/sample_projects/webapp/app/controllers/application_controller.rb +5 -0
- data/spec/sample_projects/webapp/config.ru +4 -0
- data/spec/sample_projects/webapp/config/application.rb +46 -0
- data/spec/sample_projects/webapp/config/boot.rb +6 -0
- data/spec/sample_projects/webapp/config/environment.rb +5 -0
- data/spec/sample_projects/webapp/config/environments/development.rb +25 -0
- data/spec/sample_projects/webapp/config/environments/test.rb +35 -0
- data/spec/sample_projects/webapp/config/initializers/secret_token.rb +7 -0
- data/spec/sample_projects/webapp/config/preflight.yml +6 -0
- data/spec/sample_projects/webapp/config/preflight_files/vendor/jetty/etc/custom-project-specific-jetty.xml +5 -0
- data/spec/sample_projects/webapp/config/preflight_files/vendor/jetty/etc/template-from-project-jetty.xml.erb +9 -0
- data/spec/sample_projects/webapp/config/routes.rb +60 -0
- data/spec/sample_projects/webapp/public/index.html +239 -0
- data/spec/sample_projects/webapp/script/rails +6 -0
- data/spec/spec_helper.rb +48 -0
- data/spec/suite.rb +1 -0
- data/spec/web_spec.rb +67 -0
- data/web_inf_files/web.xml.erb +47 -0
- metadata +175 -0
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#===========================================================
|
2
|
+
# Jetty start.jar arguments
|
3
|
+
# Each line of this file is prepended to the command line
|
4
|
+
# arguments # of a call to:
|
5
|
+
# java -jar start.jar [arg...]
|
6
|
+
#===========================================================
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
#===========================================================
|
11
|
+
# If the arguements in this file include JVM arguments
|
12
|
+
# (eg -Xmx512m) or JVM System properties (eg com.sun.???),
|
13
|
+
# then these will not take affect unless the --exec
|
14
|
+
# parameter is included or if the output from --dry-run
|
15
|
+
# is executed like:
|
16
|
+
# eval $(java -jar start.jar --dry-run)
|
17
|
+
#
|
18
|
+
# Below are some recommended options for Sun's JRE
|
19
|
+
#-----------------------------------------------------------
|
20
|
+
# --exec
|
21
|
+
# -Dcom.sun.management.jmxremote
|
22
|
+
# -Dorg.eclipse.jetty.util.log.IGNORED=true
|
23
|
+
# -Dorg.eclipse.jetty.util.log.stderr.DEBUG=true
|
24
|
+
# -Dorg.eclipse.jetty.util.log.stderr.SOURCE=true
|
25
|
+
# -Xmx2000m
|
26
|
+
# -Xmn512m
|
27
|
+
# -verbose:gc
|
28
|
+
# -XX:+PrintGCDateStamps
|
29
|
+
# -XX:+PrintGCTimeStamps
|
30
|
+
# -XX:+PrintGCDetails
|
31
|
+
# -XX:+PrintTenuringDistribution
|
32
|
+
# -XX:+PrintCommandLineFlags
|
33
|
+
# -XX:+DisableExplicitGC
|
34
|
+
# -XX:+UseConcMarkSweepGC
|
35
|
+
# -XX:ParallelCMSThreads=2
|
36
|
+
# -XX:+CMSClassUnloadingEnabled
|
37
|
+
# -XX:+UseCMSCompactAtFullCollection
|
38
|
+
# -XX:CMSInitiatingOccupancyFraction=80
|
39
|
+
#-----------------------------------------------------------
|
40
|
+
|
41
|
+
|
42
|
+
#===========================================================
|
43
|
+
# Start classpath OPTIONS.
|
44
|
+
# These control what classes are on the classpath
|
45
|
+
# for a full listing do
|
46
|
+
# java -jar start.jar --list-options
|
47
|
+
#-----------------------------------------------------------
|
48
|
+
OPTIONS=Server,jsp
|
49
|
+
#-----------------------------------------------------------
|
50
|
+
|
51
|
+
|
52
|
+
#===========================================================
|
53
|
+
# Configuration files.
|
54
|
+
# For a full list of available configuration files do
|
55
|
+
# java -jar start.jar --help
|
56
|
+
#-----------------------------------------------------------
|
57
|
+
# etc/jetty-jmx.xml
|
58
|
+
etc/jetty.xml
|
59
|
+
# etc/jetty-hightide.xml
|
60
|
+
# etc/jetty-ssl.xml
|
61
|
+
# etc/jetty-requestlog.xml
|
62
|
+
etc/jetty-deploy.xml
|
63
|
+
# etc/jetty-plus.xml
|
64
|
+
#etc/jetty-overlay.xml
|
65
|
+
etc/jetty-webapps.xml
|
66
|
+
# etc/jetty-contexts.xml
|
67
|
+
etc/jetty-testrealm.xml
|
68
|
+
# etc/jetty-jaas.xml
|
69
|
+
#===========================================================
|
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
require "yaml"
|
3
|
+
require "erb"
|
4
|
+
|
5
|
+
module Preflight
|
6
|
+
class Settings < OpenStruct
|
7
|
+
def self.load_from_project(project_dir)
|
8
|
+
config_file = File.join(project_dir, "config/preflight.yml")
|
9
|
+
raise("#{config_file} not found") unless File.exists?(config_file)
|
10
|
+
yaml = YAML.load(ERB.new(File.read(config_file)).result)
|
11
|
+
Settings.new(project_dir, yaml)
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(project_dir, user_defined_options)
|
15
|
+
contents = {}
|
16
|
+
contents["app_root"] = user_defined_options["app_root"] || File.expand_path(project_dir)
|
17
|
+
contents["app_user"] = user_defined_options["app_user"] || Etc.getpwuid(File.stat(contents["app_root"]).uid).name
|
18
|
+
contents["java_options"] = user_defined_options["java_options"] || "-Xmx2048m"
|
19
|
+
contents["https_port"] = user_defined_options["https_port"] || "4443"
|
20
|
+
contents["http_port"] = user_defined_options["http_port"] || "4080"
|
21
|
+
contents["jruby_rack"] = user_defined_options["jruby-rack"] if user_defined_options.key?("jruby-rack")
|
22
|
+
contents["jetty"] = user_defined_options["jetty"] if user_defined_options.key?("jetty")
|
23
|
+
contents["jruby"] = user_defined_options["jruby"] if user_defined_options.key?("jruby")
|
24
|
+
contents["max_concurrent_connections"] = user_defined_options["max_concurrent_connections"] || 20
|
25
|
+
contents["ruby_version"] = user_defined_options["ruby_version"] || "1.8"
|
26
|
+
|
27
|
+
@keys = contents.keys.sort
|
28
|
+
|
29
|
+
super(contents)
|
30
|
+
end
|
31
|
+
|
32
|
+
def jruby?
|
33
|
+
respond_to?(:jruby)
|
34
|
+
end
|
35
|
+
|
36
|
+
def jetty?
|
37
|
+
respond_to?(:jetty)
|
38
|
+
end
|
39
|
+
|
40
|
+
def jetty_pid_path
|
41
|
+
File.join(app_root, "/vendor/jetty/run/jetty.pid")
|
42
|
+
end
|
43
|
+
|
44
|
+
def inspect
|
45
|
+
self.class.name + ":\n" + @keys.map{|k|" #{k.ljust(20)} = #{send(k.to_sym)}"}.join("\n") + "\n"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/script/ci
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
bundler_version="1.0.18"
|
4
|
+
rspec_version="2.6.0"
|
5
|
+
|
6
|
+
source "$HOME/.rvm/scripts/rvm"
|
7
|
+
|
8
|
+
function install_ruby_if_needed() {
|
9
|
+
echo "Checking for $1..."
|
10
|
+
if ! rvm list rubies | grep $1 > /dev/null; then
|
11
|
+
rvm install $1
|
12
|
+
fi
|
13
|
+
}
|
14
|
+
function switch_ruby() {
|
15
|
+
install_ruby_if_needed $1 && rvm use $1
|
16
|
+
}
|
17
|
+
|
18
|
+
function install_bundler_if_needed() {
|
19
|
+
echo "Checking for Bundler $bundler_version..."
|
20
|
+
if ! gem list --installed bundler --version "$bundler_version" > /dev/null; then
|
21
|
+
gem install bundler --version "$bundler_version" --source http://mirrors.squareup.com/rubygems
|
22
|
+
fi
|
23
|
+
}
|
24
|
+
|
25
|
+
function install_rspec_if_needed() {
|
26
|
+
echo "Checking for rspec $rspec_version..."
|
27
|
+
if ! gem list --installed rspec --version "$rspec_version" > /dev/null; then
|
28
|
+
gem install rspec --version "$rspec_version" --source http://mirrors.squareup.com/rubygems
|
29
|
+
fi
|
30
|
+
}
|
31
|
+
|
32
|
+
function update_gems_if_needed() {
|
33
|
+
echo "Installing gems..."
|
34
|
+
bundle check || bundle install
|
35
|
+
}
|
36
|
+
|
37
|
+
function run_tests() {
|
38
|
+
bundle exec rake spec:setup
|
39
|
+
rspec spec/suite.rb # Cannot be bundle exec'd
|
40
|
+
}
|
41
|
+
|
42
|
+
function prepare_and_run() {
|
43
|
+
switch_ruby $1 &&
|
44
|
+
install_bundler_if_needed &&
|
45
|
+
install_rspec_if_needed &&
|
46
|
+
update_gems_if_needed &&
|
47
|
+
run_tests
|
48
|
+
}
|
49
|
+
|
50
|
+
function tag_green_build() {
|
51
|
+
tag_name="ci-preflight-master/latest"
|
52
|
+
git tag -f -m "tagging green build" "$tag_name"
|
53
|
+
git push -f origin "$tag_name"
|
54
|
+
}
|
55
|
+
|
56
|
+
prepare_and_run "1.9.3-p0" &&
|
57
|
+
tag_green_build
|
data/spec/basics_spec.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "tmpdir"
|
3
|
+
|
4
|
+
describe "preflight - basics" do
|
5
|
+
let(:project) { "spec/sample_projects/no_dependencies" }
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
reset
|
9
|
+
@result = x!("bin/preflight #{project}")
|
10
|
+
end
|
11
|
+
after(:all) do
|
12
|
+
reset
|
13
|
+
end
|
14
|
+
|
15
|
+
it "will put the jruby jar under vendor" do
|
16
|
+
@result[:stderr].should == ""
|
17
|
+
@result[:exitstatus].should == 0
|
18
|
+
File.exists?("#{project}/vendor/jruby.jar").should == true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "creates a rake script" do
|
22
|
+
@result[:stdout].should include("#{project}/bin/rake\n")
|
23
|
+
File.exists?("#{project}/bin/rake").should == true
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "creates a ruby script that" do
|
27
|
+
it "allows you to execute using the jruby jar." do
|
28
|
+
rake_result = x(%{#{project}/bin/ruby --version})
|
29
|
+
rake_result[:stderr].should == ""
|
30
|
+
rake_result[:stdout].should include("ruby")
|
31
|
+
rake_result[:exitstatus].should == 0
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'does not spawn a new PID' do
|
35
|
+
# This makes writing daemon wrappers around bin/ruby much easier.
|
36
|
+
Dir.mktmpdir do |dir|
|
37
|
+
tmpfile = File.join(dir, 'test_pid')
|
38
|
+
pid = Process.spawn("#{project}/bin/ruby -e 'puts Process.pid'", STDOUT=>tmpfile)
|
39
|
+
Process.wait(pid)
|
40
|
+
pid.should == File.read(tmpfile).chomp.to_i
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "makes a rake script that" do
|
46
|
+
it %{ - runs from any directory (properly cd's)
|
47
|
+
- the ruby used is indeed jruby
|
48
|
+
- allows you to execute several tasks in a row
|
49
|
+
- shows the trace of a rake failure
|
50
|
+
- nails the GEM_PATH to within the jar so we don't go 'accidentally' loading gems and such from another ruby env, the result of which is insanity.
|
51
|
+
|
52
|
+
Asserting all this in one test to optimize for test running time.} do
|
53
|
+
absolute_script_path = File.expand_path("#{project}/bin/rake project_info another_task load_path gem_path boom")
|
54
|
+
rake_result = x("cd /tmp && #{absolute_script_path} --trace")
|
55
|
+
|
56
|
+
rake_result[:stdout].should include("PWD=#{File.expand_path(project)}")
|
57
|
+
rake_result[:stdout].should include("DOLLAR_ZERO=#{File.expand_path("#{project}/bin/.rake_runner")}")
|
58
|
+
rake_result[:stdout].should include("Hi, I'm the no_dependencies project")
|
59
|
+
rake_result[:stdout].should include("RUBY_PLATFORM=java")
|
60
|
+
rake_result[:stdout].should include("jruby.jar!/META-INF")
|
61
|
+
rake_result[:stdout].should include("You ran another task")
|
62
|
+
|
63
|
+
rake_result[:stderr].should include("BOOM")
|
64
|
+
rake_result[:stderr].should include("xxx")
|
65
|
+
rake_result[:stderr].should include("yyy")
|
66
|
+
rake_result[:stderr].should include("zzz")
|
67
|
+
rake_result[:exitstatus].should == 1
|
68
|
+
|
69
|
+
load_path_elements = rake_result[:stdout].split("\n").select{|line|line =~ /^LP--/}
|
70
|
+
load_path_elements.length >= 3
|
71
|
+
load_path_elements.each do |element|
|
72
|
+
element = element.sub("LP-- ", "")
|
73
|
+
(element =~ /META-INF\/jruby\.home/ || element =~ /^\.$/).should >= 0
|
74
|
+
end
|
75
|
+
|
76
|
+
gem_path_elements = rake_result[:stdout].split("\n").select{|line|line =~ /^GP--/}
|
77
|
+
gem_path_elements.length >= 2
|
78
|
+
gem_path_elements.each do |element|
|
79
|
+
element = element.sub("GP-- ", "")
|
80
|
+
(element =~ /META-INF\/jruby\.home/ || element =~ /vendor\/bundler_gem/).should >= 0
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "preflight - bundler and gems" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
reset
|
7
|
+
rm_rf("spec/sample_projects/has_gems_via_bundler/vendor/bundle")
|
8
|
+
rm_rf("spec/sample_projects/has_gems_via_bundler/vendor/bundler_gem")
|
9
|
+
x!("bin/preflight spec/sample_projects/has_gems_via_bundler")
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:all) do
|
13
|
+
rm_rf("spec/sample_projects/has_gems_via_bundler/vendor/bundle")
|
14
|
+
rm_rf("spec/sample_projects/has_gems_via_bundler/vendor/bundler_gem")
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "presence of the library" do
|
18
|
+
it "installed bundler into vendor/bundler_gem." do
|
19
|
+
files = Dir["spec/sample_projects/has_gems_via_bundler/vendor/bundler_gem/**/*.rb"].to_a.map{|f|File.basename(f)}
|
20
|
+
files.should include("bundler.rb")
|
21
|
+
files.should include("dsl.rb")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "is not accidentally using bundler from another ruby environment." do
|
25
|
+
rake_result = x("spec/sample_projects/has_gems_via_bundler/bin/rake load_path_with_bundler")
|
26
|
+
load_path_elements = rake_result[:stdout].split("\n").select{|line|line =~ /^--/}
|
27
|
+
load_path_elements.length.should >= 3
|
28
|
+
invalid_load_path_elements =
|
29
|
+
load_path_elements.reject do |element|
|
30
|
+
element = element.sub("-- ", "")
|
31
|
+
(element =~ /META-INF\/jruby\.home/ || element =~ /vendor\/bundler_gem/ || element =~ /^\.$/ || element =~ /vendor\/bundle\//)
|
32
|
+
end
|
33
|
+
invalid_load_path_elements.should == []
|
34
|
+
end
|
35
|
+
|
36
|
+
it "can be used from a script fed to jruby." do
|
37
|
+
rake_result = x(%{spec/sample_projects/has_gems_via_bundler/bin/ruby -e 'require \\"rubygems\\"; require \\"bundler\\"; puts Bundler::VERSION'})
|
38
|
+
rake_result[:stderr].should == ""
|
39
|
+
rake_result[:stdout].should include("1.1.rc")
|
40
|
+
rake_result[:exitstatus].should == 0
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "gem installation" do
|
45
|
+
it "installs gems into vendor/bundle" do
|
46
|
+
files = Dir["spec/sample_projects/has_gems_via_bundler/vendor/bundle/**/*.rb"].to_a.map{|f|File.basename(f)}
|
47
|
+
files.should include("bijection.rb")
|
48
|
+
files.should include("spruz.rb")
|
49
|
+
files.length.should > 20
|
50
|
+
end
|
51
|
+
|
52
|
+
it "installed gems are available via normal require" do
|
53
|
+
rake_result = x("cd spec/sample_projects/has_gems_via_bundler && " +
|
54
|
+
%{bin/ruby -e 'require \\"rubygems\\"; require \\"bundler/setup\\"; require \\"spruz/bijection\\"; puts Spruz::Bijection.name'})
|
55
|
+
rake_result[:stderr].should == ""
|
56
|
+
rake_result[:stdout].should == "Spruz::Bijection\n"
|
57
|
+
rake_result[:exitstatus].should == 0
|
58
|
+
end
|
59
|
+
|
60
|
+
it "installed gems are available via Bundler.require" do
|
61
|
+
rake_result = x("cd spec/sample_projects/has_gems_via_bundler && " +
|
62
|
+
%{bin/ruby -e 'require \\"rubygems\\"; require \\"bundler\\"; Bundler.require; puts Spruz::Bijection.name'})
|
63
|
+
rake_result[:stderr].should == ""
|
64
|
+
rake_result[:stdout].should == "Spruz::Bijection\n"
|
65
|
+
rake_result[:exitstatus].should == 0
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "bin/rake" do
|
70
|
+
it "uses rake version specified in Gemfile" do
|
71
|
+
rake_result = x("spec/sample_projects/has_gems_via_bundler/bin/rake rake_version")
|
72
|
+
rake_result[:stdout].lines.to_a.last.chomp.should == "0.9.2.2"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "Gemfile.lock that does not contain PLATFORM=java" do
|
77
|
+
before do
|
78
|
+
File.open("spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile.lock", "w") do |f|
|
79
|
+
f << %{GEM
|
80
|
+
remote: http://rubygems.org/
|
81
|
+
specs:
|
82
|
+
rake (0.9.2.2)
|
83
|
+
spruz (0.2.13)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
rake (~> 0.9.2)
|
90
|
+
spruz
|
91
|
+
}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
after do
|
96
|
+
FileUtils.rm_f("spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile.lock")
|
97
|
+
end
|
98
|
+
|
99
|
+
it "regenerates the Gemfile.lock and prints out a warning message" do
|
100
|
+
File.read("spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile.lock").should_not include("java")
|
101
|
+
preflight_result = x("bin/preflight spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock")
|
102
|
+
preflight_result[:stderr].gsub("\n", "").squeeze(" ").should include(%{
|
103
|
+
WARNING: Your Gemfile.lock does not contain PLATFORM java.
|
104
|
+
Automtically regenerating and overwriting Gemfile.lock using jruby
|
105
|
+
- because otherwise, jruby-specific gems would not be installed by bundler.
|
106
|
+
To make this message go away, you must re-generate your Gemfile.lock using jruby.
|
107
|
+
}.gsub("\n", "").squeeze(" "))
|
108
|
+
preflight_result[:exitstatus].should == 0
|
109
|
+
|
110
|
+
File.read("spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock/Gemfile.lock").should include("java")
|
111
|
+
|
112
|
+
rake_result = x("cd spec/sample_projects/has_gems_via_bundler_bad_gemfile_lock && " +
|
113
|
+
%{bin/ruby -e 'require \\"rubygems\\"; require \\"bundler\\"; Bundler.require; puts Spruz::Bijection.name'})
|
114
|
+
rake_result[:stderr].should == ""
|
115
|
+
rake_result[:stdout].should == "Spruz::Bijection\n"
|
116
|
+
rake_result[:exitstatus].should == 0
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "preflight - bundler and gems in 1.9 mode" do
|
4
|
+
let(:project) { 'has_gems_via_bundler_19' }
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
reset
|
8
|
+
rm_rf("spec/sample_projects/#{project}/vendor/bundle")
|
9
|
+
rm_rf("spec/sample_projects/#{project}/vendor/bundler_gem")
|
10
|
+
x!("bin/preflight spec/sample_projects/#{project}")
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:all) do
|
14
|
+
rm_rf("spec/sample_projects/#{project}/vendor/bundle")
|
15
|
+
rm_rf("spec/sample_projects/#{project}/vendor/bundler_gem")
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "gem installation" do
|
19
|
+
it "installed gems are available via Bundler.require" do
|
20
|
+
rake_result = x("cd spec/sample_projects/#{project} && " +
|
21
|
+
%{bin/ruby -e 'require \\"rubygems\\"; require \\"bundler\\"; Bundler.require; puts Spruz::Bijection.name'})
|
22
|
+
rake_result[:stderr].should == ""
|
23
|
+
rake_result[:stdout].should == "Spruz::Bijection\n"
|
24
|
+
rake_result[:exitstatus].should == 0
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "bin/rake" do
|
29
|
+
it "uses rake version specified in Gemfile" do
|
30
|
+
rake_result = x("spec/sample_projects/#{project}/bin/rake rake_version")
|
31
|
+
rake_result[:stdout].lines.to_a.last.chomp.should == "0.9.2.2"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
task :load_path do
|
2
|
+
puts $LOAD_PATH.join("\n")
|
3
|
+
end
|
4
|
+
|
5
|
+
task :load_path_with_rubygems do
|
6
|
+
require "rubygems"
|
7
|
+
puts $LOAD_PATH.join("\n")
|
8
|
+
end
|
9
|
+
|
10
|
+
task :load_path_with_bundler do
|
11
|
+
require "rubygems"
|
12
|
+
require "bundler"
|
13
|
+
$LOAD_PATH.each{|path|puts "-- #{path}"}
|
14
|
+
end
|
15
|
+
|
16
|
+
task :rake_version do
|
17
|
+
puts RAKEVERSION
|
18
|
+
end
|