-
-
Notifications
You must be signed in to change notification settings - Fork 449
/
Copy pathRakefile
85 lines (72 loc) · 1.81 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# frozen_string_literal: true
require 'rspec/core/rake_task'
require 'net/http'
require 'json'
namespace :test do
desc 'Set up the test environment for functional tests'
task :functional_setup do
sh 'go mod vendor'
sh 'go build -o dalfox .' # Explicitly name the output binary
end
desc 'Run the functional tests'
RSpec::Core::RakeTask.new(functional: :functional_setup) do |t|
t.pattern = 'spec/functional_tests/**/*_spec.rb'
t.verbose = true # More output for debugging
end
desc 'Run the unit tests'
task :unit do
sh 'go test ./...'
end
desc 'Run all tests'
task :all do
Rake::Task['test:functional'].invoke
Rake::Task['test:unit'].invoke
end
end
namespace :docs do
desc 'Serve the documentation site'
task :serve do
within_docs_directory do
unless system('bundle check')
puts "Bundler is not installed or dependencies are not met. Please run 'rake docs:install'."
exit 1
end
sh 'bundle exec jekyll s'
end
end
desc 'Install dependencies for the documentation site'
task :install do
within_docs_directory do
sh 'bundle install'
end
end
def within_docs_directory(&block)
Dir.chdir('docs', &block)
rescue Errno::ENOENT => e
puts "Directory 'docs' not found: #{e.message}"
exit 1
rescue StandardError => e
puts "An error occurred: #{e.message}"
exit 1
end
end
namespace :assets do
desc 'Check remote assets'
task :check do
def check(endpoint)
url = URI("https://assets.hahwul.com/#{endpoint}.json")
response = Net::HTTP.get(url)
data = JSON.parse(response)
puts data
end
endpoints = [
'xss-portswigger',
'xss-payloadbox',
'wl-params',
'wl-assetnote-params'
]
endpoints.each do |target|
check target
end
end
end