administrate-field-simple_markdown 0.0.4 → 0.1.0

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
- SHA1:
3
- metadata.gz: a014bcf99d446dd6839d0f6ca9ec7ff4b627cd86
4
- data.tar.gz: 4a0effe0ffddd481fd18ae32e0e6a73c53132e64
2
+ SHA256:
3
+ metadata.gz: 6d3a701c9d55c3e017033cd492ee81b1498389ae51a8c744b2502016016badc9
4
+ data.tar.gz: ceead71e4f9cc8e1540720eec50a741313b9089f779e0d33217883e3481cbeb4
5
5
  SHA512:
6
- metadata.gz: b03a2c0a340b2be1ae26b807df540406cb28feb91742002792724e67cf8a02faf3402f533ac229c557a48f4ab5a176eb944894e8f7646fa7fd4a69767db4cf3b
7
- data.tar.gz: 377ab6ceba7303f8daf536c15da44be8c36ddb23eccc15201e25875164907283e35a59a842f3a91581632bef0c1acfd0d3215c243dfb078f38e87b4e6647c331
6
+ metadata.gz: 050efe13f5c9e1d2c29ee61d2cdde82e98261e1672bce77597428c0626deaf447e6b1571bc6e17ed8d8d392823ea8a9bf3769bfad1787d6240490198cbad3617
7
+ data.tar.gz: 5dc7dce3ab88f7018570894be90ae5e5baff9d5435f731a9b105e8ea353f4cad61cbe33e08ef51c5fd5cb33ce8ebb2bfe72ce5cd88c2cf6ae9d5ca10a4ec2486
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  *.gem
2
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+
@@ -1,19 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.1.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.1.0) (2018-01-23)
4
+
5
+ [Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.4...v0.1.0)
6
+
7
+ * Require Redcarpet
8
+ * Add RSpec and tests
9
+ * Handle null data
10
+ * Update documentation
11
+
3
12
  ## [v0.0.4](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.4) (2017-04-03)
13
+
4
14
  [Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.3...v0.0.4)
5
15
 
6
16
  * Bump up Administrate dependency
7
17
 
8
18
  ## [v0.0.3](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.3) (2017-03-20)
19
+
9
20
  [Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.2...v0.0.3)
10
21
 
11
22
  * Bump up Administrate dependency
12
23
 
13
24
  ## [v0.0.2](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.2) (2016-11-22)
25
+
14
26
  [Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.1...v0.0.2)
15
27
 
16
28
  * Bump up Administrate dependency
17
29
 
18
30
  ## [v0.0.1](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.1) (2016-11-16)
31
+
19
32
  First release
data/README.md CHANGED
@@ -11,7 +11,7 @@ A plugin to edit Markdown text in [Administrate] using [SimpleMDE] v1.11.2.
11
11
  Add it to your `Gemfile`:
12
12
 
13
13
  ```ruby
14
- gem 'administrate-field-simple_markdown', '~> 0.0.4'
14
+ gem 'administrate-field-simple_markdown', '~> 0.1.0'
15
15
  ```
16
16
 
17
17
  Run:
@@ -27,12 +27,11 @@ ATTRIBUTE_TYPES = {
27
27
  bar: Field::SimpleMarkdown
28
28
  }.freeze
