moved wizard under tools/estudio_wizard

This commit is contained in:
2015-03-05 16:01:45 +01:00
parent b26504b4a1
commit f81e5251e8
64 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
class
EWF_CONSOLE_WIZARD_APPLICATION
inherit
CONSOLE_WIZARD_APPLICATION
SHARED_EXECUTION_ENVIRONMENT
create
make
feature {NONE} -- Initialization
make
-- Initialize `Current'.
do
initialize
on_start
end
feature {NONE} -- Initialization
new_wizard: EWF_WIZARD
do
create Result.make (Current)
end
end

View File

@@ -0,0 +1,210 @@
note
description: "Summary description for {EWF_WIZARD}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EWF_WIZARD
inherit
WIZARD
create
make
feature -- Access
title: STRING_32 = "Web Application Wizard"
feature -- Factory
wizard_generator : EWF_WIZARD_GENERATOR
do
create Result.make (Current)
end
feature -- Pages
first_page: WIZARD_PAGE
once
Result := new_page ("first")
Result.set_title ("Web Application Wizard")
Result.set_subtitle ("Based on the EWF libraries...")
Result.add_section_text ("Create Web server application with EWF.")
Result.add_text ("[
Using the Eiffel Web Framework (EWF), the generated application
will run on any platforms.
Depending on the connector(s), you may need to use a
third-party httpd server (such as apache, nginx, ...)
]")
end
project_page: WIZARD_PAGE
once
Result := new_page ("project")
Result.set_title ("Project Name and Project Location")
Result.set_subtitle ("You can choose the name of the project and%Nthe directory where the project will be generated.")
Result.add_text ("[
Please fill in:
The name of the project (without space).
The directory where you want the eiffel classes to be generated.
]")
Result.extend (Result.new_string_question ("Project name:", "name", "ASCII name, without space"))
Result.add_directory_question ("Project location:", "location", "Valid directory path, it will be created if missing")
Result.data.force ("ewf_app", "name")
Result.data.force (application.available_directory_path ("ewf_app", application.layout.default_projects_location.extended ("ewf")).name, "location")
Result.set_validation (agent (a_page: WIZARD_PAGE)
do
if
not attached a_page.data.item ("name") as l_name
or else l_name.is_whitespace
then
a_page.report_error ("Invalid value for `name'!")
end
if not a_page.data.has ("location") then
a_page.report_error ("Missing value for `location'!")
end
end)
end
connectors_page: WIZARD_PAGE
once
Result := new_page ("connectors")
Result.set_title ("Connectors selection")
Result.set_subtitle ("You can choose one or multiple connectors%Nto use as the same time.")
Result.add_text ("[
Web application runs on top of connectors
(i.e layer handling httpd incoming connections)
Select connectors you want to support:
]")
Result.add_boolean_question ("Standalone", "use_standalone", "Using the Eiffel Web nino server")
Result.add_boolean_question ("CGI", "use_cgi", "Require a httpd server")
Result.add_boolean_question ("libFCGI", "use_libfcgi", "Require a httpd server")
Result.data.force ("yes", "use_standalone")
Result.data.force ("yes", "use_cgi")
Result.data.force ("yes", "use_libfcgi")
end
standalone_connector_page: WIZARD_PAGE
once
Result := new_page ("standalone_connector")
Result.set_title ("Standalone (nino) connector")
Result.set_subtitle ("Set options .")
Result.add_integer_question ("Port number", "port", "It happens port 80 is already taken, thus choose another one.")
Result.add_boolean_question ("Verbose", "verbose", "Verbose output")
Result.data.force ("80", "port")
Result.data.force ("no", "verbose")
end
routers_page: WIZARD_PAGE
once
Result := new_page ("routers")
Result.set_title ("Use Router (URL dispatching)")
Result.set_subtitle ("Use the router component to easily map url patterns to handlers.")
Result.add_text ("[
Use the router component to easily map URL patterns to handlers:
]")
Result.add_boolean_question ("use the router component", "use_router", "Check generated code to see how to configure it.")
Result.data.force ("yes", "use_router")
end
final_page: WIZARD_PAGE
local
-- s,sv: STRING_32
-- l_settings: ARRAYED_LIST [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]
-- l_project_settings: STRING_32
-- l_ewf_settings: STRING_32
txt1, txt2: WIZARD_PAGE_TEXT_ITEM
once
Result := new_page ("final")
Result.set_title ("Completing the New Web Application Wizard")
Result.add_text ("You have specified the following settings:%N%N")
txt1 := Result.new_fixed_size_text_item ("...")
-- Result.add_fixed_size_text ("...", "projects_settings")
Result.extend (txt1)
txt2 := Result.new_fixed_size_text_item ("...")
-- Result.add_fixed_size_text ("...", "ewf_settings")
Result.extend (txt2)
Result.update_actions.extend (agent (a_page: WIZARD_PAGE; a_txt1, a_txt2: WIZARD_PAGE_TEXT_ITEM)
local
sv: STRING_32
l_settings: ARRAYED_LIST [TUPLE [title: READABLE_STRING_GENERAL; value: READABLE_STRING_GENERAL]]
do
-- Project
create l_settings.make (10)
if attached project_page.field_value ("name") as l_project_name then
l_settings.force (["Project name", l_project_name])
end
if attached project_page.field_value ("location") as l_project_location then
l_settings.force (["Location", l_project_location])
end
a_txt1.set_text (formatted_title_value_items (l_settings))
-- EWF
create l_settings.make (5)
create sv.make_empty
if connectors_page.boolean_field_value ("use_standalone") then
if not sv.is_empty then
sv.append (", ")
end
sv.append ("standalone")
end
if connectors_page.boolean_field_value ("use_cgi") then
if not sv.is_empty then
sv.append (", ")
end
sv.append ("cgi")
end
if connectors_page.boolean_field_value ("use_libfcgi") then
if not sv.is_empty then
sv.append (", ")
end
sv.append ("libfcgi")
end
l_settings.force (["Connectors", sv])
if routers_page.boolean_field_value ("use_router") then
l_settings.force (["Use Router", "yes"])
end
a_txt2.set_text (formatted_title_value_items (l_settings))
end(Result, txt1, txt2))
end
feature -- Events
next_page (a_current_page: detachable WIZARD_PAGE): WIZARD_PAGE
do
Result := notfound_page
if a_current_page = Void then
Result := first_page
elseif a_current_page = first_page then
Result := project_page
elseif a_current_page = project_page then
Result := connectors_page
elseif a_current_page = connectors_page then
if connectors_page.boolean_field_value ("use_standalone") then
Result := standalone_connector_page
else
Result := routers_page
end
elseif a_current_page = standalone_connector_page then
Result := routers_page
elseif a_current_page = routers_page then
Result := final_page
end
end
end

