amazon-kinesis-client-ruby 0.0.1 → 0.0.3
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -2
- data/Rakefile +9 -0
- data/amazon-kinesis-client-ruby.gemspec +3 -2
- data/lib/kcl/executor.rb +17 -1
- data/lib/kcl/executor_command_builder.rb +22 -6
- data/lib/kcl/version.rb +1 -1
- data/pom.xml +35 -0
- data/spec/executor_command_builder_spec.rb +27 -0
- metadata +20 -5
- data/lib/jars/joda-time-2.4.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8124a97c0e7e8ea976c9f9cc547fafff165775a7
|
4
|
+
data.tar.gz: 37382747dd7c3d8e9e54774c97983e392278e0d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d106ff42b7fbac173f1a220156d5ad8bd7f1df57838f02fd00ec4c5dba64e2c1a832fb035e4ac1719f1dc0409251dffd491a9ae29dbeca0c580f96a468bdc6
|
7
|
+
data.tar.gz: 1fd05ff47e18134be1fbbebaa54f769d7772f637a33ecdff9f2531d5f0824f9044bed24001df887dcc7a5176caaa2dd1ebda7bb0c75ab95b2903fc38faaa3401
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -213,8 +213,8 @@ rake spec
|
|
213
213
|
|
214
214
|
Future Roadmap
|
215
215
|
--------------
|
216
|
-
-
|
217
|
-
|
216
|
+
- Advanced batch record processing
|
217
|
+
- Spec tests on the Kcl::Process to enable future refactoring
|
218
218
|
|
219
219
|
Contributing
|
220
220
|
------------
|
data/Rakefile
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
require 'rubocop/rake_task'
|
4
|
+
require 'rubygems/tasks'
|
5
|
+
require 'maven/ruby/maven'
|
4
6
|
|
5
7
|
RSpec::Core::RakeTask.new :spec do |spec|
|
6
8
|
spec.rspec_opts = '--format documentation --color'
|
7
9
|
end
|
8
10
|
|
9
11
|
RuboCop::RakeTask.new
|
12
|
+
|
13
|
+
task :download_jars do
|
14
|
+
mvn = Maven::Ruby::Maven.new
|
15
|
+
mvn.exec 'generate-sources', '-f', 'pom.xml'
|
16
|
+
end
|
17
|
+
|
18
|
+
task build: :download_jars
|
@@ -13,17 +13,18 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = ''
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.files = `git ls-files -z`.split("\x0") + Dir['lib/jars/*']
|
17
17
|
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'activesupport', '~> 4.1
|
21
|
+
spec.add_runtime_dependency 'activesupport', '~> 4.1'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
26
26
|
spec.add_development_dependency 'rubocop', '~> 0.27.1'
|
27
|
+
spec.add_development_dependency 'ruby-maven', '~> 3.1.1'
|
27
28
|
|
28
29
|
spec.required_ruby_version = '~> 2.0'
|
29
30
|
end
|
data/lib/kcl/executor.rb
CHANGED
@@ -27,6 +27,18 @@ module Kcl
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def system_properties system_properties = nil
|
31
|
+
@system_properties = system_properties if system_properties
|
32
|
+
|
33
|
+
@system_properties || {}
|
34
|
+
end
|
35
|
+
|
36
|
+
def extra_class_path *extra_class_path
|
37
|
+
@extra_class_path = extra_class_path unless extra_class_path.empty?
|
38
|
+
|
39
|
+
@extra_class_path || []
|
40
|
+
end
|
41
|
+
|
30
42
|
def run argv
|
31
43
|
if argv[0] == 'exec'
|
32
44
|
run_exec
|
@@ -40,7 +52,11 @@ module Kcl
|
|
40
52
|
attr_reader :record_processor_callback, :configuration
|
41
53
|
|
42
54
|
def run_exec
|
43
|
-
command = ExecutorCommandBuilder.new(
|
55
|
+
command = ExecutorCommandBuilder.new(
|
56
|
+
config_properties_path,
|
57
|
+
system_properties: system_properties,
|
58
|
+
extra_class_path: extra_class_path
|
59
|
+
).build
|
44
60
|
LOG.info "execute command:\n#{command.join ' '}"
|
45
61
|
|
46
62
|
system(*command)
|
@@ -1,16 +1,22 @@
|
|
1
1
|
module Kcl
|
2
2
|
class ExecutorCommandBuilder
|
3
|
-
def initialize properties_file_path
|
3
|
+
def initialize properties_file_path, system_properties: {},
|
4
|
+
extra_class_path: []
|
4
5
|
@properties_file_path = properties_file_path
|
6
|
+
@system_properties = system_properties
|
7
|
+
@extra_class_path = extra_class_path
|
5
8
|
end
|
6
9
|
|
7
10
|
def build
|
8
|
-
[
|
11
|
+
[
|
12
|
+
java, system_property_options, '-cp', class_path,
|
13
|
+
client_class, properties_file
|
14
|
+
].flatten
|
9
15
|
end
|
10
16
|
|
11
17
|
private
|
12
18
|
|
13
|
-
attr_reader :properties_file_path
|
19
|
+
attr_reader :properties_file_path, :extra_class_path, :system_properties
|
14
20
|
|
15
21
|
def java
|
16
22
|
command = ENV.fetch('PATH_TO_JAVA', `which java`).strip
|
@@ -24,9 +30,9 @@ module Kcl
|
|
24
30
|
end
|
25
31
|
|
26
32
|
def class_path
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
(
|
34
|
+
Dir["#{jar_dir}/*.jar"].concat(extra_class_path) << properties_file_dir
|
35
|
+
).join ':'
|
30
36
|
end
|
31
37
|
|
32
38
|
def properties_file
|
@@ -36,5 +42,15 @@ module Kcl
|
|
36
42
|
def properties_file_dir
|
37
43
|
@properties_file_dir ||= File.dirname properties_file_path
|
38
44
|
end
|
45
|
+
|
46
|
+
def system_property_options
|
47
|
+
@system_property_options ||= system_properties.map do |key, value|
|
48
|
+
"-D#{key}=#{value}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def jar_dir
|
53
|
+
@jar_dir ||= File.expand_path '../../jars', __FILE__
|
54
|
+
end
|
39
55
|
end
|
40
56
|
end
|
data/lib/kcl/version.rb
CHANGED
data/pom.xml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
4
|
+
<groupId>com.edh.data</groupId>
|
5
|
+
<artifactId>amazon-kinesis-client-ruby</artifactId>
|
6
|
+
<version>0.0.1</version>
|
7
|
+
<packaging>jar</packaging>
|
8
|
+
<dependencies>
|
9
|
+
<dependency>
|
10
|
+
<groupId>com.amazonaws</groupId>
|
11
|
+
<artifactId>amazon-kinesis-client</artifactId>
|
12
|
+
<version>1.2.0</version>
|
13
|
+
</dependency>
|
14
|
+
</dependencies>
|
15
|
+
<build>
|
16
|
+
<plugins>
|
17
|
+
<plugin>
|
18
|
+
<groupId>org.apache.maven.plugins</groupId>
|
19
|
+
<artifactId>maven-dependency-plugin</artifactId>
|
20
|
+
<version>2.1</version>
|
21
|
+
<executions>
|
22
|
+
<execution>
|
23
|
+
<phase>generate-sources</phase>
|
24
|
+
<goals>
|
25
|
+
<goal>copy-dependencies</goal>
|
26
|
+
</goals>
|
27
|
+
<configuration>
|
28
|
+
<outputDirectory>${basedir}/lib/jars</outputDirectory>
|
29
|
+
</configuration>
|
30
|
+
</execution>
|
31
|
+
</executions>
|
32
|
+
</plugin>
|
33
|
+
</plugins>
|
34
|
+
</build>
|
35
|
+
</project>
|
@@ -58,5 +58,32 @@ describe Kcl::ExecutorCommandBuilder do
|
|
58
58
|
|
59
59
|
it { expect(properties_file).to eq File.basename(properties_file_path) }
|
60
60
|
end
|
61
|
+
|
62
|
+
context 'With system properties' do
|
63
|
+
let(:builder) {
|
64
|
+
system_properties = {
|
65
|
+
'log4j.configuration' => 'log4j.properties',
|
66
|
+
option2: 'test'
|
67
|
+
}
|
68
|
+
|
69
|
+
Kcl::ExecutorCommandBuilder.new properties_file_path,
|
70
|
+
system_properties: system_properties
|
71
|
+
}
|
72
|
+
|
73
|
+
it { expect(command).to include '-Dlog4j.configuration=log4j.properties' }
|
74
|
+
|
75
|
+
it { expect(command).to include '-Doption2=test' }
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'With extra_class_path' do
|
79
|
+
let(:classpath) { command[2] }
|
80
|
+
|
81
|
+
let(:builder) {
|
82
|
+
Kcl::ExecutorCommandBuilder.new properties_file_path,
|
83
|
+
extra_class_path: ['test.jar']
|
84
|
+
}
|
85
|
+
|
86
|
+
it { expect(classpath).to include 'test.jar' }
|
87
|
+
end
|
61
88
|
end
|
62
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-kinesis-client-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soloman Weng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.27.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ruby-maven
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.1.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.1.1
|
83
97
|
description: Amazon Kinesis Client Library for Ruby
|
84
98
|
email:
|
85
99
|
- solomanw@everydayhero.com.au
|
@@ -103,7 +117,7 @@ files:
|
|
103
117
|
- lib/jars/jackson-annotations-2.1.1.jar
|
104
118
|
- lib/jars/jackson-core-2.1.1.jar
|
105
119
|
- lib/jars/jackson-databind-2.1.1.jar
|
106
|
-
- lib/jars/joda-time-2.
|
120
|
+
- lib/jars/joda-time-2.5.jar
|
107
121
|
- lib/kcl.rb
|
108
122
|
- lib/kcl/action_handler.rb
|
109
123
|
- lib/kcl/advanced_record_processor.rb
|
@@ -117,6 +131,7 @@ files:
|
|
117
131
|
- lib/kcl/process.rb
|
118
132
|
- lib/kcl/record_processor.rb
|
119
133
|
- lib/kcl/version.rb
|
134
|
+
- pom.xml
|
120
135
|
- spec/configuration_spec.rb
|
121
136
|
- spec/executor_command_builder_spec.rb
|
122
137
|
- spec/executor_spec.rb
|
data/lib/jars/joda-time-2.4.jar
DELETED
Binary file
|