lesli 5.0.3 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/lesli_manifest.js +2 -1
  3. data/app/assets/images/lesli/brand/app-logo2.svg +52 -0
  4. data/app/assets/javascripts/lesli/users/confirmations.js +32 -0
  5. data/app/assets/javascripts/lesli/users/passwords.js +3 -3
  6. data/app/assets/javascripts/lesli/users/registrations.js +3 -3
  7. data/app/assets/javascripts/lesli/users/sessions.js +3 -3
  8. data/app/assets/stylesheets/lesli/users/confirmations.scss +28 -6
  9. data/app/controllers/lesli/application_controller.rb +3 -3
  10. data/app/controllers/lesli/application_lesli_controller.rb +2 -2
  11. data/app/controllers/lesli/interfaces/application/authorization.rb +2 -2
  12. data/app/controllers/lesli/interfaces/application/logger.rb +14 -38
  13. data/app/controllers/lesli/interfaces/application/requester.rb +1 -1
  14. data/app/controllers/lesli/roles_controller.rb +3 -1
  15. data/app/controllers/lesli/shared/dashboards_controller.rb +308 -0
  16. data/app/controllers/users/confirmations_controller.rb +63 -27
  17. data/app/controllers/users/passwords_controller.rb +67 -30
  18. data/app/controllers/users/sessions_controller.rb +2 -4
  19. data/app/helpers/lesli/general_helper.rb +1 -1
  20. data/app/helpers/lesli/navigation_helper.rb +17 -16
  21. data/app/lib/lesli/system.rb +14 -5
  22. data/app/mailers/lesli/application_lesli_mailer.rb +8 -19
  23. data/app/mailers/lesli/devise_mailer.rb +29 -3
  24. data/app/models/concerns/account_initializer.rb +100 -0
  25. data/app/models/concerns/{user_guard.rb → user_security.rb} +7 -8
  26. data/app/models/lesli/account.rb +9 -26
  27. data/app/models/lesli/application_lesli_record.rb +2 -1
  28. data/app/models/lesli/descriptor/privilege.rb +38 -0
  29. data/app/models/lesli/descriptor.rb +18 -1
  30. data/app/models/lesli/role/power.rb +70 -0
  31. data/app/models/lesli/role/privilege.rb +38 -0
  32. data/app/models/lesli/role.rb +20 -15
  33. data/app/models/lesli/shared/dashboard.rb +162 -0
  34. data/app/models/lesli/system_controller.rb +1 -0
  35. data/app/models/lesli/user/{role.rb → power.rb} +1 -1
  36. data/app/{services/lesli/role_service.rb → models/lesli/user/setting.rb} +10 -9
  37. data/app/models/lesli/user.rb +11 -20
  38. data/app/operators/lesli/controller_operator.rb +148 -0
  39. data/app/operators/lesli/descriptor_privilege_operator.rb +75 -0
  40. data/app/operators/lesli/role_power_operator.rb +108 -0
  41. data/app/operators/lesli/user_registration_operator.rb +121 -0
  42. data/app/services/lesli/user_service.rb +2 -4
  43. data/app/services/lesli/{user/session_service.rb → user_session_service.rb} +11 -4
  44. data/app/views/devise/confirmations/new.html.erb +0 -14
  45. data/app/views/devise/confirmations/show.html.erb +63 -0
  46. data/app/views/devise/passwords/edit.html.erb +78 -24
  47. data/app/views/devise/passwords/new.html.erb +2 -3
  48. data/app/views/lesli/emails/devise_mailer/confirmation_instructions.html.erb +1 -1
  49. data/app/views/lesli/emails/devise_mailer/reset_password_instructions.html.erb +23 -0
  50. data/app/views/lesli/partials/_application-lesli-engines.html.erb +1 -1
  51. data/app/views/lesli/partials/_application-lesli-header.html.erb +3 -1
  52. data/app/views/lesli/partials/_application-lesli-icons.html.erb +1 -1
  53. data/config/initializers/devise.rb +2 -0
  54. data/config/locales/translations.en.yml +13 -3
  55. data/config/locales/translations.es.yml +13 -3
  56. data/config/routes.rb +4 -2
  57. data/db/migrate/v1.0/0010000110_create_lesli_accounts.rb +2 -0
  58. data/db/{tables/0010001010_create_account_settings.rb → migrate/v1.0/0010001010_create_lesli_account_settings.rb} +5 -5
  59. data/db/{tables/0010003110_create_user_settings.rb → migrate/v1.0/0010003110_create_lesli_user_settings.rb} +4 -4
  60. data/db/migrate/v1.0/0010003210_create_lesli_user_sessions.rb +6 -2
  61. data/db/migrate/v1.0/{0010003410_create_lesli_user_roles.rb → 0010003410_create_lesli_user_powers.rb} +4 -4
  62. data/db/migrate/v1.0/0010005010_create_lesli_descriptors.rb +1 -1
  63. data/db/migrate/v1.0/{0010003910_create_lesli_user_agents.rb → 0010005510_create_lesli_role_powers.rb} +7 -9
  64. data/db/{tables/0010005710_create_role_privileges.rb → migrate/v1.0/0010005710_create_lesli_role_privileges.rb} +6 -6
  65. data/db/seed/development/users.rb +3 -4
  66. data/db/seed/tools.rb +4 -4
  67. data/db/seeds.rb +16 -29
  68. data/lib/lesli/engine.rb +33 -10
  69. data/lib/lesli/version.rb +1 -1
  70. data/lib/mailer_previews/devise_mailer_preview.rb +7 -0
  71. data/lib/sass/lesli/bulma/loader.scss +3 -0
  72. data/lib/sass/lesli/layouts/application-navbar.scss +1 -1
  73. data/lib/sass/lesli/pages/devise-simple.scss +2 -1
  74. data/lib/tasks/lesli/controllers.rake +1 -94
  75. data/lib/tasks/lesli/db.rake +43 -3
  76. data/lib/tasks/lesli/dev.rake +66 -0
  77. data/lib/tasks/lesli/engine.rake +59 -0
  78. data/lib/tasks/lesli/privileges.rake +54 -0
  79. data/lib/tasks/lesli_tasks.rake +5 -0
  80. data/lib/vue/application.js +11 -3
  81. data/lib/vue/devise/passwords.js +7 -7
  82. data/lib/vue/devise/registrations.js +2 -2
  83. data/lib/vue/devise/sessions.js +11 -6
  84. data/lib/vue/layouts/application-header.vue +15 -3
  85. data/lib/vue/shared/dashboards/apps/edit.vue +215 -0
  86. data/lib/vue/{apps → shared}/dashboards/apps/index.vue +3 -5
  87. data/lib/vue/{apps → shared}/dashboards/apps/show.vue +26 -16
  88. data/lib/vue/{apps → shared}/dashboards/components/form.vue +31 -43
  89. data/lib/vue/shared/stores/dashboard.js +251 -0
  90. data/lib/vue/stores/translations.json +24 -72
  91. data/lib/vue/stores/{user.js → users.js} +1 -1
  92. data/lib/webpack/base.js +3 -2
  93. data/lib/webpack/core.js +2 -1
  94. data/readme.md +23 -7
  95. metadata +63 -65
  96. data/app/models/concerns/account_engines.rb +0 -249
  97. data/app/models/concerns/user_polyfill.rb +0 -134
  98. data/db/migrate/v1.0/0010001510_create_lesli_account_requests.rb +0 -45
  99. data/db/migrate/v1.0/0010003810_create_lesli_user_requests.rb +0 -44
  100. data/db/tables/0010005510_create_role_descriptors.rb +0 -44
  101. data/lib/vue/apps/dashboards/apps/edit.vue +0 -105
  102. data/lib/vue/apps/dashboards/components/preview.vue +0 -172
  103. /data/app/assets/icons/lesli/{cloud-vault.svg → cloud-guard.svg} +0 -0
  104. /data/lib/vue/{apps → shared}/cloudobjects/action.vue +0 -0
  105. /data/lib/vue/{apps → shared}/cloudobjects/discussion/content.vue +0 -0
  106. /data/lib/vue/{apps → shared}/cloudobjects/discussion/element.vue +0 -0
  107. /data/lib/vue/{apps → shared}/cloudobjects/discussion/filters.vue +0 -0
  108. /data/lib/vue/{apps → shared}/cloudobjects/discussion/new.vue +0 -0
  109. /data/lib/vue/{apps → shared}/cloudobjects/discussion.vue +0 -0
  110. /data/lib/vue/{apps → shared}/cloudobjects/file/grid.vue +0 -0
  111. /data/lib/vue/{apps → shared}/cloudobjects/file/list.vue +0 -0
  112. /data/lib/vue/{apps → shared}/cloudobjects/file.vue +0 -0
  113. /data/lib/vue/{apps → shared}/dashboards/apps/new.vue +0 -0
  114. /data/lib/vue/{apps → shared}/workflows2/apps/actions/form.vue +0 -0
  115. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/chatroom-form.vue +0 -0
  116. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/cloud-object-clone-form.vue +0 -0
  117. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/cloud-object-file-form.vue +0 -0
  118. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/email-form.vue +0 -0
  119. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/notification-form.vue +0 -0
  120. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/send-cloud-object-file.vue +0 -0
  121. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/task-form.vue +0 -0
  122. /data/lib/vue/{apps → shared}/workflows2/apps/actions/index.vue +0 -0
  123. /data/lib/vue/{apps → shared}/workflows2/apps/checks/form.vue +0 -0
  124. /data/lib/vue/{apps → shared}/workflows2/apps/checks/index.vue +0 -0
  125. /data/lib/vue/{apps → shared}/workflows2/apps/index.vue +0 -0
  126. /data/lib/vue/{apps → shared}/workflows2/apps/new.vue +0 -0
  127. /data/lib/vue/{apps → shared}/workflows2/apps/show.vue +0 -0
  128. /data/lib/vue/{apps → shared}/workflows2/components/associations.vue +0 -0
  129. /data/lib/vue/{apps → shared}/workflows2/components/chart.vue +0 -0
  130. /data/lib/vue/{apps → shared}/workflows2/components/workflow-form.vue +0 -0
  131. /data/lib/vue/{apps → shared}/workflows2/components/workflow-status-dropdown.vue +0 -0
