-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
63 lines (55 loc) · 1.75 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
# frozen_string_literal: true
require "decidim/dev/common_rake"
def install_module(path)
Dir.chdir(path) do
# Temporary fix to overcome the issue with sass-embedded, see:
# https://github.com/decidim/decidim/pull/11074
system("npm i sass-embedded@~1.62.0")
end
end
# Temporary fix to overcome the issue with babel plugin updates, see:
# https://github.com/decidim/decidim/pull/10916
def fix_babel_config(path)
Dir.chdir(path) do
babel_config = "#{Dir.pwd}/babel.config.json"
File.delete(babel_config) if File.exist?(babel_config)
FileUtils.cp("#{__dir__}/babel.config.json", Dir.pwd)
end
end
desc "Generates a dummy app for testing"
task test_app: "decidim:generate_external_test_app" do
fix_babel_config("spec/decidim_dummy_app")
install_module("spec/decidim_dummy_app")
end
desc "Generates a development app."
task :development_app do
Bundler.with_original_env do
generate_decidim_app(
"development_app",
"--app_name",
"#{base_app_name}_development_app",
"--path",
"..",
"--recreate_db",
"--demo"
)
end
fix_babel_config("development_app")
install_module("development_app")
# Copy the initializer and translation file to the development app folder
base_path = __dir__
source_path = "#{base_path}/lib/decidim/access_requests/generators/app_templates"
target_path = "#{base_path}/development_app/config"
FileUtils.cp(
"#{source_path}/initializer.rb",
"#{target_path}/initializers/decidim_verifications_access_requests.rb"
)
FileUtils.cp(
"#{source_path}/en.yml",
"#{target_path}/locales/decidim-access_requests.en.yml"
)
# Seed the DB after the initializer has been installed
Dir.chdir("development_app") do
system("bundle exec rake db:seed")
end
end