decidim 0.24.3 → 0.25.0.rc4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +28 -8
  3. data/babel.config.json +30 -0
  4. data/decidim-core/lib/decidim/webpacker/configuration.rb +89 -0
  5. data/decidim-core/lib/decidim/webpacker/postcss.config.js +16 -0
  6. data/decidim-core/lib/decidim/webpacker/runner.rb +24 -0
  7. data/decidim-core/lib/decidim/webpacker/webpack/base.js +6 -0
  8. data/decidim-core/lib/decidim/webpacker/webpack/custom.js +97 -0
  9. data/decidim-core/lib/decidim/webpacker/webpack/development.js +7 -0
  10. data/decidim-core/lib/decidim/webpacker/webpack/production.js +7 -0
  11. data/decidim-core/lib/decidim/webpacker/webpack/test.js +7 -0
  12. data/decidim-core/lib/decidim/webpacker/webpacker.yml +65 -0
  13. data/docs/README.adoc +1 -1
  14. data/docs/modules/configure/pages/initializer.adoc +31 -0
  15. data/docs/modules/customize/assets/images/modified_user_menu.png +0 -0
  16. data/docs/modules/customize/assets/images/original_user_menu.png +0 -0
  17. data/docs/modules/customize/pages/code.adoc +4 -1
  18. data/docs/modules/customize/pages/images.adoc +2 -2
  19. data/docs/modules/customize/pages/javascript.adoc +8 -3
  20. data/docs/modules/customize/pages/menu.adoc +56 -0
  21. data/docs/modules/customize/pages/styles.adoc +6 -3
  22. data/docs/modules/develop/pages/components.adoc +30 -0
  23. data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +175 -0
  24. data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +121 -0
  25. data/docs/modules/develop/pages/maps.adoc +2 -2
  26. data/docs/modules/develop/pages/newsletter_templates.adoc +1 -1
  27. data/docs/modules/develop/pages/releases.adoc +3 -1
  28. data/docs/modules/develop/pages/testing.adoc +11 -0
  29. data/docs/modules/develop/pages/view_models_aka_cells.adoc +1 -12
  30. data/docs/modules/install/pages/manual.adoc +46 -43
  31. data/docs/modules/services/pages/elections_bulletin_board.adoc +19 -16
  32. data/docs/modules/services/pages/social_providers.adoc +1 -1
  33. data/lib/decidim/gem_manager.rb +39 -18
  34. data/lib/decidim/version.rb +1 -1
  35. data/lib/decidim.rb +0 -4
  36. data/lib/tasks/decidim_tasks.rake +92 -0
  37. data/package-lock.json +36038 -0
  38. data/package.json +71 -0
  39. data/packages/browserslist-config/index.js +7 -0
  40. data/packages/browserslist-config/package.json +13 -0
  41. data/packages/core/node_modules/uuid/AUTHORS +5 -0
  42. data/packages/core/node_modules/uuid/CHANGELOG.md +119 -0
  43. data/packages/core/node_modules/uuid/LICENSE.md +21 -0
  44. data/packages/core/node_modules/uuid/README.md +276 -0
  45. data/packages/core/node_modules/uuid/bin/uuid +65 -0
  46. data/packages/core/node_modules/uuid/index.js +8 -0
  47. data/packages/core/node_modules/uuid/lib/bytesToUuid.js +26 -0
  48. data/packages/core/node_modules/uuid/lib/md5-browser.js +216 -0
  49. data/packages/core/node_modules/uuid/lib/md5.js +25 -0
  50. data/packages/core/node_modules/uuid/lib/rng-browser.js +34 -0
  51. data/packages/core/node_modules/uuid/lib/rng.js +8 -0
  52. data/packages/core/node_modules/uuid/lib/sha1-browser.js +89 -0
  53. data/packages/core/node_modules/uuid/lib/sha1.js +25 -0
  54. data/packages/core/node_modules/uuid/lib/v35.js +57 -0
  55. data/packages/core/node_modules/uuid/package.json +49 -0
  56. data/packages/core/node_modules/uuid/v1.js +109 -0
  57. data/packages/core/node_modules/uuid/v3.js +4 -0
  58. data/packages/core/node_modules/uuid/v4.js +29 -0
  59. data/packages/core/node_modules/uuid/v5.js +3 -0
  60. data/packages/core/package.json +53 -0
  61. data/packages/dev/package.json +15 -0
  62. data/packages/elections/package.json +17 -0
  63. data/packages/eslint-config/index.js +278 -0
  64. data/packages/eslint-config/package.json +24 -0
  65. data/packages/stylelint-config/index.js +160 -0
  66. data/packages/stylelint-config/package.json +16 -0
  67. data/packages/webpacker/index.js +6 -0
  68. data/packages/webpacker/package.json +50 -0
  69. data/packages/webpacker/src/override-config.js +52 -0
  70. metadata +92 -44
