# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(spec: :start_website) do |task| task.pattern = 'spec/test_gem_spec.rb' end directory 'logs' desc 'Start virtual web service' task start_website: :logs do mkdir_p 'logs' command = %w[jekyll serve -s test_site] ENV['test_site_pid'] = Process.spawn(*command, err: %w[logs/test_site.log w]).to_s sleep 2 # Wait a little for virtual server to start up puts 'Running test site on pid ' + ENV['test_site_pid'] ENV['PAGE_URL'] = 'localhost:4000' end task default: :spec