embulk-filter-affix 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ac13f8ed3def5f2c053be66b18c01bcb87c9a8c5
4
+ data.tar.gz: 210106ebd11e679eeb4cdb3ad8e569ba63f5bb2c
5
+ SHA512:
6
+ metadata.gz: 74cd9091e8972c09286c00a0bdc05b9c1c61599f495cb5668897e8db7a51b2f5119620fff85dba66ba9ab6b7f26018dfba02a2733d2ee3584a6ef9b0e15e70d2
7
+ data.tar.gz: 8750e770f8948baee5a404d5504302f8cbc43755c10b74a5c1f343dfd50bdc72948b7eedb82dd6698d711fbc8de622a9cf9ece9d1bb6fbf1d560d158aec94eac
@@ -0,0 +1,5 @@
1
+ *~
2
+ /pkg/
3
+ /tmp/
4
+ /.bundle/
5
+ /Gemfile.lock
@@ -0,0 +1 @@
1
+ jruby-9.1.5.0
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org/'
2
+ gemspec
@@ -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.
@@ -0,0 +1,26 @@
1
+ # Affix filter plugin for Embulk
2
+
3
+ TODO: Write short description here and embulk-filter-affix.gemspec file.
4
+
5
+ ## Overview
6
+
7
+ * **Plugin type**: filter
8
+
9
+ ## Configuration
10
+
11
+ - **affix**: affix(prefix or suffix) (string, default: `"prefix"`)
12
+
13
+ ## Example
14
+
15
+ ```yaml
16
+ filters:
17
+ - type: affix
18
+ affix: suffix
19
+ ```
20
+
21
+
22
+ ## Build
23
+
24
+ ```
25
+ $ rake
26
+ ```
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task default: :build
@@ -0,0 +1,20 @@
1
+
2
+ Gem::Specification.new do |spec|
3
+ spec.name = "embulk-filter-affix"
4
+ spec.version = "0.1.0"
5
+ spec.authors = ["imura81gt"]
6
+ spec.summary = "Affix filter plugin for Embulk"
7
+ spec.description = "Affix"
8
+ spec.email = ["imura81gt@gmail.com"]
9
+ spec.licenses = ["MIT"]
10
+ spec.homepage = "https://github.com/imura81gt/embulk-filter-affix"
11
+
12
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
13
+ spec.test_files = spec.files.grep(%r{^(test|spec)/})
14
+ spec.require_paths = ["lib"]
15
+
16
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
17
+ spec.add_development_dependency 'embulk', ['>= 0.8.17']
18
+ spec.add_development_dependency 'bundler', ['>= 1.10.6']
19
+ spec.add_development_dependency 'rake', ['>= 10.0']
20
+ end
@@ -0,0 +1,51 @@
1
+ module Embulk
2
+ module Filter
3
+
4
+ class Affix < FilterPlugin
5
+ Plugin.register_filter("affix", self)
6
+
7
+ def self.transaction(config, in_schema, &control)
8
+ task = {
9
+ "affix" => config.param("affix", :string, default: "suffix"),
10
+ }
11
+
12
+ columns = []
13
+
14
+ in_schema.each do |record|
15
+ if task['affix'] == "suffix" then
16
+ name = record.name + "_" + record.type.to_s[0]
17
+ elsif task['affix'] == "prefix" then
18
+ name = record.type.to_s[0] + "_" + record.name
19
+ else
20
+ name = record.name
21
+ end
22
+ column = Column.new(nil, name, record.type)
23
+ columns.push(column)
24
+ end
25
+
26
+ out_columns = columns
27
+
28
+ yield(task, out_columns)
29
+ end
30
+
31
+ def init
32
+ # initialization code:
33
+ @affix = task["affix"]
34
+ end
35
+
36
+ def close
37
+ end
38
+
39
+ def add(page)
40
+ page.each do |record|
41
+ page_builder.add(record)
42
+ end
43
+ end
44
+
45
+ def finish
46
+ page_builder.finish
47
+ end
48
+ end
49
+
50
+ end
51
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: embulk-filter-affix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - imura81gt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 0.8.17
19
+ name: embulk
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.17
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.10.6
33
+ name: bundler
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.10.6
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '10.0'
47
+ name: rake
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Affix
56
+ email:
57
+ - imura81gt@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".ruby-version"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - embulk-filter-affix.gemspec
69
+ - lib/embulk/filter/affix.rb
70
+ homepage: https://github.com/imura81gt/embulk-filter-affix
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.6.6
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Affix filter plugin for Embulk
94
+ test_files: []