decidim 0.0.7 → 0.0.8.1

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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +67 -0
  3. data/.eslintignore +1 -1
  4. data/.eslintrc.json +1 -0
  5. data/.travis.yml +4 -1
  6. data/Gemfile.lock +49 -48
  7. data/README.md +44 -118
  8. data/Rakefile +9 -13
  9. data/decidim-admin/README.md +2 -2
  10. data/decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6 +13 -0
  11. data/decidim-admin/app/assets/javascripts/decidim/admin/toggle_nav.js.es6 +17 -0
  12. data/decidim-admin/app/assets/stylesheets/decidim/admin/_decidim.scss +0 -1
  13. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_datepicker.scss +224 -0
  14. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_modules.scss +1 -0
  15. data/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
  16. data/decidim-admin/app/forms/decidim/admin/participatory_process_user_role_form.rb +9 -0
  17. data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +6 -0
  18. data/decidim-admin/app/views/decidim/admin/categories/index.html.erb +1 -1
  19. data/decidim-admin/app/views/decidim/admin/participatory_process_groups/index.html.erb +1 -1
  20. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/_form.html.erb +2 -3
  21. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +1 -1
  22. data/decidim-admin/app/views/decidim/admin/static_pages/index.html.erb +2 -2
  23. data/decidim-admin/app/views/layouts/decidim/admin/_application.html.erb +2 -1
  24. data/decidim-admin/app/views/layouts/decidim/admin/pages.html.erb +1 -1
  25. data/decidim-admin/config/i18n-tasks.yml +2 -0
  26. data/decidim-admin/config/locales/ca.yml +22 -17
  27. data/decidim-admin/config/locales/en.yml +22 -17
  28. data/decidim-admin/config/locales/es.yml +23 -18
  29. data/decidim-admin/config/locales/eu.yml +0 -19
  30. data/decidim-admin/config/locales/fi.yml +0 -14
  31. data/decidim-admin/config/locales/fr.yml +141 -0
  32. data/decidim-admin/config/locales/nl.yml +5 -0
  33. data/decidim-admin/spec/features/admin_invite_spec.rb +7 -1
  34. data/decidim-admin/spec/features/admin_manages_organization_spec.rb +1 -1
  35. data/decidim-admin/spec/features/admin_manages_participatory_process_groups_spec.rb +1 -1
  36. data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +1 -1
  37. data/decidim-admin/spec/features/static_pages_spec.rb +0 -5
  38. data/decidim-admin/spec/forms/organization_form_spec.rb +6 -1
  39. data/decidim-admin/spec/shared/manage_process_admins_examples.rb +2 -2
  40. data/decidim-admin/spec/shared/manage_process_steps_examples.rb +21 -17
  41. data/decidim-admin/spec/shared/manage_processes_examples.rb +13 -10
  42. data/decidim-admin/spec/shared/participatory_admin_shared_context.rb +3 -3
  43. data/decidim-admin/vendor/assets/javascripts/moment.min.js +7 -0
  44. data/decidim-api/README.md +2 -2
  45. data/decidim-budgets/README.md +2 -2
  46. data/decidim-budgets/config/locales/ca.yml +3 -3
  47. data/decidim-budgets/config/locales/en.yml +3 -3
  48. data/decidim-budgets/config/locales/es.yml +3 -3
  49. data/decidim-budgets/config/locales/eu.yml +0 -3
  50. data/decidim-budgets/config/locales/fi.yml +0 -3
  51. data/decidim-budgets/config/locales/fr.yml +97 -0
  52. data/decidim-budgets/config/locales/nl.yml +5 -0
  53. data/decidim-budgets/db/migrate/20170410074214_remove_not_null_reference_budgets.rb +5 -0
  54. data/decidim-budgets/spec/shared/manage_projects_examples.rb +1 -1
  55. data/decidim-comments/README.md +2 -2
  56. data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
  57. data/decidim-comments/config/locales/fr.yml +5 -0
  58. data/decidim-comments/config/locales/nl.yml +5 -0
  59. data/decidim-dev/README.md +2 -2
  60. data/decidim-dev/config/locales/fr.yml +5 -0
  61. data/decidim-dev/config/locales/nl.yml +5 -0
  62. data/decidim-dev/lib/decidim/dev.rb +8 -5
  63. data/decidim-dev/lib/decidim/dev/common_rake.rb +1 -23
  64. data/decidim-dev/lib/decidim/dev/railtie.rb +13 -0
  65. data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +6 -5
  66. data/decidim-dev/lib/generators/decidim/dummy_generator.rb +13 -16
  67. data/decidim-dev/lib/tasks/test_app.rake +18 -0
  68. data/decidim-meetings/README.md +2 -2
  69. data/decidim-meetings/app/controllers/decidim/meetings/meeting_widgets_controller.rb +21 -0
  70. data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -0
  71. data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/.erb +16 -0
  72. data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/show.html.erb +18 -0
  73. data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +1 -0
  74. data/decidim-meetings/config/locales/ca.yml +5 -5
  75. data/decidim-meetings/config/locales/en.yml +5 -5
  76. data/decidim-meetings/config/locales/es.yml +5 -5
  77. data/decidim-meetings/config/locales/eu.yml +0 -7
  78. data/decidim-meetings/config/locales/fi.yml +0 -7
  79. data/decidim-meetings/config/locales/fr.yml +5 -0
  80. data/decidim-meetings/config/locales/nl.yml +5 -0
  81. data/decidim-meetings/db/migrate/20170410074252_remove_not_null_reference_meetings.rb +5 -0
  82. data/decidim-meetings/lib/decidim/meetings/list_engine.rb +3 -1
  83. data/decidim-meetings/spec/shared/manage_meetings_examples.rb +87 -72
  84. data/decidim-pages/README.md +2 -2
  85. data/decidim-pages/config/locales/ca.yml +1 -1
  86. data/decidim-pages/config/locales/en.yml +1 -1
  87. data/decidim-pages/config/locales/es.yml +1 -1
  88. data/decidim-pages/config/locales/eu.yml +0 -1
  89. data/decidim-pages/config/locales/fi.yml +0 -1
  90. data/decidim-pages/config/locales/fr.yml +5 -0
  91. data/decidim-pages/config/locales/nl.yml +5 -0
  92. data/decidim-proposals/README.md +2 -2
  93. data/decidim-proposals/app/controllers/decidim/proposals/proposal_widgets_controller.rb +24 -0
  94. data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +13 -4
  95. data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +15 -0
  96. data/decidim-proposals/app/helpers/decidim/proposals/proposal_order_helper.rb +1 -1
  97. data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +6 -9
  98. data/decidim-proposals/app/views/decidim/proposals/proposal_widgets/show.html.erb +25 -0
  99. data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +9 -3
  100. data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +8 -7
  101. data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +3 -6
  102. data/decidim-proposals/config/locales/ca.yml +5 -5
  103. data/decidim-proposals/config/locales/en.yml +6 -5
  104. data/decidim-proposals/config/locales/es.yml +5 -5
  105. data/decidim-proposals/config/locales/eu.yml +0 -6
  106. data/decidim-proposals/config/locales/fi.yml +0 -5
  107. data/decidim-proposals/config/locales/fr.yml +5 -0
  108. data/decidim-proposals/config/locales/nl.yml +5 -0
  109. data/decidim-proposals/db/migrate/20170410073742_remove_not_null_reference_proposals.rb +5 -0
  110. data/decidim-proposals/lib/decidim/proposals/engine.rb +1 -0
  111. data/decidim-proposals/lib/decidim/proposals/feature.rb +1 -0
  112. data/decidim-proposals/spec/features/proposals_spec.rb +1 -6
  113. data/decidim-proposals/spec/features/vote_proposal_spec.rb +15 -0
  114. data/decidim-proposals/spec/helpers/proposal_order_helper_spec.rb +13 -3
  115. data/decidim-proposals/spec/shared/manage_proposals_examples.rb +43 -9
  116. data/decidim-results/README.md +2 -2
  117. data/decidim-results/app/controllers/decidim/results/result_widgets_controller.rb +17 -0
  118. data/decidim-results/app/controllers/decidim/results/results_controller.rb +1 -0
  119. data/decidim-results/app/views/decidim/results/result_widgets/show.html.erb +10 -0
  120. data/decidim-results/app/views/decidim/results/results/show.html.erb +1 -0
  121. data/decidim-results/config/locales/ca.yml +3 -3
  122. data/decidim-results/config/locales/en.yml +3 -3
  123. data/decidim-results/config/locales/es.yml +3 -3
  124. data/decidim-results/config/locales/eu.yml +0 -3
  125. data/decidim-results/config/locales/fi.yml +0 -3
  126. data/decidim-results/config/locales/fr.yml +5 -0
  127. data/decidim-results/config/locales/nl.yml +5 -0
  128. data/decidim-results/db/migrate/20170410074358_remove_not_null_reference_results.rb +5 -0
  129. data/decidim-results/lib/decidim/results/list_engine.rb +3 -1
  130. data/decidim-results/spec/shared/manage_results_examples.rb +1 -1
  131. data/decidim-system/config/locales/ca.yml +3 -3
  132. data/decidim-system/config/locales/en.yml +3 -3
  133. data/decidim-system/config/locales/es.yml +3 -3
  134. data/decidim-system/config/locales/eu.yml +0 -3
  135. data/decidim-system/config/locales/fi.yml +0 -3
  136. data/decidim-system/config/locales/fr.yml +5 -0
  137. data/decidim-system/config/locales/nl.yml +5 -0
  138. data/docs/features_and_components.md +1 -1
  139. data/docs/geocoding.md +34 -0
  140. data/docs/getting_started.md +135 -0
  141. data/docs/testing.md +17 -0
  142. data/lib/generators/decidim/app_generator.rb +7 -0
  143. data/lib/generators/decidim/templates/Gemfile.erb +4 -4
  144. data/lib/generators/decidim/templates/README.md.erb +1 -1
  145. data/lib/generators/decidim/templates/authorization_handler.rb +5 -1
  146. data/package.json +1 -1
  147. data/run_ci.sh +6 -6
  148. metadata +61 -23
