keynote 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of keynote might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +1 -8
- data/Appraisals +8 -8
- data/CHANGELOG.md +7 -1
- data/README.md +8 -7
- data/gemfiles/rails32.gemfile +1 -1
- data/gemfiles/rails40.gemfile +1 -1
- data/gemfiles/rails41.gemfile +1 -1
- data/gemfiles/{rails30.gemfile → rails42.gemfile} +2 -2
- data/keynote.gemspec +1 -1
- data/lib/generators/presenter_generator.rb +0 -8
- data/lib/keynote/inline.rb +33 -11
- data/lib/keynote/testing/minitest_rails.rake +4 -15
- data/lib/keynote/version.rb +1 -1
- data/spec/generator_spec.rb +4 -1
- metadata +34 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5580937686785fe2aed29d208952f1273be81215
|
4
|
+
data.tar.gz: a4e7781866312b33d3d32013f994e385bb3f7bbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e14e73225a31a0952a2873ec55457899fa2c11b80731ed4a19c59edfb10f7d99a9a2a14f8bcdcee243f292ad9024a90ae11f1b3ff591397d36f5a4d4b2e39b6
|
7
|
+
data.tar.gz: fa5e14539c2ba3e4ee8e1e0b76577e20079b450eba4c41217aa656b76afbbf7708537f389ce2e9a211a176b83226d4c408989e16fb577a137ca6faf3fba50251
|
data/.travis.yml
CHANGED
@@ -1,22 +1,15 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.2
|
4
3
|
- 1.9.3
|
5
4
|
- 2.0.0
|
6
5
|
- 2.1.0
|
7
6
|
- rbx-2
|
8
7
|
- jruby-19mode
|
9
8
|
gemfile:
|
10
|
-
- gemfiles/rails30.gemfile
|
11
9
|
- gemfiles/rails31.gemfile
|
12
10
|
- gemfiles/rails32.gemfile
|
13
11
|
- gemfiles/rails40.gemfile
|
14
12
|
- gemfiles/rails41.gemfile
|
15
|
-
|
16
|
-
exclude:
|
17
|
-
- rvm: 1.9.2
|
18
|
-
gemfile: gemfiles/rails40.gemfile
|
19
|
-
- rvm: 1.9.2
|
20
|
-
gemfile: gemfiles/rails41.gemfile
|
13
|
+
- gemfiles/rails42.gemfile
|
21
14
|
notifications:
|
22
15
|
email: false
|
data/Appraisals
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
appraise "rails30" do
|
2
|
-
gem "rails", "3.0.20"
|
3
|
-
gem "minitest", "< 5"
|
4
|
-
end
|
5
|
-
|
6
1
|
appraise "rails31" do
|
7
2
|
gem "rails", "3.1.12"
|
8
3
|
gem "minitest", "< 5"
|
9
4
|
end
|
10
5
|
|
11
6
|
appraise "rails32" do
|
12
|
-
gem "rails", "3.2.
|
7
|
+
gem "rails", "3.2.21"
|
13
8
|
gem "minitest", "< 5"
|
14
9
|
end
|
15
10
|
|
16
11
|
appraise "rails40" do
|
17
|
-
gem "rails", "4.0.
|
12
|
+
gem "rails", "4.0.13"
|
18
13
|
gem "minitest", "< 5"
|
19
14
|
end
|
20
15
|
|
21
16
|
appraise "rails41" do
|
22
|
-
gem "rails", "4.1.
|
17
|
+
gem "rails", "4.1.9"
|
18
|
+
gem "minitest", "~> 5.0"
|
19
|
+
end
|
20
|
+
|
21
|
+
appraise "rails42" do
|
22
|
+
gem "rails", "4.2.0"
|
23
23
|
gem "minitest", "~> 5.0"
|
24
24
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1
|
+
## v0.3.0
|
2
|
+
* Drop support for Rails 3.0 and Ruby 1.9.2; add support for Rails 4.2.
|
3
|
+
* Drop support for MiniTest::Rails versions older than 2.0; add support for 2.0
|
4
|
+
and higher. (@kirs)
|
5
|
+
|
1
6
|
## v0.2.3
|
2
7
|
* Allow user to pass the string version of the presenter name into
|
3
8
|
`Keynote.present` as an alternative to passing a symbol. This makes it less
|
4
9
|
awkward to use namespaced presenters, but it does remove the possibility of
|
5
10
|
defining a `StringPresenter` and using it with code like
|
6
11
|
`k('some string').format_as_markdown`. It seems unlikely that anyone is
|
7
|
-
actually doing that though.
|
12
|
+
actually doing that though. (@outpunk)
|
8
13
|
* Update RSpec integration to not print deprecation warnings with RSpec 3.
|
14
|
+
(@DarthSim)
|
9
15
|
|
10
16
|
## v0.2.2
|
11
17
|
* Fix another RSpec integration bug, which happened in cases where the app's
|
data/README.md
CHANGED
@@ -186,11 +186,9 @@ though:
|
|
186
186
|
|
187
187
|
### Why not use decorators?
|
188
188
|
|
189
|
-
The biggest distinction between Keynote and similar libraries like
|
190
|
-
[
|
191
|
-
|
192
|
-
presenters aren't decorators -- undefined method calls don't
|
193
|
-
fall through to an underlying model.
|
189
|
+
The biggest distinction between Keynote and similar libraries like [Draper] and
|
190
|
+
[DisplayCase] is that Keynote presenters aren't decorators – undefined method
|
191
|
+
calls don't fall through to an underlying model.
|
194
192
|
|
195
193
|
Applying the Decorator pattern to generating views is a reasonable thing to do.
|
196
194
|
However, this practice also has some downsides.
|
@@ -227,8 +225,8 @@ Test::Unit or MiniTest::Rails if applicable.
|
|
227
225
|
|
228
226
|
## Compatibility
|
229
227
|
|
230
|
-
Keynote is supported on Rails 3.
|
231
|
-
testable with Test::Unit, RSpec, and MiniTest::Rails.
|
228
|
+
Keynote is supported on Rails 3.1, 3.2, 4.0, 4.1, and 4.2. Keynote presenters
|
229
|
+
are testable with Test::Unit, RSpec, and MiniTest::Rails (>= 2.0).
|
232
230
|
|
233
231
|
If you find problems with any of the above integrations, please open an issue.
|
234
232
|
|
@@ -244,3 +242,6 @@ $ bundle exec rake appraisal
|
|
244
242
|
|
245
243
|
Feel free to submit pull requests according to the usual conventions for Ruby
|
246
244
|
projects.
|
245
|
+
|
246
|
+
[DisplayCase]: https://github.com/objects-on-rails/display-case
|
247
|
+
[Draper]: https://github.com/drapergem/draper
|
data/gemfiles/rails32.gemfile
CHANGED
data/gemfiles/rails40.gemfile
CHANGED
data/gemfiles/rails41.gemfile
CHANGED
data/keynote.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
gem.version = Keynote::VERSION
|
21
21
|
|
22
|
-
gem.add_dependency 'rails', '>= 3.
|
22
|
+
gem.add_dependency 'rails', '>= 3.1.0'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'appraisal'
|
25
25
|
gem.add_development_dependency 'minitest'
|
@@ -65,13 +65,5 @@ module Rails::Generators
|
|
65
65
|
def target_names
|
66
66
|
targets.map { |t| ":#{t}" }
|
67
67
|
end
|
68
|
-
|
69
|
-
if ::Rails.version.to_f < 3.1
|
70
|
-
protected
|
71
|
-
# This method doesn't exist in Rails 3.0
|
72
|
-
def module_namespacing
|
73
|
-
yield if block_given?
|
74
|
-
end
|
75
|
-
end
|
76
68
|
end
|
77
69
|
end
|
data/lib/keynote/inline.rb
CHANGED
@@ -187,6 +187,10 @@ module Keynote
|
|
187
187
|
unindent result.chomp
|
188
188
|
end
|
189
189
|
|
190
|
+
def handler_for_format(format)
|
191
|
+
ActionView::Template.handler_for_extension(format.to_s)
|
192
|
+
end
|
193
|
+
|
190
194
|
# Borrowed from Pry, which borrowed it from Python.
|
191
195
|
def unindent(text, left_padding = 0)
|
192
196
|
margin = text.scan(/^[ \t]*(?=[^ \t\n])/).inject do |current_margin, next_indent|
|
@@ -201,20 +205,10 @@ module Keynote
|
|
201
205
|
|
202
206
|
text.gsub(/^#{margin}/, ' ' * left_padding)
|
203
207
|
end
|
204
|
-
|
205
|
-
if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 0
|
206
|
-
def handler_for_format(format)
|
207
|
-
ActionView::Template.handler_class_for_extension(format.to_s)
|
208
|
-
end
|
209
|
-
else
|
210
|
-
def handler_for_format(format)
|
211
|
-
ActionView::Template.handler_for_extension(format.to_s)
|
212
|
-
end
|
213
|
-
end
|
214
208
|
end
|
215
209
|
|
216
210
|
# @private
|
217
|
-
class
|
211
|
+
class TemplateFor41AndLower < ActionView::Template
|
218
212
|
# Older versions of Rails don't have this mutex, but we probably want it,
|
219
213
|
# so let's make sure it's there.
|
220
214
|
def initialize(*)
|
@@ -239,5 +233,33 @@ module Keynote
|
|
239
233
|
end
|
240
234
|
end
|
241
235
|
end
|
236
|
+
|
237
|
+
# @private
|
238
|
+
class TemplateFor42AndHigher < ActionView::Template
|
239
|
+
# The only difference between this #compile! and the normal one is that
|
240
|
+
# we call `view.class` instead of `view.singleton_class`, so that the
|
241
|
+
# template method gets defined as an instance method on the presenter
|
242
|
+
# and therefore sticks around between presenter instances.
|
243
|
+
def compile!(view)
|
244
|
+
return if @compiled
|
245
|
+
|
246
|
+
@compile_mutex.synchronize do
|
247
|
+
return if @compiled
|
248
|
+
|
249
|
+
compile(view.class)
|
250
|
+
|
251
|
+
@source = nil if @virtual_path
|
252
|
+
@compiled = true
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
if Rails.version.to_f < 4.2
|
258
|
+
# @private
|
259
|
+
Template = TemplateFor41AndLower
|
260
|
+
else
|
261
|
+
# @private
|
262
|
+
Template = TemplateFor42AndHigher
|
263
|
+
end
|
242
264
|
end
|
243
265
|
end
|
@@ -1,18 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require "minitest/rails/tasks/sub_test_task"
|
6
|
-
|
7
|
-
MiniTest::Rails::Testing.default_tasks << "presenters"
|
8
|
-
|
9
|
-
namespace "minitest" do
|
10
|
-
unless Rake::Task.task_defined? "minitest:presenters"
|
11
|
-
desc "Runs tests under test/presenters"
|
12
|
-
MiniTest::Rails::Tasks::SubTestTask.new("presenters" => "test:prepare") do |t|
|
13
|
-
t.libs.push "test"
|
14
|
-
t.pattern = "test/presenters/**/*_test.rb"
|
15
|
-
t.options = MiniTest::Rails::Testing.task_opts["presenters"] if MiniTest::Rails::Testing.task_opts["presenters"]
|
16
|
-
end
|
17
|
-
end
|
3
|
+
Rails::TestTask.new("test:presenters" => "test:prepare") do |t|
|
4
|
+
t.pattern = "test/presenters/**/*_test.rb"
|
18
5
|
end
|
6
|
+
|
7
|
+
Rake::Task["test:run"].enhance ["test:presenters"]
|
data/lib/keynote/version.rb
CHANGED
data/spec/generator_spec.rb
CHANGED
@@ -15,7 +15,10 @@ describe "generators" do
|
|
15
15
|
:destination_root => output_path
|
16
16
|
|
17
17
|
assert retval, 'Generator must succeed'
|
18
|
-
|
18
|
+
|
19
|
+
output_files = Dir["#{output_path}/**/*.rb"]
|
20
|
+
|
21
|
+
yield output_files.map { |path| path.sub("#{output_path}/", '') }.sort
|
19
22
|
ensure
|
20
23
|
FileUtils.rm_rf(output_path)
|
21
24
|
end
|
metadata
CHANGED
@@ -1,179 +1,179 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keynote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Fitzgerald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.1.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: 3.
|
26
|
+
version: 3.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: appraisal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
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
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mocha
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: slim
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: haml
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: redcarpet
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description:
|
153
|
+
description: " A presenter is an object that encapsulates view logic. Like Rails helpers,
|
154
154
|
presenters help you keep complex logic out of your templates. Keynote provides a
|
155
|
-
consistent interface for defining and instantiating presenters.
|
155
|
+
consistent interface for defining and instantiating presenters. "
|
156
156
|
email:
|
157
157
|
- rwfitzge@gmail.com
|
158
158
|
executables: []
|
159
159
|
extensions: []
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
|
-
- .editorconfig
|
163
|
-
- .gitignore
|
164
|
-
- .travis.yml
|
165
|
-
- .yardopts
|
162
|
+
- ".editorconfig"
|
163
|
+
- ".gitignore"
|
164
|
+
- ".travis.yml"
|
165
|
+
- ".yardopts"
|
166
166
|
- Appraisals
|
167
167
|
- CHANGELOG.md
|
168
168
|
- Gemfile
|
169
169
|
- LICENSE
|
170
170
|
- README.md
|
171
171
|
- Rakefile
|
172
|
-
- gemfiles/rails30.gemfile
|
173
172
|
- gemfiles/rails31.gemfile
|
174
173
|
- gemfiles/rails32.gemfile
|
175
174
|
- gemfiles/rails40.gemfile
|
176
175
|
- gemfiles/rails41.gemfile
|
176
|
+
- gemfiles/rails42.gemfile
|
177
177
|
- keynote.gemspec
|
178
178
|
- lib/generators/presenter_generator.rb
|
179
179
|
- lib/generators/templates/keynote_mini_test_spec.rb
|
@@ -213,17 +213,17 @@ require_paths:
|
|
213
213
|
- lib
|
214
214
|
required_ruby_version: !ruby/object:Gem::Requirement
|
215
215
|
requirements:
|
216
|
-
- -
|
216
|
+
- - ">="
|
217
217
|
- !ruby/object:Gem::Version
|
218
218
|
version: '0'
|
219
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
220
|
requirements:
|
221
|
-
- -
|
221
|
+
- - ">="
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
225
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.4.4
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: Flexible presenters for Rails.
|