@@ -17,7 +17,7 @@ GNU General Public License for more details.
17
17
  You should have received a copy of the GNU General Public License
18
18
  along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
- Lesli · Ruby on Rails SaaS development platform.
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
22
  Made with ♥ by https://www.lesli.tech
23
23
  Building a better future, one line of code at a time.
@@ -27,19 +27,19 @@ Building a better future, one line of code at a time.
27
27
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
28
 
29
29
  // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
- // ·
30
+ // ·
31
31
  =end
32
32
 
33
- class CreateRolePrivileges < ActiveRecord::Migration[7.0]
33
+ class CreateLesliRolePrivileges < ActiveRecord::Migration[7.0]
34
34
  def change
35
- create_table :role_privileges do |t|
35
+ create_table :lesli_role_privileges do |t|
36
36
  t.string :controller
37
37
  t.string :action
38
38
  t.boolean :active
39
39
  t.datetime :deleted_at, index: true
40
40
  t.timestamps
41
41
  end
42
- add_reference(:role_privileges, :role, foreign_key: { to_table: :roles })
43
- add_index(:role_privileges, %i[controller action role_id], unique: true, name: "role_privileges_index")
42
+ add_reference(:lesli_role_privileges, :role, foreign_key: { to_table: :lesli_roles })
43
+ add_index(:lesli_role_privileges, %i[controller action role_id], unique: true, name: "role_privileges_index")
44
44
  end