@@ -0,0 +1,175 @@
1
+ = Migrate to Webpacker an instance app
2
+
3
+ In order to migrate an existing Decidim app to Webpacker, there are a few changes your need to run in your code.
4
+
5
+ Disclaimer: this recipe might not work for all the cases, it tries to cover the generic scenarios. If you find yourself with a complex scenario and want to improve this guide feel free to open a PR to complete the guide.
6
+
7
+ == About Webpacker
8
+
9
+ It's recommended to understand how Webpacker works. More information:
10
+
11
+ * https://github.com/rails/webpacker#usage
12
+ * https://edgeguides.rubyonrails.org/webpacker.html
13
+
14
+ == Requirements
15
+
16
+ Before starting the migration, please check you have the following dependencies installed:
17
+
18
+ - Node.js version 16.9.x (this version is mandatory)
19
+ - Npm version 7.21.x (it works with other versions, but this is the recommended)
20
+
21
+ == Add Webpacker to the application
22
+
23
+ Follow the steps described https://github.com/rails/webpacker#installation[here]
24
+
25
+ - Install it
26
+
27
+ [source,console]
28
+ ----
29
+ bundle exec rails webpacker:install
30
+ ----
31
+
32
+ * Install Decidim webpacker custom code
33
+
34
+ [source,console]
35
+ ----
36
+ bundle exec rails decidim:webpacker:install
37
+ ----
38
+
39
+ This task do a few steps to allow the Rails instance to have a webpacker instance sharing the code between itself and Decidim gem.
40
+
41
+ This task is automatically performed every time decidim is updated, to get the latest Webpack configuration. This happens when you run the `decidim:upgrade` task.
42
+
43
+ == Copy Decidim custom CSS and Javascript
44
+
45
+ `webpacker:install` task should have created to you the following dirs structure:
46
+
47
+ [source,console]
48
+ ----
49
+ app/packs:
50
+ ├── entrypoints
51
+ └── src
52
+ └── stylesheets
53
+ └── images
54
+ ----
55
+
56
+ If it's not the case you must create it. Then, copy Decidim customizable assets
57
+
58
+ * Copy the file https://github.com/decidim/decidim/blob/develop/decidim-generators/lib/decidim/generators/app_templates/decidim_application.js[decidim_application.js] to `app/packs/src/decidim/decidim_application.js`
59
+ * Copy the file https://github.com/decidim/decidim/blob/develop/decidim-generators/lib/decidim/generators/app_templates/decidim_application.scss[decidim_application.scss] to `app/packs/stylesheets/decidim/decidim_application.scss`
60
+ * Copy the file https://github.com/decidim/decidim/blob/develop/decidim-generators/lib/decidim/generators/app_templates/_decidim-settings.scss[_decidim-settings.scss] to `app/packs/stylesheets/decidim/_decidim-settings.scss`
61
+
62
+ These files are hooked into Decidim packs (specifically into decidim-core pack) and will be automatically included inside that pack when compiled.
63
+
64
+ == Migrate images
65
+
66
+ Copy the existing images from `app/assets/images` to `app/packs/images`. Images will be available at `/media/images/image.png`
67
+
68
+ == Migrate stylesheets
69
+
70
+ Existing stylesheets should be moved from `app/assets/stylesheets` to `app/packs/stylesheets` and imported with `@import` into `decidim_application.scss`. Take into account that you might need to adjust a bit the paths of the `@import` to adjust them to the new locations.
71
+
72
+ If that CSS file is replacing a Decidim file, there's no need to add it to `decidim_application.scss`.
73
+
74
+ If any of the CSS is re-defining CSS vars add them to `_decidim-settings.scss`.
75
+
76
+ == Migrate javascripts
77
+
78
+ Existing javascripts should be moved from `app/assets/javascsripts` to `app/packs/src` and imported with `import` into `decidim_application.js`. Take into account that you might need to adjust a bit the paths of the `import` to adjust them to the new locations.
79
+
80
+ If that JS file is replacing a Decidim file, there's no need to add it to `decidim_application.js`
81
+
82
+ == Update Rails helpers
83
+
84
+ `javascript_include_tag` and `stylesheet_link_tag` have been replaced by `javascript_pack_tag` and `stylesheet_pack_tag`.
85
+
86
+ For images, if they are in `app/packs/images` you could use `image_pack_tag`.
87
+
88
+ == Migrate vendorized files and gems
89
+
90
+ Sometimes assets are included in `vendor/assets/` folder or imported from gems. For each specific one you should check:
91
+
92
+ 1. if the asset is a javascript that is available as npm package the recommendation is to add it to package.json with `npm install`. If it's not available you might want to copy it to `app/packs/src` and import it.
93
+ 2. if the asset is a stylesheet it should be copied to `app/packs/stylesheets` and imported with `@import...` from `_decidim-settings.scss`. Alternatively you can use the optional asset includes as described below to include these in the Decidim main SCSS files.
94
+
95
+ == Optional asset includes
96
+
97
+ Decidim Webpacker provides a new configuration convention that allows you to add extra configurations for webpacker using a configuration file named `config/assets.rb`. Within this file, you have the following API methods available:
98
+
99
+ [source,ruby]
100
+ ----
101
+ # frozen_string_literal: true
102
+ # This file is located at `config/assets.rb` of your module.
103
+
104
+ # Define the base path of your module. Please note that `Rails.root` may not be
105
+ # used because we are not inside the Rails environment when this file is loaded.
106
+ base_path = File.expand_path("..", __dir__)
107
+
108
+ # If you want to import some extra SCSS files in the Decidim main SCSS file
109
+ # without adding any extra stylesheet inclusion tags, you can use the following
110
+ # method to register the stylesheet import for the main application. This would
111
+ # include an SCSS file at `app/packs/stylesheets/your_app_extensions.scss` into
112
+ # the Decidim's main SCSS file.
113
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/your_app_extensions")
114
+
115
+ # If you want to do the same but include the SCSS file for the admin panel's
116
+ # main SCSS file, you can use the following method.
117
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/your_app_admin_extensions", group: :admin)
118
+ ----
119
+
120
+ == Remove Sprockets references
121
+
122
+ The completely remove Sprockets references from your application:
123
+
124
+ * Review your Gemfile and remove any reference to `sprockets` and `sassc-rails`
125
+ * Remove `config/initializers/assets.rb`
126
+ * Remove `app/assets` folder
127
+ * In `config/application.rb` replace:
128
+
129
+ [source,ruby]
130
+ ----
131
+ require 'rails/all'
132
+ ----
133
+
134
+ with:
135
+
136
+ [source,ruby]
137
+ ----
138
+ require "decidim/rails"
139
+ # Add the frameworks used by your app that are not loaded by Decidim.
140
+ # require "action_cable/engine"
141
+ # require "action_mailbox/engine"
142
+ # require "action_text/engine"
143
+ ----
144
+
145
+ * In `config/environments/*.rb` remove any line containing `config.assets.*` (i.e `config.assets.debug = true`)
146
+
147
+ == Deployment
148
+
149
+ The deployment needs to be updated to manually run `npm install` before assets are precompiled.
150
+
151
+ In the case of Capistrano this can be done with a before hook:
152
+
153
+ [source,ruby]
154
+ ----
155
+ namespace :deploy do
156
+ desc "Decidim webpacker configuration"
157
+ task :decidim_webpacker_install do
158
+ on roles(:all) do
159
+ within release_path do
160
+ with rails_env: fetch(:rails_env) do
161
+ execute "npm ci"
162
+ end
163
+ end
164
+ end
165
+ end
166
+
167
+ before "deploy:assets:precompile", "deploy:decidim_webpacker_install"
168
+ end
169
+ ----
170
+
171
+ Also, in the case of Capistrano it's interesting to add to the shared_paths the following folders:
172
+
173
+ * `tmp/webpacker-cache`
174
+ * `node_modules`
175
+ * `public/decidim-packs`
@@ -0,0 +1,121 @@
1
+ = Migrate to Webpacker a Decidim module
2
+
3
+ Decidim modules are included to Decidim apps as gems. Since the introduction of Webpacker to manage and compile assets in Decidim, there are some changes required to make modules compatible with Decidim
4
+
5
+ == About Webpacker
6
+
7
+ It's recommended to understand how Webpacker works. More information:
8
+
9
+ * https://github.com/rails/webpacker#usage
10
+ * https://edgeguides.rubyonrails.org/webpacker.html
11
+
12
+ == Overview
13
+
14
+ The recommended way to import assets from a gem in a Rails app using Webpacker is to publish a package in npmjs.org and include it in the package.json via `npm install`. Then the assets are available to Webpack via node_modules/ folder
15
+
16
+ Once created, you should update the instructions to install the module and add the step to add the assets with npm.
17
+
18
+ == Folder migration
19
+
20
+ It's recommend to migrate to the new folders structure:
21
+
22
+ ```
23
+ app/packs:
24
+ ├── entrypoints
25
+ └── src
26
+ └── stylesheets
27
+ └── images
28
+ ```
29
+
30
+ == Update Rails helpers
31
+
32
+ `javascript_include_tag` and `stylesheet_link_tag` have been replaced by `javascript_pack_tag` and `stylesheet_pack_tag`
33
+
34
+ For images, if they are in `app/packs/images` you could use `image_pack_tag`.
35
+
36
+ == Asset compilation
37
+
38
+ As all assets are now compiled using Webpacker without ever loading the Rails or Decidim environment, there are some new conventions how to tell Webpacker about the Decidim module's assets.
39
+
40
+ To begin with, create a new file named `config/assets.rb` inside your Decidim module.
41
+
42
+ After this, add the following contents in that file, depending what kind of assets your module provides:
43
+
44
+ [source,ruby]
45
+ ----
46
+ # frozen_string_literal: true
47
+ # This file is located at `config/assets.rb` of your module.
48
+
49
+ # Define the base path of your module. Please note that `Rails.root` may not be
50
+ # used because we are not inside the Rails environment when this file is loaded.
51
+ base_path = File.expand_path("..", __dir__)
52
+
53
+ # Register an additional load path for webpack. All the assets within these
54
+ # directories will be available for inclusion within the Decidim assets. For
55
+ # example, if you have `app/packs/src/decidim/foo.js`, you can include that file
56
+ # in your JavaScript entrypoints (or other JavaScript files within Decidim)
57
+ # using `import "src/decidim/foo"` after you have registered the additional path
58
+ # as follows.
59
+ Decidim::Webpacker.register_path("#{base_path}/app/packs")
60
+
61
+ # Register the entrypoints for your module. These entrypoints can be included
62
+ # within your application using `javascript_pack_tag` and if you include any
63
+ # SCSS files within the entrypoints, they become available for inclusion using
64
+ # `stylesheet_pack_tag`.
65
+ Decidim::Webpacker.register_entrypoints(
66
+ decidim_foo: "#{base_path}/app/packs/entrypoints/decidim_foo.js",
67
+ decidim_foo_admin: "#{base_path}/app/packs/entrypoints/decidim_foo_admin.js"
68
+ )
69
+
70
+ # If you want to import some extra SCSS files in the Decidim main SCSS file
71
+ # without adding any extra stylesheet inclusion tags, you can use the following
72
+ # method to register the stylesheet import for the main application.
73
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/app")
74
+
75
+ # If you want to do the same but include the SCSS file for the admin panel's
76
+ # main SCSS file, you can use the following method.
77
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/admin", group: :admin)
78
+
79
+ # If you want to override some SCSS variables/settings for Foundation from the
80
+ # module, you can add the following registered import.
81
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/settings", type: :settings)
82
+
83
+ # If you want to do the same but override the SCSS variables of the admin
84
+ # panel's styles, you can use the following method.
85
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/admin_settings", type: :settings, group: :admin)
86
+ ----
87
+
88
+ == Component stylesheet migration
89
+
90
+ In older Decidim versions your components could define their own stylesheet as follows:
91
+
92
+ [source,ruby]
93
+ ----
94
+ Decidim.register_component(:your_component) do |component|
95
+ component.engine = Decidim::YourComponent::Engine
96
+ component.stylesheet = "decidim/your_component/your_component"
97
+ component.admin_stylesheet = "decidim/your_component/your_component_admin"
98
+ end
99
+ ----
100
+
101
+ These were automatically included in the main application's stylesheet file and also in the admin panel's stylesheet file. These no longer work with Webpacker as the Decidim environment is not loaded when Webpacker compiles the assets.
102
+
103
+ What you should do instead is to follow the asset compilation migration guide above and migrate these definitions into your module's `config/assets.rb` file as follows:
104
+
105
+ [source,ruby]
106
+ ----
107
+ # frozen_string_literal: true
108
+ # This file is located at `config/assets.rb` of your module.
109
+
110
+ base_path = File.expand_path("..", __dir__)
111
+
112
+ # Register the additonal path for Webpacker in order to make the module's
113
+ # stylesheets available for inclusion.
114
+ Decidim::Webpacker.register_path("#{base_path}/app/packs")
115
+
116
+ # Register the main application's stylesheet include statement:
117
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/your_component/your_component")
118
+
119
+ # Register the admin panel's stylesheet include statement:
120
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/your_component/your_component_admin", group: :admin)
121
+ ----
@@ -186,7 +186,7 @@ module Decidim
186
186
  # autocompletion functionality in the front-end:
