middleman-pagegroups 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36b39432e2959430ad92e7a0fbc590a2b07829e3
4
- data.tar.gz: f398d30caa4c9b340a8a99ee93d8590644ff9841
3
+ metadata.gz: 12b13f9772555307c96788be1a321eea187d4a84
4
+ data.tar.gz: 5b18ef759e3f15784c27a4d294f42bb56c85240a
5
5
  SHA512:
6
- metadata.gz: a98612cb826a331b8ab73a1fccb06a2983e4c330d6ffae0182db84a48a7402f205bda870aefd24628d094f1bdc540b36c90c532a1ef72d7273c32c62bf3fe1ad
7
- data.tar.gz: cd322348875e2fcf88235784174916f66fff02cca8ab2f346c53c5f775e97bcbce814dcce244ac05833f5d0d1045faf9cd970796de2a0e4801636a27c2728018
6
+ metadata.gz: bc06ed4016a0fa77187137954165d95d9e32f78b9fd2b9320ff68cbc16b8f78ffda8704072417209bc01fce257758acd4b532b85ed1b9c82c5f9bbd011c56a17
7
+ data.tar.gz: f0b2228d1ed3bd97b156a77b8f1d66f5be6d544c88208d03d569aa41a878f773e55150afa14530e93805b2ff54e2fd6c7dcfd3e104f17c5758a2b5b855a9182e
data/.gitignore CHANGED
@@ -14,4 +14,11 @@ Gemfile.lock
14
14
  /pkg
15
15
 
16
16
  # Ignore build folders
