decidim-generators 0.30.1 → 0.31.0.rc1
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 +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +377 -288
- data/lib/decidim/generators/app_generator.rb +60 -65
- data/lib/decidim/generators/app_templates/.node-version +1 -1
- data/lib/decidim/generators/app_templates/database.yml.erb +3 -3
- data/lib/decidim/generators/app_templates/dummy_signature_handler.rb +124 -0
- data/lib/decidim/generators/app_templates/dummy_signature_handler_form.html.erb +73 -0
- data/lib/decidim/generators/app_templates/dummy_sms_mobile_phone_validator.rb +11 -0
- data/lib/decidim/generators/app_templates/elections_initializer.rb +11 -0
- data/lib/decidim/generators/app_templates/initiatives_initializer.rb +54 -0
- data/lib/decidim/generators/app_templates/sidekiq.yml.erb +1 -1
- data/lib/decidim/generators/app_templates/storage.yml +42 -0
- data/lib/decidim/generators/component_templates/.node-version +1 -1
- data/lib/decidim/generators/component_templates/Gemfile.erb +2 -2
- data/lib/decidim/generators/component_templates/config/assets.rb.erb +3 -3
- data/lib/decidim/generators/component_templates/github/ci.yml.erb +2 -2
- data/lib/decidim/generators/component_templates/lib/decidim/component/engine.rb.erb +1 -1
- data/lib/decidim/generators/install_generator.rb +18 -21
- data/lib/decidim/generators/test/generator_examples.rb +24 -88
- data/lib/decidim/generators/version.rb +1 -1
- metadata +10 -8
- data/lib/decidim/generators/app_templates/ai_initializer.rb +0 -113
- data/lib/decidim/generators/app_templates/initializer.rb +0 -477
- data/lib/decidim/generators/app_templates/secrets.yml.erb +0 -190
- data/lib/decidim/generators/app_templates/storage.yml.erb +0 -42
@@ -45,10 +45,6 @@ module Decidim
|
|
45
45
|
RUBY
|
46
46
|
end
|
47
47
|
|
48
|
-
def secrets
|
49
|
-
template "secrets.yml.erb", "config/secrets.yml", force: true
|
50
|
-
end
|
51
|
-
|
52
48
|
def remove_layout
|
53
49
|
remove_file "app/views/layouts/application.html.erb"
|
54
50
|
remove_file "app/views/layouts/mailer.text.erb"
|
@@ -56,20 +52,20 @@ module Decidim
|
|
56
52
|
|
57
53
|
def smtp_environment
|
58
54
|
inject_into_file "config/environments/production.rb",
|
59
|
-
after: "config.
|
60
|
-
cut <<~
|
55
|
+
after: "config.log_tags = [ :request_id ]" do
|
56
|
+
cut <<~HERE
|
61
57
|
|
|
62
58
|
| config.action_mailer.smtp_settings = {
|
63
|
-
| :address =>
|
64
|
-
| :port =>
|
65
|
-
| :authentication =>
|
66
|
-
| :user_name =>
|
67
|
-
| :password =>
|
68
|
-
| :domain =>
|
69
|
-
| :enable_starttls_auto =>
|
59
|
+
| :address => Decidim::Env.new("SMTP_ADDRESS").to_s,
|
60
|
+
| :port => Decidim::Env.new("SMTP_PORT", 587).to_i,
|
61
|
+
| :authentication => Decidim::Env.new("SMTP_AUTHENTICATION", "plain").to_s,
|
62
|
+
| :user_name => Decidim::Env.new("SMTP_USERNAME").to_s,
|
63
|
+
| :password => Decidim::Env.new("SMTP_PASSWORD").to_s,
|
64
|
+
| :domain => Decidim::Env.new("SMTP_DOMAIN").to_s,
|
65
|
+
| :enable_starttls_auto => Decidim::Env.new("SMTP_STARTTLS_AUTO").to_boolean_string,
|
70
66
|
| :openssl_verify_mode => 'none'
|
71
67
|
| }
|
72
|
-
|
68
|
+
HERE
|
73
69
|
end
|
74
70
|
end
|
75
71
|
|
@@ -79,7 +75,7 @@ module Decidim
|
|
79
75
|
remove_file "Gemfile"
|
80
76
|
end
|
81
77
|
|
82
|
-
def
|
78
|
+
def install_decidim_shakapacker
|
83
79
|
# Copy CSS file
|
84
80
|
copy_file "decidim_application.scss", "app/packs/stylesheets/decidim/decidim_application.scss"
|
85
81
|
|
@@ -91,16 +87,17 @@ module Decidim
|
|
91
87
|
# Add a .keep file so directory is included in git when committing
|
92
88
|
create_file "app/packs/images/.keep"
|
93
89
|
|
94
|
-
# Regenerate
|
90
|
+
# Regenerate shakapacker binstubs
|
95
91
|
remove_file "bin/yarn"
|
96
92
|
bundle_install
|
97
|
-
rails "shakapacker:binstubs"
|
98
93
|
|
99
94
|
# Copy package.json
|
100
95
|
copy_file "package.json", "package.json"
|
101
96
|
|
102
|
-
|
103
|
-
|
97
|
+
rails "shakapacker:binstubs"
|
98
|
+
|
99
|
+
# Run Decidim custom shakapacker installation
|
100
|
+
rails "decidim:shakapacker:install"
|
104
101
|
|
105
102
|
# Run Decidim custom procfile installation
|
106
103
|
rails "decidim:procfile:install"
|
@@ -124,11 +121,11 @@ module Decidim
|
|
124
121
|
|
125
122
|
inject_into_file "config/environments/development.rb",
|
126
123
|
after: "config.action_mailer.raise_delivery_errors = false" do
|
127
|
-
cut <<~
|
124
|
+
cut <<~HERE
|
128
125
|
|
|
129
126
|
| config.action_mailer.delivery_method = :letter_opener_web
|
130
127
|
| config.action_mailer.default_url_options = { port: 3000 }
|
131
|
-
|
128
|
+
HERE
|
132
129
|
end
|
133
130
|
end
|
134
131
|
|
@@ -46,6 +46,9 @@ shared_examples_for "a new production application" do
|
|
46
46
|
.to match(/^# gem "decidim-initiatives"/)
|
47
47
|
.and match(/^# gem "decidim-conferences"/)
|
48
48
|
.and match(/^# gem "decidim-templates"/)
|
49
|
+
.and match(/^# gem "decidim-collaborative_texts"/)
|
50
|
+
.and match(/^# gem "decidim-elections"/)
|
51
|
+
.and match(/^# gem "decidim-demographics"/)
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
@@ -57,6 +60,9 @@ shared_examples_for "a new development application" do
|
|
57
60
|
.to match(/^gem "decidim-initiatives"/)
|
58
61
|
.and match(/^gem "decidim-conferences"/)
|
59
62
|
.and match(/^gem "decidim-templates"/)
|
63
|
+
.and match(/^gem "decidim-collaborative_texts"/)
|
64
|
+
.and match(/^gem "decidim-elections"/)
|
65
|
+
.and match(/^gem "decidim-demographics"/)
|
60
66
|
|
61
67
|
# Checks that every table from a migration is included in the generated schema
|
62
68
|
schema = File.read("#{test_app}/db/schema.rb")
|
@@ -120,8 +126,11 @@ shared_context "with application env vars" do
|
|
120
126
|
"DECIDIM_ADMIN_PASSWORD_MIN_LENGTH" => "",
|
121
127
|
"DECIDIM_ADMIN_PASSWORD_REPETITION_TIMES" => "",
|
122
128
|
"DECIDIM_ADMIN_PASSWORD_STRONG" => "",
|
129
|
+
"DECIDIM_DELETE_INACTIVE_USERS_AFTER_DAYS" => "",
|
130
|
+
"DECIDIM_MINIMUM_INACTIVITY_PERIOD_IN_DAYS" => "",
|
131
|
+
"DECIDIM_DELETE_INACTIVE_USERS_FIRST_WARNING_DAYS_BEFORE" => "",
|
132
|
+
"DECIDIM_DELETE_INACTIVE_USERS_LAST_WARNING_DAYS_BEFORE" => "",
|
123
133
|
"DECIDIM_SERVICE_WORKER_ENABLED" => "",
|
124
|
-
"RAILS_LOG_LEVEL" => "nonsense",
|
125
134
|
"STORAGE_PROVIDER" => ""
|
126
135
|
}
|
127
136
|
end
|
@@ -209,6 +218,10 @@ shared_context "with application env vars" do
|
|
209
218
|
"DECIDIM_ADMIN_PASSWORD_MIN_LENGTH" => "18",
|
210
219
|
"DECIDIM_ADMIN_PASSWORD_REPETITION_TIMES" => "8",
|
211
220
|
"DECIDIM_ADMIN_PASSWORD_STRONG" => "false",
|
221
|
+
"DECIDIM_DELETE_INACTIVE_USERS_AFTER_DAYS" => "365",
|
222
|
+
"DECIDIM_MINIMUM_INACTIVITY_PERIOD_IN_DAYS" => "30",
|
223
|
+
"DECIDIM_DELETE_INACTIVE_USERS_FIRST_WARNING_DAYS_BEFORE" => "30",
|
224
|
+
"DECIDIM_DELETE_INACTIVE_USERS_LAST_WARNING_DAYS_BEFORE" => "7",
|
212
225
|
"RAILS_LOG_LEVEL" => "fatal",
|
213
226
|
"RAILS_ASSET_HOST" => "http://assets.example.org",
|
214
227
|
"ETHERPAD_SERVER" => "http://a-etherpad-server.com",
|
@@ -226,10 +239,8 @@ shared_context "with application env vars" do
|
|
226
239
|
"PROPOSALS_PARTICIPATORY_SPACE_HIGHLIGHTED_PROPOSALS_LIMIT" => "6",
|
227
240
|
"PROPOSALS_PROCESS_GROUP_HIGHLIGHTED_PROPOSALS_LIMIT" => "5",
|
228
241
|
"MEETINGS_UPCOMING_MEETING_NOTIFICATION" => "3",
|
229
|
-
"
|
242
|
+
"MEETINGS_WAITING_LIST_ENABLED" => "true",
|
230
243
|
"MEETINGS_EMBEDDABLE_SERVICES" => "www.youtube.com www.twitch.tv meet.jit.si 8x8.vc",
|
231
|
-
"BUDGETS_ENABLE_PROPOSAL_LINKING" => "false",
|
232
|
-
"ACCOUNTABILITY_ENABLE_PROPOSAL_LINKING" => "false",
|
233
244
|
"INITIATIVES_CREATION_ENABLED" => "false",
|
234
245
|
"INITIATIVES_SIMILARITY_THRESHOLD" => "0.99",
|
235
246
|
"INITIATIVES_SIMILARITY_LIMIT" => "10",
|
@@ -282,7 +293,8 @@ shared_examples_for "an application with configurable env vars" do
|
|
282
293
|
%w(omniauth google_oauth2 enabled) => false,
|
283
294
|
%w(decidim application_name) => "My Application Name",
|
284
295
|
%w(decidim mailer_sender) => "change-me@example.org",
|
285
|
-
%w(decidim available_locales) => %w(ca cs de
|
296
|
+
%w(decidim available_locales) => %w(en bg ar ca cs da de el eo es es-MX es-PY et eu fa fi-pl fi fr fr-CA ga gl hr hu
|
297
|
+
id is it ja ko lb lt lv mt nl no pl pt pt-BR ro ru sk sl sr sv tr uk vi zh-CN zh-TW),
|
286
298
|
%w(decidim default_locale) => "en",
|
287
299
|
%w(decidim force_ssl) => "auto",
|
288
300
|
%w(decidim enable_html_header_snippets) => false,
|
@@ -340,10 +352,7 @@ shared_examples_for "an application with configurable env vars" do
|
|
340
352
|
%w(decidim proposals participatory_space_highlighted_proposals_limit) => 4,
|
341
353
|
%w(decidim proposals process_group_highlighted_proposals_limit) => 3,
|
342
354
|
%w(decidim meetings upcoming_meeting_notification) => 2,
|
343
|
-
%w(decidim meetings enable_proposal_linking) => "auto",
|
344
355
|
%w(decidim meetings embeddable_services) => [],
|
345
|
-
%w(decidim budgets enable_proposal_linking) => "auto",
|
346
|
-
%w(decidim accountability enable_proposal_linking) => "auto",
|
347
356
|
%w(decidim initiatives creation_enabled) => "auto",
|
348
357
|
%w(decidim initiatives minimum_committee_members) => 2,
|
349
358
|
%w(decidim initiatives default_signature_time_period_length) => 120,
|
@@ -436,10 +445,7 @@ shared_examples_for "an application with configurable env vars" do
|
|
436
445
|
%w(decidim proposals participatory_space_highlighted_proposals_limit) => 6,
|
437
446
|
%w(decidim proposals process_group_highlighted_proposals_limit) => 5,
|
438
447
|
%w(decidim meetings upcoming_meeting_notification) => 3,
|
439
|
-
%w(decidim meetings enable_proposal_linking) => false,
|
440
448
|
%w(decidim meetings embeddable_services) => %w(www.youtube.com www.twitch.tv meet.jit.si 8x8.vc),
|
441
|
-
%w(decidim budgets enable_proposal_linking) => false,
|
442
|
-
%w(decidim accountability enable_proposal_linking) => false,
|
443
449
|
%w(decidim initiatives creation_enabled) => false,
|
444
450
|
%w(decidim initiatives minimum_committee_members) => 3,
|
445
451
|
%w(decidim initiatives default_signature_time_period_length) => 133,
|
@@ -457,14 +463,15 @@ shared_examples_for "an application with configurable env vars" do
|
|
457
463
|
{
|
458
464
|
"application_name" => "My Application Name",
|
459
465
|
"mailer_sender" => "change-me@example.org",
|
460
|
-
"available_locales" => %w(ca cs de
|
466
|
+
"available_locales" => %w(en bg ar ca cs da de el eo es es-MX es-PY et eu fa fi-pl fi fr fr-CA ga gl hr hu id is it
|
467
|
+
ja ko lb lt lv mt nl no pl pt pt-BR ro ru sk sl sr sv tr uk vi zh-CN zh-TW),
|
461
468
|
"default_locale" => "en",
|
462
469
|
"force_ssl" => true,
|
463
470
|
"enable_html_header_snippets" => false,
|
464
471
|
"currency_unit" => "€",
|
465
472
|
"image_uploader_quality" => 80,
|
466
|
-
"maximum_attachment_size" =>
|
467
|
-
"maximum_avatar_size" =>
|
473
|
+
"maximum_attachment_size" => 10, # 10 megabytes
|
474
|
+
"maximum_avatar_size" => 5, # 5 megabytes
|
468
475
|
"max_reports_before_hiding" => 3,
|
469
476
|
"track_newsletter_links" => true,
|
470
477
|
"download_your_data_expiry_time" => 604_800, # 7 days
|
@@ -502,8 +509,8 @@ shared_examples_for "an application with configurable env vars" do
|
|
502
509
|
"enable_html_header_snippets" => true,
|
503
510
|
"currency_unit" => "$",
|
504
511
|
"image_uploader_quality" => 91,
|
505
|
-
"maximum_attachment_size" =>
|
506
|
-
"maximum_avatar_size" =>
|
512
|
+
"maximum_attachment_size" => 25, # 25 megabytes
|
513
|
+
"maximum_avatar_size" => 11, # 11 megabytes
|
507
514
|
"max_reports_before_hiding" => 4,
|
508
515
|
"track_newsletter_links" => false,
|
509
516
|
"download_your_data_expiry_time" => 172_800, # 2 days
|
@@ -630,7 +637,6 @@ shared_examples_for "an application with configurable env vars" do
|
|
630
637
|
let(:meetings_initializer_off) do
|
631
638
|
{
|
632
639
|
"upcoming_meeting_notification" => 172_800, # 2.days
|
633
|
-
"enable_proposal_linking" => true,
|
634
640
|
"embeddable_services" => %w(www.youtube.com www.twitch.tv meet.jit.si)
|
635
641
|
}
|
636
642
|
end
|
@@ -638,35 +644,10 @@ shared_examples_for "an application with configurable env vars" do
|
|
638
644
|
let(:meetings_initializer_on) do
|
639
645
|
{
|
640
646
|
"upcoming_meeting_notification" => 259_200, # 3.days
|
641
|
-
"enable_proposal_linking" => false,
|
642
647
|
"embeddable_services" => %w(www.youtube.com www.twitch.tv meet.jit.si 8x8.vc)
|
643
648
|
}
|
644
649
|
end
|
645
650
|
|
646
|
-
let(:budgets_initializer_off) do
|
647
|
-
{
|
648
|
-
"enable_proposal_linking" => true
|
649
|
-
}
|
650
|
-
end
|
651
|
-
|
652
|
-
let(:budgets_initializer_on) do
|
653
|
-
{
|
654
|
-
"enable_proposal_linking" => false
|
655
|
-
}
|
656
|
-
end
|
657
|
-
|
658
|
-
let(:accountability_initializer_off) do
|
659
|
-
{
|
660
|
-
"enable_proposal_linking" => true
|
661
|
-
}
|
662
|
-
end
|
663
|
-
|
664
|
-
let(:accountability_initializer_on) do
|
665
|
-
{
|
666
|
-
"enable_proposal_linking" => false
|
667
|
-
}
|
668
|
-
end
|
669
|
-
|
670
651
|
# The logs settings have changed between Rails 6.0 abd 6.1 and this may be here
|
671
652
|
# https://github.com/rails/rails/commit/73079940111e8b85bf87953e5ef9fafeece5b5da
|
672
653
|
let(:rails_off) do
|
@@ -695,19 +676,6 @@ shared_examples_for "an application with configurable env vars" do
|
|
695
676
|
# This is using a big example to avoid recreating the application every time
|
696
677
|
it "env vars generate secrets application" do
|
697
678
|
expect(result[1]).to be_success, result[0]
|
698
|
-
# Test onto the secret generated when ENV vars are empty strings or undefined
|
699
|
-
json_off = json_secrets_for(test_app, env_off)
|
700
|
-
secrets_off.each do |keys, value|
|
701
|
-
current = json_off.dig(*keys)
|
702
|
-
expect(current).to eq(value), "Secret #{keys} = (#{current}) expected to match Env:OFF (#{value})"
|
703
|
-
end
|
704
|
-
|
705
|
-
# Test onto the secret generated when ENV vars are set
|
706
|
-
json_on = json_secrets_for(test_app, env_on)
|
707
|
-
secrets_on.each do |keys, value|
|
708
|
-
current = json_on.dig(*keys)
|
709
|
-
expect(current).to eq(value), "Secret #{keys} = (#{current}) expected to match Env:ON (#{value})"
|
710
|
-
end
|
711
679
|
|
712
680
|
# Test onto the initializer when ENV vars are empty strings or undefined
|
713
681
|
json_off = initializer_config_for(test_app, env_off)
|
@@ -786,34 +754,6 @@ shared_examples_for "an application with configurable env vars" do
|
|
786
754
|
expect(current).to eq(value), "Meetings Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
|
787
755
|
end
|
788
756
|
|
789
|
-
# Test onto the initializer with ENV vars OFF for the Budgets module
|
790
|
-
json_off = initializer_config_for(test_app, env_off, "Decidim::Budgets")
|
791
|
-
budgets_initializer_off.each do |key, value|
|
792
|
-
current = json_off[key]
|
793
|
-
expect(current).to eq(value), "Budgets Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
|
794
|
-
end
|
795
|
-
|
796
|
-
# Test onto the initializer with ENV vars ON for the Budgets module
|
797
|
-
json_on = initializer_config_for(test_app, env_on, "Decidim::Budgets")
|
798
|
-
budgets_initializer_on.each do |key, value|
|
799
|
-
current = json_on[key]
|
800
|
-
expect(current).to eq(value), "Budgets Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
|
801
|
-
end
|
802
|
-
|
803
|
-
# Test onto the initializer with ENV vars OFF for the Accountability module
|
804
|
-
json_off = initializer_config_for(test_app, env_off, "Decidim::Accountability")
|
805
|
-
accountability_initializer_off.each do |key, value|
|
806
|
-
current = json_off[key]
|
807
|
-
expect(current).to eq(value), "Accountability Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
|
808
|
-
end
|
809
|
-
|
810
|
-
# Test onto the initializer with ENV vars ON for the Accountability module
|
811
|
-
json_on = initializer_config_for(test_app, env_on, "Decidim::Accountability")
|
812
|
-
accountability_initializer_on.each do |key, value|
|
813
|
-
current = json_on[key]
|
814
|
-
expect(current).to eq(value), "Accountability Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
|
815
|
-
end
|
816
|
-
|
817
757
|
# Test onto some extra Rails configs when ENV vars are empty or undefined
|
818
758
|
rails_off.each do |key, value|
|
819
759
|
current = rails_value(key, test_app, env_off)
|
@@ -951,16 +891,12 @@ shared_examples_for "an application with storage and queue gems" do
|
|
951
891
|
current = rails_value("YAML.load(ERB.new(IO.read(\"config/sidekiq.yml\")).result)", test_app, queue_envs_on)
|
952
892
|
expect(current["concurrency"]).to eq(11), "sidekiq concurrency (#{current["concurrency"]}) expected to eq 11"
|
953
893
|
|
954
|
-
queues = %w(mailers vote_reminder reminders default newsletter newsletters_opt_in conference_diplomas events translations user_report block_user
|
894
|
+
queues = %w(mailers vote_reminder reminders default newsletter newsletters_opt_in conference_diplomas events translations user_report block_user exports
|
955
895
|
close_meeting_reminder)
|
956
896
|
expect(current["queues"].flatten).to include(*queues), "sidekiq queues (#{current["queues"].flatten}) expected to contain (#{queues})"
|
957
897
|
end
|
958
898
|
end
|
959
899
|
|
960
|
-
def json_secrets_for(path, env)
|
961
|
-
JSON.parse cmd_capture(path, "bin/rails runner 'puts Rails.application.secrets.to_json'", env:)
|
962
|
-
end
|
963
|
-
|
964
900
|
def initializer_config_for(path, env, mod = "Decidim")
|
965
901
|
JSON.parse cmd_capture(path, "bin/rails runner 'puts #{mod}.config.to_json'", env:)
|
966
902
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-
|
13
|
+
date: 2025-09-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.31.0.rc1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.31.0.rc1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- lib/decidim/generators/app_templates/Dockerfile.erb
|
65
65
|
- lib/decidim/generators/app_templates/LICENSE-AGPLv3.txt
|
66
66
|
- lib/decidim/generators/app_templates/README.md.erb
|
67
|
-
- lib/decidim/generators/app_templates/ai_initializer.rb
|
68
67
|
- lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
|
69
68
|
- lib/decidim/generators/app_templates/budgets_initializer.rb
|
70
69
|
- lib/decidim/generators/app_templates/budgets_workflow_random.en.yml
|
@@ -79,13 +78,16 @@ files:
|
|
79
78
|
- lib/decidim/generators/app_templates/docker-compose-etherpad.yml
|
80
79
|
- lib/decidim/generators/app_templates/docker-compose.yml.erb
|
81
80
|
- lib/decidim/generators/app_templates/dummy_authorization_handler.rb
|
81
|
+
- lib/decidim/generators/app_templates/dummy_signature_handler.rb
|
82
|
+
- lib/decidim/generators/app_templates/dummy_signature_handler_form.html.erb
|
83
|
+
- lib/decidim/generators/app_templates/dummy_sms_mobile_phone_validator.rb
|
84
|
+
- lib/decidim/generators/app_templates/elections_initializer.rb
|
82
85
|
- lib/decidim/generators/app_templates/ephemeral_dummy_authorization_handler.rb
|
83
|
-
- lib/decidim/generators/app_templates/
|
86
|
+
- lib/decidim/generators/app_templates/initiatives_initializer.rb
|
84
87
|
- lib/decidim/generators/app_templates/package.json
|
85
88
|
- lib/decidim/generators/app_templates/rack_profiler_initializer.rb
|
86
|
-
- lib/decidim/generators/app_templates/secrets.yml.erb
|
87
89
|
- lib/decidim/generators/app_templates/sidekiq.yml.erb
|
88
|
-
- lib/decidim/generators/app_templates/storage.yml
|
90
|
+
- lib/decidim/generators/app_templates/storage.yml
|
89
91
|
- lib/decidim/generators/app_templates/verifications_initializer.rb
|
90
92
|
- lib/decidim/generators/component_generator.rb
|
91
93
|
- lib/decidim/generators/component_templates/.eslintrc.json
|
@@ -1,113 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if Decidim.module_installed?(:ai)
|
4
|
-
Decidim::Ai::Language.formatter = "Decidim::Ai::Language::Formatter"
|
5
|
-
|
6
|
-
Decidim::Ai::SpamDetection.reporting_user_email = "your-admin@example.org"
|
7
|
-
|
8
|
-
Decidim::Ai::SpamDetection.resource_score_threshold = 0.75 # default
|
9
|
-
|
10
|
-
Decidim::Ai::SpamDetection.spam_detection_delay = 30.seconds # default
|
11
|
-
|
12
|
-
# The entry must be a hash with the following keys:
|
13
|
-
# - name: the name of the analyzer
|
14
|
-
# - strategy: the class of the strategy to use
|
15
|
-
# - options: a hash with the options to pass to the strategy
|
16
|
-
# Example:
|
17
|
-
# Decidim::Ai::SpamDetection.resource_analyzers = [
|
18
|
-
# {
|
19
|
-
# name: :bayes,
|
20
|
-
# strategy: Decidim::Ai::SpamContent::BayesStrategy,
|
21
|
-
# options: {
|
22
|
-
# adapter: :redis,
|
23
|
-
# params: {
|
24
|
-
# url: lambda { ENV["REDIS_URL"] }
|
25
|
-
# scheme: "redis"
|
26
|
-
# host: "127.0.0.1"
|
27
|
-
# port: 6379
|
28
|
-
# path: nil
|
29
|
-
# timeout: 5.0
|
30
|
-
# password: nil
|
31
|
-
# db: 0
|
32
|
-
# driver: nil
|
33
|
-
# id: nil
|
34
|
-
# tcp_keepalive: 0
|
35
|
-
# reconnect_attempts: 1
|
36
|
-
# inherit_socket: false
|
37
|
-
# }
|
38
|
-
# }
|
39
|
-
# }
|
40
|
-
# ]
|
41
|
-
Decidim::Ai::SpamDetection.resource_analyzers = [
|
42
|
-
{
|
43
|
-
name: :bayes,
|
44
|
-
strategy: Decidim::Ai::SpamDetection::Strategy::Bayes,
|
45
|
-
options: {
|
46
|
-
adapter: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE", "redis"),
|
47
|
-
params: { url: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE_REDIS_URL", "redis://localhost:6379/2") }
|
48
|
-
}
|
49
|
-
}
|
50
|
-
]
|
51
|
-
|
52
|
-
# If you want to use a different spam detection service, you can define your own service.
|
53
|
-
# Refer to documentation for more details.
|
54
|
-
#
|
55
|
-
Decidim::Ai::SpamDetection.resource_detection_service = "Decidim::Ai::SpamDetection::Service"
|
56
|
-
|
57
|
-
# Customize here what are the analyzed models. You may want to use this to
|
58
|
-
# override what we register by default, or to register your own resources.
|
59
|
-
# Follow the documentation on how to trail more resources
|
60
|
-
Decidim::Ai::SpamDetection.resource_models = begin
|
61
|
-
models = {}
|
62
|
-
models["Decidim::Comments::Comment"] = "Decidim::Ai::SpamDetection::Resource::Comment" if Decidim.module_installed?("comments")
|
63
|
-
models["Decidim::Debates::Debate"] = "Decidim::Ai::SpamDetection::Resource::Debate" if Decidim.module_installed?("debates")
|
64
|
-
models["Decidim::Initiative"] = "Decidim::Ai::SpamDetection::Resource::Initiative" if Decidim.module_installed?("initiatives")
|
65
|
-
models["Decidim::Meetings::Meeting"] = "Decidim::Ai::SpamDetection::Resource::Meeting" if Decidim.module_installed?("meetings")
|
66
|
-
models["Decidim::Proposals::Proposal"] = "Decidim::Ai::SpamDetection::Resource::Proposal" if Decidim.module_installed?("proposals")
|
67
|
-
models["Decidim::Proposals::CollaborativeDraft"] = "Decidim::Ai::SpamDetection::Resource::CollaborativeDraft" if Decidim.module_installed?("proposals")
|
68
|
-
models
|
69
|
-
end
|
70
|
-
|
71
|
-
Decidim::Ai::SpamDetection.user_score_threshold = 0.75 # default
|
72
|
-
|
73
|
-
# The entry must be a hash with the following keys:
|
74
|
-
# - name: the name of the analyzer
|
75
|
-
# - strategy: the class of the strategy to use
|
76
|
-
# - options: a hash with the options to pass to the strategy
|
77
|
-
# Example:
|
78
|
-
# Decidim::Ai::SpamDetection.user_analyzers = [
|
79
|
-
# {
|
80
|
-
# name: :bayes,
|
81
|
-
# strategy: Decidim::Ai::SpamContent::BayesStrategy,
|
82
|
-
# options: {
|
83
|
-
# adapter: :redis,
|
84
|
-
# params: {
|
85
|
-
# url: lambda { ENV["REDIS_URL"] }
|
86
|
-
# }
|
87
|
-
# }
|
88
|
-
# }
|
89
|
-
# ]
|
90
|
-
Decidim::Ai::SpamDetection.user_analyzers = [
|
91
|
-
{
|
92
|
-
name: :bayes,
|
93
|
-
strategy: Decidim::Ai::SpamDetection::Strategy::Bayes,
|
94
|
-
options: {
|
95
|
-
adapter: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_USER", "redis"),
|
96
|
-
params: { url: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_USER_REDIS_URL", "redis://localhost:6379/3") }
|
97
|
-
}
|
98
|
-
}
|
99
|
-
]
|
100
|
-
|
101
|
-
# Customize here what are the analyzed models. You may want to use this to
|
102
|
-
# override what we register by default, or to register your own resources.
|
103
|
-
# Follow the documentation on how to trail more resources
|
104
|
-
Decidim::Ai::SpamDetection.user_models = {
|
105
|
-
"Decidim::UserGroup" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity",
|
106
|
-
"Decidim::User" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity"
|
107
|
-
}
|
108
|
-
|
109
|
-
# If you want to use a different spam detection service, you can define your own service.
|
110
|
-
# Refer to documentation for more details.
|
111
|
-
#
|
112
|
-
Decidim::Ai::SpamDetection.user_detection_service = "Decidim::Ai::SpamDetection::Service"
|
113
|
-
end
|