middlemac-extras 1.0.6 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +4 -0
  3. data/.gitignore +8 -1
  4. data/.yardopts +7 -0
  5. data/CHANGELOG.md +55 -9
  6. data/Rakefile +206 -7
  7. data/documentation_project/Gemfile +3 -3
  8. data/documentation_project/config.rb +2 -6
  9. data/documentation_project/source/api_reference.html.md.erb +38 -0
  10. data/documentation_project/source/cli.html.md.erb +4 -3
  11. data/documentation_project/source/config_rb.html.md.erb +1 -2
  12. data/documentation_project/source/css_image_sizes.html.md.erb +2 -3
  13. data/documentation_project/source/image_tag.html.md.erb +1 -2
  14. data/documentation_project/source/index.html.md.erb +8 -7
  15. data/documentation_project/source/license.html.md.erb +1 -2
  16. data/documentation_project/source/md_images.html.md.erb +1 -2
  17. data/documentation_project/source/md_links.html.md.erb +1 -2
  18. data/documentation_project/source/partials/_yard_config.erb +200 -0
  19. data/documentation_project/source/partials/_yard_helpers.erb +192 -0
  20. data/documentation_project/source/partials/_yard_helpers_extended.erb +135 -0
  21. data/documentation_project/source/stylesheets/_middlemac_minimal.scss +281 -0
  22. data/features/helpers.feature +39 -0
  23. data/features/support/env.rb +20 -0
  24. data/fixtures/middlemac_extras_app/config.rb +7 -0
  25. data/fixtures/middlemac_extras_app/source/images/middlemac-extras-small.png +0 -0
  26. data/fixtures/middlemac_extras_app/source/images/middlemac-extras-small@2x.png +0 -0
  27. data/fixtures/middlemac_extras_app/source/images/middlemac-extras-smaller.png +0 -0
  28. data/fixtures/middlemac_extras_app/source/index.html.md.erb +31 -0
  29. data/lib/middlemac-extras/extension.rb +187 -61
  30. data/lib/middlemac-extras/version.rb +1 -1
  31. data/middlemac-extras.gemspec +44 -17
  32. data/yard/readme.md +6 -0
  33. data/yard/template-grouped/default/module/html/method_details_list.erb +11 -0
  34. data/yard/template-partials/default/method_details/setup.rb +4 -0
  35. data/yard/template-partials/default/module/html/attribute_details.erb +9 -0
  36. data/yard/template-partials/default/module/html/method_details_list.erb +10 -0
  37. data/yard/template-partials/default/module/setup.rb +6 -0
  38. data/yard/template-partials/default/onefile/html/layout.erb +1 -0
  39. data/yard/template-partials/default/onefile/html/setup.rb +4 -0
  40. data/yard/yard_extensions.rb +109 -0
  41. metadata +118 -23
@@ -2,26 +2,53 @@
2
2
  $:.push File.expand_path('../lib', __FILE__)
3
3
  require 'middlemac-extras/version'
4
4
 
5
+ # We should work with any 4.3.x version of Middleman, but due to #2319,
6
+ # automatic image alt attributes have been removed from Middleman, so
7
+ # I'm adjusting the minimum requirement to the first release incorporating
8
+ # that change.
9
+
10
+ mm_needed = ['~> 4.3.0', '>= 4.3.7']
11
+
12
+ # We should work with any 2.0 version of Ruby, but I'm no longer testing them
13
+ # for regressions. Version 2.6.0 goes back to December 2018, and is a suitable
14
+ # minimum version.
15
+ #
16
+ # Currently no released version of Middleman works with Ruby 3, so until that is
17
+ # resolved, We will only support 2.6 up to and not including Ruby 3.0.
18
+
19
+ rb_needed = ['~> 2.0', '>= 2.6']
20
+
21
+
5
22
  Gem::Specification.new do |s|
6
- s.name = 'middlemac-extras'
7
- s.version = Middleman::MiddlemacExtras::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Jim Derry']
10
- s.email = ['balthisar@gmail.com']
11
- s.homepage = 'https://github.com/middlemac/middlemac-extras'
12
- s.summary = 'Implements several useful developer conveniences for Middleman projects.'
13
- s.description = 'Implements several useful developer conveniences for Middleman projects.'
14
- s.license = 'MIT'
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ['lib']
23
+
24
+ s.required_ruby_version = rb_needed
25
+ s.name = 'middlemac-extras'
26
+ s.version = Middleman::MiddlemacExtras::VERSION
27
+ s.platform = Gem::Platform::RUBY
28
+ s.authors = ['Jim Derry']
29
+ s.email = ['balthisar@gmail.com']
30
+ s.homepage = 'https://github.com/middlemac/middlemac-extras'
31
+ s.summary = 'Implements several useful developer conveniences for Middleman projects.'
32
+ s.description = 'Implements several useful developer conveniences for Middleman projects.'
33
+ s.license = 'MIT'
34
+
35
+ s.files = `git ls-files`.split("\n")
36
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
37
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
38
+ s.require_paths = ['lib']
20
39
 
