middleman-blog 4.0.2 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +69 -0
  3. data/.travis.yml +20 -28
  4. data/CHANGELOG.md +4 -4
  5. data/Gemfile +20 -21
  6. data/Gemfile-4.x +38 -0
  7. data/README.md +0 -6
  8. data/Rakefile +14 -12
  9. data/features/summary.feature +3 -6
  10. data/features/support/env.rb +7 -10
  11. data/features/support/time_steps.rb +7 -10
  12. data/features/tags.feature +1 -1
  13. data/fixtures/article-dirs-app/config-directory-indexes.rb +2 -2
  14. data/fixtures/article-dirs-app/config-permalink-with-dot.rb +2 -2
  15. data/fixtures/article-dirs-app/config.rb +2 -2
  16. data/fixtures/blog-sources-app/config.rb +2 -5
  17. data/fixtures/blog-sources-no-date-app/config.rb +2 -5
  18. data/fixtures/blog-sources-no-day-app/config.rb +2 -5
  19. data/fixtures/blog-sources-no-title-app/config.rb +1 -4
  20. data/fixtures/blog-sources-subdirs-app/config.rb +3 -6
  21. data/fixtures/calendar-and-tag-app/config-directory-indexes.rb +3 -3
  22. data/fixtures/calendar-and-tag-app/config.rb +4 -4
  23. data/fixtures/calendar-app/config-directory-indexes.rb +5 -7
  24. data/fixtures/calendar-app/config-only-year.rb +7 -9
  25. data/fixtures/calendar-app/config.rb +5 -7
  26. data/fixtures/calendar-multiblog-app/config.rb +12 -12
  27. data/fixtures/custom-collections-app/config-blog-prefix.rb +7 -7
  28. data/fixtures/custom-collections-app/config-directory-indexes.rb +6 -6
  29. data/fixtures/custom-collections-app/config.rb +6 -6
  30. data/fixtures/custom-collections-multiblog-app/config.rb +14 -14
  31. data/fixtures/custom-collections-sources-app/config.rb +5 -5
  32. data/fixtures/custom-permalinks-app/config-directory-indexes.rb +3 -3
  33. data/fixtures/custom-permalinks-app/config.rb +3 -3
  34. data/fixtures/default-template-app/Gemfile +5 -5
  35. data/fixtures/default-template-app/config.rb +11 -11
  36. data/fixtures/filename-date-app/config.rb +1 -1
  37. data/fixtures/future-date-app/config.rb +2 -2
  38. data/fixtures/indexes-app/config.rb +2 -2
  39. data/fixtures/lang-path-app/config.rb +2 -2
  40. data/fixtures/layouts-app/config.rb +1 -1
  41. data/fixtures/paginate-app/config-directory-indexes.rb +12 -14
  42. data/fixtures/paginate-app/config-paginate-off.rb +12 -14
  43. data/fixtures/paginate-app/config.rb +12 -14
  44. data/fixtures/paginate-multiblog-app/config.rb +13 -13
  45. data/fixtures/permalink-app/config.rb +3 -6
  46. data/fixtures/preview-app/config.rb +2 -2
  47. data/fixtures/published-app/config.rb +2 -2
  48. data/fixtures/tags-app/config-directory-indexes.rb +5 -5
  49. data/fixtures/tags-app/config.rb +5 -5
  50. data/fixtures/tags-multiblog-app/config.rb +10 -10
  51. data/lib/middleman-blog.rb +6 -8
  52. data/lib/middleman-blog/blog_article.rb +20 -40
  53. data/lib/middleman-blog/blog_data.rb +20 -27
  54. data/lib/middleman-blog/calendar_pages.rb +8 -14
  55. data/lib/middleman-blog/commands/article.rb +54 -63
  56. data/lib/middleman-blog/custom_pages.rb +8 -9
  57. data/lib/middleman-blog/extension.rb +7 -8
  58. data/lib/middleman-blog/helpers.rb +17 -26
  59. data/lib/middleman-blog/paginator.rb +5 -4
  60. data/lib/middleman-blog/tag_pages.rb +11 -23
  61. data/lib/middleman-blog/truncate_html.rb +8 -7
  62. data/lib/middleman-blog/uri_templates.rb +31 -17
  63. data/lib/middleman-blog/version.rb +1 -3
  64. data/lib/middleman_extension.rb +1 -1
  65. data/middleman-blog.gemspec +15 -15
  66. data/spec/spec_helper.rb +1 -4
  67. data/spec/uri_templates_spec.rb +23 -30
  68. metadata +10 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bb18830e698dff563dc55d64242eea72fb69db75
