middleman-pagegroups 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -1
  3. data/.yardopts +8 -0
  4. data/CHANGELOG.md +24 -4
  5. data/README.md +5 -5
  6. data/Rakefile +201 -7
  7. data/documentation_project/Gemfile +2 -2
  8. data/documentation_project/config.rb +15 -19
  9. data/documentation_project/source/documentation/100_nested_folder/another_file.html.md.erb +19 -0
  10. data/documentation_project/source/documentation/100_nested_folder/index.html.md.erb +25 -0
  11. data/documentation_project/source/documentation/100_nested_folder/one_file.html.md.erb +11 -0
  12. data/documentation_project/source/documentation/100_nested_folder/stray.txt +6 -0
  13. data/documentation_project/source/documentation/10_concepts.html.md.erb +1 -1
  14. data/documentation_project/source/documentation/20_directory_organization.html.md.erb +12 -10
  15. data/documentation_project/source/documentation/40_resources.html.md.erb +3 -68
  16. data/documentation_project/source/documentation/50_helpers.html.md.erb +41 -163
  17. data/documentation_project/source/documentation/60_sample_partials.html.md.erb +23 -22
  18. data/documentation_project/source/documentation/80_config.html.md.erb +6 -0
  19. data/documentation_project/source/documentation/90_cli.html.md.erb +47 -0
  20. data/documentation_project/source/partials/_yard_config.erb +744 -0
  21. data/documentation_project/source/partials/_yard_helpers.erb +710 -0
  22. data/documentation_project/source/partials/_yard_helpers_css.erb +523 -0
  23. data/documentation_project/source/partials/_yard_helpers_extended.erb +56 -0
  24. data/documentation_project/source/partials/_yard_resources.erb +540 -0
  25. data/documentation_project/source/stylesheets/_middlemac_minimal.scss +287 -0
  26. data/features/helpers_and_resources.feature +120 -0
  27. data/features/support/env.rb +20 -0
  28. data/fixtures/middleman_pagegroups_app/config.rb +17 -0
  29. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/index.html.md.erb +8 -0
  30. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/not_legitimate.html.md.erb +8 -0
  31. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/sibling_one.html.md.erb +8 -0
  32. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/sibling_two.html.md.erb +8 -0
  33. data/fixtures/middleman_pagegroups_app/source/_partial.md.erb +111 -0
  34. data/fixtures/middleman_pagegroups_app/source/index.html.md.erb +23 -0
  35. data/fixtures/middleman_pagegroups_app/source/layout.erb +6 -0
  36. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/10_sibling_one.html.md.erb +7 -0
  37. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/20_sibling_two.html.md.erb +7 -0
  38. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/30_sibling_three.html.md.erb +7 -0
  39. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/index.html.md.erb +9 -0
  40. data/lib/middleman-pagegroups/extension.rb +468 -110
  41. data/lib/middleman-pagegroups/partials.rb +9 -12
  42. data/lib/middleman-pagegroups/version.rb +1 -1
  43. data/middleman-pagegroups.gemspec +10 -2
  44. data/yard/readme.md +5 -0
  45. data/yard/template-grouped/default/module/html/method_details_list.erb +11 -0
  46. data/yard/template-partials/default/method_details/setup.rb +4 -0
  47. data/yard/template-partials/default/module/html/attribute_details.erb +9 -0
  48. data/yard/template-partials/default/module/html/method_details_list.erb +10 -0
  49. data/yard/template-partials/default/module/setup.rb +6 -0
  50. data/yard/template-partials/default/onefile/html/layout.erb +1 -0
  51. data/yard/template-partials/default/onefile/html/setup.rb +4 -0
  52. data/yard/yard_extensions.rb +109 -0
  53. metadata +105 -7
@@ -1,14 +1,12 @@
1
1
  ################################################################################
2
- # partials
3
- # Here's the deal: this is an extension and not an extension+template, so in
4
- # order to provide some modicum of usefulness to users, we're providing some
5
- # template-like helpers in the extension. This file constitutes the source
6
- # for them, with the added benefit that we can recycle the values in the
7
- # console application and generate real partial templates for users that
8
- # prefer pure MVC.
2
+ # Given that `middleman-pagegroups` is an extension and not a template, we
3
+ # don’t have partials. However we are capable of building the partials using
4
+ # the CLI, and using this same code base provide helpers.
5
+ #
6
+ # Because of recursion, `MM_TOC_INDEX` will only be used to build a partial;
7
+ # the helper internally generates identical output but is constructed just a
8
+ # bit differently.
9
9
  ################################################################################