21
40
  # The version of middleman-core your extension depends on
22
- s.add_runtime_dependency('middleman-core', ['~> 4.1', '>= 4.1.6'])
41
+ s.add_runtime_dependency('middleman-core', mm_needed)
23
42
 
24
43
  # Additional dependencies
25
- s.add_runtime_dependency('middleman-cli', ['~> 4.1', '>= 4.1.6'])
26
- s.add_runtime_dependency('fastimage', ['~> 1.9', '>= 1.9.0'])
44
+ s.add_runtime_dependency('middleman-cli', mm_needed)
45
+ s.add_runtime_dependency('fastimage', ['~> 2.0'])
46
+
47
+ # Development dependencies
48
+ s.add_development_dependency 'middleman', mm_needed
49
+ s.add_development_dependency 'bundler', '>= 1.6'
50
+ s.add_development_dependency 'rake', '>= 10.3'
51
+ s.add_development_dependency 'git'
52
+ s.add_development_dependency 'capybara', ['~> 2.5.0']
53
+
27
54
  end
data/yard/readme.md ADDED
@@ -0,0 +1,6 @@
1
+ This gem provides conveniences to **Middleman** projects such as CSS-based image
2
+ size limits; easy-to-use Markdown link references (including title!);
3
+ easy-to-use Markdown image references; and an enhanced `image_tag` helper
4
+ that includes @2x images automatically.
5
+
6
+ It is standalone and can be used in any **Middleman** project.
@@ -0,0 +1,11 @@
1
+ <% scopes(method_listing(false)) do |list, scope| %>
2
+ <div id="<%= scope %>_method_details" class="method_details_list">
3
+ <% groups = list.group_by { |g| g.group.nil? ? 'ZZZ' : g.group }.sort.to_h %>
4
+ <% groups.each_value do |group| %>
5
+ <h2><%= group[0].group || "#{scope.to_s.capitalize} Method Details" %></h2>
6
+ <% group.each_with_index do |meth, i| %>
7
+ <%= yieldall :object => meth, :owner => object, :index => i %>
8
+ <% end %>
9
+ <% end %>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,4 @@
1
+ def init
2
+ super
3
+ sections :header, [:method_signature, T('docstring')]
4
+ end
@@ -0,0 +1,9 @@
1
+ <% scopes(attr_listing) do |list, scope| %>
2
+ <div id="<%= scope %>_attr_details" class="attr_details">
3
+ <% list.each_with_index do |meth, i| %>
4
+ <% rw = meth.attr_info %>
5
+ <span id="<%= anchor_for(rw[meth.reader? ? :write : :read]) %>"></span>
6
+ <%= yieldall :object => meth, :owner => object, :index => i %>
7
+ <% end %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% scopes(method_listing(false)) do |list, scope| %>
2
+ <div class="method_details_list">
3
+ <% groups = list.group_by { |g| g.group.nil? ? 'ZZZ' : g.group }.sort.to_h %>
4
+ <% groups.each_value do |group| %>
5
+ <% group.each_with_index do |meth, i| %>
6
+ <%= yieldall :object => meth, :owner => object, :index => i %>
7
+ <% end %>
8
+ <% end %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,6 @@
1
+ include Helpers::ModuleHelper
2
+
3
+ def init
4
+ sections :attribute_details, [T('method_details')],
5
+ :method_details_list, [T('method_details')]
6
+ end
@@ -0,0 +1 @@
1
+ <%= yieldall %>
@@ -0,0 +1,4 @@
1
+ def init
2
+ super
3
+ sections :layout, [:all_objects]
4
+ end
@@ -0,0 +1,109 @@
1
+ ##########################################################################
2
+ # Our template groups the methods by @group instead of lumping all of
3
+ # them together as instance methods. This is because most of them simply
4
+ # *aren't* instance methods but rather helpers or resource methods.
5
+ # This template will be used by default because .yardopts loads this
6
+ # file; however `rake partials` will override this template via the
7
+ # command line in order to use the `template-partials` instead.
8
+ ##########################################################################
9
+ YARD::Templates::Engine.register_template_path File.join(File.dirname(__FILE__), 'template-grouped')
10
+
11
+ ##########################################################################
12
+ # Force Yard to parse the helpers block in a Middleman extension.
13
+ #
14
+ # * Assign a generic "Helpers" group to each item if they don't have
15
+ # their own @group assignment. Note that @!group doesn't work in this
16
+ # section.
17
+ # * Add a @note to each item to distinguish them in a mixed up instance
18
+ # method detail section.
19
+ ##########################################################################
20
+ class HelpersHandler < YARD::Handlers::Ruby::Base
21
+ handles method_call(:helpers)
22
+ namespace_only
23
+
24
+ def process
25
+
26
+ statement.last.last.each do |node|
27
+
28
+ extra = ''
29
+
30
+ # Find out if there's a @group assigned.
31
+ extra << '@group Helpers' unless node.docstring.match(/^@group (.*?)$/i)
32
+
33
+ # Clean up the doc string because we like - and = borders.
34
+ # Force the note and group on each of these "fake" methods.
35
+ if node.docstring
36
+ docstring = node.docstring
37
+ docstring = docstring.gsub(/^[\-=]+\n/, '')
38
+ docstring = docstring.gsub(/[\-=]+$/, '')
39
+ docstring << extra
40
+ node.docstring = docstring
41
+ else
42
+ node.docstring = extra
43
+ end
44
+
45
+ parse_block(node, :owner => self.owner)
46
+ end # do
47
+
48
+ end # def
49
+
50
+ end # class
51
+
52
+
53
+ ##########################################################################
54
+ # Force Yard to parse the resources.each block in a Middleman extension.
55
+ #
56
+ # * Assign a generic "Resource Extensions" group to each item if they
57
+ # don't have their own @group assignment. Note that @!group
58
+ # doesn't work in this section.
59
+ # * Force each item to have a `@visibility public` because we will
60
+ # probably have `@visibility private` in the wrapping method.
61
+ # * Add a @note to each item to distinguish them in a mixed up instance
62
+ # method detail section.
63
+ ##########################################################################
64
+ class ResourcesHandler < YARD::Handlers::Ruby::Base
65
+ handles :def
66
+ namespace_only
67
+
68
+ def process
69
+ extra = <<HEREDOC
70
+ @visibility public
71
+ HEREDOC
72
+
73
+ return unless statement.method_name(true).to_sym == :manipulate_resource_list
74
+
75
+ # Block consists of everything in the actual `do` block
76
+ block = statement.last.first.last.last
77
+ block.each do | node |
78
+ if node.type == :defs
79
+ # Clean up the doc string because we like - and = borders.
80
+ # Force the note and public on each of these "fake" methods.
81
+ if node.docstring
82
+ docstring = node.docstring
83
+ docstring = docstring.gsub(/^[\-=]+\n/, '')
84
+ docstring = docstring.gsub(/[\-=]+$/, '')
85
+ docstring << extra
86
+ else
87
+ docstring = extra
88
+ end
89
+
90
+ # Find out if there's a @group assigned.
91
+ if ( group = docstring.match(/^@group (.*?)$/i) )
92
+ group = group[1]
93
+ else
94
+ group = 'Resource Extensions'
95
+ end
96
+
97
+ def_name = node[2][0]
98
+ object = YARD::CodeObjects::MethodObject.new(namespace, "resource.#{def_name}")
99
+ register(object)
100
+ object.dynamic = true
101
+ object.source = node.source.clone
102
+ object[:docstring] = docstring
103
+ object[:group] = group
104
+ end
105
+ end # do
106
+
107
+ end # def
108
+
109
+ end # class
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middlemac-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Derry
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-08 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -16,60 +16,130 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.1'
19
+ version: 4.3.0
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.1.6
22
+ version: 4.3.7
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '4.1'
29
+ version: 4.3.0
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 4.1.6
32
+ version: 4.3.7
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: middleman-cli
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '4.1'
39
+ version: 4.3.0
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 4.1.6
42
+ version: 4.3.7
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '4.1'
49
+ version: 4.3.0
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 4.1.6
52
+ version: 4.3.7
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: fastimage
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.9'
59
+ version: '2.0'
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: middleman
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: 4.3.0
60
74
  - - ">="
