imw 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/tsv_to_json.rb +29 -0
  3. data/lib/imw.rb +1 -1
  4. metadata +7 -5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.11
1
+ 0.2.12
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'json/ext'
4
+ require 'configliere'
5
+
6
+ Settings.use :commandline, :define
7
+ Settings.define :json_keys, :description => "A comma separated list of keys, in the order to be read from source."
8
+ # Settings.resolve!
9
+
10
+ module TSVtoJSON
11
+
12
+ # def initialize
13
+ # keys unless Settings.keys.nil?
14
+ # end
15
+
16
+ def keys
17
+ @keys ||= Settings.json_keys.split(",")
18
+ end
19
+
20
+ def into_json record, exclude=[]
21
+ json_hash = Hash.new
22
+ keys.each_with_index do |key, index|
23
+ next if exclude.include?(key)
24
+ json_hash[key] = record[index]
25
+ end
26
+ return JSON.generate(json_hash)
27
+ end
28
+
29
+ end
data/lib/imw.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
- Bundler.setup
3
+ require 'bundler/setup'
4
4
  require 'imw/boot'
5
5
  require 'imw/utils'
6
6
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imw
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 11
10
- version: 0.2.11
9
+ - 12
10
+ version: 0.2.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dhruv Bansal
@@ -16,13 +16,14 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-15 00:00:00 -06:00
20
- default_executable: imw
19
+ date: 2010-11-17 00:00:00 -06:00
20
+ default_executable:
21
21
  dependencies: []
22
22
 
23
23
  description: The Infinite Monkeywrench (IMW) is a Ruby frameworks to simplify the tasks of acquiring, extracting, transforming, loading, and packaging data. It minimizes programmer time by encapsulating common data workflows and patterns and creating interfaces to many other useful Ruby libraries.
24
24
  email: coders@infochimps.org
25
25
  executables:
26
+ - tsv_to_json.rb
26
27
  - imw
27
28
  extensions: []
28
29
 
@@ -38,6 +39,7 @@ files:
38
39
  - Rakefile
39
40
  - VERSION
40
41
  - bin/imw
42
+ - bin/tsv_to_json.rb
41
43
  - etc/imwrc.rb
42
44
  - examples/dataset.rb
43
45
  - examples/metadata.yml