forked from rbotafogo/mdarray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
163 lines (119 loc) · 4.1 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
require 'rbconfig'
##########################################################################################
# Configuration. Remove setting before publishing Gem.
##########################################################################################
# set to true if development environment
# $DVLP = true
# Set to 'cygwin' when in cygwin
# $ENV = 'cygwin'
# Dependencies that are not yet installed (still in development)
$DEPEND = Array.new
##########################################################################################
# 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
#---------------------------------------------------------------------------------------
# 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 of a path
#---------------------------------------------------------------------------------------
def set_path(path)
`cygpath -a -p -m #{path}`.tr("\n", "")
end
else
#---------------------------------------------------------------------------------------
# Return the path
#---------------------------------------------------------------------------------------
def set_path(path)
path
end
end
#---------------------------------------------------------------------------------------
# Set dependencies
#---------------------------------------------------------------------------------------
def depend(name)
dependency_dir = MDArray.project_dir + "/" + name
mklib(dependency_dir)
end
#---------------------------------------------------------------------------------------
# Set the project directories
#---------------------------------------------------------------------------------------
class MDArray
@home_dir = File.expand_path File.dirname(__FILE__)
class << self
attr_reader :home_dir
end
@project_dir = MDArray.home_dir + "/.."
@doc_dir = MDArray.home_dir + "/doc"
@lib_dir = MDArray.home_dir + "/lib"
@src_dir = MDArray.home_dir + "/src"
@target_dir = MDArray.home_dir + "/target"
@test_dir = MDArray.home_dir + "/test"
@vendor_dir = MDArray.home_dir + "/vendor"
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
end
@build_dir = MDArray.src_dir + "/build"
class << self
attr_reader :build_dir
end
@classes_dir = MDArray.build_dir + "/classes"
class << self
attr_reader :classes_dir
end
end
##########################################################################################
# Config gem
##########################################################################################
if ($DVLP == true)
mklib(MDArray.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 "MDArray", "lib/mdarray"
add_group "Colt", "lib/colt"
add_group "NetCDF", "lib/netcdf"
end
end
end