forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ckon.rb
93 lines (89 loc) · 3.14 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
93
class Ckon < Formula
homepage "http://tschaume.github.io/ckon/"
url "https://github.com/tschaume/ckon/archive/v0.7.1.tar.gz"
sha1 "15481a0232e7fe6584f91cd530d324e8d275f1c0"
head "https://github.com/tschaume/ckon.git"
bottle do
root_url "https://downloads.sf.net/project/machomebrew/Bottles/science"
cellar :any
sha1 "5e314bc8906e51866e3c210561987983a51ae14d" => :yosemite
sha1 "d73d9cafbe6d405cbd295171ff45676db3ccb394" => :mavericks
sha1 "d49c913baa3a43485724ba87dae663a9d229840c" => :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