Class: WirisPlugin::RubyConfigurationUpdater

Inherits:
Object
  • Object
show all
Includes:
Wiris
Defined in:
lib/src-generic/RubyConfigurationUpdater.rb

Instance Method Summary collapse

Instance Method Details

#init(obj) ⇒ Object



11
12
# File 'lib/src-generic/RubyConfigurationUpdater.rb', line 11

def init(obj)
end

#requestObject



4
5
6
# File 'lib/src-generic/RubyConfigurationUpdater.rb', line 4

def request
@request
end

#request=(request) ⇒ Object



7
8
9
# File 'lib/src-generic/RubyConfigurationUpdater.rb', line 7

def request=(request)
@request=request
end

#updateConfiguration(configuration) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/src-generic/RubyConfigurationUpdater.rb', line 14

def updateConfiguration(configuration)
	v =PropertiesTools::getProperty(configuration, ConfigurationKeys::CACHE_FOLDER, nil)
	if v.nil?
		configuration[ConfigurationKeys::CACHE_FOLDER] = File.dirname(__FILE__) +  "/../../cache"
	end
	v =PropertiesTools::getProperty(configuration, ConfigurationKeys::FORMULA_FOLDER, nil)
	if v.nil?
		configuration[ConfigurationKeys::FORMULA_FOLDER] = File.dirname(__FILE__) +  "/../../formulas"
	end
	v =PropertiesTools::getProperty(configuration, ConfigurationKeys::SHOWIMAGE_PATH, nil)
	if v.nil?
		configuration[ConfigurationKeys::SHOWIMAGE_PATH] = "wirispluginengine/integration/showimage?formula="
	end
	v =PropertiesTools::getProperty(configuration, ConfigurationKeys::CLEAN_CACHE_PATH, nil)
	if v.nil?
		configuration[ConfigurationKeys::CLEAN_CACHE_PATH] = "cleancache"
	end
	v =PropertiesTools::getProperty(configuration, ConfigurationKeys::RESOURCE_PATH, nil)
	if v.nil?
		configuration[ConfigurationKeys::RESOURCE_PATH] = "resource"
	end
	v =PropertiesTools::getProperty(configuration, ConfigurationKeys::CONFIGURATION_PATH, nil)
	if v.nil?
		if File.file?(Rails.root.join('vendor', 'wiris', 'configuration.ini'))
			configuration[ConfigurationKeys::CONFIGURATION_PATH] = Rails.root.join('vendor', 'wiris').to_s
		else
			configuration[ConfigurationKeys::CONFIGURATION_PATH] = File.dirname(__FILE__) + "/../../"
		end
	end
	v = PropertiesTools::getProperty(configuration, ConfigurationKeys::REFERER, nil)
	if v.nil?
		configuration[ConfigurationKeys::REFERER] = request.original_url
	end
end