4
- data.tar.gz: 3a1363542c53cbf03e10c425b8c4c051d6e2f466
2
+ SHA256:
3
+ metadata.gz: 02acc65e0b298f6a99ef12beb14728ce8b38a62d7bd4efb7f18c19c9a374bde0
4
+ data.tar.gz: 87d8c68a9f577326e49297d95e13cb38ec768b138c882debfab26caa0263eef7
5
5
  SHA512:
6
- metadata.gz: 54188f4ae4228dc2b5242435bb3cd2d2f4ad8eea48b18cb3b018f7af39439f19de4fd2952261445c32302917ebd351b7e075c460d6cf82ed2e9200f7531cf363
7
- data.tar.gz: c8051538355b5b6cea843c8293dcbf0815fef79f79c2d42164ed4fd9d56bd5987f89d12c06f7dc5994bb9cc199b73c009efb571659fd701bbe09bef96561cebf
6
+ metadata.gz: ff9a0742dd98a22d3709c787977fbf23337b1fde7bebe42cd47ce7fd3f3ec9bef2dde7b2607775a660af381034fb5f82a4a220a74116c30428b976c008de610c
7
+ data.tar.gz: 68847383fc5fbce0753ac74ebf66b1f7988ea59a08ee7010a52fd19ea5fecd1e2723be23363d5300b098d6903df67cce1758b000d972d46f96c5c649b8337363
@@ -0,0 +1,69 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Include:
4
+ - '**/*.rb'
5
+ - '**/Rakefile'
6
+ - '**/Gemfile'
7
+ - '**/config.ru'
8
+ Exclude:
9
+ - 'vendor/**/*'
10
+ - '**/tmp/**/*'
11
+ - 'middleman-cli/lib/middleman-cli/templates/**/*'
12
+ Security/YAMLLoad:
13
+ Enabled: false
14
+ Style/GuardClause:
15
+ Enabled: false
16
+ Metrics/LineLength:
17
+ Enabled: false
18
+ Metrics/MethodLength:
19
+ Enabled: false
20
+ Style/Documentation:
21
+ Enabled: false
22
+ Metrics/AbcSize:
23
+ Enabled: false
24
+ Metrics/CyclomaticComplexity:
25
+ Enabled: false
26
+ Metrics/BlockLength:
27
+ Enabled: false
28
+ Metrics/ModuleLength:
29
+ Enabled: false
30
+ Metrics/PerceivedComplexity:
31
+ Enabled: false
32
+ Metrics/ClassLength:
33
+ Enabled: false
34
+ Lint/AmbiguousRegexpLiteral:
35
+ Enabled: false
36
+ Lint/AmbiguousBlockAssociation:
37
+ Enabled: false
38
+ Lint/UriEscapeUnescape:
39
+ Enabled: false
40
+ Lint/HandleExceptions:
41
+ Enabled: false
42
+ Lint/ShadowedException:
43
+ Enabled: false
44
+ Naming/FileName:
45
+ Enabled: false
46
+ Naming/UncommunicativeMethodParamName:
47
+ Enabled: false
48
+ Naming/MemoizedInstanceVariableName:
49
+ Enabled: false
50
+ Naming/HeredocDelimiterNaming:
51
+ Enabled: false
52
+ Security/Eval:
53
+ Enabled: false
54
+ Style/RegexpLiteral:
55
+ Enabled: false
56
+ Style/ClassAndModuleChildren:
57
+ Enabled: false
58
+ Style/MissingRespondToMissing:
59
+ Enabled: false
60
+ Style/MethodMissingSuper:
61
+ Enabled: false
62
+ Style/FrozenStringLiteralComment:
63
+ Enabled: false
64
+ Style/EvalWithLocation:
65
+ Enabled: false
66
+ Style/ClassVars:
67
+ Enabled: false
68
+ Style/GlobalVars:
69
+ Enabled: false
@@ -1,38 +1,30 @@
1
- ##
2
- # Travis YAML
3
- ##
1
+ language: ruby
2
+ cache: bundler
4
3
 
