embulk-input-command 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +24 -0
- data/README.md +1 -1
- data/build.gradle +4 -3
- data/src/main/java/org/embulk/input/CommandFileInputPlugin.java +13 -1
- data/src/test/java/org/embulk/input/TestCommandFileInputPlugin.java +23 -0
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfb1edd3656ab3780a2abfdb1fce32a64871455b
|
4
|
+
data.tar.gz: 31a65a6ff23eaac1f6317fe2bec976b1830fedf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a82a97910aaa580c84f02c72872421e3159945116ae07bd0b027c3c5a11f27fdb06585e7885562ac8b2ef94eef5ecd81be906585211f2ff80bc239d9d4aa46d5
|
7
|
+
data.tar.gz: be3d0ece9a03569876144020e632d98069e3ef1c7ae415b59501cacd350627addcee72f3fee0fb1ea881c1ecacf5d3dc1965a755d4da7f7d7f3d85406a1fb57c
|
data/ChangeLog
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
Release 0.1.4 - 2016-01-13
|
3
|
+
|
4
|
+
* added support for Windows (@cosmo0920++)
|
5
|
+
|
6
|
+
|
7
|
+
Release 0.1.3 - 2015-08-18
|
8
|
+
|
9
|
+
* embulk version to v0.7.0
|
10
|
+
|
11
|
+
|
12
|
+
Release 0.1.2 - 2015-02-25
|
13
|
+
|
14
|
+
* fixed gem description
|
15
|
+
|
16
|
+
|
17
|
+
Release 0.1.1 - 2015-02-25
|
18
|
+
|
19
|
+
* upgraded to embulk-core v0.4.8
|
20
|
+
|
21
|
+
|
22
|
+
Release 0.1.0 - 2015-02-17
|
23
|
+
|
24
|
+
* The initial release
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ This plugin runs a command and reads data from its stdout (or stderr).
|
|
12
12
|
- **command**: command line (string, required)
|
13
13
|
- **pipe**: stdout or stderr (string, default: stdout)
|
14
14
|
|
15
|
-
The **command** is exected using a shell.
|
15
|
+
The **command** is exected using a shell (`sh -c` on UNIX/Linux, `PowerShell.exe -Command` on Windows). Therefore, it can include pipe (`|`), environment variables (`$VAR`), redirects, and so on.
|
16
16
|
|
17
17
|
## Example
|
18
18
|
|
data/build.gradle
CHANGED
@@ -12,11 +12,12 @@ configurations {
|
|
12
12
|
provided
|
13
13
|
}
|
14
14
|
|
15
|
-
version = "0.1.
|
15
|
+
version = "0.1.4"
|
16
16
|
|
17
17
|
dependencies {
|
18
|
-
compile "org.embulk:embulk-core:0.7
|
19
|
-
provided "org.embulk:embulk-core:0.7
|
18
|
+
compile "org.embulk:embulk-core:0.7.+"
|
19
|
+
provided "org.embulk:embulk-core:0.7.+"
|
20
|
+
testCompile 'org.embulk:embulk-core:0.7.+:tests'
|
20
21
|
testCompile "junit:junit:4.+"
|
21
22
|
}
|
22
23
|
|
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|
5
5
|
import java.io.InputStream;
|
6
6
|
import java.io.IOException;
|
7
7
|
import java.io.FilterInputStream;
|
8
|
+
import com.google.common.annotations.VisibleForTesting;
|
8
9
|
import org.slf4j.Logger;
|
9
10
|
import com.google.common.base.Optional;
|
10
11
|
import com.google.common.collect.ImmutableList;
|
@@ -88,7 +89,7 @@ public class CommandFileInputPlugin
|
|
88
89
|
PluginTask task = taskSource.loadTask(PluginTask.class);
|
89
90
|
|
90
91
|
List<String> cmdline = new ArrayList<String>();
|
91
|
-
cmdline.addAll(
|
92
|
+
cmdline.addAll(buildShell());
|
92
93
|
cmdline.add(task.getCommand());
|
93
94
|
|
94
95
|
logger.info("Running command {}", cmdline);
|
@@ -131,6 +132,17 @@ public class CommandFileInputPlugin
|
|
131
132
|
}
|
132
133
|
}
|
133
134
|
|
135
|
+
@VisibleForTesting
|
136
|
+
static List<String> buildShell()
|
137
|
+
{
|
138
|
+
String osName = System.getProperty("os.name");
|
139
|
+
if(osName.indexOf("Windows") >= 0) {
|
140
|
+
return ImmutableList.of("PowerShell.exe", "-Command");
|
141
|
+
} else {
|
142
|
+
return ImmutableList.of("sh", "-c");
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
134
146
|
private static class ProcessWaitInputStream
|
135
147
|
extends FilterInputStream
|
136
148
|
{
|
@@ -1,5 +1,28 @@
|
|
1
1
|
package org.embulk.input;
|
2
2
|
|
3
|
+
import com.google.common.collect.ImmutableList;
|
4
|
+
import org.junit.Before;
|
5
|
+
import org.junit.Rule;
|
6
|
+
import org.junit.Test;
|
7
|
+
import org.embulk.EmbulkTestRuntime;
|
8
|
+
import static org.embulk.input.CommandFileInputPlugin.buildShell;
|
9
|
+
|
10
|
+
import java.util.List;
|
11
|
+
|
12
|
+
import static org.junit.Assert.assertEquals;
|
13
|
+
|
3
14
|
public class TestCommandFileInputPlugin
|
4
15
|
{
|
16
|
+
@Rule
|
17
|
+
public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
|
18
|
+
|
19
|
+
@Test
|
20
|
+
public void testShell() {
|
21
|
+
if (System.getProperty("os.name").indexOf("Windows") >= 0) {
|
22
|
+
assertEquals(ImmutableList.of("PowerShell.exe", "-Command"), buildShell());
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
assertEquals(ImmutableList.of("sh", "-c"), buildShell());
|
26
|
+
}
|
27
|
+
}
|
5
28
|
}
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
14
|
requirement: !ruby/object:Gem::Requirement
|
21
15
|
requirements:
|
22
16
|
- - ~>
|
23
17
|
- !ruby/object:Gem::Version
|
24
18
|
version: '1.0'
|
19
|
+
name: bundler
|
25
20
|
prerelease: false
|
26
21
|
type: :development
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
|
-
- -
|
24
|
+
- - ~>
|
32
25
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
30
|
- - '>='
|
37
31
|
- !ruby/object:Gem::Version
|
38
32
|
version: '10.0'
|
33
|
+
name: rake
|
39
34
|
prerelease: false
|
40
35
|
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
41
|
description: Executes a command and reads a file from its STDOUT.
|
42
42
|
email:
|
43
43
|
- frsyuki@gmail.com
|
@@ -47,6 +47,7 @@ extra_rdoc_files: []
|
|
47
47
|
files:
|
48
48
|
- .gitignore
|
49
49
|
- COPYING
|
50
|
+
- ChangeLog
|
50
51
|
- README.md
|
51
52
|
- build.gradle
|
52
53
|
- gradle/wrapper/gradle-wrapper.jar
|
@@ -56,7 +57,7 @@ files:
|
|
56
57
|
- lib/embulk/input/command.rb
|
57
58
|
- src/main/java/org/embulk/input/CommandFileInputPlugin.java
|
58
59
|
- src/test/java/org/embulk/input/TestCommandFileInputPlugin.java
|
59
|
-
- classpath/embulk-input-command-0.1.
|
60
|
+
- classpath/embulk-input-command-0.1.4.jar
|
60
61
|
homepage: https://github.com/embulk/embulk-input-command
|
61
62
|
licenses:
|
62
63
|
- Apache 2.0
|