187
187
  class Builder < Decidim::Map::Autocomplete::Builder
188
188
  def javascript_snippets
189
- template.javascript_include_tag("decidim/geocoding/provider/your_provider")
189
+ template.javascript_pack_tag("decidim/geocoding/provider/your_provider")
190
190
  end
191
191
  end
192
192
  end
@@ -196,7 +196,7 @@ module Decidim
196
196
  end
197
197
  ----
198
198
 
199
- To see an example of the front-end JavaScript code that handles the geocoding requests, you can take a look at the link:/decidim-core/app/assets/javascripts/decidim/geocoding/provider/here.js.es6[HERE Maps example].
199
+ To see an example of the front-end JavaScript code that handles the geocoding requests, you can take a look at the link:/decidim-core/app/packs/src/decidim/geocoding/provider/here.js.es6[HERE Maps example].
200
200
  You will have to listen to the `geocoder-suggest.decidim` JavaScript event on all elements that have the `data-decidim-geocoding` attribute defined which contains all the configurations returned by the builder's `builder_options` method as mentioned above.
201
201
  For example, if you passed the following configuration from that method:
202
202
 
@@ -19,7 +19,7 @@ Decidim.content_blocks.register(:newsletter_template, :my_template) do |content_
19
19
  {
20
20
  name: :main_image,
21
21
  uploader: "Decidim::NewsletterTemplateImageUploader",
22
- preview: -> { ActionController::Base.helpers.asset_path("decidim/placeholder.jpg") }
22
+ preview: -> { ActionController::Base.helpers.asset_pack_path("media/images/placeholder.jpg") }
23
23
  }
