33 lines
889 B
Ruby
33 lines
889 B
Ruby
|
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 = "module OcticonsHelper\n"\
|
||
|
" VERSION = \"#{args[:v]}\".freeze\n"\
|
||
|
"end"
|
||
|
File.open(File.expand_path("../lib/octicons_helper/version.rb", __FILE__), "w") do |file|
|
||
|
file.puts out
|
||
|
end
|
||
|
|
||
|
["octicons_helper.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
|