go4rake 1.4.3 → 1.5.7

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
- SHA1:
3
- metadata.gz: c7945dae8c9bbaf53504dba57c93bafc95657cff
4
- data.tar.gz: f66bdf4a6879756f3f6c69788a2d736be0c0672e
2
+ SHA256:
3
+ metadata.gz: '029845c95d728b7ba040be28eeae6dc761e1aaca0410fc9ce64e42a18bdc8d38'
4
+ data.tar.gz: 45f524f451459ef570ab83a479b2760b50e775e3e77e2123045be2928d3ba543
5
5
  SHA512:
6
- metadata.gz: 63f048bd51b3a188e762ccecf54016a10111930d2a14c8c489f25c0a5998a13509564094311c0b39da2969a04abe4a8a659484d384b3244d02eabcb0027f3b62
7
- data.tar.gz: 558fd2eda9cefadea64c9b81c7ca8f95fac8487af8d82c8a5a31cccf78cfb6e7769e1bb73434560f347a7dca3d10903e5b9d97326449e5767e2f89488c0c1f29
6
+ metadata.gz: 4fd85f9dcc4ad561c5c9747fa5e6d4f3baafdf95c2dace93ad81b3cfd68045bccbf2259090e0a341a5a89d2fdbf72a52ae5a61dbb488d444e967f1e0aa5c8a58
7
+ data.tar.gz: 020da2972138e0312e4cfdeef7071eaf61fe3db2c1f51fee217c48cdfaef1e25ee261b817b828145022f6cc131d12535e052ef00e22c66a0330e7c79759228a0
data/NOTICE CHANGED
@@ -1,6 +1,6 @@
1
1
  go4rake: https://github.com/chillum/go4rake
2
2
 
3
- Copyright 2014-2016 Vasily Korytov
3
+ Copyright 2014-2019 Vasily Korytov
4
4
 
5
5
  Licensed under the Apache License, Version 2.0 (the "License");
6
6
  you may not use this software except in compliance with the License.
data/README.md CHANGED
@@ -50,7 +50,9 @@ These files will be also included into the ZIP files:
50
50
  Please note that:
51
51
 
52
52
  * If `out` is specified, ZIP files will appear in the specified
53
- directory; if not, they will be in current directory
54
- * if `files` are not specified, a `NOTICE` file will be included in ZIP
53
+ directory; if not, they will be in `~/Downloads`.
54
+ Prior to 1.5.2 the default value was `.`
55
+ * Also please note that current files with the same names as your targets are overwritten.
56
+ * If `files` are not specified, a `NOTICE` file will be included in ZIP
55
57
  files, if it's found in the project directory
56
58
  * `arch` is appended to the file name if `arch` is a list
@@ -1,8 +1,8 @@
1
1
  # go4rake config
2
2
  # Public domain
3
3
 
4
- # ZIP file directory. If absent, the current directory is used.
5
- out: ~/Downloads
4
+ # ZIP file directory. If absent, ~/Downloads is used:
5
+ #out: .
6
6
 
7
7
  # Additional files to include in ZIP file. Optional.
8
8
  files:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'go4rake/new'
2
4
 
3
5
  Go4Rake.new
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake/tasklib'
2
4
  require 'yaml'
3
- require 'zip'
4
5
  require 'zip/filesystem'
5
6
 
6
7
  # Rake tasks to cross-compile Go project and ZIP the binaries:
@@ -18,20 +19,31 @@ class Go4Rake < ::Rake::TaskLib
18
19
  # Load configuration file and initialize Rake tasks for cross-compiling Go programs.
19
20
  def initialize(yml = 'go4rake.yml')
20
21
  begin
21
- @config = YAML.load_file(yml)
22
- tasks(@config, yml)
23
- rescue => e
24
- $stderr.puts("WARNING: Skipping `build` and `zip` tasks: #{e}")
22
+ @yaml_file = yml
23
+ @config = YAML.load_file(@yaml_file)
24
+ @config['out'] ||= '~/Downloads' # Default to ~/Downloads, if 'out' is not specified.
25
+
26
+ init_tasks
27
+ rescue(Errno::ENOENT) => e
28
+ warn "WARNING: Skipping `build` and `zip` tasks: #{e}"
25
29
  end
26
30
  # `build`, `zip` and `clean` depend on config, `test` doesn't.
27
31
  task_test
28
32
  end
29
33
 
34
+ private
35
+
36
+ def init_tasks
37
+ task_build
38
+ task_zip
39
+ task_clean
40
+ end
41
+
30
42
  # Initialize `build`, `zip` and `clean` tasks.
31
- def tasks(cfg, yml)
32
- desc "Build this project for the platforms in #{yml}"
43
+ def task_build
44
+ desc "Build this project for the platforms in #{@yaml_file}"
33
45
  task :build do
