decidim-generators 0.27.4 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -5
  3. data/Gemfile.lock +372 -407
  4. data/README.md +2 -2
  5. data/lib/decidim/generators/app_generator.rb +83 -24
  6. data/lib/decidim/generators/app_templates/.node-version +1 -0
  7. data/lib/decidim/generators/app_templates/.rubocop.yml +2 -0
  8. data/lib/decidim/generators/app_templates/.ruby-version +1 -0
  9. data/lib/decidim/generators/app_templates/README.md.erb +7 -12
  10. data/lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb +1 -1
  11. data/lib/decidim/generators/app_templates/budgets_workflow_random.rb +1 -1
  12. data/lib/decidim/generators/app_templates/bullet_initializer.rb +1 -1
  13. data/lib/decidim/generators/app_templates/config/boot.rb.tt +16 -0
  14. data/lib/decidim/generators/app_templates/database.yml.erb +1 -1
  15. data/lib/decidim/generators/app_templates/decidim_application.scss +2 -1
  16. data/lib/decidim/generators/app_templates/dummy_authorization_handler.rb +5 -5
  17. data/lib/decidim/generators/app_templates/initializer.rb +19 -8
  18. data/lib/decidim/generators/app_templates/rack_profiler_initializer.rb +2 -1
  19. data/lib/decidim/generators/app_templates/secrets.yml.erb +14 -8
  20. data/lib/decidim/generators/component_generator.rb +44 -2
  21. data/lib/decidim/generators/component_templates/.eslintrc.json +3 -0
  22. data/lib/decidim/generators/component_templates/.node-version +1 -0
  23. data/lib/decidim/generators/component_templates/.rubocop.yml +2 -0
  24. data/lib/decidim/generators/component_templates/.ruby-version +1 -0
  25. data/lib/decidim/generators/component_templates/.stylelintrc.json +3 -0
  26. data/lib/decidim/generators/component_templates/README.md.erb +7 -1
  27. data/lib/decidim/generators/component_templates/app/controllers/decidim/component/admin/application_controller.rb.erb +11 -0
  28. data/lib/decidim/generators/component_templates/app/permissions/decidim/component/admin/permissions.rb.erb +23 -0
  29. data/lib/decidim/generators/component_templates/decidim-component.gemspec.erb +9 -2
  30. data/lib/decidim/generators/component_templates/github/ci.yml.erb +77 -0
  31. data/lib/decidim/generators/component_templates/gitignore +5 -0
  32. data/lib/decidim/generators/component_templates/lib/decidim/component/test/factories.rb.erb +1 -0
  33. data/lib/decidim/generators/component_templates/package.json.erb +21 -0
  34. data/lib/decidim/generators/component_templates/spec/lib/version_spec.rb.erb +13 -0
  35. data/lib/decidim/generators/component_templates/spec/permissions/admin/permissions_spec.rb.erb +40 -0
  36. data/lib/decidim/generators/install_generator.rb +12 -7
  37. data/lib/decidim/generators/test/generator_examples.rb +72 -40
  38. data/lib/decidim/generators/version.rb +1 -1
  39. metadata +29 -13
  40. data/lib/decidim/generators/app_templates/_decidim-settings.scss +0 -7
  41. data/lib/decidim/generators/app_templates/social_share_button.rb +0 -8
  42. data/lib/decidim/generators/component_templates/circleci/config.yml +0 -47
@@ -9,6 +9,17 @@ module Decidim
9
9
  # Note that it inherits from `Decidim::Admin::Components::BaseController`, which
10
10
  # override its layout and provide all kinds of useful methods.
11
11
  class ApplicationController < Decidim::Admin::Components::BaseController
12
+ def permission_class_chain
13
+ [::Decidim::<%= component_module_name %>::Admin::Permissions] + super
14
+ end
15
+
16
+ def user_not_authorized_path
17
+ decidim.root_path
18
+ end
19
+
20
+ def user_has_no_permission_path
21
+ decidim.root_path
22
+ end
12
23
  end
13
24
  end
