rake-multilogs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +35 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/.yardopts +5 -0
- data/CODE_OF_CONDUCT.md +53 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +54 -0
- data/LICENSE.md +10 -0
- data/README.md +65 -0
- data/Rakefile +18 -0
- data/bin/bundle +105 -0
- data/bin/console +8 -0
- data/bin/rake +29 -0
- data/bin/setup +4 -0
- data/lib/rake/multilogs.rb +24 -0
- data/lib/rake/multilogs/fork.rb +49 -0
- data/lib/rake/multilogs/forks.rb +27 -0
- data/lib/rake/multilogs/task.rb +20 -0
- data/lib/rake/multilogs/version.rb +8 -0
- data/rake-multilogs.gemspec +36 -0
- metadata +166 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 64d4859313b42953886395d47fc659c685bcac240fcc1cdf7629152be7cfcca5
|
4
|
+
data.tar.gz: f7da7f6086547bb179bd5e1210b5d3f8ddb3fe8423855969aa8536b6b2412062
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 04f34a77107f34c4dce60865f260f8e154b3c805f719c67f4c496fbfd23cb3eadec8dd10ede8ee4d8c4f6cffdc545a2848127e7b950e5d6645abf8bb21ccead2
|
7
|
+
data.tar.gz: 07bb9c6bdafa949605454cb953b29d23d4e5edd3b6bf0befc63628afc3b72bd12d540b08725483d5dbe0231ca22c765dee8ef40d5a17040bc0a21718265e226c
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
3
|
+
Exclude:
|
4
|
+
- bin/bundle
|
5
|
+
- bin/rake
|
6
|
+
- vendor/bundle/**/*
|
7
|
+
|
8
|
+
Metrics/LineLength:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/BlockDelimiters:
|
15
|
+
EnforcedStyle: semantic
|
16
|
+
|
17
|
+
Style/Documentation:
|
18
|
+
Exclude:
|
19
|
+
- test/**/*
|
20
|
+
|
21
|
+
Style/HashSyntax:
|
22
|
+
Exclude:
|
23
|
+
- Rakefile
|
24
|
+
|
25
|
+
Style/Lambda:
|
26
|
+
EnforcedStyle: literal
|
27
|
+
|
28
|
+
Style/StringLiterals:
|
29
|
+
EnforcedStyle: double_quotes
|
30
|
+
|
31
|
+
Style/SymbolArray:
|
32
|
+
EnforcedStyle: brackets
|
33
|
+
|
34
|
+
Style/WordArray:
|
35
|
+
EnforcedStyle: brackets
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
|
8
|
+
## Our Standards
|
9
|
+
|
10
|
+
Examples of behavior that contributes to creating a positive environment include:
|
11
|
+
|
12
|
+
* Using welcoming and inclusive language
|
13
|
+
* Being respectful of differing viewpoints and experiences
|
14
|
+
* Gracefully accepting constructive criticism
|
15
|
+
* Focusing on what is best for the community
|
16
|
+
* Showing empathy towards other community members
|
17
|
+
|
18
|
+
Examples of unacceptable behavior by participants include:
|
19
|
+
|
20
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
21
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
22
|
+
* Public or private harassment
|
23
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
24
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
25
|
+
|
26
|
+
|
27
|
+
## Our Responsibilities
|
28
|
+
|
29
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
30
|
+
|
31
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
32
|
+
|
33
|
+
|
34
|
+
## Scope
|
35
|
+
|
36
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
37
|
+
Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
38
|
+
Representation of a project may be further defined and clarified by project maintainers.
|
39
|
+
|
40
|
+
|
41
|
+
## Enforcement
|
42
|
+
|
43
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at andrew@haines.org.nz.
|
44
|
+
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
|
45
|
+
The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
|
46
|
+
Further details of specific enforcement policies may be posted separately.
|
47
|
+
|
48
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
49
|
+
|
50
|
+
|
51
|
+
## Attribution
|
52
|
+
|
53
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org) [version 1.4](http://contributor-covenant.org/version/1/4/).
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rake-multilogs (0.1.0)
|
5
|
+
rake (~> 12.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
coderay (1.1.2)
|
12
|
+
jaro_winkler (1.5.1)
|
13
|
+
method_source (0.9.0)
|
14
|
+
mini_portile2 (2.3.0)
|
15
|
+
minitest (5.11.3)
|
16
|
+
nokogiri (1.8.2)
|
17
|
+
mini_portile2 (~> 2.3.0)
|
18
|
+
parallel (1.12.1)
|
19
|
+
parser (2.5.1.0)
|
20
|
+
ast (~> 2.4.0)
|
21
|
+
powerpack (0.1.2)
|
22
|
+
pry (0.11.3)
|
23
|
+
coderay (~> 1.1.0)
|
24
|
+
method_source (~> 0.9.0)
|
25
|
+
rainbow (3.0.0)
|
26
|
+
rake (12.3.1)
|
27
|
+
rubocop (0.57.1)
|
28
|
+
jaro_winkler (~> 1.5.1)
|
29
|
+
parallel (~> 1.10)
|
30
|
+
parser (>= 2.5)
|
31
|
+
powerpack (~> 0.1)
|
32
|
+
rainbow (>= 2.2.2, < 4.0)
|
33
|
+
ruby-progressbar (~> 1.7)
|
34
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
35
|
+
ruby-progressbar (1.9.0)
|
36
|
+
unicode-display_width (1.4.0)
|
37
|
+
yard (0.9.14)
|
38
|
+
yard-relative_markdown_links (0.1.2)
|
39
|
+
nokogiri (~> 1.8.1)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
bundler (~> 1.16)
|
46
|
+
minitest (~> 5.11)
|
47
|
+
pry (~> 0.11)
|
48
|
+
rake-multilogs!
|
49
|
+
rubocop (~> 0.57.1)
|
50
|
+
yard (~> 0.9)
|
51
|
+
yard-relative_markdown_links (~> 0.1)
|
52
|
+
|
53
|
+
BUNDLED WITH
|
54
|
+
1.16.2
|
data/LICENSE.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright © 2018 Andrew Haines
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
10
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Rake::Multilogs
|
2
|
+
|
3
|
+
[![Docs](https://img.shields.io/badge/docs-github.io-blue.svg?style=flat-square)](https://haines.github.io/rake-multilogs/)
|
4
|
+
[![Gem](https://img.shields.io/gem/v/rake-multilogs.svg?style=flat-square)](https://rubygems.org/gems/rake-multilogs)
|
5
|
+
[![GitHub](https://img.shields.io/badge/github-haines%2Frake--multilogs-blue.svg?style=flat-square)](https://github.com/haines/rake-multilogs)
|
6
|
+
[![License](https://img.shields.io/github/license/haines/rake-multilogs.svg?style=flat-square)](https://github.com/haines/rake-multilogs/blob/master/LICENSE.md)
|
7
|
+
[![Travis](https://img.shields.io/travis/haines/rake-multilogs.svg?style=flat-square)](https://travis-ci.org/haines/rake-multilogs)
|
8
|
+
|
9
|
+
|
10
|
+
Rake [multitask](https://ruby.github.io/rake/Rake/DSL.html#method-i-multitask) logs can be confusing, with output from each of the concurrently-running tasks being interleaved.
|
11
|
+
`Rake::Multilogs` untangles the mess by capturing each task's output and displaying it after all the tasks are finished.
|
12
|
+
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem "rake-multilogs"
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
```console
|
25
|
+
$ bundle install
|
26
|
+
```
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
```console
|
31
|
+
$ gem install rake-multilogs
|
32
|
+
```
|
33
|
+
|
34
|
+
JRuby and Windows are not supported, because [`Process.fork`](https://ruby-doc.org/core/Process.html#method-c-fork) is unavailable.
|
35
|
+
`Rake::Multilogs` will gracefully fall back to the default (interleaved) output on those platforms.
|
36
|
+
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
Add this line to your application's Rakefile:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
require "rake/multilogs"
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
## Development
|
48
|
+
|
49
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
50
|
+
Then, run `bin/rake test` to run the tests.
|
51
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
52
|
+
|
53
|
+
To install this gem onto your local machine, run `bin/rake install`.
|
54
|
+
To release a new version, update the version number in `lib/rake/multilogs/version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [RubyGems](https://rubygems.org).
|
55
|
+
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
Bug reports and pull requests are welcome [on GitHub](https://github.com/haines/rake-multilogs).
|
60
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md).
|
61
|
+
|
62
|
+
|
63
|
+
## License
|
64
|
+
|
65
|
+
© 2018 Andrew Haines, released under the [MIT license](LICENSE.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
require "yard"
|
7
|
+
|
8
|
+
Rake::TestTask.new do |task|
|
9
|
+
task.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
RuboCop::RakeTask.new
|
13
|
+
|
14
|
+
desc "Generate documentation"
|
15
|
+
YARD::Rake::YardocTask.new :doc
|
16
|
+
CLOBBER << "doc/"
|
17
|
+
|
18
|
+
task :default => [:doc, :rubocop, :test]
|
data/bin/bundle
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1 || ">= 0.a"
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||= begin
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version || "#{Gem::Requirement.default}.a"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def load_bundler!
|
71
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
|
+
|
73
|
+
# must dup string for RG < 1.8 compatibility
|
74
|
+
activate_bundler(bundler_version.dup)
|
75
|
+
end
|
76
|
+
|
77
|
+
def activate_bundler(bundler_version)
|
78
|
+
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
+
bundler_version = "< 2"
|
80
|
+
end
|
81
|
+
gem_error = activation_error_handling do
|
82
|
+
gem "bundler", bundler_version
|
83
|
+
end
|
84
|
+
return if gem_error.nil?
|
85
|
+
require_error = activation_error_handling do
|
86
|
+
require "bundler/version"
|
87
|
+
end
|
88
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
89
|
+
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
90
|
+
exit 42
|
91
|
+
end
|
92
|
+
|
93
|
+
def activation_error_handling
|
94
|
+
yield
|
95
|
+
nil
|
96
|
+
rescue StandardError, LoadError => e
|
97
|
+
e
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
m.load_bundler!
|
102
|
+
|
103
|
+
if m.invoked_as_script?
|
104
|
+
load Gem.bin_path("bundler", "bundle")
|
105
|
+
end
|
data/bin/console
ADDED
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rake"
|
4
|
+
require "rake/multilogs/fork"
|
5
|
+
require "rake/multilogs/forks"
|
6
|
+
require "rake/multilogs/task"
|
7
|
+
require "rake/multilogs/version"
|
8
|
+
|
9
|
+
module Rake
|
10
|
+
# `Rake::Multilogs` groups multitask output by task, displaying it when all
|
11
|
+
# tasks have completed, rather than the default behavior of displaying output
|
12
|
+
# immediately (which means that output from different tasks becomes
|
13
|
+
# confusingly interleaved).
|
14
|
+
#
|
15
|
+
# This requires `Process.fork`, so is not supported on JRuby or Windows.
|
16
|
+
module Multilogs
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
if Process.respond_to?(:fork)
|
21
|
+
Rake::Task.prepend Rake::Multilogs::Task
|
22
|
+
else
|
23
|
+
warn "Rake::Multilogs is disabled because Process.fork is not available on this platform"
|
24
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
module Multilogs
|
5
|
+
# @private
|
6
|
+
class Fork
|
7
|
+
def initialize(task:, args:, invocation_chain:)
|
8
|
+
@task = task
|
9
|
+
@args = args
|
10
|
+
@invocation_chain = invocation_chain
|
11
|
+
end
|
12
|
+
|
13
|
+
def invoke
|
14
|
+
@reader, @writer = IO.pipe
|
15
|
+
@pid = fork { invoke_in_child_process }
|
16
|
+
@writer.close
|
17
|
+
end
|
18
|
+
|
19
|
+
def wait
|
20
|
+
_, @status = Process.wait2(@pid)
|
21
|
+
end
|
22
|
+
|
23
|
+
def report
|
24
|
+
puts @reader.read
|
25
|
+
end
|
26
|
+
|
27
|
+
def failed?
|
28
|
+
!@status.success?
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
@task.to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def invoke_in_child_process
|
38
|
+
@reader.close
|
39
|
+
[STDOUT, STDERR].each do |stream|
|
40
|
+
stream.reopen @writer
|
41
|
+
end
|
42
|
+
|
43
|
+
@task.application.standard_exception_handling do
|
44
|
+
@task.send :invoke_with_call_chain, @args, @invocation_chain
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
module Multilogs
|
5
|
+
# @private
|
6
|
+
class Forks
|
7
|
+
def initialize(tasks:, args:, invocation_chain:)
|
8
|
+
@forks = tasks.map { |task|
|
9
|
+
Fork.new(
|
10
|
+
task: task,
|
11
|
+
args: args.new_scope(task.arg_names),
|
12
|
+
invocation_chain: invocation_chain
|
13
|
+
)
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def invoke
|
18
|
+
@forks
|
19
|
+
.each(&:invoke)
|
20
|
+
.each(&:wait)
|
21
|
+
.each(&:report)
|
22
|
+
|
23
|
+
abort if @forks.any?(&:failed?)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
module Multilogs
|
5
|
+
# Monkey-patches `Rake::Task` to group multitask output by task and display
|
6
|
+
# it when all tasks have completed.
|
7
|
+
module Task
|
8
|
+
# Invoke all the prerequisites of a task in parallel, grouping output by
|
9
|
+
# task and displaying it when all tasks have completed.
|
10
|
+
# @return [void]
|
11
|
+
def invoke_prerequisites_concurrently(task_args, invocation_chain)
|
12
|
+
Forks.new(
|
13
|
+
tasks: prerequisite_tasks,
|
14
|
+
args: task_args,
|
15
|
+
invocation_chain: invocation_chain
|
16
|
+
).invoke
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require "rake/multilogs/version"
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "rake-multilogs"
|
10
|
+
spec.version = Rake::Multilogs::VERSION
|
11
|
+
spec.authors = ["Andrew Haines"]
|
12
|
+
spec.email = ["andrew@haines.org.nz"]
|
13
|
+
|
14
|
+
spec.summary = "Capture log output from Rake multitasks"
|
15
|
+
spec.description = <<~DESCRIPTION
|
16
|
+
Rake multitask logs can be confusing, with interleaved output from all parallel tasks.
|
17
|
+
Rake::Multilogs untangles the mess by capturing each task's output and displaying it after all the tasks are finished.
|
18
|
+
DESCRIPTION
|
19
|
+
|
20
|
+
spec.homepage = "https://github.com/haines/rake-multilogs"
|
21
|
+
spec.license = "MIT"
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0").reject { |path| path.match(%r{^test/}) } }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.metadata["yard.run"] = "yri"
|
27
|
+
|
28
|
+
spec.add_dependency "rake", "~> 12.1"
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
31
|
+
spec.add_development_dependency "minitest", "~> 5.11"
|
32
|
+
spec.add_development_dependency "pry", "~> 0.11"
|
33
|
+
spec.add_development_dependency "rubocop", "~> 0.57.1"
|
34
|
+
spec.add_development_dependency "yard", "~> 0.9"
|
35
|
+
spec.add_development_dependency "yard-relative_markdown_links", "~> 0.1"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rake-multilogs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Haines
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '12.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '12.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.11'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.11'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.57.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.57.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard-relative_markdown_links
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.1'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.1'
|
111
|
+
description: |
|
112
|
+
Rake multitask logs can be confusing, with interleaved output from all parallel tasks.
|
113
|
+
Rake::Multilogs untangles the mess by capturing each task's output and displaying it after all the tasks are finished.
|
114
|
+
email:
|
115
|
+
- andrew@haines.org.nz
|
116
|
+
executables: []
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- ".ruby-version"
|
123
|
+
- ".travis.yml"
|
124
|
+
- ".yardopts"
|
125
|
+
- CODE_OF_CONDUCT.md
|
126
|
+
- Gemfile
|
127
|
+
- Gemfile.lock
|
128
|
+
- LICENSE.md
|
129
|
+
- README.md
|
130
|
+
- Rakefile
|
131
|
+
- bin/bundle
|
132
|
+
- bin/console
|
133
|
+
- bin/rake
|
134
|
+
- bin/setup
|
135
|
+
- lib/rake/multilogs.rb
|
136
|
+
- lib/rake/multilogs/fork.rb
|
137
|
+
- lib/rake/multilogs/forks.rb
|
138
|
+
- lib/rake/multilogs/task.rb
|
139
|
+
- lib/rake/multilogs/version.rb
|
140
|
+
- rake-multilogs.gemspec
|
141
|
+
homepage: https://github.com/haines/rake-multilogs
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata:
|
145
|
+
yard.run: yri
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 2.7.7
|
163
|
+
signing_key:
|
164
|
+
specification_version: 4
|
165
|
+
summary: Capture log output from Rake multitasks
|
166
|
+
test_files: []
|