Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
update to Jruby 9.2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
slawo-ch committed Dec 20, 2018
1 parent dd070c1 commit f4f2c70
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 29 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ruby scripting for [pentaho-kettle](https://github.com/pentaho/pentaho-kettle)

[![Kettle 5.x](https://img.shields.io/badge/pentaho_kettle-5.x--7.x-4c7e9f.svg)](https://github.com/pentaho/pentaho-kettle)
[![Kettle 5.x](https://img.shields.io/badge/pentaho_kettle-5.x--8.x-4c7e9f.svg)](https://github.com/pentaho/pentaho-kettle)
[![Java 7+](https://img.shields.io/badge/java-7+-4c7e9f.svg)](http://java.oracle.com)
[![License](https://img.shields.io/badge/license-LGPL2.1-4c7e9f.svg)](https://raw.githubusercontent.com/twineworks/ruby-for-pentaho-kettle/master/LICENSE.txt)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.twineworks/ruby-for-pentaho-kettle/badge.svg)](http://search.maven.org/#search|gav|1|g:"com.twineworks"%20AND%20a:"ruby-for-pentaho-kettle")
Expand All @@ -12,7 +12,8 @@ An plugin for Pentaho kettle (PDI) allowing to include ruby scripts as transform
The elegance of the ruby language is paired with ultimate row processing flexibility. The step allows scripts to read, write, aggregate, consume and redirect rows to accomplish the most complex of data processing tasks in one place. This plugin provides a scripting step similar to the javascript and java class steps. The implementation is based on [JRuby](http://jruby.org). Thanks to JRuby's great Java interop, the scripting step also enables easy Java scripting in kettle.

## Supported versions of pentaho-kettle
The plugin is built and [tested](https://travis-ci.org/twineworks/ruby-for-pentaho-kettle) against the most recent versions of Kettle 5.x, 6.x and 7.x.
The plugin is built and [tested](https://travis-ci.org/twineworks/ruby-for-pentaho-kettle) against the most recent versions of Kettle 5.x, 6.x, 7.x.
It works with Kettle 8.x as well.

## How to get it?
Grab the latest release from the [releases](https://github.com/twineworks/ruby-for-pentaho-kettle/releases) page.
Expand Down
38 changes: 34 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,29 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!--
Making a release:
- ensure pom.xml contains SNAPSHOT version
- ensure the snapshot release is successful
$ mvn clean deploy
- ensure pom.xml contains release version
- commit pom
- deploy release version
$ mvn clean deploy -P release
- tag release version
- ensure pom.xml contains next SNAPSHOT version
- commit
- push to github
- upload zip as github release
Details on release process to sonatype:
https://central.sonatype.org/pages/apache-maven.html
-->

<groupId>com.twineworks</groupId>
<artifactId>ruby-for-pentaho-kettle</artifactId>
<version>1.3.5-SNAPSHOT</version>
<version>1.3.5</version>

<organization>
<name>Twineworks GmbH</name>
Expand Down Expand Up @@ -62,9 +82,19 @@
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<pentaho.kettle.version>5.4.1.8-209</pentaho.kettle.version>
<!--<pentaho.kettle.version>5.4.1.8-209</pentaho.kettle.version>-->
<!--<pentaho.kettle.version>6.1.0.9-307</pentaho.kettle.version>-->
<!--<pentaho.kettle.version>7.1.0.4-63</pentaho.kettle.version>-->
<pentaho.kettle.version>7.1.0.4-63</pentaho.kettle.version>
<!--
Starting with 8.x Pentaho has split basic core steps into
plugins. Integration testing would involve finding the mvn
dependencies of all core steps, reassembling them, and changing
the test helper to ensure all core plugins are found and
initialized before running tests.
This seems too fragile and different from 5.x-7.x to support,
so the plugin is not CI tested against 8.x.
-->
<!--<pentaho.kettle.version>8.2.0.0-342</pentaho.kettle.version>-->
<skipTests>true</skipTests>
</properties>

Expand Down Expand Up @@ -254,7 +284,7 @@
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>9.1.13.0</version>
<version>9.2.5.0</version>
</dependency>

<!-- kettle interface libs -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.jcodings.Encoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.Ruby;
import org.jruby.common.NullWarnings;
import org.jruby.lexer.ByteListLexerSource;
Expand All @@ -36,8 +36,8 @@
import org.jruby.lexer.yacc.SyntaxException;
import org.jruby.parser.ParserConfiguration;
import org.jruby.parser.ParserSupport;
import org.jruby.parser.RubyParser;
import org.jruby.parser.RubyParserResult;
import org.jruby.parser.Tokens;
import org.jruby.util.ByteList;
import org.pentaho.di.ui.core.widget.StyledTextComp;

Expand Down Expand Up @@ -129,41 +129,41 @@ public class RubyStepSyntaxHighlighter {
private StyleRange tokenToStyleRange(int token, Object value, int previousToken) {

// determine keyword style up front
if (token >= Tokens.kCLASS && token <= Tokens.kDO_LAMBDA) {
if (token >= RubyParser.keyword_class && token <= RubyParser.keyword_do_lambda) {
return styles[STYLE_KEYWORD];
}

switch (token) {
case TOKEN_COMMENT:
return styles[STYLE_COMMENT];

case Tokens.tINTEGER:
case Tokens.tFLOAT:
case Tokens.tRATIONAL:
case RubyParser.tINTEGER:
case RubyParser.tFLOAT:
case RubyParser.tRATIONAL:
return styles[STYLE_NUMBER];
case Tokens.tSTRING_BEG:
case Tokens.tSTRING_CONTENT:
case Tokens.tSTRING_END:
case Tokens.tSTRING_DBEG:
case Tokens.tSTRING_DVAR:
case RubyParser.tSTRING_BEG:
case RubyParser.tSTRING_CONTENT:
case RubyParser.tSTRING_END:
case RubyParser.tSTRING_DBEG:
case RubyParser.tSTRING_DVAR:
return styles[STYLE_STRING];
case Tokens.tCONSTANT:
case RubyParser.tCONSTANT:
return styles[STYLE_CONSTANT];
case Tokens.tGVAR:
case Tokens.tIVAR:
case RubyParser.tGVAR:
case RubyParser.tIVAR:
return styles[STYLE_VARIABLE];
case Tokens.tREGEXP_BEG:
case Tokens.tREGEXP_END:
case Tokens.tPIPE:
case RubyParser.tREGEXP_BEG:
case RubyParser.tREGEXP_END:
case RubyParser.tPIPE:
return styles[STYLE_LITERAL_BOUNDARY];
case Tokens.tSYMBEG:
case RubyParser.tSYMBEG:
return styles[STYLE_SYMBOL];
case Tokens.tIDENTIFIER:
if (previousToken == Tokens.tSYMBEG) {
case RubyParser.tIDENTIFIER:
if (previousToken == RubyParser.tSYMBEG) {
return styles[STYLE_SYMBOL];
}
// fall through
case Tokens.tFID:
case RubyParser.tFID:

if (value != null && PSEUDO_KEYWORDS_SET.contains(value.toString())) {
return styles[STYLE_KEYWORD];
Expand Down Expand Up @@ -222,7 +222,7 @@ private int charOffset(int byteOffset) {

private void initLexer(String title) {
LexerSource lexerSource = new ByteListLexerSource(title, 0, new ByteList(utf8Bytes), null);
lexerSource.setEncoding(Encoding.load("UTF8"));
lexerSource.setEncoding(UTF8Encoding.INSTANCE);

ParserSupport parserSupport = new ParserSupport();
lexer = new RubyLexer(parserSupport, lexerSource, new NullWarnings(Ruby.getGlobalRuntime()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
<scripts>
<script>
<title>Ruby Script</title>
<body>&#xa;&#x23; test for converted types to be present&#xa;raise &#x22;key should have class Fixnum&#x22; unless &#x24;row&#x5b;&#x22;key&#x22;&#x5d;.class &#x3d;&#x3d; Fixnum &#xa;raise &#x22;str should have class String&#x22; unless &#x24;row&#x5b;&#x22;str&#x22;&#x5d;.class &#x3d;&#x3d; String&#xa;raise &#x22;int should have class Fixnum&#x22; unless &#x24;row&#x5b;&#x22;int&#x22;&#x5d;.class &#x3d;&#x3d; Fixnum&#xa;raise &#x22;num should have class Float&#x22; unless &#x24;row&#x5b;&#x22;num&#x22;&#x5d;.class &#x3d;&#x3d; Float&#xa;raise &#x22;bignum should have class BigDecimal&#x22; unless &#x24;row&#x5b;&#x22;bignum&#x22;&#x5d;.class &#x3d;&#x3d; BigDecimal&#xa;raise &#x22;bool should have class TrueClass&#x22; unless &#x24;row&#x5b;&#x22;bool&#x22;&#x5d;.class &#x3d;&#x3d; TrueClass&#xa;raise &#x22;date should have class Time&#x22; unless &#x24;row&#x5b;&#x22;date&#x22;&#x5d;.class &#x3d;&#x3d; Time&#xa;raise &#x22;inet should have class IPAddr&#x22; unless &#x24;row&#x5b;&#x22;inet&#x22;&#x5d;.class &#x3d;&#x3d; IPAddr&#xa;raise &#x22;bin should have class Array&#x22; unless &#x24;row&#x5b;&#x22;bin&#x22;&#x5d;.class &#x3d;&#x3d; Array&#xa;raise &#x22;ts should have class Time&#x22; unless &#x24;row&#x5b;&#x22;ts&#x22;&#x5d;.class &#x3d;&#x3d; Time&#xa;&#xa;&#x23; pass through everything unchanged&#xa;&#x24;row</body>
<body>&#xa;&#x23; test for converted types to be present&#xa;raise &#x22;key should have class Integer&#x22; unless &#x24;row&#x5b;&#x22;key&#x22;&#x5d;.class &#x3d;&#x3d; Integer &#xa;raise &#x22;str should have class String&#x22; unless &#x24;row&#x5b;&#x22;str&#x22;&#x5d;.class &#x3d;&#x3d; String&#xa;raise &#x22;int should have class Integer&#x22; unless &#x24;row&#x5b;&#x22;int&#x22;&#x5d;.class &#x3d;&#x3d; Integer&#xa;raise &#x22;num should have class Float&#x22; unless &#x24;row&#x5b;&#x22;num&#x22;&#x5d;.class &#x3d;&#x3d; Float&#xa;raise &#x22;bignum should have class BigDecimal&#x22; unless &#x24;row&#x5b;&#x22;bignum&#x22;&#x5d;.class &#x3d;&#x3d; BigDecimal&#xa;raise &#x22;bool should have class TrueClass&#x22; unless &#x24;row&#x5b;&#x22;bool&#x22;&#x5d;.class &#x3d;&#x3d; TrueClass&#xa;raise &#x22;date should have class Time&#x22; unless &#x24;row&#x5b;&#x22;date&#x22;&#x5d;.class &#x3d;&#x3d; Time&#xa;raise &#x22;inet should have class IPAddr&#x22; unless &#x24;row&#x5b;&#x22;inet&#x22;&#x5d;.class &#x3d;&#x3d; IPAddr&#xa;raise &#x22;bin should have class Array&#x22; unless &#x24;row&#x5b;&#x22;bin&#x22;&#x5d;.class &#x3d;&#x3d; Array&#xa;raise &#x22;ts should have class Time&#x22; unless &#x24;row&#x5b;&#x22;ts&#x22;&#x5d;.class &#x3d;&#x3d; Time&#xa;&#xa;&#x23; pass through everything unchanged&#xa;&#x24;row</body>
<role>ROW_SCRIPT</role>
</script>
</scripts>
Expand Down

0 comments on commit f4f2c70

Please sign in to comment.