diff options
| author | Max Howell | 2012-09-11 03:32:10 -0400 |
|---|---|---|
| committer | Max Howell | 2012-09-11 03:45:16 -0400 |
| commit | 7a494e8d4dce785df58a663b54eaa84b20436e89 (patch) | |
| tree | 220ff5a7489d4a5ab8663b3eee1ed1e67e00a2c9 /Library | |
| parent | ff55b25b552780e3027a1b1052ec871b11d9d654 (diff) | |
| download | homebrew-7a494e8d4dce785df58a663b54eaa84b20436e89.tar.bz2 | |
Make mongod just work
Hopefully this is safe. I ran a full db against it, everything seemed fine to me.
Homebrew should "just work" no remembering to specify `--config foo`, that's just lame sauce.
Also cleaned up the caveats and removed the `skip_clean: all`.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/mongodb.rb | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/Library/Formula/mongodb.rb b/Library/Formula/mongodb.rb index 58c3a1096..e6287ea3b 100644 --- a/Library/Formula/mongodb.rb +++ b/Library/Formula/mongodb.rb @@ -15,8 +15,6 @@ class Mongodb < Formula option '32-bit' - skip_clean :all - def install # Copy the prebuilt binaries to prefix prefix.install Dir['*'] @@ -28,25 +26,34 @@ class Mongodb < Formula # Write the configuration files (prefix+'mongod.conf').write mongodb_conf + # Homebrew: it just works. + mv (sh = bin/'mongod'), prefix + sh.write <<-EOS.undent + #!/usr/bin/env ruby + ARGV << '--config' << '#{etc}/mongod.conf' unless ARGV.include? '--config' + exec "#{prefix}/mongod", *ARGV + EOS + sh.chmod 0755 + # copy the config file to etc if this is the first install. etc.install prefix+'mongod.conf' unless File.exists? etc+"mongod.conf" end - def caveats; <<-EOS.undent + def caveats + bn = plist_path.basename + plist_path = "#{HOMEBREW_PREFIX}/opt/#{name}/*.plist" + <<-EOS.undent If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents - cp #{plist_path} ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} - - If this is an upgrade and you already have the #{plist_path.basename} loaded: - launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} - cp #{plist_path} ~/Library/LaunchAgents/ - launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} + ln -s #{plist_path} ~/Library/LaunchAgents/ + launchctl load -w ~/Library/LaunchAgents/#{bn} - Or start it manually: - mongod run --config #{etc}/mongod.conf + If this is an upgrade and you already have the plist loaded: + launchctl unload -w ~/Library/LaunchAgents/#{bn} + launchctl load -w ~/Library/LaunchAgents/#{bn} - The launchctl plist above expects the config file to be at #{etc}/mongod.conf. + Or just start it manually: + mongod EOS end |
