Upgrade rubocop

This commit is contained in:
Mike Angell
2019-08-27 17:46:09 +10:00
parent 831355dfbd
commit da9051eb18
121 changed files with 2736 additions and 1872 deletions
+30 -25
View File
@@ -1,29 +1,33 @@
# frozen_string_literal: true
require 'rake'
require 'rake/testtask'
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "liquid/version"
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))
require 'liquid/version'
task default: [:test, :rubocop]
task(default: %i[test rubocop])
desc 'run test suite with default parser'
desc('run test suite with default parser')
Rake::TestTask.new(:base_test) do |t|
t.libs << '.' << 'lib' << 'test'
t.test_files = FileList['test/{integration,unit}/**/*_test.rb']
t.verbose = false
end
desc 'run test suite with warn error mode'
desc('run test suite with warn error mode')
task :warn_test do
ENV['LIQUID_PARSER_MODE'] = 'warn'
Rake::Task['base_test'].invoke
end
task :rubocop do
require 'rubocop/rake_task'
RuboCop::RakeTask.new
if RUBY_ENGINE == 'ruby'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end
end
desc 'runs test suite with both strict and lax parsers'
desc('runs test suite with both strict and lax parsers')
task :test do
ENV['LIQUID_PARSER_MODE'] = 'lax'
Rake::Task['base_test'].invoke
@@ -32,8 +36,9 @@ task :test do
Rake::Task['base_test'].reenable
Rake::Task['base_test'].invoke
if RUBY_ENGINE == 'ruby'
ENV['LIQUID-C'] = '1'
if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'truffleruby'
ENV['LIQUID_C'] = '1'
ENV['LIQUID_PARSER_MODE'] = 'lax'
Rake::Task['base_test'].reenable
@@ -45,9 +50,9 @@ task :test do
end
end
task gem: :build
task(gem: :build)
task :build do
system "gem build liquid.gemspec"
system 'gem build liquid.gemspec'
end
task install: :build do
@@ -56,45 +61,45 @@ end
task release: :build do
system "git tag -a v#{Liquid::VERSION} -m 'Tagging #{Liquid::VERSION}'"
system "git push --tags"
system 'git push --tags'
system "gem push liquid-#{Liquid::VERSION}.gem"
system "rm liquid-#{Liquid::VERSION}.gem"
end
namespace :benchmark do
desc "Run the liquid benchmark with lax parsing"
desc 'Run the liquid benchmark with lax parsing'
task :run do
ruby "./performance/benchmark.rb lax"
ruby './performance/benchmark.rb lax'
end
desc "Run the liquid benchmark with strict parsing"
desc 'Run the liquid benchmark with strict parsing'
task :strict do
ruby "./performance/benchmark.rb strict"
ruby './performance/benchmark.rb strict'
end
end
namespace :profile do
desc "Run the liquid profile/performance coverage"
desc 'Run the liquid profile/performance coverage'
task :run do
ruby "./performance/profile.rb"
ruby './performance/profile.rb'
end
desc "Run the liquid profile/performance coverage with strict parsing"
desc 'Run the liquid profile/performance coverage with strict parsing'
task :strict do
ruby "./performance/profile.rb strict"
ruby './performance/profile.rb strict'
end
end
namespace :memory_profile do
desc "Run memory profiler"
desc 'Run memory profiler'
task :run do
ruby "./performance/memory_profile.rb"
ruby './performance/memory_profile.rb'
end
end
desc "Run example"
desc('Run example')
task :example do
ruby "-w -d -Ilib example/server/server.rb"
ruby '-w -d -Ilib example/server/server.rb'
end
task :console do