forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
112 lines (88 loc) · 3.09 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "decidim/gem_manager"
RSpec::Core::RakeTask.new(:spec)
task default: :spec
desc "Runs all tests in all Decidim engines"
task test_all: [:test_main, :test_subgems]
desc "Runs all tests in decidim subgems"
task test_subgems: :test_app do
Decidim::GemManager.run_all("rake", include_root: false)
end
desc "Runs all tests in the main decidim gem"
task :test_main do
Decidim::GemManager.new(__dir__).run("rake")
end
desc "Update version in all gems to the one set in the `.decidim-version` file"
task :update_versions do
Decidim::GemManager.replace_versions
end
Decidim::GemManager.all_dirs(include_root: false) do |dir|
manager = Decidim::GemManager.new(dir)
name = manager.short_name
desc "Runs tests on #{name}"
task "test_#{name}" do
manager.run("rake")
end
end
desc "Runs tests for a random participatory space"
task :test_participatory_space do
Decidim::GemManager.test_participatory_space
end
desc "Runs tests for a random component"
task :test_component do
Decidim::GemManager.test_component
end
desc "Installs all local gem versions globally"
task :install_all do
Decidim::GemManager.install_all
end
desc "Uninstalls all local gem versions"
task :uninstall_all do
Decidim::GemManager.uninstall_all
end
desc "Pushes a new build for each gem and package."
task release_all: [:update_versions, :check_locale_completeness] do
Decidim::GemManager.run_all("rake release")
Decidim::GemManager.run_packages("npm publish --access public")
end
desc "Makes sure all official locales are complete and clean."
task :check_locale_completeness do
system({ "ENFORCED_LOCALES" => "en,ca,es", "SKIP_NORMALIZATION" => "true" }, "rspec spec/i18n_spec.rb")
end
load "decidim-dev/lib/tasks/generators.rake"
load "lib/tasks/common_passwords_tasks.rake"
load "lib/tasks/redesign_tasks.rake"
desc "Generates a dummy app for testing"
task test_app: "decidim:generate_external_test_app"
desc "Generates a development app."
task development_app: "decidim:generate_external_development_app"
desc "Bundle all Gemfiles"
task :bundle do
[".", "decidim-generators", "decidim_app-design"].each do |dir|
Bundler.with_original_env do
puts "Updating #{dir}...\n"
system!("bundle install", dir)
end
end
end
desc "Synchronize npm packages files on the whole repo"
task :webpack do
FileUtils.rm_rf(decidim_app_design_path.join("package-lock.json"))
FileUtils.rm_rf(decidim_app_design_path.join("packages"))
FileUtils.cp_r(root_folder.join("package.json"), decidim_app_design_path)
FileUtils.cp_r(root_folder.join("package-lock.json"), decidim_app_design_path)
FileUtils.cp_r(root_folder.join("packages"), decidim_app_design_path)
system!("npm install", root_folder)
system!("npm install", decidim_app_design_path)
end
def root_folder
@root_folder ||= Pathname.new(__dir__)
end
def decidim_app_design_path
@decidim_app_design_path ||= Pathname.new(root_folder.join("decidim_app-design"))
end
def system!(command, path)
system("cd #{path} && #{command}") || abort("\n== Command #{command} failed ==")
end