24
24
  ]
25
25
 
@@ -74,9 +74,11 @@ Running it as is, or passing it the `--help` flag, will render the help section
74
74
  bin/changelog_generator <GITHUB_TOKEN> <SHA>
75
75
  ----
76
76
 
77
+ This command will create a `temporary_changelog.md` in the root of the project, so you can inspect this file and generated changelog.
78
+
77
79
  If you have some elements in the `Unsorted` section of the output, you can review the PRs individually, fix the title and the tags and rerun the script. Those PRs with the tags fixed will be automatically sorted. Labelling the PRs as they're opened or merged is encouraged to save some time when producing the changelog.
78
80
 
79
- You can copy-paste the output of the command to the relevant sections of the changelog file.
81
+ You can copy-paste the contents of the temporary changelog file to the relevant sections of the Changelog file.
80
82
 
81
83
  == Release Candidates
82
84
 
@@ -47,3 +47,14 @@ bundle exec rake test_all
47
47
  ----
48
48
 
49
49
  But beware, it takes a long time... :)
50
+
51
+ == Continuous integration
52
+
53
+ The tests are also run when a new commit is added to the `develop` or releases
54
+ branches, or added to a Pull Request. In the latter case, only the tests for
55
+ the modules affected by any the PR commits will be executed.
56
+
57
+ This means that the workflows defined for each module in the folder
58
+ `.github/workflows/` should be always updated with the module's dependencies
59
+ list. The script `.github/workflows/dependencies.sh` can be helpful to keep
60
+ those files updated until we have an automatic process to do it.
@@ -29,21 +29,10 @@ The `label` option accepts this arguments:
29
29
 