61
75
  - !ruby/object:Gem::Version
62
- version: 1.9.0
63
- type: :runtime
76
+ version: 4.3.7
77
+ type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
81
  - - "~>"
68
82
  - !ruby/object:Gem::Version
69
- version: '1.9'
83
+ version: 4.3.0
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 4.3.7
87
+ - !ruby/object:Gem::Dependency
88
+ name: bundler
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '1.6'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '1.6'
101
+ - !ruby/object:Gem::Dependency
102
+ name: rake
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '10.3'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '10.3'
115
+ - !ruby/object:Gem::Dependency
116
+ name: git
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
70
119
  - - ">="
71
120
  - !ruby/object:Gem::Version
72
- version: 1.9.0
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ - !ruby/object:Gem::Dependency
130
+ name: capybara
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: 2.5.0
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: 2.5.0
73
143
  description: Implements several useful developer conveniences for Middleman projects.
74
144
  email:
75
145
  - balthisar@gmail.com
@@ -78,7 +148,9 @@ executables:
78
148
  extensions: []
79
149
  extra_rdoc_files: []
80
150
  files:
151
+ - ".gitattributes"
81
152
  - ".gitignore"
153
+ - ".yardopts"
82
154
  - CHANGELOG.md
83
155
  - Gemfile
84
156
  - LICENSE.md