29
29
  ```
30
- The field will figure out the appropriate thousand separator and decimal delimiter for the unit.
31
30
 
32
31
  ## About
33
32
 
34
- Administrate::Field::SimpleMarkdown is maintained by [z.productions].
33
+ Administrate::Field::SimpleMarkdown is maintained by [Zooppa].
35
34
 
36
- [Administrate]: https://github.com/thoughtbot/administrate
37
- [SimpleMDE]: https://github.com/NextStepWebs/simplemde-markdown-editor
38
- [z.productions]: https://www.z.productions/
35
+ [administrate]: https://github.com/thoughtbot/administrate
36
+ [simplemde]: https://github.com/NextStepWebs/simplemde-markdown-editor
37
+ [zooppa]: https://www.zooppa.com/
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -2,12 +2,12 @@ $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'administrate-field-simple_markdown'
5
- gem.version = '0.0.4'
5
+ gem.version = '0.1.0'
6
6
  gem.authors = ['Michele Gerarduzzi']
7
7
  gem.email = ['michele.gerarduzzi@gmail.com']
8
8
  gem.homepage = 'https://github.com/zooppa/administrate-field-simple_markdown'
9
- gem.summary = 'A plugin to edit Markdown text in Administrate'
10
- gem.description = gem.summary
9
+ gem.summary = 'Markdown editor for Administrate'
10
+ gem.description = 'A plugin to handle Markdown text in Administrate'
11
11
  gem.license = 'MIT'
12
12
 
13
13
  gem.require_paths = ['lib']
@@ -15,6 +15,9 @@ Gem::Specification.new do |gem|
15
15
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
 
17
17
  gem.add_runtime_dependency 'administrate', '< 1.0.0'
18
- gem.add_runtime_dependency 'rails', '>= 4.2'
18
+ gem.add_runtime_dependency 'rails', '>= 4.2', '< 6'
19
19
  gem.add_runtime_dependency 'redcarpet', '~> 3.3'
20
+
21
+ gem.add_development_dependency 'rake', '~> 12.3'
22
+ gem.add_development_dependency 'rspec', '~> 3.7'
20
23
  end
@@ -1,5 +1,7 @@
1
+ require 'rails'
1
2
  require 'administrate/field/text'
2
3
  require 'administrate/engine'
4
+ require 'redcarpet'
3
5
  require 'redcarpet/render_strip'
4
6
 
5
7
  module Administrate
@@ -10,6 +12,10 @@ module Administrate
10
12
  Administrate::Engine.add_stylesheet 'administrate-field-simple_markdown/application'
11
13
  end
12
14
 
15
+ def data
16
+ @data || ''
17
+ end
18
+
13
19
  def to_html
14
20
  markdown(html_renderer).render(data).html_safe
15
21
  end
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ describe Administrate::Field::SimpleMarkdown do
4
+ subject { Administrate::Field::SimpleMarkdown.new(:simple_markdown, data, :show) }
5
+
6
+ let(:md) { '**foo** is the new _bar_' }
7
+ let(:text) { 'foo is the new bar' }
8
+ let(:html) { '<p><strong>foo</strong> is the new <em>bar</em></p>' }
9
+
10
+ describe '#data' do
11
+ let(:output) { subject.data }
12
+
13
+ context 'with nil' do
14
+ let(:data) { nil }
15
+
16
+ it 'returns an empty string' do
17
+ expect(output).to eq ''
18
+ end
19
+ end
20
+
21
+ context 'with data' do
22
+ let(:data) { text }
23
+
24
+ it 'returns the data' do
25
+ expect(output).to eq text
26
+ end
27
+ end
28
+ end
29
+
30
+ describe '#to_s' do
31
+ let(:output) { subject.to_s }
32
+
33
+ context 'with nil' do
34
+ let(:data) { nil }
35
+
36
+ it 'returns an empty string' do
37
+ expect(output).to eq ''
38
+ end
39
+ end
40
+
41
+ context 'with a string' do
42
+ let(:data) { text }
43
+
44
+ it 'returns the same string' do
45
+ expect(output).to eq "#{text}\n"
46
+ end
47
+ end
48
+
49
+ context 'with Markdown' do
50
+ let(:data) { md }
51
+
52
+ it 'strips out the formatting' do
53
+ expect(output).to eq "#{text}\n"
54
+ end
55
+ end
56
+ end
57
+
58
+ describe '#to_html' do
59
+ let(:output) { subject.to_html }
60
+
61
+ context 'with nil' do
62
+ let(:data) { nil }
63
+
64
+ it 'returns an empty string' do
65
+ expect(output).to eq ''
66
+ end
67
+ end
68
+
69
+ context 'with a string' do
70
+ let(:data) { text }
71
+
72
+ it 'wraps it in a paragraph' do
73
+ expect(output).to eq "<p>#{text}</p>\n"
74
+ end
75
+ end
76
+
77
+ context 'with Markdown' do
78
+ let(:data) { md }
79
+
80
+ it 'converts it to HTML' do
81
+ expect(output).to eq "#{html}\n"
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'administrate/field/simple_markdown'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate-field-simple_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michele Gerarduzzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2018-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: administrate
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.2'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '6'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '4.2'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '6'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: redcarpet
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +58,35 @@ dependencies:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '3.3'
55
- description: A plugin to edit Markdown text in Administrate
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '12.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '12.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.7'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.7'
89
+ description: A plugin to handle Markdown text in Administrate
56
90
  email:
57
91
  - michele.gerarduzzi@gmail.com
58
92
  executables: []
@@ -60,11 +94,12 @@ extensions: []
60
94
  extra_rdoc_files: []
61
95
  files:
62
96
  - ".gitignore"
97
+ - ".rspec"
63
98
  - CHANGELOG.md
64
99
  - Gemfile
65
- - Gemfile.lock
66
100
  - LICENSE.md
67
101
  - README.md
102
+ - Rakefile
68
103
  - administrate-field-simple_markdown.gemspec
69
104
  - app/assets/javascripts/administrate-field-simple_markdown/application.js
70
105
  - app/assets/stylesheets/administrate-field-simple_markdown/application.css
@@ -73,6 +108,8 @@ files:
73
108
  - app/views/fields/simple_markdown/_show.html.erb
74
109
  - demo.gif
75
110
  - lib/administrate/field/simple_markdown.rb
111
+ - spec/lib/administrate/field/simple_markdown_spec.rb
112
+ - spec/spec_helper.rb
76
113
  - vendor/assets/javascripts/simplemde.min.js
77
114
  - vendor/assets/stylesheets/simplemde.min.css
78
115
  homepage: https://github.com/zooppa/administrate-field-simple_markdown
@@ -95,8 +132,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
132
  version: '0'
96
133
  requirements: []
97
134
  rubyforge_project:
98
- rubygems_version: 2.6.11
135
+ rubygems_version: 2.7.3
99
136
  signing_key:
100
137
  specification_version: 4
101
- summary: A plugin to edit Markdown text in Administrate
102
- test_files: []
138
+ summary: Markdown editor for Administrate
139
+ test_files:
140
+ - spec/lib/administrate/field/simple_markdown_spec.rb
141
+ - spec/spec_helper.rb
@@ -1,161 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- administrate-field-simple_markdown (0.0.4)
5
- administrate (< 1.0.0)
6
- rails (>= 4.2)
7
- redcarpet (~> 3.3)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actioncable (5.0.2)
13
- actionpack (= 5.0.2)
14
- nio4r (>= 1.2, < 3.0)
15
- websocket-driver (~> 0.6.1)
16
- actionmailer (5.0.2)
17
- actionpack (= 5.0.2)
18
- actionview (= 5.0.2)
19
- activejob (= 5.0.2)
20
- mail (~> 2.5, >= 2.5.4)
21
- rails-dom-testing (~> 2.0)
22
- actionpack (5.0.2)
23
- actionview (= 5.0.2)
24
- activesupport (= 5.0.2)
25
- rack (~> 2.0)
26
- rack-test (~> 0.6.3)
27
- rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.0.2)
30
- activesupport (= 5.0.2)
31
- builder (~> 3.1)
32
- erubis (~> 2.7.0)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.0.2)
36
- activesupport (= 5.0.2)
37
- globalid (>= 0.3.6)
38
- activemodel (5.0.2)
39
- activesupport (= 5.0.2)
40
- activerecord (5.0.2)
41
- activemodel (= 5.0.2)
42
- activesupport (= 5.0.2)
43
- arel (~> 7.0)
44
- activesupport (5.0.2)
45
- concurrent-ruby (~> 1.0, >= 1.0.2)
46
- i18n (~> 0.7)
47
- minitest (~> 5.1)
48
- tzinfo (~> 1.1)
49
- administrate (0.4.0)
50
- autoprefixer-rails (~> 6.0)
51
- bourbon (~> 4.2)
52
- datetime_picker_rails (~> 0.0.7)
53
- jquery-rails (~> 4.0)
54
- kaminari (~> 0.16)
55
- momentjs-rails (~> 2.8)
56
- neat (~> 1.1)
57
- normalize-rails (~> 3.0)
58
- rails (>= 4.2, < 5.1)
59
- sass-rails (~> 5.0)
60
- selectize-rails (~> 0.6)
61
- arel (7.1.4)
62
- autoprefixer-rails (6.7.7)
63
- execjs
64
- bourbon (4.3.3)
65
- sass (~> 3.4)
66
- thor (~> 0.19)
67
- builder (3.2.3)
68
- concurrent-ruby (1.0.5)
69
- datetime_picker_rails (0.0.7)
70
- momentjs-rails (>= 2.8.1)
71
- erubis (2.7.0)
72
- execjs (2.7.0)
73
- globalid (0.3.7)
74
- activesupport (>= 4.1.0)
75
- i18n (0.8.1)
76
- jquery-rails (4.2.2)
77
- rails-dom-testing (>= 1, < 3)
78
- railties (>= 4.2.0)
79
- thor (>= 0.14, < 2.0)
80
- kaminari (0.17.0)
81
- actionpack (>= 3.0.0)
82
- activesupport (>= 3.0.0)
83
- loofah (2.0.3)
84
- nokogiri (>= 1.5.9)
85
- mail (2.6.4)
86
- mime-types (>= 1.16, < 4)
87
- method_source (0.8.2)
88
- mime-types (3.1)
89
- mime-types-data (~> 3.2015)
90
- mime-types-data (3.2016.0521)
91
- mini_portile2 (2.1.0)
92
- minitest (5.10.1)
93
- momentjs-rails (2.17.1)
94
- railties (>= 3.1)
95
- neat (1.8.0)
96
- sass (>= 3.3)
97
- thor (~> 0.19)
98
- nio4r (2.0.0)
99
- nokogiri (1.7.1)
100
- mini_portile2 (~> 2.1.0)
101
- normalize-rails (3.0.3)
102
- rack (2.0.1)
103
- rack-test (0.6.3)
104
- rack (>= 1.0)
105
- rails (5.0.2)
106
- actioncable (= 5.0.2)
107
- actionmailer (= 5.0.2)
108
- actionpack (= 5.0.2)
109
- actionview (= 5.0.2)
110
- activejob (= 5.0.2)
111
- activemodel (= 5.0.2)
112
- activerecord (= 5.0.2)
113
- activesupport (= 5.0.2)
114
- bundler (>= 1.3.0, < 2.0)
115
- railties (= 5.0.2)
116
- sprockets-rails (>= 2.0.0)
117
- rails-dom-testing (2.0.2)
118
- activesupport (>= 4.2.0, < 6.0)
119
- nokogiri (~> 1.6)
120
- rails-html-sanitizer (1.0.3)
121
- loofah (~> 2.0)
122
- railties (5.0.2)
123
- actionpack (= 5.0.2)
124
- activesupport (= 5.0.2)
125
- method_source
126
- rake (>= 0.8.7)
127
- thor (>= 0.18.1, < 2.0)
128
- rake (12.0.0)
129
- redcarpet (3.4.0)
130
- sass (3.4.23)
131
- sass-rails (5.0.6)
132
- railties (>= 4.0.0, < 6)
133
- sass (~> 3.1)
134
- sprockets (>= 2.8, < 4.0)
135
- sprockets-rails (>= 2.0, < 4.0)
136
- tilt (>= 1.1, < 3)
137
- selectize-rails (0.12.4)
138
- sprockets (3.7.1)
139
- concurrent-ruby (~> 1.0)
140
- rack (> 1, < 3)
141
- sprockets-rails (3.2.0)
142
- actionpack (>= 4.0)
143
- activesupport (>= 4.0)
144
- sprockets (>= 3.0.0)
145
- thor (0.19.4)
146
- thread_safe (0.3.6)
147
- tilt (2.0.7)
148
- tzinfo (1.2.2)
149
- thread_safe (~> 0.1)
150
- websocket-driver (0.6.5)
151
- websocket-extensions (>= 0.1.0)
152
- websocket-extensions (0.1.2)
153
-
154
- PLATFORMS
155
- ruby
156
-
157
- DEPENDENCIES
158
- administrate-field-simple_markdown!
159
-
160
- BUNDLED WITH
161
- 1.14.6