Skip to content

Commit

Permalink
Update to rubocop standards, test against stable and master Middleman…
Browse files Browse the repository at this point in the history
…, fix build
  • Loading branch information
tdreyno committed Dec 27, 2018
1 parent 4f698b6 commit 3e57af6
Show file tree
Hide file tree
Showing 64 changed files with 568 additions and 594 deletions.
69 changes: 69 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,69 @@
AllCops:
TargetRubyVersion: 2.3
Include:
- '**/*.rb'
- '**/Rakefile'
- '**/Gemfile'
- '**/config.ru'
Exclude:
- 'vendor/**/*'
- '**/tmp/**/*'
- 'middleman-cli/lib/middleman-cli/templates/**/*'
Security/YAMLLoad:
Enabled: false
Style/GuardClause:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Style/Documentation:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/ClassLength:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/AmbiguousBlockAssociation:
Enabled: false
Lint/UriEscapeUnescape:
Enabled: false
Lint/HandleExceptions:
Enabled: false
Lint/ShadowedException:
Enabled: false
Naming/FileName:
Enabled: false
Naming/UncommunicativeMethodParamName:
Enabled: false
Naming/MemoizedInstanceVariableName:
Enabled: false
Naming/HeredocDelimiterNaming:
Enabled: false
Security/Eval:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/MissingRespondToMissing:
Enabled: false
Style/MethodMissingSuper:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/EvalWithLocation:
Enabled: false
Style/ClassVars:
Enabled: false
Style/GlobalVars:
Enabled: false
42 changes: 16 additions & 26 deletions .travis.yml
@@ -1,39 +1,29 @@
##
# Travis YAML
##
language: ruby
cache: bundler

language : ruby
sudo : false
cache : bundler

before_script :
- bundle update

rvm :
rvm:
- ruby-head
- 2.4.0
- 2.3.1
- 2.2.4
- 2.5.3
- 2.4.5
- 2.3.8

os :
os:
- linux
# - osx

matrix :
fast_finish : true
allow_failures :
- rvm : ruby-head
fast_finish: true
allow_failures:
- rvm: ruby-head

# gemfile:
# - Gemfile
gemfile:
- Gemfile
- Gemfile-4.x

script : bundle exec rake test
script: bundle exec rake test

env :
global :
env:
global:
- TEST=true
# - CODECLIMATE_REPO_TOKEN=81787f7b1c3bfa937edadcafbc94f807bf5af5c1142c7b793f2d9969a271de1f

notifications:
email: false
# slack: middleman:JW9OvXmn1m3XrSERe8866nBR
7 changes: 4 additions & 3 deletions CHANGELOG.md
@@ -1,10 +1,11 @@
# Changelog

$ gem push squid-utils-0.1.0.gem

## 4.0.3

*
* Loosen dependencies and test against Middlman v5 betas
* Adapt to core Rubocop standards
* Title should be always a string (#351)
* Fixed multibyte tags.

## 4.0.2

Expand Down
41 changes: 20 additions & 21 deletions Gemfile
@@ -1,38 +1,37 @@
##
# If you do not have OpenSSL installed, change
# the following line to use 'http://'
##
source 'https://rubygems.org'

# Middleman Gems
gem "middleman-cli", git: "https://github.com/middleman/middleman.git", branch: 'master'
gem "middleman-core", git: "https://github.com/middleman/middleman.git", branch: 'master'
gem 'middleman-cli', git: 'https://github.com/middleman/middleman.git', branch: 'master'
gem 'middleman-core', git: 'https://github.com/middleman/middleman.git', branch: 'master'

# Specify your gem's dependencies in middleman-blog.gemspec
gemspec

# Build and doc tools
gem 'rake', '~> 10.3', require: false # Latest 12.0.0
gem 'yard', '~> 0.8', require: false # Latest 0.9.8
gem 'rake', '~> 12.3', require: false
gem 'yard', '~> 0.9.11', require: false

# Test tools
gem 'pry', '~> 0.10', require: false, group: :development # Latest 1.0.0.pre1
gem 'aruba', '~> 0.7.4', require: false # Latest 0.14.2
gem 'capybara', '~> 2.5.0', require: false # Latest 2.13.0 middleman-core forces all plugins to declare this
gem 'rspec', '~> 3.0', require: false # Latest 3.6.0.beta2
gem 'cucumber', '~> 2.4', require: false # Latest 3.0.0.pre.1
gem 'aruba', '~> 0.14.0', require: false
gem 'byebug'
gem 'capybara', '~> 2.5.0', require: false
gem 'cucumber', '~> 3.0', require: false
gem 'rspec', '~> 3.0', require: false

gem "timecop", "~> 0.6.3" # Latest 0.8.1
gem "nokogiri" # Latest 1.7.1
gem "kramdown" # Latest 1.13.2
# Pry tools
gem 'pry'
gem 'pry-rescue'
gem 'pry-stack_explorer'

gem 'kramdown' # Latest 1.13.2
gem 'nokogiri' # Latest 1.7.1
gem 'timecop', '~> 0.6.3' # Latest 0.8.1

# Code Quality
gem 'rubocop', '~> 0.24', require: false # Latest 0.47.1
gem 'simplecov', '~> 0.10', require: false # Latest 0.14.1
gem 'coveralls', '~> 0.8', require: false # Latest 0.8.19
gem 'codeclimate-test-reporter', '~> 0.3', require: false, group: :test # Latest 1.0.8
gem 'rubocop', '~> 0.59', require: false
gem 'simplecov', '~> 0.10', require: false

# Set the ruby platform - not windows
platforms :ruby do
gem "redcarpet", "~> 3.1" # Latest 3.4.0
gem 'redcarpet', '~> 3.1' # Latest 3.4.0
end
38 changes: 38 additions & 0 deletions Gemfile-4.x
@@ -0,0 +1,38 @@

source 'https://rubygems.org'

# Middleman Gems
gem 'middleman-cli', '~> 4.2'
gem 'middleman-core', '~> 4.2'

# Specify your gem's dependencies in middleman-blog.gemspec
gemspec
# Build and doc tools
gem 'rake', '~> 12.3', require: false
gem 'yard', '~> 0.9.11', require: false

# Test tools
gem 'aruba', '~> 0.14.0', require: false
gem 'byebug'
gem 'capybara', '~> 2.5.0', require: false
gem 'cucumber', '~> 3.0', require: false
gem 'rspec', '~> 3.0', require: false

# Pry tools
gem 'pry'
gem 'pry-rescue'
gem 'pry-stack_explorer'

gem 'kramdown' # Latest 1.13.2
gem 'nokogiri' # Latest 1.7.1
gem 'timecop', '~> 0.6.3' # Latest 0.8.1

# Code Quality
gem 'rubocop', '~> 0.59', require: false
gem 'simplecov', '~> 0.10', require: false

# Set the ruby platform - not windows
platforms :ruby do
gem 'redcarpet', '~> 3.1' # Latest 3.4.0
end
4 changes: 0 additions & 4 deletions README.md
Expand Up @@ -39,8 +39,6 @@ Additionally, up-to-date generated code documentation is available on [RubyDoc].
[![Gem Version](https://badge.fury.io/rb/middleman-blog.svg)][gem]
[![Build Status](https://travis-ci.org/middleman/middleman-blog.svg)][travis]
[![Dependency Status](https://gemnasium.com/middleman/middleman-blog.svg?travis)][gemnasium]
[![Code Quality](https://codeclimate.com/github/middleman/middleman-blog.svg)][codeclimate]
[![Code Coverage](https://coveralls.io/repos/middleman/middleman-blog/badge.svg?branch=master)][coveralls]

## Community

Expand Down Expand Up @@ -99,7 +97,5 @@ Copyright (c) 2010-2017 Thomas Reynolds. MIT Licensed, see [LICENSE] for details
[gem]: https://rubygems.org/gems/middleman-blog
[travis]: http://travis-ci.org/middleman/middleman-blog
[gemnasium]: https://gemnasium.com/middleman/middleman-blog
[codeclimate]: https://codeclimate.com/github/middleman/middleman-blog
[coveralls]: https://coveralls.io/r/middleman/middleman-blog
[rubydoc]: http://rubydoc.info/github/middleman/middleman-blog/master
[LICENSE]: https://github.com/middleman/middleman-blog/blob/master/LICENSE.md
26 changes: 14 additions & 12 deletions Rakefile
Expand Up @@ -5,31 +5,33 @@ require 'cucumber/rake/task'

require 'middleman-core'

Cucumber::Rake::Task.new( :cucumber, 'Run features that should pass' ) do | t |
ENV[ "TEST" ] = "true"
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
ENV['TEST'] = 'true'

exempt_tags = ""
exempt_tags << "--tags ~@nojava " if RUBY_PLATFORM == "java"
exempt_tags = ''
exempt_tags << '--tags ~@nojava ' if RUBY_PLATFORM == 'java'

t.cucumber_opts = "--color --tags ~@wip #{ exempt_tags } --strict --format #{ ENV[ 'CUCUMBER_FORMAT' ] || 'pretty' }"
t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
end

require 'rake/clean'

desc "Run tests, both RSpec and Cucumber"
task test: [ :spec, :cucumber ]
desc 'Run tests, both RSpec and Cucumber'
task test: %i[rubocop spec cucumber]

require 'rspec/core/rake_task'

desc "Run RSpec"

RSpec::Core::RakeTask.new do | spec |
desc 'Run RSpec'
RSpec::Core::RakeTask.new do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rspec_opts = [ '--color', '--format documentation' ]
spec.rspec_opts = ['--color', '--format documentation']
end

desc "Build HTML documentation"
require 'rubocop/rake_task'
desc 'Run RuboCop to check code consistency'
RuboCop::RakeTask.new(:rubocop)

desc 'Build HTML documentation'
task :doc do
sh 'bundle exec yard'
end
17 changes: 7 additions & 10 deletions features/support/env.rb
@@ -1,18 +1,15 @@
require 'simplecov'

SimpleCov.start do
add_filter "/features/"
add_filter '/features/'
end

require 'coveralls'
Coveralls.wear!
ENV['TEST'] = 'true'
ENV['AUTOLOAD_SPROCKETS'] = 'false'

ENV[ "TEST" ] = "true"
ENV[ "AUTOLOAD_SPROCKETS" ] = "false"
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))

PROJECT_ROOT_PATH = File.dirname( File.dirname( File.dirname( __FILE__ ) ) )
require 'middleman-core'
require 'middleman-core/step_definitions'

require "middleman-core"
require "middleman-core/step_definitions"

require File.join( PROJECT_ROOT_PATH, 'lib', 'middleman-blog' )
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-blog')
17 changes: 7 additions & 10 deletions features/support/time_steps.rb
@@ -1,28 +1,25 @@
require 'timecop'
require 'active_support/core_ext/time/calculations'

Time.zone = "UTC" if Time.zone.nil?
Time.zone = 'UTC' if Time.zone.nil?

Given /the timezone is "(.+?)"$/ do | zone |
Time.zone = zone
Given /the timezone is "(.+?)"$/ do |zone|
Time.zone = zone
end

Given /the (date|time|date and time) is (.+?)$/ do | datetime, value |
Given /the (date|time|date and time) is (.+?)$/ do |datetime, value|
time = case datetime
when "date"
when 'date'
Date.parse(value)
when "time"
when 'time'
Time.parse(value)
when "date and time"
when 'date and time'
Time.zone.parse(value)
end

Timecop.travel time

end

After do

Timecop.return

end
2 changes: 1 addition & 1 deletion features/tags.feature
Expand Up @@ -102,7 +102,7 @@ Feature: Tag pages
Newer Article Content
"""

When I go to "/tags/.html"
When I go to "/tags/☆☆☆.html"
Then I should see "/2011-01-01-new-article.html"

Scenario: Tag pages are not added when disabled in configuration
Expand Down
4 changes: 2 additions & 2 deletions fixtures/article-dirs-app/config-directory-indexes.rb
@@ -1,6 +1,6 @@
activate :blog do |blog|
blog.permalink = "{year}/{month}/{day}/{title}"
blog.sources = "blog/:year-:month-:day-:title.html"
blog.permalink = '{year}/{month}/{day}/{title}'
blog.sources = 'blog/:year-:month-:day-:title.html'
end

activate :directory_indexes
4 changes: 2 additions & 2 deletions fixtures/article-dirs-app/config-permalink-with-dot.rb
@@ -1,6 +1,6 @@
activate :blog do |blog|
blog.permalink = "{year}.{month}.{day}/{title}"
blog.sources = "blog/:year-:month-:day-:title.html"
blog.permalink = '{year}.{month}.{day}/{title}'
blog.sources = 'blog/:year-:month-:day-:title.html'
end

activate :directory_indexes
4 changes: 2 additions & 2 deletions fixtures/article-dirs-app/config.rb
@@ -1,3 +1,3 @@
activate :blog do |blog|
blog.sources = "blog/:year-:month-:day-:title.html"
end
blog.sources = 'blog/:year-:month-:day-:title.html'
end

0 comments on commit 3e57af6

Please sign in to comment.