mongoid-textile 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +22 -22
- data/lib/mongoid-textile/version.rb +1 -1
- data/lib/mongoid-textile.rb +3 -3
- data/mongoid-textile.gemspec +3 -1
- data/spec/mongoid-textile_spec.rb +9 -0
- data/spec/spec_helper.rb +2 -2
- metadata +57 -10
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -9,41 +9,41 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
RedCloth (4.2.9)
|
12
|
-
activemodel (3.2.
|
13
|
-
activesupport (= 3.2.
|
12
|
+
activemodel (3.2.2)
|
13
|
+
activesupport (= 3.2.2)
|
14
14
|
builder (~> 3.0.0)
|
15
|
-
activesupport (3.2.
|
15
|
+
activesupport (3.2.2)
|
16
16
|
i18n (~> 0.6)
|
17
17
|
multi_json (~> 1.0)
|
18
|
-
bson (1.
|
19
|
-
bson_ext (1.
|
20
|
-
bson (
|
18
|
+
bson (1.6.1)
|
19
|
+
bson_ext (1.6.1)
|
20
|
+
bson (~> 1.6.1)
|
21
21
|
builder (3.0.0)
|
22
22
|
diff-lcs (1.1.3)
|
23
23
|
i18n (0.6.0)
|
24
|
-
mongo (1.
|
25
|
-
bson (
|
26
|
-
mongoid (2.4.
|
24
|
+
mongo (1.6.1)
|
25
|
+
bson (~> 1.6.1)
|
26
|
+
mongoid (2.4.7)
|
27
27
|
activemodel (~> 3.1)
|
28
28
|
mongo (~> 1.3)
|
29
29
|
tzinfo (~> 0.3.22)
|
30
|
-
multi_json (1.0
|
30
|
+
multi_json (1.2.0)
|
31
31
|
rake (0.9.2.2)
|
32
|
-
rspec (2.
|
33
|
-
rspec-core (~> 2.
|
34
|
-
rspec-expectations (~> 2.
|
35
|
-
rspec-mocks (~> 2.
|
36
|
-
rspec-core (2.
|
37
|
-
rspec-expectations (2.
|
38
|
-
diff-lcs (~> 1.1.
|
39
|
-
rspec-mocks (2.
|
40
|
-
tzinfo (0.3.
|
32
|
+
rspec (2.9.0)
|
33
|
+
rspec-core (~> 2.9.0)
|
34
|
+
rspec-expectations (~> 2.9.0)
|
35
|
+
rspec-mocks (~> 2.9.0)
|
36
|
+
rspec-core (2.9.0)
|
37
|
+
rspec-expectations (2.9.0)
|
38
|
+
diff-lcs (~> 1.1.3)
|
39
|
+
rspec-mocks (2.9.0)
|
40
|
+
tzinfo (0.3.32)
|
41
41
|
|
42
42
|
PLATFORMS
|
43
43
|
ruby
|
44
44
|
|
45
45
|
DEPENDENCIES
|
46
|
-
bson_ext (~> 1.
|
46
|
+
bson_ext (~> 1.6.1)
|
47
47
|
mongoid-textile!
|
48
|
-
rake (~> 0.9.2
|
49
|
-
rspec (~> 2.
|
48
|
+
rake (~> 0.9.2)
|
49
|
+
rspec (~> 2.9.0)
|
data/lib/mongoid-textile.rb
CHANGED
@@ -16,8 +16,7 @@ module Mongoid
|
|
16
16
|
field_name = textile_field_name.gsub(/_formatted/, '')
|
17
17
|
|
18
18
|
if self.fields[field_name.to_s].localized?
|
19
|
-
values = self.send("#{field_name}_translations")
|
20
|
-
|
19
|
+
values = self.send("#{field_name}_translations") || {}
|
21
20
|
formatted_text = {}
|
22
21
|
|
23
22
|
values.each do |key, value|
|
@@ -50,5 +49,6 @@ module Mongoid
|
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
52
|
+
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
data/mongoid-textile.gemspec
CHANGED
@@ -19,5 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency 'mongoid', '~> 2.4.0'
|
20
20
|
gem.add_dependency 'RedCloth', '~> 4.2.0'
|
21
21
|
|
22
|
-
gem.add_development_dependency '
|
22
|
+
gem.add_development_dependency 'bson_ext', '~> 1.6.1'
|
23
|
+
gem.add_development_dependency 'rspec', '~> 2.9.0'
|
24
|
+
gem.add_development_dependency 'rake', '~> 0.9.2'
|
23
25
|
end
|
@@ -45,6 +45,15 @@ describe Mongoid::Textile do
|
|
45
45
|
article.text_formatted.should eq("")
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
context "when text is localized and is not present" do
|
50
|
+
let(:post) { Post.create }
|
51
|
+
|
52
|
+
it "should set formatted translations field with an empty hash" do
|
53
|
+
post.text_formatted_translations.should eq({})
|
54
|
+
post.text_formatted.should eq(nil)
|
55
|
+
end
|
56
|
+
end
|
48
57
|
|
49
58
|
context "when text is empty" do
|
50
59
|
let(:article) { Article.create(:text => "") }
|
data/spec/spec_helper.rb
CHANGED
@@ -14,8 +14,8 @@ RSpec.configure do |config|
|
|
14
14
|
|
15
15
|
config.before :suite do
|
16
16
|
Mongoid.configure do |config|
|
17
|
-
|
18
|
-
|
17
|
+
config.master = Mongo::Connection.new.db("mongoid-textile")
|
18
|
+
end
|
19
19
|
end
|
20
20
|
|
21
21
|
config.after :each do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-textile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mongoid
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: 2.4.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 2.4.0
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: RedCloth
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ~>
|
@@ -33,18 +38,60 @@ dependencies:
|
|
33
38
|
version: 4.2.0
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 4.2.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bson_ext
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.1
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.6.1
|
37
63
|
- !ruby/object:Gem::Dependency
|
38
64
|
name: rspec
|
39
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2.9.0
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
74
|
none: false
|
41
75
|
requirements:
|
42
76
|
- - ~>
|
43
77
|
- !ruby/object:Gem::Version
|
44
|
-
version: 2.
|
78
|
+
version: 2.9.0
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rake
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.9.2
|
45
87
|
type: :development
|
46
88
|
prerelease: false
|
47
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.9.2
|
48
95
|
description: Textile texts directly from MongoDB.
|
49
96
|
email:
|
50
97
|
- contato@lucasrenan.com
|
@@ -87,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
134
|
version: '0'
|
88
135
|
requirements: []
|
89
136
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.8.
|
137
|
+
rubygems_version: 1.8.19
|
91
138
|
signing_key:
|
92
139
|
specification_version: 3
|
93
140
|
summary: Mongoid Textile caches Textile texts on MongoDB to eliminate reprocessing.
|