forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ckon.rb
92 lines (88 loc) · 3.17 KB
/
ckon.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
class Ckon < Formula
homepage "https://tschaume.github.io/ckon/"
url "https://github.com/tschaume/ckon/archive/v0.7.1.tar.gz"
sha256 "4cc8bde10430e21520aed4b7ac5f6d96a80b8a91014760997f9a7039103a7e0d"
head "https://github.com/tschaume/ckon.git"
bottle do
cellar :any
sha256 "323e789437728c8c463f8d2ffa18cdf8577c104c372e1cee1e26b98b62727336" => :yosemite
sha256 "b5fcb57a446c1af14eabea2abda7dfd6dcfc64c6c82c41f83bcc79334c4d4515" => :mavericks
sha256 "dc18479f693509bd64bf31ab8f5f162d52d4ecf69e70bb82fd7fe9e4d7ca42dc" => :mountain_lion
end
depends_on "boost"
depends_on "curl"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
def install
system "./autogen.sh"
autoreconf_args = ["-v", "--force", "--install", "-Wall"]
system "autoreconf", *autoreconf_args
boostopts = [
"--with-boost", "--with-boost-filesystem",
"--with-boost-system", "--with-boost-regex",
"--with-boost-program-options"
]
system "./configure", "--prefix=#{prefix}", *boostopts
system "make", "install"
end
test do
system "#{bin}/ckon", "--version"
(testpath/"ckon.cfg").write <<-EOS.undent
suffix=0
yaml=1
[ckon]
src_dir=StRoot
prog_subdir=programs
build_dir=build
install_dir=build
exclSuffix=""
NoRootCint="BesCocktail"
cppflags="-Wall"
boost="system filesystem program_options"
[ldadd]
cbes=-lMathMore
EOS
(testpath/"ckonignore").write <<-EOS.undent
macros
EOS
(testpath/"ckon.out").write <<-EOS.undent
found ignore string macros in StRoot/BesCocktail/macros
found ignore string macros in StRoot/BesCocktail/macros/bingchu
"StRoot/BesCocktail"
found ignore string macros in StRoot/BesCocktail/macros
found ignore string macros in StRoot/BesCocktail/macros
Processing file "StRoot/BesCocktail/Analysis.h"
class "Analysis" found at: 302
Processing file "StRoot/BesCocktail/CmdLine.h"
class "CmdLine" found at: 255
Processing file "StRoot/BesCocktail/Database.h"
class "DatabaseManager" found at: 1728
Processing file "StRoot/BesCocktail/Functions.h"
class "Functions" found at: 310
Processing file "StRoot/BesCocktail/Simulation.h"
class "Simulation" found at: 329
Processing file "StRoot/BesCocktail/Utils.h"
class "Utils" found at: 168
Processing file "StRoot/BesCocktail/Analysis.h"
Processing file "StRoot/BesCocktail/CmdLine.h"
Processing file "StRoot/BesCocktail/Database.h"
namespace "YAML" found at: 737
Processing file "StRoot/BesCocktail/Functions.h"
Processing file "StRoot/BesCocktail/Simulation.h"
Processing file "StRoot/BesCocktail/Utils.h"
core_lib_string: lib/libMyCollection.la
core_lib_string: lib/libMyCollection.la
1 sub-directories processed.
EOS
cd testpath
mkdir "StRoot"
system "git", "clone", "https://github.com/tschaume/BesCocktail.git", "StRoot/BesCocktail"
result = File.open(testpath/"ckon.out").read
require "open3"
Open3.popen3("#{bin}/ckon", "-v", "dry") do |_, stdout, _|
assert_equal result, stdout.read
end
system "#{bin}/ckon", "clean"
end
end