From 0f953dd5b6655498b2a23f6d8995f1d6d45c2ccd Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Tue, 17 Nov 2015 16:14:26 +0100 Subject: [PATCH] Move template to external file --- interface/generate-grant-execute.rb | 7 +++---- interface/templates/grant-execute.erb | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 interface/templates/grant-execute.erb diff --git a/interface/generate-grant-execute.rb b/interface/generate-grant-execute.rb index 3f7f8bf..b572723 100644 --- a/interface/generate-grant-execute.rb +++ b/interface/generate-grant-execute.rb @@ -9,18 +9,17 @@ GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client' INTERFACE_SOURCE_FILE = 'interface.csv' class GrantExecute - TEMPLATE=<<-END -GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser; -END + TEMPLATE_FILE = 'templates/grant-execute.erb' attr_reader :function_signature def initialize(function_signature) @function_signature = function_signature + @template = File.read(TEMPLATE_FILE) end def render - ERB.new(TEMPLATE).result(binding) + ERB.new(@template).result(binding) end end diff --git a/interface/templates/grant-execute.erb b/interface/templates/grant-execute.erb new file mode 100644 index 0000000..c3aaecb --- /dev/null +++ b/interface/templates/grant-execute.erb @@ -0,0 +1 @@ +GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser; \ No newline at end of file