Load hirb

This commit is contained in:
Rajat Venkatesh 2016-01-31 13:45:45 +05:30
parent 49b5b27777
commit b4ad18ddf1

View file

@ -24,6 +24,8 @@ import org.slf4j.LoggerFactory;
import org.jruby.embed.ScriptingContainer;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.io.StringWriter;
@ -94,6 +96,15 @@ public class HbaseInterpreter extends Interpreter {
List<String> paths = new ArrayList<>(Arrays.asList(abs_ruby_src.toAbsolutePath().toString()));
this.scriptingContainer.setLoadPaths(paths);
Path abs_hirb_path = Paths.get(hbase_home, ruby_src, "irb/hirb.rb");
try {
FileInputStream fis = new FileInputStream(abs_hirb_path.toFile());
this.scriptingContainer.runScriptlet(fis, "hirb.rb");
fis.close();
} catch (IOException e) {
throw new InterpreterException(e.getCause());
}
}
}