CapicuaGenGaspar 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +49 -0
  6. data/CapicuaGenGaspar.gemspec +60 -0
  7. data/Gemfile +4 -0
  8. data/Gemfile.lock +33 -0
  9. data/LICENSE +165 -0
  10. data/README.md +41 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/lib/CapicuaGenGaspar/Business/CSSqlEntitityInterface/Source/cs_sql_entity_interface_feature.rb +96 -0
  15. data/lib/CapicuaGenGaspar/Business/CSSqlEntitityInterface/Template/table_interface.erb +49 -0
  16. data/lib/CapicuaGenGaspar/Business/CSSqlEntity/Source/cs_sql_entity_feature.rb +103 -0
  17. data/lib/CapicuaGenGaspar/Business/CSSqlEntity/Template/table_entity.erb +51 -0
  18. data/lib/CapicuaGenGaspar/CodeTransformer/CSHeaderFooter/Source/cs_header_footer_feature.rb +148 -0
  19. data/lib/CapicuaGenGaspar/CodeTransformer/CSHeaderFooter/Template/footer.erb +37 -0
  20. data/lib/CapicuaGenGaspar/CodeTransformer/CSHeaderFooter/Template/header.erb +43 -0
  21. data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/EnvDTE.dll +0 -0
  22. data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/EnvDTE80.dll +0 -0
  23. data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/RunCodeMaidCleaner.exe +0 -0
  24. data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/RunCodeMaidCleaner.exe.config +52 -0
  25. data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Bin/stdole.dll +0 -0
  26. data/lib/CapicuaGenGaspar/CodeTransformer/CodeMaidCleaner/Source/code_maid_cleaner_feature.rb +162 -0
  27. data/lib/CapicuaGenGaspar/DataAccess/CSConnectionProvider/Source/cs_db_connection_provider_feature.rb +90 -0
  28. data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Source/cs_sql_data_access_feature.rb +106 -0
  29. data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Template/data_access.erb +154 -0
  30. data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Template/data_access_exception.erb +36 -0
  31. data/lib/CapicuaGenGaspar/DataAccess/CSSqlDataAccess/Template/data_access_table.erb +298 -0
  32. data/lib/CapicuaGenGaspar/Entities/CSEntity/Source/entity_field_schema.rb +100 -0
  33. data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Source/cs_about_windows_form_feature.rb +85 -0
  34. data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Template/AboutForm.designer.erb +211 -0
  35. data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Template/AboutForm.erb +127 -0
  36. data/lib/CapicuaGenGaspar/GUI/CSAboutWindowsForm/Template/AboutForm.resx.erb +535 -0
  37. data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Source/cs_catalog_windows_form_feature.rb +146 -0
  38. data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogForm.Designer.erb +363 -0
  39. data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogForm.erb +320 -0
  40. data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogForm.resx.erb +2407 -0
  41. data/lib/CapicuaGenGaspar/GUI/CSCatalogWindowsForm/Template/CatalogState.erb +51 -0
  42. data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Source/cs_mdi_windows_form_feature.rb +93 -0
  43. data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MainForm.Designer.erb +316 -0
  44. data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MainForm.erb +161 -0
  45. data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MainForm.resx.erb +2504 -0
  46. data/lib/CapicuaGenGaspar/GUI/CSMDIWindowsForm/Template/MsgboxConsts.erb +31 -0
  47. data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Source/cs_splash_windows_feature.rb +87 -0
  48. data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Template/SplashForm.designer.erb +141 -0
  49. data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Template/SplashForm.erb +160 -0
  50. data/lib/CapicuaGenGaspar/GUI/CSSplashWindowsForm/Template/SplashForm.resx.erb +535 -0
  51. data/lib/CapicuaGenGaspar/Mixins/about_mixin.rb +55 -0
  52. data/lib/CapicuaGenGaspar/Mixins/catalog_mixin.rb +65 -0
  53. data/lib/CapicuaGenGaspar/Mixins/cs_app_config_mixin.rb +41 -0
  54. data/lib/CapicuaGenGaspar/Mixins/cs_db_connection_provider_mixin.rb +67 -0
  55. data/lib/CapicuaGenGaspar/Mixins/cs_namespace_mixin.rb +53 -0
  56. data/lib/CapicuaGenGaspar/Mixins/entity_interface_mixin.rb +57 -0
  57. data/lib/CapicuaGenGaspar/Mixins/entity_mixin.rb +58 -0
  58. data/lib/CapicuaGenGaspar/Mixins/entity_sql_table_mixin.rb +58 -0
  59. data/lib/CapicuaGenGaspar/Mixins/main_form_mixin.rb +55 -0
  60. data/lib/CapicuaGenGaspar/Mixins/splash_mixin.rb +54 -0
  61. data/lib/CapicuaGenGaspar/Proyect/CSProyect/Source/cs_proyect_feature.rb +140 -0
  62. data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Source/cs_proyect_rest_ful_feature.rb +82 -0
  63. data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/AssemblyInfo.erb +59 -0
  64. data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/ExcepcionControlada.erb +38 -0
  65. data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/Proyect.erb +114 -0
  66. data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/Soluction.erb +54 -0
  67. data/lib/CapicuaGenGaspar/Proyect/CSProyectRESTFul/Template/Web.erb +66 -0
  68. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Source/cs_proyect_windows_form_feature.rb +85 -0
  69. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/App.erb +32 -0
  70. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/AssemblyInfo.erb +59 -0
  71. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/ControlExcepciones.erb +49 -0
  72. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/ExcepcionControlada.erb +40 -0
  73. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/Program.erb +46 -0
  74. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/Proyect.erb +138 -0
  75. data/lib/CapicuaGenGaspar/Proyect/CSProyectWindowsForm/Template/Soluction.erb +55 -0
  76. data/lib/CapicuaGenGaspar/Tools/message_helper.rb +43 -0
  77. data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Source/cs_rest_ful_catalog_feature.rb +176 -0
  78. data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/CatalogState.erb +51 -0
  79. data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/Catalogs.erb +58 -0
  80. data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/Catalogs.svc.erb +24 -0
  81. data/lib/CapicuaGenGaspar/WCFService/CSRESTFulCatalog/Template/ICatalogs.erb +58 -0
  82. data/lib/CapicuaGenGaspar/gaspar.rb +44 -0
  83. data/lib/CapicuaGenGaspar/version.rb +3 -0
  84. metadata +216 -0
@@ -0,0 +1,51 @@
1
+ <%
2
+ #encoding: UTF-8
3
+
4
+ =begin
5
+
6
+ CapicuaGen
7
+
8
+ CapicuaGen es un software que ayuda a la creación automática de
9
+ sistemas empresariales a través de la definición y ensamblado de
10
+ diversos generadores de características.
11
+
12
+ El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
13
+ del 2016.
14
+
15
+ Puede modificar y distribuir este software, según le plazca, y usarlo
16
+ para cualquier fin ya sea comercial, personal, educativo, o de cualquier
17
+ índole, siempre y cuando incluya este mensaje, y se permita acceso el
18
+ código fuente.
19
+
20
+ Este software es código libre, y se licencia bajo LGPL.
21
+
22
+ Para más información consultar http://www.gnu.org/licenses/lgpl.html
23
+ =end
24
+ %>using System;
25
+ using System.Configuration;
26
+ using System.Data;
27
+ using System.Data.Common;
28
+ using System.Text;
29
+ using System.Collections.Generic;
30
+ <%=get_namespaces_text(:business_interfaces) %>
31
+
32
+ namespace <%=generation_attributes[:namespace]%>
33
+ {
34
+
35
+ /// <summary>
36
+ /// Entidad de <%=template_target.class_name%>
37
+ /// </summary>
38
+ <%="#{template_target.class_accessor} "%>partial class <%=template_target.class_name%> : I<%=template_target.class_name%>
39
+ {
40
+ <%template_target.entity_schema.fields.each { |field| %>
41
+ /// <summary>
42
+ /// Nombre: <%=field.name%>
43
+ /// Tipo: <%=field.type%>
44
+ /// Permite Nulos: <%=field.allow_null%>
45
+ /// Valor por Defecto: <%=field.default_value%>
46
+ /// Llave Primaria: <%=field.primary_key%>
47
+ /// </summary>
48
+ public <%=field.net_type%> <%=field.name%> { get; set; }
49
+ <%}%>
50
+ }
51
+ }
@@ -0,0 +1,148 @@
1
+ =begin
2
+
3
+ CapicuaGen
4
+
5
+ CapicuaGen es un software que ayuda a la creación automática de
6
+ sistemas empresariales a través de la definición y ensamblado de
7
+ diversos generadores de características.
8
+
9
+ El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
10
+ del 2016.
11
+
12
+ Puede modificar y distribuir este software, según le plazca, y usarlo
13
+ para cualquier fin ya sea comercial, personal, educativo, o de cualquier
14
+ índole, siempre y cuando incluya este mensaje, y se permita acceso el
15
+ código fuente.
16
+
17
+ Este software es código libre, y se licencia bajo LGPL.
18
+
19
+ Para más información consultar http://www.gnu.org/licenses/lgpl.html
20
+ =end
21
+
22
+ require 'active_support/core_ext/object/blank'
23
+
24
+
25
+ require_relative '../../../gaspar'
26
+ require_relative '../../../Mixins/cs_db_connection_provider_mixin'
27
+ require_relative '../../../Mixins/cs_namespace_mixin'
28
+ require_relative '../../../Mixins/entity_interface_mixin'
29
+ require_relative '../../../Mixins/entity_sql_table_mixin'
30
+
31
+ module CapicuaGen::Gaspar
32
+
33
+ # Caracteristica generadora de caceberas y pies de pagina
34
+ # en el codigo fuente generado por otras caracteristicas
35
+ class CSHeaderFooterFeature < CapicuaGen::TemplateFeature
36
+ include CapicuaGen
37
+ include CapicuaGen::Gaspar
38
+
39
+ attr_accessor :include_regex, :exclude_regex
40
+
41
+ public
42
+
43
+ # Inicializa la caracteristica
44
+ def initialize(values= {})
45
+ super(values)
46
+
47
+ # Configuro los tipos si estos no han sido configurados previamente
48
+ self.types= [:code_transformer] if self.types.blank?
49
+
50
+ # Configuro los templates
51
+ set_template("header", Template.new(:file => 'header.erb'))
52
+ set_template("footer", Template.new(:file => 'footer.erb'))
53
+
54
+ #Configuro los include y exclude
55
+ @include_regex= [/\.cs$/i] unless @include_regex
56
+ @exclude_regex= [/\.Designer\.cs$/i] unless @exclude_regex
57
+
58
+
59
+ end
60
+
61
+ # Configura los objetivos de las platillas (despues de establecer el generador)
62
+ def configure_template_targets
63
+
64
+ # Configuro los templates
65
+ @header_template_target= set_template_target('header', TemplateTarget.new())
66
+ @footer_template_target= set_template_target('footer', TemplateTarget.new())
67
+
68
+ end
69
+
70
+ # Recorre las plantilla y genera las cabeceras
71
+ def generate
72
+ message_helper.puts_generating_feature(self)
73
+
74
+ message_helper.add_indent
75
+
76
+ begin
77
+
78
+
79
+ resultado= ''
80
+
81
+ template_target= get_template_target_by_name('proyect')
82
+
83
+ directory_base= self.generation_attributes[:out_dir]
84
+ # Recorro todas las caracteristicas
85
+ generator.features().each do |feature|
86
+ #Obtengo todos los archivos asociados
87
+ feature.get_relative_out_files(:directory_base => directory_base, :types => :proyect_file).each do |unix_path|
88
+
89
+ # Nombre del archivo
90
+ file = unix_path.gsub(/\//, '\\')
91
+ file_name= File.basename file
92
+
93
+ next unless check_include(file)
94
+
95
+ file_content= ''
96
+
97
+ Dir.chdir directory_base do
98
+ # Cargo el acrhivo
99
+ file_content= File.read(file)
100
+ end
101
+
102
+
103
+ # Genero los las licencias
104
+ header= generate_template_target(@header_template_target, binding)
105
+ return if not header.blank? and file_content.include?(header)
106
+ footer= generate_template_target(@footer_template_target, binding)
107
+ return if not footer.blank? and file_content.include?(footer)
108
+
109
+ file_out= "#{header}#{file_content}#{footer}"
110
+ Dir.chdir directory_base do
111
+ # Guardo el archivo
112
+ File.write(file, file_out)
113
+ message_helper.puts_created_template("header.erb, footer.erb", file, :override)
114
+ end
115
+ end
116
+
117
+ end
118
+
119
+ ensure
120
+ message_helper.remove_indent
121
+ puts
122
+
123
+ end
124
+
125
+ end
126
+
127
+ # Revisa si un archivo debe ser incluido
128
+ def check_include(file)
129
+ return false if @include_regex.blank?
130
+
131
+ @include_regex.each do |include|
132
+ return false unless include.match(file)
133
+ end
134
+
135
+ return true if @exclude_regex.blank?
136
+
137
+ @exclude_regex.each do |exclude|
138
+ return false if exclude.match(file)
139
+ end
140
+
141
+ return true
142
+
143
+ end
144
+ end
145
+
146
+ end
147
+
148
+
@@ -0,0 +1,37 @@
1
+ <%
2
+ #encoding: UTF-8
3
+
4
+ =begin
5
+
6
+ CapicuaGen
7
+
8
+ CapicuaGen es un software que ayuda a la creación automática de
9
+ sistemas empresariales a través de la definición y ensamblado de
10
+ diversos generadores de características.
11
+
12
+ El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
13
+ del 2016.
14
+
15
+ Puede modificar y distribuir este software, según le plazca, y usarlo
16
+ para cualquier fin ya sea comercial, personal, educativo, o de cualquier
17
+ índole, siempre y cuando incluya este mensaje, y se permita acceso el
18
+ código fuente.
19
+
20
+ Este software es código libre, y se licencia bajo LGPL.
21
+
22
+ Para más información consultar http://www.gnu.org/licenses/lgpl.html
23
+ =end
24
+ %>
25
+
26
+ /*
27
+ * -------------------------------------------------------------------------
28
+ * Archivo <%=file_name%>
29
+ * -------------------------------------------------------------------------
30
+ * Generado automaticamente con CapicuaGen,
31
+ *
32
+ * Puede cambiar este pie de pagina haciendo un checkout de los templates de
33
+ * la caracteristica, y modificando el template 'footer.erb'.
34
+ *
35
+ * capicuagen.rb checkout CapicuaGenGaspar/CSHeaderFooter/template
36
+ *
37
+ */
@@ -0,0 +1,43 @@
1
+ <%
2
+ #encoding: UTF-8
3
+
4
+ =begin
5
+
6
+ CapicuaGen
7
+
8
+ CapicuaGen es un software que ayuda a la creación automática de
9
+ sistemas empresariales a través de la definición y ensamblado de
10
+ diversos generadores de características.
11
+
12
+ El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
13
+ del 2016.
14
+
15
+ Puede modificar y distribuir este software, según le plazca, y usarlo
16
+ para cualquier fin ya sea comercial, personal, educativo, o de cualquier
17
+ índole, siempre y cuando incluya este mensaje, y se permita acceso el
18
+ código fuente.
19
+
20
+ Este software es código libre, y se licencia bajo LGPL.
21
+
22
+ Para más información consultar http://www.gnu.org/licenses/lgpl.html
23
+ =end
24
+ %>/*
25
+ * -------------------------------------------------------------------------
26
+ * Archivo <%=file_name%>
27
+ * -------------------------------------------------------------------------
28
+ * Generado automaticamente con CapicuaGen,
29
+ *
30
+ * CapicuaGen es un software que ayuda a la creación automática de
31
+ * sistemas empresariales a través de la definición y ensamblado de
32
+ * diversos generadores de características.
33
+ *
34
+ * El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
35
+ * del 2016.
36
+ *
37
+ * Puede cambiar este encabezado haciendo un checkout de los templates de
38
+ * la caracteristica, y modificando el template 'header.erb'.
39
+ *
40
+ * capicuagen.rb checkout CapicuaGenGaspar/CSHeaderFooter/template
41
+ *
42
+ */
43
+
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!--
3
+ /*
4
+ * RunCodeMaidCleaner
5
+ *
6
+ * RunCodeMaidCleaner es un software que permite ejecutar la opción "Cleanup"
7
+ * de la extesión de Visual Studio "CodeMaid", desde la linea de comandos
8
+ * con lo que es posible ejecutarlo dentro de procesos bath de generación de
9
+ * codigo.
10
+ *
11
+ * El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
12
+ * del 2016.
13
+ *
14
+ * Puede modificar y distribuir este software, según le plazca, y usarlo
15
+ * para cualquier fin ya sea comercial, personal, educativo, o de cualquier
16
+ * índole, siempre y cuando incluya este mensaje, y se permita acceso el
17
+ * código fuente.
18
+ *
19
+ * Este software es código libre, y se licencia bajo LGPL.
20
+ *
21
+ * Para más información consultar http://www.gnu.org/licenses/lgpl.html
22
+ */
23
+ -->
24
+ <configuration>
25
+ <configSections>
26
+ <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
27
+ <section name="RunCodeMaidCleaner.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
28
+ </sectionGroup>
29
+ </configSections>
30
+ <startup>
31
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.3" />
32
+ </startup>
33
+ <applicationSettings>
34
+ <RunCodeMaidCleaner.Properties.Settings>
35
+ <setting name="VisualStudio" serializeAs="String">
36
+ <value>VisualStudio.Solution.12.0</value>
37
+ </setting>
38
+ <setting name="GuidCodeMaidCommandCleanupActiveCodeString" serializeAs="String">
39
+ <value>36de540f-25cb-4151-957f-d63a5a3a10a7</value>
40
+ </setting>
41
+ <setting name="CmdIDCodeMaidCleanupActiveCode" serializeAs="String">
42
+ <value>4608</value>
43
+ </setting>
44
+ <setting name="GuidCodeMaidCommandCleanupAllCodeString" serializeAs="String">
45
+ <value>eb2efdb6-2efe-405c-94af-383d36ad58dd</value>
46
+ </setting>
47
+ <setting name="CmdIDCodeMaidCleanupAllCode" serializeAs="String">
48
+ <value>4864</value>
49
+ </setting>
50
+ </RunCodeMaidCleaner.Properties.Settings>
51
+ </applicationSettings>
52
+ </configuration>
@@ -0,0 +1,162 @@
1
+ =begin
2
+
3
+ CapicuaGen
4
+
5
+ CapicuaGen es un software que ayuda a la creación automática de
6
+ sistemas empresariales a través de la definición y ensamblado de
7
+ diversos generadores de características.
8
+
9
+ El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
10
+ del 2016.
11
+
12
+ Puede modificar y distribuir este software, según le plazca, y usarlo
13
+ para cualquier fin ya sea comercial, personal, educativo, o de cualquier
14
+ índole, siempre y cuando incluya este mensaje, y se permita acceso el
15
+ código fuente.
16
+
17
+ Este software es código libre, y se licencia bajo LGPL.
18
+
19
+ Para más información consultar http://www.gnu.org/licenses/lgpl.html
20
+ =end
21
+
22
+
23
+ =begin
24
+ Este clase se comunica con la extensiòn CodeMaid de Visual Stuido,
25
+ para formatear y limpiar la salida del codigo fuente
26
+ para mas informaciòn visistar la pagina del producto
27
+
28
+ http://www.codemaid.net/
29
+
30
+ =end
31
+
32
+ require 'nokogiri'
33
+ require 'tempfile'
34
+
35
+ require_relative '../../../gaspar'
36
+ require 'active_support/core_ext/object/blank'
37
+ require_relative '../../../Mixins/cs_app_config_mixin'
38
+
39
+
40
+ module CapicuaGen::Gaspar
41
+ # Caracteristica generadora para limpiar y formatear el codigo generado
42
+ # a traves de la herramienta CodeMaid (Extesion de Visual Studio)
43
+ class CodeMaidCleanerFeature < CapicuaGen::Feature
44
+ include CapicuaGen
45
+ include CapicuaGen::Gaspar
46
+
47
+ attr_accessor :bin_directories, :target_feature_types
48
+
49
+ BINARY= "RunCodeMaidCleaner.exe"
50
+
51
+ public
52
+
53
+ # Inicializa la caracteristica
54
+ def initialize(values= {})
55
+ super(values)
56
+
57
+
58
+ # Configuro los tipos si estos no han sido configurados previamente
59
+ self.types = [:transformer] if self.types.blank?
60
+
61
+ @target_feature_types= [:soluction] if @target_feature_types.blank?
62
+
63
+
64
+ @bin_directories = [] if self.bin_directories.blank?
65
+ @bin_directories << File.join(File.dirname(__FILE__), '../bin')
66
+
67
+
68
+ end
69
+
70
+
71
+ # Genera las cabeceras y pie de paginas
72
+ def generate
73
+ super()
74
+
75
+
76
+ message_helper.add_indent
77
+
78
+ begin
79
+
80
+ directory_base= self.generation_attributes[:out_dir]
81
+ binary_file = find_binary
82
+ parameters = ' /mo'
83
+ files = []
84
+
85
+
86
+ # Recorro todas las caracteristicas
87
+ generator.features.each do |feature|
88
+
89
+ return unless feature.respond_to?('get_relative_out_files')
90
+
91
+ #Obtengo todos los archivos asociados
92
+ feature.get_relative_out_files(:directory_base => directory_base).each do |unix_path|
93
+
94
+ file= unix_path.gsub(/\//, '\\')
95
+ Dir.chdir directory_base do
96
+ file= File.absolute_path(file)
97
+ end
98
+ extension= File.extname(file).downcase
99
+
100
+ case extension
101
+ when '.sln'
102
+ parameters<<" /s \"#{file}\""
103
+ when '.csproj'
104
+ parameters<<" /p \"#{file}\"" if @target_feature_types.include?(:proyect)
105
+ else
106
+
107
+ Dir.chdir directory_base do
108
+ #Compruebo si debe ser includo
109
+ stat=File::Stat.new(unix_path)
110
+ if (stat.mtime > self.generator.start_time)
111
+ file= File.basename(unix_path)
112
+ files<<file
113
+ end
114
+ end
115
+ end
116
+
117
+ end
118
+ end
119
+
120
+ Dir.chdir directory_base do
121
+ #Guardo el archivo de directorio
122
+ file= Tempfile.new('files')
123
+
124
+ begin
125
+ file.write(files.join($/))
126
+ file.close
127
+ file_path= file.path.gsub /\//, '\\'
128
+
129
+ parameters<<" /f #{file_path}"
130
+
131
+ #Ejecuto el programa
132
+ IO.popen("\"#{binary_file}\" #{parameters}").each do |line|
133
+ message_helper.puts_code_clean(line.chomp)
134
+ end
135
+
136
+
137
+ ensure
138
+ file.close
139
+ file.unlink # deletes the temp file
140
+ end
141
+
142
+
143
+ end
144
+ ensure
145
+ message_helper.remove_indent
146
+ puts
147
+ end
148
+
149
+ end
150
+
151
+ def find_binary
152
+ bin_directories.each do |bin|
153
+ current_path= File.join(bin, BINARY)
154
+ return current_path if File.exist?(current_path)
155
+ end
156
+
157
+ end
158
+ end
159
+ end
160
+
161
+
162
+
@@ -0,0 +1,90 @@
1
+ =begin
2
+
3
+ CapicuaGen
4
+
5
+ CapicuaGen es un software que ayuda a la creación automática de
6
+ sistemas empresariales a través de la definición y ensamblado de
7
+ diversos generadores de características.
8
+
9
+ El proyecto fue iniciado por José Luis Bautista Martin, el 6 de enero
10
+ del 2016.
11
+
12
+ Puede modificar y distribuir este software, según le plazca, y usarlo
13
+ para cualquier fin ya sea comercial, personal, educativo, o de cualquier
14
+ índole, siempre y cuando incluya este mensaje, y se permita acceso el
15
+ código fuente.
16
+
17
+ Este software es código libre, y se licencia bajo LGPL.
18
+
19
+ Para más información consultar http://www.gnu.org/licenses/lgpl.html
20
+ =end
21
+
22
+
23
+ require 'active_support/core_ext/object/blank'
24
+ require 'nokogiri'
25
+
26
+ require_relative '../../../gaspar'
27
+ require_relative '../../../Mixins/cs_app_config_mixin'
28
+
29
+ module CapicuaGen::Gaspar
30
+ # Caracteristica generadora que devuelve un metodo
31
+ # para configurar una cadena de conexion dentro del codigo generado
32
+ class CSDBConnectionProviderFeature < CapicuaGen::Feature
33
+ include CapicuaGen
34
+ include CapicuaGen::Gaspar
35
+
36
+
37
+ public
38
+
39
+ # Inicializa la caracteristica
40
+ def initialize(values= {})
41
+ super(values)
42
+
43
+ # Configuro los tipos si estos no han sido configurados previamente
44
+ self.types= [:data_connection_provider, :transformer] if self.types.blank?
45
+
46
+ end
47
+
48
+
49
+ # Devuelve el metodo que genera el proveedor de conexion
50
+ def get_db_connection_provider_method
51
+ return "DbProviderFactories.GetFactory(ConfigurationManager.ConnectionStrings[\"#{generation_attributes[:app_config_db_connection_name]}\"].ProviderName)"
52
+ end
53
+
54
+ def get_db_connection_name_method
55
+ return "\"#{generation_attributes[:app_config_db_connection_name]}\""
56
+ end
57
+
58
+ # Devuelve la cadena de conexión
59
+ def get_db_connection_string_method
60
+ return "ConfigurationManager.ConnectionStrings[\"#{generation_attributes[:app_config_db_connection_name]}\"].ConnectionString"
61
+ end
62
+
63
+ # Modifica el archivo App.Config para que contenga la cadena de conexión a la base de datos
64
+ def generate
65
+
66
+ # Ruta para conseguir el archivo app.config
67
+ xml= Nokogiri::XML(File.read(get_app_config_file))
68
+ xpath= "connectionStrings/add[@name= '#{generation_attributes[:app_config_db_connection_name]}']"
69
+
70
+ # Recupero el nodo
71
+ node= XMLHelper.get_node_from_xml_document(xml, xpath)
72
+
73
+ # Configuro el nodo
74
+ node['name']= generation_attributes[:app_config_db_connection_name]
75
+ node['connectionString']= generation_attributes[:app_config_db_connection_string]
76
+ node['providerName']= generation_attributes[:app_config_db_connection_provider]
77
+
78
+ # Formateo el texto
79
+ formatted_xml= XMLHelper.format(xml.to_xml)
80
+
81
+ # Guardo el resultado
82
+ File.write(get_app_config_file,formatted_xml)
83
+
84
+ end
85
+
86
+ end
87
+ end
88
+
89
+
90
+