View File

@@ -0,0 +1,136 @@
note
description: "Summary description for {EWF_WIZARD_GENERATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EWF_WIZARD_GENERATOR
inherit
WIZARD_GENERATOR
redefine
copy_template
end
SHARED_TEMPLATE_CONTEXT
create
make
feature -- Query
collection: detachable WIZARD_DATA
feature -- Execution
execute (a_collection: WIZARD_DATA)
local
d: DIRECTORY
pdn, dn: PATH
tfn: PATH
res: WIZARD_SUCCEED_RESPONSE
-- k: STRING_32
do
collection := a_collection
if
attached a_collection.item ("project:name") as pn and
attached a_collection.item ("project:location") as l_loc
then
create pdn.make_from_string (l_loc)
variables.force (pn.as_lower, "APP_NAME")
variables.force (pn.as_upper, "APP_ROOT")
variables.force (new_uuid, "UUID")
variables.force ("none", "CONCURRENCY")
variables.force ("yes", "WIZ_YES")
variables.force ("no", "WIZ_NO")
dn := pdn
create d.make_with_path (dn)
if not d.exists then
d.recursive_create_dir
end
recursive_copy_templates (application.layout.resources_location, dn)
tfn := dn.extended (pn).appended_with_extension ("ecf")
create res.make (tfn, d.path)
send_response (res)
else
send_response (create {WIZARD_FAILED_RESPONSE})
end
end
feature -- Templates
smarty_template_extensions: ARRAY [READABLE_STRING_32]
once
Result := <<"e", "ecf", "ini">>
end
is_smarty_template_file (f: PATH): BOOLEAN
do
if attached f.extension as ext then
Result := across smarty_template_extensions as ext_ic some ext_ic.item.is_case_insensitive_equal_general (ext) end
end
end
is_template_file (f: PATH): BOOLEAN
do
Result := is_smarty_template_file (f)
end
copy_template (a_src: PATH; a_target: PATH)
do
if is_smarty_template_file (a_src) then
copy_smarty_template (a_src, a_target)
else
Precursor (a_src, a_target)
end
end
copy_smarty_template (a_res: PATH; a_target: PATH)
local
tpl: TEMPLATE_FILE
f,t: PLAIN_TEXT_FILE
inspectors: ARRAYED_LIST [TEMPLATE_INSPECTOR]
do
create f.make_with_path (a_res)
if f.exists and f.is_readable then
create tpl.make_from_file (f.path.name)
if attached collection as l_collection then
tpl.add_value (l_collection, "WIZ")
end
across
variables as ic
loop
tpl.add_value (ic.item, ic.key)
end
template_context.set_template_folder (application.layout.templates_location)
create inspectors.make (2)
inspectors.force (create {WIZARD_DATA_TEMPLATE_INSPECTOR}.register ({detachable WIZARD_DATA}))
inspectors.force (create {WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR}.register ({detachable WIZARD_PAGE_DATA}))
tpl.analyze
tpl.get_output
across
inspectors as ic
loop
ic.item.unregister
end
if attached tpl.output as l_output then
create t.make_with_path (a_target)
if not t.exists or else t.is_writable then
t.create_read_write
t.put_string (l_output)
t.close
end
else
copy_file (a_res, a_target)
end
end
end
end

