loady 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +1 -1
- data/README.md +71 -0
- data/lib/loady/version.rb +1 -1
- data/loady.gemspec +5 -4
- data/test/test_helper.rb +2 -1
- metadata +28 -41
- data/.rvmrc +0 -1
- data/README.rdoc +0 -53
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 73912330c3f4b5362b36e18a110532db84d4635e
|
4
|
+
data.tar.gz: 0f8a2bd49e4eb00fde4aff8ffe79fad9d24553e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e30064023249f1baaa1945a7f2b2a522d238f7c5742f2c8c591fcd50e28b8c96325dc6eeca86eca276485a46a73bf77c80a1d7fc9a30c001a57ffda3a4dd394
|
7
|
+
data.tar.gz: 0ee3605df2936c3a96deff8b6e1f8edabe9f6776d4c7e180f70c25382ddca6948813617c1d43cb65e4a510653c211465d78c66c13c7c1fca0988250639afc9c4
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/loady.png)](http://badge.fury.io/rb/loady)
|
2
|
+
[![Build Status](https://api.travis-ci.org/teeparham/loady.png)](https://travis-ci.org/teeparham/loady)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/teeparham/loady.png)](https://codeclimate.com/github/teeparham/loady)
|
4
|
+
|
5
|
+
# Loady - A file loader with simple logging
|
6
|
+
|
7
|
+
Loady is a simple file reader and logger. Use it to quickly load any delimited file, continue on error rows, and do basic logging.
|
8
|
+
|
9
|
+
It works with MRI ruby 1.9 and 2.0. It uses ruby's CSV library to parse rows.
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
``` ruby
|
14
|
+
gem install loady
|
15
|
+
```
|
16
|
+
|
17
|
+
Or include the gem in your Gemfile:
|
18
|
+
|
19
|
+
``` ruby
|
20
|
+
gem 'loady'
|
21
|
+
```
|
22
|
+
|
23
|
+
## Use
|
24
|
+
|
25
|
+
If an error occurs, Loady will continue reading the file, ignoring problem rows and logging a warning for each.
|
26
|
+
|
27
|
+
By default, messages are logged to the standard output.
|
28
|
+
|
29
|
+
### Basic usage:
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
Loady.read "/your/file.csv" do |row|
|
33
|
+
# your code to process each row goes here
|
34
|
+
puts "#{row[0]}, #{row[1]}, etc."
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
### Skip the first row and log to a file:
|
39
|
+
|
40
|
+
``` ruby
|
41
|
+
logger = Logger.new "/your/file.log"
|
42
|
+
|
43
|
+
Loady.read "/your/file.csv", logger: logger, skip_first_row: true do |row|
|
44
|
+
# do some stuff for each row
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
### Name your attributes:
|
49
|
+
|
50
|
+
``` ruby
|
51
|
+
Loady.read "/your/file.csv" do |row|
|
52
|
+
Monkey.create row.to_attributes [:name, :year, :mom]
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
### Load a tab-delimited file:
|
57
|
+
|
58
|
+
``` ruby
|
59
|
+
Loady.read "/your/file.tab", col_sep: "\t" do |row|
|
60
|
+
# go bananas
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
## Development
|
65
|
+
|
66
|
+
```
|
67
|
+
git clone git://github.com/teeparham/loady.git
|
68
|
+
cd loady
|
69
|
+
bundle
|
70
|
+
bundle exec rake
|
71
|
+
```
|
data/lib/loady/version.rb
CHANGED
data/loady.gemspec
CHANGED
@@ -11,16 +11,17 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = "http://github.com/teeparham/loady"
|
12
12
|
s.summary = %q{CSV file loader with simple logging}
|
13
13
|
s.description = %q{CSV file loader with simple logging}
|
14
|
-
|
15
|
-
s.rubyforge_project = "loady"
|
14
|
+
s.license = "MIT"
|
16
15
|
|
17
16
|
s.files = `git ls-files`.split("\n")
|
18
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
s.executables =
|
18
|
+
s.executables = []
|
20
19
|
s.require_paths = %w(lib)
|
21
20
|
|
21
|
+
s.required_ruby_version = '>=1.9.2'
|
22
|
+
|
22
23
|
s.add_development_dependency "mocha"
|
23
24
|
s.add_development_dependency "rake"
|
24
|
-
s.add_development_dependency "shoulda"
|
25
|
+
s.add_development_dependency "shoulda-context"
|
25
26
|
s.add_development_dependency "test-unit"
|
26
27
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,80 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loady
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.7.0
|
4
|
+
version: 0.7.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tee Parham
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: mocha
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
21
|
+
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
23
|
requirements:
|
26
|
-
- -
|
24
|
+
- - '>='
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '0'
|
29
|
-
prerelease: false
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
35
|
+
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '0'
|
45
|
-
prerelease: false
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name: shoulda
|
42
|
+
name: shoulda-context
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
49
|
+
prerelease: false
|
55
50
|
version_requirements: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - '>='
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
|
-
prerelease: false
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: test-unit
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
63
|
+
prerelease: false
|
71
64
|
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
65
|
requirements:
|
74
|
-
- -
|
66
|
+
- - '>='
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: '0'
|
77
|
-
prerelease: false
|
78
69
|
description: CSV file loader with simple logging
|
79
70
|
email:
|
80
71
|
- tee@neighborland.com
|
@@ -83,9 +74,10 @@ extensions: []
|
|
83
74
|
extra_rdoc_files: []
|
84
75
|
files:
|
85
76
|
- .gitignore
|
86
|
-
- .
|
77
|
+
- .ruby-version
|
78
|
+
- .travis.yml
|
87
79
|
- Gemfile
|
88
|
-
- README.
|
80
|
+
- README.md
|
89
81
|
- Rakefile
|
90
82
|
- lib/loady.rb
|
91
83
|
- lib/loady/attribute_array.rb
|
@@ -101,34 +93,28 @@ files:
|
|
101
93
|
- test/test_helper.rb
|
102
94
|
- test/test_memory_logger.rb
|
103
95
|
homepage: http://github.com/teeparham/loady
|
104
|
-
licenses:
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
105
99
|
post_install_message:
|
106
100
|
rdoc_options: []
|
107
101
|
require_paths:
|
108
102
|
- lib
|
109
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
104
|
requirements:
|
112
|
-
- -
|
105
|
+
- - '>='
|
113
106
|
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
- 0
|
116
|
-
hash: 1518214605886805454
|
117
|
-
version: '0'
|
107
|
+
version: 1.9.2
|
118
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
109
|
requirements:
|
121
|
-
- -
|
110
|
+
- - '>='
|
122
111
|
- !ruby/object:Gem::Version
|
123
|
-
segments:
|
124
|
-
- 0
|
125
|
-
hash: 1518214605886805454
|
126
112
|
version: '0'
|
127
113
|
requirements: []
|
128
|
-
rubyforge_project:
|
129
|
-
rubygems_version:
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.0.5
|
130
116
|
signing_key:
|
131
|
-
specification_version:
|
117
|
+
specification_version: 4
|
132
118
|
summary: CSV file loader with simple logging
|
133
119
|
test_files:
|
134
120
|
- test/csv/file1.csv
|
@@ -138,3 +124,4 @@ test_files:
|
|
138
124
|
- test/test_csv_loader.rb
|
139
125
|
- test/test_helper.rb
|
140
126
|
- test/test_memory_logger.rb
|
127
|
+
has_rdoc:
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm 1.9.3
|
data/README.rdoc
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
= Loady - A CSV file loader with simple logging
|
2
|
-
|
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
|
-
|
5
|
-
It works with ruby 1.9. It uses ruby's CSV library to parse rows.
|
6
|
-
|
7
|
-
== Install
|
8
|
-
|
9
|
-
gem install loady
|
10
|
-
|
11
|
-
Or include the gem in your Gemfile:
|
12
|
-
|
13
|
-
gem 'loady'
|
14
|
-
|
15
|
-
== Use
|
16
|
-
|
17
|
-
If an error occurs, Loady will continue reading the file, ignoring problem rows and logging a warning for each.
|
18
|
-
|
19
|
-
By default, messages are logged to the standard output.
|
20
|
-
|
21
|
-
Basic usage:
|
22
|
-
|
23
|
-
Loady.read "/your/file.csv" do |row|
|
24
|
-
# your code to process each row goes here
|
25
|
-
puts "#{row[0]}, #{row[1]}, etc."
|
26
|
-
end
|
27
|
-
|
28
|
-
Skip the first row and log to a file:
|
29
|
-
|
30
|
-
logger = Logger.new "/your/file.log"
|
31
|
-
|
32
|
-
Loady.read "/your/file.csv", logger: logger, skip_first_row: true do |row|
|
33
|
-
# do some stuff for each row
|
34
|
-
end
|
35
|
-
|
36
|
-
Name your attributes:
|
37
|
-
|
38
|
-
Loady.read "/your/file.csv" do |row|
|
39
|
-
Monkey.create row.to_attributes [:name, :year, :mom]
|
40
|
-
end
|
41
|
-
|
42
|
-
Load a tab-delimited file:
|
43
|
-
|
44
|
-
Loady.read "/your/file.tab", col_sep: "\t" do |row|
|
45
|
-
# go bananas
|
46
|
-
end
|
47
|
-
|
48
|
-
== Development
|
49
|
-
|
50
|
-
git clone git://github.com/teeparham/loady.git
|
51
|
-
cd loady
|
52
|
-
bundle
|
53
|
-
bundle exec rake
|