-
Notifications
You must be signed in to change notification settings - Fork 5
/
package.rb
executable file
·29 lines (27 loc) · 1.16 KB
/
package.rb
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
#!/usr/bin/env ruby
require_relative 'components.rb' rescue LoadError
require 'fileutils'
COMPONENTS.each do |comp|
puts "Packaging component: #{comp.name}..."
puts "Packaging contents of #{comp.path} to ./build/..."
# loop over all entries in the component path
Dir.entries(comp.path).each do |entry|
if File.directory?("#{comp.path}/#{entry}")
# zip and move the zipped file to build/ if the entry is a directory
if !entry.include?(".")
# quick fix for aurorae themes, they need the parent folder inside the archive
if comp.name == "aurorae"
system("tar", "-czvf", "#{comp.name} #{entry}.tar.gz", "-C", "#{comp.path}", "./#{entry}")
else
system("tar", "-czvf", "#{comp.name} #{entry}.tar.gz", "-C", "#{comp.path}/#{entry}/", ".")
end
FileUtils.mv("#{comp.name} #{entry}.tar.gz", "build")
end
else
# copy the file to build/ otherwise
FileUtils.cp("#{comp.path}/#{entry}", "build")
puts entry
end
end
puts "Component packaged: #{comp.name}"
end