View File

@@ -0,0 +1,46 @@
note
description: "[
Objects that ...
]"
author: "$Author$"
date: "$Date$"
revision: "$Revision$"
class
EWF_GRAPHICAL_WIZARD
inherit
EV_APPLICATION
SHARED_EXECUTION_ENVIRONMENT
undefine
default_create, copy
end
create
make_and_launch
feature {NONE} -- Initialization
make_and_launch
local
w: like main_window
cons: EWF_CONSOLE_WIZARD_APPLICATION
do
default_create
if execution_environment.arguments.index_of_word_option ("-console") > 0 then
create cons.make
else
create w
main_window := w
w.show
launch
end
end
feature {NONE} -- Implementation
main_window: detachable EWF_WIZARD_WINDOW
end

View File

@@ -0,0 +1,38 @@
note
description: "Summary description for {EWF_WIZARD_WINDOW}."
date: "$Date$"
revision: "$Revision$"
class
EWF_WIZARD_WINDOW
inherit
GRAPHICAL_WIZARD_WINDOW
redefine
side_bar_items
end
feature {NONE} -- Initialization
new_wizard: EWF_WIZARD
do
create Result.make (Current)
end
feature -- Access
side_bar_items (a_page: WIZARD_PAGE): ARRAYED_LIST [WIZARD_PAGE_ITEM]
local
lab: EV_LABEL
do
Result := Precursor (a_page)
if a_page.page_id.is_case_insensitive_equal_general ("first")
or a_page.page_id.is_case_insensitive_equal_general ("final")
then
create lab.make_with_text ("EWF")
lab.set_foreground_color (colors.white)
Result.extend (create {GRAPHICAL_WIZARD_PAGE_WIDGET}.make_with_widget (lab))
end
end
end

View File

@@ -0,0 +1,46 @@
note
description: "Summary description for {WIZARD_DATA_TEMPLATE_INSPECTOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_DATA_TEMPLATE_INSPECTOR
inherit
TEMPLATE_INSPECTOR
redefine
internal_data
end
create
register
feature {TEMPLATE_ROUTINES}
internal_data (field_name: STRING; obj: detachable ANY): detachable CELL [detachable ANY]
-- Return object in a cell
-- If not handled by this inspector, return Void
local
l_fn: STRING
utf: UTF_CONVERTER
do
if attached {WIZARD_DATA} obj as wiz then
l_fn := field_name.as_lower
if attached wiz.page_data (l_fn) as v then
Result := cell_of (v)
end
end
end
note
copyright: "2011-2014, Jocelyn Fiat, 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

View File

@@ -0,0 +1,45 @@
note
description: "Summary description for {WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WIZARD_PAGE_DATA_TEMPLATE_INSPECTOR
inherit
TEMPLATE_INSPECTOR
redefine
internal_data
end
create
register
feature {TEMPLATE_ROUTINES}
internal_data (field_name: STRING; obj: detachable ANY): detachable CELL [detachable ANY]
-- Return object in a cell
-- If not handled by this inspector, return Void
local
l_fn: STRING
do
if attached {WIZARD_PAGE_DATA} obj as pg then
l_fn := field_name.as_lower
if attached pg.item (l_fn) as v then
Result := cell_of (v)
end
end
end
note
copyright: "2011-2014, Jocelyn Fiat, 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