diff --git a/Services/core.rb b/Services/core.rb index cd18d35..7deaaa8 100755 --- a/Services/core.rb +++ b/Services/core.rb @@ -82,8 +82,8 @@ class Object public end # ### Mount Databases by role -if File.exists?("#{GxG::SYSTEM_PATHS[:configuration]}/databases.json") - handle = File.open("#{GxG::SYSTEM_PATHS[:configuration]}/databases.json", "rb") +if ::File.exist?("#{::GxG::SYSTEM_PATHS[:configuration]}/databases.json") + handle = ::File.open("#{::GxG::SYSTEM_PATHS[:configuration]}/databases.json", "rb") db_config = ::JSON::parse(handle.read(), {:symbolize_names => true}) handle.close # ### Set DB Roles, and other details @@ -206,7 +206,7 @@ end ::GxG::VFS.mount(::GxG::Storage::Volume.new({:directory => ::GxG::SYSTEM_PATHS[:public]}), "/Public") # Populate Optional VFS mount points if GxG::valid_uuid?(GxG::DB[:administrator]) - if File.exists?("#{GxG::SYSTEM_PATHS[:configuration]}/mounts.json") + if File.exist?("#{GxG::SYSTEM_PATHS[:configuration]}/mounts.json") handle = File.open("#{GxG::SYSTEM_PATHS[:configuration]}/mounts.json", "rb") mount_config = ::JSON::parse(handle.read(), {:symbolize_names => true}) handle.close @@ -493,7 +493,7 @@ module GxG def save_configuration(options={}) result = false config_path = ::File.expand_path(::GxG::SYSTEM_PATHS[:configuration] + "/" + "#{@provides.to_s}.json") - if File.exists?(config_path) + if File.exist?(config_path) File.delete(config_path) end begin @@ -510,7 +510,7 @@ module GxG def load_configuration(options={}) result = false config_path = ::File.expand_path(::GxG::SYSTEM_PATHS[:configuration] + "/" + "#{@provides.to_s}.json") - if File.exists?(config_path) + if File.exist?(config_path) handle = File.open(config_path, "rb", 0664) begin @configuration =::JSON::parse(handle.read(), {:symbolize_names => true}) @@ -1816,7 +1816,7 @@ core_service.on(:at_stop, {:description => "System Service Layer Shutdown", :usa unless service.configuration()[:disabled].include?(moniker) service_file_path = ::File.expand_path("#{File.dirname(__FILE__)}/#{moniker}/#{moniker}.rb") puts "Loading : #{service_file_path}" - if ::File.exists?(service_file_path) + if ::File.exist?(service_file_path) begin require (service_file_path) rescue Exception => the_error diff --git a/setup.rb b/setup.rb index 4829d8a..9325dfa 100755 --- a/setup.rb +++ b/setup.rb @@ -88,13 +88,13 @@ module GxG SERVER_PATHS = {:root => gxg_root, :system => system_dir, :services => services_dir, :temporary => tmp_dir, :logs => log_dir, :installers => installer_dir, :public => public_dir, :configuration => sys_config_dir, :themes => pub_theme_dir, :javascript => pub_js_dir, :images => pub_image_dir, :audio => pub_audio_dir, :video => pub_video_dir, :databases => sys_db_dir, :extensions => sys_ext_dir, :gems => sys_gem_dir, :libraries => sys_lib_dir, :users => user_dir} end # Core Configuration -unless File.exists?("#{GxG::SERVER_PATHS[:configuration]}/core.json") +unless File.exist?("#{GxG::SERVER_PATHS[:configuration]}/core.json") handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/core.json", "wb") handle.write(::JSON.pretty_generate({:enabled => ["www"], :disabled => [], :available => ["www"]})) handle.close end # WWW Configuration -unless File.exists?("#{GxG::SERVER_PATHS[:configuration]}/www.json") +unless File.exist?("#{GxG::SERVER_PATHS[:configuration]}/www.json") handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/www.json", "wb") handle.write(::JSON.pretty_generate({:mode => "production", :listen => [{:address => "127.0.0.1", :port => 32767}], :relative_url => "", :cache_quota => 1073741824, :cache_max_item_size => 1073741824})) handle.close @@ -103,7 +103,7 @@ end def configure_db() # Construct default configuration files: # Database Configuration: - if File.exists?("#{GxG::SERVER_PATHS[:configuration]}/databases.json") + if File.exist?("#{GxG::SERVER_PATHS[:configuration]}/databases.json") handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/databases.json", "rb") db_config = ::JSON::parse(handle.read(), {:symbolize_names => true}) handle.close @@ -134,7 +134,7 @@ def configure_db() end end # - if File.exists?("#{GxG::SERVER_PATHS[:configuration]}/databases.json") + if File.exist?("#{GxG::SERVER_PATHS[:configuration]}/databases.json") File.delete("#{GxG::SERVER_PATHS[:configuration]}/databases.json") end handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/databases.json","w+b", 0664) @@ -149,7 +149,7 @@ db_configuration = configure_db() def configure_vfs() # VFS Mounting Configuration: reserved_roles = ["users", "data"] - if File.exists?("#{GxG::SERVER_PATHS[:configuration]}/mounts.json") + if File.exist?("#{GxG::SERVER_PATHS[:configuration]}/mounts.json") handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/mounts.json", "rb") mount_config = ::JSON::parse(handle.read(), {:symbolize_names => true}) handle.close @@ -191,7 +191,7 @@ def configure_vfs() end end end - if File.exists?("#{GxG::SERVER_PATHS[:configuration]}/mounts.json") + if File.exist?("#{GxG::SERVER_PATHS[:configuration]}/mounts.json") File.delete("#{GxG::SERVER_PATHS[:configuration]}/mounts.json") end handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/mounts.json","w+b", 0664) @@ -274,7 +274,7 @@ def admin_setup(db_pool, mount_config) end # admin_config = {:credential => credential} - if File.exists?("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json") + if File.exist?("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json") File.delete("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json") end handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json","w+b", 0664) @@ -283,7 +283,7 @@ def admin_setup(db_pool, mount_config) GxG::DB[:administrator] = credential else # has already been setup. - if File.exists?("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json") + if File.exist?("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json") handle = File.open("#{GxG::SERVER_PATHS[:configuration]}/db_admin.json","rb") admin_config = ::JSON::parse(handle.read(), {:symbolize_names => true}) handle.close