mirror of
https://github.com/mistergibson/gxg-server.git
synced 2026-08-15 02:15:59 -07:00
Fixed File.exists? issue
This commit is contained in:
parent
b7533c6c9d
commit
67bc1a9338
2 changed files with 14 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
16
setup.rb
16
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue