Method: Nyx#compile

Defined in:
lib/nyx.rb

#compile(args) ⇒ Object

def



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/nyx.rb', line 214

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