-
Notifications
You must be signed in to change notification settings - Fork 8
/
Rakefile
155 lines (135 loc) · 4.43 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
require 'rubygems'
require 'rake'
require 'rake/clean'
CLEAN.add 'tmp'
CLOBBER.add '**/*.class', '**/buby.jar', "doc", '.yardoc'
begin
require 'jeweler'
jeweler = Jeweler::Tasks.new do |gem|
gem.name = "buby"
gem.summary = %q{Buby is a mashup of JRuby with the popular commercial web security testing tool Burp Suite from PortSwigger}
gem.description = %q{Buby is a mashup of JRuby with the popular commercial web security testing tool Burp Suite from PortSwigger. Burp is driven from and tied to JRuby with a Java extension using the BurpExtender API. This extension aims to add Ruby scriptability to Burp Suite with an interface comparable to the Burp's pure Java extension interface.}
gem.email = "td@matasano.com"
gem.homepage = "http://tduehr.github.com/buby"
gem.authors = ["Eric Monti, tduehr"]
gem.platform = "java"
gem.license = "MIT"
gem.files.include "**/buby.jar"
gem.files.include "**/burp_interfaces.jar"
gem.test_files = ["test/buby_test.rb"]
gem.rdoc_options = ["--main", "README.rdoc"]
gem.extra_rdoc_files = ["History.txt", "README.rdoc", "bin/buby"]
gem.add_development_dependency "rake-compiler", "~> 0.8.1"
end.jeweler
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test' << 'java'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
task :test => :check_dependencies
task :default => :test
begin
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION')
version = File.read('VERSION')
else
version = ""
end
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "buby #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('History.txt')
rdoc.rdoc_files.include('bin/buby')
rdoc.rdoc_files.include('lib/**/*.rb')
end
rescue LoadError
end
begin
require 'yard'
YARD::Rake::YardocTask.new
YARD::Rake::YardocTask.new(:todo) do |yard|
yard.options.concat ['--query', '@todo']
yard.options << "--list"
end
rescue LoadError
end
begin
require 'rake/javaextensiontask'
Rake::JavaExtensionTask.new('burp_interfaces', jeweler.gemspec)
Rake::JavaExtensionTask.new('buby', jeweler.gemspec) do |jet|
jet.classpath = "lib/burp_interfaces.jar"
end
task :test => :compile
task :build => :compile
rescue LoadError
warn 'rake-compiler not found. java compilation must be performed manually'
end
namespace :version do
task :nice do
version_hash = YAML.load_file 'VERSION.yml'
version_string = ""
version_string << version_hash[:major].to_s
version_string << ".#{version_hash[:minor].to_s}"
version_string << ".#{version_hash[:patch].to_s}"
version_string << ".#{version_hash[:build].to_s}" if version_hash[:build]
File.open('lib/buby/version.rb', 'w') do |file|
file.write <<EOS
class Buby
module Version
STRING = "#{version_string}"
MAJOR = #{version_hash[:major].to_i}
MINOR = #{version_hash[:minor].to_i}
PATCH = #{version_hash[:patch].to_i}
BUILD = #{version_hash[:build].inspect}
end
end
EOS
end
jeweler.repo.add 'lib/buby/version.rb'
jeweler.repo.commit "fixup! Version bump to #{version_string}"
system 'git', 'rebase', '-i', 'HEAD~1'
puts "Buby::Version updated to #{version_string}"
end
namespace :bump do
task :patch do
Rake::Task["version:nice"].invoke
end
task :patch do
Rake::Task["version:nice"].invoke
end
task :patch do
Rake::Task["version:nice"].invoke
end
end
end
desc "Start Buby in interactive mode with all runtime dependencies loaded"
task :test_console, [:script] do |t,args|
# TODO move to a command
dirs = ['ext', 'lib'].select { |dir| File.directory?(dir) }
original_load_path = $LOAD_PATH
cmd = if File.exist?('Gemfile')
require 'bundler'
Bundler.setup(:default)
end
# add the project code directories
$LOAD_PATH.unshift(*dirs)
# clear ARGV so IRB is not confused
ARGV.clear
require 'irb'
require File.basename Dir.glob('lib/burpsuite_pro_*.jar').last
require 'burp_interfaces.jar'
require 'buby.jar'
require 'buby'
$burp = Buby.start_burp
# set the optional script to run
IRB.conf[:SCRIPT] = args.script
IRB.start
# return the $LOAD_PATH to it's original state
$LOAD_PATH.reject! { |path| !(original_load_path.include?(path)) }
end