datomic: fix upgrades and reinstalls (#23012)

don't attempt string replacements on an existing config file
This commit is contained in:
ilovezfs 2018-01-18 04:24:52 -08:00 committed by GitHub
parent 3405b293d6
commit 717417fe95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,14 @@ class Datomic < Formula
depends_on :java
def install
inreplace "config/samples/free-transactor-template.properties" do |s|
s.gsub! "# data-dir=data", "data-dir=#{var}/lib/datomic/"
s.gsub! "# log-dir=log", "log-dir=#{var}/lib/datomic/log"
end
# install free-transactor properties
(etc/"datomic").install "config/samples/free-transactor-template.properties" => "free-transactor.properties"
libexec.install Dir["*"]
(bin/"datomic").write_env_script libexec/"bin/datomic", Language::Java.java_home_env
@ -18,16 +26,6 @@ class Datomic < Formula
# create directory for datomic data and logs
(var/"lib/datomic").mkpath
# install free-transactor properties
data = var/"lib/datomic"
(etc/"datomic").mkpath
(etc/"datomic").install libexec/"config/samples/free-transactor-template.properties" => "free-transactor.properties"
inreplace "#{etc}/datomic/free-transactor.properties" do |s|
s.gsub! "# data-dir=data", "data-dir=#{data}/"
s.gsub! "# log-dir=log", "log-dir=#{data}/log"
end
end
def post_install