gom-filesystem-adapter 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,9 +17,11 @@ specified.
17
17
  === Example
18
18
 
19
19
  GOM::Storage.configure {
20
- name :storage_name
21
- adapter :filesystem
22
- directory "/var/project-name/data"
20
+ storage {
21
+ name :storage_name
22
+ adapter :filesystem
23
+ directory "/var/project-name/data"
24
+ }
23
25
  }
24
26
 
25
27
  == Files
@@ -10,7 +10,11 @@ class GOM::Storage::Filesystem::Collection::Fetcher
10
10
  end
11
11
 
12
12
  def drafts
13
- @drafts.values.select{ |draft| draft.class_name == @view.class_name }
13
+ if @view.is_a?(GOM::Storage::Configuration::View::All)
14
+ @drafts.values.select{ |draft| !draft.class_name.nil? }
15
+ else
16
+ @drafts.values.select{ |draft| draft.class_name == @view.class_name.to_s }
17
+ end
14
18
  end
15
19
 
16
20
  end
@@ -1,12 +1,12 @@
1
1
 
2
2
  object_1:
3
- class: GOM::Spec::Object
3
+ class: "GOM::Spec::Object"
4
4
  properties:
5
5
  number: 5
6
6
  relations:
7
- related_object: test_storage:object_2
7
+ related_object: "test_storage:object_2"
8
8
 
9
9
  object_2:
10
- class: GOM::Spec::Object
10
+ class: "GOM::Spec::Object"
11
11
  properties:
12
12
  number: 7
@@ -5,18 +5,42 @@ describe GOM::Storage::Filesystem::Collection::Fetcher do
5
5
  before :each do
6
6
  @draft_one = mock GOM::Object::Draft, :class_name => "Object"
7
7
  @draft_two = mock GOM::Object::Draft, :class_name => "Test"
8
- @drafts = mock Hash, :values => [ @draft_one, @draft_two ]
9
- @view = mock GOM::Storage::Configuration::View::Class, :class_name => "Object"
8
+ @draft_three = mock GOM::Object::Draft, :class_name => nil
9
+ @drafts = mock Hash, :values => [ @draft_one, @draft_two, @draft_three ]
10
10
 
11
11
  @fetcher = described_class.new @drafts, @view
12
12
  end
13
13
 
14
14
  describe "drafts" do
15
15
 
16
- it "should return an array with a selection of drafts" do
17
- drafts = @fetcher.drafts
18
- drafts.should include(@draft_one)
19
- drafts.should_not include(@draft_two)
16
+ context "for an all view" do
17
+
18
+ before :each do
19
+ @fetcher.view = GOM::Storage::Configuration::View::All.new
20
+ end
21
+
22
+ it "should return all drafts with a model class attribute" do
23
+ drafts = @fetcher.drafts
24
+ drafts.should include(@draft_one)
25
+ drafts.should include(@draft_two)
26
+ drafts.should_not include(@draft_three)
27
+ end
28
+
29
+ end
30
+
31
+ context "for a class view" do
32
+
33
+ before :each do
34
+ @fetcher.view = GOM::Storage::Configuration::View::Class.new "Object"
35
+ end
36
+
37
+ it "should return an array with a selection of drafts" do
38
+ drafts = @fetcher.drafts
39
+ drafts.should include(@draft_one)
40
+ drafts.should_not include(@draft_two)
41
+ drafts.should_not include(@draft_three)
42
+ end
43
+
20
44
  end
21
45
 
22
46
  end
@@ -10,10 +10,14 @@ GOM::Storage.configure {
10
10
  name :test_storage
11
11
  adapter :filesystem
12
12
  files File.join(File.dirname(__FILE__), "acceptance", "data", "*.yml")
13
+ view {
14
+ name :test_all_view
15
+ kind :all
16
+ }
13
17
  view {
14
18
  name :test_object_class_view
15
19
  kind :class
16
- model_class Object
20
+ model_class GOM::Spec::Object
17
21
  }
18
22
  }
19
23
  }
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gom-filesystem-adapter
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 11
4
5
  prerelease:
5
- version: 0.4.1
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - "Philipp Br\xC3\xBCll"
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-05-30 00:00:00 +02:00
18
+ date: 2011-10-19 00:00:00 +02:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,7 +26,12 @@ dependencies:
21
26
  requirements:
22
27
  - - ">="
23
28
  - !ruby/object:Gem::Version
24
- version: 0.4.0
29
+ hash: 11
30
+ segments:
31
+ - 0
32
+ - 5
33
+ - 0
34
+ version: 0.5.0
25
35
  type: :runtime
26
36
  version_requirements: *id001
27
37
  - !ruby/object:Gem::Dependency
@@ -32,6 +42,9 @@ dependencies:
32
42
  requirements:
33
43
  - - ">="
34
44
  - !ruby/object:Gem::Version
45
+ hash: 7
46
+ segments:
47
+ - 2
35
48
  version: "2"
36
49
  type: :development
37
50
  version_requirements: *id002
@@ -43,6 +56,10 @@ dependencies:
43
56
  requirements:
44
57
  - - ">="
45
58
  - !ruby/object:Gem::Version
59
+ hash: 11
60
+ segments:
61
+ - 1
62
+ - 2
46
63
  version: "1.2"
47
64
  type: :development
48
65
  version_requirements: *id003
@@ -58,19 +75,19 @@ files:
58
75
  - README.rdoc
59
76
  - LICENSE
60
77
  - Rakefile
61
- - lib/gom/storage/filesystem/adapter.rb
62
- - lib/gom/storage/filesystem/loader.rb
78
+ - lib/gom/filesystem-adapter.rb
79
+ - lib/gom/storage/filesystem.rb
63
80
  - lib/gom/storage/filesystem/collection/fetcher.rb
81
+ - lib/gom/storage/filesystem/loader.rb
82
+ - lib/gom/storage/filesystem/adapter.rb
64
83
  - lib/gom/storage/filesystem/collection.rb
65
- - lib/gom/storage/filesystem.rb
66
- - lib/gom/filesystem-adapter.rb
67
84
  - lib/gom/storage.rb
85
+ - spec/spec_helper.rb
68
86
  - spec/gom/storage/filesystem/collection/fetcher_spec.rb
69
87
  - spec/gom/storage/filesystem/adapter_spec.rb
70
88
  - spec/gom/storage/filesystem/loader_spec.rb
71
- - spec/spec_helper.rb
72
- - spec/acceptance/data/objects.yml
73
89
  - spec/acceptance/adapter_spec.rb
90
+ - spec/acceptance/data/objects.yml
74
91
  has_rdoc: true
75
92
  homepage: http://github.com/phifty/gom-filesystem-adapter
76
93
  licenses: []
@@ -85,17 +102,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
102
  requirements:
86
103
  - - ">="
87
104
  - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
88
108
  version: "0"
89
109
  required_rubygems_version: !ruby/object:Gem::Requirement
90
110
  none: false
91
111
  requirements:
92
112
  - - ">="
93
113
  - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
94
117
  version: "0"
95
118
  requirements: []
96
119
 
97
120
  rubyforge_project: gom-filesystem-adapter
98
- rubygems_version: 1.6.1
121
+ rubygems_version: 1.6.2
99
122
  signing_key:
100
123
  specification_version: 3
101
124
  summary: Filesystem storage adapter for the General Object Mapper.