45
45
  end
@@ -43,11 +43,10 @@ user.account.save!
43
43
 
44
44
  # core development users
45
45
  [
46
- ["ldonis@lesli.tech", "owner", "Luis", "Donis"],
47
- ["admin@lesli.tech", "sysadmin", "Admin", "Lesli"],
48
- ["guest@lesli.tech", "limited", "Guest", "Lesli"],
46
+ ["ldonis@lesli.tech", "owner", "Luis", "Donis"],
47
+ ["admin@lesli.tech", "sysadmin","Admin","Lesli"],
48
+ ["guest@lesli.tech", "limited", "Guest","Lesli"],
49
49
  ["test@lesli.tech", "sysadmin", "Test", "Lesli"],
50
50
  ].each do |user|
51
51
  create_development_user(user[0], user[1], user[2], user[3])
52
- L2.m("User #{ user[2] } <#{ user[0] }> successfully created!")
53
52
  end
data/db/seed/tools.rb CHANGED
@@ -17,16 +17,16 @@ GNU General Public License for more details.
17
17
  You should have received a copy of the GNU General Public License
18
18
  along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
- Lesli · Your Smart Business Assistant.
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
22
  Made with ♥ by https://www.lesli.tech
23
23
  Building a better future, one line of code at a time.
24
24
 
