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.
data/README.textile CHANGED
@@ -1,64 +1,42 @@
1
1
  h1. jettywrapper
2
2
 
3
- This gem is designed to make it easier to run automated tests against jetty. Solr comes bundled in a jetty instance, and the hydra project has taken a similar approach with hydra-jetty, an instance of jetty pre-configured to load fedora, solr, and various other java servlets of use to the hydra project.
4
-
5
- h2. Instructions for the impatient:
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
- h2. Important note on creating nested rake tasks:
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
- When creating your rake tasks, keep in mind that rake does not by default propogate up errors raised from system commands.
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
- h3. Example 1: Checking return value from system()
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
- bc..
52
- system("rake hudson RAILS_ENV=test")
53
- raise "rake hudson encoutered errors" unless $?.success?
28
+ h2. Example rake task:
54
29
 
55
- h3. Example 3: An alternative method: using %x[] or backticks with $?
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 and pull the submodules
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 'spec/rake/spectask'
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
- Spec::Rake::SpecTask.new(:spec) do |spec|
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
- Spec::Rake::SpecTask.new(:rcov) do |spec|
24
- spec.libs << 'lib' << 'spec'
25
- spec.pattern = 'spec/**/*_spec.rb'
26
- spec.rcov = true
27
- spec.rcov_opts = %w{--exclude spec\/*,gems\/*,ruby\/* --aggregate coverage.data}
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 => [:rcov, :doc]
57
+ #task :default => [:coverage, :doc]
58
+ task :default => [:spec]
data/config/jetty.yml CHANGED
@@ -1,4 +1,5 @@
1
- jetty_port: 8983
2
- java_opts:
3
- - "-Xmx128mb"
4
-
1
+ default:
2
+ jetty_port: 8983
3
+ java_opts:
4
+ - "-XX:MaxPermSize=256m"
5
+ - "-Xmx256m"
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ file = File.expand_path("../../Gemfile", __FILE__)
4
+
5
+ if File.exists?(file)
6
+ puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
7
+ instance_eval File.read(file)
8
+ end
9
+
10
+ gem 'activesupport', '~> 4.1.1'
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ file = File.expand_path("../../Gemfile", __FILE__)
4
+
5
+ if File.exists?(file)
6
+ puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
7
+ instance_eval File.read(file)
8
+ end
9
+
10
+ gem 'activesupport', '~> 4.2.0.beta2'
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 = GEMVERSION
8
+ s.version = Jettywrapper::VERSION
9
9
  s.platform = Gem::Platform::RUBY
10
- s.authors = ["Bess Sadler"]
11
- s.email = ["bess@stanford.edu"]
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
- # Bundler will install these gems too if you've checked this out from source from git and run 'bundle install'
29
- # It will not add these as dependencies if you require lyber-core for other projects
30
- s.add_development_dependency "ruby-debug"
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', '0.6.5' # Yard > 0.6.5 won't generate docs.
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
 
@@ -1 +1,3 @@
1
- GEMVERSION = "1.0.0"
1
+ class Jettywrapper
2
+ VERSION = "2.0.0"
3
+ end