代码拉取完成,页面将自动刷新
# frozen_string_literal: true
excluded_source_paths = %w[/vendor/ /externs/ /jquery_native.js]
desc 'Find if any files do not containing license'
task :check_file_without_license do
license_header = 'Copyright Ascensio System'
all_js_files = Dir['./**/*.js']
files_without_license = []
all_js_files.each do |file|
next if excluded_source_paths.any? { |exclude| file.include?(exclude) }
unless File.read(file).include?(license_header)
files_without_license << file
end
end
unless files_without_license.empty?
raise("Files without license: #{files_without_license}")
end
end
desc 'Find if any files do not containing correct latvian adress'
task :check_file_without_latvian_adress do
latvian_address = 'LV-1050'
all_js_files = Dir['./**/*.js']
files_without_address = []
all_js_files.each do |file|
next if excluded_source_paths.any? { |exclude| file.include?(exclude) }
unless File.read(file).include?(latvian_address)
files_without_address << file
end
end
unless files_without_address.empty?
raise("Files without latvian address `#{latvian_address}`: #{files_without_address}")
end
end
desc 'Find files without LF ending'
task :check_file_without_lf_ending do
all_files = Dir['./**/*.js']
files_without_ending = []
all_files.each do |file|
files_without_ending << file if File.read(file).include?("\r")
end
unless files_without_ending.empty?
raise("Files without LF ending: #{files_without_ending}")
end
end
desc 'Check files for trailing newline'
task :check_file_trailing_newline do
all_files = Dir['./**/*.js']
files_without_trailing_line = []
all_files.each do |file|
unless IO.readlines(file)[-1].end_with?("\n")
files_without_trailing_line << file
end
end
unless files_without_trailing_line.empty?
raise("Files without newline at end: #{files_without_trailing_line}")
end
end
desc 'Perform check on source files'
task :check_source_files do
Rake::Task['check_file_without_license'].invoke
Rake::Task['check_file_without_lf_ending'].invoke
Rake::Task['check_file_trailing_newline'].invoke
Rake::Task['check_file_without_latvian_adress'].invoke
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。