30
30
  == Introducing a Card Cell to a `component`
31
31
 
32
- * add *dependency* to "decidim-*.gemspec"
32
+ * Add the module cell paths to cell view paths in `decidim-<module>/lib/decidim/<module>/engine.rb`
33
33
  +
34
34
  [source,rb]
35
35
  ----
36
- s.add_dependency "cells-erb", "~> 0.1.0"
37
- s.add_dependency "cells-rails", "~> 0.0.9"
38
- ----
39
-
40
- * *require* cells in `decidim-<module>/lib/decidim/<module>/engine.rb`
41
- +
42
- [source,rb]
43
- ----
44
- require "cells/rails"
45
- require "cells-erb"
46
-
47
36
  initializer "decidim_<module>.add_cells_view_paths" do
48
37
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::<Module>::Engine.root}/app/cells")
49
38
  Cell::ViewModel.view_paths << File.expand_path("#{Decidim::<Module>::Engine.root}/app/views") # for partials
@@ -1,40 +1,39 @@
1
1
  = Manual installation tutorial
2
2
 
3
- == Step by step
4
-
5
3
  In order to develop on decidim, you'll need:
6
4
 
7
5
  * *Git* 2.15+
8
- * *PostgreSQL* 9.5+
9
- * *Ruby* 2.5.0 (2.3+ should work just fine, but that's the version we test against)
10
- * *NodeJS* 9.x.x
6
+ * *PostgreSQL* 12.7+
7
+ * *Ruby* 2.7.1
8
+ * *NodeJS* 16.9.x
9
+ * *Npm* 7.21.x
11
10
  * *ImageMagick*
12
11
  * *Chrome* browser and https://sites.google.com/a/chromium.org/chromedriver/[chromedriver].
13
12
 
14
- We're starting with an Ubuntu 16.04 LTS. This is an opinionated guide and YMMV, so if you're free to use the technology that you fell most comfortable on. If you have any doubts and you're blocked you can go and ask on https://gitter.im/decidim/decidim[our Gitter]. We recommend that you follow some Ruby on Rails tutorials (like http://guides.rubyonrails.org/getting_started.html[Getting Started with Ruby on Rails]) and have some knowledge on how gems and engines work.
13
+ We're starting with an Ubuntu 20.04 LTS. This is an opinionated guide, so you're free to use the technology that you are most comfortable. If you have any doubts and you're blocked you can go and ask on https://gitter.im/decidim/decidim[our Gitter].
14
+
15
+ We recommend to have at least some basic proficiency in Ruby on Rails (a good starting point is http://guides.rubyonrails.org/getting_started.html[Getting Started with Ruby on Rails]) and have some knowledge on how gems work.
15
16
 
16
- On this tutorial we'll see how to install rbenv, PostgreSQL and Decidim, and how to configure everything together.
17
+ In this guide, we'll see how to install rbenv, PostgreSQL and, Decidim, and how to configure everything together.
17
18
 
18
- === Installing rbenv
19
+ == 1. Installing rbenv
19
20
 
20
- First we're going to install rbenv, for managing various ruby versions. We're following the guide from https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-16-04[DigitalOcean]. You could also use https://rvm.io/[rvm] as an alternative on this step. On these instruction we're using the latest ruby published version at the moment (2.5.3), but you should check this out on https://www.ruby-lang.org/en/downloads/[Ruby official website].
21
+ First, we're going to install https://github.com/rbenv/rbenv[rbenv], for managing various ruby versions. You could also use https://rvm.io/[rvm] or https://github.com/asdf-vm/asdf[asdf] as alternatives on this step. Mind that at the moment, Decidim isn't compatible with Ruby 3.0.
21
22
 
22
23
  [source,bash]
23
24
  ----
24
25
  sudo apt update
25
- sudo apt install -y build-essential autoconf bison libssl-dev libyaml-dev libreadline-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev libicu-dev
26
+ sudo apt install -y build-essential git libssl-dev zlib1g-dev
26
27
  git clone https://github.com/rbenv/rbenv.git ~/.rbenv
27
28
  echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
28
29
  echo 'eval "$(rbenv init -)"' >> ~/.bashrc
29
30
  source ~/.bashrc
30
31
  git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
31
- rbenv install 2.5.3
32
- rbenv global 2.5.3
33
- echo "gem: --no-document" > ~/.gemrc
34
- gem install bundler
32
+ rbenv install 2.7.1
33
+ rbenv global 2.7.1
35
34
  ----
36
35
 
37
- === Installing PostgreSQL
36
+ == 2. Installing PostgreSQL
38
37
 
39
38
  Now we're going to install PostgreSQL for the database:
40
39
 
@@ -44,20 +43,19 @@ sudo apt install -y postgresql libpq-dev
44
43
  sudo -u postgres psql -c "CREATE USER decidim_app WITH SUPERUSER CREATEDB NOCREATEROLE PASSWORD 'thepassword'"
45
44
  ----
46
45
 
47
- You need to change the password (on this example is "thepassword") and save it somewhere to configure it later with the application.
46
+ You need to change the password (in this example is "thepassword") and save it somewhere to configure it later with the application.
48
47
 
49
- === Installing Decidim
48
+ == 3. Installing Decidim
50
49
 
51
- Next, we need to install the `decidim` gem:
50
+ Next, we need to install the `decidim` gem with its dependencies:
52
51
 
53
52
  [source,bash]
54
53
  ----
55
- gem install bootsnap
56
- gem install listen
54
+ sudo apt install -y libicu-dev nodejs imagemagick
57
55
  gem install decidim
58
56
  ----
59
57
 
60
- Afterwards, we can create an application with the nice `decidim` executable, where `decidim_application` is your application name (ie decidim.barcelona):
58
+ Then we can create an application with the `decidim` executable, where `decidim_application` is your application name (ie DecidimBarcelona):
61
59
 
62
60
  [source,bash]
63
61
  ----
@@ -69,13 +67,13 @@ We recommend that you save it all on Git.
69
67
 
70
68
  [source,bash]
71
69
  ----
72
- git init .
73
- git commit -m "Initial commit. Generated with Decidim 0.X https://decidim.org"
70
+ git add .
71
+ git commit -m "Initial commit. Generated with Decidim https://decidim.org"
74
72
  ----
75
73
 
76
- === Configure the database
74
+ == 4. Configure the database
77
75
 
78
- You need to modify your secrets (see `config/database.yml`). For this you can use https://github.com/laserlemon/figaro[figaro], https://github.com/bkeepers/dotenv[dotenv] or https://github.com/rbenv/rbenv-vars[rbenv-vars]. You should always be careful of not uploading your plain secrets on git or your version control system. You can also upload the encrypted secrets, using the sekrets gem or if you're on Ruby on Rails greater than 5.1 you can do it natively.
76
+ Modify your secrets (see `config/database.yml`). For this you can use https://github.com/laserlemon/figaro[figaro], https://github.com/bkeepers/dotenv[dotenv] or https://github.com/rbenv/rbenv-vars[rbenv-vars]. You should always be careful of not uploading your plain secrets on git or your version control system. You can also upload the encrypted secrets, using the sekrets gem or if you're on Ruby on Rails greater than 5.1 you can do it natively.
79
77
 
80
78
  For instance, for working with figaro, add this to your `Gemfile`:
81
79
 
@@ -92,13 +90,13 @@ bundle install
92
90
  bundle exec figaro install
93
91
  ----
94
92
 
95
- Next add this to your `config/application.yml`, using the setup the PostgreSQL database name, user and password that you configure before.
93
+ Next, add this to your `config/application.yml`, using the setup PostgreSQL database name, user and, password that you've configured before.
96
94
 
97
95
  [source,yaml]
98
96
  ----
99
97
  DATABASE_HOST: localhost
100
98
  DATABASE_USERNAME: decidim_app
101
- DATABASE_PASSWORD: your_password
99
+ DATABASE_PASSWORD: thepassword
102
100
  ----
103
101
 
104
102
  Finally, save it all to git:
@@ -106,12 +104,12 @@ Finally, save it all to git:
106
104
  [source,bash]
107
105
  ----
108
106
  git add .
109
- git commit -m "Adds figaro configuration management"
107
+ git commit -m "Add figaro configuration management"
110
108
  ----
111
109
 
112
- === Initializing your app for local development
110
+ == 5. Initializing your app for local development
113
111
 
114
- We should now setup your database:
112
+ We should now create your database:
115
113
 
116
114
  [source,bash]
117
115
  ----
@@ -119,29 +117,34 @@ bin/rails db:create db:migrate
119
117
  bin/rails db:seed
120
118
  ----
121
119
 
122
- This will also create some default data so you can start testing the app:
120
+ This will also create some default data so you can start testing the app, with an administrator account with email admin@example.org and password `decidim123456`
123
121
 
124
- * A `Decidim::System::Admin` with email `system@example.org` and password `decidim123456`, to log in at `/system`.
125
- * A `Decidim::Organization` named `Decidim Staging`. You probably want to change its name and hostname to match your needs.
126
- * A `Decidim::User` acting as an admin for the organization, with email `admin@example.org` and password `decidim123456`.
127
- * A `Decidim::User` that also belongs to the organization but it's a regular user, with email `user@example.org` and password `decidim123456`.
122
+ == 6. Start your web server
128
123
 
129
- This data won't be created in production environments, if you still want to do it, run:
124
+ You can now start your server!
130
125
 
131
126
  [source,bash]
132
127
  ----
133
- SEED=true rails db:setup
128
+ bin/rails s
134
129
  ----
135
130
 
136
- ==== Notes
131
+ Visit http://localhost:3000 to see your app running. 🎉 🎉
137
132
 
138
- When you run `bin/rails db:migrate` you should see a lot of output. If you don't, or if you run into errors seeding your database, try runnning `bin/rake decidim:upgrade` before.
133
+ [NOTE]
134
+ ====
135
+ With these steps you would only have an initial installation for trying Decidim, but it still needs lots of things to take in account. If you want a working production system then we recommend that you follow the https://platoniq.github.io/decidim-install/[Decidim Install guide by Platoniq].
136
+ ====
139
137
 
140
- You can now start your server!
138
+ == Extra notes
139
+
140
+ Other user accounts that you'll have in the seeds are:
141
+
142
+ * To participate as a regular user, with email `user@example.org` and password `decidim123456`.
143
+ * To manage the Multitenant and being able to log in at `/system`, with email `system@example.org` and password `decidim123456`.
144
+
145
+ The seed data won't be created in production environments, if you still want to do it (for instance, for a Demo or Staging server), run:
141
146
 
142
147
  [source,bash]
143
148
  ----
144
- bin/rails s
149
+ SEED=true rails db:seed
145
150
  ----
146
-
147
- Visit http://localhost:3000 to see your app running. 🎉 🎉
@@ -5,11 +5,13 @@
5
5
  This is a work in progress and is not fully working yet.
6
6
  ====
7
7
 
8
- In order to celebrate https://en.wikipedia.org/wiki/End-to-end_auditable_voting_systems[End-to-end auditable votings] using the Elections module, you will need to connect your Decidim instance with an instance of the https://github.com/decidim/decidim-bulletin-board/[Decidim Bulletin Board application], preferably run by an independent organization.
8
+ In order to celebrate https://en.wikipedia.org/wiki/End-to-end_auditable_voting_systems[End-to-end auditable votings] using the Elections module, you will need to connect your Decidim instance with an instance of the https://github.com/decidim/decidim-bulletin-board/[Decidim Bulletin Board application].
9
+
10
+ *Note*: The connected Bulletin Board instance is used by all organizations, therefore it's recommended to set it up by an independent organization.
9
11
 
10
12
  == Identification pair of keys generation
11
13
 
12
- The first step needed to setup the connection is to generate an a pair of keys to identify the application against the Bulletin Board.
14
+ The first step needed to setup the connection is to generate a pair of keys to identify the application against the Bulletin Board.
13
15
  This can be done running the following rake task in your application environment:
14
16
 
15
17
  [source,sh]
@@ -17,32 +19,33 @@ This can be done running the following rake task in your application environment
17
19
  bundle exec rake decidim_elections:generate_identification_keys
18
20
  ----
19
21
 
20
- This task will output the generated private and public keys. You should copy the public key and send it to the Bulletin Board administrator through a secure channel. Together with the key, send your *Authority name* to the Bulletin Board administrator and store its value on the environment variable `BULLETIN_BOARD_AUTHORITY_NAME`.
22
+ This task will output the generated private and public keys. You should copy the public key and send it, together with your *Authority name* to the Bulletin Board administrator through a secure channel. Together with the key, send your *Authority name* to the Bulletin Board administrator.
23
+
24
+ After that, copy the private key and store that value on the environment variable `AUTHORITY_PRIVATE_KEY` and your *Authority name* on the variable `AUTHORITY_NAME`.
21
25
 
22
- After that, copy the private key and store that value on the environment variable `BULLETIN_BOARD_IDENTIFICATION_PRIVATE_KEY`.
26
+ Ensure that the private key is not lost between deployments and servers reboots and that it can only be accessed by the application.
23
27
 
24
- Ensure that the private key is not lost between deployments and servers reboots and that only can be accessed by the application.
28
+ As an administrator of the Bulletin Board, you find the steps to be taken https://github.com/decidim/decidim-bulletin-board/blob/develop/decidim-bulletin_board-app/docs/setup.md#adding-an-authority-as-a-client-of-the-bulletin-board[here].
25
29
 
26
30
  == Configuration of the Bulletin Board application
27
31
 
28
32
  The Bulletin Board administrator will store the received public key in their server and will send you back an API key.
29
- To complete the setup process you should store this API key and the Bulletin Board URL address on the environment variables `BULLETIN_BOARD_API_KEY` and `BULLETIN_BOARD_SERVER`, respectively.
33
+ To complete the setup process you should store this API key and the Bulletin Board URL address on the environment variables `AUTHORITY_API_KEY` and `BULLETIN_BOARD_SERVER`, respectively.
30
34
 
31
35
  The following YAML snippet with all the defined environment variables should be used in the `default` block of your application `config/secrets.yml` file.
32
36
  Maybe this is already done, as it was included in the Decidim applications generator during the development of the Elections module.
33
37
 
34
38
  [source,yaml]
35
39
  ----
36
- bulletin_board:
37
- identification_private_key: <%= ENV["BULLETIN_BOARD_IDENTIFICATION_PRIVATE_KEY"] %>
38
- server: <%= ENV["BULLETIN_BOARD_SERVER"] %>
39
- api_key: <%= ENV["BULLETIN_BOARD_API_KEY"] %>
40
- number_of_trustees: <%= ENV["BULLETIN_BOARD_NUMBER_OF_TRUSTEES"] %>
41
- authority_name: <%= ENV["BULLETIN_BOARD_AUTHORITY_NAME"] %>
42
- scheme:
43
- name: <%= ENV["BULLETIN_BOARD_SCHEME_NAME"] %>
44
- parameters:
45
- quorum: <%= ENV["BULLETIN_BOARD_SCHEME_QUORUM"] %>
40
+ elections:
41
+ bulletin_board_server: <%= ENV["BULLETIN_BOARD_SERVER"] %>
42
+ bulletin_board_public_key: <%= ENV["BULLETIN_BOARD_PUBLIC_KEY"] %>
43
+ authority_api_key: <%= ENV["AUTHORITY_API_KEY"] %>
44
+ authority_name: <%= ENV["AUTHORITY_NAME"] %>
45
+ authority_private_key: <%= ENV["AUTHORITY_PRIVATE_KEY"] %>
46
+ scheme_name: <%= ENV["ELECTIONS_SCHEME_NAME"] %>
47
+ number_of_trustees: <%= ENV["ELECTIONS_NUMBER_OF_TRUSTEES"] %>
48
+ quorum: <%= ENV["ELECTIONS_QUORUM"] %>
46
49
  ----
47
50
 
48
51
  After restarting the Decidim instance, administrator users will be able to create elections on the configured Bulletin Board.
@@ -82,7 +82,7 @@ Instructions in how to configure the client applications can be found in the mod
82
82
  * Or you can create a new strategy, as the https://github.com/decidim/omniauth-decidim[Decidim OmniAuth Strategy]. This strategy allow users from a Decidim instance to login in other Decidim instance. For example, this strategy is used to allow https://decidim.barcelona[decidim.barcelona] users to log into https://meta.decidim.barcelona[meta.decidim.barcelona].
83
83
  * Once you have defined your strategy, you can configure it in the `config/secrets.yml` or in the organization configuration, as it is done for the built-in providers.
84
84
  * By default, Decidim will search in its icons library for an icon named as the provider. You can change this adding an `icon` or `icon_path` attribute to the provider configuration. The `icon` attribute sets the icon name to look for in the Decidim's icons library. The `icon_path` attribute sets the route to the image that should be used.
85
- * Here is an example of the configuration section for the Decidim strategy, using an icon located on the application's `app/assets/images` folder:
85
+ * Here is an example of the configuration section for the Decidim strategy, using an icon located on the application's `app/packs/images` folder:
86
86
 
87
87
  [source,yaml]
88
88
  ----