gitmodel 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitmodel (0.0.0)
4
+ gitmodel (0.0.2)
5
5
  activemodel (>= 3.0.1)
6
6
  activesupport (>= 3.0.1)
7
7
  grit (>= 2.3.0)
@@ -10,45 +10,40 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- ZenTest (4.4.0)
14
- activemodel (3.0.1)
15
- activesupport (= 3.0.1)
13
+ ZenTest (4.5.0)
14
+ activemodel (3.0.4)
15
+ activesupport (= 3.0.4)
16
16
  builder (~> 2.1.2)
17
- i18n (~> 0.4.1)
18
- activesupport (3.0.1)
19
- autotest (4.4.1)
20
- autotest-fsevent (0.2.3)
17
+ i18n (~> 0.4)
18
+ activesupport (3.0.4)
19
+ autotest (4.4.6)
20
+ ZenTest (>= 4.4.1)
21
+ autotest-fsevent (0.2.4)
21
22
  sys-uname
22
23
  builder (2.1.2)
23
24
  diff-lcs (1.1.2)
24
- grit (2.3.0)
25
+ grit (2.4.1)
25
26
  diff-lcs (~> 1.1)
26
27
  mime-types (~> 1.15)
27
- i18n (0.4.1)
28
+ i18n (0.5.0)
28
29
  lockfile (1.4.3)
29
30
  mime-types (1.16)
30
- rspec (2.0.1)
31
- rspec-core (~> 2.0.1)
32
- rspec-expectations (~> 2.0.1)
33
- rspec-mocks (~> 2.0.1)
34
- rspec-core (2.0.1)
35
- rspec-expectations (2.0.1)
36
- diff-lcs (>= 1.1.2)
37
- rspec-mocks (2.0.1)
38
- rspec-core (~> 2.0.1)
39
- rspec-expectations (~> 2.0.1)
40
- sys-uname (0.8.4)
31
+ rspec (2.5.0)
32
+ rspec-core (~> 2.5.0)
33
+ rspec-expectations (~> 2.5.0)
34
+ rspec-mocks (~> 2.5.0)
35
+ rspec-core (2.5.1)
36
+ rspec-expectations (2.5.0)
37
+ diff-lcs (~> 1.1.2)
38
+ rspec-mocks (2.5.0)
39
+ sys-uname (0.8.5)
41
40
 
42
41
  PLATFORMS
43
42
  ruby
44
43
 
45
44
  DEPENDENCIES
46
45
  ZenTest (>= 4.4.0)
47
- activemodel (>= 3.0.1)
48
- activesupport (>= 3.0.1)
49
46
  autotest (>= 4.4.1)
50
47
  autotest-fsevent (>= 0.2.3)
51
48
  gitmodel!
52
- grit (>= 2.3.0)
53
- lockfile (>= 1.4.3)
54
49
  rspec (>= 2.0.1)
data/README.md CHANGED
@@ -48,6 +48,14 @@ Why it's awesome
48
48
  * Clean and easy-to-use API
49
49
 
50
50
 
51
+ Installation
52
+ ------------
53
+
54
+ It's available as a [RubyGem](https://rubygems.org/gems/gitmodel):
55
+
56
+ > gem install gitmodel
57
+
58
+
51
59
  Usage
52
60
  -----
53
61
 
@@ -63,7 +71,6 @@ Usage
63
71
  attribute :allow_comments, :default => true
64
72
 
65
73
  blob :image
66
-
67
74
  end
68
75
 
69
76
  p1 = Post.new(:id => 'lessons-learned', :title => 'Lessons learned', :body => '...')
@@ -81,7 +88,6 @@ Usage
81
88
 
82
89
  p4 = Post.find('running-with-scissors')
83
90
 
84
-
85
91
  class Comment
86
92
  include GitModel::Persistable
87
93
  attribute :text
@@ -90,6 +96,8 @@ Usage
90
96
  c1 = Comment.create!(:id => '2010-01-03-328', :text => '...')
91
97
  c2 = Comment.create!(:id => '2010-05-29-742', :text => '...')
92
98
 
99
+ An example of a project that uses GitModel is [Balisong](https://github.com/pauldowman/balisong), a blogging app for coders (but it doesn't save objects to the data store. It's read-only so far, assuming that posts will be edited with a text editor).
100
+
93
101
 
94
102
  Database file structure
95
103
  -----------------------
@@ -125,10 +133,16 @@ structure that looks like this:
125
133
  * running-with-scissors
126
134
  * _attributes.json_
127
135
 
136
+ Contributors
137
+ ------------
138
+
139
+ * [Paul Dowman](http://pauldowman.com/about) ([@pauldowman](http://twitter.com/pauldowman))
140
+
128
141
 
129
142
  To Do
130
143
  -----
131
144
 
145
+ * Add validations and other feature examples to sample code in README
132
146
  * Querying
133
147
  * Use AREL?
134
148
  * Finish some pending specs
data/gitmodel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gitmodel'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.platform = Gem::Platform::RUBY
5
5
 
6
6
  s.authors = ["Paul Dowman"]
@@ -97,7 +97,10 @@ module GitModel
97
97
  transaction = options.delete(:transaction) || GitModel::Transaction.new(options)
98
98
  result = transaction.execute do |t|
99
99
  # Write the attributes to the attributes file
100
- t.index.add(File.join(dir, 'attributes.json'), JSON.pretty_generate(attributes))
100
+ # NOTE: using the redundant attributes.to_hash to work around a bug in
101
+ # active_support 3.0.4, remove when
102
+ # JSON.generate(HashWithIndifferentAccess.new) no longer fails.
103
+ t.index.add(File.join(dir, 'attributes.json'), JSON.pretty_generate(attributes.to_hash))
101
104
 
102
105
  # Write the blob files
103
106
  blobs.each do |name, data|
@@ -187,6 +190,7 @@ module GitModel
187
190
  def find_all(conditions = {})
188
191
  GitModel.logger.debug "Finding all #{name.pluralize} with conditions: #{conditions.inspect}"
189
192
  results = []
193
+ return results unless GitModel.current_tree
190
194
  dirs = (GitModel.current_tree / db_subdir).trees
191
195
  dirs.each do |dir|
192
196
  if dir.blobs.any?
@@ -327,6 +327,11 @@ describe GitModel::Persistable do
327
327
  r.size.should == 3
328
328
  end
329
329
 
330
+ it 'returns an empty array if there are no objects of the current type' do
331
+ r = TestEntity.find_all
332
+ r.should == []
333
+ end
334
+
330
335
  end
331
336
 
332
337
  describe '#exists?' do
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitmodel
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 1
9
- version: 0.0.1
4
+ prerelease:
5
+ version: 0.0.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - Paul Dowman
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-11-10 00:00:00 -05:00
13
+ date: 2011-02-19 00:00:00 -05:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 0
31
- - 1
32
24
  version: 3.0.1
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,10 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 3
45
- - 0
46
- - 1
47
35
  version: 3.0.1
48
36
  type: :runtime
49
37
  version_requirements: *id002
@@ -55,10 +43,6 @@ dependencies:
55
43
  requirements:
56
44
  - - ">="
57
45
  - !ruby/object:Gem::Version
58
- segments:
59
- - 2
60
- - 3
61
- - 0
62
46
  version: 2.3.0
63
47
  type: :runtime
64
48
  version_requirements: *id003
@@ -70,10 +54,6 @@ dependencies:
70
54
  requirements:
71
55
  - - ">="
72
56
  - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 4
76
- - 3
77
57
  version: 1.4.3
78
58
  type: :runtime
79
59
  version_requirements: *id004
@@ -85,10 +65,6 @@ dependencies:
85
65
  requirements:
86
66
  - - ">="
87
67
  - !ruby/object:Gem::Version
88
- segments:
89
- - 4
90
- - 4
91
- - 0
92
68
  version: 4.4.0
93
69
  type: :development
94
70
  version_requirements: *id005
@@ -100,10 +76,6 @@ dependencies:
100
76
  requirements:
101
77
  - - ">="
102
78
  - !ruby/object:Gem::Version
103
- segments:
104
- - 4
105
- - 4
106
- - 1
107
79
  version: 4.4.1
108
80
  type: :development
109
81
  version_requirements: *id006
@@ -115,10 +87,6 @@ dependencies:
115
87
  requirements:
116
88
  - - ">="
117
89
  - !ruby/object:Gem::Version
118
- segments:
119
- - 0
120
- - 2
121
- - 3
122
90
  version: 0.2.3
123
91
  type: :development
124
92
  version_requirements: *id007
@@ -130,10 +98,6 @@ dependencies:
130
98
  requirements:
131
99
  - - ">="
132
100
  - !ruby/object:Gem::Version
133
- segments:
134
- - 2
135
- - 0
136
- - 1
137
101
  version: 2.0.1
138
102
  type: :development
139
103
  version_requirements: *id008
@@ -155,7 +119,6 @@ files:
155
119
  - LICENSE
156
120
  - README.md
157
121
  - Rakefile
158
- - autotest/discover.rb
159
122
  - gitmodel.gemspec
160
123
  - lib/gitmodel.rb
161
124
  - lib/gitmodel/errors.rb
@@ -180,21 +143,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
143
  requirements:
181
144
  - - ">="
182
145
  - !ruby/object:Gem::Version
183
- segments:
184
- - 0
185
146
  version: "0"
186
147
  required_rubygems_version: !ruby/object:Gem::Requirement
187
148
  none: false
188
149
  requirements:
189
150
  - - ">="
190
151
  - !ruby/object:Gem::Version
191
- segments:
192
- - 0
193
152
  version: "0"
194
153
  requirements: []
195
154
 
196
155
  rubyforge_project:
197
- rubygems_version: 1.3.7
156
+ rubygems_version: 1.5.0
198
157
  signing_key:
199
158
  specification_version: 3
200
159
  summary: An ActiveModel-compliant persistence framework for Ruby that uses Git for versioning and remote syncing.
data/autotest/discover.rb DELETED
@@ -1 +0,0 @@
1
- Autotest.add_discovery { "rspec2" }