14
25
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module <%= component_module_name %>
5
+ module Admin
6
+ class Permissions < Decidim::DefaultPermissions
7
+ def permissions
8
+ return permission_action if permission_action.scope != :admin
9
+ return permission_action unless user&.admin?
10
+
11
+ allow! if can_access?
12
+
13
+ permission_action
14
+ end
15
+
16
+ def can_access?
17
+ permission_action.subject == :<%= component_name.to_sym %> &&
18
+ permission_action.action == :read
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -9,8 +9,15 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["<%= %x[git config user.name].chomp %>"]
10
10
  s.email = ["<%= %x[git config user.email].chomp %>"]
11
11
  s.license = "AGPL-3.0"
12
- s.homepage = "https://github.com/decidim/decidim-module-<%= component_name %>"
13
- s.required_ruby_version = ">= 3.0"
12
+ s.homepage = "https://decidim.org"
13
+ s.metadata = {
14
+ "bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
15
+ "documentation_uri" => "https://docs.decidim.org/",
16
+ "funding_uri" => "https://opencollective.com/decidim",
17
+ "homepage_uri" => "https://decidim.org",
18
+ "source_code_uri" => "https://github.com/decidim/decidim"
19
+ }
20
+ s.required_ruby_version = ">= <%= required_ruby_version %>"
14
21
 
15
22
  s.name = "decidim-<%= component_name %>"
16
23
  s.summary = "A decidim <%= component_name %> module"
@@ -0,0 +1,77 @@
1
+ name: "[CI] <%= component_module_name %>"
2
+ on:
3
+ push:
4
+ branches:
5
+ - develop
6
+ - release/*
7
+ - "*-stable"
8
+ pull_request:
9
+ branches-ignore:
10
+ - "chore/l10n*"
11
+
12
+ env:
13
+ CI: "true"
14
+ RUBY_VERSION: <%= RUBY_VERSION %>
15
+ NODE_VERSION: 18.17.1
16
+
17
+ concurrency:
18
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19
+ cancel-in-progress: true
20
+
21
+ jobs:
22
+ main:
23
+ name: Tests
24
+ runs-on: ubuntu-latest
25
+ timeout-minutes: 30
26
+ services:
27
+ postgres:
28
+ image: postgres:14
29
+ ports: ["5432:5432"]
30
+ options: >-
31
+ --health-cmd pg_isready
32
+ --health-interval 10s
33
+ --health-timeout 5s
34
+ --health-retries 5
35
+ env:
36
+ POSTGRES_PASSWORD: postgres
37
+ env:
38
+ DATABASE_USERNAME: postgres
39
+ DATABASE_PASSWORD: postgres
40
+ DATABASE_HOST: localhost
41
+ steps:
42
+ - uses: actions/checkout@v3
43
+ with:
44
+ fetch-depth: 1
45
+ - uses: ruby/setup-ruby@v1
46
+ with:
47
+ bundler-cache: true
48
+ - uses: actions/setup-node@v3
49
+ with:
50
+ node-version: ${{ env.NODE_VERSION }}
51
+ - name: Get npm cache directory path
52
+ id: npm-cache-dir-path
53
+ run: echo "dir=$(npm get cache)-<%= component_name %>" >> $GITHUB_OUTPUT
54
+ - uses: actions/cache@v3
55
+ id: npm-cache
56
+ with:
57
+ path: ${{ steps.npm-cache-dir-path.outputs.dir }}
58
+ key: npm-${{ hashFiles('**/package-lock.json') }}
59
+ restore-keys: |
60
+ npm-
61
+ - run: bundle exec rake test_app
62
+ name: Create test app
63
+ - run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
64
+ name: Create the screenshots folder
65
+ - uses: nanasess/setup-chromedriver@v2
66
+ - run: RAILS_ENV=test bundle exec rails assets:precompile
67
+ name: Precompile assets
68
+ working-directory: ./spec/decidim_dummy_app/
69
+ - run: bundle exec rspec
70
+ name: RSpec
71
+ - uses: codecov/codecov-action@v3
72
+ - uses: actions/upload-artifact@v3
73
+ if: always()
74
+ with:
75
+ name: screenshots
76
+ path: ./spec/decidim_dummy_app/tmp/screenshots
77
+ if-no-files-found: ignore
@@ -10,6 +10,11 @@
10
10
  # rspec failure tracking
11
11
  .rspec-failures
12
12
 
13
+ # env configuration files
14
+ .env
15
+ .envrc
16
+ .rbenv-vars
17
+
13
18
  # default test application
