-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathmongodb-community@7.0.rb
71 lines (60 loc) · 1.79 KB
/
mongodb-community@7.0.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class MongodbCommunityAT70 < Formula
desc "High-performance, schema-free, document-oriented database"
homepage "https://www.mongodb.com/"
# frozen_string_literal: true
if Hardware::CPU.intel?
url "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-7.0.16.tgz"
sha256 "bd03e101d1943a9747602b8addfb6d5c7d93b77966c0ab2bcda4a730c3d57391"
else
url "https://fastdl.mongodb.org/osx/mongodb-macos-arm64-7.0.16.tgz"
sha256 "e01c5ce1ef8efbef4196797130564b8f121f6e29f20ccf70e025feba07e15739"
end
option "with-enable-test-commands", "Configures MongoDB to allow test commands such as failpoints"
depends_on "mongodb-database-tools" => :recommended
depends_on "mongosh" => :recommended
conflicts_with "mongodb-enterprise"
def install
inreplace "macos_mongodb.plist" do |s|
s.gsub!("\#{plist_name}", "#{plist_name}")
s.gsub!("\#{opt_bin}", "#{opt_bin}")
s.gsub!("\#{etc}", "#{etc}")
s.gsub!("\#{HOMEBREW_PREFIX}", "#{HOMEBREW_PREFIX}")
s.gsub!("\#{var}", "#{var}")
end
prefix.install Dir["*"]
prefix.install_symlink "macos_mongodb.plist" => "#{plist_name}.plist"
end
def post_install
(var/"mongodb").mkpath
(var/"log/mongodb").mkpath
if !(File.exist?((etc/"mongod.conf"))) then
(etc/"mongod.conf").write mongodb_conf
end
end
service do
name macos: "#{plist_name}"
end
def mongodb_conf
cfg = <<~EOS
systemLog:
destination: file
path: #{var}/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: #{var}/mongodb
net:
bindIp: 127.0.0.1, ::1
ipv6: true
EOS
if build.with? "enable-test-commands"
cfg += <<~EOS
setParameter:
enableTestCommands: 1
EOS
end
cfg
end
test do
system "#{bin}/mongod", "--sysinfo"
end
end