JSONRecord 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # JSONRecord
2
2
 
3
- JSONRecord is a minimal document storage for rails, with an active record style query interface.
3
+ JSONRecord is a minimal document storage for ruby, with an active record style query interface.
4
4
  It eventually aims to be as powerfull of other document stores like couchdb ... this is just a beginning.
5
- Inventual Roadmap is to make it independent of rails.
6
-
7
5
 
8
6
  ## Installation
9
7
 
@@ -39,11 +37,10 @@ Or install it yourself as:
39
37
  ##Methods include :
40
38
 
41
39
  ```ruby
42
-
43
- find(id)
44
- find_by_column_name("column_value")
45
- model_instance.update_attributes(:name => "pankaj" , :age => "29")
46
-
40
+ Model.find(id)
41
+ Model.find_by_column_name("column_value")
42
+ Model.find(id).update_attributes(:name => "pankaj" , :age => "29")
43
+ Model.find(id).destroy()
47
44
  ```
48
45
 
49
46
  also ,
@@ -53,7 +50,7 @@ Model.new({:name=> "pankaj" , :age => "29"}).save
53
50
  ```
54
51
 
55
52
  In your rails model: In order to define new attributes use `column` method
56
- i.e column :column_name , datetype
53
+ i.e column :column_name , datatype
57
54
 
58
55
 
59
56
  example => `column :name`
data/bin/jsonrecord CHANGED
@@ -4,7 +4,8 @@ require 'fileutils'
4
4
  require 'optparse'
5
5
  require 'active_support/inflector'
6
6
 
7
- tables_dir = File.expand_path('../../lib/tables',__FILE__)
7
+ gempath = Gem::Specification.find_by_name('JSONRecord').gem_dir
8
+ tables_dir = File.expand_path("#{gempath}/lib/tables",__FILE__)
8
9
 
9
10
  if ARGV[0] == 'generate' and ARGV[1] == 'model'
10
11
  model_name = ARGV[2].to_s.pluralize
@@ -57,7 +57,8 @@ module JSONRecord
57
57
  end
58
58
 
59
59
  private
60
- Dir.glob File.expand_path("../../tables/**/*.json", __FILE__) do |file|
60
+ gempath = Gem::Specification.find_by_name('JSONRecord').gem_dir
61
+ Dir.glob File.expand_path("#{gempath}/lib/tables/**/*.json", __FILE__) do |file|
61
62
  JSON_TABLES[File.basename(file)] = file
62
63
  end
63
64
 
@@ -1,3 +1,3 @@
1
1
  module JSONRecord
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
data/lib/loader.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  ["../JSONRecord/"].each{ |dir| $LOAD_PATH << File.expand_path(dir,__FILE__) }
2
2
 
3
3
  require 'version'
4
+ require 'fileutils'
4
5
  require 'yajl/json_gem'
5
6
  require 'active_model'
6
7
  require 'active_support/inflector'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: JSONRecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
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: 2013-03-13 00:00:00.000000000 Z
12
+ date: 2013-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport