go4rake 1.1.3 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/examples/go4rake.yml +4 -0
- data/lib/go4rake/new.rb +18 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8394666cc2650a0c825465c248c1338a622554f
|
4
|
+
data.tar.gz: f8d8562b346f4bfd8b6f9ef79496cb6abf060bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60e0025bb32e1df49f6b4bff3b777980ea061001e63b8a0c42e3a24423eb6c51556af4bf71cd78054bad16e8c13245cf6d3c1c1b92cdf37b7e7bb031c0f3f727
|
7
|
+
data.tar.gz: 3301f898c776401f2d57c5562807d0b4c9e67a652e2d72642adba9de8d7914a8901c737e479fdff39094d2a5cbac48a377418774f11f9cac795b0e20ab2240e5
|
data/README.md
CHANGED
@@ -45,11 +45,17 @@ For each platform:
|
|
45
45
|
* `arch` is arch
|
46
46
|
* `zip` is ZIP file name (optional)
|
47
47
|
|
48
|
+
These files will be also included into the ZIP files:
|
49
|
+
|
50
|
+
* `README.md`
|
51
|
+
* `NOTICE`
|
52
|
+
|
48
53
|
Please note that:
|
49
54
|
|
50
|
-
* ZIP files include a `NOTICE` file, if it's found in the project directory
|
51
55
|
* If `out` is specified, ZIP files will appear in the specified
|
52
56
|
directory; if not, they will be in current directory
|
57
|
+
* if `files` it not specified, a `NOTICE` file will be included in ZIP
|
58
|
+
files, if it's found in the project directory
|
53
59
|
* ZIP file permissions default to `0600`, this is due to
|
54
60
|
[bug in rubyzip](https://github.com/rubyzip/rubyzip/issues/204)
|
55
61
|
* `arch` is appended to the file name if `arch` is a list
|
data/examples/go4rake.yml
CHANGED
data/lib/go4rake/new.rb
CHANGED
@@ -48,10 +48,12 @@ class Go4Rake < ::Rake::TaskLib
|
|
48
48
|
cfg['platforms'].each { |os|
|
49
49
|
if os['arch'].respond_to?('each')
|
50
50
|
os['arch'].each { |arch|
|
51
|
-
zip(os['name'], arch, cfg['out'],
|
51
|
+
zip(os['name'], arch, cfg['out'], cfg['files'],
|
52
|
+
os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
|
52
53
|
}
|
53
54
|
else
|
54
|
-
zip(os['name'], os['arch'], cfg['out'],
|
55
|
+
zip(os['name'], os['arch'], cfg['out'], cfg['files'],
|
56
|
+
os['zip'] || "#{os['name']}_#{os['arch']}")
|
55
57
|
end
|
56
58
|
}
|
57
59
|
end
|
@@ -85,20 +87,27 @@ class Go4Rake < ::Rake::TaskLib
|
|
85
87
|
end
|
86
88
|
|
87
89
|
# Zip the compiled files.
|
88
|
-
def zip(os, arch, dir, file)
|
90
|
+
def zip(os, arch, dir, files, file)
|
89
91
|
setenv(os, arch)
|
90
92
|
bin = `go list -f '{{.Target}}'`.chomp
|
91
93
|
return unless bin
|
92
94
|
zip_file = File.expand_path(dir) + '/' + file + '.zip'
|
93
95
|
name = File.basename(bin)
|
96
|
+
unless files
|
97
|
+
files = []
|
98
|
+
# `NOTICE` file is required by Apache license.
|
99
|
+
files.push('NOTICE') if File.exists?('NOTICE')
|
100
|
+
end
|
94
101
|
|
95
102
|
Zip::File.open(zip_file, Zip::File::CREATE) do |zip|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
103
|
+
[*files].each { |i|
|
104
|
+
t = File.basename(i)
|
105
|
+
begin
|
106
|
+
zip.add(t, i)
|
107
|
+
rescue Zip::ZipEntryExistsError
|
108
|
+
zip.replace(t, i)
|
109
|
+
end
|
110
|
+
}
|
102
111
|
|
103
112
|
# The executable file.
|
104
113
|
begin
|