17
- build*
17
+ build/*
18
+
19
+ # Yard cruft
20
+ /doc/
21
+ /.yardoc
22
+
23
+ # Aruba
24
+ /tmp/
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ --no-private
2
+ --markup=markdown
3
+ --load yard/yard_extensions.rb
4
+ --exclude middleman-pagegroups/version.rb
5
+ --exclude middleman-pagegroups/partials.rb
6
+ --one-file
7
+ --readme yard/readme.md
8
+ --title middleman-pagegroups
data/CHANGELOG.md CHANGED
@@ -1,10 +1,30 @@
1
1
  middleman-pagegroups change log
2
2
  ===============================
3
3
 
4
- - Version 1.0.1 / 2016-April-03
4
+ - Version 1.0.3 / 2016-May-11
5
5
 
6
- - Fixed the bad reference to the local gem in the sample project.
6
+ - Support ordering on directories; documentation
7
+ - Replaced Middleman's `resource.parent` with fixed version that respects
8
+ changes to output directory names.
9
+ - Fixed an issue wherein HTML files in renamed directories weren't having
10
+ their paths corrected.
11
+ - Added YARDOC comments and features.
12
+ - Added initial Cucumber testing support.
13
+ - Added significant release-related functionality to the Rakefile.
14
+ Rakefile now generates the change log.
7
15
 
8
- - Version 1.0.1 / 2016-March
16
+ - Version 1.0.2 / 2016-May-10
9
17
 
10
- - Initial Release
18
+ - Bump to v1.0.2 to fix files that don't have a page order associated with them
19
+ - Cleanup
20
+ - Cleanup README.
21
+ - Remove .gem that should not have been committed.
22
+
23
+ - Version 1.0.1 / 2016-May-10
24
+
25
+ - Bump to v1.0.1 to repair bad sample project
26
+ - Added RubyGems badge to README
27
+
28
+ - Version 1.0.0 / 2016-April-03
29
+
30
+ - Version 1.0.0
data/README.md CHANGED
@@ -9,7 +9,7 @@ middleman-pagegroups readme
9
9
  by topic and navigating between them. It includes support for tables of
10
10
  content, related pages, breadcrumbs, and more.
11
11
 
12
- It is standalone and can be used in any Middleman project.
12
+ It is standalone and can be used in any **Middleman** project.
13
13
 
14
14
 
15
15
  Install the Gem
@@ -50,7 +50,7 @@ Middlemac
50
50
  ---------
51
51
 
52
52
  This Middleman extension is a critical part of
53
- [Middlemac](https://github.com/middlemac), the Mac OS X help building system
53
+ [**Middlemac**](https://github.com/middlemac), the Mac OS X help building system
54
54
  for Mac OS X applications. However this gem is not Mac OS X specific and can be
55
55
  useful in any application for which you want to provide structure and
56
56
  navigation.
@@ -59,11 +59,11 @@ navigation.
59
59
  License
60
60
  -------
61
61
 
62
- MIT. See `LICENSE.md`.
62
+ MIT. See [`LICENSE.md`](LICENSE.md).
63
63
 
64
64
 
65
65
  Changelog
66
66
  ---------
67
67
 
68
- See `CHANGELOG.md` for point changes, or simply have a look at the commit
69
- history for non-version changes (such as readme updates).
68
+ See [`CHANGELOG.md`](CHANGELOG.md) for point changes, or simply have a look at
69
+ the commit history for non-version changes (such as readme updates).
data/Rakefile CHANGED
@@ -1,10 +1,204 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'cucumber/rake/task'
3
+ require 'yard'
4
+ require 'git'
5
+ require File.expand_path('../lib/middleman-pagegroups/version.rb', __FILE__)
3
6
 
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
7
+
8
+ ###############################################################################
9
+ # :default
10
+ # Define the default task.
11
+ ###############################################################################
12
+ task :default => :test
13
+
14
+
15
+ ###############################################################################
16
+ # :test
17
+ # Perform Cucumber testing.
18
+ ###############################################################################
19
+ Cucumber::Rake::Task.new(:test, 'Features that must pass') do |task|
20
+ task.cucumber_opts = '--require features --color --tags ~@wip --strict --format QuietFormatter'
21
+ end
22
+
23
+
24
+ ###############################################################################
25
+ # :yard
26
+ # Generate documentation using YARD. Note that there is a `.yardopts` file
27
+ # present that will load the `yard/yard_extensions.rb` file in order to
28
+ # control how output is generated. Output will be to the default `doc`
29
+ # directory using the template-grouped template, as a single page.
30
+ ###############################################################################
31
+ YARD::Rake::YardocTask.new(:yard) do |task|
32
+ task.stats_options = ['--list-undoc']
33
+ end
34
+
35
+
36
+ ###############################################################################
37
+ # :partials
38
+ # Generate documentation partials using YARD. These are used by the
39
+ # documentation project in order to include the API documentation.
40
+ ###############################################################################
41
+ desc 'Make separate documents for documentation_project'
42
+ task :partials do
43
+
44
+ # Define the @!group to output file relationships.
45
+ sections = [
46
+ { :file => '_yard_helpers.erb', :group => 'Helpers', },
47
+ { :file => '_yard_helpers_css.erb', :group => 'CSS Class Helpers', },
48
+ { :file => '_yard_helpers_extended.erb', :group => 'Extended Helpers' },
49
+ { :file => '_yard_config.erb', :group => 'Extension Configuration' },
50
+ { :file => '_yard_resources.erb', :group => 'Resource Extensions', },
51
+ ]
52
+
53
+ # Define the output directory.
54
+ dest = File.join('documentation_project', 'source', 'partials')
55
+
56
+ # Run YARD multiple times, filtering the group that interests us.
57
+ sections.each do |s|
58
+ params = [
59
+ "--query 'o.group == \"#{s[:group]}\" || has_tag?(:author)'",
60
+ "-o #{dest}",
61
+ "-t default",
62
+ "-p #{File.join(File.dirname(__FILE__), 'yard', 'template-partials')}"
63
+ ]
64
+ command = "yardoc #{params.join(' ')}"
65
+ puts command
66
+ system(command)
67
+ File.rename( File.join(dest, 'index.html'), File.join(dest, s[:file]) )
68
+ end
69
+
70
+ end
71
+
72
+
73
+ ###############################################################################
74
+ # :version
75
+ # Displays the current version.
76
+ ###############################################################################
77
+ desc 'Displays the current version'
78
+ task :version do
79
+ puts "Current version: #{Middleman::MiddlemanPageGroups::VERSION}"
80
+ end
81
+
82
+
83
+ ###############################################################################
84
+ # :version_finalize
85
+ # Remove any wip suffix from the version, as we are ready to release.
86
+ ###############################################################################
87
+ desc 'Remove any wip suffix from the version'
88
+ task :version_finalize do
89
+ version_old = Middleman::MiddlemanPageGroups::VERSION
90
+ version_new = version_old.sub('.wip', '')
91
+ update_version_file( version_new )
92
+ update_doc_file( version_new )
93
+ Middleman::MiddlemanPageGroups.send(:remove_const, 'VERSION')
94
+ Middleman::MiddlemanPageGroups::VERSION = version_new
95
+ end
96
+
97
+
98
+ ###############################################################################
99
+ # :version_next_wip
100
+ # Increment the patch level and add a wip suffix. We are ready for work.
101
+ ###############################################################################
102
+ desc 'Increment the patch level and add a wip suffix'
103
+ task :version_next_wip do
104
+ version_old = Middleman::MiddlemanPageGroups::VERSION
105
+ version_new = version_old.sub('.wip', '').split('.')
106
+ version_new.last.succ!
107
+ version_new = version_new.join('.') + '.wip'
108
+ update_version_file( version_new )
109
+ update_doc_file( version_new )
110
+ Middleman::MiddlemanPageGroups.send(:remove_const, 'VERSION')
111
+ Middleman::MiddlemanPageGroups::VERSION = version_new
112
+ end
113
+
114
+
115
+ ###############################################################################
116
+ # :log
117
+ # Generate the CHANGELOG.md file.
118
+ ###############################################################################
119
+ desc 'Generate the CHANGELOG.md file'
120
+ task :log do
121
+ report = ''
122
+ report << "middleman-pagegroups change log\n"
123
+ report << "===============================\n"
124
+
125
+ Git.open( File.expand_path('..', __FILE__) ).log.each_with_index do |l, i|
126
+
127
+ version = nil
128
+ if i == 0 && !l.name.start_with?('tags/')
129
+ version = "Version #{Middleman::MiddlemanPageGroups::VERSION}"
130
+ elsif l.name.end_with?('^0')
131
+ version = "Version #{l.name.match(/tags\/v(.*)\^0/)[1]}"
132
+ end
133
+
134
+ if version
135
+ report << "\n- #{version} / #{l.date.strftime('%Y-%B-%d')}\n"
136
+ report << "\n"
137
+ end
138
+
139
+ l.message.each_line.with_index do |line, lineno|
140
+ if lineno == 0
141
+ report << " - #{line}"
142
+ else
143
+ report << " #{line}" unless line.strip == ''
144
+ end
145
+ end
146
+ report << "\n"
147
+ end # Git.open
148
+
149
+ file = File.expand_path('../CHANGELOG.md', __FILE__)
150
+ File.write(file, report)
151
+ puts "The changelog has been written."
152
+ end
153
+
154
+
155
+ ###############################################################################
156
+ # :pre_release
157
+ # Prepares the project for release.
158
+ ###############################################################################
159
+ desc "Prepares the project for release"
160
+ task :pre_release do
161
+
162
+ if `git status -s`.length > 0
163
+ puts "Cannot continue because you have uncommitted changes."
164
+ exit 1
165
+ end
166
+
167
+ Rake::Task[:version_finalize].execute
168
+ Rake::Task[:partials].execute
169
+ Rake::Task[:log].execute
170
+ sh "git add -A"
171
+ sh "git commit --amend --no-edit"
172
+ end
173
+
174
+ private
175
+
176
+
177
+ ###############################################################################
178
+ # update_version_file
179
+ # Replace the version in the `version.rb` file.
180
+ ###############################################################################
181
+ def update_version_file( version_new )
182
+ file = File.expand_path('../lib/middleman-pagegroups/version.rb', __FILE__)
183
+ content = File.read(file)
184
+ content.sub!(/(?<=VERSION = ')(.*)(?=')/, version_new)
185
+ File.write(file, content)
186
+ puts "version.rb changed to #{version_new}."
187
+ end
188
+
189
+ ###############################################################################
190
+ # update_doc_file
191
+ # Replace the version in the `documentation_project/config.rb` file.
192
+ ###############################################################################
193
+ def update_doc_file( version_new )
194
+ file = File.expand_path('../documentation_project/config.rb', __FILE__)
195
+ content = File.read(file)
196
+ content.sub!(/(?<=def product_version).*?(?=end)/m, "\n '#{version_new}'\n")
197
+ File.write(file, content)
198
+ puts "config.rb changed to #{version_new}."
8
199
  end
9
200
 
10
- task :default => :spec
201
+
202
+ def const_undef(const)
203
+ self.instance_eval { remove_const(const) }
204
+ end
@@ -9,8 +9,8 @@ gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw]
9
9
  gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
10
10
 
11
11
  # Middleman Gems
12
- gem 'middleman-pagegroups'
13
- gem 'middleman', '~> 4.1.6'
12
+ gem 'middleman-pagegroups', :path => '../'
13
+ gem 'middleman', '~> 4.1.7'
14
14
  gem 'middleman-syntax'
15
15
 
16
16
 
@@ -14,56 +14,52 @@
14
14
 
15
15
  #==========================================================================
16
16
  # Extension Setup
17
- # Note that middleman-targets adds configuration parameters to the base
18
- # Middleman application (supported feature in 4.0+); there are *not*
19
- # extension options. Additionally if middleman-targets is in your Gemfile
20
- # then it is also activated automatically.
21
17
  #==========================================================================
22
- activate :MiddlemanPageGroups do |config|
18
+ activate :MiddlemanPageGroups do |options|
23
19
 
24
20
  # Indicate whether or not numeric file name prefixes used for sorting
25
21
  # pages should be eliminated during output. This results in cleaner
26
22
  # URI's. Helpers such as `page_name` and Middleman helpers such as
27
23
  # `page_class` will reflect the pretty name.
28
- config.strip_file_prefixes = true
24
+ options[:strip_file_prefixes] = true
29
25
 
30
26
  # Indicates whether or not Middleman's built-in `page_class` helper is
31
27
  # extended to include the page_group and page_name.
32
- config.extend_page_class = true
28
+ options[:extend_page_class] = true
33
29
 
34
30
  # the following options provide defaults for the built-in helpers, and
35
31
  # also work with the sample partials if you choose to install them.
36
32
  # They'll also work in your own partials and helpers, of course.
37
33
 
38
34
  # Default css class for the nav_breadcrumbs helper/partial.
39
- config.nav_breadcrumbs_class = 'breadcrumbs'
35
+ options[:nav_breadcrumbs_class] = 'breadcrumbs'
40
36
 
41
37
  # Default css class for the nav_breadcrumbs_alt helper/partial.
42
- config.nav_breadcrumbs_alt_class = 'breadcrumbs'
38
+ options[:nav_breadcrumbs_alt_class] = 'breadcrumbs'
43
39
 
44
40
  # Default "current page" label for the nav_breadcrumbs_alt helper/partial.
45
- config.nav_breadcrumbs_alt_label = 'Current page'
41
+ options[:nav_breadcrumbs_alt_label] = 'Current page'
46
42
 
47
43
  # Default css class for the nav_brethren helper/partial.
48
- config.nav_brethren_class = 'table_contents'
44
+ options[:nav_brethren_class] = 'table_contents'
49
45
 
50
46
  # Default css class for the nav_brethren_index helper/partial.
51
- config.nav_brethren_index_class = 'related-topics'
47
+ options[:nav_brethren_index_class] = 'related-topics'
52
48
 
53
49
  # Default css class for the nav_legitimate_children helper/partial.
54
- config.nav_legitimate_children_class = 'table_contents'
50
+ options[:nav_legitimate_children_class] = 'table_contents'
55
51
 
56
52
  # Default css class for the nav_prev_next helper/partial.
57
- config.nav_prev_next_class = 'navigate_prev_next'
53
+ options[:nav_prev_next_class] = 'navigate_prev_next'
58
54
 
59
55
  # Default "previous" label text for the nav_prev_next helper/partial.
60
- config.nav_prev_next_label_prev = 'Previous'
56
+ options[:nav_prev_next_label_prev] = 'Previous'
61
57
 
62
58
  # Default "next" label text for the nav_prev_next helper/partial.
63
- config.nav_prev_next_label_next = 'Next'
59
+ options[:nav_prev_next_label_next] = 'Next'
64
60
 
65
61
  # Default css class for the nav_toc_index helper/partial.
66
- config.nav_toc_index_class = 'help_map'
62
+ options[:nav_toc_index_class] = 'help_map'
67
63
 
68
64
  end
69
65
 
@@ -90,8 +86,8 @@ helpers do
90
86
  end
91
87
 
92
88
  def product_version
93
- '1.0.2'
94
- end
89
+ '1.0.3'
90
+ end
95
91
 
96
92
  def product_uri
97
93
  'https://github.com/middlemac'
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Another File
3
+ blurb: This is just a file with a sort order of 10 specified in its front
4
+ matter.
5
+ layout: template-logo-medium
6
+ order: 10
7
+ ---
8
+
9
+ # <%= current_page.data.title %>
10
+
11
+ <%= current_page.data.blurb %>
12
+
13
+ Current Page: <%= current_page.url %>
14
+
15
+ Parent: <%= current_page.parent.url %>
16
+
17
+ <% siblings = current_page.siblings.collect { |p| p.url } %>
18
+ Siblings: <%= siblings %>
19
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ title: Nested Group Example
3
+ blurb: See an example of a nested group, where sort order is specified only
4
+ by the front matter.
5
+ layout: template-logo-large
6
+ navigator: false
7
+ ---
8
+
9
+ # <%= current_page.data.title %>
10
+
11
+ - All of these documents are part of the `nested_folder` group. This is because
12
+ the source directory they reside in is named `nested_folder/`.
13
+
14
+ - This particular page is the index page of the group, and is considered the
15
+ parent of all of the other files.
16
+
17
+ - This page does not have an `:order` key set; its order is based on its
18
+ original containing directory name.
19
+
20
+ - The other pages are set via their `:order` keys instead of a via a naming
21
+ prefix.
22
+
23
+ * * *
24
+
25
+ <%= nav_legitimate_children :class => 'table_contents' %>