5
- language : ruby
6
- sudo : false
7
- cache : bundler
8
-
9
- before_script :
10
- - bundle update
11
-
12
- rvm :
4
+ rvm:
13
5
  - ruby-head
14
- - 2.4.0
15
- - 2.3.1
16
- - 2.2.4
6
+ - 2.6.0
7
+ - 2.5.3
8
+ - 2.4.5
9
+ - 2.3.8
17
10
 
18
- os :
11
+ os:
19
12
  - linux
20
- # - osx
21
13
 
22
- matrix :
23
- fast_finish : true
24
- allow_failures :
25
- - rvm : ruby-head
14
+ gemfile:
15
+ - Gemfile
16
+ - Gemfile-4.x
26
17
 
27
- # gemfile:
28
- # - Gemfile
18
+ matrix :
19
+ fast_finish: true
20
+ allow_failures:
21
+ - rvm: ruby-head
29
22
 
30
- script : bundle exec rake test
23
+ script: bundle exec rake test
31
24
 
32
- env :
33
- global :
25
+ env:
26
+ global:
34
27
  - TEST=true
35
- # - CODECLIMATE_REPO_TOKEN=81787f7b1c3bfa937edadcafbc94f807bf5af5c1142c7b793f2d9969a271de1f
36
28
 
37
- # notifications :
38
- # slack : middleman:JW9OvXmn1m3XrSERe8866nBR
29
+ notifications:
30
+ email: false
@@ -1,11 +1,11 @@
1
1
  # Changelog
2
2
 
3
- $ gem build middleman-blog.gemspec
4
- $ gem push middleman-blog-4.0.2.gem
5
-
6
3
  ## 4.0.3
7
4
 