14
19
  spec/decidim_dummy_app
15
20
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/components/namer"
3
4
  require "decidim/core/test/factories"
4
5
 
5
6
  FactoryBot.define do
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "decidim-<%= component_name %>",
3
+ "version": "0.0.1",
4
+ "description": <%= JSON.generate(component_description || "") %>,
5
+ "private": true,
6
+ "license": "AGPL-3.0",
7
+ "scripts": {
8
+ "lint": "eslint -c .eslintrc.json --no-error-on-unmatched-pattern --ignore-pattern app/packs/vendor --ext .js app/packs",
9
+ "stylelint": "stylelint app/packs/**/*.scss"
10
+ },
11
+ "dependencies": {
12
+ "@decidim/browserslist-config": "<%= npm_package_version %>",
13
+ "@decidim/webpacker": "<%= npm_package_version %>"
14
+ },
15
+ "devDependencies": {
16
+ "@decidim/dev": "<%= npm_package_version %>",
17
+ "@decidim/eslint-config": "<%= npm_package_version %>",
18
+ "@decidim/stylelint-config": "<%= npm_package_version %>"
19
+ },
20
+ "browserslist": ["extends @decidim/browserslist-config"]
21
+ }
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ module Decidim
6
+ describe <%= component_module_name %> do
7
+ subject { described_class }
8
+
9
+ it "has version" do
10
+ expect(subject.version).to eq("<%= core_version %>")
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ module Decidim::<%= component_module_name %>::Admin
6
+ describe Permissions do
7
+ subject { described_class.new(user, permission_action, context).permissions.allowed? }
8
+
9
+ let(:organization) { create :organization }
10
+ let(:context) do
11
+ {
12
+ current_organization: organization
13
+ }
14
+ end
15
+ let(:action) do
16
+ { scope: :admin, action: :read, subject: :<%= component_name.to_sym %> }
17
+ end
18
+ let(:permission_action) { Decidim::PermissionAction.new(**action) }
19
+
20
+ context "when user is admin" do
21
+ let(:user) { create :user, :admin, organization: organization }
22
+
23
+ it { is_expected.to be_truthy }
24
+
25
+ context "when scope is not admin" do
26
+ let(:action) do
27
+ { scope: :foo, action: :read, subject: :<%= component_name.to_sym %> }
28
+ end
29
+
30
+ it_behaves_like "permission is not set"
31
+ end
32
+ end
33
+
34
+ context "when user is not admin" do
35
+ let(:user) { create :user, organization: organization }
36
+
37
+ it_behaves_like "permission is not set"
38
+ end
39
+ end
40
+ end
@@ -28,7 +28,7 @@ module Decidim
28
28
 
29
29
  class_option :skip_gemfile, type: :boolean,
30
30
  default: false,
31
- desc: "Don't generate a Gemfile for the application"
31
+ desc: "Do not generate a Gemfile for the application"
32
32
 
33
33
  class_option :profiling, type: :boolean,
34
34
  default: false,
@@ -40,14 +40,13 @@ module Decidim
40
40
 
41
41
  def add_seeds
42
42
  append_file "db/seeds.rb", <<~RUBY
43
- # You can remove the 'faker' gem if you don't want Decidim seeds.
43
+ # You can remove the 'faker' gem if you do not want Decidim seeds.
44
44
  Decidim.seed!
45
45
  RUBY
46
46
  end
47
47
 
48
48
  def copy_initializer
49
49
  copy_file "carrierwave.rb", "config/initializers/carrierwave.rb"
50
- copy_file "social_share_button.rb", "config/initializers/social_share_button.rb"
51
50
  end
52
51
 
53
52
  def secrets
@@ -79,9 +78,8 @@ module Decidim
79
78
  end
80
79
 
81
80
  def install_decidim_webpacker
82
- # Copy CSS files
81
+ # Copy CSS file
83
82
  copy_file "decidim_application.scss", "app/packs/stylesheets/decidim/decidim_application.scss"
84
- copy_file "_decidim-settings.scss", "app/packs/stylesheets/decidim/_decidim-settings.scss"
85
83
 
86
84
  # Copy JS application file
87
85
  copy_file "decidim_application.js", "app/packs/src/decidim/decidim_application.js"
@@ -94,10 +92,17 @@ module Decidim
94
92
  # Regenerate webpacker binstubs
