embulk-plugin-filter-grep 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9e5624ef46a062ea7fcc2db5bb8b5ed1595dfd6
4
- data.tar.gz: 0fd4c2e4452a134c1f2f85ddaf31cf04dc73380f
3
+ metadata.gz: 4dbe7ace9cc017fc75522410ea11a0333e289047
4
+ data.tar.gz: 17a9379165bca2594fb964c90153823844293f20
5
5
  SHA512:
6
- metadata.gz: 72897cb6e24ae7db4ca54f9724416e8dc9e8feeeabc03650ba927463dd3ecba3135d7c2847b83371fb4ede31d6bd974ca80a46deacbedd0bdb46384237ac1ffd
7
- data.tar.gz: 5c2a2312f69e82f669855753379a3b13bf44fd97e8849d06abd7f559133bbbf1a92f9ebdf1cb886a1d4a6340c806153db6536c046c63028747ae7603bff4968d
6
+ metadata.gz: c6aab379409e9ad88882a2b707741d74fa9e0665dc486367b6427c63f75f3b88c7a4087bb5bb4674ae73d2365341ccb1fd34767939fbf814bee8e5417d67fc80
7
+ data.tar.gz: 6941a0e141ec28bbeac1b960e4b663b26a63ab07e45af2dd77a5a0ce44e102d7bb70e14e69a3b4669a2ee59dd8d7fec15be83dbdb0e750e199954a8ac7f5e237
data/README.md CHANGED
@@ -1,39 +1,16 @@
1
- # Embulk::Plugin::Filter::Grep
1
+ # Embulk filter plugin for data extraction
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/embulk/plugin/filter/grep`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ data extraction
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Configuration
6
6
 
7
- ## Installation
7
+ - **columns** column name and grep condition (array)
8
8
 
9
- Add this line to your application's Gemfile:
9
+ ### Example
10
10
 
11
- ```ruby
12
- gem 'embulk-plugin-filter-grep'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install embulk-plugin-filter-grep
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- 1. Fork it ( https://github.com/[my-github-username]/embulk-plugin-filter-grep/fork )
36
- 2. Create your feature branch (`git checkout -b my-new-feature`)
37
- 3. Commit your changes (`git commit -am 'Add some feature'`)
38
- 4. Push to the branch (`git push origin my-new-feature`)
39
- 5. Create a new Pull Request
11
+ ```yaml
12
+ filters:
13
+ - type: grep
14
+ columns:
15
+ - {name: comment, regexp: 'jruby'}
16
+ ```
@@ -0,0 +1,46 @@
1
+ module Embulk
2
+ module Plugin
3
+
4
+ class FilterGrep < FilterPlugin
5
+
6
+ Plugin.register_filter('grep', self)
7
+
8
+ def self.transaction(config, in_schema, &control)
9
+ task = {
10
+ 'columns' => config.param('columns', :array),
11
+ }
12
+
13
+ out_columns = in_schema
14
+
15
+ puts "Extranction filter started."
16
+ yield(task, out_columns)
17
+ puts "Extranction filter finished."
18
+ end
19
+
20
+ def initialize(task, in_schema, out_schema, page_builder)
21
+ super
22
+ @columns = task['columns']
23
+ end
24
+
25
+ def close
26
+ end
27
+
28
+ def add(page)
29
+ page.each do |record|
30
+ hash = Hash[in_schema.names.zip(record)]
31
+ @columns.each do |col|
32
+ regEx = col['regexp']
33
+ if hash[col['name']] =~ /#{regEx}/
34
+ @page_builder.add(record)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ def finish
41
+ @page_builder.finish
42
+ end
43
+ end
44
+
45
+ end
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-plugin-filter-grep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tadaichiro Nakano
@@ -31,21 +31,8 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - .gitignore
35
- - .rspec
36
- - .travis.yml
37
- - CODE_OF_CONDUCT.md
38
- - Gemfile
39
- - LICENSE.txt
34
+ - lib/embulk/filter_grep.rb
40
35
  - README.md
41
- - Rakefile
42
- - bin/console
43
- - bin/setup
44
- - embulk-plugin-filter-grep.gemspec
45
- - lib/embulk/plugin/filter/grep.rb
46
- - lib/embulk/plugin/filter/grep/version.rb
47
- - spec/embulk/plugin/filter/grep_spec.rb
48
- - spec/spec_helper.rb
49
36
  homepage: https://github.com/tadaichiro/embulk-plugin-filter-grep
50
37
  licenses:
51
38
  - MIT
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in embulk-plugin-filter-grep.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 tadaichiro
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
- task :default => [:build]
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "embulk/plugin/filter/grep"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,18 +0,0 @@
1
- Gem::Specification.new do |gem|
2
- gem.name = "embulk-plugin-filter-grep"
3
- gem.version = "0.0.1"
4
-
5
- gem.summary = %q{Embulk Fileter Plugin Grep}
6
- gem.description = gem.summary
7
- gem.authors = ["Tadaichiro Nakano"]
8
- gem.email = ["nakanotadaichiro@outlook.jp"]
9
- gem.homepage = "https://github.com/tadaichiro/embulk-plugin-filter-grep"
10
- gem.license = "MIT"
11
-
12
- gem.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
13
- gem.require_paths = ["lib"]
14
-
15
- gem.add_development_dependency "bundler", "~> 1.8"
16
- # spec.add_development_dependency "rake", "~> 10.0"
17
- # spec.add_development_dependency "rspec"
18
- end
@@ -1,11 +0,0 @@
1
- require "embulk/plugin/filter/grep/version"
2
-
3
- module Embulk
4
- module Plugin
5
- module Filter
6
- module Grep
7
- # Your code goes here...
8
- end
9
- end
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- module Embulk
2
- module Plugin
3
- module Filter
4
- module Grep
5
- VERSION = "0.1.0"
6
- end
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Embulk::Plugin::Filter::Grep do
4
- it 'has a version number' do
5
- expect(Embulk::Plugin::Filter::Grep::VERSION).not_to be nil
6
- end
7
-
8
- it 'does something useful' do
9
- expect(false).to eq(true)
10
- end
11
- end
data/spec/spec_helper.rb DELETED
@@ -1,2 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'embulk/plugin/filter/grep'