25
25
  @contact hello@lesli.tech
26
- @website https://lesli.tech
26
+ @website https://www.lesli.tech
27
27
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
28
 
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
30
  // ·
31
31
  =end
32
32
 
@@ -53,7 +53,7 @@ def create_development_user email, rolename, firstname, lastname, password:nil
53
53
  user.last_name = lastname
54
54
  user.save!
55
55
 
56
- #user.user_roles.create!({ role: Role.find_by("name" => rolename) })
56
+ user.powers.create!({ role: Lesli::Role.find_by(:name => rolename) })
57
57
 
58
58
  user
59
59
  end
data/db/seeds.rb CHANGED
@@ -31,32 +31,19 @@ Building a better future, one line of code at a time.
31
31
  =end
32
32
 
33
33
 
34
- # including tools for seeders
35
- load Lesli::Engine.root.join("db", "seed", "tools.rb")
36
-
37
-
38
- # loading core seeders
39
- load Lesli::Engine.root.join("db", "seed", "#{Rails.env.downcase}.rb")
40
-
41
-
42
- # loading engine seeders
43
- # Rails.application.config.lesli.dig(:engines).each do |engine|
44
-
45
- # # every instance (builder module) is loaded into the platform using the same name of the engine
46
- # instance_klass = engine[:name].safe_constantize
47
-
48
- # L2.msg(
49
- # "Loading seeds for #{instance_klass} environment",
50
- # "Version: #{instance_klass::VERSION} - Build: #{instance_klass::BUILD}"
51
- # )
52
-
53
- # # dynamic load seeds from installed engines
54
- # instance_klass::Engine.load_seed
55
- # end
56
-
57
-
58
- # # exec maintenance tasks
59
- #Rake.application.invoke_task("app:maintenance")
60
-
61
-
62
- #L2.cow("Seed process completed!")
34
+ # IMPORTANT:
35
+ # Seed files are only for development, if you need to create default resources
36
+ # for production you must use the initializer method in the Engine account model
37
+ if Rails.env.development?
38
+ L2.msg(
39
+ "Lesli",
40
+ "Version: #{Lesli::VERSION}",
41
+ "Build: #{Lesli::BUILD}")
42
+
43
+ # including tools for seeders
44
+ load Lesli::Engine.root.join("db", "seed", "tools.rb")
45
+
46
+
47
+ # loading core seeders
48
+ load Lesli::Engine.root.join("db", "seed", "#{Rails.env.downcase}.rb")
49
+ end
data/lib/lesli/engine.rb CHANGED
@@ -39,6 +39,7 @@ require "L2"
39
39
  require "devise"
40
40
  require "useragent"
41
41
  require "flag-icons-rails"
42
+ require "acts_as_paranoid"
42
43
 
43
44
  module Lesli
44
45
  class Engine < ::Rails::Engine
@@ -46,6 +47,21 @@ module Lesli
46
47
 
47
48
  initializer :lesli do |app|
48
49
 
50
+
51
+ # Lesli standard engine configuration
52
+
53
+
54
+ # register assets manifest
55
+ config.assets.precompile += %w[lesli_manifest.js]
56
+
57
+ # register engine migrations path
58
+ unless app.root.to_s.match root.to_s
59
+ config.paths["db/migrate"].expanded.each do |expanded_path|
60
+ app.config.paths["db/migrate"] << expanded_path
61
+ end
62
+ end
63
+
64
+
49
65
  # Lesli Framework configuration
50
66
 
51
67
 
@@ -65,21 +81,28 @@ module Lesli
65
81
  # if this is not false Rails will fingerprint the assets by default and precompile is needed
66
82
  config.assets.digest = false
67
83
 
84
+
85
+ # Lesli Framework Mailer configuration
86
+
87
+
88
+ # Development mailer by default
89
+ config.action_mailer.delivery_method ||= :letter_opener
90
+
91
+ # Add the Lesli root folder for email development tempaltes
68
92
  config.action_mailer.preview_path = root.join("lib", "mailer_previews")
69
93
 
