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
|
# frozen_string_literal: true
class Package
INCLUDED_FILES = [
".ruby-version",
"BUILD",
"Dockerfile",
"Gemfile*",
"Procfile",
"Rakefile",
"app/**/*",
"bin/*",
"config.ru",
"config/**/*",
"db/**/*",
"lib/**/*",
"public/**/*",
"public/.well-known/*",
"vendor/cache/**/*"
].freeze
EXCLUDED_FILES = [
"bin/*",
"config/database.yml",
"db/*.sqlite3",
/public\/packs-test/,
].freeze
def self.execute
require 'rake/packagetask'
build = `git rev-parse --short HEAD`.strip
IO.write("./BUILD", build)
name = Rails.application.class.name.split(':')[0].downcase
Rake::PackageTask.new(name, build) do |package|
package.need_tar_gz = true
package.package_files.add INCLUDED_FILES
package.package_files.exclude EXCLUDED_FILES
end
Rake::Task['repackage'].invoke
end
end
|