blob: b49244cef142f78c100b970f819b2b3b772373e3 (
plain)
| 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
 | class Artifactory < Formula
  homepage "http://www.jfrog.com/artifactory/"
  url "http://dl.bintray.com/jfrog/artifactory/artifactory-3.5.1.zip"
  sha1 "bf07c877c73c0bf18754e0a31b347eb27cd07ada"
  depends_on :java => "1.7+"
  option "with-low-heap", "Run artifactory with low Java memory options. Useful for development machines. Do not use in production."
  option "with-java8", "Adjust memory settings for Java 8"
  def install
    # Remove Windows binaries
    rm_f Dir["bin/*.bat"]
    rm_f Dir["bin/*.exe"]
    # Set correct working directory
    inreplace "bin/artifactory.sh",
      'export ARTIFACTORY_HOME="$(cd "$(dirname "${artBinDir}")" && pwd)"',
      "export ARTIFACTORY_HOME=#{libexec}"
    # Remove obsolete parameters for Java 8
    inreplace "bin/artifactory.default",
      "-server -Xms512m -Xmx2g -Xss256k -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+UseG1GC",
      "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC" if build.with? "java8"
    # Reduce memory consumption for non production use
    inreplace "bin/artifactory.default",
      "-server -Xms512m -Xmx2g",
      "-Xms128m -Xmx768m" if build.with? "low-heap"
    libexec.install Dir["*"]
    # Launch Script
    bin.install_symlink libexec/"bin/artifactory.sh"
    # Memory Options
    bin.install_symlink libexec/"bin/artifactory.default"
  end
  def post_install
    # Create persistent data directory. Artifactory heavily relies on the data
    # directory being directly under ARTIFACTORY_HOME.
    # Therefore, we symlink the data dir to var.
    data = var/"artifactory"
    data.mkpath
    libexec.install_symlink data => "data"
  end
  plist_options :manual => "#{HOMEBREW_PREFIX}/opt/artifactory/libexec/bin/artifactory.sh"
  def plist; <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>Label</key>
        <string>com.jfrog.artifactory</string>
        <key>WorkingDirectory</key>
        <string>#{libexec}</string>
        <key>Program</key>
        <string>bin/artifactory.sh</string>
        <key>KeepAlive</key>
        <true/>
      </dict>
    </plist>
  EOS
  end
  test do
    output = shell_output("#{bin}/artifactory.sh check 2>&1", 1)
    assert output.include?("Checking arguments to Artifactory")
  end
end
 |