This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from haines/implementation
Create gem to group Rake multitask output by task
- Loading branch information
Showing
22 changed files
with
662 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.bundle/ | ||
/.yardoc/ | ||
/doc/ | ||
/pkg/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
AllCops: | ||
TargetRubyVersion: 2.3 | ||
Exclude: | ||
- bin/bundle | ||
- bin/rake | ||
- vendor/bundle/**/* | ||
|
||
Metrics/LineLength: | ||
Enabled: false | ||
|
||
Metrics/MethodLength: | ||
Enabled: false | ||
|
||
Style/BlockDelimiters: | ||
EnforcedStyle: semantic | ||
|
||
Style/Documentation: | ||
Exclude: | ||
- test/**/* | ||
|
||
Style/HashSyntax: | ||
Exclude: | ||
- Rakefile | ||
|
||
Style/Lambda: | ||
EnforcedStyle: literal | ||
|
||
Style/StringLiterals: | ||
EnforcedStyle: double_quotes | ||
|
||
Style/SymbolArray: | ||
EnforcedStyle: brackets | ||
|
||
Style/WordArray: | ||
EnforcedStyle: brackets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sudo: false | ||
language: ruby | ||
rvm: | ||
- 2.3 | ||
- 2.4 | ||
- 2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--markup markdown | ||
--no-private | ||
--plugin relative_markdown_links | ||
- | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
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. | ||
|
||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
|
||
## Our Responsibilities | ||
|
||
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. | ||
|
||
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. | ||
|
||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. | ||
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. | ||
Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. | ||
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. | ||
The project team is obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
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. | ||
|
||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org) [version 1.4](http://contributor-covenant.org/version/1/4/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
rake-multilogs (0.1.0) | ||
rake (~> 12.1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
ast (2.4.0) | ||
coderay (1.1.2) | ||
jaro_winkler (1.5.1) | ||
method_source (0.9.0) | ||
mini_portile2 (2.3.0) | ||
minitest (5.11.3) | ||
nokogiri (1.8.2) | ||
mini_portile2 (~> 2.3.0) | ||
parallel (1.12.1) | ||
parser (2.5.1.0) | ||
ast (~> 2.4.0) | ||
powerpack (0.1.2) | ||
pry (0.11.3) | ||
coderay (~> 1.1.0) | ||
method_source (~> 0.9.0) | ||
rainbow (3.0.0) | ||
rake (12.3.1) | ||
rubocop (0.57.1) | ||
jaro_winkler (~> 1.5.1) | ||
parallel (~> 1.10) | ||
parser (>= 2.5) | ||
powerpack (~> 0.1) | ||
rainbow (>= 2.2.2, < 4.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (~> 1.0, >= 1.0.1) | ||
ruby-progressbar (1.9.0) | ||
unicode-display_width (1.4.0) | ||
yard (0.9.14) | ||
yard-relative_markdown_links (0.1.2) | ||
nokogiri (~> 1.8.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bundler (~> 1.16) | ||
minitest (~> 5.11) | ||
pry (~> 0.11) | ||
rake-multilogs! | ||
rubocop (~> 0.57.1) | ||
yard (~> 0.9) | ||
yard-relative_markdown_links (~> 0.1) | ||
|
||
BUNDLED WITH | ||
1.16.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Rake::Multilogs | ||
|
||
[![Docs](https://img.shields.io/badge/docs-github.io-blue.svg?style=flat-square)](https://haines.github.io/rake-multilogs/) | ||
[![Gem](https://img.shields.io/gem/v/rake-multilogs.svg?style=flat-square)](https://rubygems.org/gems/rake-multilogs) | ||
[![GitHub](https://img.shields.io/badge/github-haines%2Frake--multilogs-blue.svg?style=flat-square)](https://github.com/haines/rake-multilogs) | ||
[![License](https://img.shields.io/github/license/haines/rake-multilogs.svg?style=flat-square)](https://github.com/haines/rake-multilogs/blob/master/LICENSE.md) | ||
[![Travis](https://img.shields.io/travis/haines/rake-multilogs.svg?style=flat-square)](https://travis-ci.org/haines/rake-multilogs) | ||
|
||
|
||
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. | ||
`Rake::Multilogs` untangles the mess by capturing each task's output and displaying it after all the tasks are finished. | ||
|
||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
```ruby | ||
gem "rake-multilogs" | ||
``` | ||
|
||
And then execute: | ||
|
||
```console | ||
$ bundle install | ||
``` | ||
|
||
Or install it yourself as: | ||
|
||
```console | ||
$ gem install rake-multilogs | ||
``` | ||
|
||
JRuby and Windows are not supported, because [`Process.fork`](https://ruby-doc.org/core/Process.html#method-c-fork) is unavailable. | ||
`Rake::Multilogs` will gracefully fall back to the default (interleaved) output on those platforms. | ||
|
||
|
||
## Usage | ||
|
||
Add this line to your application's Rakefile: | ||
|
||
```ruby | ||
require "rake/multilogs" | ||
``` | ||
|
||
|
||
## Development | ||
|
||
After checking out the repo, run `bin/setup` to install dependencies. | ||
Then, run `bin/rake test` to run the tests. | ||
You can also run `bin/console` for an interactive prompt that will allow you to experiment. | ||
|
||
To install this gem onto your local machine, run `bin/rake install`. | ||
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). | ||
|
||
|
||
## Contributing | ||
|
||
Bug reports and pull requests are welcome [on GitHub](https://github.com/haines/rake-multilogs). | ||
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). | ||
|
||
|
||
## License | ||
|
||
© 2018 Andrew Haines, released under the [MIT license](LICENSE.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require "rake/testtask" | ||
require "rubocop/rake_task" | ||
require "yard" | ||
|
||
Rake::TestTask.new do |task| | ||
task.test_files = FileList["test/**/*_test.rb"] | ||
end | ||
|
||
RuboCop::RakeTask.new | ||
|
||
desc "Generate documentation" | ||
YARD::Rake::YardocTask.new :doc | ||
CLOBBER << "doc/" | ||
|
||
task :default => [:doc, :rubocop, :test] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'bundle' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
require "rubygems" | ||
|
||
m = Module.new do | ||
module_function | ||
|
||
def invoked_as_script? | ||
File.expand_path($0) == File.expand_path(__FILE__) | ||
end | ||
|
||
def env_var_version | ||
ENV["BUNDLER_VERSION"] | ||
end | ||
|
||
def cli_arg_version | ||
return unless invoked_as_script? # don't want to hijack other binstubs | ||
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` | ||
bundler_version = nil | ||
update_index = nil | ||
ARGV.each_with_index do |a, i| | ||
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN | ||
bundler_version = a | ||
end | ||
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ | ||
bundler_version = $1 || ">= 0.a" | ||
update_index = i | ||
end | ||
bundler_version | ||
end | ||
|
||
def gemfile | ||
gemfile = ENV["BUNDLE_GEMFILE"] | ||
return gemfile if gemfile && !gemfile.empty? | ||
|
||
File.expand_path("../../Gemfile", __FILE__) | ||
end | ||
|
||
def lockfile | ||
lockfile = | ||
case File.basename(gemfile) | ||
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) | ||
else "#{gemfile}.lock" | ||
end | ||
File.expand_path(lockfile) | ||
end | ||
|
||
def lockfile_version | ||
return unless File.file?(lockfile) | ||
lockfile_contents = File.read(lockfile) | ||
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ | ||
Regexp.last_match(1) | ||
end | ||
|
||
def bundler_version | ||
@bundler_version ||= begin | ||
env_var_version || cli_arg_version || | ||
lockfile_version || "#{Gem::Requirement.default}.a" | ||
end | ||
end | ||
|
||
def load_bundler! | ||
ENV["BUNDLE_GEMFILE"] ||= gemfile | ||
|
||
# must dup string for RG < 1.8 compatibility | ||
activate_bundler(bundler_version.dup) | ||
end | ||
|
||
def activate_bundler(bundler_version) | ||
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0") | ||
bundler_version = "< 2" | ||
end | ||
gem_error = activation_error_handling do | ||
gem "bundler", bundler_version | ||
end | ||
return if gem_error.nil? | ||
require_error = activation_error_handling do | ||
require "bundler/version" | ||
end | ||
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) | ||
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}'`" | ||
exit 42 | ||
end | ||
|
||
def activation_error_handling | ||
yield | ||
nil | ||
rescue StandardError, LoadError => e | ||
e | ||
end | ||
end | ||
|
||
m.load_bundler! | ||
|
||
if m.invoked_as_script? | ||
load Gem.bin_path("bundler", "bundle") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "bundler/setup" | ||
require "rake/multilogs" | ||
|
||
require "pry" | ||
Pry.start |
Oops, something went wrong.