Skip to content

PEMB2030/decidim-capitalofdemocracy-barcelona

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decidim Capital of Democracy Barcelona

Free Open-Source participatory democracy, citizen participation and open government for cities and organizations

This is the open-source repository for developing the Capital of Democracy Barcelona project, based on Decidim.

Developing

To start contributing to this project, first:

  • Install the basic dependencies (such as Ruby and PostgreSQL)
  • Clone this repository

Start a development application by installing the database and some seeds:

bundle
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bin/rails db:create db:migrate
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bin/rails db:seed

Note that the database user has to have rights to create and drop a database in order to create the development app database.

Optionally, before starting the development server, start in a different terminal the webpacker live compiler. This facilitates working with JS/CSS assets:

bin/webpack-dev-server

Then start the development server:

DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bin/rails s

We recommend using rbenv and have the rbenv-vars plugin installed for it. Then you can add the environment variables to the root directory of the project in a file named .rbenv-vars. If these are defined for the environment, you can omit defining these in the commands shown above.

Code Styling

Please follow the code styling defined by the different linters that ensure we are all talking with the same language collaborating on the same project. This project is set to follow the same rules that Decidim itself follows.

Rubocop linter is used for the Ruby language.

You can run the code styling checks by running the following commands from the console:

$ bundle exec rubocop

To ease up following the style guide, you should install the plugin to your favorite editor, such as:

Testing

To run the tests, prepare the test database

RAILS_ENV=test DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bin/rails db:create db:schema:load

Then run the following:

RAILS_ENV=test DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rspec

Note that the database user has to have rights to create and drop a database in order to create the dummy test app database.

In case you are using rbenv and have the rbenv-vars plugin installed for it, you can add these environment variables to the root directory of the project in a file named .rbenv-vars. In this case, you can omit defining these in the commands shown above.

Setting up the application

You will need to do some steps before having the app working properly once you've deployed it:

  1. Open a Rails console in the server: bundle exec rails console
  2. Create a System Admin user:
user = Decidim::System::Admin.new(email: <email>, password: <password>, password_confirmation: <password>)
user.save!
  1. Visit <your app url>/system and login with your system admin credentials
  2. Create a new organization. Check the locales you want to use for that organization, and select a default locale.
  3. Set the correct default host for the organization, otherwise the app will not work properly. Note that you need to include any subdomain you might be using.
  4. Fill the rest of the form and submit it.

You're good to go!