embulk-parser-poi_excel 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +120 -0
- data/build.gradle +77 -0
- data/classpath/commons-codec-1.9.jar +0 -0
- data/classpath/embulk-parser-poi_excel-0.1.0.jar +0 -0
- data/classpath/embulk-standards-0.7.5.jar +0 -0
- data/classpath/poi-3.13.jar +0 -0
- data/classpath/poi-ooxml-3.13.jar +0 -0
- data/classpath/poi-ooxml-schemas-3.13.jar +0 -0
- data/classpath/stax-api-1.0.1.jar +0 -0
- data/classpath/xmlbeans-2.6.0.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/gradle/wrapper/gradle-wrapper.properties +6 -0
- data/gradlew +164 -0
- data/gradlew.bat +90 -0
- data/lib/embulk/guess/poi_excel.rb +61 -0
- data/lib/embulk/parser/poi_excel.rb +3 -0
- data/src/main/java/org/embulk/parser/poi_excel/PoiExcelColumnValueType.java +39 -0
- data/src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java +199 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/AbstractPoiExcelCellAttributeVisitor.java +133 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellCommentVisitor.java +68 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellFontVisitor.java +117 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellStyleVisitor.java +205 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelCellVisitor.java +194 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColorVisitor.java +81 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColumnIndex.java +174 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColumnVisitor.java +146 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelVisitorFactory.java +171 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelVisitorValue.java +63 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/embulk/BooleanCellVisitor.java +54 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/embulk/CellVisitor.java +41 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/embulk/DoubleCellVisitor.java +54 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java +54 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/embulk/StringCellVisitor.java +63 -0
- data/src/main/java/org/embulk/parser/poi_excel/visitor/embulk/TimestampCellVisitor.java +73 -0
- data/src/test/java/org/embulk/parser/EmbulkPluginTester.java +176 -0
- data/src/test/java/org/embulk/parser/EmbulkTestFileInputPlugin.java +83 -0
- data/src/test/java/org/embulk/parser/EmbulkTestOutputPlugin.java +193 -0
- data/src/test/java/org/embulk/parser/EmbulkTestParserConfig.java +51 -0
- data/src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin.java +187 -0
- data/src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin_cellComment.java +42 -0
- data/src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin_cellFont.java +125 -0
- data/src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin_cellStyle.java +132 -0
- data/src/test/java/org/embulk/parser/poi_excel/TestPoiExcelParserPlugin_columnNumber.java +188 -0
- data/src/test/resources/org/embulk/parser/poi_excel/test1.xls +0 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9eabdb80c2cf4ef399fd2d9b0ec1f255cdda7ee1
|
4
|
+
data.tar.gz: 3b3ec43a2141a303fd234439aeef7ce2bd1da7ae
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f93efdbd29139564ee732ebcae17a7ecbec39b03ab9f6a161ae7ffc172760386d21c1f26aa36b399ca286b8ec315b6cd849dda3960e353085c64cbf627738b41
|
7
|
+
data.tar.gz: 95822b832a14fdba92b2181f178d93abff62e2dd25daeadbc4ddb4ee37cb958ca5d649c56f20f9f1c50f410e67f9fc398af28dd1adc1337204bfb91824befb15
|
data/.gitignore
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
MIT License
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
# Apache POI Excel parser plugin for Embulk
|
2
|
+
|
3
|
+
Parses Microsoft Excel files(xls, xlsx) read by other file input plugins.
|
4
|
+
This plugin uses Apache POI.
|
5
|
+
|
6
|
+
## Overview
|
7
|
+
|
8
|
+
* **Plugin type**: parser
|
9
|
+
* **Guess supported**: no
|
10
|
+
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
* **sheet**: sheet name. (string, default: `Sheet1`)
|
14
|
+
* **skip_header_lines**: skip rows. (integer, default: `0`)
|
15
|
+
* **columns**: column definition. see below. (hash, required)
|
16
|
+
|
17
|
+
### columns
|
18
|
+
|
19
|
+
* **name**: Embulk column name. (string, required)
|
20
|
+
* **type**: Embulk column type. (string, required)
|
21
|
+
* **value**: value type. see below. (string, defualt: `cell_value`)
|
22
|
+
* **column_number**: Excel column number. see below. (string, default: next column)
|
23
|
+
* **attribute_name**: use with value `cell_style`, `cell_font`, etc. see below. (list of string)
|
24
|
+
|
25
|
+
### value
|
26
|
+
|
27
|
+
* **cell_value**: value in cell.
|
28
|
+
* **cell_formula**: formula in cell. (if cell is not formula, same `cell_value`.)
|
29
|
+
* **cell_style**: all cell style attributes. returned json string. see **attribute_name**. (**type** required `string`)
|
30
|
+
* **cell_font**: all cell font attributes. returned json string. see **attribute_name**. (**type** required `string`)
|
31
|
+
* **cell_comment**: all cell comment attributes. returned json string. see **attribute_name**. (**type** required `string`)
|
32
|
+
* **sheet_name**: sheet name.
|
33
|
+
* **row_number**: row number(1 origin).
|
34
|
+
* **column_number**: column number(1 origin).
|
35
|
+
|
36
|
+
### column_number
|
37
|
+
|
38
|
+
* `A`,`B`,`C`,...: column number of "A1 format".
|
39
|
+
* *number*: column number (1 origin).
|
40
|
+
* `+`: next column.
|
41
|
+
* `+`*name*: next column of name.
|
42
|
+
* `+`*number*: number next column.
|
43
|
+
* `-`: previous column.
|
44
|
+
* `-`*name*: previous column of name.
|
45
|
+
* `-`*number*: number previous column.
|
46
|
+
* `=`: same column.
|
47
|
+
* `=`*name*: same column of name.
|
48
|
+
|
49
|
+
### attribute_name
|
50
|
+
|
51
|
+
**value**が`cell_style`, `cell_font`, `cell_comment`のとき、デフォルトでは、全属性を取得してJSON文字列に変換します。
|
52
|
+
(JSON文字列を返すので、**type**は`string`である必要があります)
|
53
|
+
|
54
|
+
```yaml
|
55
|
+
columns:
|
56
|
+
- {name: foo, type: string, column_number: A, value: cell_style}
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
attribute_nameを指定することで、指定された属性だけを取得してJSON文字列に変換します。
|
61
|
+
|
62
|
+
* **attribute_name**: attribute names. (list of string)
|
63
|
+
|
64
|
+
```yaml
|
65
|
+
columns:
|
66
|
+
- {name: foo, type: string, column_number: A, value: cell_style, attribute_name: [border_top, border_bottom, border_left, border_right]}
|
67
|
+
```
|
68
|
+
|
69
|
+
|
70
|
+
また、`cell_style`や`cell_font`の直後にピリオドを付けて属性名を指定することにより、その属性だけを取得することが出来ます。
|
71
|
+
この場合はJSON文字列にはならず、属性の型に合う**type**を指定する必要があります。
|
72
|
+
|
73
|
+
```yaml
|
74
|
+
columns:
|
75
|
+
- {name: foo, type: long, value: cell_style.border}
|
76
|
+
- {name: bar, type: long, value: cell_font.color}
|
77
|
+
```
|
78
|
+
|
79
|
+
なお、`cell_style`や`cell_font`では、**column_number**を省略した場合は直前と同じ列を対象とします。
|
80
|
+
(`cell_value`では、**column_number**を省略すると次の列に移る)
|
81
|
+
|
82
|
+
|
83
|
+
## Example
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
in:
|
87
|
+
type: any file input plugin type
|
88
|
+
parser:
|
89
|
+
type: poi_excel
|
90
|
+
sheet: "DQ10-orb"
|
91
|
+
skip_header_lines: 1 # first row is header.
|
92
|
+
columns:
|
93
|
+
- {name: row, type: long, value: row_number}
|
94
|
+
- {name: get_date, type: timestamp, value: cell_value, column_number: A}
|
95
|
+
- {name: orb_type, type: string}
|
96
|
+
- {name: orb_name, type: string}
|
97
|
+
- {name: orb_shape, type: long}
|
98
|
+
- {name: drop_monster_name, type: string}
|
99
|
+
```
|
100
|
+
|
101
|
+
if omit `value`, specified `cell_value`.
|
102
|
+
if omit `column_number` when valus is `cell_value`, specified next column.
|
103
|
+
if omit `column_number` when valus is `cell_style`, specified same column.
|
104
|
+
|
105
|
+
### execute
|
106
|
+
|
107
|
+
```
|
108
|
+
$ cd ~/your-workspace
|
109
|
+
$ git clone https://github.com/hishidama/embulk-parser-poi_excel.git
|
110
|
+
$ cd embulk-parser-poi_excel
|
111
|
+
$ ./gradlew package
|
112
|
+
$ cd /your-embulk-working-dir
|
113
|
+
$ embulk run -L ~/your-workspace/embulk-parser-poi_excel config.yml
|
114
|
+
```
|
115
|
+
|
116
|
+
## Build
|
117
|
+
|
118
|
+
```
|
119
|
+
$ ./gradlew package
|
120
|
+
```
|
data/build.gradle
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
plugins {
|
2
|
+
id "com.jfrog.bintray" version "1.1"
|
3
|
+
id "com.github.jruby-gradle.base" version "0.1.5"
|
4
|
+
id "java"
|
5
|
+
id "eclipse"
|
6
|
+
}
|
7
|
+
import com.github.jrubygradle.JRubyExec
|
8
|
+
repositories {
|
9
|
+
mavenCentral()
|
10
|
+
jcenter()
|
11
|
+
}
|
12
|
+
configurations {
|
13
|
+
provided
|
14
|
+
}
|
15
|
+
|
16
|
+
version = "0.1.0"
|
17
|
+
|
18
|
+
dependencies {
|
19
|
+
compile "org.embulk:embulk-core:0.7.5"
|
20
|
+
provided "org.embulk:embulk-core:0.7.5"
|
21
|
+
compile "org.embulk:embulk-standards:0.7.5"
|
22
|
+
// compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
|
23
|
+
compile group: 'org.apache.poi', name : 'poi', version: '3.13'
|
24
|
+
compile group: 'org.apache.poi', name : 'poi-ooxml', version: '3.13'
|
25
|
+
testCompile "junit:junit:4.+"
|
26
|
+
}
|
27
|
+
|
28
|
+
task classpath(type: Copy, dependsOn: ["jar"]) {
|
29
|
+
doFirst { file("classpath").deleteDir() }
|
30
|
+
from (configurations.runtime - configurations.provided + files(jar.archivePath))
|
31
|
+
into "classpath"
|
32
|
+
}
|
33
|
+
clean { delete "classpath" }
|
34
|
+
|
35
|
+
task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
|
36
|
+
jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
|
37
|
+
script "${project.name}.gemspec"
|
38
|
+
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
|
39
|
+
}
|
40
|
+
|
41
|
+
task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
|
42
|
+
jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
|
43
|
+
script "pkg/${project.name}-${project.version}.gem"
|
44
|
+
}
|
45
|
+
|
46
|
+
task "package"(dependsOn: ["gemspec", "classpath"]) << {
|
47
|
+
println "> Build succeeded."
|
48
|
+
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
|
49
|
+
}
|
50
|
+
|
51
|
+
task gemspec {
|
52
|
+
ext.gemspecFile = file("${project.name}.gemspec")
|
53
|
+
inputs.file "build.gradle"
|
54
|
+
outputs.file gemspecFile
|
55
|
+
doLast { gemspecFile.write($/
|
56
|
+
Gem::Specification.new do |spec|
|
57
|
+
spec.name = "${project.name}"
|
58
|
+
spec.version = "${project.version}"
|
59
|
+
spec.authors = ["hishidama"]
|
60
|
+
spec.summary = %[Apache POI Excel parser plugin for Embulk]
|
61
|
+
spec.description = %[Parses Excel files(xls, xlsx) read by other file input plugins.]
|
62
|
+
spec.email = ["hishi.dama@asahi.email.ne.jp"]
|
63
|
+
spec.licenses = ["MIT"]
|
64
|
+
spec.homepage = "https://github.com/hishidama/embulk-parser-poi_excel"
|
65
|
+
|
66
|
+
spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
|
67
|
+
spec.test_files = spec.files.grep(%r"^(test|spec)/")
|
68
|
+
spec.require_paths = ["lib"]
|
69
|
+
|
70
|
+
#spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
|
71
|
+
spec.add_development_dependency 'bundler', ['~> 1.0']
|
72
|
+
spec.add_development_dependency 'rake', ['>= 10.0']
|
73
|
+
end
|
74
|
+
/$)
|
75
|
+
}
|
76
|
+
}
|
77
|
+
clean { delete "${project.name}.gemspec" }
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/gradlew
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
##############################################################################
|
4
|
+
##
|
5
|
+
## Gradle start up script for UN*X
|
6
|
+
##
|
7
|
+
##############################################################################
|
8
|
+
|
9
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
10
|
+
DEFAULT_JVM_OPTS=""
|
11
|
+
|
12
|
+
APP_NAME="Gradle"
|
13
|
+
APP_BASE_NAME=`basename "$0"`
|
14
|
+
|
15
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
16
|
+
MAX_FD="maximum"
|
17
|
+
|
18
|
+
warn ( ) {
|
19
|
+
echo "$*"
|
20
|
+
}
|
21
|
+
|
22
|
+
die ( ) {
|
23
|
+
echo
|
24
|
+
echo "$*"
|
25
|
+
echo
|
26
|
+
exit 1
|
27
|
+
}
|
28
|
+
|
29
|
+
# OS specific support (must be 'true' or 'false').
|
30
|
+
cygwin=false
|
31
|
+
msys=false
|
32
|
+
darwin=false
|
33
|
+
case "`uname`" in
|
34
|
+
CYGWIN* )
|
35
|
+
cygwin=true
|
36
|
+
;;
|
37
|
+
Darwin* )
|
38
|
+
darwin=true
|
39
|
+
;;
|
40
|
+
MINGW* )
|
41
|
+
msys=true
|
42
|
+
;;
|
43
|
+
esac
|
44
|
+
|
45
|
+
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
46
|
+
if $cygwin ; then
|
47
|
+
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
48
|
+
fi
|
49
|
+
|
50
|
+
# Attempt to set APP_HOME
|
51
|
+
# Resolve links: $0 may be a link
|
52
|
+
PRG="$0"
|
53
|
+
# Need this for relative symlinks.
|
54
|
+
while [ -h "$PRG" ] ; do
|
55
|
+
ls=`ls -ld "$PRG"`
|
56
|
+
link=`expr "$ls" : '.*-> \(.*\)$'`
|
57
|
+
if expr "$link" : '/.*' > /dev/null; then
|
58
|
+
PRG="$link"
|
59
|
+
else
|
60
|
+
PRG=`dirname "$PRG"`"/$link"
|
61
|
+
fi
|
62
|
+
done
|
63
|
+
SAVED="`pwd`"
|
64
|
+
cd "`dirname \"$PRG\"`/" >&-
|
65
|
+
APP_HOME="`pwd -P`"
|
66
|
+
cd "$SAVED" >&-
|
67
|
+
|
68
|
+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
69
|
+
|
70
|
+
# Determine the Java command to use to start the JVM.
|
71
|
+
if [ -n "$JAVA_HOME" ] ; then
|
72
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
73
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
74
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
75
|
+
else
|
76
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
77
|
+
fi
|
78
|
+
if [ ! -x "$JAVACMD" ] ; then
|
79
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
80
|
+
|
81
|
+
Please set the JAVA_HOME variable in your environment to match the
|
82
|
+
location of your Java installation."
|
83
|
+
fi
|
84
|
+
else
|
85
|
+
JAVACMD="java"
|
86
|
+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
87
|
+
|
88
|
+
Please set the JAVA_HOME variable in your environment to match the
|
89
|
+
location of your Java installation."
|
90
|
+
fi
|
91
|
+
|
92
|
+
# Increase the maximum file descriptors if we can.
|
93
|
+
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
94
|
+
MAX_FD_LIMIT=`ulimit -H -n`
|
95
|
+
if [ $? -eq 0 ] ; then
|
96
|
+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
97
|
+
MAX_FD="$MAX_FD_LIMIT"
|
98
|
+
fi
|
99
|
+
ulimit -n $MAX_FD
|
100
|
+
if [ $? -ne 0 ] ; then
|
101
|
+
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
102
|
+
fi
|
103
|
+
else
|
104
|
+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
105
|
+
fi
|
106
|
+
fi
|
107
|
+
|
108
|
+
# For Darwin, add options to specify how the application appears in the dock
|
109
|
+
if $darwin; then
|
110
|
+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
111
|
+
fi
|
112
|
+
|
113
|
+
# For Cygwin, switch paths to Windows format before running java
|
114
|
+
if $cygwin ; then
|
115
|
+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
116
|
+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
117
|
+
|
118
|
+
# We build the pattern for arguments to be converted via cygpath
|
119
|
+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
120
|
+
SEP=""
|
121
|
+
for dir in $ROOTDIRSRAW ; do
|
122
|
+
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
123
|
+
SEP="|"
|
124
|
+
done
|
125
|
+
OURCYGPATTERN="(^($ROOTDIRS))"
|
126
|
+
# Add a user-defined pattern to the cygpath arguments
|
127
|
+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
128
|
+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
129
|
+
fi
|
130
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
131
|
+
i=0
|
132
|
+
for arg in "$@" ; do
|
133
|
+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
134
|
+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
135
|
+
|
136
|
+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
137
|
+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
138
|
+
else
|
139
|
+
eval `echo args$i`="\"$arg\""
|
140
|
+
fi
|
141
|
+
i=$((i+1))
|
142
|
+
done
|
143
|
+
case $i in
|
144
|
+
(0) set -- ;;
|
145
|
+
(1) set -- "$args0" ;;
|
146
|
+
(2) set -- "$args0" "$args1" ;;
|
147
|
+
(3) set -- "$args0" "$args1" "$args2" ;;
|
148
|
+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
149
|
+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
150
|
+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
151
|
+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
152
|
+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
153
|
+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
154
|
+
esac
|
155
|
+
fi
|
156
|
+
|
157
|
+
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
158
|
+
function splitJvmOpts() {
|
159
|
+
JVM_OPTS=("$@")
|
160
|
+
}
|
161
|
+
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
162
|
+
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
163
|
+
|
164
|
+
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
data/gradlew.bat
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
@if "%DEBUG%" == "" @echo off
|
2
|
+
@rem ##########################################################################
|
3
|
+
@rem
|
4
|
+
@rem Gradle startup script for Windows
|
5
|
+
@rem
|
6
|
+
@rem ##########################################################################
|
7
|
+
|
8
|
+
@rem Set local scope for the variables with windows NT shell
|
9
|
+
if "%OS%"=="Windows_NT" setlocal
|
10
|
+
|
11
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
12
|
+
set DEFAULT_JVM_OPTS=
|
13
|
+
|
14
|
+
set DIRNAME=%~dp0
|
15
|
+
if "%DIRNAME%" == "" set DIRNAME=.
|
16
|
+
set APP_BASE_NAME=%~n0
|
17
|
+
set APP_HOME=%DIRNAME%
|
18
|
+
|
19
|
+
@rem Find java.exe
|
20
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
21
|
+
|
22
|
+
set JAVA_EXE=java.exe
|
23
|
+
%JAVA_EXE% -version >NUL 2>&1
|
24
|
+
if "%ERRORLEVEL%" == "0" goto init
|
25
|
+
|
26
|
+
echo.
|
27
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
28
|
+
echo.
|
29
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
30
|
+
echo location of your Java installation.
|
31
|
+
|
32
|
+
goto fail
|
33
|
+
|
34
|
+
:findJavaFromJavaHome
|
35
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
36
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
37
|
+
|
38
|
+
if exist "%JAVA_EXE%" goto init
|
39
|
+
|
40
|
+
echo.
|
41
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
42
|
+
echo.
|
43
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
44
|
+
echo location of your Java installation.
|
45
|
+
|
46
|
+
goto fail
|
47
|
+
|
48
|
+
:init
|
49
|
+
@rem Get command-line arguments, handling Windowz variants
|
50
|
+
|
51
|
+
if not "%OS%" == "Windows_NT" goto win9xME_args
|
52
|
+
if "%@eval[2+2]" == "4" goto 4NT_args
|
53
|
+
|
54
|
+
:win9xME_args
|
55
|
+
@rem Slurp the command line arguments.
|
56
|
+
set CMD_LINE_ARGS=
|
57
|
+
set _SKIP=2
|
58
|
+
|
59
|
+
:win9xME_args_slurp
|
60
|
+
if "x%~1" == "x" goto execute
|
61
|
+
|
62
|
+
set CMD_LINE_ARGS=%*
|
63
|
+
goto execute
|
64
|
+
|
65
|
+
:4NT_args
|
66
|
+
@rem Get arguments from the 4NT Shell from JP Software
|
67
|
+
set CMD_LINE_ARGS=%$
|
68
|
+
|
69
|
+
:execute
|
70
|
+
@rem Setup the command line
|
71
|
+
|
72
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
73
|
+
|
74
|
+
@rem Execute Gradle
|
75
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
76
|
+
|
77
|
+
:end
|
78
|
+
@rem End local scope for the variables with windows NT shell
|
79
|
+
if "%ERRORLEVEL%"=="0" goto mainEnd
|
80
|
+
|
81
|
+
:fail
|
82
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
83
|
+
rem the _cmd.exe /c_ return code!
|
84
|
+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
85
|
+
exit /b 1
|
86
|
+
|
87
|
+
:mainEnd
|
88
|
+
if "%OS%"=="Windows_NT" endlocal
|
89
|
+
|
90
|
+
:omega
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Embulk
|
2
|
+
module Guess
|
3
|
+
|
4
|
+
# TODO implement guess plugin to make this command work:
|
5
|
+
# $ embulk guess -g "poi_excel" partial-config.yml
|
6
|
+
#
|
7
|
+
# Depending on the file format the plugin uses, you can use choose
|
8
|
+
# one of binary guess (GuessPlugin), text guess (TextGuessPlugin),
|
9
|
+
# or line guess (LineGuessPlugin).
|
10
|
+
|
11
|
+
#class PoiExcel < GuessPlugin
|
12
|
+
# Plugin.register_guess("poi_excel", self)
|
13
|
+
#
|
14
|
+
# def guess(config, sample_buffer)
|
15
|
+
# if sample_buffer[0,2] == GZIP_HEADER
|
16
|
+
# guessed = {}
|
17
|
+
# guessed["type"] = "poi_excel"
|
18
|
+
# guessed["property1"] = "guessed-value"
|
19
|
+
# return {"parser" => guessed}
|
20
|
+
# else
|
21
|
+
# return {}
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#end
|
25
|
+
|
26
|
+
#class PoiExcel < TextGuessPlugin
|
27
|
+
# Plugin.register_guess("poi_excel", self)
|
28
|
+
#
|
29
|
+
# def guess_text(config, sample_text)
|
30
|
+
# js = JSON.parse(sample_text) rescue nil
|
31
|
+
# if js && js["mykeyword"] == "keyword"
|
32
|
+
# guessed = {}
|
33
|
+
# guessed["type"] = "poi_excel"
|
34
|
+
# guessed["property1"] = "guessed-value"
|
35
|
+
# return {"parser" => guessed}
|
36
|
+
# else
|
37
|
+
# return {}
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
#end
|
41
|
+
|
42
|
+
#class PoiExcel < LineGuessPlugin
|
43
|
+
# Plugin.register_guess("poi_excel", self)
|
44
|
+
#
|
45
|
+
# def guess_lines(config, sample_lines)
|
46
|
+
# all_line_matched = sample_lines.all? do |line|
|
47
|
+
# line =~ /mypattern/
|
48
|
+
# end
|
49
|
+
# if all_line_matched
|
50
|
+
# guessed = {}
|
51
|
+
# guessed["type"] = "poi_excel"
|
52
|
+
# guessed["property1"] = "guessed-value"
|
53
|
+
# return {"parser" => guessed}
|
54
|
+
# else
|
55
|
+
# return {}
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
#end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
package org.embulk.parser.poi_excel;
|
2
|
+
|
3
|
+
public enum PoiExcelColumnValueType {
|
4
|
+
/** cell value */
|
5
|
+
CELL_VALUE(true, true),
|
6
|
+
/** cell formula */
|
7
|
+
CELL_FORMULA(true, true),
|
8
|
+
/** cell style */
|
9
|
+
CELL_STYLE(true, false),
|
10
|
+
/** cell font */
|
11
|
+
CELL_FONT(true, false),
|
12
|
+
/** cell comment */
|
13
|
+
CELL_COMMENT(true, false),
|
14
|
+
/** sheet name */
|
15
|
+
SHEET_NAME(false, false),
|
16
|
+
/** row number (1 origin) */
|
17
|
+
ROW_NUMBER(false, false),
|
18
|
+
/** column number (1 origin) */
|
19
|
+
COLUMN_NUMBER(true, false),
|
20
|
+
|
21
|
+
//
|
22
|
+
;
|
23
|
+
|
24
|
+
private final boolean useCell;
|
25
|
+
private final boolean nextIndex;
|
26
|
+
|
27
|
+
PoiExcelColumnValueType(boolean useCell, boolean nextIndex) {
|
28
|
+
this.useCell = useCell;
|
29
|
+
this.nextIndex = nextIndex;
|
30
|
+
}
|
31
|
+
|
32
|
+
public boolean useCell() {
|
33
|
+
return useCell;
|
34
|
+
}
|
35
|
+
|
36
|
+
public boolean nextIndex() {
|
37
|
+
return nextIndex;
|
38
|
+
}
|
39
|
+
}
|