94
+ config.action_mailer.default_options ||= {
70
95
 
71
- # Lesli standard engine configuration
96
+ # Use the main email in the lesli settings as email sender
97
+ from: config.company.dig(:email)
98
+ }
72
99
 
73
-
74
- # register assets manifest
75
- config.assets.precompile += %w[lesli_manifest.js]
76
100
 
77
- # register engine migrations path
78
- unless app.root.to_s.match root.to_s
79
- config.paths["db/migrate"].expanded.each do |expanded_path|
80
- app.config.paths["db/migrate"] << expanded_path
81
- end
82
- end
101
+
102
+ # Mailer url options for development
103
+ config.action_mailer.default_url_options ||= {
104
+ host: "http://0.0.0.0:3000"
105
+ }
83
106
  end
84
107
  end
85
108
  end
data/lib/lesli/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Lesli
2
- VERSION = "5.0.3"
2
+ VERSION = "5.0.5"
3
3
  BUILD = "1697000148"
4
4
  end
@@ -32,6 +32,13 @@ Building a better future, one line of code at a time.
32
32
 
33
33
  class DeviseMailerPreview < ActionMailer::Preview
34
34
 
35
+ def reset_password_instructions
36
+ record = Lesli::User.first
37
+ token = "abcdef12345"
38
+ opts = {}
39
+ Lesli::DeviseMailer.reset_password_instructions(record, token, opts)
40
+ end
41
+
35
42
  def confirmation_instructions
36
43
  record = Lesli::User.first
37
44
  token = "abcdef12345"
@@ -52,18 +52,21 @@ $navbar-background-color: transparent;
52
52
 
53
53
  @import "bulma/sass/form/all";
54
54
 
55
+ @import "bulma/sass/components/card";
55
56
  @import "bulma/sass/components/tabs";
56
57
  @import "bulma/sass/components/media";
57
58
  @import "bulma/sass/components/level";
58
59
  @import "bulma/sass/components/dropdown";
59
60
  @import "bulma/sass/components/pagination";
60
61
 
62
+ @import "bulma/sass/elements/notification";
61
63
  @import "bulma/sass/elements/container";
62
64
  @import "bulma/sass/elements/button";
63
65
  @import "bulma/sass/elements/image";
64
66
  @import "bulma/sass/elements/title";
65
67
  @import "bulma/sass/elements/table";
66
68
  @import "bulma/sass/elements/icon";
69
+ @import "bulma/sass/elements/tag";
67
70
 
68
71
  @import "bulma/sass/grid/columns";
69
72
 
@@ -54,7 +54,7 @@ nav.lesli-application-navigation {
54
54
  }
55
55
 
56
56
  [class^="ri-"] {
57
- font-size: 18px;
57
+ font-size: 20px;
58
58
  }
59
59
  }
60
60
  }