@@ -23,7 +23,7 @@ $ bundle
23
23
  ```
24
24
 
25
25
  ## Contributing
26
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
26
+ See [Decidim](https://github.com/decidim/decidim).
27
27
 
28
28
  ## License
29
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
29
+ See [Decidim](https://github.com/decidim/decidim).
@@ -17,7 +17,7 @@ $ bundle
17
17
  ```
18
18
 
19
19
  ## Contributing
20
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
20
+ See [Decidim](https://github.com/decidim/decidim).
21
21
 
22
22
  ## License
23
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
23
+ See [Decidim](https://github.com/decidim/decidim).
@@ -15,7 +15,7 @@ ca:
15
15
  confirm_destroy: Estàs segur que vols eliminar aquest projecte?
16
16
  destroy: Esborrar
17
17
  edit: Editar
18
- new: Nou %{name}
18
+ new: Nou
19
19
  preview: Previsualitzar
20
20
  title: Accions
21
21
  admin:
@@ -30,13 +30,13 @@ ca:
30
30
  success: Projecte eliminat correctament
31
31
  edit:
32
32
  title: Editar projecte
33
- update: Actualitzar projecte
33
+ update: Actualitzar
34
34
  index:
35
35
  finished_orders: Vots finalitzats
36
36
  pending_orders: Vots en procés
37
37
  title: Projectes
38
38
  new:
39
- create: Crear projecte
39
+ create: Crear
40
40
  title: Nou resultat
41
41
  update:
42
42
  invalid: Hi ha hagut un problema actualitzant aquest projecte
@@ -16,7 +16,7 @@ en:
16
16
  confirm_destroy: Are you sure you want to delete this project?
17
17
  destroy: Delete
18
18
  edit: Edit
19
- new: New %{name}
19
+ new: New
20
20
  preview: Preview
21
21
  title: Actions
22
22
  admin:
@@ -31,13 +31,13 @@ en:
31
31
  success: Project successfully destroyed
32
32
  edit:
33
33
  title: Edit project
34
- update: Update project
34
+ update: Update
35
35
  index:
36
36
  finished_orders: Finished orders
37
37
  pending_orders: Pending orders
38
38
  title: Projects
39
39
  new:
40
- create: Create project
40
+ create: Create
41
41
  title: New result
42
42
  update:
43
43
  invalid: There's been a problem updating this project
@@ -15,7 +15,7 @@ es:
15
15
  confirm_destroy: '¿Estás seguro de que deseas eliminar este proyecto?'
16
16
  destroy: Borrar
17
17
  edit: Editar
18
- new: Nuevo %{name}
18
+ new: Nuevo
19
19
  preview: Previsualizar
20
20
  title: Acciones
21
21
  admin:
@@ -30,13 +30,13 @@ es:
30
30
  success: Proyecto eliminado exitosamente
31
31
  edit:
32
32
  title: Editar proyecto
33
- update: Actualizar proyecto
33
+ update: Actualizar
34
34
  index:
35
35
  finished_orders: Votos finalizados
36
36
  pending_orders: Votos pendientes
37
37
  title: Proyectos
38
38
  new:
39
- create: Crear proyecto
39
+ create: Crear
40
40
  title: Nuevo resultado
41
41
  update:
42
42
  invalid: Ha habido un problema al actualizar este proyecto
@@ -15,7 +15,6 @@ eu:
15
15
  confirm_destroy: Ziur zaude proiektu hau ezabatu nahi duzula?
16
16
  destroy: Garbitu
17
17
  edit: Editatu
18
- new: '%{name} berria'
19
18
  preview: Aurreikusi
20
19
  title: Ekintzak
21
20
  admin:
@@ -30,13 +29,11 @@ eu:
30
29
  success: Proiektu ongi ezabatu da
31
30
  edit:
32
31
  title: Editatu proiektua
33
- update: Eguneratu proiektua
34
32
  index:
35
33
  finished_orders: Emandako botoak
36
34
  pending_orders: Emateke dauden botoak
37
35
  title: Proiektuak
38
36
  new:
39
- create: Sortu proiektua
40
37
  title: Emaitza berria
41
38
  update:
42
39
  invalid: Arazo bat izan da proiektu hau eguneratzean
@@ -15,7 +15,6 @@ fi:
15
15
  confirm_destroy: Haluatko varmasti poistaa tämän projektin?
16
16
  destroy: Poista
17
17
  edit: Muokkaa
18
- new: Uusi %{name}
19
18
  title: Toiminnot
20
19
  admin:
21
20
  models:
@@ -29,13 +28,11 @@ fi:
29
28
  success: Projekti tuhottu onnistuneesti
30
29
  edit:
31
30
  title: Muokkaa projektia
32
- update: Päivitä projektia
33
31
  index:
34
32
  finished_orders: Valmiit tilaukset
35
33
  pending_orders: Odottavat tilaukset
36
34
  title: Projektit
37
35
  new:
38
- create: Luo projekti
39
36
  title: Uusi tulos
40
37
  update:
41
38
  invalid: Tämän projektin päivityksessä tapahtui virhe
@@ -0,0 +1,97 @@
1
+ fr:
2
+ activemodel:
3
+ attributes:
4
+ project:
5
+ budget: Budget
6
+ decidim_category_id: Catégorie
7
+ decidim_scope_id: Champ d'application
8
+ description: Description
9
+ proposal_ids: Propositions liées
10
+ title: Titre
11
+ decidim:
12
+ budgets:
13
+ actions:
14
+ attachments: Pièces jointes
15
+ confirm_destroy: Êtes-vous certain de vouloir supprimer ce projet?
16
+ destroy: Supprimer
17
+ edit: Modifier
18
+ preview: Aperçu
19
+ title: Actions
20
+ admin:
21
+ models:
22
+ project:
23
+ name: Projet
24
+ projects:
25
+ create:
26
+ invalid: Il y a eu un problème lors de la création de ce projet
27
+ success: Projet créé avec succès
28
+ destroy:
29
+ success: Projet supprimé avec succès
30
+ edit:
31
+ title: Éditer un projet
32
+ index:
33
+ finished_orders: Commandes terminées
34
+ pending_orders: Commandes en attente
35
+ title: Projets
36
+ new:
37
+ title: Nouveau résultat
38
+ update:
39
+ invalid: Il y a eu un problème de mise à jour de ce projet
40
+ success: Projet mis à jour avec succès
41
+ models:
42
+ project:
43
+ fields:
44
+ title: Titre
45
+ projects:
46
+ budget_confirm:
47
+ are_you_sure: Êtes-vous d'accord ? Une fois que vous aurez confirmé votre vote, vous ne pourrez plus le modifier.
48
+ cancel: Annuler
49
+ confirm: Confirmer
50
+ description: Voici les projets que vous avez choisis pour le budget.
51
+ title: Confirmez votre vote
52
+ budget_excess:
53
+ close: Fermer
54
+ description: Ce projet dépasse le budget maximum et ne peut pas être ajouté. Si vous le souhaitez, vous pouvez supprimer un projet que vous avez déjà sélectionné ou voter selon vos préférences.
55
+ ok: D'accord
56
+ title: Budget maximum dépassé
57
+ budget_summary:
58
+ are_you_sure: Êtes-vous certain de vouloir annuler votre vote ?
59
+ assigned: 'Affecté à :'
60
+ cancel_order: supprimer votre vote et recommencer
61
+ checked_out:
62
+ description: Vous avez déjà voté pour le budget. Si vous avez changé d'avis, vous pouvez %{cancel_link}.
63
+ title: Vote du budget terminé
64
+ description: A quels projets pensez-vous que nous devrions allouer un budget ? Assignez au moins %{minimum_budget} aux projets que vous soutenez et votez selon vos préférences pour définir le budget.
65
+ title: Vous décidez du budget
66
+ count:
67
+ projects_count:
68
+ one: 1 projet
69
+ other: "%{count} projets"
70
+ filters:
71
+ category: Catégorie
72
+ category_prompt: Sélectionner une catégorie
73
+ scopes: Étendues
74
+ search: Rechercher
75
+ filters_small_view:
76
+ close_modal: Fermer la vue
77
+ filter: Filtrer
78
+ filter_by: Filtrer par
79
+ unfold: Déplier
80
+ order_progress:
81
+ vote: Voter
82
+ order_selected_projects:
83
+ remove: Supprimer
84
+ selected_projects:
85
+ one: projet sélectionné
86
+ other: projets sélectionnés
87
+ view: Voir
88
+ project:
89
+ add: Ajouter
90
+ count:
91
+ one: 1 soutien
92
+ other: "%{count} soutiens"
93
+ features:
94
+ budgets:
95
+ settings:
96
+ global:
97
+ vote_threshold_percent: Pourcentage de seuil de vote
@@ -0,0 +1,5 @@
1
+ nl:
2
+ activemodel:
3
+ attributes:
4
+ project:
5
+ description: Beschrijving
@@ -0,0 +1,5 @@
1
+ class RemoveNotNullReferenceBudgets < ActiveRecord::Migration[5.0]
2
+ def change
3
+ change_column_null :decidim_budgets_projects, :reference, true
4
+ end
5
+ end
@@ -63,7 +63,7 @@ RSpec.shared_examples "manage projects" do
63
63
  end
64
64
 
65
65
  it "creates a new project" do
66
- click_link "New Project"
66
+ find(".card-title a.button").click
67
67
 
68
68
  within ".new_project" do
69
69
  fill_in_i18n(
@@ -69,7 +69,7 @@ Since we are using Typescript we can generate interfaces and types from our sche
69
69
  This command will create a file called `app/frontend/support/schema.ts` that can be used to strict type checking in our components.
70
70
 
71
71
  ## Contributing
72
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
72
+ See [Decidim](https://github.com/decidim/decidim).
73
73
 
74
74
  ## License
75
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
75
+ See [Decidim](https://github.com/decidim/decidim).
@@ -0,0 +1,5 @@
1
+ fr:
2
+ decidim:
3
+ comments:
4
+ comment_notification_mailer:
5
+ hello: Bonjour %{name},
@@ -0,0 +1,5 @@
1
+ nl:
2
+ decidim:
3
+ comments:
4
+ comment_notification_mailer:
5
+ hello: Hallo %{name},
@@ -18,7 +18,7 @@ $ bundle
18
18
  ```
19
19
 
20
20
  ## Contributing
21
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
21
+ See [Decidim](https://github.com/decidim/decidim).
22
22
 
23
23
  ## License
24
- See [Decidim](https://github.com/AjuntamentdeBarcelona/decidim).
24
+ See [Decidim](https://github.com/decidim/decidim).
@@ -0,0 +1,5 @@
1
+ fr:
2
+ decidim:
3
+ resource_links:
4
+ test_link:
5
+ dummy_resource_dummy: Mannequin apparenté
@@ -0,0 +1,5 @@
1
+ nl:
2
+ decidim:
3
+ resource_links:
4
+ test_link:
5
+ dummy_resource_dummy: Gerelateerde dummy
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "letter_opener_web"
4
+ require "decidim/dev/railtie"
4
5
 
5
6
  module Decidim
6
7
  # Decidim::Dev holds all the convenience logic and libraries to be able to
@@ -11,11 +12,13 @@ module Decidim
11
12
  #
12
13
  # Returns a String with the path for a particular asset.
13
14
  def self.asset(name)
14
- File.join(
15
- File.dirname(__FILE__),
16
- "dev",
17
- "assets",
18
- name
15
+ File.expand_path(
16
+ File.join(
17
+ File.dirname(__FILE__),
18
+ "dev",
19
+ "assets",
20
+ name
21
+ )
19
22
  )
20
23
  end
21
24
  end
@@ -1,28 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
- require_relative "../../generators/decidim/dummy_generator"
5
-
6
- engine_path = Dir.pwd
7
- engine_name = engine_path.split("/").last
8
- dummy_app_path = File.expand_path(File.join(engine_path, "spec", "#{engine_name}_dummy_app"))
9
-
10
- desc "Generates a dummy app for testing"
11
- task :generate_test_app do
12
- Decidim::Generators::DummyGenerator.start(
13
- [
14
- "--engine_path=#{engine_path}",
15
- "--migrate=true",
16
- "--quiet"
17
- ]
18
- )
19
-
20
- require File.join(dummy_app_path, "config", "application")
21
- Rails.application.load_tasks
22
- Rake.application["assets:precompile"].invoke
23
-
24
- FileUtils.cd(engine_path)
25
- end
26
4
 
27
5
  RSpec::Core::RakeTask.new(:spec)
28
- task default: [:generate_test_app, :spec]
6
+ task default: [:spec]
@@ -0,0 +1,13 @@
1
+ module Decidim
2
+ module Dev
3
+ class Railtie < Rails::Railtie
4
+ railtie_name :decidim_dev
5
+
6
+ rake_tasks do
7
+ Dir[File.join(File.dirname(__FILE__), "../../tasks/*.rake")].each do |file|
8
+ load file
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
  ENV["RAILS_ENV"] ||= "test"
3
3
 
4
+ root_path = File.join(Dir.pwd, "..")
4
5
  engine_name = ENV["ENGINE_NAME"]
5
6
  engine_spec_dir = File.join(Dir.pwd, "spec")
6
- dummy_app_path = File.expand_path(File.join(engine_spec_dir, "#{engine_name}_dummy_app"))
7
+ dummy_app_path = File.expand_path(File.join(root_path, "spec", "decidim_dummy_app"))
7
8
 
8
- if ENV["CI"]
9
+ if ENV["SIMPLECOV"]
9
10
  require "simplecov"
10
- SimpleCov.root(ENV["TRAVIS_BUILD_DIR"])
11
+ SimpleCov.root(root_path)
11
12
 
12
13
  SimpleCov.start do
13
14
  filters.clear
@@ -17,7 +18,7 @@ if ENV["CI"]
17
18
  add_filter "/vendor/"
18
19
 
19
20
  add_filter do |src|
20
- !(src.filename =~ /^#{ENV["TRAVIS_BUILD_DIR"]}/)
21
+ !(src.filename =~ /^#{root_path}/)
21
22
  end
22
23
  end
23
24
 
@@ -34,7 +35,7 @@ require "#{File.dirname(__FILE__)}/rspec_support/feature.rb"
34
35
  begin
35
36
  require "#{dummy_app_path}/config/environment"
36
37
  rescue LoadError
37
- puts "Could not load dummy application. Please ensure you have run `bundle exec rake generate_test_app`"
38
+ puts "Could not load dummy application. Please ensure you have run `bundle exec rake decidim:generate_test_app`"
38
39
  puts "Tried to load it from #{dummy_app_path}"
39
40
  exit(-1)
40
41
  end
@@ -18,8 +18,8 @@ module Decidim
18
18
  class DummyGenerator < Rails::Generators::Base
19
19
  desc "Generate dummy app for testing purposes"
20
20
 
21
- class_option :engine_path, type: :string,
22
- desc: "The library where the dummy app will be installed"
21
+ class_option :dummy_app_path, type: :string,
22
+ desc: "The path where the dummy app will be installed"
23
23
 
24
24
  def source_paths
25
25
  [
@@ -28,12 +28,13 @@ module Decidim
28
28
  end
29
29
 
30
30
  def cleanup
31
- remove_directory_if_exists(dummy_path)
31
+ remove_directory_if_exists(dummy_app_path)
32
32
  end
33
33
 
34
34
  def create_dummy_app
35
35
  Decidim::Generators::AppGenerator.start [
36
- dummy_path,
36
+ dummy_app_path,
37
+ "--app_const_base=DummyApplication",
37
38
  "--skip_gemfile",
38
39
  "--skip-bundle",
39
40
  "--skip-git",
@@ -44,29 +45,29 @@ module Decidim
44
45
  end
45
46
 
46
47
  def set_locales
47
- inject_into_file "#{dummy_path}/config/application.rb", after: "class Application < Rails::Application" do
48
+ inject_into_file "#{dummy_app_path}/config/application.rb", after: "class Application < Rails::Application" do
48
49
  "\n config.i18n.available_locales = %w(en ca es)\n config.i18n.default_locale = :en"
49
50
  end
50
51
  end
51
52
 
52
53
  def decidim_dev
53
- template "decidim_dev.rb", "#{dummy_path}/config/initializers/decidim_dev.rb"
54
+ template "decidim_dev.rb", "#{dummy_app_path}/config/initializers/decidim_dev.rb"
54
55
 
55
56
  # TODO: Remove these after PhantomJS updates WebKit version (see YML and
56
57
  # initializer comments)
57
- template "autoprefixer.yml", "#{dummy_path}/config/autoprefixer.yml"
58
- template "autoprefixer_initializer.rb", "#{dummy_path}/config/initializers/autoprefixer.rb"
58
+ template "autoprefixer.yml", "#{dummy_app_path}/config/autoprefixer.yml"
59
+ template "autoprefixer_initializer.rb", "#{dummy_app_path}/config/initializers/autoprefixer.rb"
59
60
  end
60
61
 
61
62
  def test_env
62
- gsub_file "#{dummy_path}/config/environments/test.rb",
63
+ gsub_file "#{dummy_app_path}/config/environments/test.rb",
63
64
  /allow_forgery_protection = (.*)/, 'allow_forgery_protection = true'
64
65
  end
65
66
 
66
67
  private
67
68
 
68
- def dummy_path
69
- ENV["DUMMY_PATH"] || engine_path + "/spec/#{dir_name}_dummy_app"
69
+ def dummy_app_path
70
+ options[:dummy_app_path]
70
71
  end
71
72
 
72
73
  def remove_directory_if_exists(path)
@@ -74,11 +75,7 @@ module Decidim
74
75
  end
75
76
 
76
77
  def dir_name
77
- engine_path.split("/").last
78
- end
79
-
80
- def engine_path
81
- options[:engine_path]
78
+ dummy_app_path.split("/").last
82
79
  end
83
80
  end
84
81
  end