Skip to content

Instantly share code, notes, and snippets.

@enebo
Created October 22, 2009 15:45
Show Gist options
  • Save enebo/216027 to your computer and use it in GitHub Desktop.
Save enebo/216027 to your computer and use it in GitHub Desktop.
package my.example;
import java.util.Arrays;
import java.util.List;
import org.jruby.embed.AttributeName;
import org.jruby.embed.PathType;
import org.jruby.embed.ScriptingContainer;
public class Main {
public static void main(String[] args) {
ScriptingContainer container = new ScriptingContainer();
container.getProvider().setLoadPaths(Arrays.asList("lib"));
container.setAttribute(AttributeName.BASE_DIR, System.getProperty("user.dir"));
container.runScriptlet(PathType.RELATIVE, "load_git.rb");
//...
List<GitDiff> list = (List<GitDiff>) container.runScriptlet("last_patch");
for (GitDiff diff : list) {
System.out.println("PATH: " + diff.getPath());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment