sobremesa 0.1.0
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.
- checksums.yaml +7 -0
- data/lib/generators/sobremesa/sobremesa_generator.rb +58 -0
- data/lib/generators/sobremesa/templates/active_record/es-PE.template +13 -0
- data/lib/generators/sobremesa/templates/controller/es-PE.template +9 -0
- data/lib/generators/sobremesa/templates/views/es-PE.template +34 -0
- data/lib/sobremesa/version.rb +5 -0
- data/lib/sobremesa.rb +8 -0
- metadata +71 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f0cd2b52037455cbb9a4dfafa1bc8cbbb318a8f6a71714ebdfb23c0f8fe9f6f0
|
|
4
|
+
data.tar.gz: be282f013947a5a3d34f4efefa427c9b4ac090f7a78f7fb113a3ea48dbead532
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c1aa594008ed51ee84911a1053937a05084e2b6253c9658b5251182f0ab0bdf46367f48a42315058277095ae1d7d88d02f5516ac5236cc89ec36211c25951f8d
|
|
7
|
+
data.tar.gz: b665d497ee43191ffca6a2004f68fc876666b0e736ea18069f013f5a82f34ae576f9448a56f0348ca6a8382be0d05a27191596e15798057a8cd75b0cc1e05581
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SobremesaGenerator
|
|
4
|
+
# Generate locales to active_record, views and controllers
|
|
5
|
+
class SobremesaGenerator < Rails::Generators::NamedBase
|
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
|
7
|
+
|
|
8
|
+
class_option :languages, type: :array, default: ['es-PE']
|
|
9
|
+
argument :attributes, type: :array, default: [], banner: 'field:type field:type'
|
|
10
|
+
|
|
11
|
+
def gen_init
|
|
12
|
+
@modules = Array(regular_class_path)
|
|
13
|
+
options.languages.each do |language|
|
|
14
|
+
@language = language
|
|
15
|
+
ask_labels unless behavior == :revoke
|
|
16
|
+
locales_types.each do |locales_type|
|
|
17
|
+
create_locales(locales_type, language)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def create_locales(locales_type, language)
|
|
25
|
+
dir = "#{locales_dir(locales_type)}/#{language}.yml"
|
|
26
|
+
template_path = "#{locales_type}/#{language}.template"
|
|
27
|
+
template template_path, dir
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def locales_types
|
|
31
|
+
%w[active_record controller views]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def locales_dir(type)
|
|
35
|
+
['config', 'locales', type, @modules, file_name.pluralize.underscore].flatten.compact.join('/')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def ask_labels
|
|
39
|
+
@dic = {
|
|
40
|
+
singular: ask('[singular_model]:'),
|
|
41
|
+
plural: ask('[plural_model]:'),
|
|
42
|
+
art: ask('[art]:'),
|
|
43
|
+
dart: ask('[dart]:'),
|
|
44
|
+
termination: ask('[a/o/e]')
|
|
45
|
+
}
|
|
46
|
+
@dic[:art_singular] = "#{@dic[:art]} #{@dic[:singular]}"
|
|
47
|
+
@dic[:dart_singular] = "#{@dic[:dart]} #{@dic[:singular]}"
|
|
48
|
+
ask_attributes
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def ask_attributes
|
|
52
|
+
@dic[:attributes] = {}
|
|
53
|
+
attributes.each do |attribute|
|
|
54
|
+
@dic[:attributes][attribute.name] = ask("#{attribute.name}: ")
|
|
55
|
+
end
|
|
56
|
+
@dic[:attributes]
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%= @language %>:
|
|
2
|
+
activerecord:
|
|
3
|
+
attributes:
|
|
4
|
+
<%= "#{@modules.join('/')}" %><%= @modules.empty? ? '' : '/'%><%= "#{file_name.underscore}" %>:
|
|
5
|
+
_self: '<%= @dic[:singular].capitalize %>'
|
|
6
|
+
_self_plural: '<%= @dic[:plural].capitalize %>'<% attributes.each do |attribute| %><% if attribute.reference? %>
|
|
7
|
+
<%=attribute.name%>: '<%= @dic[:attributes][attribute.name].capitalize %>'
|
|
8
|
+
<%=attribute.index_name%>: '<%= @dic[:attributes][attribute.name].capitalize %>'<% else %>
|
|
9
|
+
<%=attribute.name%>: '<%= @dic[:attributes][attribute.name].capitalize %>'<% end %><% end %>
|
|
10
|
+
errors:
|
|
11
|
+
models:
|
|
12
|
+
<%= "#{@modules.join('/')}" %><%= @modules.empty? ? '' : '/'%><%= "#{file_name.underscore}" %>:
|
|
13
|
+
attributes:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= @language %>:
|
|
2
|
+
controller:
|
|
3
|
+
<%= "#{@modules.join('/')}" %><%="#{@modules.empty? ? '' : '/'}"%><%= "#{file_name.pluralize.underscore}" %>:
|
|
4
|
+
success:
|
|
5
|
+
create: '<%= @dic[:art_singular].capitalize %> fue cread<%= @dic[:termination].downcase %> correctamente'
|
|
6
|
+
update: 'Los datos <%= @dic[:dart_singular] %> fueron modificados correctamente'
|
|
7
|
+
destroy: '<%= @dic[:art_singular].capitalize %> fue eliminad<%= @dic[:termination].downcase %> correctamente'
|
|
8
|
+
error:
|
|
9
|
+
destroy: '<%= @dic[:art_singular].capitalize %> no pudo ser eliminad<%= @dic[:termination].downcase %>'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<%= @language %>:
|
|
2
|
+
view:
|
|
3
|
+
<%= @modules.join('/') %><%="#{@modules.empty? ? '' : '/'}"%><%= "#{file_name.pluralize.underscore}" %>:
|
|
4
|
+
index:
|
|
5
|
+
title: 'Gestionar <%= @dic[:plural] %>'
|
|
6
|
+
new_link: 'Crear <%= @dic[:singular] %>'
|
|
7
|
+
show_link: 'Configurar'
|
|
8
|
+
show:
|
|
9
|
+
back_link: 'Volver a la lista de <%= @dic[:plural] %>'
|
|
10
|
+
title: 'Datos <%= @dic[:dart_singular] %>'
|
|
11
|
+
edit_link: 'Editar'
|
|
12
|
+
edit_pass_link: 'Editar contraseña'
|
|
13
|
+
edit_char_link: 'Editar'
|
|
14
|
+
destroy_link: 'Eliminar'
|
|
15
|
+
destroy_confirm_message: '¿Está seguro de eliminar <%= @dic[:art_singular] %>?'
|
|
16
|
+
new:
|
|
17
|
+
back_link: 'Volver a la lista de <%= @dic[:plural] %>'
|
|
18
|
+
form_title: 'Crear <%= @dic[:singular] %>'
|
|
19
|
+
save_button: 'Crear'
|
|
20
|
+
create:
|
|
21
|
+
back_link: 'Volver a la lista de <%= @dic[:plural] %>'
|
|
22
|
+
form_title: 'Crear <%= @dic[:singular] %>'
|
|
23
|
+
save_button: 'Crear'
|
|
24
|
+
edit:
|
|
25
|
+
back_link: 'Volver a configurar <%= @dic[:art_singular] %>'
|
|
26
|
+
form_title: 'Editar <%= @dic[:singular] %>'
|
|
27
|
+
form_photo_message: 'Archivo formato jpg o png, menor a 1mb'
|
|
28
|
+
save_button: 'Guardar'
|
|
29
|
+
update:
|
|
30
|
+
back_link: 'Volver a configurar <%= @dic[:art_singular] %>'
|
|
31
|
+
form_title: 'Editar <%= @dic[:singular] %>'
|
|
32
|
+
save_button: 'Guardar'
|
|
33
|
+
_show_basic_info:
|
|
34
|
+
title: 'Usuario'
|
data/lib/sobremesa.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sobremesa
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Marcos Chuquicondor
|
|
8
|
+
- Dino Castillo
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: rails
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - "~>"
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: '7.0'
|
|
21
|
+
- - ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 7.0.0
|
|
24
|
+
type: :runtime
|
|
25
|
+
prerelease: false
|
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
- - "~>"
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
version: '7.0'
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 7.0.0
|
|
34
|
+
description: Generate templates active_record, controllers and views locales.
|
|
35
|
+
email:
|
|
36
|
+
- marcos@chuquicondor.com
|
|
37
|
+
executables: []
|
|
38
|
+
extensions: []
|
|
39
|
+
extra_rdoc_files: []
|
|
40
|
+
files:
|
|
41
|
+
- lib/generators/sobremesa/sobremesa_generator.rb
|
|
42
|
+
- lib/generators/sobremesa/templates/active_record/es-PE.template
|
|
43
|
+
- lib/generators/sobremesa/templates/controller/es-PE.template
|
|
44
|
+
- lib/generators/sobremesa/templates/views/es-PE.template
|
|
45
|
+
- lib/sobremesa.rb
|
|
46
|
+
- lib/sobremesa/version.rb
|
|
47
|
+
homepage: https://github.com/chuquimm/sobremesa
|
|
48
|
+
licenses:
|
|
49
|
+
- MIT
|
|
50
|
+
metadata:
|
|
51
|
+
homepage_uri: https://github.com/chuquimm/sobremesa
|
|
52
|
+
post_install_message:
|
|
53
|
+
rdoc_options: []
|
|
54
|
+
require_paths:
|
|
55
|
+
- lib
|
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 2.6.0
|
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
requirements: []
|
|
67
|
+
rubygems_version: 3.3.3
|
|
68
|
+
signing_key:
|
|
69
|
+
specification_version: 4
|
|
70
|
+
summary: Rails locales templates.
|
|
71
|
+
test_files: []
|