samvera-deprecated / jettywrapper

Convenience tasks and classes for automated testing of hydra heads.
Apache License 2.0
7 stars 19 forks source link

Requires jettywrapper in rake file: easier to use Jettywrapper outside of hydra #52

Closed reggieb closed 8 years ago

reggieb commented 8 years ago

With this small change it is possible to load Jettywrapper's rake tasks into another environment, via a Rakefile with this content:

spec = Gem::Specification.find_by_name 'jettywrapper'
load File.expand_path 'lib/tasks/jettywrapper.rake', spec.gem_dir

It is then possible to pull down and build a standalone Jetty instance (with solr and fedora) by running these commands within ruby:

require 'jettywrapper'
Jettywrapper.unzip

And then be able to start and stop the Jetty instance with rake jetty:start and rake jetty:stop

jcoyne commented 8 years ago

I don't understand why this is needed. Currently you just need to put gem 'jettywrapper' in your gemfile and then you can do:

$ rake -T jetty
rake jetty:clean        # remove the jetty directory and recreate it
rake jetty:download     # download the jetty zip file
rake jetty:environment  # Load the jetty config
rake jetty:restart      # Restarts jetty
rake jetty:start        # Start jetty
rake jetty:status       # Return the status of jetty
rake jetty:stop         # stop jetty
rake jetty:unzip        # unzip the downloaded jetty archive
reggieb commented 8 years ago

I think you'll find that only works within a rails environment.

Have a look at this: https://github.com/reggieb/jettywrapper_play

Currently that won't work with jettywrapper. Adding the additional require statement in the rake file allows it to work.

reggieb commented 8 years ago

Actually, looking at this again, there is a simpler way to do this - adding:

require 'jettywrapper`

To the Rakefile has the same effect. In fact, playing further - just that command alone in a Rakefile, load the tasks into the environment.