10
-
11
-
12
10
  module MMPartials
13
11
 
14
12
  MM_BREADCRUMBS = <<HEREDOC
@@ -156,8 +154,8 @@ HEREDOC
156
154
 
157
155
 
158
156
  #########################################################
159
- # MM_PARTIALS
160
- # Used by the CLI application to build partial files.
157
+ # The CLI application will use this array to generate
158
+ # partials using the given :filename with the :content.
161
159
  #########################################################
162
160
  MM_PARTIALS = [
163
161
  { :filename => '_nav_breadcrumbs.haml', :content => MM_BREADCRUMBS },
@@ -169,5 +167,4 @@ HEREDOC
169
167
  { :filename => '_nav_toc_index.haml', :content => MM_TOC_INDEX },
170
168
  ]
171
169
 
172
-
173
170
  end # module
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module MiddlemanPageGroups
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  end
5
5
  end
@@ -2,6 +2,8 @@
2
2
  $:.push File.expand_path('../lib', __FILE__)
3
3
  require 'middleman-pagegroups/version'
4
4
 
5
+ mm_needed = ['~> 4.1', '>= 4.1.7']
6
+
5
7
  Gem::Specification.new do |s|
6
8
  s.name = 'middleman-pagegroups'
7
9
  s.version = Middleman::MiddlemanPageGroups::VERSION
@@ -19,8 +21,14 @@ Gem::Specification.new do |s|
19
21
  s.require_paths = ['lib']
20
22
 
21
23
  # The version of middleman-core your extension depends on
22
- s.add_runtime_dependency('middleman-core', ['~> 4.1', '>= 4.1.6'])
24
+ s.add_runtime_dependency('middleman-core', mm_needed)
23
25
 
24
26
  # Additional dependencies
25
- s.add_runtime_dependency('middleman-cli', ['~> 4.1', '>= 4.1.6'])
27
+ s.add_runtime_dependency('middleman-cli', mm_needed)
28
+
29
+ # Development dependencies
30
+ s.add_development_dependency 'middleman', mm_needed
31
+ s.add_development_dependency 'bundler', '>= 1.6'
32
+ s.add_development_dependency 'rake', '>= 10.3'
33
+ s.add_development_dependency 'git'
26
34
  end
data/yard/readme.md ADDED
@@ -0,0 +1,5 @@
1
+ This gem provides advanced navigation tools and helpers for grouping pages
2
+ by topic and navigating between them. It includes support for tables of
3
+ content, related pages, breadcrumbs, and more.
4
+
5
+ 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: middleman-pagegroups
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Derry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.1.6
22
+ version: 4.1.7
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 4.1.6
32
+ version: 4.1.7
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: middleman-cli
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '4.1'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 4.1.6
42
+ version: 4.1.7
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,69 @@ dependencies:
49
49
  version: '4.1'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 4.1.6
52
+ version: 4.1.7
53
+ - !ruby/object:Gem::Dependency
54
+ name: middleman
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '4.1'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 4.1.7
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '4.1'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 4.1.7
73
+ - !ruby/object:Gem::Dependency
74
+ name: bundler
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '1.6'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '1.6'
87
+ - !ruby/object:Gem::Dependency
88
+ name: rake
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '10.3'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '10.3'
101
+ - !ruby/object:Gem::Dependency
102
+ name: git
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
53
115
  description: Provides logical page groups and easy navigation for Middleman projects.
54
116
  email:
55
117
  - balthisar@gmail.com
@@ -59,6 +121,7 @@ extensions: []
59
121
  extra_rdoc_files: []
60
122
  files:
61
123
  - ".gitignore"
124
+ - ".yardopts"
62
125
  - CHANGELOG.md
63
126
  - Gemfile
64
127
  - LICENSE.md
@@ -69,6 +132,10 @@ files:
69
132
  - documentation_project/Gemfile
70
133
  - documentation_project/README.md
71
134
  - documentation_project/config.rb
135
+ - documentation_project/source/documentation/100_nested_folder/another_file.html.md.erb
136
+ - documentation_project/source/documentation/100_nested_folder/index.html.md.erb
137
+ - documentation_project/source/documentation/100_nested_folder/one_file.html.md.erb
138
+ - documentation_project/source/documentation/100_nested_folder/stray.txt
72
139
  - documentation_project/source/documentation/10_concepts.html.md.erb
