decidim 0.10.1 → 0.11.0.pre1
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.
- checksums.yaml +4 -4
- data/README.md +8 -7
- data/Rakefile +17 -31
- data/docs/add_authenticable_action.md +12 -5
- data/docs/adding_fixtures_aka_dummy_content.md +4 -2
- data/docs/advanced/components.md +60 -0
- data/docs/advanced/content_processors.md +20 -0
- data/docs/advanced/followers.md +2 -2
- data/docs/advanced/view_models_aka_cells.md +91 -0
- data/docs/checklist.md +47 -0
- data/docs/customization/code.md +5 -3
- data/docs/customization/gemfile.md +2 -2
- data/docs/customization/javascript.md +1 -1
- data/docs/customization/oauth.md +23 -0
- data/docs/customization/styles.md +3 -7
- data/docs/data-picker.md +10 -3
- data/docs/getting_started.md +60 -25
- data/docs/services/analytics.md +1 -1
- data/docs/services/geocoding.md +4 -4
- data/docs/services/social_providers.md +26 -26
- data/lib/decidim.rb +2 -0
- data/lib/decidim/{component_manager.rb → gem_manager.rb} +49 -4
- data/lib/decidim/version.rb +1 -1
- metadata +82 -55
- data/Gemfile +0 -26
- data/Gemfile.lock +0 -606
- data/bin/decidim +0 -6
- data/docs/advanced/features.md +0 -60
- data/lib/generators/decidim/app_generator.rb +0 -159
- data/lib/generators/decidim/install_generator.rb +0 -138
- data/lib/generators/decidim/templates/Dockerfile.erb +0 -1
- data/lib/generators/decidim/templates/README.md.erb +0 -22
- data/lib/generators/decidim/templates/cable.yml.erb +0 -9
- data/lib/generators/decidim/templates/carrierwave.rb +0 -28
- data/lib/generators/decidim/templates/database.yml.erb +0 -87
- data/lib/generators/decidim/templates/decidim.scss.erb +0 -3
- data/lib/generators/decidim/templates/decidim_controller.rb.erb +0 -5
- data/lib/generators/decidim/templates/docker-compose.yml.erb +0 -26
- data/lib/generators/decidim/templates/example_authorization_handler.rb +0 -55
- data/lib/generators/decidim/templates/initializer.rb +0 -47
- data/lib/generators/decidim/templates/secrets.yml.erb +0 -61
- data/lib/generators/decidim/templates/social_share_button.rb +0 -8
@@ -1,8 +1,8 @@
|
|
1
1
|
# Gemfile
|
2
2
|
|
3
|
-
You can add and change your Gemfile as you want, this is a classic Ruby on Rails application. For example to add[
|
3
|
+
You can add and change your Gemfile as you want, this is a classic Ruby on Rails application. For example to add [rails-footnotes](https://github.com/josevalim/rails-footnotes) gem you would just add:
|
4
4
|
|
5
|
-
```
|
5
|
+
```ruby
|
6
6
|
gem 'rails-footnotes', '~> 4.0'
|
7
7
|
```
|
8
8
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# OAuth
|
2
|
+
|
3
|
+
Decidim is both and OAuth client (via [omniauth](https://github.com/omniauth/omniauth)) and an OAuth provider (via [doorkeeper](https://github.com/doorkeeper-gem/doorkeeper)).
|
4
|
+
|
5
|
+
Check the [Social Providers](https://github.com/decidim/decidim/blob/master/docs/services/social_providers.md) document to check the client configuration.
|
6
|
+
|
7
|
+
## Decidim as an OAuth provider
|
8
|
+
|
9
|
+
You can use your own Decidim application to log in to other applications that support OAuth 2. To do it you need to create an OAuth application from the admin panel for each client that wants to use Decidim.
|
10
|
+
|
11
|
+
To create a new OAuth application you need:
|
12
|
+
|
13
|
+
* Name: The name of the client application that will be shown to the user when authorizing it from your Decidim application.
|
14
|
+
* Redirect URI: The URI where the Decidim application should redirect the user after authorizing it. It is usually where you handle the OAUth callback in your client application. If you're using `omniauth-decidim` the value should be `YOUR_APPLICATION_HOST/users/auth/decidim/callback`.
|
15
|
+
* Organization name: The name of the organization that owns the client application.
|
16
|
+
* Organization URL: The URL of the organization that owns the client application.
|
17
|
+
* Organization logo: An image of the logo of the organization that owns the client application.
|
18
|
+
|
19
|
+
All the organization data will be used during the authorization process so the users know to who they're giving their data.
|
20
|
+
|
21
|
+
Once you've created your application you'll get the settings to setup your client.
|
22
|
+
|
23
|
+
Check [omniauth-decidim](https://github.com/decidim/omniauth-decidim) in order to configure your client application.
|
@@ -2,14 +2,10 @@
|
|
2
2
|
|
3
3
|
One of the first things you’ll want to do after you install Decidim is applying your own corporative image. To do this, you can go to app/assets/stylesheets/application.css.sass on your generated application with your own colors. There you can override any class using CSS with SASS.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Also you can check your scss files syntax with
|
5
|
+
In [decidim-core/app/assets/stylesheets/decidim/_variables.scss](https://github.com/decidim/decidim/blob/master/decidim-core/app/assets/stylesheets/decidim/_variables.scss) you can find the `variables` that can be overriden in your `sass`.
|
8
6
|
|
9
|
-
|
10
|
-
scss-lint
|
11
|
-
```
|
7
|
+
We use [SASS, with SCSS syntax](http://sass-lang.com/guide) as CSS preprocessor.
|
12
8
|
|
13
9
|
## **Accesibility**
|
14
10
|
|
15
|
-
To maintain accesibility level, if you add new colors use a[
|
11
|
+
To maintain accesibility level, if you add new colors use a [Color contrast checker](http://webaim.org/resources/contrastchecker/) (WCAG AA is mandatory, WCAG AAA is recommended)
|
data/docs/data-picker.md
CHANGED
@@ -7,14 +7,19 @@ Current Decidim's selector is inspired on [this](https://medium.com/@mibosc/resp
|
|
7
7
|
Data Picker is a selector thought to be reusable in many contexts and kinds of data. The idea behind it is a reusable widget that opens a popup where the user will perform a given selection and, on finish, this selection is returned to the source widget in the main page. The popup is accompained by a semitransparent layer behind it to blur the background and keep the user concentrated in the current action, the selection.
|
8
8
|
|
9
9
|
## Artifacts
|
10
|
+
|
10
11
|
Data Picker is composed by 2 visual artifacts, plus the javascript and one controller action for each selection type:
|
12
|
+
|
11
13
|
- **widget**: the first visual artifact is the widget that encapsulates the main Data Picker functionality. This widget manages the rendering of __the button__ that opens the selector and __the popup__. This button is managed via ujs (Unobtrusive JavaScript). The popup is empty and must be filled with a selection partial.
|
12
14
|
- **selection functionality** partial: There are many ways to select things (and many kinds of things to select). Thus, the selection functionality can be customized via a selection partial which will be rendered inside the widget's popup. This partial is supplied to the widget via ajax.
|
13
15
|
- **controller ajax action**: An ajax action will send the content of the popup in an html partial.
|
14
16
|
|
15
17
|
## How to
|
16
|
-
|
18
|
+
|
19
|
+
### Placing the Data Picker widget
|
20
|
+
|
17
21
|
The Data Picker widget structure is as follows:
|
22
|
+
|
18
23
|
```html
|
19
24
|
<div id="some-unique-id" class="data-picker <%= picker_options[:class]%>" data-picker-name="<%=picker_options[:name]%>">
|
20
25
|
<div class="picker-values"><% @form.proposals.each do |proposal, params| %>
|
@@ -27,13 +32,14 @@ The Data Picker widget structure is as follows:
|
|
27
32
|
Placing the widget in a form requires two steps:
|
28
33
|
|
29
34
|
It is a good way to implement the widget to think that it is a component that takes parameters.
|
35
|
+
|
30
36
|
1. Prepare Data Picker parameters
|
31
|
-
Data Picker takes two arguments the `picker_params` hash (to fill the main div) and the `prompt_params` hash (for the `picker-prompt` div).
|
37
|
+
Data Picker takes two arguments the `picker_params` hash (to fill the main div) and the `prompt_params` hash (for the `picker-prompt` div).
|
32
38
|
- `picker_params.id`: the html unique id of the widget instance, required by the JavaScript.
|
33
39
|
- `picker_params.name`: the html name of the widget which will be sent by the form.
|
34
40
|
- `picker_params.class`: one of `picker-multiple`, when user can select multiple data, or `picker-single`, when only one data is to be selected.
|
35
41
|
|
36
|
-
|
42
|
+
1. Html for the Data Picker widget
|
37
43
|
|
38
44
|
### Selector popup content
|
39
45
|
|
@@ -45,4 +51,5 @@ picker-value: the selected value
|
|
45
51
|
picker-text (optional): The text to be shown in the picker button.
|
46
52
|
|
47
53
|
### Returning the selection to the widget
|
54
|
+
|
48
55
|
To return the selection to the widget in the main page use javascript to set the data-picker-value in the #proposal-picker-choose button.
|
data/docs/getting_started.md
CHANGED
@@ -16,7 +16,7 @@ If you want to start your own installation of Decidim, you don't need to clone t
|
|
16
16
|
|
17
17
|
We've made an script for Ubuntu 16.04 LTS and macos sierra 10.2. It's a BETA and as such you should be aware that this could break your environment (if you have any). It'll install rbenv, postgresql, nodejs and install decidim on this directory. It should take 15 minutes depending on your network connection.
|
18
18
|
|
19
|
-
```
|
19
|
+
```console
|
20
20
|
wget http://get.decidim.org -O install_decidim.bash
|
21
21
|
bash install_decidim.bash
|
22
22
|
```
|
@@ -25,28 +25,55 @@ Read more about the [installation script](https://github.com/alabs/decidim-insta
|
|
25
25
|
|
26
26
|
### B. Using Docker [experimental]
|
27
27
|
|
28
|
-
|
28
|
+
You can also use [docker] && [docker-compose] to develop decidim. You'll
|
29
|
+
need to install those but in exchange you don't need to install any other
|
30
|
+
dependency in your computer, not even Ruby!
|
29
31
|
|
30
|
-
|
32
|
+
To get started, first clone the decidim repo
|
31
33
|
|
34
|
+
```console
|
35
|
+
git clone https://github.com/decidim/decidim
|
32
36
|
```
|
33
|
-
|
37
|
+
|
38
|
+
Switch to the cloned folder
|
39
|
+
|
40
|
+
```console
|
41
|
+
cd decidim
|
34
42
|
```
|
35
43
|
|
36
|
-
|
44
|
+
Then create a development application
|
45
|
+
|
46
|
+
```console
|
47
|
+
d/bundle install
|
48
|
+
d/rake development_app
|
49
|
+
cd development_app
|
50
|
+
bin/rails server
|
51
|
+
```
|
37
52
|
|
53
|
+
In general, to use the docker development environment, change any instruction in
|
54
|
+
the docs to use its equivalent docker binstub. So for example, instead of
|
55
|
+
running `bundle install`, you would run `d/bundle install`.
|
38
56
|
|
39
57
|
### C. Step by step
|
40
58
|
|
59
|
+
In order to develop on decidim, you'll need:
|
60
|
+
|
61
|
+
* **Git** 2.15+
|
62
|
+
* **PostgreSQL** 9.4+
|
63
|
+
* **Ruby** 2.5.0 (2.3+ should work just fine, but that's the version we test against)
|
64
|
+
* **NodeJS** 9.x.x
|
65
|
+
* **ImageMagick**
|
66
|
+
* **Chrome** browser and [chromedriver](https://sites.google.com/a/chromium.org/chromedriver/).
|
67
|
+
|
41
68
|
First of all, you need to install the `decidim` gem:
|
42
69
|
|
43
|
-
```
|
70
|
+
```console
|
44
71
|
gem install decidim
|
45
72
|
```
|
46
73
|
|
47
74
|
afterwards, you can create an application with the nice `decidim` executable:
|
48
75
|
|
49
|
-
```
|
76
|
+
```console
|
50
77
|
decidim decidim_application
|
51
78
|
cd decidim_application
|
52
79
|
bundle install
|
@@ -57,8 +84,8 @@ rails server
|
|
57
84
|
|
58
85
|
You should now setup your database:
|
59
86
|
|
60
|
-
```
|
61
|
-
|
87
|
+
```console
|
88
|
+
bin/rails db:create db:migrate db:seed
|
62
89
|
```
|
63
90
|
|
64
91
|
This will also create some default data so you can start testing the app:
|
@@ -67,12 +94,13 @@ This will also create some default data so you can start testing the app:
|
|
67
94
|
* A `Decidim::Organization` named `Decidim Staging`. You probably want to change its name and hostname to match your needs.
|
68
95
|
* A `Decidim::User` acting as an admin for the organization, with email `admin@example.org` and password `decidim123456`.
|
69
96
|
* A `Decidim::User` that also belongs to the organization but it's a regular user, with email `user@example.org` and password `decidim123456`.
|
97
|
+
|
70
98
|
This data won't be created in production environments, if you still want to do it, run: ``` $ SEED=true rails db:setup ```
|
71
99
|
|
72
100
|
You can now start your server!
|
73
101
|
|
74
|
-
```
|
75
|
-
|
102
|
+
```console
|
103
|
+
bin/rails s
|
76
104
|
```
|
77
105
|
|
78
106
|
Visit [http://localhost:3000](http://localhost:3000) to see your app running.
|
@@ -81,12 +109,12 @@ Visit [http://localhost:3000](http://localhost:3000) to see your app running.
|
|
81
109
|
|
82
110
|
Decidim comes pre-configured with some safe defaults, but can be changed through the `config/initializers/decidim.rb` file in your app. Check the comments there or read the comments in [the source file](https://github.com/decidim/decidim/blob/master/decidim-core/lib/decidim/core.rb) (the part with the `config_accessor` calls) for more up-to-date info.
|
83
111
|
|
84
|
-
We also have other guides on how to configure some extra
|
112
|
+
We also have other guides on how to configure some extra components:
|
85
113
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
114
|
+
* [ActiveJob](https://github.com/decidim/decidim/blob/master/docs/services/activejob.md)
|
115
|
+
* [Analytics](https://github.com/decidim/decidim/blob/master/docs/services/analytics.md): How to enable analytics
|
116
|
+
* [Geocoding](https://github.com/decidim/decidim/blob/master/docs/services/geocoding.md): How to enable geocoding for proposals and meetings
|
117
|
+
* [Social providers integration](https://github.com/decidim/decidim/blob/master/docs/services/social_providers.md): Enable sign up from social networks.
|
90
118
|
|
91
119
|
## Deploy
|
92
120
|
|
@@ -109,8 +137,8 @@ You can check the [`decidim-system` README file](https://github.com/decidim/deci
|
|
109
137
|
|
110
138
|
If you want, you can create seed data in production. Run this command in your production console:
|
111
139
|
|
112
|
-
```
|
113
|
-
|
140
|
+
```console
|
141
|
+
SEED=true rails db:seed
|
114
142
|
```
|
115
143
|
|
116
144
|
You'll need to login as system user and edit the host for the organization. Set it to you production host, without the protocol and the port (so if your host is `https://my.host:3001`, you need to write `my.host`).
|
@@ -119,23 +147,30 @@ You'll need to login as system user and edit the host for the organization. Set
|
|
119
147
|
|
120
148
|
We keep releasing new versions of Decidim. In order to get the latest one, update your dependencies:
|
121
149
|
|
122
|
-
```
|
123
|
-
|
150
|
+
```console
|
151
|
+
bundle update decidim
|
124
152
|
```
|
125
153
|
|
126
154
|
And make sure you get all the latest migrations:
|
127
155
|
|
128
|
-
```
|
129
|
-
|
130
|
-
|
156
|
+
```console
|
157
|
+
bin/rails decidim:upgrade
|
158
|
+
bin/rails db:migrate
|
131
159
|
```
|
132
160
|
|
133
161
|
You can also make sure new translations are complete for all languages in your
|
134
162
|
application with:
|
135
163
|
|
136
|
-
```
|
137
|
-
|
164
|
+
```console
|
165
|
+
bin/rails decidim:check_locales
|
138
166
|
```
|
139
167
|
|
140
168
|
Be aware that this task might not be able to detect everything, so make sure you
|
141
169
|
also manually check your application before upgrading.
|
170
|
+
|
171
|
+
## Checklist
|
172
|
+
|
173
|
+
There are several things you need to check before making your putting your application on production. See the [checklist](docs/checklist.md).
|
174
|
+
|
175
|
+
[docker]: https://docs.docker.com/engine/installation/
|
176
|
+
[docker-compose]: https://docs.docker.com/compose/install/
|
data/docs/services/analytics.md
CHANGED
@@ -6,7 +6,7 @@ Adding analytics is quite easy. We've set up a partial in place for that. Just c
|
|
6
6
|
|
7
7
|
Here's an example for Piwik:
|
8
8
|
|
9
|
-
```
|
9
|
+
```javascript
|
10
10
|
<script type="text/javascript">
|
11
11
|
var _paq = _paq || [];
|
12
12
|
// tracker methods like "setCustomDimension" should be called before "trackPageView"
|
data/docs/services/geocoding.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Configuring geocoding
|
4
4
|
|
5
|
-
Decidim has the ability to geocode proposals and meetings using
|
5
|
+
Decidim has the ability to geocode proposals and meetings using Open Street Maps, for instance, you can use [Here](http://here.com) service. We can't use the OSM server by their [tile usage policy](https://operations.osmfoundation.org/policies/tiles/). As an alternative, you may also want to use your own [self-hosted tile server](https://opentileserver.org/).
|
6
6
|
|
7
7
|
After generating your app, you'll see that your `config/initializers/decidim.rb` file has come commented code about geocoding:
|
8
8
|
|
@@ -18,7 +18,7 @@ After generating your app, you'll see that your `config/initializers/decidim.rb`
|
|
18
18
|
If you want to enable geocoding in your app:
|
19
19
|
|
20
20
|
1. Uncomment or add the previous code in your `config/initializers/decidim.rb`.
|
21
|
-
1. Make sure your `config/secrets.yml` file has the needed section (it should be added by the
|
21
|
+
1. Make sure your `config/secrets.yml` file has the needed section (it should be added by the generator automatically).
|
22
22
|
1. Get your app ID and code from Here.com and set them as environment variables, as required by your `config/secrets.yml` file.
|
23
23
|
1. If you had your Rails server running, restart it so the changes apply.
|
24
24
|
|
@@ -28,8 +28,8 @@ Once geocoding is configured, you'll need to activate it. As of April 2017, only
|
|
28
28
|
|
29
29
|
### Proposals
|
30
30
|
|
31
|
-
In order to enable geocoding for proposals you'll need to edit the
|
31
|
+
In order to enable geocoding for proposals you'll need to edit the feature configuration and set the global flag to true. This works for that specific component, so you can have geocoding enabled for meetings in a participatory process, and disabled for another one.
|
32
32
|
|
33
33
|
### Meetings
|
34
34
|
|
35
|
-
Meetings do not have a configuration option for geocoding. Instead, if geocoding is configured it will try to geocode the address every time you create or update a meeting.. As of April 2017 there's no way to enable or disable geocoding per meetings
|
35
|
+
Meetings do not have a configuration option for geocoding. Instead, if geocoding is configured it will try to geocode the address every time you create or update a meeting.. As of April 2017 there's no way to enable or disable geocoding per meetings component.
|
@@ -5,37 +5,37 @@ If you want to enable sign up through social providers like Facebook you will ne
|
|
5
5
|
## Facebook
|
6
6
|
|
7
7
|
1. Navigate to [Facebook Developers Page](https://developers.facebook.com/)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
1. Follow the "Add a New App" link.
|
9
|
+
1. Click the "Website" option.
|
10
|
+
1. Fill in your application name and click "Create New Facebook App ID" button.
|
11
|
+
1. Fill in the contact email info and category.
|
12
|
+
1. Validate the captcha.
|
13
|
+
1. Ignore the source code and fill in the URL field.
|
14
|
+
1. Navigate to the application dashboard and copy the APP_ID and APP_SECRET
|
15
|
+
1. Paste credentials in `config/secrets.yml`. Ensure the `enabled` attribute is `true`.
|
16
16
|
|
17
17
|
## Twitter
|
18
18
|
|
19
19
|
1. Navigate to [Twitter Developers Page](https://dev.twitter.com/)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
1. Follow the "My apps" link.
|
21
|
+
1. Click the "Create New App" button.
|
22
|
+
1. Fill in the `Name`, `Description` fields.
|
23
|
+
1. Fill in the `Website` and `Callback URL` fields with the same value. If you are working on a development app you need to use `http://127.0.0.1:3000/` instead of `http://localhost:3000/`.
|
24
|
+
1. Check the 'Developer Agreement' checkbox and click the 'Create your Twitter application' button.
|
25
|
+
1. Navigate to the "Keys and Access Tokens" tab and copy the API_KEY and API_SECRET.
|
26
|
+
1. (Optional) Navigate to the "Permissions" tab and check the "Request email addresses from users" checkbox.
|
27
|
+
1. Paste credentials in `config/secrets.yml`. Ensure the `enabled` attribute is `true`.
|
28
28
|
|
29
29
|
## Google
|
30
30
|
|
31
31
|
1. Navigate to [Google Developers Page](https://console.developers.google.com)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
1. Follow the 'Create projecte' link.
|
33
|
+
1. Fill in the name of your app.
|
34
|
+
1. Navigate to the projecte dashboard and click on "Enable API"
|
35
|
+
1. Click on `Google+ API` and then "Enable"
|
36
|
+
1. Navigate to the project credentials page and click on `OAuth consent screen`.
|
37
|
+
1. Fill in the `Product name` field
|
38
|
+
1. Click on `Credentials` tab and click on "Create credentials" button. Select `OAuth client ID`.
|
39
|
+
1. Select `Web applications`. Fill in the `Authorized Javascript origins` with your url. Then fill in the `Authorized redirect URIs` with your url and append the path `/users/auth/google_oauth2/callback`.
|
40
|
+
1. Copy the CLIENT_ID AND CLIENT_SECRET
|
41
|
+
1. Paste credentials in `config/secrets.yml`. Ensure the `enabled` attribute is `true`.
|
data/lib/decidim.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "open3"
|
4
|
+
|
3
5
|
module Decidim
|
4
6
|
#
|
5
7
|
# Handles a decidim components.
|
@@ -15,7 +17,25 @@ module Decidim
|
|
15
17
|
# * Updating version files from the main `.decidim-version` file in the root
|
16
18
|
# of the repository.
|
17
19
|
#
|
18
|
-
class
|
20
|
+
class GemManager
|
21
|
+
PARTICIPATORY_SPACES = %w(
|
22
|
+
participatory_processes
|
23
|
+
assemblies
|
24
|
+
consultations
|
25
|
+
).freeze
|
26
|
+
|
27
|
+
COMPONENTS = %w(
|
28
|
+
accountability
|
29
|
+
budgets
|
30
|
+
debates
|
31
|
+
meetings
|
32
|
+
pages
|
33
|
+
proposals
|
34
|
+
surveys
|
35
|
+
sortitions
|
36
|
+
blogs
|
37
|
+
).freeze
|
38
|
+
|
19
39
|
def initialize(dir)
|
20
40
|
@dir = File.expand_path(dir)
|
21
41
|
end
|
@@ -23,8 +43,7 @@ module Decidim
|
|
23
43
|
def run(command, out: STDOUT)
|
24
44
|
Dir.chdir(@dir) do
|
25
45
|
command = command.gsub("%version", version).gsub("%name", name)
|
26
|
-
|
27
|
-
abort unless status || ENV["FAIL_FAST"] == "false"
|
46
|
+
self.class.run(command, out: out)
|
28
47
|
end
|
29
48
|
end
|
30
49
|
|
@@ -43,6 +62,28 @@ module Decidim
|
|
43
62
|
end
|
44
63
|
|
45
64
|
class << self
|
65
|
+
def run(cmd, out: STDOUT)
|
66
|
+
output, status = Open3.capture2e(cmd)
|
67
|
+
|
68
|
+
STDOUT.puts output if out == STDOUT || !continue?(status)
|
69
|
+
|
70
|
+
abort unless continue?(status)
|
71
|
+
|
72
|
+
[output, status]
|
73
|
+
end
|
74
|
+
|
75
|
+
def continue?(status)
|
76
|
+
status.success? || ENV["FAIL_FAST"] == "false"
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_participatory_space
|
80
|
+
new("decidim-#{PARTICIPATORY_SPACES.sample}").run("rake")
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_component
|
84
|
+
new("decidim-#{COMPONENTS.sample}").run("rake")
|
85
|
+
end
|
86
|
+
|
46
87
|
def replace_versions
|
47
88
|
replace_file(
|
48
89
|
"package.json",
|
@@ -76,7 +117,11 @@ module Decidim
|
|
76
117
|
end
|
77
118
|
|
78
119
|
def all_dirs(include_root: true)
|
79
|
-
|
120
|
+
root = File.expand_path(File.join("..", ".."), __dir__)
|
121
|
+
|
122
|
+
glob = "#{root}/#{include_root ? "{decidim-*,.}" : "decidim-*"}"
|
123
|
+
|
124
|
+
Dir.glob(glob)
|
80
125
|
.select { |f| File.directory?(f) }
|
81
126
|
.each { |dir| yield(dir) }
|
82
127
|
end
|