shortcode 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/Appraisals +2 -6
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +54 -33
- data/README.md +7 -2
- data/gemfiles/rails_3.2.gemfile +1 -1
- data/gemfiles/rails_4.0.gemfile +1 -1
- data/gemfiles/rails_4.1.gemfile +2 -2
- data/gemfiles/rails_4.2.gemfile +2 -2
- data/lib/shortcode.rb +4 -2
- data/lib/shortcode/version.rb +1 -1
- data/shortcode.gemspec +2 -2
- data/spec/presenter_spec.rb +30 -0
- data/spec/support/presenters/other_presenter.rb +19 -0
- metadata +8 -7
- data/gemfiles/rails_3.1.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e0988a6e1f0ecb12fe3fed784a3510ed7453844
|
4
|
+
data.tar.gz: 172791fe6e082acf4f886c0c579634f5512c3e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0920cdbdfa0c5dd301e7f4a9ee6120222a97a3ee0603407f2d6938b89934801ebc5070ea4e00035b1f214a0dcf3ae218af2d5c249687d90f012a932f8a87eb3e
|
7
|
+
data.tar.gz: 21c39fe3f962bbfe73e9a91c337dc2d52243711d9688b7e813c10ee92f1e8ab6a6c0a5d17d21aec65aed7a8ddffcd9eb02620e774f690e0486239b63f0245121
|
data/.travis.yml
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 1.9.3-p551
|
5
4
|
- 2.0.0-p598
|
6
|
-
- 2.1.
|
7
|
-
- 2.2.
|
5
|
+
- 2.1.6
|
6
|
+
- 2.2.2
|
8
7
|
- ruby-head
|
9
8
|
- jruby-19mode
|
10
9
|
- jruby-head
|
@@ -19,7 +18,6 @@ matrix:
|
|
19
18
|
- rvm: jruby-head
|
20
19
|
|
21
20
|
gemfile:
|
22
|
-
- gemfiles/rails_3.1.gemfile
|
23
21
|
- gemfiles/rails_3.2.gemfile
|
24
22
|
- gemfiles/rails_4.0.gemfile
|
25
23
|
- gemfiles/rails_4.1.gemfile
|
data/Appraisals
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
appraise "rails-3.1" do
|
2
|
-
gem "rails", "~> 3.1.12"
|
3
|
-
end
|
4
|
-
|
5
1
|
appraise "rails-3.2" do
|
6
2
|
gem "rails", "~> 3.2.21"
|
7
3
|
end
|
@@ -11,9 +7,9 @@ appraise "rails-4.0" do
|
|
11
7
|
end
|
12
8
|
|
13
9
|
appraise "rails-4.1" do
|
14
|
-
gem "rails", "~> 4.1.
|
10
|
+
gem "rails", "~> 4.1.10"
|
15
11
|
end
|
16
12
|
|
17
13
|
appraise "rails-4.2" do
|
18
|
-
gem "rails", "4.2.
|
14
|
+
gem "rails", "4.2.1"
|
19
15
|
end
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,72 +1,93 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shortcode (1.0
|
5
|
-
parslet (= 1.
|
4
|
+
shortcode (1.1.0)
|
5
|
+
parslet (= 1.7.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
10
|
+
activesupport (4.2.1)
|
11
|
+
i18n (~> 0.7)
|
12
|
+
json (~> 1.7, >= 1.7.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
appraisal (2.0.1)
|
17
|
+
activesupport (>= 3.2.21)
|
11
18
|
bundler
|
12
19
|
rake
|
13
20
|
thor (>= 0.14.0)
|
14
21
|
blankslate (3.1.3)
|
15
|
-
coveralls (0.
|
16
|
-
|
17
|
-
rest-client (
|
18
|
-
simplecov (~> 0.
|
22
|
+
coveralls (0.8.1)
|
23
|
+
json (~> 1.8)
|
24
|
+
rest-client (>= 1.6.8, < 2)
|
25
|
+
simplecov (~> 0.10.0)
|
19
26
|
term-ansicolor (~> 1.3)
|
20
27
|
thor (~> 0.19.1)
|
21
28
|
diff-lcs (1.2.5)
|
22
29
|
docile (1.1.5)
|
30
|
+
domain_name (0.5.24)
|
31
|
+
unf (>= 0.0.5, < 1.0.0)
|
23
32
|
haml (4.0.6)
|
24
33
|
tilt
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
34
|
+
http-cookie (1.0.2)
|
35
|
+
domain_name (~> 0.5)
|
36
|
+
i18n (0.7.0)
|
37
|
+
json (1.8.2)
|
38
|
+
mime-types (2.5)
|
39
|
+
minitest (5.6.1)
|
40
|
+
netrc (0.10.3)
|
41
|
+
parslet (1.7.0)
|
29
42
|
blankslate (>= 2.0, <= 4.0)
|
30
43
|
rake (10.4.2)
|
31
|
-
rest-client (1.
|
44
|
+
rest-client (1.8.0)
|
45
|
+
http-cookie (>= 1.0.2, < 2.0)
|
32
46
|
mime-types (>= 1.16, < 3.0)
|
33
47
|
netrc (~> 0.7)
|
34
|
-
rspec (3.
|
35
|
-
rspec-core (~> 3.
|
36
|
-
rspec-expectations (~> 3.
|
37
|
-
rspec-mocks (~> 3.
|
38
|
-
rspec-core (3.
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-expectations (3.1
|
48
|
+
rspec (3.2.0)
|
49
|
+
rspec-core (~> 3.2.0)
|
50
|
+
rspec-expectations (~> 3.2.0)
|
51
|
+
rspec-mocks (~> 3.2.0)
|
52
|
+
rspec-core (3.2.3)
|
53
|
+
rspec-support (~> 3.2.0)
|
54
|
+
rspec-expectations (3.2.1)
|
41
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-mocks (3.1
|
44
|
-
|
45
|
-
|
46
|
-
|
56
|
+
rspec-support (~> 3.2.0)
|
57
|
+
rspec-mocks (3.2.1)
|
58
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
+
rspec-support (~> 3.2.0)
|
60
|
+
rspec-support (3.2.2)
|
61
|
+
simplecov (0.10.0)
|
47
62
|
docile (~> 1.1.0)
|
48
|
-
|
49
|
-
simplecov-html (~> 0.
|
50
|
-
simplecov-html (0.
|
51
|
-
slim (3.0.
|
63
|
+
json (~> 1.8)
|
64
|
+
simplecov-html (~> 0.10.0)
|
65
|
+
simplecov-html (0.10.0)
|
66
|
+
slim (3.0.3)
|
52
67
|
temple (~> 0.7.3)
|
53
68
|
tilt (>= 1.3.3, < 2.1)
|
54
69
|
temple (0.7.5)
|
55
70
|
term-ansicolor (1.3.0)
|
56
71
|
tins (~> 1.0)
|
57
72
|
thor (0.19.1)
|
73
|
+
thread_safe (0.3.5)
|
58
74
|
tilt (2.0.1)
|
59
|
-
tins (1.
|
75
|
+
tins (1.5.1)
|
76
|
+
tzinfo (1.2.2)
|
77
|
+
thread_safe (~> 0.1)
|
78
|
+
unf (0.1.4)
|
79
|
+
unf_ext
|
80
|
+
unf_ext (0.0.7.1)
|
60
81
|
|
61
82
|
PLATFORMS
|
62
83
|
ruby
|
63
84
|
|
64
85
|
DEPENDENCIES
|
65
|
-
appraisal (=
|
86
|
+
appraisal (= 2.0.1)
|
66
87
|
bundler (~> 1.3)
|
67
|
-
coveralls
|
88
|
+
coveralls (~> 0)
|
68
89
|
haml (~> 4.0)
|
69
|
-
rake
|
70
|
-
rspec (~> 3.1
|
90
|
+
rake (~> 10.4)
|
91
|
+
rspec (~> 3.1)
|
71
92
|
shortcode!
|
72
93
|
slim (~> 3.0)
|
data/README.md
CHANGED
@@ -27,8 +27,8 @@ Or install it yourself as:
|
|
27
27
|
$ gem install shortcode
|
28
28
|
```
|
29
29
|
|
30
|
-
Shortcode is tested against ruby version
|
31
|
-
Rails versions 3.
|
30
|
+
Shortcode is tested against ruby version 2.0, 2.1, and 2.2 as well as jruby, it will not work with ruby 1.8 and is no longer tested against ruby 1.9. Shortcode rails integration is tested against
|
31
|
+
Rails versions 3.2, 4.0, 4.1 and 4.2.
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
@@ -201,7 +201,12 @@ Shortcode.process('[gallery]', { images: @post.images })
|
|
201
201
|
To register a presenter simply call `Shortcode.register_presenter` passing the presenter class e.g.
|
202
202
|
|
203
203
|
```ruby
|
204
|
+
# A single presenter
|
204
205
|
Shortcode.register_presenter(CustomPresenter)
|
206
|
+
|
207
|
+
# Or multiple presenters in one call
|
208
|
+
Shortcode.register_presenter(CustomPresenter, AnotherPresenter)
|
209
|
+
|
205
210
|
```
|
206
211
|
|
207
212
|
### Configuration
|
data/gemfiles/rails_3.2.gemfile
CHANGED
data/gemfiles/rails_4.0.gemfile
CHANGED
data/gemfiles/rails_4.1.gemfile
CHANGED
data/gemfiles/rails_4.2.gemfile
CHANGED
data/lib/shortcode.rb
CHANGED
@@ -23,8 +23,10 @@ module Shortcode
|
|
23
23
|
yield configuration
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.register_presenter(
|
27
|
-
|
26
|
+
def self.register_presenter(*presenters)
|
27
|
+
presenters.each do |presenter|
|
28
|
+
Shortcode::Presenter.register presenter
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
32
|
private
|
data/lib/shortcode/version.rb
CHANGED
data/shortcode.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "parslet", "1.
|
21
|
+
spec.add_dependency "parslet", "1.7.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
-
spec.add_development_dependency "rake", "~>
|
24
|
+
spec.add_development_dependency "rake", "~> 10.4"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.1"
|
26
26
|
spec.add_development_dependency "coveralls", "~> 0"
|
27
27
|
spec.add_development_dependency "slim", "~> 3.0"
|
data/spec/presenter_spec.rb
CHANGED
@@ -3,6 +3,7 @@ require 'parslet/rig/rspec'
|
|
3
3
|
require 'pp'
|
4
4
|
|
5
5
|
require 'support/presenters/my_presenter'
|
6
|
+
require 'support/presenters/other_presenter'
|
6
7
|
require 'support/presenters/multiple_presenter'
|
7
8
|
require 'support/presenters/missing_for_presenter'
|
8
9
|
require 'support/presenters/missing_initialize_presenter'
|
@@ -57,6 +58,35 @@ describe Shortcode::Presenter do
|
|
57
58
|
|
58
59
|
end
|
59
60
|
|
61
|
+
context "presenter registration" do
|
62
|
+
|
63
|
+
describe "registering a single presenter" do
|
64
|
+
|
65
|
+
before do
|
66
|
+
Shortcode.register_presenter MyPresenter
|
67
|
+
end
|
68
|
+
|
69
|
+
it "adds the presenter to the list" do
|
70
|
+
expect(Shortcode::Presenter.presenters).to include(MyPresenter.for)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "registering multiple presenters" do
|
76
|
+
|
77
|
+
before do
|
78
|
+
Shortcode.register_presenter(MyPresenter, OtherPresenter)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "adds the presenter to the list" do
|
82
|
+
expect(Shortcode::Presenter.presenters).to include(MyPresenter.for)
|
83
|
+
expect(Shortcode::Presenter.presenters).to include(OtherPresenter.for)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
60
90
|
context "presenter validation" do
|
61
91
|
|
62
92
|
describe "missing #for class method" do
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class OtherPresenter
|
2
|
+
|
3
|
+
def self.for
|
4
|
+
:other
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(attributes, content, additional_attributes)
|
8
|
+
@content = content
|
9
|
+
@additional_attributes = additional_attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
def content
|
13
|
+
@content
|
14
|
+
end
|
15
|
+
|
16
|
+
def attributes
|
17
|
+
@additional_attributes || { title: "my custom title" }
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shortcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Dyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '10.4'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '10.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,7 +125,6 @@ files:
|
|
125
125
|
- LICENSE.txt
|
126
126
|
- README.md
|
127
127
|
- Rakefile
|
128
|
-
- gemfiles/rails_3.1.gemfile
|
129
128
|
- gemfiles/rails_3.2.gemfile
|
130
129
|
- gemfiles/rails_4.0.gemfile
|
131
130
|
- gemfiles/rails_4.1.gemfile
|
@@ -186,6 +185,7 @@ files:
|
|
186
185
|
- spec/support/presenters/missing_initialize_presenter.rb
|
187
186
|
- spec/support/presenters/multiple_presenter.rb
|
188
187
|
- spec/support/presenters/my_presenter.rb
|
188
|
+
- spec/support/presenters/other_presenter.rb
|
189
189
|
- spec/support/templates/erb/collapsible_list.html.erb
|
190
190
|
- spec/support/templates/erb/custom_helper.html.erb
|
191
191
|
- spec/support/templates/erb/item.html.erb
|
@@ -270,6 +270,7 @@ test_files:
|
|
270
270
|
- spec/support/presenters/missing_initialize_presenter.rb
|
271
271
|
- spec/support/presenters/multiple_presenter.rb
|
272
272
|
- spec/support/presenters/my_presenter.rb
|
273
|
+
- spec/support/presenters/other_presenter.rb
|
273
274
|
- spec/support/templates/erb/collapsible_list.html.erb
|
274
275
|
- spec/support/templates/erb/custom_helper.html.erb
|
275
276
|
- spec/support/templates/erb/item.html.erb
|