Rakefile in asana-2.0.1 vs Rakefile in asana-2.0.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'appraisal'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
@@ -17,36 +19,31 @@
task :codegen do
# TODO: I believe this is obsolete and can be removed
`node spec/support/codegen.js`
end
+# rubocop:disable Metrics/BlockLength
namespace :bump do
def read_version
File.readlines('./lib/asana/version.rb')
.detect { |l| l =~ /VERSION/ }
.scan(/VERSION = '([^']+)/).flatten.first.split('.')
.map { |n| Integer(n) }
end
- # rubocop:disable Metrics/MethodLength
def write_version(major, minor, patch)
+ File.write('VERSION', "#{major}.#{minor}.#{patch}")
- File.open('VERSION', 'w') do |f|
- f.write "#{major}.#{minor}.#{patch}"
- end
+ str = <<~RUBY
+ #:nodoc:
+ module Asana
+ # Public: Version of the gem.
+ VERSION = '#{major}.#{minor}.#{patch}'
+ end
+ RUBY
+ File.write('./lib/asana/version.rb', str)
- str = <<-EOS
-#:nodoc:
-module Asana
- # Public: Version of the gem.
- VERSION = '#{major}.#{minor}.#{patch}'
-end
-EOS
- File.open('./lib/asana/version.rb', 'w') do |f|
- f.write str
- end
-
new_version = "#{major}.#{minor}.#{patch}"
system('bundle lock --update')
system('git add Gemfile.lock')
system('git add VERSION')
system('git add lib/asana/version.rb')
@@ -71,13 +68,13 @@
task :major do
major, = read_version
write_version major + 1, 0, 0
end
end
+# rubocop:enable Metrics/BlockLength
desc 'Default: run the unit tests.'
-task default: [:all, :rubocop, :yard]
-
+task default: %i[all rubocop yard]
desc 'Test the plugin under all supported Rails versions.'
task :all do |_t|
exec('bundle exec appraisal install && bundle exec rake appraisal spec')
end