go4rake 1.5.6 → 1.5.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/go4rake/new.rb +26 -13
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dead3a1458a9771919d0d7d3b142709208815dbf86d244c7c22ac388d537b71
4
- data.tar.gz: dd21a2e59f866ca7e4c7de84d5d673a4de3a9bef84391ce0d4e1dbbb2f892ad3
3
+ metadata.gz: '029845c95d728b7ba040be28eeae6dc761e1aaca0410fc9ce64e42a18bdc8d38'
4
+ data.tar.gz: 45f524f451459ef570ab83a479b2760b50e775e3e77e2123045be2928d3ba543
5
5
  SHA512:
6
- metadata.gz: c1e23a3f97078ce7144c36604e52918492eb05f5615aa8524cbbdd13093c77158684003a236122c2e5783682179453050b7bd402f1ee5ca5997686c9b4219780
7
- data.tar.gz: 7dc078cf726b54bac228e7290300c0474f6bc1f0c56760a1d2851ce6c7015c6ea8a390468dd00783184bead3558ebd11230290a15b028f17c2a7eaf5a4a0721b
6
+ metadata.gz: 4fd85f9dcc4ad561c5c9747fa5e6d4f3baafdf95c2dace93ad81b3cfd68045bccbf2259090e0a341a5a89d2fdbf72a52ae5a61dbb488d444e967f1e0aa5c8a58
7
+ data.tar.gz: 020da2972138e0312e4cfdeef7071eaf61fe3db2c1f51fee217c48cdfaef1e25ee261b817b828145022f6cc131d12535e052ef00e22c66a0330e7c79759228a0
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rake/tasklib'
4
4
  require 'yaml'
5
- require 'zip'
6
5
  require 'zip/filesystem'
7
6
 
8
7
  # Rake tasks to cross-compile Go project and ZIP the binaries:
@@ -20,9 +19,11 @@ class Go4Rake < ::Rake::TaskLib
20
19
  # Load configuration file and initialize Rake tasks for cross-compiling Go programs.
21
20
  def initialize(yml = 'go4rake.yml')
22
21
  begin
23
- @config = YAML.load_file(yml)
22
+ @yaml_file = yml
23
+ @config = YAML.load_file(@yaml_file)
24
24
  @config['out'] ||= '~/Downloads' # Default to ~/Downloads, if 'out' is not specified.
25
- tasks(@config, yml)
25
+
26
+ init_tasks
26
27
  rescue(Errno::ENOENT) => e
27
28
  warn "WARNING: Skipping `build` and `zip` tasks: #{e}"
28
29
  end
@@ -30,11 +31,19 @@ class Go4Rake < ::Rake::TaskLib
30
31
  task_test
31
32
  end
32
33
 
34
+ private
35
+
36
+ def init_tasks
37
+ task_build
38
+ task_zip
39
+ task_clean
40
+ end
41
+
33
42
  # Initialize `build`, `zip` and `clean` tasks.
34
- def tasks(cfg, yml)
35
- desc "Build this project for the platforms in #{yml}"
43
+ def task_build
44
+ desc "Build this project for the platforms in #{@yaml_file}"
36
45
  task :build do
37
- cfg['platforms'].each { |os|
46
+ @config['platforms'].each { |os|
38
47
  if os['arch'].respond_to?('each')
39
48
  os['arch'].each { |arch|
40
49
  build(os['name'], arch)
@@ -44,31 +53,35 @@ class Go4Rake < ::Rake::TaskLib
44
53
  end
45
54
  }
46
55
  end
56
+ end
47
57
 
58
+ def task_zip
48
59
  desc 'ZIP this project binaries'
49
- task zip: %i[build test] do
50
- cfg['platforms'].each { |os|
60
+ task zip: %i[build test] do
61
+ @config['platforms'].each { |os|
51
62
  if os['arch'].respond_to?('each')
52
63
  os['arch'].each { |arch|
53
- zip(os['name'], arch, cfg['out'], cfg['files'],
64
+ zip(os['name'], arch, @config['out'], @config['files'],
54
65
  os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
55
66
  }
56
67
  else
57
- zip(os['name'], os['arch'], cfg['out'], cfg['files'],
68
+ zip(os['name'], os['arch'], @config['out'], @config['files'],
58
69
  os['zip'] || "#{os['name']}_#{os['arch']}")
59
70
  end
60
71
  }
61
72
  end
73
+ end
62
74
 
75
+ def task_clean
63
76
  desc 'Delete ZIP files'
64
77
  task :clean do
65
- cfg['platforms'].each { |os|
78
+ @config['platforms'].each { |os|
66
79
  if os['arch'].respond_to?('each')
67
80
  os['arch'].each { |arch|
68
- clean(cfg['out'], os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
81
+ clean(@config['out'], os['zip'] ? "#{os['zip']}_#{arch}" : "#{os['name']}_#{arch}")
69
82
  }
70
83
  else
71
- clean(cfg['out'], os['zip'] || "#{os['name']}_#{os['arch']}")
84
+ clean(@config['out'], os['zip'] || "#{os['name']}_#{os['arch']}")
72
85
  end
73
86
  }
74
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go4rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
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: 2019-11-30 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
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.2'
39
+ version: '2.0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.2'
46
+ version: '2.0'
47
47
  description: "`build`, `zip, `test`` and `clean` tasks for cross-compilation of Go
48
48
  programs"
49
49
  email: v.korytov@outlook.com
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.0.3
78
+ rubygems_version: 3.1.2
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Rake helper for cross-compiling Go programs