34
- cfg['platforms'].each { |os|
46
+ @config['platforms'].each { |os|
35
47
  if os['arch'].respond_to?('each')
36
48
  os['arch'].each { |arch|
37
49
  build(os['name'], arch)
@@ -41,35 +53,35 @@ class Go4Rake < ::Rake::TaskLib
41
53
  end
42
54
  }
43
55
  end
56
+ end
44
57
 
58
+ def task_zip
45
59
  desc 'ZIP this project binaries'
46
- task zip: [:build, :test] do
47
- cfg['out'] ||= '.' # Default to the current directory, if 'out' is not specified.
48
-
49
- cfg['platforms'].each { |os|
60
+ task zip: %i[build test] do
61
+ @config['platforms'].each { |os|
50
62
  if os['arch'].respond_to?('each')
51
63
  os['arch'].each { |arch|
52
- zip(os['name'], arch, cfg['out'], cfg['files'],
64
+ zip(os['name'], arch, @config['out'], @config['files'],
53
65
  os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
54
66
  }
55
67
  else
56
- zip(os['name'], os['arch'], cfg['out'], cfg['files'],
68
+ zip(os['name'], os['arch'], @config['out'], @config['files'],
57
69
  os['zip'] || "#{os['name']}_#{os['arch']}")
58
70
  end
59
71
  }
60
72
  end
73
+ end
61
74
 
75
+ def task_clean
62
76
  desc 'Delete ZIP files'
63
77
  task :clean do
64
- cfg['out'] ||= '.' # Default to the current directory, if 'out' is not specified.
65
-
66
- cfg['platforms'].each { |os|
78
+ @config['platforms'].each { |os|
67
79
  if os['arch'].respond_to?('each')
68
80
  os['arch'].each { |arch|
69
- clean(cfg['out'], os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
81
+ clean(@config['out'], os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
70
82
  }
71
83
  else
72
- clean(cfg['out'], os['zip'] || "#{os['name']}_#{os['arch']}")
84
+ clean(@config['out'], os['zip'] || "#{os['name']}_#{os['arch']}")
73
85
  end
74
86
  }
75
87
  end
@@ -105,8 +117,9 @@ class Go4Rake < ::Rake::TaskLib
105
117
  # Zip the compiled files.
106
118
  def zip(os, arch, dir, files, file)
107
119
  setenv(os, arch)
108
- bin = `go list -f '{{.Target}}'`.chomp
120
+ bin = `go list -f '{{.Target}}'`.chomp.delete_prefix("'").delete_suffix("'")
109
121
  return unless bin
122
+
110
123
  zip_file = File.expand_path(dir) + '/' + file + '.zip'
111
124
  name = File.basename(bin)
112
125
  unless files
@@ -124,7 +137,7 @@ class Go4Rake < ::Rake::TaskLib
124
137
 
125
138
  # The executable file.
126
139
  zip.add(name, bin)
127
- zip.file.chmod(0755, name)
140
+ zip.file.chmod(0o755, name)
128
141
  end
129
142
  puts("Wrote #{zip_file}")
130
143
  end
@@ -133,6 +146,7 @@ class Go4Rake < ::Rake::TaskLib
133
146
  def clean(dir, file)
134
147
  zip_file = File.expand_path(dir) + '/' + file + '.zip'
135
148
  return unless File.exist?(zip_file)
149
+
136
150
  puts("Removing #{zip_file}")
137
151
  File.delete(zip_file)
138
152
  end
metadata CHANGED
@@ -1,46 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go4rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasily Korytov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2020-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
19
+ version: '10'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '14'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '10'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '10.0'
32
+ version: '14'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rubyzip
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ~>
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '1.2'
39
+ version: '2.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ~>
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '1.2'
41
- description: '`build`, `zip, `test`` and `clean` tasks for cross-compilation of Go
42
- programs'
43
- email: vasily.korytov@yandex.com
46
+ version: '2.0'
47
+ description: "`build`, `zip, `test`` and `clean` tasks for cross-compilation of Go
48
+ programs"
49
+ email: v.korytov@outlook.com
44
50
  executables: []
45
51
  extensions: []
46
52
  extra_rdoc_files: []
@@ -60,17 +66,16 @@ require_paths:
60
66
  - lib
61
67
  required_ruby_version: !ruby/object:Gem::Requirement
62
68
  requirements:
63
- - - '>='
69
+ - - ">="
64
70
  - !ruby/object:Gem::Version
65
- version: 1.9.2
71
+ version: '2.5'
66
72
  required_rubygems_version: !ruby/object:Gem::Requirement
67
73
  requirements:
68
- - - '>='
74
+ - - ">="
69
75
  - !ruby/object:Gem::Version
70
76
  version: '0'
71
77
  requirements: []
72
- rubyforge_project:
73
- rubygems_version: 2.0.14.1
78
+ rubygems_version: 3.1.2
74
79
  signing_key:
75
80
  specification_version: 4
76
81
  summary: Rake helper for cross-compiling Go programs