jettywrapper 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.gitmodules +0 -3
- data/.rspec +1 -0
- data/.travis.yml +16 -0
- data/CONTRIBUTING.md +113 -0
- data/Gemfile +5 -1
- data/History.txt +25 -0
- data/LICENSE +1086 -0
- data/README.textile +30 -60
- data/Rakefile +14 -10
- data/config/jetty.yml +5 -4
- data/gemfiles/rails4.1.gemfile +10 -0
- data/gemfiles/rails4.2.beta.gemfile +10 -0
- data/jettywrapper.gemspec +8 -15
- data/lib/jettywrapper/version.rb +3 -1
- data/lib/jettywrapper.rb +344 -217
- data/lib/tasks/jettywrapper.rake +17 -1
- data/spec/lib/jettywrapper_integration_spec.rb +49 -26
- data/spec/lib/jettywrapper_spec.rb +332 -78
- data/spec/spec_helper.rb +19 -5
- metadata +116 -178
- data/.rvmrc +0 -1
data/README.textile
CHANGED
|
@@ -1,64 +1,42 @@
|
|
|
1
1
|
h1. jettywrapper
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
bc..
|
|
8
|
-
require 'jettywrapper'
|
|
9
|
-
desc "Hudson build"
|
|
10
|
-
task :hudson do
|
|
11
|
-
if (ENV['RAILS_ENV'] == "test")
|
|
12
|
-
jetty_params = {
|
|
13
|
-
:jetty_home => File.expand_path(File.dirname(__FILE__) + '/../../jetty'),
|
|
14
|
-
:quiet => false,
|
|
15
|
-
:jetty_port => 8983,
|
|
16
|
-
:solr_home => File.expand_path(File.dirname(__FILE__) + '/../../jetty/solr/test-core'),
|
|
17
|
-
:fedora_home => File.expand_path(File.dirname(__FILE__) + '/../../jetty/fedora/default'),
|
|
18
|
-
:startup_wait => 30
|
|
19
|
-
}
|
|
20
|
-
Rake::Task["db:drop"].invoke
|
|
21
|
-
Rake::Task["db:migrate"].invoke
|
|
22
|
-
Rake::Task["db:migrate:plugins"].invoke
|
|
23
|
-
error = Jettywrapper.wrap(jetty_params) do
|
|
24
|
-
Rake::Task["libra_oa:default_fixtures:refresh"].invoke
|
|
25
|
-
Rake::Task["hydra:fixtures:refresh"].invoke
|
|
26
|
-
Rake::Task["spec"].invoke
|
|
27
|
-
Rake::Task["cucumber"].invoke
|
|
28
|
-
end
|
|
29
|
-
raise "test failures: #{error}" if error
|
|
30
|
-
else
|
|
31
|
-
system("rake hudson RAILS_ENV=test")
|
|
32
|
-
fail unless $?.success?
|
|
33
|
-
end
|
|
34
|
-
end
|
|
3
|
+
!https://travis-ci.org/projecthydra/jettywrapper.png?branch=master!:https://travis-ci.org/projecthydra/jettywrapper
|
|
4
|
+
|
|
5
|
+
This gem is designed to make it easier to integrate a jetty servlet container into a rails project.
|
|
6
|
+
Jettywrapper provides rake tasks for starting and stopping jetty, as well as a method (Jettywrapper.wrap) that will start the server before the block and stop the server after the block, which is useful for automated testing.
|
|
35
7
|
|
|
36
|
-
|
|
8
|
+
jettywrapper supports
|
|
9
|
+
ruby 2.0.0
|
|
10
|
+
ruby 1.9.3
|
|
11
|
+
ruby 1.8.7
|
|
12
|
+
ree 1.8.7
|
|
13
|
+
jruby 1.6.6+
|
|
37
14
|
|
|
38
|
-
|
|
39
|
-
If you use system(), the return value will be false for any exit codes other than 0. If you use backticks or %x(), you must use $? to check the exit status code
|
|
40
|
-
after the call. Failure to do so could result in false successes.
|
|
15
|
+
h2. Configuring Jettywrapper
|
|
41
16
|
|
|
42
|
-
|
|
17
|
+
Jettywrapper starts the process with a list of options that you can specify in config/jetty.yml (otherwise a default is used). You can provide a per environment configuration, or you can have a default configuration which will be used when a per-environment configuration is not specified.
|
|
18
|
+
|
|
19
|
+
<pre>default:
|
|
20
|
+
jetty_port: 8983
|
|
21
|
+
java_opts:
|
|
22
|
+
- "-XX:MaxPermSize=128m"
|
|
23
|
+
- "-Xmx256m"
|
|
24
|
+
</pre>
|
|
43
25
|
|
|
44
|
-
bc..
|
|
45
|
-
#retval should return false for non-zero exit codes
|
|
46
|
-
retval = system("rake hudson RAILS_ENV=test")
|
|
47
|
-
fail unless retval
|
|
48
26
|
|
|
49
|
-
h3. Example 2: Checking $? with system()
|
|
50
27
|
|
|
51
|
-
|
|
52
|
-
system("rake hudson RAILS_ENV=test")
|
|
53
|
-
raise "rake hudson encoutered errors" unless $?.success?
|
|
28
|
+
h2. Example rake task:
|
|
54
29
|
|
|
55
|
-
|
|
30
|
+
bc.. require 'jettywrapper'
|
|
31
|
+
desc "Hudson build"
|
|
32
|
+
task :hudson do
|
|
33
|
+
jetty_params = Jettywrapper.load_config.merge({:jetty_home => File.expand_path(File.dirname(__FILE__) + '/../jetty')})
|
|
34
|
+
error = Jettywrapper.wrap(jetty_params) do
|
|
35
|
+
Rake::Task["spec"].invoke
|
|
36
|
+
end
|
|
37
|
+
raise "test failures: #{error}" if error
|
|
38
|
+
end
|
|
56
39
|
|
|
57
|
-
bc..
|
|
58
|
-
# %x[] or `` will return everything sent to stdout from the command
|
|
59
|
-
puts %x[cucumber --tags ~@pending --tags ~@overwritten features]
|
|
60
|
-
raise "Cucumber failed." unless $?.success?
|
|
61
|
-
|
|
62
40
|
h2. Testing the gem
|
|
63
41
|
|
|
64
42
|
If you haven't already, clone the git repository
|
|
@@ -68,19 +46,11 @@ If you haven't already, clone the git repository
|
|
|
68
46
|
cd jettywrapper
|
|
69
47
|
</pre>
|
|
70
48
|
|
|
71
|
-
If you're using RVM (recommended), use the .rvmrc
|
|
72
|
-
|
|
73
|
-
<pre>
|
|
74
|
-
source .rvmrc
|
|
75
|
-
rvm list gemsets
|
|
76
|
-
</pre>
|
|
77
49
|
|
|
78
|
-
Install the gems
|
|
50
|
+
Install the gems
|
|
79
51
|
|
|
80
52
|
<pre>
|
|
81
53
|
bundle install
|
|
82
|
-
git submodule init
|
|
83
|
-
git submodule update
|
|
84
54
|
</pre>
|
|
85
55
|
|
|
86
56
|
Run the tests
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'rake'
|
|
2
2
|
require 'bundler'
|
|
3
|
-
require '
|
|
3
|
+
require 'rspec/core/rake_task'
|
|
4
4
|
require 'yard'
|
|
5
5
|
|
|
6
6
|
Bundler::GemHelper.install_tasks
|
|
@@ -15,16 +15,19 @@ rescue Bundler::BundlerError => e
|
|
|
15
15
|
exit e.status_code
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
spec.libs << 'lib' << 'spec'
|
|
20
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
18
|
+
RSpec::Core::RakeTask.new(:spec => 'jetty:clean') do |spec|
|
|
19
|
+
# spec.libs << 'lib' << 'spec'
|
|
20
|
+
# spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
RSpec::Core::RakeTask.new(:coverage) do |spec|
|
|
24
|
+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
25
|
+
ENV['COVERAGE'] = 'true' unless ruby_engine == 'jruby'
|
|
26
|
+
|
|
27
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
|
|
28
|
+
spec.rcov = true
|
|
29
|
+
spec.rcov_opts = %w{--exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data}
|
|
30
|
+
end
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
task :clean do
|
|
@@ -51,4 +54,5 @@ rescue LoadError
|
|
|
51
54
|
end
|
|
52
55
|
end
|
|
53
56
|
|
|
54
|
-
task :default => [:
|
|
57
|
+
#task :default => [:coverage, :doc]
|
|
58
|
+
task :default => [:spec]
|
data/config/jetty.yml
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
default:
|
|
2
|
+
jetty_port: 8983
|
|
3
|
+
java_opts:
|
|
4
|
+
- "-XX:MaxPermSize=256m"
|
|
5
|
+
- "-Xmx256m"
|
data/jettywrapper.gemspec
CHANGED
|
@@ -5,38 +5,31 @@ require 'bundler'
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "jettywrapper"
|
|
8
|
-
s.version =
|
|
8
|
+
s.version = Jettywrapper::VERSION
|
|
9
9
|
s.platform = Gem::Platform::RUBY
|
|
10
|
-
s.authors = ["Bess Sadler"]
|
|
11
|
-
s.email = ["
|
|
10
|
+
s.authors = ["Chris Beer", "Justin Coyne", "Bess Sadler"]
|
|
11
|
+
s.email = ["hydra-tech@googlegroups.com"]
|
|
12
12
|
s.homepage = "https://github.com/projecthydra/jettywrapper"
|
|
13
13
|
s.summary = %q{Convenience tasks for working with jetty from within a ruby project.}
|
|
14
14
|
s.description = %q{Spin up a jetty instance (e.g., the one at https://github.com/projecthydra/hydra-jetty) and wrap test in it. This lets us run tests against a real copy of solr and fedora.}
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
|
16
16
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
17
|
-
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
18
17
|
s.require_paths = ["lib"]
|
|
18
|
+
s.license = 'APACHE2'
|
|
19
19
|
|
|
20
20
|
s.required_rubygems_version = ">= 1.3.6"
|
|
21
21
|
|
|
22
22
|
s.add_dependency "logger"
|
|
23
|
-
s.add_dependency "mediashelf-loggable"
|
|
24
23
|
s.add_dependency "childprocess"
|
|
25
24
|
s.add_dependency "i18n"
|
|
26
25
|
s.add_dependency "activesupport", ">=3.0.0"
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
s.add_development_dependency
|
|
31
|
-
s.add_development_dependency "rspec", "< 2.0" # We're not ready to upgrade to rspec 2
|
|
32
|
-
s.add_development_dependency 'mocha'
|
|
33
|
-
s.add_development_dependency 'rcov'
|
|
27
|
+
s.add_development_dependency "rspec", '~> 2.99'
|
|
28
|
+
s.add_development_dependency "rspec-its"
|
|
29
|
+
s.add_development_dependency 'rake'
|
|
34
30
|
|
|
35
|
-
s.add_development_dependency 'yard'
|
|
31
|
+
s.add_development_dependency 'yard'#, '0.6.5' # Yard > 0.6.5 won't generate docs.
|
|
36
32
|
# I don't know why & don't have time to
|
|
37
33
|
# debug it right now
|
|
38
|
-
|
|
39
|
-
s.add_development_dependency 'RedCloth'
|
|
40
|
-
|
|
41
34
|
end
|
|
42
35
|
|
data/lib/jettywrapper/version.rb
CHANGED