forked from sidaf/homebrew-pentest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cewl.rb
48 lines (41 loc) · 1.7 KB
/
cewl.rb
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
require "formula"
class Cewl < Formula
homepage "https://github.com/digininja/CeWL/"
url "https://github.com/digininja/CeWL/", :using => :git, :revision => 'e102a5c'
version "5.3"
revision 4
depends_on "ruby@2.5"
depends_on "libxml2"
depends_on "libxslt"
depends_on "exiftool"
resource "bundler" do
url "https://rubygems.org/downloads/bundler-1.14.3.gem"
sha256 "9d61c7d983b99eb0b16d64658b182e045bcdd74ef3b139e849777f780782dbfe"
end
def install
(buildpath/"vendor/bundle").mkpath
resources.each do |r|
r.verify_download_integrity(r.fetch)
system("#{HOMEBREW_PREFIX}/opt/ruby@2.5/bin/gem", "install", r.cached_download, "--no-document",
"--install-dir", "vendor/bundle")
end
ENV["GEM_HOME"] = "#{buildpath}/vendor/bundle"
system "#{HOMEBREW_PREFIX}/opt/ruby@2.5/bin/ruby", "#{buildpath}/vendor/bundle/bin/bundle", "install", "--no-cache", "--path", "vendor/bundle"
inreplace "cewl.rb", "require './cewl_lib'", "require '#{libexec}/cewl_lib'"
inreplace "fab.rb", "require \"./cewl_lib.rb\"", "require '#{libexec}/cewl_lib.rb'"
(bin/"cewl.rb").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{libexec}/vendor/bundle"
export BUNDLE_GEMFILE="#{libexec}/Gemfile"
#{libexec}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/ruby@2.5/bin/ruby #{libexec}/cewl.rb "$@"
EOS
(bin/"fab.rb").write <<~EOS
#!/usr/bin/env bash
export GEM_HOME="#{libexec}/vendor/bundle"
export BUNDLE_GEMFILE="#{libexec}/Gemfile"
#{libexec}/vendor/bundle/bin/bundle exec #{HOMEBREW_PREFIX}/opt/ruby@2.5/bin/ruby #{libexec}/fab.rb "$@"
EOS
libexec.install Dir['*']
libexec.install ".bundle"
end
end