-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
57 lines (44 loc) · 1.62 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
# frozen_string_literal: true
require "fileutils"
require "rspec/core/rake_task"
require_relative "./docker/services/ruby/lib/monadic/version"
version = Monadic::VERSION
RSpec::Core::RakeTask.new(:spec)
require "rubocop/rake_task"
RuboCop::RakeTask.new
task default: %i[spec rubocop]
task :eslint do
sh "npx eslint ."
end
# task to build win/mac x64/mac arm64 packages
task :build do
# remove /docker/services/python/pysetup.py
FileUtils.rm_f("docker/services/python/pysetup.py")
home_directory_path = File.join(File.dirname(__FILE__), "docker")
Dir.glob("#{home_directory_path}/data/*").each { |file| FileUtils.rm_f(file) }
Dir.glob("#{home_directory_path}/dist/*").each { |file| FileUtils.rm_f(file) }
sh "npm update"
sh "npm cache clean --force"
sh "npm run build:linux-x64"
sh "npm run build:linux-arm64"
sh "npm run build:win"
sh "npm run build:mac-x64"
sh "npm run build:mac-arm64"
necessary_files = [
"Monadic Chat-#{version}-arm64.dmg",
"Monadic Chat-#{version}.dmg",
"Monadic Chat Setup #{version}.exe",
"monadic-chat_#{version}_amd64.deb",
"monadic-chat_#{version}_arm64.deb"
].map { |file| File.expand_path("dist/#{file}") }
Dir.glob("dist/*").each do |file|
filepath = File.expand_path(file)
FileUtils.rm_rf(filepath) unless necessary_files.include?(filepath)
# move the file to the /docs/assets/download/ directory if it is included in necessary_files
# FileUtils.mv(filepath, "docs/assets/download/") if necessary_files.include?(filepath)
end
end
# Test ruby code with rspec ./docker/services/ruby/spec
task :spec do
sh "rspec ./docker/services/ruby/spec"
end