-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.rb
202 lines (151 loc) · 5.16 KB
/
config.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
require 'rbconfig'
require 'java'
#
# In principle should not be in this file. The right way of doing this is by executing
# bundler exec, but I don't know how to do this from inside emacs. So, should comment
# the next line before publishing the GEM. If not commented, this should be harmless
# anyway.
#
begin
require 'bundler/setup'
rescue LoadError
end
=begin
##########################################################################################
# Configuration. Remove setting before publishing Gem.
##########################################################################################
# set to true if development environment
$DVLP = true
# Set to 'cygwin' when in cygwin
$ENV = 'cygwin'
# Set development dependency: those are gems that are also in development and thus not
# installed in the gem directory. Need a way of accessing them if we are in development
# otherwise gem install will install the dependency
if $DVLP
$DEPEND=["SciCom", "MDArray"]
end
=end
##########################################################################################
# the platform
@platform =
case RUBY_PLATFORM
when /mswin/ then 'windows'
when /mingw/ then 'windows'
when /bccwin/ then 'windows'
when /cygwin/ then 'windows-cygwin'
when /java/
require 'java' #:nodoc:
if java.lang.System.getProperty("os.name") =~ /[Ww]indows/
'windows-java'
else
'default-java'
end
else 'default'
end
=begin
#---------------------------------------------------------------------------------------
# Add path to load path
#---------------------------------------------------------------------------------------
def mklib(path, home_path = true)
if (home_path)
lib = path + "/lib"
else
lib = path
end
$LOAD_PATH << lib
end
##########################################################################################
# Prepare environment to work inside Cygwin
##########################################################################################
if $ENV == 'cygwin'
#---------------------------------------------------------------------------------------
# Return the cygpath (windows format) of a path in POSIX format, i.e., /home/...
#---------------------------------------------------------------------------------------
def set_path(path)
`cygpath -a -p -m #{path}`.tr("\n", "")
end
else
#---------------------------------------------------------------------------------------
# Return the given path. When not in cygwin then just use the given path
#---------------------------------------------------------------------------------------
def set_path(path)
path
end
end
=end
#---------------------------------------------------------------------------------------
# Set the project directories
#---------------------------------------------------------------------------------------
class SciCom
@home_dir = File.expand_path File.dirname(__FILE__)
class << self
attr_reader :home_dir
end
@project_dir = SciCom.home_dir + "/.."
@doc_dir = SciCom.home_dir + "/doc"
@lib_dir = SciCom.home_dir + "/lib"
@src_dir = SciCom.home_dir + "/src"
@target_dir = SciCom.home_dir + "/target"
@test_dir = SciCom.home_dir + "/test"
@vendor_dir = SciCom.home_dir + "/vendor"
@cran_dir = SciCom.home_dir + "/cran"
class << self
attr_reader :project_dir
attr_reader :doc_dir
attr_reader :lib_dir
attr_reader :src_dir
attr_reader :target_dir
attr_reader :test_dir
attr_reader :vendor_dir
attr_reader :cran_dir
end
@build_dir = SciCom.src_dir + "/build"
class << self
attr_accessor :build_dir
end
@classes_dir = SciCom.build_dir + "/classes"
class << self
attr_reader :classes_dir
end
end
=begin
#---------------------------------------------------------------------------------------
# Set dependencies
#---------------------------------------------------------------------------------------
def depend(name)
dependency_dir = SciCom.project_dir + "/" + name
mklib(dependency_dir)
end
##########################################################################################
# If development
##########################################################################################
if ($DVLP == true)
mklib(SciCom.home_dir)
# Add dependencies here
# depend(<other_gems>)
$DEPEND.each do |dep|
depend(dep)
end if $DEPEND
#----------------------------------------------------------------------------------------
# If we need to test for coverage
#----------------------------------------------------------------------------------------
if $COVERAGE == 'true'
require 'simplecov'
SimpleCov.start do
@filters = []
add_group "SciCom", "lib/scicom"
end
end
end
# Add cran directory to the $LOAD_PATH search path
mklib(SciCom.cran_dir, false)
=end
##########################################################################################
# Load necessary jar files
##########################################################################################
Dir["#{SciCom.vendor_dir}/*.jar"].each do |jar|
require jar
end
Dir["#{SciCom.target_dir}/*.jar"].each do |jar|
require jar
end