Method: Nyx#compile

Defined in:
lib/nyx.rb

#compile(args) ⇒ Object

def



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/nyx.rb', line 185

def compile(args)
	if args.length != 0
		dirpath = args[0].sub(/(\/)+$/,'')+'/'
	else # no parameters, assume .
		dirpath = './'
	end#if

	if ! File.exist? dirpath
		self.fail 'Target directory does not exist.'
		return;
	end#if

	jsonconfigfile = dirpath+'nyx.json'
	if ! File.exist? jsonconfigfile
		self.fail 'Missing nyx.json file in target directory.'
		return;
	end#if

	conf = JSON.parse(open(jsonconfigfile).read)

	# ensure nyx.json interface isn't newer

	conf_interface = '1.0.0'
	if (conf != nil && conf.has_key?('interface'))
		conf_interface = conf['interface'];
	end#if

	self.check_interface_version(conf_interface, 'nyx.json');

	# core processing

	conf['cores'].each do |wpcoreconf|
		self.core dirpath, wpcoreconf
	end#each

	puts ""
	puts "  fin"
end