8
- *
5
+ * Loosen dependencies and test against Middlman v5 betas
6
+ * Adapt to core Rubocop standards
7
+ * Title should be always a string (#351)
8
+ * Fixed multibyte tags.
9
9
 
10
10
  ## 4.0.2
11
11
 
data/Gemfile CHANGED
@@ -1,38 +1,37 @@
1
- ##
2
- # If you do not have OpenSSL installed, change
3
- # the following line to use 'http://'
4
- ##
5
1
  source 'https://rubygems.org'
6
2
 
7
3
  # Middleman Gems
8
- gem "middleman-cli", git: "https://github.com/middleman/middleman.git", branch: 'master'
9
- gem "middleman-core", git: "https://github.com/middleman/middleman.git", branch: 'master'
4
+ gem 'middleman-cli', git: 'https://github.com/middleman/middleman.git', branch: 'master'
5
+ gem 'middleman-core', git: 'https://github.com/middleman/middleman.git', branch: 'master'
10
6
 
11
7
  # Specify your gem's dependencies in middleman-blog.gemspec
12
8
  gemspec
13
9
 
14
10
  # Build and doc tools
15
- gem 'rake', '~> 10.3', require: false # Latest 12.0.0
16
- gem 'yard', '~> 0.8', require: false # Latest 0.9.8
11
+ gem 'rake', '~> 12.3', require: false
12
+ gem 'yard', '~> 0.9.11', require: false
17
13
 
18
14
  # Test tools
19
- gem 'pry', '~> 0.10', require: false, group: :development # Latest 1.0.0.pre1
20
- gem 'aruba', '~> 0.7.4', require: false # Latest 0.14.2
21
- gem 'capybara', '~> 2.5.0', require: false # Latest 2.13.0 middleman-core forces all plugins to declare this
22
- gem 'rspec', '~> 3.0', require: false # Latest 3.6.0.beta2
23
- gem 'cucumber', '~> 2.4', require: false # Latest 3.0.0.pre.1
15
+ gem 'aruba', '~> 0.14.0', require: false
16
+ gem 'byebug'
17
+ gem 'capybara', '~> 2.5.0', require: false
18
+ gem 'cucumber', '~> 3.0', require: false
19
+ gem 'rspec', '~> 3.0', require: false
24
20
 
25
- gem "timecop", "~> 0.6.3" # Latest 0.8.1
26
- gem "nokogiri" # Latest 1.7.1
27
- gem "kramdown" # Latest 1.13.2
21
+ # Pry tools
22
+ gem 'pry'
23
+ gem 'pry-rescue'
24
+ gem 'pry-stack_explorer'
25
+
26
+ gem 'kramdown'
27
+ gem 'nokogiri', '~> 1.9.1'
28
+ gem 'timecop', '~> 0.6.3'
28
29
 
29
30
  # Code Quality
30
- gem 'rubocop', '~> 0.24', require: false # Latest 0.47.1
31
- gem 'simplecov', '~> 0.10', require: false # Latest 0.14.1
32
- gem 'coveralls', '~> 0.8', require: false # Latest 0.8.19
33
- gem 'codeclimate-test-reporter', '~> 0.3', require: false, group: :test # Latest 1.0.8
31
+ gem 'rubocop', '~> 0.61.1', require: false
32
+ gem 'simplecov', '~> 0.10', require: false
34
33
 
35
34
  # Set the ruby platform - not windows
36
35
  platforms :ruby do
37
- gem "redcarpet", "~> 3.1" # Latest 3.4.0
36
+ gem 'redcarpet', '~> 3.1' # Latest 3.4.0
38
37
  end
@@ -0,0 +1,38 @@
1
+
2
+ source 'https://rubygems.org'
3
+
4
+ # Middleman Gems
5
+ gem 'middleman-cli', '~> 4.2'
6
+ gem 'middleman-core', '~> 4.2'
7
+
8
+ # Specify your gem's dependencies in middleman-blog.gemspec
9
+ gemspec
10
+
11
+ # Build and doc tools
12
+ gem 'rake', '~> 12.3', require: false
13
+ gem 'yard', '~> 0.9.11', require: false
14
+
15
+ # Test tools
16
+ gem 'aruba', '~> 0.14.0', require: false
17
+ gem 'byebug'
18
+ gem 'capybara', '~> 2.5.0', require: false
19
+ gem 'cucumber', '~> 3.0', require: false
20
+ gem 'rspec', '~> 3.0', require: false
21
+
22
+ # Pry tools
23
+ gem 'pry'
24
+ gem 'pry-rescue'
25
+ gem 'pry-stack_explorer'
26
+
27
+ gem 'kramdown'
28
+ gem 'nokogiri', '~> 1.9.1'
29
+ gem 'timecop', '~> 0.6.3'
30
+
31
+ # Code Quality
32
+ gem 'rubocop', '~> 0.61.1', require: false
33
+ gem 'simplecov', '~> 0.10', require: false
34
+
35
+ # Set the ruby platform - not windows
36
+ platforms :ruby do
37
+ gem 'redcarpet', '~> 3.1' # Latest 3.4.0
38
+ end
data/README.md CHANGED
@@ -38,9 +38,6 @@ Additionally, up-to-date generated code documentation is available on [RubyDoc].
38
38
 
39
39
  [![Gem Version](https://badge.fury.io/rb/middleman-blog.svg)][gem]
40
40
  [![Build Status](https://travis-ci.org/middleman/middleman-blog.svg)][travis]
41
- [![Dependency Status](https://gemnasium.com/middleman/middleman-blog.svg?travis)][gemnasium]
42
- [![Code Quality](https://codeclimate.com/github/middleman/middleman-blog.svg)][codeclimate]
43
- [![Code Coverage](https://coveralls.io/repos/middleman/middleman-blog/badge.svg?branch=master)][coveralls]
44
41
 
45
42
  ## Community
46
43
 
@@ -98,8 +95,5 @@ Copyright (c) 2010-2017 Thomas Reynolds. MIT Licensed, see [LICENSE] for details
98
95
  [middleman]: http://middlemanapp.com
99
96
  [gem]: https://rubygems.org/gems/middleman-blog
100
97
  [travis]: http://travis-ci.org/middleman/middleman-blog
101
- [gemnasium]: https://gemnasium.com/middleman/middleman-blog
102
- [codeclimate]: https://codeclimate.com/github/middleman/middleman-blog
103
- [coveralls]: https://coveralls.io/r/middleman/middleman-blog
104
98
  [rubydoc]: http://rubydoc.info/github/middleman/middleman-blog/master
105
99
  [LICENSE]: https://github.com/middleman/middleman-blog/blob/master/LICENSE.md
data/Rakefile CHANGED
@@ -5,31 +5,33 @@ require 'cucumber/rake/task'
5
5
 
6
6
  require 'middleman-core'
7
7
 
8
- Cucumber::Rake::Task.new( :cucumber, 'Run features that should pass' ) do | t |
9
- ENV[ "TEST" ] = "true"
8
+ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
9
+ ENV['TEST'] = 'true'
10
10
 
11
- exempt_tags = ""
12
- exempt_tags << "--tags ~@nojava " if RUBY_PLATFORM == "java"
11
+ exempt_tags = ''
12
+ exempt_tags << '--tags ~@nojava ' if RUBY_PLATFORM == 'java'
13
13
 
14
- t.cucumber_opts = "--color --tags ~@wip #{ exempt_tags } --strict --format #{ ENV[ 'CUCUMBER_FORMAT' ] || 'pretty' }"
14
+ t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
15
15
  end
16
16
 
17
17
  require 'rake/clean'
18
18
 
19
- desc "Run tests, both RSpec and Cucumber"
20
- task test: [ :spec, :cucumber ]
19
+ desc 'Run tests, both RSpec and Cucumber'
20
+ task test: %i[rubocop spec cucumber]
21
21
 
22
22
  require 'rspec/core/rake_task'
23
23
 
24
- desc "Run RSpec"
25
-
26
- RSpec::Core::RakeTask.new do | spec |
24
+ desc 'Run RSpec'
25
+ RSpec::Core::RakeTask.new do |spec|
27
26
  spec.pattern = 'spec/**/*_spec.rb'
28
- spec.rspec_opts = [ '--color', '--format documentation' ]
27
+ spec.rspec_opts = ['--color', '--format documentation']
29
28
  end
30
29
 
31
- desc "Build HTML documentation"
30
+ require 'rubocop/rake_task'
31
+ desc 'Run RuboCop to check code consistency'
32
+ RuboCop::RakeTask.new(:rubocop)
32
33
 
34
+ desc 'Build HTML documentation'
33
35
  task :doc do
34
36
  sh 'bundle exec yard'
35
37
  end
@@ -83,14 +83,11 @@ Feature: Article summary generation
83
83
 
84
84
  Scenario: Summary limited by length only
85
85
  Given a fixture app "summary-app"
86
- And a file named "config.rb" with:
87
- """
88
- activate :blog
89
- """
90
86
  And a file named "source/index.html.erb" with:
91
87
  """
92
88
  <% @i = 0 %>
93
- <% blog.articles.each do |article| %>
89
+ <%= blog.articles.size %>
90
+ <% blog.articles.sort_by(&:title).each do |article| %>
94
91
  <article>
95
92
  <%= article.summary(7, (@i += 1).to_s) %>
96
93
  </article>
@@ -101,6 +98,6 @@ Feature: Article summary generation
101
98
  Then I should see "Summary1"
102
99
  Then I should see "Summary2"
103
100
  Then I should see "Summary3"
101
+ Then I should see "Summary4"
104
102
  # it has a custom separator, which overrides explicit length, so we show up to the separator
105
103
  Then I should see "Summary from article with separator."
106
- Then I should see "Summary5"
@@ -1,18 +1,15 @@
1
1
  require 'simplecov'
2
2
 
3
3
  SimpleCov.start do
4
- add_filter "/features/"
4
+ add_filter '/features/'
5
5
  end
6
6
 
7
- require 'coveralls'
8
- Coveralls.wear!
7
+ ENV['TEST'] = 'true'
8
+ ENV['AUTOLOAD_SPROCKETS'] = 'false'
9
9
 
10
- ENV[ "TEST" ] = "true"
11
- ENV[ "AUTOLOAD_SPROCKETS" ] = "false"
10
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
12
11
 
13
- PROJECT_ROOT_PATH = File.dirname( File.dirname( File.dirname( __FILE__ ) ) )
12
+ require 'middleman-core'
13
+ require 'middleman-core/step_definitions'
14
14
 
15
- require "middleman-core"
16
- require "middleman-core/step_definitions"
17
-
18
- require File.join( PROJECT_ROOT_PATH, 'lib', 'middleman-blog' )
15
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-blog')
@@ -1,28 +1,25 @@
1
1
  require 'timecop'
2
2
  require 'active_support/core_ext/time/calculations'
3
3
 
4
- Time.zone = "UTC" if Time.zone.nil?
4
+ Time.zone = 'UTC' if Time.zone.nil?
5
5
 
6
- Given /the timezone is "(.+?)"$/ do | zone |
7
- Time.zone = zone
6
+ Given /the timezone is "(.+?)"$/ do |zone|
7
+ Time.zone = zone
8
8
  end
9
9
 
10
- Given /the (date|time|date and time) is (.+?)$/ do | datetime, value |
10
+ Given /the (date|time|date and time) is (.+?)$/ do |datetime, value|
11
11
  time = case datetime
12
- when "date"
12
+ when 'date'
13
13
  Date.parse(value)
14
- when "time"
14
+ when 'time'
15
15
  Time.parse(value)
16
- when "date and time"
16
+ when 'date and time'
17
17
  Time.zone.parse(value)
18
18
  end
19
19
 
20
20
  Timecop.travel time
21
-
22
21
  end
23
22
 
24
23
  After do
25
-
26
24
  Timecop.return
27
-
28
25
  end
@@ -102,7 +102,7 @@ Feature: Tag pages
102
102
  Newer Article Content
103
103
  """
104
104
 
105
- When I go to "/tags/.html"
105
+ When I go to "/tags/☆☆☆.html"
106
106
  Then I should see "/2011-01-01-new-article.html"
107
107
 
108
108
  Scenario: Tag pages are not added when disabled in configuration
@@ -1,6 +1,6 @@
1
1
  activate :blog do |blog|
2
- blog.permalink = "{year}/{month}/{day}/{title}"
3
- blog.sources = "blog/:year-:month-:day-:title.html"
2
+ blog.permalink = '{year}/{month}/{day}/{title}'
3
+ blog.sources = 'blog/:year-:month-:day-:title.html'
4
4
  end
5
5
 
6
6
  activate :directory_indexes
@@ -1,6 +1,6 @@
1
1
  activate :blog do |blog|
2
- blog.permalink = "{year}.{month}.{day}/{title}"
3
- blog.sources = "blog/:year-:month-:day-:title.html"
2
+ blog.permalink = '{year}.{month}.{day}/{title}'
3
+ blog.sources = 'blog/:year-:month-:day-:title.html'
4
4
  end
5
5
 
6
6
  activate :directory_indexes
@@ -1,3 +1,3 @@
1
1
  activate :blog do |blog|
2
- blog.sources = "blog/:year-:month-:day-:title.html"
3
- end
2
+ blog.sources = 'blog/:year-:month-:day-:title.html'
3
+ end