loady 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/.rvmrc +1 -0
- data/Gemfile.lock +3 -1
- data/README.rdoc +14 -2
- data/lib/loady/array.rb +4 -3
- data/lib/loady/version.rb +1 -1
- data/loady.gemspec +1 -0
- metadata +48 -43
data/.gitignore
CHANGED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.3
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
loady (0.
|
4
|
+
loady (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
+
rake (0.9.2.2)
|
9
10
|
shoulda (2.11.3)
|
10
11
|
test-unit (2.1.2)
|
11
12
|
|
@@ -14,5 +15,6 @@ PLATFORMS
|
|
14
15
|
|
15
16
|
DEPENDENCIES
|
16
17
|
loady!
|
18
|
+
rake
|
17
19
|
shoulda
|
18
20
|
test-unit
|
data/README.rdoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= Loady - A CSV file loader with simple logging
|
2
2
|
|
3
|
-
Loady is a simple file reader and logger. Use it to quickly load
|
3
|
+
Loady is a simple file reader and logger. Use it to quickly load any delimited file, continue on error rows, and do basic logging.
|
4
4
|
|
5
|
-
It works with ruby 1.9.
|
5
|
+
It works with ruby 1.9. It uses ruby's CSV library to parse rows.
|
6
6
|
|
7
7
|
== Install
|
8
8
|
|
@@ -39,3 +39,15 @@ Name your attributes:
|
|
39
39
|
Monkey.create row.to_attributes [:name, :year, :mom]
|
40
40
|
end
|
41
41
|
|
42
|
+
Load a tab-delimited file:
|
43
|
+
|
44
|
+
Loady.csv "/your/file.tab", :col_sep => "\t" do |row|
|
45
|
+
# go bananas
|
46
|
+
end
|
47
|
+
|
48
|
+
== Development
|
49
|
+
|
50
|
+
git clone git://github.com/stackpilot/loady.git
|
51
|
+
cd loady
|
52
|
+
bundle
|
53
|
+
bundle exec rake test
|
data/lib/loady/array.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
class Array
|
2
2
|
|
3
3
|
# usage:
|
4
|
-
# ['john', 'doe'].to_attributes([:first, :last])
|
4
|
+
# ['john', 'doe'].to_attributes([:first, :last])
|
5
|
+
# => { :first => 'john', :last => 'doe' }
|
5
6
|
#
|
6
7
|
# options:
|
7
|
-
# :strip =>
|
8
|
+
# :strip => false -- default = true
|
8
9
|
# -- array values must be strings if :strip is true
|
9
10
|
def to_attributes(names, options={})
|
10
|
-
options =
|
11
|
+
options = {:strip => true}.merge(options)
|
11
12
|
|
12
13
|
h = {}
|
13
14
|
|
data/lib/loady/version.rb
CHANGED
data/loady.gemspec
CHANGED
metadata
CHANGED
@@ -1,50 +1,58 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: loady
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Tee Parham
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: test-unit
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2152353540 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :development
|
25
|
-
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2152353540
|
25
|
+
- !ruby/object:Gem::Dependency
|
27
26
|
name: shoulda
|
27
|
+
requirement: &2152352480 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
28
34
|
prerelease: false
|
29
|
-
|
35
|
+
version_requirements: *2152352480
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &2152351920 !ruby/object:Gem::Requirement
|
30
39
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
35
44
|
type: :development
|
36
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152351920
|
37
47
|
description: CSV file loader with simple logging
|
38
|
-
email:
|
48
|
+
email:
|
39
49
|
- tee@stackpilot.com
|
40
50
|
executables: []
|
41
|
-
|
42
51
|
extensions: []
|
43
|
-
|
44
52
|
extra_rdoc_files: []
|
45
|
-
|
46
|
-
files:
|
53
|
+
files:
|
47
54
|
- .gitignore
|
55
|
+
- .rvmrc
|
48
56
|
- Gemfile
|
49
57
|
- Gemfile.lock
|
50
58
|
- README.rdoc
|
@@ -62,32 +70,29 @@ files:
|
|
62
70
|
- test/test_loady.rb
|
63
71
|
homepage: http://github.com/stackpilot/loady
|
64
72
|
licenses: []
|
65
|
-
|
66
73
|
post_install_message:
|
67
74
|
rdoc_options: []
|
68
|
-
|
69
|
-
require_paths:
|
75
|
+
require_paths:
|
70
76
|
- lib
|
71
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
78
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version:
|
77
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
84
|
none: false
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version:
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
83
89
|
requirements: []
|
84
|
-
|
85
90
|
rubyforge_project: loady
|
86
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.8.10
|
87
92
|
signing_key:
|
88
93
|
specification_version: 3
|
89
94
|
summary: CSV file loader with simple logging
|
90
|
-
test_files:
|
95
|
+
test_files:
|
91
96
|
- test/csv/file1.csv
|
92
97
|
- test/csv/file2.csv
|
93
98
|
- test/csv/file3.dat
|