Commit 1715bf35 authored by Lucas Nussbaum's avatar Lucas Nussbaum

Reorganize code to avoid duplicate requires

parent e0823063
require_relative '../lib/input_loader' $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require_relative './wiki_generator' require 'wiki_generator'
require_relative './mw_utils'
class CPUParametersGenerator < WikiGenerator class CPUParametersGenerator < WikiGenerator
......
# coding: utf-8 # coding: utf-8
require_relative '../lib/input_loader' $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require_relative './wiki_generator' require 'wiki_generator'
require_relative './mw_utils'
class DiskReservationGenerator < WikiGenerator class DiskReservationGenerator < WikiGenerator
......
# coding: utf-8 # coding: utf-8
require 'pp' $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require_relative '../lib/input_loader' require 'wiki_generator'
require_relative './wiki_generator'
require_relative './mw_utils'
require_relative './site_hardware.rb' require_relative './site_hardware.rb'
class G5KHardwareGenerator < WikiGenerator class G5KHardwareGenerator < WikiGenerator
......
...@@ -5,7 +5,10 @@ require 'net/http' ...@@ -5,7 +5,10 @@ require 'net/http'
require 'net/https' require 'net/https'
require 'mediawiki_api' require 'mediawiki_api'
require_relative "../lib/input_loader" # also add generators/lib to load path
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../lib')))
require 'input_loader'
#Adding method to mediawiki_api client #Adding method to mediawiki_api client
module MediawikiApi module MediawikiApi
...@@ -109,7 +112,7 @@ module G5K ...@@ -109,7 +112,7 @@ module G5K
@@global_hash = nil @@global_hash = nil
def self.get_global_hash def self.get_global_hash
if @@global_hash.nil? if @@global_hash.nil?
@@global_hash = load_yaml_file_hierarchy(File.expand_path("../../input/grid5000/", File.dirname(__FILE__))) @@global_hash = load_yaml_file_hierarchy(File.expand_path("../../../input/grid5000/", File.dirname(__FILE__)))
end end
# return a deep copy of global_hash # return a deep copy of global_hash
return Marshal.load(Marshal.dump(@@global_hash)) return Marshal.load(Marshal.dump(@@global_hash))
......
# also add generators/lib to load path
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../lib')))
require 'input_loader'
require "optparse" require "optparse"
require "mediawiki_api" require "mediawiki_api"
require "diffy" require "diffy"
require "mw_utils"
require_relative "./mw_utils"
class WikiGenerator class WikiGenerator
......
# coding: utf-8 # coding: utf-8
require 'pp' $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require 'wiki_generator'
require_relative '../lib/input_loader'
require_relative '../oar-properties/lib/lib-oar-properties' require_relative '../oar-properties/lib/lib-oar-properties'
require_relative './wiki_generator'
require_relative './mw_utils'
class OarPropertiesGenerator < WikiGenerator class OarPropertiesGenerator < WikiGenerator
......
# coding: utf-8 # coding: utf-8
require 'optparse' $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require 'date' require 'wiki_generator'
require 'pp'
require_relative '../lib/input_loader'
require_relative './wiki_generator'
require_relative './mw_utils'
class SiteHardwareGenerator < WikiGenerator class SiteHardwareGenerator < WikiGenerator
......
# coding: utf-8
require 'pp'
require_relative './site_hardware.rb'
require_relative './mw_utils.rb'
pp get_hardware(G5K::SITES)
# coding: utf-8 # coding: utf-8
require 'optparse' $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'lib')))
require 'date' require 'wiki_generator'
require_relative '../lib/input_loader'
require_relative './wiki_generator'
require_relative './mw_utils'
require_relative '../input-validators/check-network-description' require_relative '../input-validators/check-network-description'
# This class generates the network description of each site, in .dot # This class generates the network description of each site, in .dot
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment