plain_record 0.4 → 0.4.1
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/.travis.yml +2 -0
- data/ChangeLog +3 -0
- data/Gemfile.lock +3 -3
- data/lib/plain_record.rb +0 -2
- data/lib/plain_record/model.rb +1 -1
- data/lib/plain_record/model/entry.rb +2 -1
- data/lib/plain_record/model/list.rb +1 -1
- data/lib/plain_record/resource.rb +11 -3
- data/lib/plain_record/version.rb +1 -1
- data/spec/image_spec.rb +5 -0
- data/spec/resource_spec.rb +7 -8
- data/spec/spec_helper.rb +7 -4
- metadata +3 -3
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,7 +6,7 @@ GEM
|
|
6
6
|
r18n-core (1.1.3)
|
7
7
|
rake (10.0.3)
|
8
8
|
redcarpet (2.2.2)
|
9
|
-
rmagick (2.13.
|
9
|
+
rmagick (2.13.2)
|
10
10
|
rspec (2.12.0)
|
11
11
|
rspec-core (~> 2.12.0)
|
12
12
|
rspec-expectations (~> 2.12.0)
|
@@ -14,8 +14,8 @@ GEM
|
|
14
14
|
rspec-core (2.12.2)
|
15
15
|
rspec-expectations (2.12.1)
|
16
16
|
diff-lcs (~> 1.1.3)
|
17
|
-
rspec-mocks (2.12.
|
18
|
-
yard (0.8.
|
17
|
+
rspec-mocks (2.12.2)
|
18
|
+
yard (0.8.4.1)
|
19
19
|
|
20
20
|
PLATFORMS
|
21
21
|
ruby
|
data/lib/plain_record.rb
CHANGED
@@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
21
|
require 'pathname'
|
22
22
|
require 'yaml'
|
23
23
|
|
24
|
-
YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE
|
25
|
-
|
26
24
|
dir = Pathname(__FILE__).dirname.expand_path + 'plain_record'
|
27
25
|
require dir + 'version'
|
28
26
|
require dir + 'callbacks'
|
data/lib/plain_record/model.rb
CHANGED
@@ -119,9 +119,17 @@ module PlainRecord
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
# Return
|
123
|
-
def
|
124
|
-
|
122
|
+
# Return model data with plain hash of all child data
|
123
|
+
def data_recursive
|
124
|
+
hash = { }
|
125
|
+
@data.each_pair do |key, value|
|
126
|
+
hash[key] = if value.respond_to? :data_recursive
|
127
|
+
value.data_recursive
|
128
|
+
else
|
129
|
+
value
|
130
|
+
end
|
131
|
+
end
|
132
|
+
hash
|
125
133
|
end
|
126
134
|
|
127
135
|
# Compare if its fields and texts are equal.
|
data/lib/plain_record/version.rb
CHANGED
data/spec/image_spec.rb
CHANGED
@@ -72,6 +72,8 @@ describe PlainRecord::Extra::Image do
|
|
72
72
|
File.should_receive(:exists?).
|
73
73
|
with(PlainRecord.root('a/photo.png')).and_return(true)
|
74
74
|
|
75
|
+
FileUtils.stub!(:mkpath)
|
76
|
+
FileUtils.should_receive(:mkpath).with('images/data')
|
75
77
|
FileUtils.stub!(:cp)
|
76
78
|
FileUtils.should_receive(:cp).
|
77
79
|
with(PlainRecord.root('a/photo.png'), 'images/data/photo..png')
|
@@ -84,6 +86,9 @@ describe PlainRecord::Extra::Image do
|
|
84
86
|
File.should_receive(:exists?).
|
85
87
|
with(PlainRecord.root('a/logo.png')).and_return(true)
|
86
88
|
|
89
|
+
FileUtils.stub!(:mkpath)
|
90
|
+
FileUtils.should_receive(:mkpath).with('images/data')
|
91
|
+
|
87
92
|
thumb = double('thumb')
|
88
93
|
thumb.stub!(:write)
|
89
94
|
thumb.should_receive(:write).with('images/data/logo.small.png')
|
data/spec/resource_spec.rb
CHANGED
@@ -28,14 +28,13 @@ describe PlainRecord::Resource do
|
|
28
28
|
first = Post.first(:title => 'First')
|
29
29
|
first.save
|
30
30
|
|
31
|
-
file.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
"content\n"
|
31
|
+
file.string.should == "title: First\n" +
|
32
|
+
"---\n" +
|
33
|
+
"first --- content\n" +
|
34
|
+
"---\n" +
|
35
|
+
"big\n" +
|
36
|
+
"---\n" +
|
37
|
+
"content\n"
|
39
38
|
end
|
40
39
|
|
41
40
|
it "should save list entry" do
|
data/spec/spec_helper.rb
CHANGED
@@ -55,10 +55,13 @@ RSpec::Matchers.define :has_methods do |*methods|
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
RSpec::Matchers.define :has_yaml do |
|
59
|
-
match do |
|
60
|
-
|
61
|
-
|
58
|
+
RSpec::Matchers.define :has_yaml do |expected|
|
59
|
+
match do |actual|
|
60
|
+
YAML.load(actual.string).should == expected
|
61
|
+
end
|
62
|
+
|
63
|
+
failure_message_for_should do |actual|
|
64
|
+
"expected #{expected.inspect} to equal #{YAML.load(actual.string)}"
|
62
65
|
end
|
63
66
|
end
|
64
67
|
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: plain_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 0.4.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrey "A.I." Sitnik
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
type: :runtime
|
@@ -228,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
segments:
|
230
230
|
- 0
|
231
|
-
hash: -
|
231
|
+
hash: -3581892843472371509
|
232
232
|
version: '0'
|
233
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
234
|
none: false
|