Latest test results:
Doubleshot is for Developers using JRuby.
It let’s you write Java and Ruby, perform Continuous Testing (meaning whenever a file changes, both Java and Ruby code is sandboxed and reloaded and the appropriate tests run), and package it all up as a Gem or JAR.
It’s a substitute for writing your own Maven tasks, declaring Maven Dependencies, having Ruby dependencies managed by Bundler, and a Rakefile for packaging everything up as a Gem.
Before Doubleshot you might have a Buildfile
(using Buildr), Jarfile
and Gemfile
. Or a pom.xml
, Gemfile
and Rakefile
. However you slice it, you’d be using multiple tools, with different syntaxes and styles, that required you to run them in a specific order to actually get your project to run.
Doubleshot simplifies all that. You have one Doubleshot file that defines your Gem dependencies, your JAR dependencies, and declares how to either test or package it all up as a Gem or a JAR. Once you have a Doubleshot file (take a look at the examples folder for some basics), then you have a few simple commands you can run to do what you need. Here’s the output of doubleshot help
:
Usage: doubleshot COMMAND [ OPTIONS ]
Summary: Command line tool for creating and managing doubleshot projects.
doubleshot init # Generate a Doubleshot file for your project.
doubleshot test # A test harness that watches files, builds your # source, and executes tests based on filename # conventions. The location of your tests is # determined by the 'config.source.tests' # attribute of your Doubleshot configuration.
doubleshot build # Download all dependencies and compile sources so that you # can use the project directly without installation, such # as with IRB. # # NOTE: Packaging and testing have a dependency on this # command. You don't need to build as a prerequisite.
doubleshot gem # Package your project as a Rubygem, bundling any # JAR dependencies and Java classes in with the distribution.
doubleshot jar # Package your project as a JAR.
doubleshot install # Install your project as a Rubygem.
doubleshot pom # Generate a pom.xml based on your Doubleshot file.
To get a descriptive Doubleshot
that comments all the options, just run doubleshot init
in your project. It’ll read existing myproject.gemspec
and pom.xml
files, and use them to generate a Doubleshot file. Take a look at the Doubleshot.example
file in this project if you just want to read up now.
Pro-Tip: Similarly to a Gem::Specification
, a Doubleshot::Configuration
provides a #to_ruby
method, so that example was generated in IRB from the actual project configuration (the existing Doubleshot
file in the project) like this:
require "lib/doubleshot"
Pathname("Doubleshot.example").open("w+") do |example|
example << Doubleshot::current.config.to_ruby
end
Here’s how to get Doubleshot running locally yourself. You’ll need Java, Maven and JRuby (1.7.x or -head) installed. Then, clone the repo:
git clone git://github.com/sam/doubleshot.git
Doubleshot bootstraps it’s own build using a slightly different process than used for projects actually using it. It’s a chicken and egg situation. Since Doubleshot depends on some Java code to resolve JAR dependencies, and we can’t compile without our dependencies, we can’t use Doubleshot’s normal code to resolve it’s own JAR dependencies. That’s why Doubleshot has a pom.xml
(generated with the doubleshot pom
command). We shell out to the Maven command line while bootstrapping the build.
All that just to clarify the process. The only thing left you actually need to do at this point is run one of the doubleshot
commands to package or test. The internal bootstrapping will take care of the rest:
bin/doubleshot test --ci
Happy coding!