mongoid-textile 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +21 -18
- data/LICENSE +2 -2
- data/README.md +22 -10
- data/gemfiles/mongoid-3.1.gemfile +5 -0
- data/gemfiles/mongoid-master.gemfile +5 -0
- data/lib/mongoid-textile.rb +7 -3
- data/lib/mongoid-textile/version.rb +1 -1
- data/mongoid-textile.gemspec +6 -5
- data/spec/mongoid-textile_spec.rb +9 -9
- data/spec/spec_helper.rb +5 -0
- metadata +50 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4ce26fa6ecf228c4358b32b8c95c406c70cb014
|
4
|
+
data.tar.gz: a378eab1af0e2350e555c3f5600b0a80de972b07
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 761e6b38e3db81afb149b9a481b82235600d7b50dd3d141ee7891ebe77379cc833d24e2d89dde5d35a339d314b82f129cc0f3d5bfda88ad180586696f5018ace
|
7
|
+
data.tar.gz: ebbff8489a3f84edf16cfc0c82783f5e993a3e21294362076b33432d6b09661a29c351974623fc0cbef3884800a4ac6e20eb338d915788ca913229577e428f7b
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,31 +1,34 @@
|
|
1
|
-
|
1
|
+
### 1.0.0 - August 5, 2014
|
2
2
|
|
3
|
-
|
3
|
+
* Improvements
|
4
|
+
* Update dependencies.
|
4
5
|
|
5
|
-
|
6
|
+
### 0.2.0 - July 11, 2012
|
6
7
|
|
7
|
-
|
8
|
+
* Improvements
|
9
|
+
* Adding support to Mongoid 3.
|
8
10
|
|
9
|
-
*
|
11
|
+
* Major Changes (Backwards Incompatible)
|
12
|
+
* Mongoid Textile no longer supports Ruby 1.8.7 and 1.9.2 (if you use Mongoid 3).
|
10
13
|
|
11
|
-
|
14
|
+
### 0.1.1 - March 30, 2012
|
12
15
|
|
13
|
-
|
16
|
+
* Resolved Issues
|
17
|
+
* Sets an empty hash to formatted translations field when field is localized and empty. ([@lucasrenan][]) commit: [3ae3e981d1][]
|
14
18
|
|
15
|
-
|
19
|
+
### 0.1.0 - February 14, 2012
|
16
20
|
|
17
|
-
|
21
|
+
* Improvements
|
22
|
+
* Inclusion of support for localized fields.
|
18
23
|
|
19
|
-
###
|
24
|
+
### 0.0.2 - January 17, 2012
|
20
25
|
|
21
|
-
*
|
26
|
+
* Improvements
|
27
|
+
* Removing InstanceMethods module inside of ActiveSupport::Concern because it is deprecated on ActiveSupport 3.2.0.
|
22
28
|
|
23
|
-
|
24
|
-
|
25
|
-
### Improvements
|
26
|
-
|
27
|
-
* Removing InstanceMethods module inside of ActiveSupport::Concern because it is deprecated on ActiveSupport 3.2.0.
|
28
|
-
|
29
|
-
## 0.0.1 - January 11, 2012
|
29
|
+
### 0.0.1 - January 11, 2012
|
30
30
|
|
31
31
|
Initial release.
|
32
|
+
|
33
|
+
[3ae3e981d1]: https://github.com/tiagogodinho/mongoid-textile/commit/3ae3e981d108013350988b659873f857a5beafcd
|
34
|
+
[@lucasrenan]: https://github.com/lucasrenan
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2012 Lucas Renan e Tiago Rafael Godinho
|
1
|
+
Copyright (c) 2012-2014 Lucas Renan e Tiago Rafael Godinho
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# Mongoid
|
1
|
+
# Mongoid Textile
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/tiagogodinho/mongoid-textile.svg?branch=master)](https://travis-ci.org/tiagogodinho/mongoid-textile)
|
4
|
+
[![Dependency Status](https://gemnasium.com/tiagogodinho/mongoid-textile.svg)](https://gemnasium.com/tiagogodinho/mongoid-textile)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/mongoid-textile.svg)](http://badge.fury.io/rb/mongoid-textile)
|
6
|
+
[![Coverage Status](https://img.shields.io/coveralls/tiagogodinho/mongoid-textile.svg)](https://coveralls.io/r/tiagogodinho/mongoid-textile?branch=master)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/tiagogodinho/mongoid-textile/badges/gpa.svg)](https://codeclimate.com/github/tiagogodinho/mongoid-textile)
|
2
8
|
|
3
9
|
Textile texts directly from MongoDB.
|
4
10
|
|
@@ -6,17 +12,23 @@ Mongoid Textile caches Textile texts on MongoDB to eliminate reprocessing.
|
|
6
12
|
|
7
13
|
## Installation
|
8
14
|
|
9
|
-
Add this line to your application's Gemfile
|
15
|
+
Add this line to your application's `Gemfile`:
|
10
16
|
|
11
|
-
|
17
|
+
``` ruby
|
18
|
+
gem 'mongoid-textile'
|
19
|
+
```
|
12
20
|
|
13
21
|
And then execute:
|
14
22
|
|
15
|
-
|
23
|
+
``` terminal
|
24
|
+
bundle
|
25
|
+
```
|
16
26
|
|
17
27
|
Or install it yourself as:
|
18
28
|
|
19
|
-
|
29
|
+
``` terminal
|
30
|
+
gem install mongoid-textile
|
31
|
+
```
|
20
32
|
|
21
33
|
## Usage
|
22
34
|
|
@@ -24,9 +36,9 @@ Or install it yourself as:
|
|
24
36
|
class Article
|
25
37
|
include Mongoid::Document
|
26
38
|
include Mongoid::Textile
|
27
|
-
|
39
|
+
|
28
40
|
field :text
|
29
|
-
|
41
|
+
|
30
42
|
textlize :text
|
31
43
|
end
|
32
44
|
|
@@ -37,7 +49,7 @@ article.text_formatted #=> <h1>Proud to be a rails developer</h1>
|
|
37
49
|
|
38
50
|
## Compatibility
|
39
51
|
|
40
|
-
Mongoid Textile is tested against Ruby 1.9.3.
|
52
|
+
Mongoid Textile is tested against Ruby 1.9.3, 2.0.0 and 2.1.0.
|
41
53
|
|
42
54
|
## Contributing
|
43
55
|
|
@@ -50,8 +62,8 @@ Mongoid Textile is tested against Ruby 1.9.3.
|
|
50
62
|
## Maintainers
|
51
63
|
|
52
64
|
* Lucas Renan (https://github.com/lucasrenan)
|
53
|
-
* Tiago
|
65
|
+
* Tiago Godinho (https://github.com/tiagogodinho)
|
54
66
|
|
55
67
|
## License
|
56
68
|
|
57
|
-
MIT License. Copyright 2012 Lucas Renan e Tiago Rafael Godinho
|
69
|
+
MIT License. Copyright 2012-2014 Lucas Renan e Tiago Rafael Godinho
|
data/lib/mongoid-textile.rb
CHANGED
@@ -20,13 +20,13 @@ module Mongoid
|
|
20
20
|
formatted_text = {}
|
21
21
|
|
22
22
|
values.each do |key, value|
|
23
|
-
formatted_text[key.to_s] =
|
23
|
+
formatted_text[key.to_s] = get_formatted_text(value)
|
24
24
|
end
|
25
25
|
|
26
26
|
self.send("#{textile_field_name}_translations=", formatted_text)
|
27
27
|
else
|
28
28
|
value = self.send(field_name)
|
29
|
-
formatted_text =
|
29
|
+
formatted_text = get_formatted_text(value)
|
30
30
|
self.send("#{textile_field_name}=", formatted_text)
|
31
31
|
end
|
32
32
|
end
|
@@ -34,6 +34,10 @@ module Mongoid
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
+
def get_formatted_text(value)
|
38
|
+
RedCloth.new(value.to_s).to_html
|
39
|
+
end
|
40
|
+
|
37
41
|
def textile_fields
|
38
42
|
fields.collect{ |field| field.first }.select{ |field_name| field_name =~ /\w+_formatted/ }
|
39
43
|
end
|
@@ -51,4 +55,4 @@ module Mongoid
|
|
51
55
|
end
|
52
56
|
|
53
57
|
end
|
54
|
-
end
|
58
|
+
end
|
data/mongoid-textile.gemspec
CHANGED
@@ -14,10 +14,11 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.require_paths = ['lib']
|
15
15
|
gem.version = Mongoid::Textile::VERSION
|
16
16
|
|
17
|
-
gem.add_dependency 'mongoid', '>= 2.4'
|
18
|
-
gem.add_dependency 'RedCloth', '~> 4.2
|
17
|
+
gem.add_dependency 'mongoid', '>= 2.4', '< 5'
|
18
|
+
gem.add_dependency 'RedCloth', '~> 4.2'
|
19
19
|
|
20
|
-
gem.add_development_dependency '
|
21
|
-
gem.add_development_dependency '
|
22
|
-
gem.add_development_dependency '
|
20
|
+
gem.add_development_dependency 'coveralls', '~> 0.7.0'
|
21
|
+
gem.add_development_dependency 'database_cleaner', '~> 1.3.0'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 3.0.0'
|
23
|
+
gem.add_development_dependency 'rake', '~> 10.3.0'
|
23
24
|
end
|
@@ -24,25 +24,25 @@ describe Mongoid::Textile do
|
|
24
24
|
let(:article) { Article.create(text: 'h1. proud to be a rails developer') }
|
25
25
|
|
26
26
|
it 'should build a dynamic field for textilized fields' do
|
27
|
-
article.
|
27
|
+
expect(article).to respond_to(:text_formatted)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should set formatted field from textile to html' do
|
31
|
-
article.text_formatted.
|
31
|
+
expect(article.text_formatted).to eq('<h1>proud to be a rails developer</h1>')
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should change textlized text' do
|
35
35
|
article.text = 'p. ruby makes me happy'
|
36
36
|
article.save
|
37
37
|
|
38
|
-
article.text_formatted.
|
38
|
+
expect(article.text_formatted).to eq('<p>ruby makes me happy</p>')
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'when text is nil' do
|
42
42
|
let(:article) { Article.create(text: nil) }
|
43
43
|
|
44
44
|
it 'should set formatted field with an empty string' do
|
45
|
-
article.text_formatted.
|
45
|
+
expect(article.text_formatted).to eq('')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,8 +50,8 @@ describe Mongoid::Textile do
|
|
50
50
|
let(:post) { Post.create }
|
51
51
|
|
52
52
|
it 'should set formatted translations field with an empty hash' do
|
53
|
-
post.text_formatted_translations.
|
54
|
-
post.text_formatted.
|
53
|
+
expect(post.text_formatted_translations).to eq({})
|
54
|
+
expect(post.text_formatted).to eq(nil)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -59,7 +59,7 @@ describe Mongoid::Textile do
|
|
59
59
|
let(:article) { Article.create(text: '') }
|
60
60
|
|
61
61
|
it 'should set formatted field with an empty string' do
|
62
|
-
article.text_formatted.
|
62
|
+
expect(article.text_formatted).to eq('')
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -72,7 +72,7 @@ describe Mongoid::Textile do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'should set formatted field from textile to html' do
|
75
|
-
post.text_formatted.
|
75
|
+
expect(post.text_formatted).to eq('<h1>ruby makes me happy</h1>')
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -82,7 +82,7 @@ describe Mongoid::Textile do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should set formatted field from textile to html' do
|
85
|
-
post.text_formatted.
|
85
|
+
expect(post.text_formatted).to eq('<h1>ruby macht mich glücklich</h1>')
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-textile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Lucas Renan
|
@@ -10,88 +9,98 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: mongoid
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '2.4'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '5'
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '2.4'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
31
34
|
- !ruby/object:Gem::Dependency
|
32
35
|
name: RedCloth
|
33
36
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
37
|
requirements:
|
36
|
-
- - ~>
|
38
|
+
- - "~>"
|
37
39
|
- !ruby/object:Gem::Version
|
38
|
-
version: 4.2
|
40
|
+
version: '4.2'
|
39
41
|
type: :runtime
|
40
42
|
prerelease: false
|
41
43
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
44
|
requirements:
|
44
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.2'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: coveralls
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.0
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
45
60
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
61
|
+
version: 0.7.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: database_cleaner
|
49
64
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
65
|
requirements:
|
52
|
-
- - ~>
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 1.3.0
|
55
69
|
type: :development
|
56
70
|
prerelease: false
|
57
71
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
72
|
requirements:
|
60
|
-
- - ~>
|
73
|
+
- - "~>"
|
61
74
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
75
|
+
version: 1.3.0
|
63
76
|
- !ruby/object:Gem::Dependency
|
64
77
|
name: rspec
|
65
78
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
79
|
requirements:
|
68
|
-
- - ~>
|
80
|
+
- - "~>"
|
69
81
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
82
|
+
version: 3.0.0
|
71
83
|
type: :development
|
72
84
|
prerelease: false
|
73
85
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
86
|
requirements:
|
76
|
-
- - ~>
|
87
|
+
- - "~>"
|
77
88
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
89
|
+
version: 3.0.0
|
79
90
|
- !ruby/object:Gem::Dependency
|
80
91
|
name: rake
|
81
92
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
93
|
requirements:
|
84
|
-
- - ~>
|
94
|
+
- - "~>"
|
85
95
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
96
|
+
version: 10.3.0
|
87
97
|
type: :development
|
88
98
|
prerelease: false
|
89
99
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
100
|
requirements:
|
92
|
-
- - ~>
|
101
|
+
- - "~>"
|
93
102
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
103
|
+
version: 10.3.0
|
95
104
|
description: Textile texts directly from MongoDB.
|
96
105
|
email:
|
97
106
|
- contato@lucasrenan.com
|
@@ -100,15 +109,17 @@ executables: []
|
|
100
109
|
extensions: []
|
101
110
|
extra_rdoc_files: []
|
102
111
|
files:
|
103
|
-
- .gitignore
|
104
|
-
- .rspec
|
105
|
-
- .travis.yml
|
112
|
+
- ".gitignore"
|
113
|
+
- ".rspec"
|
114
|
+
- ".travis.yml"
|
106
115
|
- CHANGELOG.md
|
107
116
|
- Gemfile
|
108
117
|
- LICENSE
|
109
118
|
- README.md
|
110
119
|
- Rakefile
|
111
120
|
- gemfiles/mongoid-2.4.gemfile
|
121
|
+
- gemfiles/mongoid-3.1.gemfile
|
122
|
+
- gemfiles/mongoid-master.gemfile
|
112
123
|
- lib/mongoid-textile.rb
|
113
124
|
- lib/mongoid-textile/version.rb
|
114
125
|
- mongoid-textile.gemspec
|
@@ -116,33 +127,26 @@ files:
|
|
116
127
|
- spec/spec_helper.rb
|
117
128
|
homepage: ''
|
118
129
|
licenses: []
|
130
|
+
metadata: {}
|
119
131
|
post_install_message:
|
120
132
|
rdoc_options: []
|
121
133
|
require_paths:
|
122
134
|
- lib
|
123
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
136
|
requirements:
|
126
|
-
- -
|
137
|
+
- - ">="
|
127
138
|
- !ruby/object:Gem::Version
|
128
139
|
version: '0'
|
129
|
-
segments:
|
130
|
-
- 0
|
131
|
-
hash: 4348872174340008729
|
132
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
141
|
requirements:
|
135
|
-
- -
|
142
|
+
- - ">="
|
136
143
|
- !ruby/object:Gem::Version
|
137
144
|
version: '0'
|
138
|
-
segments:
|
139
|
-
- 0
|
140
|
-
hash: 4348872174340008729
|
141
145
|
requirements: []
|
142
146
|
rubyforge_project:
|
143
|
-
rubygems_version:
|
147
|
+
rubygems_version: 2.2.2
|
144
148
|
signing_key:
|
145
|
-
specification_version:
|
149
|
+
specification_version: 4
|
146
150
|
summary: Mongoid Textile caches Textile texts on MongoDB to eliminate reprocessing.
|
147
151
|
test_files:
|
148
152
|
- spec/mongoid-textile_spec.rb
|