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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 455f818a6f079a3cb892cb93380be91456695c3e
4
- data.tar.gz: 5e9ced2f3f03c1be18d385bd94a6645e05807ffd
3
+ metadata.gz: a8394666cc2650a0c825465c248c1338a622554f
4
+ data.tar.gz: f8d8562b346f4bfd8b6f9ef79496cb6abf060bdd
5
5
  SHA512:
6
- metadata.gz: 1e0f1cb18d4c6edf2a8605d54becc82c3d1521df9978b3ae4f4c25d144f67e6963862f7e23e6d570d19ec5e87ff9204aab103417d4fe82c999492d241b2b5dfa
7
- data.tar.gz: 880d0b31f8411a4a722d2bcd7b1117dd7c7fdc402db64d5ef59b18f5e4eade2a711b000b11f530edfaa3c123486933f8b310731a79481953c1063319ea72e318
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
@@ -3,6 +3,10 @@
3
3
 
4
4
  out: ~/Downloads
5
5
 
6
+ files:
7
+ - README.md
8
+ - NOTICE
9
+
6
10
  platforms:
7
11
  - name: windows
8
12
  arch: 386
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'], os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
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'], os['zip'] || "#{os['name']}_#{os['arch']}")
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
- # `NOTICE` file is required by Apache license.
97
- begin
98
- zip.add('NOTICE', 'NOTICE') if File.exists?('NOTICE')
99
- rescue Zip::ZipEntryExistsError
100
- zip.replace('NOTICE', 'NOTICE')
101
- end
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
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.1.3
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasily Korytov