Module: Msip
- Defined in:
- lib/msip.rb,
lib/msip/engine.rb,
lib/msip/version.rb,
app/models/msip/pais.rb,
app/models/msip/tema.rb,
app/models/msip/anexo.rb,
app/models/msip/etnia.rb,
app/models/msip/grupo.rb,
app/models/msip/basica.rb,
app/models/msip/modelo.rb,
app/models/msip/mundep.rb,
app/models/msip/tsitio.rb,
app/models/msip/vereda.rb,
app/models/msip/ability.rb,
app/models/msip/oficina.rb,
app/models/msip/persona.rb,
app/models/msip/tipoorg.rb,
app/models/msip/usuario.rb,
app/models/msip/bitacora.rb,
app/models/msip/etiqueta.rb,
app/models/msip/grupoper.rb,
app/models/msip/estadosol.rb,
app/models/msip/municipio.rb,
app/models/msip/orgsocial.rb,
app/models/msip/solicitud.rb,
app/models/msip/trelacion.rb,
app/models/msip/ubicacion.rb,
app/models/msip/respaldo7z.rb,
app/models/msip/tdocumento.rb,
app/models/msip/trivalente.rb,
app/helpers/msip/sql_helper.rb,
app/models/msip/departamento.rb,
app/models/msip/fuenteprensa.rb,
app/models/msip/localizacion.rb,
app/models/msip/ubicacionpre.rb,
app/helpers/msip/temas_helper.rb,
app/models/msip/centropoblado.rb,
app/models/msip/grupo_usuario.rb,
lib/msip/concerns/models/pais.rb,
lib/msip/concerns/models/tema.rb,
app/helpers/msip/modelo_helper.rb,
app/models/msip/tcentropoblado.rb,
lib/msip/concerns/models/anexo.rb,
lib/msip/concerns/models/etnia.rb,
lib/msip/concerns/models/grupo.rb,
app/helpers/msip/importa_helper.rb,
app/models/msip/perfilorgsocial.rb,
app/models/msip/sectororgsocial.rb,
lib/msip/accesores_ubicacionpre.rb,
lib/msip/concerns/models/tsitio.rb,
lib/msip/concerns/models/vereda.rb,
app/helpers/msip/capybara_helper.rb,
app/helpers/msip/internet_helper.rb,
app/helpers/msip/localiza_helper.rb,
app/helpers/msip/procesos_helper.rb,
app/models/msip/etiqueta_persona.rb,
app/models/msip/unificarpersonas.rb,
lib/msip/concerns/models/oficina.rb,
lib/msip/concerns/models/persona.rb,
lib/msip/concerns/models/tipoorg.rb,
lib/msip/concerns/models/usuario.rb,
app/helpers/msip/bootstrap_helper.rb,
app/helpers/msip/edad_sexo_helper.rb,
app/helpers/msip/ubicacion_helper.rb,
app/models/msip/orgsocial_persona.rb,
app/models/msip/pais_histvigencia.rb,
app/models/msip/persona_trelacion.rb,
lib/msip/concerns/models/bitacora.rb,
lib/msip/concerns/models/etiqueta.rb,
lib/msip/concerns/models/grupoper.rb,
app/helpers/msip/tareasrake_helper.rb,
app/models/msip/etiqueta_municipio.rb,
lib/msip/concerns/models/estadosol.rb,
lib/msip/concerns/models/municipio.rb,
lib/msip/concerns/models/orgsocial.rb,
lib/msip/concerns/models/solicitud.rb,
lib/msip/concerns/models/trelacion.rb,
lib/msip/concerns/models/ubicacion.rb,
app/helpers/msip/application_helper.rb,
app/helpers/msip/fontawesome_helper.rb,
lib/msip/concerns/models/respaldo7z.rb,
lib/msip/concerns/models/tdocumento.rb,
lib/msip/concerns/models/trivalente.rb,
lib/generators/msip/modelo_generator.rb,
app/controllers/msip/hogar_controller.rb,
app/helpers/msip/formato_fecha_helper.rb,
lib/msip/concerns/models/departamento.rb,
lib/msip/concerns/models/fuenteprensa.rb,
lib/msip/concerns/models/ubicacionpre.rb,
app/controllers/msip/anexos_controller.rb,
app/models/msip/municipio_histvigencia.rb,
lib/msip/concerns/models/centropoblado.rb,
lib/msip/concerns/models/grupo_usuario.rb,
app/controllers/msip/modelos_controller.rb,
app/helpers/msip/paginacion_ajax_helper.rb,
lib/msip/concerns/models/tcentropoblado.rb,
app/controllers/msip/personas_controller.rb,
lib/msip/concerns/models/perfilorgsocial.rb,
lib/msip/concerns/models/sectororgsocial.rb,
app/controllers/msip/bitacoras_controller.rb,
app/controllers/msip/gruposper_controller.rb,
app/models/msip/departamento_histvigencia.rb,
app/models/msip/orgsocial_sectororgsocial.rb,
lib/generators/msip/tablabasica_generator.rb,
lib/msip/concerns/models/etiqueta_persona.rb,
app/controllers/msip/admin/basicas_helpers.rb,
app/controllers/msip/respaldo7z_controller.rb,
app/models/msip/centropoblado_histvigencia.rb,
app/models/msip/solicitud_usuarionotificar.rb,
lib/generators/msip/asociabasica_generator.rb,
lib/msip/concerns/models/orgsocial_persona.rb,
lib/msip/concerns/models/pais_histvigencia.rb,
lib/msip/concerns/models/persona_trelacion.rb,
app/controllers/msip/admin/temas_controller.rb,
app/controllers/msip/application_controller.rb,
app/controllers/msip/orgsociales_controller.rb,
app/controllers/msip/solicitudes_controller.rb,
app/controllers/msip/ubicaciones_controller.rb,
lib/msip/concerns/models/etiqueta_municipio.rb,
app/controllers/msip/admin/etnias_controller.rb,
app/controllers/msip/admin/grupos_controller.rb,
app/controllers/msip/admin/paises_controller.rb,
app/controllers/msip/admin/basicas_controller.rb,
app/controllers/msip/admin/tsitios_controller.rb,
app/controllers/msip/admin/veredas_controller.rb,
app/controllers/msip/admin/oficinas_controller.rb,
app/controllers/msip/admin/tiposorg_controller.rb,
lib/msip/concerns/controllers/hogar_controller.rb,
lib/msip/concerns/controllers/temas_controller.rb,
app/controllers/msip/admin/etiquetas_controller.rb,
lib/msip/concerns/controllers/anexos_controller.rb,
lib/msip/concerns/controllers/etnias_controller.rb,
lib/msip/concerns/controllers/grupos_controller.rb,
lib/msip/concerns/controllers/paises_controller.rb,
lib/msip/concerns/models/municipio_histvigencia.rb,
app/controllers/msip/admin/estadossol_controller.rb,
app/controllers/msip/admin/municipios_controller.rb,
lib/msip/concerns/controllers/modelos_controller.rb,
lib/msip/concerns/controllers/tsitios_controller.rb,
lib/msip/concerns/controllers/veredas_controller.rb,
app/controllers/msip/admin/tdocumentos_controller.rb,
app/controllers/msip/admin/trelaciones_controller.rb,
app/controllers/msip/admin/trivalentes_controller.rb,
app/controllers/msip/etiquetas_persona_controller.rb,
lib/msip/concerns/controllers/oficinas_controller.rb,
lib/msip/concerns/controllers/personas_controller.rb,
lib/msip/concerns/controllers/tiposorg_controller.rb,
lib/msip/concerns/controllers/usuarios_controller.rb,
app/controllers/msip/orgsocial_personas_controller.rb,
lib/msip/concerns/controllers/bitacoras_controller.rb,
lib/msip/concerns/controllers/etiquetas_controller.rb,
lib/msip/concerns/controllers/gruposper_controller.rb,
lib/msip/concerns/models/departamento_histvigencia.rb,
lib/msip/concerns/models/orgsocial_sectororgsocial.rb,
app/controllers/msip/admin/departamentos_controller.rb,
app/controllers/msip/admin/fuentesprensa_controller.rb,
app/controllers/msip/persona_trelaciones_controller.rb,
lib/msip/concerns/controllers/estadossol_controller.rb,
lib/msip/concerns/controllers/municipios_controller.rb,
lib/msip/concerns/controllers/respaldo7z_controller.rb,
lib/msip/concerns/models/centropoblado_histvigencia.rb,
lib/msip/concerns/models/solicitud_usuarionotificar.rb,
app/controllers/msip/admin/ubicacionespre_controller.rb,
lib/msip/concerns/controllers/orgsociales_controller.rb,
lib/msip/concerns/controllers/solicitudes_controller.rb,
lib/msip/concerns/controllers/tdocumentos_controller.rb,
lib/msip/concerns/controllers/trelaciones_controller.rb,
lib/msip/concerns/controllers/trivalentes_controller.rb,
lib/msip/concerns/controllers/ubicaciones_controller.rb,
app/controllers/msip/admin/centrospoblados_controller.rb,
app/controllers/msip/admin/tcentrospoblados_controller.rb,
lib/msip/concerns/controllers/departamentos_controller.rb,
lib/msip/concerns/controllers/fuentesprensa_controller.rb,
app/controllers/msip/admin/perfilesorgsocial_controller.rb,
app/controllers/msip/admin/sectoresorgsocial_controller.rb,
lib/msip/concerns/controllers/ubicacionespre_controller.rb,
lib/msip/concerns/controllers/centrospoblados_controller.rb,
lib/msip/concerns/controllers/tcentrospoblados_controller.rb,
lib/msip/concerns/controllers/etiquetas_persona_controller.rb,
lib/msip/concerns/controllers/perfilesorgsocial_controller.rb,
lib/msip/concerns/controllers/sectoresorgsocial_controller.rb,
lib/msip/concerns/controllers/orgsocial_personas_controller.rb,
lib/msip/concerns/controllers/persona_trelaciones_controller.rb
Overview
frozenn_string_literal: true
Defined Under Namespace
Modules: AccesoresUbicacionpre, Admin, ApplicationHelper, Basica, BootstrapHelper, CapybaraHelper, Concerns, EdadSexoHelper, FontawesomeHelper, FormatoFechaHelper, ImportaHelper, InternetHelper, LocalizaHelper, Localizacion, Modelo, ModeloHelper, PaginacionAjaxHelper, ProcesosHelper, SqlHelper, TareasrakeHelper, TemasHelper, UbicacionHelper Classes: Ability, Anexo, AnexosController, ApplicationController, AsociabasicaGenerator, Bitacora, BitacorasController, Centropoblado, CentropobladoHistvigencia, Departamento, DepartamentoHistvigencia, Engine, Estadosol, Etiqueta, EtiquetaMunicipio, EtiquetaPersona, EtiquetasPersonaController, Etnia, Fuenteprensa, Grupo, GrupoUsuario, Grupoper, GruposperController, HogarController, ModeloGenerator, ModelosController, Mundep, Municipio, MunicipioHistvigencia, Oficina, Orgsocial, OrgsocialPersona, OrgsocialPersonasController, OrgsocialSectororgsocial, OrgsocialesController, Pais, PaisHistvigencia, Perfilorgsocial, Persona, PersonaTrelacion, PersonaTrelacionesController, PersonasController, Respaldo7z, Respaldo7zController, Sectororgsocial, Solicitud, SolicitudUsuarionotificar, SolicitudesController, TablabasicaGenerator, Tcentropoblado, Tdocumento, Tema, Tipoorg, Trelacion, Trivalente, Tsitio, Ubicacion, UbicacionesController, Ubicacionpre, Unificarpersonas, Usuario, Vereda
Constant Summary collapse
- VERSION =
"2.3.0.alfa3"
Class Method Summary collapse
-
.carga_semillas_sql(conexion, motor, tipoarchivo, patexcluye = nil) ⇒ void
Carga un archivo con semillas SQL de un motor, ruta o app.
-
.existe_secuencia?(conexion, nombre) ⇒ Boolean
Determina si existe una secuencia Considerar rubygems.org/gems/activerecord-postgresql-extensions (aunque parece no proveer algo como primary_key_exists?) stackoverflow.com/questions/11905868/Check-if-sequence-exists-in-Postgres-plpgsql/11919600#11919600.
-
.renombra_secuencia(conexion, anterior, nuevo) ⇒ Object
Renombra una secuncia.
- .setup {|_self| ... } ⇒ Object
Class Method Details
.carga_semillas_sql(conexion, motor, tipoarchivo, patexcluye = nil) ⇒ void
This method returns an undefined value.
Carga un archivo con semillas SQL de un motor, ruta o app
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/msip.rb', line 22 def self.carga_semillas_sql(conexion, motor, tipoarchivo, patexcluye = nil) if tipoarchivo.to_s != "datos" && tipoarchivo.to_s != "cambios" raise "Las semillas solo pueden ser cambios o datos" end if motor if Gem.loaded_specs[motor.to_s] motor = Gem.loaded_specs[motor.to_s].full_gem_path + "/" else # Ruta motor = motor.to_s + "/" if !File.exist?("#{motor}db/#{tipoarchivo}-basicas.sql") && motor == "../../" && ENV["RAILS_ENV"] == "test" # En motores se ejecutan pruebas desde directorio del motor # y no desde test/dummy motor = "" end end else motor = "" # Aplicacion end n = "#{motor}db/#{tipoarchivo}-basicas.sql" if File.exist?(n) l = File.readlines(n) if patexcluye l = l.select { |u| !u[patexcluye] } end conexion.execute(l.join("\n")) end end |
.existe_secuencia?(conexion, nombre) ⇒ Boolean
Determina si existe una secuencia Considerar rubygems.org/gems/activerecord-postgresql-extensions (aunque parece no proveer algo como primary_key_exists?) stackoverflow.com/questions/11905868/Check-if-sequence-exists-in-Postgres-plpgsql/11919600#11919600
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/msip.rb', line 58 def self.existe_secuencia?(conexion, nombre) cs = conexion.select_all("SELECT c.relkind FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_class c ON c.relnamespace = n.oid WHERE n.nspname = current_schema AND c.relname = '#{nombre}' AND c.relkind = 'S'") return true if cs.count > 0 false end |
.renombra_secuencia(conexion, anterior, nuevo) ⇒ Object
Renombra una secuncia
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/msip.rb', line 72 def self.renombra_secuencia(conexion, anterior, nuevo) if Msip.existe_secuencia?(conexion, anterior) && !Msip.existe_secuencia?(conexion, nuevo) conexion.execute(<<-SQL.squish) ALTER SEQUENCE #{anterior} RENAME TO #{nuevo}; SQL return true end false end |
.setup {|_self| ... } ⇒ Object
142 143 144 |
# File 'lib/msip/engine.rb', line 142 def setup(&block) yield self end |