@@ -41,8 +41,9 @@ main {
41
41
  .hero-head {
42
42
  padding: 8rem 0 4rem;
43
43
 
44
- .app-logo {
44
+ .lesli-logo {
45
45
  max-width: 130px;
46
+ margin-bottom: 1rem;
46
47
  }
47
48
  }
48
49
 
@@ -36,101 +36,8 @@ namespace :lesli do
36
36
 
37
37
  desc "Scan new routes added and create role privileges"
38
38
  task build: :environment do
39
-
40
39
  L2.msg("Registering engines, controllers and actions")
41
-
42
- # get all the engines, controllers and actions
43
- engines = scan_for_engine_controllers
44
-
45
- # Register descriptors and privileges for all the accounts
46
- engines.each do |engine, controllers|
47
-
48
- controllers.each do |controller_route, controller_actions|
49
-
50
- # Build a strig with the standard name of a Rails controller from the standard routes
51
- # Examples:
52
- # users converts to Users
53
- # cloud_bell/notifications converts to CloudBell::Notifications
54
- # sometimes we need a second split to deal with third level deep of controllers
55
- # Example: "Account::Currency::ExchangeRatesController" from "account/currency/exchange_rates"
56
- reference = controller_route
57
- .split('/') # split the controller path by namespace
58
- .collect(&:capitalize) # uppercase the first letter to match the class name convention of Rails
59
- .join("::") # join by ruby class separator for namespaces
60
- .split('_') # work with compound words like "exchange_rates"
61
- .collect { |x| x[0] = x[0].upcase; x } # convert ['exchange', 'rates'] to ['Exchange', 'Rates']
62
- .join('') # joins everything in a single string
63
-
64
- name = reference.sub('::',' ')
65
-
66
- controller = Lesli::SystemController.create_with({
67
- name: name,
68
- :engine => engine,
69
- :reference => reference
70
- }).find_or_create_by!(route: controller_route)
71
-
72
- controller_actions.each do |action_name|
73
- controller.actions.find_or_create_by!(name: action_name)
74
- end
75
- end
76
- end
77
- end
78
-
79
- def scan_for_engine_controllers
80
-
81
- # Global container
82
- controller_list = {
83
- "core" => {}
84
- }
85
-
86
- # Get the name of the instance (builder engine)
87
- instance = "lesli" #Rails.configuration.lesli.dig(:instance, :name)
88
-
89
- # Get the list of controllers and actions of the core
90
- Rails.application.routes.routes.each do |route|
91
- route = route.defaults
92
-
93
- # filter the non-used core routes
94
- next if route[:controller].blank?
95
- next if route[:controller].include? "rails"
96
- next if route[:controller].include? "action_mailbox"
97
- next if route[:controller].include? "active_storage"
98
-
99
- # create a container for the actions related to a controller
100
- controller_list["core"][route[:controller]] = [] unless controller_list["core"][route[:controller]]
101
-
102
- # assign and group all the actions related to the controller
103
- controller_list["core"][route[:controller]].push(route[:action])
104
-
105
- end
106
-
107
- # Get the list of controllers and actions from engines
108
- Lesli::System.engines.each do |engine, engine_info|
109
-
110
- # load and retrieve the list of controllers and actions from an engine
111
- routes = "#{engine}::Engine".constantize.routes.routes.each do |route|
112
- route = route.defaults
113
-
114
- # validate if route has information, some special routes like redirects
115
- # can generate an empty entry in the route hash
116
- next if route.empty?
117
-
118
- # get the engine code
119
- engine_code = engine_info[:code]
120
-
121
- # create a container for the controllers related to the engine
122
- controller_list[engine_code] = {} if controller_list[engine_code].blank?
123
-
124
- # assign and group all the actions related to the controller
125
- controller_list[engine_code][route[:controller]] = [] if controller_list[engine_code][route[:controller]].blank?
126
-
127
- # assign and group all the actions related to the controller
128
- controller_list[engine_code][route[:controller]].push(route[:action])
129
-
130
- end
131
- end
132
-
133
- return controller_list
40
+ Lesli::ControllerOperator.new.build
134
41
  end
135
42
  end
136
43
  end
@@ -48,21 +48,35 @@ namespace :lesli do
48
48
  task :seed => :environment do |task, args|
49
49
  seed()
50
50
  end
51
+
52
+ desc "Build, migrate & seed Lesli database"
53
+ task :start => :environment do |task, args|
54
+ start()
55
+ end
51
56
  end
52
57
 
53
58
  # Drop, build, migrate & seed database (development only)
54
59
  def reset
60
+
61
+ # do not execute this task if we are at production level
55
62
  return if Rails.env.production?
56
- L2.msg("Reset Lesli database for development")
63
+
64
+ # print a message to let the users show the action running
65
+ L2.m("Reset Lesli database for development")
57
66
 
58
67
  Rake::Task['db:drop'].invoke
68
+
59
69
  setup()
60
70
  end
61
71
 
62
72
  # Build, migrate & seed database (development only)
63
73
  def setup
74
+
75
+ # do not execute this task if we are at production level
64
76
  return if Rails.env.production?
65
- L2.msg("Setup Lesli database for development")
77
+
78
+ # print a message to let the users show the action running
79
+ L2.m("Setup Lesli database for development")
66
80
 
67
81
  Rake::Task['db:create'].invoke
68
82
  Rake::Task['db:migrate'].invoke
@@ -72,17 +86,43 @@ namespace :lesli do
72
86
 
73
87
  # Seed database (development only)
74
88
  def seed
89
+
90
+ # do not execute this task if we are at production level
75
91
  return if Rails.env.production?
92
+
93
+ # print a message to let the users show the action running
76
94
  L2.msg("Seed Lesli database for development")
77
95
 
96
+ # load main app seeders
78
97
  Rake::Task['db:seed'].invoke
79
98
 
99
+ # load Lesli* gems seeders
80
100
  Lesli::Engine.load_seed
81
101
  LesliBell::Engine.load_seed if defined?(LesliBell)
102
+ LesliHelp::Engine.load_seed if defined?(LesliHelp)
82
103
  LesliAudit::Engine.load_seed if defined?(LesliAudit)
104
+
105
+ start()
106
+ end
107
+
108
+ def start
109
+
110
+ # do not execute this task if we are at production level
111
+ return if Rails.env.production?
112
+
113
+ # print a message to let the users show the action running
114
+ L2.msg("Start Lesli database for development")
115
+
116
+ # scan rails routes to build the controllers index
83
117
  Rake::Task['lesli:controllers:build'].invoke
118
+
119
+ # scan rails routes to build the controllers index
120
+ Rake::Task['lesli:privileges:build'].invoke
121
+
122
+ # scan rails routes to build the base of translations
84
123
  Rake::Task['lesli:babel:build'].invoke if defined?(LesliBabel)
85
124
 
125
+ # print the lesli gems
86
126
  Rake::Task['lesli:status'].invoke
87
- end
127
+ end
88
128
  end
@@ -0,0 +1,66 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ # ·
34
+ namespace :lesli do
35
+ namespace :dev do
36
+
37
+ desc "Print a welcome message with some basic instructions"
38
+ task :welcome => :environment do |task, args|
39
+ welcome()
40
+ end
41
+ end
42
+
43
+ # Seed database (development only)
44
+ def welcome
45
+
46
+ # do not execute this task if we are at production level
47
+ return if Rails.env.production?
48
+
49
+ L2.br(4)
50
+
51
+ # print the lesli gems
52
+ Rake::Task['lesli:status'].invoke
53
+
54
+ password = Lesli.config.security.dig(:password)
55
+ password = password + Time.now.year.to_s + "$"
56
+ user = Lesli::User.first
57
+
58
+ L2.line
59
+ L2.m(" Owner user credentials (demo):")
60
+ L2.m(" username: #{ user.email }")
61
+ L2.m(" password: #{ password }")
62
+ L2.line
63
+
64
+ L2.cow "Enjoy your Lesli demo"
65
+ end
66
+ end
@@ -0,0 +1,59 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ # ·
34
+ namespace :lesli do
35
+ namespace :engine do
36
+
37
+ desc "Initialize model data for new installed engines"
38
+ task :install => :environment do |task, args|
39
+ engine_install
40
+ end
41
+ end
42
+
43
+ # Initialize model data for new installed engines
44
+ def engine_install
45
+
46
+ L2.msg("Initialize model data for new installed engines")
47
+
48
+ # scan rails routes to build the controllers index
49
+ Rake::Task['lesli:controllers:build'].invoke
50
+
51
+ Rake::Task['lesli:role:privileges'].invoke
52
+
53
+ # scan rails routes to build the base of translations
54
+ Rake::Task['lesli:babel:build'].invoke if defined?(LesliBabel)
55
+
56
+ # print the lesli gems
57
+ Rake::Task['lesli:status'].invoke
58
+ end
59
+ end
@@ -0,0 +1,54 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+ # ·
34
+ namespace :lesli do
35
+ namespace :privileges do
36
+
37
+ desc "Syncing privileges for all the available roles"
38
+ task :build => :environment do |task, args|
39
+ role_sync_privileges()
40
+ end
41
+ end
42
+
43
+ # Drop, build, migrate & seed database (development only)
44
+ def role_sync_privileges
45
+
46
+ L2.msg("Syncing privileges for all the available roles")
47
+
48
+ Lesli::Descriptor.where(:name => "owner").each do |descriptor|
49
+ descriptor.initialize_descriptor_privileges
50
+ end
51
+
52
+ Lesli::RolePowerOperator.new(Lesli::Role.all.pluck(:id)).synchronize
53
+ end
54
+ end
@@ -36,6 +36,11 @@ require "i18n-js"
36
36
  namespace :lesli do
37
37
  namespace :babel do
38
38
 
39
+ desc "Scan and register labels"
40
+ task :load => :environment do |task, args|
41
+ Rake::Task['lesli_babel:load'].invoke
42
+ end
43
+
39
44
  desc "Scan and register labels"
40
45
  task :build => :environment do |task, args|
41
46
  Rake::Task['lesli_babel:build'].invoke