mongoid_markdown_extension 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec8e015b5cfba63e62b5e27e5291363427d405becf26f9b8b798c61e42dcb080
4
- data.tar.gz: 535cd7396fb5267661ad155a7f3037d80a03a87fb36db3e1209c097d82609310
3
+ metadata.gz: 5baa9bbdd4bbe2ed9fb1091b8f722d29dd8696a0247ff189af56143034487169
4
+ data.tar.gz: a8a862d5e19e866ce63a90cc97c7fc8f5fe089243c334b7c0309a8a02929f1f6
5
5
  SHA512:
6
- metadata.gz: 2180a3997703c5a2a84624b754a29ffc59a233c82d1ffb328ba5cfd2a70d6e3463958cea22af745071958c95320a50cf4ee40459a39ebd4debe031f895b17599
7
- data.tar.gz: f2cf2ea23f98fc0a576c7f9b4d99e3ae97a99a801ac8727358b6668b8ad255239292caf7eb7f70680df4ca7cb8b20dd8278a3b7e6265ed3cd3f0b3df0562d553
6
+ metadata.gz: 60038ae6b00d87d4629daaab31c88ea752d60b514a2279d805bd54c908d86b99720f2498bfe26c6a0a981391b487d77aa60b5a8e6d22b4b8ec9c3ffabab8646e
7
+ data.tar.gz: c0c3465ad3b350eef54e5e8925830e5b2d1901ac8828d2c86e5150385278579ad6bbcc330b79985ca411948a5fdc95aa2f460cabbe9ee97d8ce0922666af9145
@@ -0,0 +1,26 @@
1
+ name: Test
2
+ on:
3
+ pull_request:
4
+ branches: ["master"]
5
+ push:
6
+ branches: ["master"]
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ gemfile: ["6", "7", "8"]
13
+ ruby: ["2.7", "3.0", "3.1", "3.2"]
14
+ include:
15
+ - gemfile: "4"
16
+ ruby: "2.5"
17
+ - gemfile: "5"
18
+ ruby: "2.5"
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true
25
+ - name: Run tests
26
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ tmp
21
21
  *.a
22
22
  mkmf.log
23
23
  .DS_Store