95
93
  remove_file "bin/yarn"
96
94
  bundle_install
97
- rails "webpacker:binstubs"
95
+ rails "shakapacker:binstubs"
98
96
 
99
97
  # Run Decidim custom webpacker installation
100
98
  rails "decidim:webpacker:install"
99
+
100
+ # Run Decidim custom procfile installation
101
+ rails "decidim:procfile:install"
102
+
103
+ # Replace robots.txt
104
+ remove_file "public/robots.txt"
105
+ rails "decidim:robots:replace"
101
106
  end
102
107
 
103
108
  def build_api_docs
@@ -185,7 +190,7 @@ module Decidim
185
190
  rails "db:test:prepare"
186
191
  end
187
192
 
188
- # Runs rails commands in a subprocess, and aborts if it doesn't suceeed
193
+ # Runs rails commands in a subprocess, and aborts if it does not suceeed
189
194
  def rails(*args)
190
195
  abort unless system("bin/rails", *args)
191
196
  end
@@ -1,12 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ shared_context "when generating a new application" do
4
+ let(:env) do |example|
5
+ #
6
+ # When tracking coverage, make sure the ruby environment points to the
7
+ # local version, so we get the benefits of running `decidim` directly
8
+ # without `bundler` (more realistic test), but also get code coverage
9
+ # properly measured (we track coverage on the local version and not on the
10
+ # installed version).
11
+ #
12
+ if ENV["SIMPLECOV"]
13
+ {
14
+ "RUBYOPT" => "-rsimplecov #{ENV.fetch("RUBYOPT", nil)}",
15
+ "RUBYLIB" => "#{repo_root}/decidim-generators/lib:#{ENV.fetch("RUBYLIB", nil)}",
16
+ "PATH" => "#{repo_root}/decidim-generators/exe:#{ENV.fetch("PATH", nil)}",
17
+ "COMMAND_NAME" => example.full_description.tr(" ", "_")
18
+ }
19
+ else
20
+ {}
21
+ end
22
+ end
23
+
24
+ let(:result) do
25
+ Bundler.with_original_env { Decidim::GemManager.capture(command, env:) }
26
+ end
27
+
28
+ # rubocop:disable RSpec/BeforeAfterAll
29
+ before(:all) do
30
+ Bundler.with_original_env { Decidim::GemManager.install_all(out: File::NULL) }
31
+ end
32
+
33
+ after(:all) do
34
+ Bundler.with_original_env { Decidim::GemManager.uninstall_all(out: File::NULL) }
35
+ end
36
+ # rubocop:enable RSpec/BeforeAfterAll
37
+ end
38
+
3
39
  shared_examples_for "a new production application" do
4
40
  it "includes optional plugins commented out in Gemfile" do
5
41
  expect(result[1]).to be_success, result[0]
6
42
 
7
43
  expect(File.read("#{test_app}/Gemfile"))
