Move template to external file
This commit is contained in:
@@ -9,18 +9,17 @@ GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client'
|
|||||||
INTERFACE_SOURCE_FILE = 'interface.csv'
|
INTERFACE_SOURCE_FILE = 'interface.csv'
|
||||||
|
|
||||||
class GrantExecute
|
class GrantExecute
|
||||||
TEMPLATE=<<-END
|
TEMPLATE_FILE = 'templates/grant-execute.erb'
|
||||||
GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser;
|
|
||||||
END
|
|
||||||
|
|
||||||
attr_reader :function_signature
|
attr_reader :function_signature
|
||||||
|
|
||||||
def initialize(function_signature)
|
def initialize(function_signature)
|
||||||
@function_signature = function_signature
|
@function_signature = function_signature
|
||||||
|
@template = File.read(TEMPLATE_FILE)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render
|
def render
|
||||||
ERB.new(TEMPLATE).result(binding)
|
ERB.new(@template).result(binding)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser;
|
||||||
Reference in New Issue
Block a user