csv_record 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # CsvRecord
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/lukasalexandre/csv_record.png)](http://travis-ci.org/lukasalexandre/csv_record) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/lukasalexandre/csv_record)
4
+
3
5
  CSV Record connects classes to CSV documents database to establish an almost zero-configuration persistence layer for applications.
4
6
 
5
7
  ## Installation
@@ -25,6 +27,8 @@ $ gem install csv_record
25
27
  ## Usage
26
28
 
27
29
  ```ruby
30
+ requite 'csv_record'
31
+
28
32
  class Car
29
33
  include CsvRecord::Document
30
34
  end
@@ -49,10 +53,10 @@ car.destroy # removes the record from the database
49
53
 
50
54
  car.new_record? # checks if the record is new
51
55
 
52
- Class.all # retrieves all saved records
56
+ Car.all # retrieves all saved records
53
57
 
54
- Class.find car.id # find through its id
55
- Class.find car # find through the record
58
+ Car.find car.id # find through its id
59
+ Car.find car # find through the record
56
60
 
57
61
  Car.count # returns the amount of records in the database
58
62
  ```
data/csv_record.gemspec CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/csv_record/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Lukas Alexandre"]
6
- gem.email = ["lukeskytm@gmail.com"]
6
+ gem.email = ["lukasalexandre@gmail.com"]
7
7
  gem.description = %q{CSV Object-relational mapping}
8
8
  gem.summary = %q{CSV Record connects classes to CSV documents database to establish an almost zero-configuration persistence layer for applications.}
9
9
  gem.homepage = "https://github.com/lukasalexandre/csv_record"
@@ -1,3 +1,3 @@
1
1
  module CsvRecord
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -45,11 +45,11 @@ module CsvRecord
45
45
  protected
46
46
 
47
47
  def calculate_id
48
- @id = Car.count + 1
48
+ @id = self.class.count + 1
49
49
  end
50
50
 
51
51
  def append_registry
52
- Car.initialize_db
52
+ self.class.initialize_db
53
53
  set_created_at
54
54
  write_object
55
55
  end
@@ -51,24 +51,41 @@ describe CsvRecord::Reader do
51
51
  Car.count.must_equal 2
52
52
  end
53
53
 
54
- it 'querying by id' do
55
- cars = []
56
- 3.times do
57
- cars << car.clone
58
- cars.last.save
54
+ describe 'simple query' do
55
+ it 'querying by id' do
56
+ cars = []
57
+ 3.times do
58
+ cars << car.clone
59
+ cars.last.save
60
+ end
61
+ Car.find(cars.first.id).wont_be_nil
62
+ Car.find(cars.first.id).must_be_instance_of Car
63
+ end
64
+
65
+ it 'querying by object' do
66
+ cars = []
67
+ 3.times do
68
+ cars << car.clone
69
+ cars.last.save
70
+ end
71
+ Car.find(cars.first).wont_be_nil
72
+ Car.find(cars.first.id).must_be_instance_of Car
59
73
  end
60
- Car.find(cars.first.id).wont_be_nil
61
- Car.find(cars.first.id).must_be_instance_of Car
62
74
  end
63
75
 
64
- it 'querying by object' do
65
- cars = []
66
- 3.times do
67
- cars << car.clone
68
- cars.last.save
76
+ describe 'complex queries' do
77
+ it 'with params' do
78
+ car.save
79
+ second_car.save
80
+ Car.find(
81
+ year: 1997,
82
+ make: 'Ford'
83
+ )
84
+ end
85
+
86
+ it 'dinamyc finders' do
87
+
69
88
  end
70
- Car.find(cars.first).wont_be_nil
71
- Car.find(cars.first.id).must_be_instance_of Car
72
89
  end
73
90
  end
74
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-29 00:00:00.000000000 Z
12
+ date: 2012-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -61,12 +61,13 @@ dependencies:
61
61
  version: '0'
62
62
  description: CSV Object-relational mapping
63
63
  email:
64
- - lukeskytm@gmail.com
64
+ - lukasalexandre@gmail.com
65
65
  executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
69
  - .gitignore
70
+ - .travis.yml
70
71
  - Gemfile
71
72
  - LICENSE
72
73
  - README.md