@@ -89,6 +161,7 @@ files:
89
161
  - documentation_project/Gemfile
90
162
  - documentation_project/README.md
91
163
  - documentation_project/config.rb
164
+ - documentation_project/source/api_reference.html.md.erb
92
165
  - documentation_project/source/archives/about.html.md.erb
93
166
  - documentation_project/source/archives/index.html.md.erb
94
167
  - documentation_project/source/archives/past_far/about.html.md.erb
@@ -126,38 +199,60 @@ files:
126
199
  - documentation_project/source/license.html.md.erb
127
200
  - documentation_project/source/md_images.html.md.erb
128
201
  - documentation_project/source/md_links.html.md.erb
202
+ - documentation_project/source/partials/_yard_config.erb
203
+ - documentation_project/source/partials/_yard_helpers.erb
204
+ - documentation_project/source/partials/_yard_helpers_extended.erb
129
205
  - documentation_project/source/stylesheets/_github.scss
130
206
  - documentation_project/source/stylesheets/_middlemac_minimal.scss
131
207
  - documentation_project/source/stylesheets/_normalize.scss
132
208
  - documentation_project/source/stylesheets/css_image_sizes.css.erb
133
209
  - documentation_project/source/stylesheets/style.css.scss
210
+ - features/helpers.feature
211
+ - features/support/env.rb
212
+ - fixtures/middlemac_extras_app/config.rb
213
+ - fixtures/middlemac_extras_app/source/images/middlemac-extras-small.png
214
+ - fixtures/middlemac_extras_app/source/images/middlemac-extras-small@2x.png
215
+ - fixtures/middlemac_extras_app/source/images/middlemac-extras-smaller.png
216
+ - fixtures/middlemac_extras_app/source/index.html.md.erb
134
217
  - lib/middlemac-extras.rb
135
218
  - lib/middlemac-extras/extension.rb
136
219
  - lib/middlemac-extras/version.rb
137
220
  - middlemac-extras.gemspec
221
+ - yard/readme.md
222
+ - yard/template-grouped/default/module/html/method_details_list.erb
223
+ - yard/template-partials/default/method_details/setup.rb
224
+ - yard/template-partials/default/module/html/attribute_details.erb
225
+ - yard/template-partials/default/module/html/method_details_list.erb
226
+ - yard/template-partials/default/module/setup.rb
227
+ - yard/template-partials/default/onefile/html/layout.erb
228
+ - yard/template-partials/default/onefile/html/setup.rb
229
+ - yard/yard_extensions.rb
138
230
  homepage: https://github.com/middlemac/middlemac-extras
139
231
  licenses:
140
232
  - MIT
141
233
  metadata: {}
142
- post_install_message:
234
+ post_install_message:
143
235
  rdoc_options: []
144
236
  require_paths:
145
237
  - lib
146
238
  required_ruby_version: !ruby/object:Gem::Requirement
147
239
  requirements:
240
+ - - "~>"
241
+ - !ruby/object:Gem::Version
242
+ version: '2.0'
148
243
  - - ">="
149
244
  - !ruby/object:Gem::Version
150
- version: '0'
245
+ version: '2.6'
151
246
  required_rubygems_version: !ruby/object:Gem::Requirement
152
247
  requirements:
153
248
  - - ">="
154
249
  - !ruby/object:Gem::Version
155
250
  version: '0'
156
251
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.4.8
159
- signing_key:
252
+ rubygems_version: 3.0.9
253
+ signing_key:
160
254
  specification_version: 4
161
255
  summary: Implements several useful developer conveniences for Middleman projects.
162
- test_files: []
163
- has_rdoc:
256
+ test_files:
257
+ - features/helpers.feature
258
+ - features/support/env.rb