24
+ /gemfiles/*.gemfile.lock
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.1
data/Appraisals ADDED
@@ -0,0 +1,19 @@
1
+ appraise "4" do
2
+ gem "mongoid", "~> 4.0"
3
+ end
4
+
5
+ appraise "5" do
6
+ gem "mongoid", "~> 5.0"
7
+ end
8
+
9
+ appraise "6" do
10
+ gem "mongoid", "~> 6.0"
11
+ end
12
+
13
+ appraise "7" do
14
+ gem "mongoid", "~> 7.0"
15
+ end
16
+
17
+ appraise "8" do
18
+ gem "mongoid", "~> 8.0"
19
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.1
4
+
5
+ - Mongoid 8 compatibility
6
+
3
7
  ## 0.2.0
4
8
 
5
9
  - Added `linebreaks` option to `to_inline_html`
data/Gemfile CHANGED
@@ -2,11 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in mongoid_markdown_extension.gemspec
4
4
  gemspec
5
-
6
- case version = ENV['MONGOID_VERSION'] || '~> 7.0'
7
- when /7/ then gem 'mongoid', '~> 7.0'
8
- when /6/ then gem 'mongoid', '~> 6.0'
9
- when /5/ then gem 'mongoid', '~> 5.1'
10
- when /4/ then gem 'mongoid', '~> 4.0'
11
- else gem 'mongoid', version
12
- end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Mongoid Markdown Extension
2
2
 
3
- [![Build Status](https://travis-ci.org/tomasc/mongoid_markdown_extension.svg)](https://travis-ci.org/tomasc/mongoid_markdown_extension) [![Gem Version](https://badge.fury.io/rb/mongoid_markdown_extension.svg)](http://badge.fury.io/rb/mongoid_markdown_extension) [![Coverage Status](https://img.shields.io/coveralls/tomasc/mongoid_markdown_extension.svg)](https://coveralls.io/r/tomasc/mongoid_markdown_extension)
3
+ [![Build Status](https://travis-ci.org/tomasc/mongoid_markdown_extension.svg)](https://travis-ci.org/tomasc/mongoid_markdown_extension) [![Gem Version](https://badge.fury.io/rb/mongoid_markdown_extension.svg)](http://badge.fury.io/rb/mongoid_markdown_extension)
4
4
 
5
5
  [Mongoid](https://github.com/mongoid/mongoid) field extension that returns an object with `to_html` method returning the content converted from Markdown syntax to html. The Markdown conversion is done using the [Redcarpet](https://github.com/vmg/redcarpet) library.
6
6
 
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mongoid", "~> 4.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mongoid", "~> 5.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mongoid", "~> 6.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mongoid", "~> 7.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mongoid", "~> 8.0"
6
+
7
+ gemspec path: "../"
@@ -5,35 +5,35 @@ module MongoidMarkdownExtension
5
5
  class Markdown < String
6
6
  class << self
7
7
  attr_writer :configuration
8
- end
9
8
 
10
- def self.configuration
11
- @configuration ||= Configuration.new
12
- end
9
+ def configuration
10
+ @configuration ||= Configuration.new
11
+ end
13
12
 
14
- def self.reset
15
- @configuration = Configuration.new
16
- end
13
+ def reset
14
+ @configuration = Configuration.new
15
+ end
17
16
 
18
- def self.configure
19
- yield(configuration)
20
- end
17
+ def configure
18
+ yield(configuration)
19
+ end
21
20
 
22
- def self.demongoize(value)
23
- Markdown.new(value)
24
- end
21
+ def demongoize(value)
22
+ Markdown.new(value)
23
+ end
25
24
 
26
- def self.mongoize(value)
27
- case value
28
- when Markdown then value.mongoize
29
- else value
25
+ def mongoize(value)
26
+ case value
27
+ when Markdown then value.mongoize
28
+ else value
29
+ end
30
30
  end
31
- end
32
31
 
33
- def self.evolve(value)
34
- case value
35
- when Markdown then value.mongoize
36
- else value
32
+ def evolve(value)
33
+ case value
34
+ when Markdown then value.mongoize
35
+ else value
36
+ end
37
37
  end
38
38
  end
39
39
 
@@ -41,6 +41,14 @@ module MongoidMarkdownExtension
41
41
  super(str.to_s)
42
42
  end
43
43
 
44
+ def split(*args)
45
+ super(*args).map { |str| self.class.new(str) }
46
+ end
47
+
48
+ def gsub(*args)
49
+ self.class.new(super(*args))
50
+ end
51
+
44
52
  def to_html
45
53
  markdown_renderer.render(to_s).html_safe
46
54
  end
@@ -1,3 +1,3 @@
1
1
  module MongoidMarkdownExtension
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'redcarpet', '~> 3.4'
22
- spec.add_dependency 'mongoid', '>= 4.0', '< 8'
22
+ spec.add_dependency 'mongoid', '>= 4.0'
23
23
 
24
+ spec.add_development_dependency 'appraisal'
24
25
  spec.add_development_dependency 'bundler'
25
- spec.add_development_dependency 'coveralls'
26
- spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rake'
27
27
  end
@@ -148,6 +148,15 @@ module MongoidMarkdownExtension
148
148
  _(split_markdown.first.to_s).must_equal "foo"
149
149
  _(split_markdown.first.to_html).must_match /<p>foo<\/p>/
150
150
  end
151
+
152
+ it "returns correctly instantiated markdown objects" do
153
+ markdown = MongoidMarkdownExtension::Markdown.new("foo\nbar\nfar\nboo")
154
+ gsubbed_markdown = markdown.gsub("\n", "bam")
155
+
156
+ _(gsubbed_markdown).must_be_kind_of MongoidMarkdownExtension::Markdown
157
+ _(gsubbed_markdown.to_s).must_equal "foobambarbamfarbamboo"
158
+ _(gsubbed_markdown.to_html).must_match (/<p>foobambarbamfarbamboo<\/p>/)
159
+ end
151
160
  end
152
161
  end
153
162
  end
data/test/test_helper.rb CHANGED
@@ -5,8 +5,3 @@ require 'minitest/autorun'
5
5
  require 'minitest/spec'
6
6
 
7
7
  require 'mongoid_markdown_extension'
8
-
9
- if ENV['CI']
10
- require 'coveralls'
11
- Coveralls.wear!
12
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_markdown_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-08 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet
@@ -31,9 +31,6 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '8'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,11 +38,8 @@ dependencies:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
40
  version: '4.0'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '8'
47
41
  - !ruby/object:Gem::Dependency
48
- name: bundler
42
+ name: appraisal
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - ">="
@@ -59,7 +53,7 @@ dependencies:
59
53
  - !ruby/object:Gem::Version
60
54
  version: '0'
61
55
  - !ruby/object:Gem::Dependency
62
- name: coveralls
56
+ name: bundler
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - ">="
@@ -76,16 +70,16 @@ dependencies:
76
70
  name: rake
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - "~>"
73
+ - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '10.0'
75
+ version: '0'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - "~>"
80
+ - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '10.0'
82
+ version: '0'
89
83
  description: Custom field type for Mongoid that handles Markdown conversion via Redcarpet
90
84
  gem.
91
85
  email:
@@ -94,15 +88,21 @@ executables: []
94
88
  extensions: []
95
89
  extra_rdoc_files: []
96
90
  files:
97
- - ".coveralls.yml"
91
+ - ".github/workflows/test.yml"
98
92
  - ".gitignore"
99
93
  - ".ruby-version"
100
- - ".travis.yml"
94
+ - ".tool-versions"
95
+ - Appraisals
101
96
  - CHANGELOG.md
102
97
  - Gemfile
103
98
  - LICENSE
104
99
  - README.md
105
100
  - Rakefile
101
+ - gemfiles/4.gemfile
102
+ - gemfiles/5.gemfile
103
+ - gemfiles/6.gemfile
104
+ - gemfiles/7.gemfile
105
+ - gemfiles/8.gemfile
106
106
  - lib/mongoid_markdown_extension.rb
107
107
  - lib/mongoid_markdown_extension/inline_renderer.rb
108
108
  - lib/mongoid_markdown_extension/markdown.rb
@@ -114,7 +114,7 @@ homepage: https://github.com/tomasc/mongoid_markdown_extension
114
114
  licenses:
115
115
  - MIT
116
116
  metadata: {}
117
- post_install_message:
117
+ post_install_message:
118
118
  rdoc_options: []
119
119
  require_paths:
120
120
  - lib
@@ -129,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.1.4
133
- signing_key:
132
+ rubygems_version: 3.4.6
133
+ signing_key:
134
134
  specification_version: 4
135
135
  summary: Custom field type for Mongoid that handles Markdown conversion via Redcarpet
136
136
  gem.
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/.travis.yml DELETED
@@ -1,24 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- script: 'bundle exec rake'
4
- rvm:
5
- - 2.2.5
6
- before_install:
7
- - gem install bundler -v 1.12.5
8
- notifications:
9
- email:
10
- recipients:
11
- - tomas.celizna@gmail.com
12
- on_failure: change
13
- on_success: never
14
-
15
- matrix:
16
- include:
17
- - rvm: 2.3.3
18
- env: MONGOID_VERSION=4
19
- - rvm: 2.3.3
20
- env: MONGOID_VERSION=5
21
- - rvm: 2.7.2
22
- env: MONGOID_VERSION=6
23
- - rvm: 2.7.2
24
- env: MONGOID_VERSION=7