diff --git a/draft/src/gewf/README.md b/draft/src/gewf/README.md
index a5cfd020..a16266b0 100644
--- a/draft/src/gewf/README.md
+++ b/draft/src/gewf/README.md
@@ -1,3 +1,4 @@
The gewf tool, is an experimentation to generate EWF project from template.
status: experimental, POC, in-progress, draft
+
diff --git a/draft/src/gewf/gewf.ecf b/draft/src/gewf/gewf.ecf
index 140da892..fc6cfa94 100644
--- a/draft/src/gewf/gewf.ecf
+++ b/draft/src/gewf/gewf.ecf
@@ -10,6 +10,7 @@
+
diff --git a/draft/src/gewf/src/gewf.e b/draft/src/gewf/src/gewf.e
index 41f04891..a5192539 100644
--- a/draft/src/gewf/src/gewf.e
+++ b/draft/src/gewf/src/gewf.e
@@ -18,6 +18,8 @@ feature {NONE} -- Initialization
args: ARGUMENTS_32
cfg: detachable READABLE_STRING_32
do
+ create setup.make
+
create args
if args.argument_count > 0 then
cfg := args.argument (1)
@@ -28,13 +30,11 @@ feature {NONE} -- Initialization
execute
end
-feature -- Status
+ setup: GEWF_SETUP
feature -- Access
config (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
- local
- l_keys: LIST [READABLE_STRING_GENERAL]
do
if attached {JSON_STRING} json_item (json, k) as js then
Result := js.unescaped_string_32
@@ -95,6 +95,9 @@ feature -- Access
create p.make_parser (s)
json := p.parse
+ if attached config ("gewf.template_dir") as d then
+ setup.set_template_dir_from_string (d)
+ end
end
json: detachable JSON_VALUE
@@ -141,8 +144,7 @@ feature -- Execution
p: PATH
appname: detachable READABLE_STRING_GENERAL
do
- create p.make_from_string ("template")
- p := p.extended (tpl)
+ p := setup.template_dir.extended (tpl)
appname := vals.item ("APPNAME")
if appname = Void then
appname := "_generated"
diff --git a/draft/src/gewf/src/gewf_setup.e b/draft/src/gewf/src/gewf_setup.e
new file mode 100644
index 00000000..829c3859
--- /dev/null
+++ b/draft/src/gewf/src/gewf_setup.e
@@ -0,0 +1,109 @@
+note
+ description: "[
+ Configuration of GEWF tool.
+ ]"
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ GEWF_SETUP
+
+inherit
+ SHARED_EXECUTION_ENVIRONMENT
+
+create
+ make
+
+feature -- Initialization
+
+ make
+
+ do
+ --| root_dir
+ get_root_dir
+
+ --| template_dir
+ get_template_dir
+
+ end
+
+ get_root_dir
+ local
+ ut: FILE_UTILITIES
+ p: detachable PATH
+ do
+ --| either $GEWF, or $HOME/.gewf or cwd/.gewf or cwd
+ if attached execution_environment.item ("GEWF") as s then
+ create p.make_from_string (s)
+ elseif attached execution_environment.item ("HOME") as s then
+ create p.make_from_string (s)
+ p := p.extended (".gewf")
+ create ut
+ if not ut.directory_path_exists (p) then
+ p := Void
+ end
+ end
+ if p = Void then
+ p := execution_environment.current_working_path
+ if ut.directory_path_exists (p.extended (".gewf")) then
+ p := p.extended (".gewf")
+ end
+ end
+ root_dir := p
+ end
+
+ get_template_dir
+ do
+ if attached execution_environment.item ("GEWF_TEMPLATE_DIR") as tpl_dir then
+ create template_dir.make_from_string (tpl_dir)
+ else
+ template_dir := root_dir.extended ("template")
+ end
+ end
+
+feature -- Access
+
+ root_dir: PATH
+
+ template_dir: PATH
+
+feature -- Status report
+
+ is_custom_template_dir: BOOLEAN
+
+ is_custom_root_dir: BOOLEAN
+
+feature -- Change
+
+ set_root_dir (p: PATH)
+ do
+ is_custom_root_dir := True
+ root_dir := p
+ if not is_custom_template_dir then
+ -- update template_dir
+ get_template_dir
+ end
+ end
+
+ set_template_dir_from_string (dn: READABLE_STRING_GENERAL)
+ do
+ set_template_dir (create {PATH} .make_from_string (dn))
+ end
+
+ set_template_dir (p: PATH)
+ do
+ is_custom_template_dir := True
+ template_dir := p
+ end
+
+;note
+ copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/draft/src/gewf/template/basic/launcher/any/application_launcher.e b/draft/src/gewf/template/basic/launcher/any/application_launcher.e
index 7182d350..7754546d 100644
--- a/draft/src/gewf/template/basic/launcher/any/application_launcher.e
+++ b/draft/src/gewf/template/basic/launcher/any/application_launcher.e
@@ -1,85 +1,18 @@
note
- description: "Summary description for {APPLICATION_LAUNCHER}."
- author: ""
+ description: "[
+ Effective class for APPLICATION_LAUNCHER_I
+
+ You can put modification in this class
+ ]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
-deferred class
+class
APPLICATION_LAUNCHER
-feature {NONE} -- Initialization
+inherit
+ APPLICATION_LAUNCHER_I
- launcher_nature: detachable READABLE_STRING_8
- -- Initialize the launcher nature
- -- either cgi, libfcgi, or nino.
- --| We could extend with more connector if needed.
- --| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
- local
- p: PATH
- l_entry_name: READABLE_STRING_32
- ext: detachable READABLE_STRING_32
- do
- create p.make_from_string (execution_environment.arguments.command_name)
- if attached p.entry as l_entry then
- ext := l_entry.extension
- end
- if ext /= Void then
- if ext.same_string (nature_nino) then
- Result := nature_nino
- end
- if ext.same_string (nature_cgi) then
- Result := nature_cgi
- end
- if ext.same_string (nature_libfcgi) or else ext.same_string ("fcgi") then
- Result := nature_libfcgi
- end
- end
- end
-
-feature {NONE} -- nino
-
- nature_nino: STRING = "nino"
-
- launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
- do
- create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
- end
-
-feature {NONE} -- cgi
-
- nature_cgi: STRING = "cgi"
-
- launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
- do
- create {WSF_CGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
- end
-
-feature {NONE} -- libfcgi
-
- nature_libfcgi: STRING = "libfcgi"
-
- launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
- do
- create {WSF_LIBFCGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
- end
-
-feature {NONE} -- Launcher
-
- launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
- local
- nature: like launcher_nature
- do
- nature := launcher_nature
- if nature = Void or else nature = nature_nino then
- launch_nino (a_service, opts)
- elseif nature = nature_cgi then
- launch_cgi (a_service, opts)
- elseif nature = nature_libfcgi then
- launch_libfcgi (a_service, opts)
- else
- -- bye bye
- (create {EXCEPTIONS}).die (-1)
- end
- end
+feature -- Custom
end
diff --git a/draft/src/gewf/template/basic/launcher/any/application_launcher_i.e b/draft/src/gewf/template/basic/launcher/any/application_launcher_i.e
new file mode 100644
index 00000000..60238588
--- /dev/null
+++ b/draft/src/gewf/template/basic/launcher/any/application_launcher_i.e
@@ -0,0 +1,101 @@
+note
+ description: "[
+ Specific application launcher
+
+ DO NOT EDIT THIS CLASS
+
+ you can customize APPLICATION_LAUNCHER
+ ]"
+ date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
+ revision: "$Revision: 36 $"
+
+deferred class
+ APPLICATION_LAUNCHER_I
+
+inherit
+ SHARED_EXECUTION_ENVIRONMENT
+
+feature -- Execution
+
+ launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ local
+ nature: like launcher_nature
+ do
+ nature := launcher_nature
+ if nature = Void or else nature = nature_nino then
+ launch_nino (a_service, opts)
+ elseif nature = nature_cgi then
+ launch_cgi (a_service, opts)
+ elseif nature = nature_libfcgi then
+ launch_libfcgi (a_service, opts)
+ else
+ -- bye bye
+ (create {EXCEPTIONS}).die (-1)
+ end
+ end
+
+feature {NONE} -- Access
+
+ launcher_nature: detachable READABLE_STRING_8
+ -- Initialize the launcher nature
+ -- either cgi, libfcgi, or nino.
+ --| We could extend with more connector if needed.
+ --| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
+ local
+ p: PATH
+ l_entry_name: READABLE_STRING_32
+ ext: detachable READABLE_STRING_32
+ do
+ create p.make_from_string (execution_environment.arguments.command_name)
+ if attached p.entry as l_entry then
+ ext := l_entry.extension
+ end
+ if ext /= Void then
+ if ext.same_string (nature_nino) then
+ Result := nature_nino
+ end
+ if ext.same_string (nature_cgi) then
+ Result := nature_cgi
+ end
+ if ext.same_string (nature_libfcgi) or else ext.same_string ("fcgi") then
+ Result := nature_libfcgi
+ end
+ end
+ end
+
+feature {NONE} -- nino
+
+ nature_nino: STRING = "nino"
+
+ launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ local
+ launcher: WSF_NINO_SERVICE_LAUNCHER
+ do
+ create launcher.make_and_launch (a_service, opts)
+ end
+
+feature {NONE} -- cgi
+
+ nature_cgi: STRING = "cgi"
+
+ launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ local
+ launcher: WSF_CGI_SERVICE_LAUNCHER
+ do
+ create launcher.make_and_launch (a_service, opts)
+ end
+
+feature {NONE} -- libfcgi
+
+ nature_libfcgi: STRING = "libfcgi"
+
+ launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ local
+ launcher: WSF_LIBFCGI_SERVICE_LAUNCHER
+ do
+ create launcher.make_and_launch (a_service, opts)
+ end
+
+
+end
+
diff --git a/draft/src/gewf/template/basic/launcher/default/application_launcher.e b/draft/src/gewf/template/basic/launcher/default/application_launcher.e
index e20b06ac..7754546d 100644
--- a/draft/src/gewf/template/basic/launcher/default/application_launcher.e
+++ b/draft/src/gewf/template/basic/launcher/default/application_launcher.e
@@ -1,19 +1,18 @@
note
- description: "Summary description for {APPLICATION}."
- author: ""
+ description: "[
+ Effective class for APPLICATION_LAUNCHER_I
+
+ You can put modification in this class
+ ]"
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
revision: "$Revision: 36 $"
-deferred class
+class
APPLICATION_LAUNCHER
-feature {NONE} -- Launcher
+inherit
+ APPLICATION_LAUNCHER_I
- launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
- local
- launcher: WSF_SERVICE_LAUNCHER
- do
- create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
- end
+feature -- Custom
end
diff --git a/draft/src/gewf/template/basic/launcher/default/application_launcher_i.e b/draft/src/gewf/template/basic/launcher/default/application_launcher_i.e
new file mode 100644
index 00000000..6110e4fa
--- /dev/null
+++ b/draft/src/gewf/template/basic/launcher/default/application_launcher_i.e
@@ -0,0 +1,25 @@
+note
+ description: "[
+ Specific application launcher
+
+ DO NOT EDIT THIS CLASS
+
+ you can customize APPLICATION_LAUNCHER
+ ]"
+ date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
+ revision: "$Revision: 36 $"
+
+deferred class
+ APPLICATION_LAUNCHER_I
+
+feature -- Execution
+
+ launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
+ local
+ launcher: WSF_SERVICE_LAUNCHER
+ do
+ create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
+ end
+
+end
+