2015-11-09 17:11:20 +00:00
|
|
|
require 'bundler/setup'
|
|
|
|
|
|
|
|
require 'rubocop/rake_task'
|
|
|
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
2017-11-28 20:08:21 +00:00
|
|
|
# If you use mediawiki-vagrant, rubocop will by default use its .rubocop.yml.
|
|
|
|
|
|
|
|
# This line makes it explicit that you want .rubocop.yml from the directory
|
|
|
|
# where `bundle exec rake` is executed:
|
2015-11-09 17:11:20 +00:00
|
|
|
task.options = ['-c', '.rubocop.yml']
|
|
|
|
end
|
|
|
|
|
2017-11-28 20:08:21 +00:00
|
|
|
task :default => [:test]
|
2015-11-09 17:11:20 +00:00
|
|
|
|
|
|
|
desc 'Run all build/tests commands (CI entry point)'
|
2017-11-28 20:08:21 +00:00
|
|
|
task :test => [:rubocop]
|
2018-03-07 14:43:25 +00:00
|
|
|
|
|
|
|
desc 'Upload screenshots to commons.wikimedia.org'
|
|
|
|
task :commons_upload do
|
|
|
|
require 'commons_upload'
|
|
|
|
required_envs = %w[
|
|
|
|
MEDIAWIKI_API_UPLOAD_URL
|
|
|
|
MEDIAWIKI_USER
|
|
|
|
MEDIAWIKI_PASSWORD
|
|
|
|
]
|
|
|
|
has_all_envs = required_envs.all? { |env| ENV.key?(env) }
|
|
|
|
fail "Requires env variables:\n#{required_envs}" unless has_all_envs
|
|
|
|
CommonsUpload.images
|
|
|
|
end
|