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
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/core_ext/module/delegation"
3
4
  require "open3"
4
5
 
5
6
  module Decidim
@@ -53,9 +54,9 @@ module Decidim
53
54
  end
54
55
  end
55
56
 
56
- def replace_version
57
+ def replace_gem_version
57
58
  Dir.chdir(@dir) do
58
- self.class.replace_file(
59
+ replace_file(
59
60
  "lib/#{name.tr("-", "/")}/version.rb",
60
61
  /def self\.version(\s*)"[^"]*"/,
61
62
  "def self.version\\1\"#{version}\""
@@ -63,6 +64,16 @@ module Decidim
63
64
  end
64
65
  end
65
66
 
67
+ def replace_package_version
68
+ Dir.chdir(@dir) do
69
+ replace_file(
70
+ "package.json",
71
+ /^ "version": "[^"]*"/,
72
+ " \"version\": \"#{semver_friendly_version(version)}\""
73
+ )
74
+ end
75
+ end
76
+
66
77
  def short_name
67
78
  name.gsub(/decidim-/, "")
68
79
  end
@@ -85,14 +96,12 @@ module Decidim
85
96
  end
86
97
 
87
98
  def replace_versions
88
- replace_file(
89
- "package.json",
90
- /^ "version": "[^"]*"/,
91
- " \"version\": \"#{semver_friendly_version}\""
92
- )
93
-
94
99
  all_dirs do |dir|
95
- new(dir).replace_version
100
+ new(dir).replace_gem_version
101
+ end
102
+
103
+ package_dirs do |dir|
104
+ new(dir).replace_package_version
96
105
  end
97
106
  end
98
107
 
@@ -129,6 +138,14 @@ module Decidim
129
138
  end
130
139
  end
131
140
 
141
+ def run_packages(command, out: $stdout)
142
+ package_dirs do |dir|
143
+ status = new(dir).run(command, out: out)
144
+
145
+ break unless status || ENV["FAIL_FAST"] == "false"
146
+ end
147
+ end
148
+
132
149
  def version
133
150
  @version ||= File.read(version_file).strip
134
151
  end
@@ -146,20 +163,26 @@ module Decidim
146
163
  dirs.each { |dir| yield(dir) }
147
164
  end
148
165
 
166
+ def package_dirs
167
+ dirs = Dir.glob("#{root}/packages/*")
168
+
169
+ dirs.each { |dir| yield(dir) }
170
+ end
171
+
149
172
  def plugins
150
173
  Dir.glob("#{root}/decidim-*/")
151
174
  end
152
175
 
176
+ def semver_friendly_version(a_version)
177
+ a_version.gsub(/\.pre/, "-pre").gsub(/\.dev/, "-dev").gsub(/.rc(\d*)/, "-rc\\1")
178
+ end
179
+
153
180
  private
154
181
 
155
182
  def root
156
183
  File.expand_path(File.join("..", ".."), __dir__)
157
184
  end
158
185
 
159
- def semver_friendly_version
160
- version.gsub(/\.pre/, "-pre").gsub(/\.dev/, "-dev").gsub(/.rc(\d*)/, "-rc\\1")
161
- end
162
-
163
186
  def version_file
164
187
  File.join(root, ".decidim-version")
165
188
  end
@@ -167,6 +190,8 @@ module Decidim
167
190
 
168
191
  private
169
192
 
193
+ delegate :plugins, :replace_file, :semver_friendly_version, :version, to: :class
194
+
170
195
  def interpolated_in_folder(command)
171
196
  Dir.chdir(@dir) do
172
197
  yield command.gsub("%version", version).gsub("%name", name)
@@ -178,11 +203,7 @@ module Decidim
178
203
  end
179
204
 
180
205
  def name
181
- self.class.plugins.map { |name| File.expand_path(name) }.include?(@dir) ? folder_name : "decidim"
182
- end
183
-
184
- def version
185
- self.class.version
206
+ plugins.map { |name| File.expand_path(name) }.include?(@dir) ? folder_name : "decidim"
186
207
  end
187
208
  end
188
209
  end
@@ -3,6 +3,6 @@
3
3
  # This holds the decidim version and the faker version it uses.
4
4
  module Decidim
5
5
  def self.version
6
- "0.24.3"
6
+ "0.25.0.rc4"
7
7
  end
8
8
  end
data/lib/decidim.rb CHANGED
@@ -23,7 +23,3 @@ require "decidim/accountability"
23
23
  require "decidim/debates"
24
24
  require "decidim/sortitions"
25
25
  require "decidim/blogs"
26
-
27
- # Module declaration.
28
- module Decidim
29
- end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ def ensure_log_goes_to_stdout
4
+ old_logger = Webpacker.logger
5
+ Webpacker.logger = ActiveSupport::Logger.new($stdout)
6
+ yield
7
+ ensure
8
+ Webpacker.logger = old_logger
9
+ end
10
+
11
+ namespace :decidim do
12
+ namespace :webpacker do
13
+ desc "Install deps with npm"
14
+ task :npm_install do
15
+ Dir.chdir(File.join(__dir__, "../..")) do
16
+ system "npm install"
17
+ end
18
+ end
19
+
20
+ desc "Compile JavaScript packs using webpack for production with digests"
21
+ task compile: [:npm_install, :environment] do
22
+ Webpacker.with_node_env("production") do
23
+ ensure_log_goes_to_stdout do
24
+ if Decidim.webpacker.commands.compile
25
+ # Successful compilation!
26
+ puts "SUCCESS"
27
+ Dir.chdir(File.join(__dir__, "../..")) do
28
+ system "cp -r public/* #{Rails.root.join("public")}"
29
+ end
30
+ else
31
+ # Failed compilation
32
+ puts "FAIL"
33
+ exit!
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ def npm_install_available?
42
+ rails_major = Rails::VERSION::MAJOR
43
+ rails_minor = Rails::VERSION::MINOR
44
+
45
+ rails_major > 5 || (rails_major == 5 && rails_minor >= 1)
46
+ end
47
+
48
+ def enhance_assets_precompile
49
+ # npm:install was added in Rails 5.1
50
+ deps = npm_install_available? ? [] : ["decidim:webpacker:npm_install"]
51
+ Rake::Task["assets:precompile"].enhance(deps) do
52
+ Rake::Task["decidim:webpacker:compile"].invoke
53
+ end
54
+ end
55
+
56
+ # Compile packs after we've compiled all other assets during precompilation
57
+ skip_webpacker_precompile = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
58
+
59
+ unless skip_webpacker_precompile
60
+ if Rake::Task.task_defined?("assets:precompile")
61
+ enhance_assets_precompile
62
+ else
63
+ Rake::Task.define_task("assets:precompile" => "decidim:webpacker:compile")
64
+ end
65
+ end
66
+
67
+ namespace :decidim do
68
+ namespace :assets do
69
+ desc "Remove 'node_modules' folder"
70
+ task rm_node_modules: :environment do
71
+ Dir.chdir(File.join(__dir__, "../..")) do
72
+ puts "Removing node_modules folder"
73
+ system "rm -rf node_modules"
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ def enhance_assets_clean
80
+ # npm:install was added in Rails 5.1
81
+ Rake::Task["assets:clean"].enhance([]) do
82
+ Rake::Task["decidim:assets:rm_node_modules"].invoke
83
+ end
84
+ end
85
+
86
+ unless skip_webpacker_precompile
87
+ if Rake::Task.task_defined?("assets:clean")
88
+ enhance_assets_clean
89
+ else
90
+ Rake::Task.define_task("assets:clean" => "decidim:assets:rm_node_modules")
91
+ end
92
+ end