go4rake 1.2 → 1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/go4rake/new.rb +25 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926c729186dfe44a389cf97c4f2758bcb2804f77
|
4
|
+
data.tar.gz: 6cd2ca2a1104937fe52a006a71cc3889887dc365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fc3b58632cd5ec4aceb9c8b87f74277b539532815534fc3cea76dc15b1462a6b8c01f27e8a8581e9333484104765f5ebc94a319e7c6f366f1b46ef05e0d3e31
|
7
|
+
data.tar.gz: 01563a5f1f53d6e43821c244cd88de4a3802035a064da5411cd31fc2c4bd69c912adc7da5c0303a4d0c8fe7c274b21e43983fa21852cf1c58371691cd45db047
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@ This gem provides the following tasks:
|
|
5
5
|
* `rake build` for cross-compiling for the specified architectures
|
6
6
|
* `rake zip` command for making ZIP files that contain binary builds
|
7
7
|
* `rake test` for running tests for the native architecture
|
8
|
+
* `rake clean` for deleting the created ZIP files
|
8
9
|
|
9
10
|
`zip` depends on `build` and `test` (in that order).
|
10
11
|
|
@@ -27,7 +28,7 @@ The reason only the native runtime is supported in `test` is that `go test` for
|
|
27
28
|
|
28
29
|
### Configuration
|
29
30
|
|
30
|
-
`zip` and `
|
31
|
+
`zip`, `build` and `clean` tasks expect a YAML config, `go4rake.yml`. Say, we
|
31
32
|
have [this config](https://github.com/chillum/go4rake/blob/master/examples/go4rake.yml).
|
32
33
|
|
33
34
|
This way, you run `rake zip` and you get the following ZIP files
|
@@ -54,7 +55,7 @@ Please note that:
|
|
54
55
|
|
55
56
|
* If `out` is specified, ZIP files will appear in the specified
|
56
57
|
directory; if not, they will be in current directory
|
57
|
-
* if `files`
|
58
|
+
* if `files` is not specified, a `NOTICE` file will be included in ZIP
|
58
59
|
files, if it's found in the project directory
|
59
60
|
* ZIP file permissions default to `0600`, this is due to
|
60
61
|
[bug in rubyzip](https://github.com/rubyzip/rubyzip/issues/204)
|
data/lib/go4rake/new.rb
CHANGED
@@ -4,7 +4,7 @@ require 'zip'
|
|
4
4
|
require 'zip/filesystem'
|
5
5
|
|
6
6
|
# Rake tasks to cross-compile Go project and ZIP the binaries:
|
7
|
-
# `rake build`, `rake test` and `rake
|
7
|
+
# `rake build`, `rake test`, `rake zip` and `rake clean`.
|
8
8
|
#
|
9
9
|
# Usage: `require 'go4rake'` in `Rakefile`. Settings are specified in a YAML file: `go4rake.yml`.
|
10
10
|
#
|
@@ -57,6 +57,22 @@ class Go4Rake < ::Rake::TaskLib
|
|
57
57
|
end
|
58
58
|
}
|
59
59
|
end
|
60
|
+
|
61
|
+
desc 'Delete ZIP files'
|
62
|
+
task :clean do
|
63
|
+
cfg['out'] ||= '.' # Default to the current directory, if 'out' is not specified.
|
64
|
+
|
65
|
+
cfg['platforms'].each { |os|
|
66
|
+
if os['arch'].respond_to?('each')
|
67
|
+
os['arch'].each { |arch|
|
68
|
+
clean(cfg['out'], os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
|
69
|
+
}
|
70
|
+
else
|
71
|
+
clean(cfg['out'], os['zip'] || "#{os['name']}_#{os['arch']}")
|
72
|
+
end
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
60
76
|
end
|
61
77
|
|
62
78
|
# Initialize `test` task.
|
@@ -119,4 +135,12 @@ class Go4Rake < ::Rake::TaskLib
|
|
119
135
|
end
|
120
136
|
puts("Wrote #{zip_file}")
|
121
137
|
end
|
138
|
+
|
139
|
+
def clean(dir, file)
|
140
|
+
zip_file = File.expand_path(dir) + '/' + file + '.zip'
|
141
|
+
if File.exists?(zip_file)
|
142
|
+
puts("Removing #{zip_file}")
|
143
|
+
File.delete(zip_file)
|
144
|
+
end
|
145
|
+
end
|
122
146
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go4rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Korytov
|
@@ -38,7 +38,8 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.1'
|
41
|
-
description: "`build`, `test` and `
|
41
|
+
description: "`build`, `test`, `zip` and `clean` tasks for cross-compilation of Go
|
42
|
+
programs"
|
42
43
|
email: vasily.korytov@yahoo.com
|
43
44
|
executables: []
|
44
45
|
extensions: []
|