8
44
  .to match(/^# gem "decidim-initiatives"/)
9
- .and match(/^# gem "decidim-consultations"/)
10
45
  .and match(/^# gem "decidim-elections"/)
11
46
  .and match(/^# gem "decidim-conferences"/)
12
47
  .and match(/^# gem "decidim-templates"/)
@@ -19,7 +54,6 @@ shared_examples_for "a new development application" do
19
54
 
20
55
  expect(File.read("#{test_app}/Gemfile"))
21
56
  .to match(/^gem "decidim-initiatives"/)
22
- .and match(/^gem "decidim-consultations"/)
23
57
  .and match(/^gem "decidim-elections"/)
24
58
  .and match(/^gem "decidim-conferences"/)
25
59
  .and match(/^gem "decidim-templates"/)
@@ -44,7 +78,7 @@ shared_examples_for "a new development application" do
44
78
  end
45
79
 
46
80
  # Check that important node modules were installed
47
- expect(Pathname.new("#{test_app}/node_modules/@rails/webpacker")).to be_directory
81
+ expect(Pathname.new("#{test_app}/node_modules/shakapacker")).to be_directory
48
82
 
49
83
  # Check that the configuration tweaks are applied properly
50
84
  expect(File.read("#{test_app}/config/spring.rb")).to match(%r{^require "decidim/spring"})
@@ -166,7 +200,8 @@ shared_context "with application env vars" do
166
200
  "DECIDIM_SESSION_TIMEOUT_INTERVAL" => "33",
167
201
  "DECIDIM_FOLLOW_HTTP_X_FORWARDED_HOST" => "true",
168
202
  "DECIDIM_MAXIMUM_CONVERSATION_MESSAGE_LENGTH" => "1234",
169
- "DECIDIM_PASSWORD_BLACKLIST" => "i-dont-like-this-password, i-dont,like,this,one,either, password123456",
203
+ "DECIDIM_PASSWORD_SIMILARITY_LENGTH" => "4",
204
+ "DECIDIM_DENIED_PASSWORDS" => "i-do-not-like-this-password, i-do-not,like,this,one,either, password123456",
170
205
  "DECIDIM_ALLOW_OPEN_REDIRECTS" => "true",
171
206
  "DECIDIM_ADMIN_PASSWORD_EXPIRATION_DAYS" => "93",
172
207
  "DECIDIM_ADMIN_PASSWORD_MIN_LENGTH" => "18",
@@ -195,7 +230,6 @@ shared_context "with application env vars" do
195
230
  "MEETINGS_EMBEDDABLE_SERVICES" => "www.youtube.com www.twitch.tv meet.jit.si 8x8.vc",
196
231
  "BUDGETS_ENABLE_PROPOSAL_LINKING" => "false",
197
232
  "ACCOUNTABILITY_ENABLE_PROPOSAL_LINKING" => "false",
198
- "CONSULTATIONS_STATS_CACHE_EXPIRATION_TIME" => "7",
199
233
  "INITIATIVES_CREATION_ENABLED" => "false",
200
234
  "INITIATIVES_SIMILARITY_THRESHOLD" => "0.99",
201
235
  "INITIATIVES_SIMILARITY_LIMIT" => "10",
@@ -288,7 +322,8 @@ shared_examples_for "an application with configurable env vars" do
288
322
  %w(decidim session_timeout_interval) => 10,
289
323
  %w(decidim follow_http_x_forwarded_host) => false,
290
324
  %w(decidim maximum_conversation_message_length) => 1000,
291
- %w(decidim password_blacklist) => [],
325
+ %w(decidim password_similarity_length) => 4,
326
+ %w(decidim denied_passwords) => [],
292
327
  %w(decidim allow_open_redirects) => false,
293
328
  %w(decidim admin_password expiration_days) => 90,
294
329
  %w(decidim admin_password min_length) => 15,
@@ -323,7 +358,6 @@ shared_examples_for "an application with configurable env vars" do
323
358
  %w(decidim meetings embeddable_services) => [],
324
359
  %w(decidim budgets enable_proposal_linking) => "auto",
325
360
  %w(decidim accountability enable_proposal_linking) => "auto",
326
- %w(decidim consultations stats_cache_expiration_time) => 5,
327
361
  %w(decidim initiatives creation_enabled) => "auto",
328
362
  %w(decidim initiatives similarity_threshold) => 0.25,
329
363
  %w(decidim initiatives similarity_limit) => 5,
@@ -336,7 +370,7 @@ shared_examples_for "an application with configurable env vars" do
336
370
  %w(decidim initiatives max_time_in_validating_state) => 60,
337
371
  %w(decidim initiatives print_enabled) => "auto",
338
372
  %w(decidim initiatives do_not_require_authorization) => false,
339
- %w(elections setup_minimum_hours_before_start) => 3,
373
+ %w(elections setup_minimum_hours_before_start) => 1,
340
374
  %w(elections start_vote_maximum_hours_before_start) => 6,
341
375
  %w(elections voter_token_expiration_minutes) => 120,
342
376
  %w(elections votings check_census_max_requests) => 5,
@@ -392,7 +426,8 @@ shared_examples_for "an application with configurable env vars" do
392
426
  %w(decidim session_timeout_interval) => 33,
393
427
  %w(decidim follow_http_x_forwarded_host) => true,
394
428
  %w(decidim maximum_conversation_message_length) => 1234,
395
- %w(decidim password_blacklist) => ["i-dont-like-this-password", "i-dont,like,this,one,either", "password123456"],
429
+ %w(decidim password_similarity_length) => 4,
430
+ %w(decidim denied_passwords) => ["i-do-not-like-this-password", "i-do-not,like,this,one,either", "password123456"],
396
431
  %w(decidim allow_open_redirects) => true,
397
432
  %w(decidim admin_password expiration_days) => 93,
398
433
  %w(decidim admin_password min_length) => 18,
@@ -427,7 +462,6 @@ shared_examples_for "an application with configurable env vars" do
427
462
  %w(decidim meetings embeddable_services) => %w(www.youtube.com www.twitch.tv meet.jit.si 8x8.vc),
428
463
  %w(decidim budgets enable_proposal_linking) => false,
429
464
  %w(decidim accountability enable_proposal_linking) => false,
430
- %w(decidim consultations stats_cache_expiration_time) => 7,
431
465
  %w(decidim initiatives creation_enabled) => false,
432
466
  %w(decidim initiatives similarity_threshold) => 0.99,
433
467
  %w(decidim initiatives similarity_limit) => 10,
@@ -486,7 +520,8 @@ shared_examples_for "an application with configurable env vars" do
486
520
  "session_timeout_interval" => 10,
487
521
  "follow_http_x_forwarded_host" => false,
488
522
  "maximum_conversation_message_length" => 1000,
489
- "password_blacklist" => [],
523
+ "password_similarity_length" => 4,
524
+ "denied_passwords" => [],
490
525
  "allow_open_redirects" => false,
491
526
  "etherpad" => nil,
492
527
  "maps" => nil
@@ -522,7 +557,8 @@ shared_examples_for "an application with configurable env vars" do
522
557
  "session_timeout_interval" => 33,
523
558
  "follow_http_x_forwarded_host" => true,
524
559
  "maximum_conversation_message_length" => 1234,
525
- "password_blacklist" => ["i-dont-like-this-password", "i-dont,like,this,one,either", "password123456"],
560
+ "password_similarity_length" => 4,
561
+ "denied_passwords" => ["i-do-not-like-this-password", "i-do-not,like,this,one,either", "password123456"],
526
562
  "allow_open_redirects" => true,
527
563
  "etherpad" => {
528
564
  "server" => "http://a-etherpad-server.com",
@@ -833,18 +869,6 @@ end
833
869
  shared_examples_for "an application with extra configurable env vars" do
834
870
  include_context "with application env vars"
835
871
 
836
- let(:consultations_initializer_off) do
837
- {
838
- "stats_cache_expiration_time" => 300 # 5.minutes
839
- }
840
- end
841
-
842
- let(:consultations_initializer_on) do
843
- {
844
- "stats_cache_expiration_time" => 420 # 7.minutes
845
- }
846
- end
847
-
848
872
  let(:initiatives_initializer_off) do
849
873
  {
850
874
  "creation_enabled" => true,
@@ -857,7 +881,7 @@ shared_examples_for "an application with extra configurable env vars" do
857
881
  "second_notification_percentage" => 66,
858
882
  "stats_cache_expiration_time" => 300, # 5.minutes
859
883
  "max_time_in_validating_state" => 5_184_000, # 60.days
860
- "print_enabled" => true,
884
+ "print_enabled" => false,
861
885
  "do_not_require_authorization" => false
862
886
  }
863
887
  end
@@ -881,7 +905,7 @@ shared_examples_for "an application with extra configurable env vars" do
881
905
 
882
906
  let(:elections_initializer_off) do
883
907
  {
884
- "setup_minimum_hours_before_start" => 3,
908
+ "setup_minimum_hours_before_start" => 1,
885
909
  "start_vote_maximum_hours_before_start" => 6,
886
910
  "voter_token_expiration_minutes" => 120
887
911
  }
@@ -924,20 +948,6 @@ shared_examples_for "an application with extra configurable env vars" do
924
948
  it "env vars generate secrets application" do
925
949
  expect(result[1]).to be_success, result[0]
926
950
 
927
- # Test onto the initializer with ENV vars OFF for the Consultations module
928
- json_off = initializer_config_for(test_app, env_off, "Decidim::Consultations")
929
- consultations_initializer_off.each do |key, value|
930
- current = json_off[key]
931
- expect(current).to eq(value), "Consultations Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
932
- end
933
-
934
- # Test onto the initializer with ENV vars ON for the Consultations module
935
- json_on = initializer_config_for(test_app, env_on, "Decidim::Consultations")
936
- consultations_initializer_on.each do |key, value|
937
- current = json_on[key]
938
- expect(current).to eq(value), "Consultations Initializer (#{key}) = (#{current}) expected to match Env (#{value})"
939
- end
940
-
941
951
  # Test onto the initializer with ENV vars OFF for the Initiatives module
942
952
  json_off = initializer_config_for(test_app, env_off, "Decidim::Initiatives")
943
953
  initiatives_initializer_off.each do |key, value|
@@ -1072,3 +1082,25 @@ shared_examples_for "an application with storage and queue gems" do
1072
1082
  expect(current["queues"].flatten).to include(*queues), "sidekiq queues (#{current["queues"].flatten}) expected to eq containt (#{queues})"
1073
1083
  end
1074
1084
  end
1085
+
1086
+ def json_secrets_for(path, env)
1087
+ JSON.parse cmd_capture(path, "bin/rails runner 'puts Rails.application.secrets.to_json'", env:)
1088
+ end
1089
+
1090
+ def initializer_config_for(path, env, mod = "Decidim")
1091
+ JSON.parse cmd_capture(path, "bin/rails runner 'puts #{mod}.config.to_json'", env:)
1092
+ end
1093
+
1094
+ def rails_value(value, path, env)
1095
+ JSON.parse cmd_capture(path, "bin/rails runner 'puts #{value}.to_json'", env:)
1096
+ end
1097
+
1098
+ def repo_root
1099
+ File.expand_path(File.join("..", "..", "..", "..", ".."), __dir__)
1100
+ end
1101
+
1102
+ def cmd_capture(path, cmd, env: {})
1103
+ Bundler.with_unbundled_env do
1104
+ Decidim::GemManager.new(path).capture(cmd, env:, with_stderr: false)[0]
1105
+ end
1106
+ end
@@ -4,7 +4,7 @@
4
4
  module Decidim
5
5
  module Generators
6
6
  def self.version
7
- "0.27.4"
7
+ "0.28.0.rc4"
8
8
  end
9
9
  end
10
10
  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.27.4
4
+ version: 0.28.0.rc4
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: 2023-07-27 00:00:00.000000000 Z
13
+ date: 2023-12-11 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.27.4
21
+ version: 0.28.0.rc4
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.27.4
28
+ version: 0.28.0.rc4
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: bundler
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -57,10 +57,12 @@ files:
57
57
  - exe/decidim
58
58
  - lib/decidim/generators.rb
59
59
  - lib/decidim/generators/app_generator.rb
60
+ - lib/decidim/generators/app_templates/.node-version
61
+ - lib/decidim/generators/app_templates/.rubocop.yml
62
+ - lib/decidim/generators/app_templates/.ruby-version
60
63
  - lib/decidim/generators/app_templates/Dockerfile.erb
61
64
  - lib/decidim/generators/app_templates/LICENSE-AGPLv3.txt
62
65
  - lib/decidim/generators/app_templates/README.md.erb
63
- - lib/decidim/generators/app_templates/_decidim-settings.scss
64
66
  - lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
65
67
  - lib/decidim/generators/app_templates/budgets_initializer.rb
66
68
  - lib/decidim/generators/app_templates/budgets_workflow_random.en.yml
@@ -68,6 +70,7 @@ files:
68
70
  - lib/decidim/generators/app_templates/bullet_initializer.rb
69
71
  - lib/decidim/generators/app_templates/cable.yml.erb
70
72
  - lib/decidim/generators/app_templates/carrierwave.rb
73
+ - lib/decidim/generators/app_templates/config/boot.rb.tt
71
74
  - lib/decidim/generators/app_templates/database.yml.erb
72
75
  - lib/decidim/generators/app_templates/decidim_application.js
73
76
  - lib/decidim/generators/app_templates/decidim_application.scss
@@ -79,10 +82,14 @@ files:
79
82
  - lib/decidim/generators/app_templates/rack_profiler_initializer.rb
80
83
  - lib/decidim/generators/app_templates/secrets.yml.erb
81
84
  - lib/decidim/generators/app_templates/sidekiq.yml.erb
82
- - lib/decidim/generators/app_templates/social_share_button.rb
83
85
  - lib/decidim/generators/app_templates/storage.yml.erb
84
86
  - lib/decidim/generators/app_templates/verifications_initializer.rb
85
87
  - lib/decidim/generators/component_generator.rb
88
+ - lib/decidim/generators/component_templates/.eslintrc.json
89
+ - lib/decidim/generators/component_templates/.node-version
90
+ - lib/decidim/generators/component_templates/.rubocop.yml
91
+ - lib/decidim/generators/component_templates/.ruby-version
92
+ - lib/decidim/generators/component_templates/.stylelintrc.json
86
93
  - lib/decidim/generators/component_templates/Gemfile.erb
87
94
  - lib/decidim/generators/component_templates/LICENSE-AGPLv3.txt
88
95
  - lib/decidim/generators/component_templates/README.md.erb
@@ -94,12 +101,13 @@ files:
94
101
  - lib/decidim/generators/component_templates/app/packs/images/decidim/component/icon.svg
95
102
  - lib/decidim/generators/component_templates/app/packs/js/entrypoint.js
96
103
  - lib/decidim/generators/component_templates/app/packs/stylesheets/decidim/default.scss
104
+ - lib/decidim/generators/component_templates/app/permissions/decidim/component/admin/permissions.rb.erb
97
105
  - lib/decidim/generators/component_templates/bin/rails.erb
98
- - lib/decidim/generators/component_templates/circleci/config.yml
99
106
  - lib/decidim/generators/component_templates/config/assets.rb.erb
100
107
  - lib/decidim/generators/component_templates/config/i18n-tasks.yml.erb
101
108
  - lib/decidim/generators/component_templates/config/locales/en.yml.erb
102
109
  - lib/decidim/generators/component_templates/decidim-component.gemspec.erb
110
+ - lib/decidim/generators/component_templates/github/ci.yml.erb
103
111
  - lib/decidim/generators/component_templates/gitignore
104
112
  - lib/decidim/generators/component_templates/lib/decidim/component.rb.erb
105
113
  - lib/decidim/generators/component_templates/lib/decidim/component/admin.rb.erb
@@ -108,15 +116,23 @@ files:
108
116
  - lib/decidim/generators/component_templates/lib/decidim/component/engine.rb.erb
109
117
  - lib/decidim/generators/component_templates/lib/decidim/component/test/factories.rb.erb
110
118
  - lib/decidim/generators/component_templates/lib/decidim/component/version.rb.erb
119
+ - lib/decidim/generators/component_templates/package.json.erb
111
120
  - lib/decidim/generators/component_templates/spec/factories.rb.erb
121
+ - lib/decidim/generators/component_templates/spec/lib/version_spec.rb.erb
122
+ - lib/decidim/generators/component_templates/spec/permissions/admin/permissions_spec.rb.erb
112
123
  - lib/decidim/generators/component_templates/spec/spec_helper.rb.erb
113
124
  - lib/decidim/generators/install_generator.rb
114
125
  - lib/decidim/generators/test/generator_examples.rb
115
126
  - lib/decidim/generators/version.rb
116
- homepage: https://github.com/decidim/decidim
127
+ homepage: https://decidim.org
117
128
  licenses:
118
129
  - AGPL-3.0
119
- metadata: {}
130
+ metadata:
131
+ bug_tracker_uri: https://github.com/decidim/decidim/issues
132
+ documentation_uri: https://docs.decidim.org/
133
+ funding_uri: https://opencollective.com/decidim
134
+ homepage_uri: https://decidim.org
135
+ source_code_uri: https://github.com/decidim/decidim
120
136
  post_install_message:
121
137
  rdoc_options: []
122
138
  require_paths:
@@ -125,14 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
141
  requirements:
126
142
  - - ">="
127
143
  - !ruby/object:Gem::Version
128
- version: '3.0'
144
+ version: '3.1'
129
145
  required_rubygems_version: !ruby/object:Gem::Requirement
130
146
  requirements:
131
- - - ">="
147
+ - - ">"
132
148
  - !ruby/object:Gem::Version
133
- version: '0'
149
+ version: 1.3.1
134
150
  requirements: []
135
- rubygems_version: 3.2.22
151
+ rubygems_version: 3.4.20
136
152
  signing_key:
137
153
  specification_version: 4
138
154
  summary: Citizen participation framework for Ruby on Rails.