require "rake/testtask" require "rubocop/rake_task" require "bundler/gem_tasks" RuboCop::RakeTask.new(:lint) do |t| t.options = ["--display-cop-names"] end task :version, [:v] do |t, args| out = "# Prevent bundler errors\n"\ "module Liquid; class Tag; end; end\n\n"\ "module Jekyll\n"\ " class Octicons < Liquid::Tag\n"\ " VERSION = \"#{args[:v]}\".freeze\n"\ " end\n"\ "end" File.open(File.expand_path("../lib/jekyll-octicons/version.rb", __FILE__), "w") do |file| file.puts out end ["jekyll-octicons.gemspec", "Gemfile"].each do |filename| gs = File.read(File.expand_path("../#{filename}", __FILE__)) File.open(File.expand_path("../#{filename}", __FILE__), "w") do |file| file.puts gs.gsub(/"octicons", "[^"]+"/, "\"octicons\", \"#{args[:v]}\"") end end end Rake::TestTask.new do |t| t.libs = ["lib", "test"] t.test_files = FileList["test/*_test.rb"] t.warning = false end desc "Run tests" task default: :test