rake_dependencies 0.23.0 → 1.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/.ruby-version +1 -1
- data/Gemfile.lock +38 -34
- data/README.md +1 -1
- data/lib/rake_dependencies.rb +6 -0
- data/lib/rake_dependencies/task_sets.rb +6 -0
- data/lib/rake_dependencies/task_sets/all.rb +68 -0
- data/lib/rake_dependencies/tasks.rb +0 -1
- data/lib/rake_dependencies/tasks/clean.rb +8 -13
- data/lib/rake_dependencies/tasks/download.rb +29 -31
- data/lib/rake_dependencies/tasks/ensure.rb +19 -41
- data/lib/rake_dependencies/tasks/extract.rb +41 -47
- data/lib/rake_dependencies/tasks/fetch.rb +14 -22
- data/lib/rake_dependencies/tasks/install.rb +19 -26
- data/lib/rake_dependencies/version.rb +1 -1
- data/rake_dependencies.gemspec +10 -9
- metadata +39 -26
- data/lib/rake_dependencies/exceptions.rb +0 -4
- data/lib/rake_dependencies/tasklib.rb +0 -98
- data/lib/rake_dependencies/tasks/all.rb +0 -137
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e20568316ef3ae3beaf87ccb5fbdd6be2446634635fb4f217e08b14c4f585b8
|
4
|
+
data.tar.gz: 5c933c6d35ca4088e36e34b8638d4a35ec6f8534e09e71cc09584037e6766f82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e32dfa3bd2bee366199f0a33211477681112e94fbc9164c4724200646b16cfa4f8360c132bfab724420088c13cf9150536a55258c60224c5a74f9b987f7526f3
|
7
|
+
data.tar.gz: cb4a02f1f8a9fcce6759ad98db7dbe2017349bf582b46f38c3ebef3e6117383e1c9b56e1328ebe78daf9fda8b1b9b396e98912b58e0257cb2301a67ececc7e66
|
data/.circleci/config.yml
CHANGED
@@ -3,14 +3,14 @@ jobs:
|
|
3
3
|
test:
|
4
4
|
working_directory: ~/rake-dependencies
|
5
5
|
docker:
|
6
|
-
- image: ruby:2.
|
6
|
+
- image: ruby:2.6.0
|
7
7
|
steps:
|
8
8
|
- checkout
|
9
9
|
- run: ./scripts/ci/steps/test.sh
|
10
10
|
prerelease:
|
11
11
|
working_directory: ~/rake-dependencies
|
12
12
|
docker:
|
13
|
-
- image: ruby:2.
|
13
|
+
- image: ruby:2.6.0
|
14
14
|
steps:
|
15
15
|
- checkout
|
16
16
|
- run: ./scripts/ci/common/install-git-crypt.sh
|
@@ -21,7 +21,7 @@ jobs:
|
|
21
21
|
release:
|
22
22
|
working_directory: ~/rake-dependencies
|
23
23
|
docker:
|
24
|
-
- image: ruby:2.
|
24
|
+
- image: ruby:2.6.0
|
25
25
|
steps:
|
26
26
|
- checkout
|
27
27
|
- run: ./scripts/ci/common/install-git-crypt.sh
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.0
|
data/Gemfile.lock
CHANGED
@@ -1,53 +1,57 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rake_dependencies (0.
|
4
|
+
rake_dependencies (1.1.0.pre.1)
|
5
5
|
hamster (~> 3.0)
|
6
|
-
minitar (~> 0.
|
7
|
-
|
6
|
+
minitar (~> 0.9)
|
7
|
+
rake_factory (~> 0.7)
|
8
|
+
rubyzip (~> 2.0)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
activesupport (5.2.1)
|
13
|
+
activesupport (5.2.4.1)
|
13
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
15
|
i18n (>= 0.7, < 2)
|
15
16
|
minitest (~> 5.1)
|
16
17
|
tzinfo (~> 1.1)
|
17
|
-
concurrent-ruby (1.1.
|
18
|
+
concurrent-ruby (1.1.5)
|
18
19
|
diff-lcs (1.3)
|
19
|
-
docile (1.3.
|
20
|
-
fakefs (0.
|
21
|
-
gem-release (2.
|
20
|
+
docile (1.3.2)
|
21
|
+
fakefs (1.0.0)
|
22
|
+
gem-release (2.1.1)
|
22
23
|
hamster (3.0.0)
|
23
24
|
concurrent-ruby (~> 1.0)
|
24
|
-
i18n (1.
|
25
|
+
i18n (1.8.2)
|
25
26
|
concurrent-ruby (~> 1.0)
|
26
|
-
json (2.
|
27
|
-
minitar (0.
|
28
|
-
minitest (5.
|
29
|
-
rake (
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
rspec-
|
36
|
-
|
27
|
+
json (2.3.0)
|
28
|
+
minitar (0.9)
|
29
|
+
minitest (5.14.0)
|
30
|
+
rake (13.0.1)
|
31
|
+
rake_factory (0.7.0)
|
32
|
+
activesupport (~> 5.2)
|
33
|
+
rake (~> 13.0)
|
34
|
+
rspec (3.9.0)
|
35
|
+
rspec-core (~> 3.9.0)
|
36
|
+
rspec-expectations (~> 3.9.0)
|
37
|
+
rspec-mocks (~> 3.9.0)
|
38
|
+
rspec-core (3.9.1)
|
39
|
+
rspec-support (~> 3.9.1)
|
40
|
+
rspec-expectations (3.9.0)
|
37
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.9.0)
|
43
|
+
rspec-mocks (3.9.1)
|
40
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.
|
42
|
-
rspec-support (3.
|
43
|
-
rubyzip (
|
44
|
-
simplecov (0.
|
45
|
+
rspec-support (~> 3.9.0)
|
46
|
+
rspec-support (3.9.2)
|
47
|
+
rubyzip (2.0.0)
|
48
|
+
simplecov (0.17.1)
|
45
49
|
docile (~> 1.1)
|
46
50
|
json (>= 1.8, < 3)
|
47
51
|
simplecov-html (~> 0.10.0)
|
48
52
|
simplecov-html (0.10.2)
|
49
53
|
thread_safe (0.3.6)
|
50
|
-
tzinfo (1.2.
|
54
|
+
tzinfo (1.2.6)
|
51
55
|
thread_safe (~> 0.1)
|
52
56
|
|
53
57
|
PLATFORMS
|
@@ -55,13 +59,13 @@ PLATFORMS
|
|
55
59
|
|
56
60
|
DEPENDENCIES
|
57
61
|
activesupport (~> 5.2)
|
58
|
-
bundler (~> 1
|
59
|
-
fakefs (~> 0
|
60
|
-
gem-release (~> 2.
|
61
|
-
rake (~>
|
62
|
+
bundler (~> 2.1)
|
63
|
+
fakefs (~> 1.0)
|
64
|
+
gem-release (~> 2.1)
|
65
|
+
rake (~> 13.0)
|
62
66
|
rake_dependencies!
|
63
|
-
rspec (~> 3.
|
64
|
-
simplecov (~> 0.
|
67
|
+
rspec (~> 3.9)
|
68
|
+
simplecov (~> 0.17)
|
65
69
|
|
66
70
|
BUNDLED WITH
|
67
|
-
1.
|
71
|
+
2.1.4
|
data/README.md
CHANGED
@@ -320,7 +320,7 @@ openssl aes-256-cbc \
|
|
320
320
|
## Contributing
|
321
321
|
|
322
322
|
Bug reports and pull requests are welcome on GitHub at
|
323
|
-
https://github.com/
|
323
|
+
https://github.com/infrablocks/rake_dependencies. This project is intended to
|
324
324
|
be a safe, welcoming space for collaboration, and contributors are expected to
|
325
325
|
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
326
326
|
conduct.
|
data/lib/rake_dependencies.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require 'rake_dependencies/tasks'
|
2
|
+
require 'rake_dependencies/task_sets'
|
2
3
|
require 'rake_dependencies/extractors'
|
3
4
|
require 'rake_dependencies/template'
|
4
5
|
require 'rake_dependencies/version'
|
5
6
|
|
6
7
|
module RakeDependencies
|
8
|
+
class << self
|
9
|
+
def define_tasks(&block)
|
10
|
+
TaskSets::All.define(&block)
|
11
|
+
end
|
12
|
+
end
|
7
13
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rake_factory'
|
2
|
+
|
3
|
+
require_relative '../tasks/clean'
|
4
|
+
require_relative '../tasks/download'
|
5
|
+
require_relative '../tasks/ensure'
|
6
|
+
require_relative '../tasks/extract'
|
7
|
+
require_relative '../tasks/fetch'
|
8
|
+
|
9
|
+
|
10
|
+
module RakeDependencies
|
11
|
+
module TaskSets
|
12
|
+
class All < RakeFactory::TaskSet
|
13
|
+
parameter :containing_namespace
|
14
|
+
|
15
|
+
parameter :dependency, :required => true
|
16
|
+
parameter :version
|
17
|
+
parameter :path, :required => true
|
18
|
+
parameter :type, :default => :zip
|
19
|
+
|
20
|
+
parameter :os_ids, default: {mac: 'mac', linux: 'linux'}
|
21
|
+
|
22
|
+
parameter :distribution_directory, default: 'dist'
|
23
|
+
parameter :binary_directory, default: 'bin'
|
24
|
+
parameter :installation_directory
|
25
|
+
|
26
|
+
parameter :uri_template, :required => true
|
27
|
+
parameter :file_name_template, :required => true
|
28
|
+
parameter :strip_path_template
|
29
|
+
|
30
|
+
parameter :source_binary_name_template
|
31
|
+
parameter :target_binary_name_template
|
32
|
+
|
33
|
+
parameter :needs_fetch, :required => true
|
34
|
+
|
35
|
+
parameter :clean_task_name, :default => :clean
|
36
|
+
parameter :download_task_name, :default => :download
|
37
|
+
parameter :extract_task_name, :default => :extract
|
38
|
+
parameter :install_task_name, :default => :install
|
39
|
+
parameter :fetch_task_name, :default => :fetch
|
40
|
+
parameter :ensure_task_name, :default => :ensure
|
41
|
+
|
42
|
+
alias namespace= containing_namespace=
|
43
|
+
|
44
|
+
task Tasks::Clean, name: ->(ts) { ts.clean_task_name }
|
45
|
+
task Tasks::Download, name: ->(ts) { ts.download_task_name }
|
46
|
+
task Tasks::Extract, name: ->(ts) { ts.extract_task_name }
|
47
|
+
task Tasks::Install, {
|
48
|
+
name: ->(ts) { ts.install_task_name },
|
49
|
+
define_if: ->(ts) { ts.installation_directory }
|
50
|
+
} do |ts, t|
|
51
|
+
t.binary_name_template =
|
52
|
+
ts.target_binary_name_template || ts.dependency
|
53
|
+
end
|
54
|
+
task Tasks::Fetch, name: ->(ts) { ts.fetch_task_name }
|
55
|
+
task Tasks::Ensure, name: ->(ts) { ts.ensure_task_name }
|
56
|
+
|
57
|
+
def define_on(application)
|
58
|
+
if containing_namespace
|
59
|
+
namespace containing_namespace do
|
60
|
+
super(application)
|
61
|
+
end
|
62
|
+
else
|
63
|
+
super(application)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,21 +1,16 @@
|
|
1
|
-
|
1
|
+
require 'rake_factory'
|
2
2
|
|
3
3
|
module RakeDependencies
|
4
4
|
module Tasks
|
5
|
-
class Clean <
|
6
|
-
|
7
|
-
|
8
|
-
parameter :dependency, :required => true
|
5
|
+
class Clean < RakeFactory::Task
|
6
|
+
default_name :clean
|
7
|
+
default_description ->(t) { "Clean vendored #{t.dependency}" }
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
parameter :dependency, :required => true
|
10
|
+
parameter :path, :required => true
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
task name do
|
17
|
-
rm_rf path
|
18
|
-
end
|
12
|
+
action do |t|
|
13
|
+
rm_rf t.path
|
19
14
|
end
|
20
15
|
end
|
21
16
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
+
require 'rake_factory'
|
1
2
|
require 'open-uri'
|
2
|
-
|
3
|
+
|
3
4
|
require_relative '../template'
|
4
5
|
|
5
6
|
module RakeDependencies
|
6
7
|
module Tasks
|
7
|
-
class Download <
|
8
|
-
|
8
|
+
class Download < RakeFactory::Task
|
9
|
+
default_name :download
|
10
|
+
default_description ->(t) { "Download #{t.dependency} distribution" }
|
9
11
|
|
10
12
|
parameter :type, default: :zip
|
11
13
|
parameter :os_ids, default: {mac: 'mac', linux: 'linux'}
|
@@ -18,35 +20,27 @@ module RakeDependencies
|
|
18
20
|
parameter :uri_template, required: true
|
19
21
|
parameter :file_name_template, required: true
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
task name do
|
29
|
-
parameters = {
|
30
|
-
version: version,
|
31
|
-
platform: platform,
|
32
|
-
os_id: os_id,
|
33
|
-
ext: ext
|
34
|
-
}
|
23
|
+
action do
|
24
|
+
parameters = {
|
25
|
+
version: version,
|
26
|
+
platform: platform,
|
27
|
+
os_id: os_id,
|
28
|
+
ext: ext
|
29
|
+
}
|
35
30
|
|
36
|
-
|
31
|
+
uri = Template.new(uri_template)
|
37
32
|
.with_parameters(parameters)
|
38
33
|
.render
|
39
|
-
|
34
|
+
download_file_name = Template.new(file_name_template)
|
40
35
|
.with_parameters(parameters)
|
41
36
|
.render
|
42
|
-
|
43
|
-
|
37
|
+
download_file_directory = File.join(path, distribution_directory)
|
38
|
+
download_file_path = File.join(download_file_directory, download_file_name)
|
44
39
|
|
45
|
-
|
40
|
+
temporary_file = open(uri)
|
46
41
|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
42
|
+
mkdir_p download_file_directory
|
43
|
+
cp temporary_file.path, download_file_path
|
50
44
|
end
|
51
45
|
|
52
46
|
private
|
@@ -65,12 +59,16 @@ module RakeDependencies
|
|
65
59
|
|
66
60
|
def ext
|
67
61
|
case resolved_type
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
62
|
+
when :tar_gz then
|
63
|
+
'.tar.gz'
|
64
|
+
when :tgz then
|
65
|
+
'.tgz'
|
66
|
+
when :zip then
|
67
|
+
'.zip'
|
68
|
+
when :uncompressed then
|
69
|
+
''
|
70
|
+
else
|
71
|
+
raise "Unknown type: #{type}"
|
74
72
|
end
|
75
73
|
end
|
76
74
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'rake_factory'
|
2
2
|
|
3
3
|
module RakeDependencies
|
4
4
|
module Tasks
|
5
|
-
class Ensure <
|
6
|
-
|
5
|
+
class Ensure < RakeFactory::Task
|
6
|
+
default_name :ensure
|
7
|
+
default_description ->(t) { "Ensure #{t.dependency} present" }
|
7
8
|
|
8
9
|
parameter :dependency, required: true
|
9
10
|
parameter :version
|
@@ -11,49 +12,26 @@ module RakeDependencies
|
|
11
12
|
|
12
13
|
parameter :binary_directory, default: 'bin'
|
13
14
|
|
14
|
-
parameter :needs_fetch, default:
|
15
|
+
parameter :needs_fetch, default: true
|
15
16
|
|
16
|
-
parameter :
|
17
|
-
parameter :
|
18
|
-
parameter :
|
19
|
-
parameter :
|
17
|
+
parameter :clean_task_name, default: :clean
|
18
|
+
parameter :download_task_name, default: :download
|
19
|
+
parameter :extract_task_name, default: :extract
|
20
|
+
parameter :install_task_name, default: :install
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
action do |t|
|
23
|
+
clean = Rake::Task[t.scope.path_with_task_name(t.clean_task_name)]
|
24
|
+
download = Rake::Task[t.scope.path_with_task_name(t.download_task_name)]
|
25
|
+
extract = Rake::Task[t.scope.path_with_task_name(t.extract_task_name)]
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
extract = Rake::Task[scoped_task_name(extract_task)]
|
30
|
-
|
31
|
-
resolved_install_task = scoped_task_name(install_task)
|
32
|
-
install = if Rake::Task.task_defined?(resolved_install_task)
|
33
|
-
Rake::Task[scoped_task_name(install_task)]
|
34
|
-
else
|
35
|
-
no_op_task = Object.new
|
36
|
-
def no_op_task.invoke; end
|
37
|
-
no_op_task
|
38
|
-
end
|
39
|
-
|
40
|
-
desc "Ensure #{dependency} present"
|
41
|
-
task name do
|
42
|
-
parameters = {
|
43
|
-
path: path,
|
44
|
-
version: version,
|
45
|
-
binary_directory: binary_directory
|
46
|
-
}
|
47
|
-
if needs_fetch.call(parameters)
|
48
|
-
[clean, download, extract, install].map(&:invoke)
|
49
|
-
end
|
27
|
+
install_name = t.scope.path_with_task_name(t.install_task_name)
|
28
|
+
install = if Rake::Task.task_defined?(install_name)
|
29
|
+
Rake::Task[install_name]
|
50
30
|
end
|
51
|
-
end
|
52
31
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Rake.application.current_scope.path_with_task_name(task_name)
|
32
|
+
if needs_fetch
|
33
|
+
[clean, download, extract, install].compact.map(&:invoke)
|
34
|
+
end
|
57
35
|
end
|
58
36
|
end
|
59
37
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
require 'rake_factory'
|
1
2
|
require 'zip'
|
2
|
-
|
3
|
+
|
3
4
|
require_relative '../template'
|
4
5
|
require_relative '../extractors'
|
5
6
|
|
6
7
|
module RakeDependencies
|
7
8
|
module Tasks
|
8
|
-
class Extract <
|
9
|
-
|
9
|
+
class Extract < RakeFactory::Task
|
10
|
+
default_name :extract
|
11
|
+
default_description ->(t) { "Extract #{t.dependency} archive" }
|
10
12
|
|
11
13
|
parameter :type, default: :zip
|
12
14
|
parameter :os_ids, default: {
|
@@ -31,52 +33,44 @@ module RakeDependencies
|
|
31
33
|
parameter :target_binary_name_template
|
32
34
|
parameter :strip_path_template
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
action do
|
37
|
+
parameters = {
|
38
|
+
version: version,
|
39
|
+
platform: platform,
|
40
|
+
os_id: os_id,
|
41
|
+
ext: ext
|
42
|
+
}
|
43
|
+
|
44
|
+
distribution_file_name = Template.new(file_name_template)
|
45
|
+
.with_parameters(parameters)
|
46
|
+
.render
|
47
|
+
distribution_file_directory = File.join(path, distribution_directory)
|
48
|
+
distribution_file_path = File.join(
|
49
|
+
distribution_file_directory, distribution_file_name)
|
50
|
+
|
51
|
+
extraction_path = File.join(path, binary_directory)
|
52
|
+
|
53
|
+
options = {}
|
54
|
+
if strip_path_template
|
55
|
+
options[:strip_path] = Template.new(strip_path_template)
|
56
|
+
.with_parameters(parameters)
|
57
|
+
.render
|
58
|
+
end
|
38
59
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
ext: ext
|
47
|
-
}
|
48
|
-
|
49
|
-
distribution_file_name = Template.new(file_name_template)
|
50
|
-
.with_parameters(parameters)
|
51
|
-
.render
|
52
|
-
distribution_file_directory = File.join(path, distribution_directory)
|
53
|
-
distribution_file_path = File.join(
|
54
|
-
distribution_file_directory, distribution_file_name)
|
55
|
-
|
56
|
-
extraction_path = File.join(path, binary_directory)
|
57
|
-
|
58
|
-
options = {}
|
59
|
-
if strip_path_template
|
60
|
-
options[:strip_path] = Template.new(strip_path_template)
|
61
|
-
.with_parameters(parameters)
|
62
|
-
.render
|
63
|
-
end
|
64
|
-
|
65
|
-
if source_binary_name_template && target_binary_name_template
|
66
|
-
options[:rename_from] = Template.new(source_binary_name_template)
|
67
|
-
.with_parameters(parameters)
|
68
|
-
.render
|
69
|
-
options[:rename_to] = Template.new(target_binary_name_template)
|
70
|
-
.with_parameters(parameters)
|
71
|
-
.render
|
72
|
-
end
|
73
|
-
|
74
|
-
extractor = extractor_for_extension.new(
|
75
|
-
distribution_file_path,
|
76
|
-
extraction_path,
|
77
|
-
options)
|
78
|
-
extractor.extract
|
60
|
+
if source_binary_name_template && target_binary_name_template
|
61
|
+
options[:rename_from] = Template.new(source_binary_name_template)
|
62
|
+
.with_parameters(parameters)
|
63
|
+
.render
|
64
|
+
options[:rename_to] = Template.new(target_binary_name_template)
|
65
|
+
.with_parameters(parameters)
|
66
|
+
.render
|
79
67
|
end
|
68
|
+
|
69
|
+
extractor = extractor_for_extension.new(
|
70
|
+
distribution_file_path,
|
71
|
+
extraction_path,
|
72
|
+
options)
|
73
|
+
extractor.extract
|
80
74
|
end
|
81
75
|
|
82
76
|
private
|
@@ -1,30 +1,22 @@
|
|
1
|
-
|
1
|
+
require 'rake_factory'
|
2
2
|
|
3
3
|
module RakeDependencies
|
4
4
|
module Tasks
|
5
|
-
class Fetch <
|
6
|
-
|
7
|
-
|
8
|
-
parameter :download_task, default: :download
|
9
|
-
parameter :extract_task, default: :extract
|
10
|
-
|
11
|
-
def process_arguments args
|
12
|
-
super(args)
|
13
|
-
self.name = args[0] if args[0]
|
14
|
-
end
|
5
|
+
class Fetch < RakeFactory::Task
|
6
|
+
default_name :fetch
|
7
|
+
default_description ->(t) { "Fetch #{t.dependency}" }
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
scoped_task_name(download_task),
|
20
|
-
scoped_task_name(extract_task)
|
21
|
-
]
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
9
|
+
parameter :dependency, required: true
|
10
|
+
parameter :download_task_name, default: :download
|
11
|
+
parameter :extract_task_name, default: :extract
|
25
12
|
|
26
|
-
|
27
|
-
|
13
|
+
action do |t|
|
14
|
+
[
|
15
|
+
Rake::Task[t.scope.path_with_task_name(t.download_task_name)],
|
16
|
+
Rake::Task[t.scope.path_with_task_name(t.extract_task_name)]
|
17
|
+
].each do |task|
|
18
|
+
task.invoke
|
19
|
+
end
|
28
20
|
end
|
29
21
|
end
|
30
22
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'rake_factory'
|
2
2
|
|
3
3
|
module RakeDependencies
|
4
4
|
module Tasks
|
5
|
-
class Install <
|
6
|
-
|
5
|
+
class Install < RakeFactory::Task
|
6
|
+
default_name :install
|
7
|
+
default_description ->(t) { "Install #{t.dependency}" }
|
7
8
|
|
8
9
|
parameter :os_ids, default: {
|
9
10
|
mac: 'mac',
|
@@ -20,31 +21,23 @@ module RakeDependencies
|
|
20
21
|
|
21
22
|
parameter :installation_directory, required: true
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
task name do
|
31
|
-
parameters = {
|
32
|
-
version: version,
|
33
|
-
platform: platform,
|
34
|
-
os_id: os_id,
|
35
|
-
ext: ext
|
36
|
-
}
|
24
|
+
action do
|
25
|
+
parameters = {
|
26
|
+
version: version,
|
27
|
+
platform: platform,
|
28
|
+
os_id: os_id,
|
29
|
+
ext: ext
|
30
|
+
}
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
binary_file_name = Template.new(binary_name_template)
|
33
|
+
.with_parameters(parameters)
|
34
|
+
.render
|
35
|
+
binary_file_directory = File.join(path, binary_directory)
|
36
|
+
binary_file_path = File.join(
|
37
|
+
binary_file_directory, binary_file_name)
|
44
38
|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
39
|
+
mkdir_p installation_directory
|
40
|
+
cp binary_file_path, installation_directory
|
48
41
|
end
|
49
42
|
|
50
43
|
def os_id
|
data/rake_dependencies.gemspec
CHANGED
@@ -22,17 +22,18 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
25
|
+
spec.required_ruby_version = '>= 2.4.9'
|
26
26
|
|
27
|
+
spec.add_dependency 'rake_factory', '~> 0.7'
|
27
28
|
spec.add_dependency 'hamster', '~> 3.0'
|
28
|
-
spec.add_dependency 'rubyzip', '
|
29
|
-
spec.add_dependency 'minitar', '~> 0.
|
29
|
+
spec.add_dependency 'rubyzip', '~> 2.0'
|
30
|
+
spec.add_dependency 'minitar', '~> 0.9'
|
30
31
|
|
31
|
-
spec.add_development_dependency 'bundler', '~> 1
|
32
|
-
spec.add_development_dependency 'rake', '~>
|
33
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
34
|
-
spec.add_development_dependency 'gem-release', '~> 2.
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
33
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
35
|
+
spec.add_development_dependency 'gem-release', '~> 2.1'
|
35
36
|
spec.add_development_dependency 'activesupport', '~> 5.2'
|
36
|
-
spec.add_development_dependency 'fakefs', '~> 0
|
37
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
37
|
+
spec.add_development_dependency 'fakefs', '~> 1.0'
|
38
|
+
spec.add_development_dependency 'simplecov', '~> 0.17'
|
38
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_dependencies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.1.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
@@ -10,6 +10,20 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake_factory
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: hamster
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -28,86 +42,86 @@ dependencies:
|
|
28
42
|
name: rubyzip
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '2.0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: '2.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitar
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
61
|
+
version: '0.9'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
68
|
+
version: '0.9'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
75
|
+
version: '2.1'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1
|
82
|
+
version: '2.1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '13.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '13.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
103
|
+
version: '3.9'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
110
|
+
version: '3.9'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: gem-release
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2.
|
117
|
+
version: '2.1'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '2.
|
124
|
+
version: '2.1'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: activesupport
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,28 +142,28 @@ dependencies:
|
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0
|
145
|
+
version: '1.0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0
|
152
|
+
version: '1.0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: simplecov
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0.
|
159
|
+
version: '0.17'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
166
|
+
version: '0.17'
|
153
167
|
description: Provides rake tasks for downloading and extracting tools depended on
|
154
168
|
for further build activities.
|
155
169
|
email:
|
@@ -186,11 +200,10 @@ files:
|
|
186
200
|
- config/secrets/rubygems/credentials
|
187
201
|
- go
|
188
202
|
- lib/rake_dependencies.rb
|
189
|
-
- lib/rake_dependencies/exceptions.rb
|
190
203
|
- lib/rake_dependencies/extractors.rb
|
191
|
-
- lib/rake_dependencies/
|
204
|
+
- lib/rake_dependencies/task_sets.rb
|
205
|
+
- lib/rake_dependencies/task_sets/all.rb
|
192
206
|
- lib/rake_dependencies/tasks.rb
|
193
|
-
- lib/rake_dependencies/tasks/all.rb
|
194
207
|
- lib/rake_dependencies/tasks/clean.rb
|
195
208
|
- lib/rake_dependencies/tasks/download.rb
|
196
209
|
- lib/rake_dependencies/tasks/ensure.rb
|
@@ -219,14 +232,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
219
232
|
requirements:
|
220
233
|
- - ">="
|
221
234
|
- !ruby/object:Gem::Version
|
222
|
-
version: 2.
|
235
|
+
version: 2.4.9
|
223
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
237
|
requirements:
|
225
|
-
- - "
|
238
|
+
- - ">"
|
226
239
|
- !ruby/object:Gem::Version
|
227
|
-
version:
|
240
|
+
version: 1.3.1
|
228
241
|
requirements: []
|
229
|
-
rubygems_version: 3.0.
|
242
|
+
rubygems_version: 3.0.1
|
230
243
|
signing_key:
|
231
244
|
specification_version: 4
|
232
245
|
summary: Rake tasks for managing build dependencies.
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'rake/tasklib'
|
2
|
-
require_relative 'exceptions'
|
3
|
-
|
4
|
-
module RakeDependencies
|
5
|
-
class TaskLib < ::Rake::TaskLib
|
6
|
-
class << self
|
7
|
-
def parameter_definitions
|
8
|
-
@parameter_definitions ||= {}
|
9
|
-
end
|
10
|
-
|
11
|
-
def parameter(name, options = {})
|
12
|
-
parameter_definition = ParameterDefinition.new(
|
13
|
-
name, options[:default], options[:required])
|
14
|
-
name = parameter_definition.name
|
15
|
-
|
16
|
-
attr_accessor(name)
|
17
|
-
|
18
|
-
parameter_definitions[name] = parameter_definition
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup_defaults_for(instance)
|
22
|
-
parameter_definitions.values.each do |parameter_definition|
|
23
|
-
parameter_definition.apply_default_to(instance)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def check_required_for(instance)
|
28
|
-
dissatisfied = parameter_definitions.values.reject do |definition|
|
29
|
-
definition.satisfied_by?(instance)
|
30
|
-
end
|
31
|
-
unless dissatisfied.empty?
|
32
|
-
names = dissatisfied.map(&:name)
|
33
|
-
raise RequiredParameterUnset,
|
34
|
-
"Required parameter#{names.length > 1 ? 's' : ''} #{names.join(',')} unset."
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def initialize(*args, &block)
|
40
|
-
setup_defaults
|
41
|
-
process_arguments(args)
|
42
|
-
process_block(block)
|
43
|
-
check_required
|
44
|
-
define
|
45
|
-
end
|
46
|
-
|
47
|
-
def setup_defaults
|
48
|
-
self.class.setup_defaults_for(self)
|
49
|
-
end
|
50
|
-
|
51
|
-
def process_arguments(_)
|
52
|
-
end
|
53
|
-
|
54
|
-
def process_block(block)
|
55
|
-
block.call(self) if block
|
56
|
-
end
|
57
|
-
|
58
|
-
def check_required
|
59
|
-
self.class.check_required_for(self)
|
60
|
-
end
|
61
|
-
|
62
|
-
def define
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
class ParameterDefinition
|
68
|
-
attr_reader :name
|
69
|
-
|
70
|
-
def initialize(name, default = nil, required = false)
|
71
|
-
@name = name.to_sym
|
72
|
-
@default = default
|
73
|
-
@required = required
|
74
|
-
end
|
75
|
-
|
76
|
-
def writer_method
|
77
|
-
"#{name}="
|
78
|
-
end
|
79
|
-
|
80
|
-
def reader_method
|
81
|
-
name
|
82
|
-
end
|
83
|
-
|
84
|
-
def apply_default_to(instance)
|
85
|
-
instance.__send__(writer_method, @default) if @default
|
86
|
-
end
|
87
|
-
|
88
|
-
def dissatisfied_by?(instance)
|
89
|
-
value = instance.__send__(reader_method)
|
90
|
-
@required && value.nil?
|
91
|
-
end
|
92
|
-
|
93
|
-
def satisfied_by?(instance)
|
94
|
-
!dissatisfied_by?(instance)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
require_relative 'clean'
|
2
|
-
require_relative 'download'
|
3
|
-
require_relative 'ensure'
|
4
|
-
require_relative 'extract'
|
5
|
-
require_relative 'fetch'
|
6
|
-
require_relative '../tasklib'
|
7
|
-
|
8
|
-
module RakeDependencies
|
9
|
-
module Tasks
|
10
|
-
class All < TaskLib
|
11
|
-
parameter :containing_namespace
|
12
|
-
|
13
|
-
parameter :dependency, :required => true
|
14
|
-
parameter :version
|
15
|
-
parameter :path, :required => true
|
16
|
-
parameter :type, :default => :zip
|
17
|
-
|
18
|
-
parameter :os_ids, default: {mac: 'mac', linux: 'linux'}
|
19
|
-
|
20
|
-
parameter :distribution_directory, default: 'dist'
|
21
|
-
parameter :binary_directory, default: 'bin'
|
22
|
-
parameter :installation_directory
|
23
|
-
|
24
|
-
parameter :uri_template, :required => true
|
25
|
-
parameter :file_name_template, :required => true
|
26
|
-
parameter :strip_path_template
|
27
|
-
|
28
|
-
parameter :source_binary_name_template
|
29
|
-
parameter :target_binary_name_template
|
30
|
-
|
31
|
-
parameter :needs_fetch, :required => true
|
32
|
-
|
33
|
-
parameter :clean_task_name, :default => :clean
|
34
|
-
parameter :download_task_name, :default => :download
|
35
|
-
parameter :extract_task_name, :default => :extract
|
36
|
-
parameter :install_task_name, :default => :install
|
37
|
-
parameter :fetch_task_name, :default => :fetch
|
38
|
-
parameter :ensure_task_name, :default => :ensure
|
39
|
-
|
40
|
-
alias namespace= containing_namespace=
|
41
|
-
|
42
|
-
def define
|
43
|
-
if containing_namespace
|
44
|
-
namespace containing_namespace do
|
45
|
-
define_tasks
|
46
|
-
end
|
47
|
-
else
|
48
|
-
define_tasks
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def define_tasks
|
55
|
-
Clean.new do |t|
|
56
|
-
t.name = clean_task_name
|
57
|
-
|
58
|
-
t.dependency = dependency
|
59
|
-
t.path = path
|
60
|
-
end
|
61
|
-
Download.new do |t|
|
62
|
-
t.name = download_task_name
|
63
|
-
|
64
|
-
t.dependency = dependency
|
65
|
-
t.version = version
|
66
|
-
t.path = path
|
67
|
-
t.type = type
|
68
|
-
|
69
|
-
t.os_ids = os_ids
|
70
|
-
|
71
|
-
t.distribution_directory = distribution_directory
|
72
|
-
|
73
|
-
t.uri_template = uri_template
|
74
|
-
t.file_name_template = file_name_template
|
75
|
-
end
|
76
|
-
Extract.new do |t|
|
77
|
-
t.name = extract_task_name
|
78
|
-
|
79
|
-
t.dependency = dependency
|
80
|
-
t.version = version
|
81
|
-
t.path = path
|
82
|
-
t.type = type
|
83
|
-
|
84
|
-
t.os_ids = os_ids
|
85
|
-
|
86
|
-
t.distribution_directory = distribution_directory
|
87
|
-
t.binary_directory = binary_directory
|
88
|
-
|
89
|
-
t.file_name_template = file_name_template
|
90
|
-
t.strip_path_template = strip_path_template
|
91
|
-
|
92
|
-
t.source_binary_name_template = source_binary_name_template
|
93
|
-
t.target_binary_name_template = target_binary_name_template
|
94
|
-
end
|
95
|
-
Install.new do |t|
|
96
|
-
t.name = install_task_name
|
97
|
-
|
98
|
-
t.dependency = dependency
|
99
|
-
t.version = version
|
100
|
-
t.path = path
|
101
|
-
t.type = type
|
102
|
-
|
103
|
-
t.os_ids = os_ids
|
104
|
-
|
105
|
-
t.binary_directory = binary_directory
|
106
|
-
t.binary_name_template = target_binary_name_template || dependency
|
107
|
-
|
108
|
-
t.installation_directory = installation_directory
|
109
|
-
end if installation_directory
|
110
|
-
Fetch.new do |t|
|
111
|
-
t.name = fetch_task_name
|
112
|
-
|
113
|
-
t.dependency = dependency
|
114
|
-
|
115
|
-
t.download_task = download_task_name
|
116
|
-
t.extract_task = extract_task_name
|
117
|
-
end
|
118
|
-
Ensure.new do |t|
|
119
|
-
t.name = ensure_task_name
|
120
|
-
|
121
|
-
t.dependency = dependency
|
122
|
-
t.version = version
|
123
|
-
t.path = path
|
124
|
-
|
125
|
-
t.binary_directory = binary_directory
|
126
|
-
|
127
|
-
t.needs_fetch = needs_fetch
|
128
|
-
|
129
|
-
t.clean_task = clean_task_name
|
130
|
-
t.download_task = download_task_name
|
131
|
-
t.extract_task = extract_task_name
|
132
|
-
t.install_task = install_task_name
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|