73
140
  - documentation_project/source/documentation/20_directory_organization.html.md.erb
74
141
  - documentation_project/source/documentation/30_frontmatter.html.md.erb
@@ -77,6 +144,7 @@ files:
77
144
  - documentation_project/source/documentation/60_sample_partials.html.md.erb
78
145
  - documentation_project/source/documentation/70_sample_layouts.html.md.erb
79
146
  - documentation_project/source/documentation/80_config.html.md.erb
147
+ - documentation_project/source/documentation/90_cli.html.md.erb
80
148
  - documentation_project/source/documentation/index.html.md.erb
81
149
  - documentation_project/source/documentation/ovum.html.md.erb
82
150
  - documentation_project/source/fonts/font-awesome/FontAwesome.otf
@@ -101,17 +169,45 @@ files:
101
169
  - documentation_project/source/partials/_nav_legitimate_children.haml
102
170
  - documentation_project/source/partials/_nav_prev_next.haml
103
171
  - documentation_project/source/partials/_nav_toc_index.haml
172
+ - documentation_project/source/partials/_yard_config.erb
173
+ - documentation_project/source/partials/_yard_helpers.erb
174
+ - documentation_project/source/partials/_yard_helpers_css.erb
175
+ - documentation_project/source/partials/_yard_helpers_extended.erb
176
+ - documentation_project/source/partials/_yard_resources.erb
104
177
  - documentation_project/source/stylesheets/_github.scss
105
178
  - documentation_project/source/stylesheets/_middlemac_minimal.scss
106
179
  - documentation_project/source/stylesheets/_normalize.scss
107
180
  - documentation_project/source/stylesheets/breadcrumb-separator-light.png
108
181
  - documentation_project/source/stylesheets/style.css.scss
109
182
  - documentation_project/source/toc.html.md.erb
183
+ - features/helpers_and_resources.feature
184
+ - features/support/env.rb
185
+ - fixtures/middleman_pagegroups_app/config.rb
186
+ - fixtures/middleman_pagegroups_app/source/20_sub_folder_02/index.html.md.erb
187
+ - fixtures/middleman_pagegroups_app/source/20_sub_folder_02/not_legitimate.html.md.erb
188
+ - fixtures/middleman_pagegroups_app/source/20_sub_folder_02/sibling_one.html.md.erb
189
+ - fixtures/middleman_pagegroups_app/source/20_sub_folder_02/sibling_two.html.md.erb
190
+ - fixtures/middleman_pagegroups_app/source/_partial.md.erb
191
+ - fixtures/middleman_pagegroups_app/source/index.html.md.erb
192
+ - fixtures/middleman_pagegroups_app/source/layout.erb
193
+ - fixtures/middleman_pagegroups_app/source/sub_folder_01/10_sibling_one.html.md.erb
194
+ - fixtures/middleman_pagegroups_app/source/sub_folder_01/20_sibling_two.html.md.erb
195
+ - fixtures/middleman_pagegroups_app/source/sub_folder_01/30_sibling_three.html.md.erb
196
+ - fixtures/middleman_pagegroups_app/source/sub_folder_01/index.html.md.erb
110
197
  - lib/middleman-pagegroups.rb
111
198
  - lib/middleman-pagegroups/extension.rb
112
199
  - lib/middleman-pagegroups/partials.rb
113
200
  - lib/middleman-pagegroups/version.rb
114
201
  - middleman-pagegroups.gemspec
202
+ - yard/readme.md
203
+ - yard/template-grouped/default/module/html/method_details_list.erb
204
+ - yard/template-partials/default/method_details/setup.rb
205
+ - yard/template-partials/default/module/html/attribute_details.erb
206
+ - yard/template-partials/default/module/html/method_details_list.erb
207
+ - yard/template-partials/default/module/setup.rb
208
+ - yard/template-partials/default/onefile/html/layout.erb
209
+ - yard/template-partials/default/onefile/html/setup.rb
210
+ - yard/yard_extensions.rb
115
211
  homepage: https://github.com/middlemac/middleman-pagegroups
116
212
  licenses:
117
213
  - MIT
@@ -136,5 +232,7 @@ rubygems_version: 2.4.8
136
232
  signing_key:
137
233
  specification_version: 4
138
234
  summary: Provides logical page groups and easy navigation for Middleman projects.
139
- test_files: []
235
+ test_files:
236
+ - features/helpers_and_resources.feature
237
+ - features/support/env.rb
140
238
  has_rdoc: