pretty_feed 0.2.0 โ†’ 1.0.0

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
2
  SHA256:
3
- metadata.gz: 33dc8684562bed8df172595936b8fd7669c442e65c436dc4fca6a7c535a69c27
4
- data.tar.gz: 2ad30b05ca9d1122336ad43056dc7fe0fcb139df671c6affc5e504da6cf97b59
3
+ metadata.gz: f28ffaa2b5d8c0fe4f992cb857d1b2d72c88fb2dde5ff0c56a4b94bd9cf69715
4
+ data.tar.gz: 5b45a649323e9d9eb637fd13e0ca30e8f6566907275b86fa12f2abc6f55bd6d1
5
5
  SHA512:
6
- metadata.gz: 58bbaf39fb718f7c2b8f0a2d6f701cb9434e89713901dbfc5f3ab1eb47154b118c93df2ccc5ec32243e1395e7696a58b223647822aa94f354f3e8caaf9fa2ecf
7
- data.tar.gz: b2e92fdad45349185671ebe130a1156844afb935f94d0af8e579a834d55262ad44a03e9c7bc82e6f534dd783ce1b4f1739e882615b5da5fca2de78dcb02a5656
6
+ metadata.gz: 905891aa0228a1ac0cef296d0fc020151443bae448ce2b108798f266322c96a28e330ee401ea58fbced9480733cc1c4df978c51315bf1bfb6471ddcfe35b5343
7
+ data.tar.gz: 8e1cf6063ceaff1044143bb58964292c4992fc977df3ba34913bcc274569450687fde2b17fb461b4442b5d066d9832f895a93b7b1e6d08a5a0d56b0fcc7a6170
data/CHANGELOG.md CHANGED
@@ -1,40 +1,58 @@
1
- ## [Unreleased]
2
-
3
- ### Added
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
4
3
 
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
6
 
7
+ ## [Unreleased]
8
+ ### Added
6
9
  ### Changed
7
-
8
-
9
10
  ### Fixed
11
+ ### Removed
10
12
 
11
-
13
+ ## [1.0.0] - 2023-10-18
14
+ ### Added
15
+ - Ruby 3.2 to CI build matrix
16
+ - `pftf` now accepts a block, and when given:
17
+ - `[BEG] #{msg}#{value}` is logged before executing the block
18
+ - `[FIN] #{msg}#{value}` is logged after executing the block
19
+ - options hash as fourth parameter to `pftf`!
20
+ - `:rescue_logged` - Error classes that should be rescued and logged. Default: `[]`
21
+ - `:backtrace_logged` - When truthy, rescued errors log a full backtrace. Default: `nil`
22
+ - `:reraise` - When truthy, rescued errors will be re-raised. Default: `nil`
23
+ - `:benchmark` - When truthy, prints realtime spent executing block. Default: `nil`
24
+ - 100% Test Line Coverage of all new features, and existing code
25
+ - Support for `term-ansicolor`, in addition to improved support and tests for
26
+ - `colorized`
27
+ - `colored2`
28
+ - `awesome_print`
29
+ - SHA-256 and SHA-512 checksums with each release.
30
+ - Releases are now cryptographically signed
31
+ ### Changed
32
+ - `VERSION` constant is now located at `PrettyFeed::Version::VERSION`
33
+ ### Fixed
34
+ - Errors in documentation
12
35
  ### Removed
36
+ - Ruby 2.6 from CI build matrix
13
37
 
14
38
  ## [0.2.0] - 2022-03-21
15
-
16
39
  ### Fixed
17
-
18
- * Misleading documentation has been corrected
19
-
40
+ - Corrected misleading documentation
20
41
 
21
42
  ## [0.1.1] - 2022-03-21
22
-
23
43
  ### Added
24
-
25
- * 100% test coverage
26
-
44
+ - 100% test coverage
27
45
  ### Changed
28
-
29
- * Improved `warn` text when stub color methods added to instances of String.
30
-
46
+ - Improved `warn` text when stub color methods added to instances of String.
31
47
  ### Fixed
32
-
33
- * Handling of frozen strings
34
-
48
+ - Handling of frozen strings
35
49
 
36
50
  ## [0.1.0] - 2022-03-21
37
-
38
51
  ### Added
52
+ - Initial Release
39
53
 
40
- Initial Release
54
+ [Unreleased]: https://github.com/pboling/pretty_feed/compare/v1.0.0...HEAD
55
+ [1.0.0]: https://github.com/pboling/pretty_feed/compare/v0.2.0...v1.0.0
56
+ [0.2.0]: https://github.com/pboling/pretty_feed/compare/v0.1.1...v0.2.0
57
+ [0.1.1]: https://github.com/pboling/pretty_feed/compare/v0.1.0...v0.1.1
58
+ [0.1.0]: https://github.com/pboling/pretty_feed/compare/cd45565324085939b680c8597599828b4c41511f...v0.1.0
data/CONTRIBUTING.md CHANGED
@@ -1,25 +1,41 @@
1
1
  ## Contributing
2
2
 
3
- Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/pretty_feed][source]
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/pretty_feed][๐ŸšŽsrc-main]
4
4
  . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
5
- the [code of conduct][conduct].
5
+ the [code of conduct][๐Ÿคconduct].
6
6
 
7
- To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request!
7
+ To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request
8
+ and post a message to the [gitter chat][๐Ÿ˜chat].
8
9
 
9
- ## Contributors
10
-
11
- [![Contributors](https://contrib.rocks/image?repo=pboling/pretty_feed)][contributors]
10
+ ## Release
12
11
 
13
- Made with [contributors-img][contrib-rocks].
12
+ To release a new version:
14
13
 
15
- [comment]: <> (Following links are used by README, CONTRIBUTING)
14
+ 1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check
15
+ 2. Update the version number in `version.rb`
16
+ 3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
17
+ 4. Run `git commit -am "๐Ÿ”– Prepare release v<VERSION>"` to commit the changes
18
+ a. NOTE: Remember to [check the build][๐Ÿงชbuild]!
19
+ 5. Run `rake build`
20
+ 6. Run [`bin/checksums`](https://github.com/rubygems/guides/pull/325) to create SHA-256 and SHA-512 checksums
21
+ a. Checksums will be committed automatically by the script
22
+ 7. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org][๐Ÿ’Žrubygems]
16
23
 
17
- [conduct]: https://github.com/pboling/pretty_feed/blob/master/CODE_OF_CONDUCT.md
24
+ NOTE: You will need to have a public key in `certs/`, and list your cert in the
25
+ `gemspec`, in order to sign the new release.
26
+ See: [RubyGems Security Guide][๐Ÿ”’๏ธrubygems-security-guide]
18
27
 
19
- [contrib-rocks]: https://contrib.rocks
28
+ ## Contributors
20
29
 
21
- [contributors]: https://github.com/pboling/pretty_feed/graphs/contributors
30
+ [![Contributors](https://contrib.rocks/image?repo=pboling/pretty_feed)][๐Ÿ–contributors]
22
31
 
23
- [comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
32
+ Made with [contributors-img][๐Ÿ–contrib-rocks].
24
33
 
25
- [source]: https://github.com/pboling/pretty_feed/
34
+ [๐Ÿงชbuild]: https://github.com/pboling/pretty_feed/actions
35
+ [๐Ÿ˜chat]: https://matrix.to/#/%23pboling_pretty_feed:gitter.im
36
+ [๐Ÿคconduct]: https://github.com/pboling/pretty_feed/blob/main/CODE_OF_CONDUCT.md
37
+ [๐Ÿ–contrib-rocks]: https://contrib.rocks
38
+ [๐Ÿ–contributors]: https://github.com/pboling/pretty_feed/graphs/contributors
39
+ [๐Ÿ’Žrubygems]: https://rubygems.org
40
+ [๐Ÿ”’๏ธrubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
41
+ [๐ŸšŽsrc-main]: https://github.com/pboling/pretty_feed
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Peter Boling
3
+ Copyright (c) 2022-2023 Peter Boling
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  PrettyFeed is a modulizer you can include in a job, worker, class, rake task, etc, which allows for simple pass/fail logging colorization. Defaults are `truthy: 'green'` and `falsey: 'red'`.
4
4
 
5
- While this gem has no direct dependencies, it won't accomplish do much for you unless you are using a "console output coloring" gem of some kind.
5
+ While this gem has few direct dependencies, it won't accomplish do much for you unless you are using a "console output coloring" gem of some kind.
6
6
 
7
7
  ## Installation
8
8
 
@@ -18,13 +18,13 @@ If bundler is not being used to manage dependencies, install the gem by executin
18
18
 
19
19
  ```ruby
20
20
  namespace :scrub do
21
- task :blurb => :environment do |_t, _args|
22
- include PrettyFeed::PfTf.new(truthy: 'green', falsey: 'blue')
23
- pftf("this will be green", true)
24
- # => "this will be green: true" # in the console
25
- pftf("this will be blue", false)
26
- # => "this will be blue: false" # in the console
27
- end
21
+ task blurb: :environment do |_t, _args|
22
+ include PrettyFeed::PfTf.new(truthy: "green", falsey: "blue")
23
+ pftf("this will be green: ", true)
24
+ # => "this will be green: true" # in the console
25
+ pftf("this will be blue: ", false)
26
+ # => "this will be blue: false" # in the console
27
+ end
28
28
  end
29
29
  ```
30
30
 
@@ -32,23 +32,40 @@ Instead of passing truthy or falsey values, you can pass a proc that will be eva
32
32
 
33
33
  ```ruby
34
34
  namespace :scrub do
35
- task :blurb => :environment do |_t, someth|
36
- include PrettyFeed::PfTf.new(truthy: 'green', falsey: 'blue')
37
- pftf("might be green or blue", someth, ->(a) { a })
38
- # => "might be green or blue: #{someth}" # in the console
39
- # NOTE: the color will depend on what someth is and whether the proc evaluates as truthy or falsey.
40
- end
35
+ task blurb: :environment do |_t, someth|
36
+ include PrettyFeed::PfTf.new(truthy: "green", falsey: "blue")
37
+ pftf("might be green or blue: ", someth, ->(a) { a })
38
+ # => "might be green or blue: #{someth}" # in the console
39
+ # NOTE: the color will depend on what someth is and whether the proc evaluates as truthy or falsey.
40
+ end
41
41
  end
42
42
  ```
43
43
 
44
- ### Defaults
44
+ ### Options
45
45
 
46
- `ColorizedString` (from the [`colorize` gem](https://github.com/fazibear/colorize)) will be used if it is `defined?`. I prefer it because it doesn't pollute the `String` class with color methods.
46
+ Released v1.0.0 has new features, all tested at 100% line & branch coverage.
47
+ Overall I'm sure the library maintains >= 90% line & branch coverage, and probably 100%,
48
+ but combining the various runs with each String color library is hard.
47
49
 
48
- ### Options
50
+ - `pftf` now accepts a block, and when given:
51
+ - `[BEG] #{msg}#{value}` is logged before executing the block
52
+ - `[FIN] #{msg}#{value}` is logged after executing the block
53
+ - options hash as fourth parameter to `pftf`!
54
+ - `:rescue_logged` - Error classes that should be rescued and logged. Default: `[]`
55
+ - `:backtrace_logged` - When truthy, rescued errors log a full backtrace. Default: `nil`
56
+ - `:reraise` - When truthy, rescued errors will be re-raised. Default: `nil`
57
+ - `:benchmark` - When truthy, prints realtime spent executing block. Default: `nil`
58
+
59
+ Find examples of these options in use, with and without blocks,
60
+ in [`pf_tf_spec.rb`](/spec/pretty_feed/pf_tf_spec.rb), as all options are fully tested.
61
+
62
+ ### Library Defaults
63
+
64
+ `ColorizedString` (from the [`colorize` gem](https://github.com/fazibear/colorize)) will be used if it is `defined?`. I prefer it because it doesn't pollute the `String` class with color methods.
49
65
 
50
- It will also work with strings that respond to the colors you select as methods on the `String` instance. This means it should work with `colored2`, `awesome_print`, and many other similar gems. If your strings do not respond to color methods there will be a `warn` message printed to STDERR. Colors available depend on the gem you use to provide the color methods! The various gems do not have uniform sets of colors, nor names of colors.
66
+ ### Library Options
51
67
 
68
+ It will also work with strings that respond to the colors you select as methods on the `String` instance. This means it should work with `colored2`, `awesome_print`, `term-ansicolor`, and many other similar gems. If your strings do not respond to color methods there will be a `warn` message printed to STDERR. Colors available depend on the gem you use to provide the color methods! The various gems do not have uniform sets of colors, nor names of colors.
52
69
 
53
70
  ## Development
54
71
 
@@ -72,7 +89,7 @@ The gem is available as open source under the terms of
72
89
  the [MIT License][license] [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][license-ref].
73
90
  See [LICENSE][license] for the official [Copyright Notice][copyright-notice-explainer].
74
91
 
75
- * Copyright (c) 2022 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
92
+ * Copyright (c) 2022-2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
76
93
 
77
94
  [copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
78
95
 
@@ -93,7 +110,7 @@ the [Pessimistic Version Constraint][pvc] with two digits of precision.
93
110
  For example:
94
111
 
95
112
  ```ruby
96
- spec.add_dependency "pretty_feed", "~> 0.1"
113
+ spec.add_dependency("pretty_feed", "~> 1.0")
97
114
  ```
98
115
 
99
116
  [copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -156,4 +173,4 @@ spec.add_dependency "pretty_feed", "~> 0.1"
156
173
 
157
174
  [liberapay_donate]: https://liberapay.com/pboling/donate
158
175
 
159
- [gh_sponsors]: https://github.com/sponsors/pboling
176
+ [gh_sponsors]: https://github.com/sponsors/pboling
data/SECURITY.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  ## Supported Versions
4
4
 
5
- | Version | Supported |
6
- | ------- | ------------------ |
7
- | 0.x | :white_check_mark: |
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 1.x | โœ… |
8
+ | 0.x | โŒ |
8
9
 
9
10
  ## Reporting a Vulnerability
10
11
 
11
12
  Peter Boling is the primary maintainer of this gem. Please find a way
12
13
  to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
13
- possible.
14
+ possible.
@@ -8,14 +8,18 @@ module PrettyFeed
8
8
  return str if str.respond_to?(color.to_sym)
9
9
 
10
10
  dstr = str.dup
11
- dstr.singleton_class.send(:include, color_stub(str, color))
11
+ if defined?(Term::ANSIColor)
12
+ dstr.singleton_class.send(:include, Term::ANSIColor)
13
+ else
14
+ dstr.singleton_class.send(:include, color_stub(str, color))
15
+ end
12
16
  dstr
13
17
  end
14
18
  module_function :[]
15
19
 
16
20
  private
17
21
 
18
- def color_stub(str, color)
22
+ module_function def color_stub(str, color)
19
23
  Module.new do
20
24
  define_method(color.to_sym) do
21
25
  warn "Adding stub for missing '#{str}'.#{color}"
@@ -23,6 +27,5 @@ module PrettyFeed
23
27
  end
24
28
  end
25
29
  end
26
- module_function :color_stub
27
30
  end
28
31
  end
@@ -1,18 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Std Libs
4
+ require "benchmark"
5
+
3
6
  module PrettyFeed
4
7
  # Provides the pf (print_feed) method
5
8
  module Modulizer
6
9
  def to_mod(truthy:, falsey:)
7
10
  Module.new do
8
- define_method(:pftf) do |prefix = nil, value = "", proc = nil|
11
+ define_method(:pftf) do |msg = nil, value = "", proc = nil, **options, &block|
12
+ rescue_logged = Array(options[:rescue_logged])
9
13
  cvalue = if proc.nil?
10
- value
11
- else
12
- proc.respond_to?(:call) ? proc.call(value) : proc
13
- end
14
+ value
15
+ else
16
+ proc.respond_to?(:call) ? proc.call(value) : proc
17
+ end
14
18
  color = cvalue ? truthy : falsey
15
- puts PrettyFeed::Compat["#{prefix}#{value}", color].send(color)
19
+ if block
20
+ external_block =
21
+ if rescue_logged.any?
22
+ -> () {
23
+ begin
24
+ block.call
25
+ rescue *rescue_logged => error
26
+ puts PrettyFeed::Compat["[ERR][#{error.class}][#{error.message}] #{msg}#{value}", color].send(color)
27
+ puts PrettyFeed::Compat["[ERR][Backtrace]\n#{error.backtrace.join("\n")}", color].send(color) if options[:backtrace_logged]
28
+ raise error if options[:reraise]
29
+ end
30
+ }
31
+ else
32
+ block
33
+ end
34
+ puts PrettyFeed::Compat["[BEG] #{msg}#{value}", color].send(color)
35
+ if options[:benchmark]
36
+ time = Benchmark.realtime do
37
+ external_block.call
38
+ end
39
+ seconds = "%.4fs" % time
40
+ puts PrettyFeed::Compat["[FIN][#{seconds}] #{msg}#{value}", color].send(color)
41
+ else
42
+ external_block.call
43
+ puts PrettyFeed::Compat["[FIN] #{msg}#{value}", color].send(color)
44
+ end
45
+ else
46
+ puts PrettyFeed::Compat["#{msg}#{value}", color].send(color)
47
+ end
16
48
  end
17
49
  end
18
50
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrettyFeed
4
- VERSION = "0.2.0"
4
+ module Version
5
+ VERSION = "1.0.0"
6
+ end
5
7
  end
data/lib/pretty_feed.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # External gems
4
+ require "version_gem"
5
+
6
+ # This library
3
7
  require_relative "pretty_feed/version"
4
8
  require_relative "pretty_feed/compat"
5
9
  require_relative "pretty_feed/modulizer"
@@ -8,3 +12,7 @@ require_relative "pretty_feed/pf_tf"
8
12
  # Namespace for this library
9
13
  module PrettyFeed
10
14
  end
15
+
16
+ PrettyFeed::Version.class_eval do
17
+ extend VersionGem::Basic
18
+ end
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pretty_feed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-22 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: version_gem
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.1.3
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.3
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: rake
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -24,20 +44,136 @@ dependencies:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
46
  version: '13.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: kettle-soup-cover
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.1'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.1'
61
+ - !ruby/object:Gem::Dependency
62
+ name: kramdown
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.4'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '2.4'
75
+ - !ruby/object:Gem::Dependency
76
+ name: yard
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.9'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 0.9.34
85
+ type: :development
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '0.9'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 0.9.34
95
+ - !ruby/object:Gem::Dependency
96
+ name: yard-junk
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '0.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '0.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: rubocop-lts
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '16.1'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 16.1.1
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '16.1'
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 16.1.1
129
+ - !ruby/object:Gem::Dependency
130
+ name: rubocop-packaging
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '0.5'
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.5.2
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.5'
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 0.5.2
149
+ - !ruby/object:Gem::Dependency
150
+ name: rubocop-rspec
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '2.24'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: '2.24'
27
163
  - !ruby/object:Gem::Dependency
28
164
  name: rspec
29
165
  requirement: !ruby/object:Gem::Requirement
30
166
  requirements:
31
167
  - - "~>"
32
168
  - !ruby/object:Gem::Version
33
- version: '3.10'
169
+ version: '3.12'
34
170
  type: :development
35
171
  prerelease: false
36
172
  version_requirements: !ruby/object:Gem::Requirement
37
173
  requirements:
38
174
  - - "~>"
39
175
  - !ruby/object:Gem::Version
40
- version: '3.10'
176
+ version: '3.12'
41
177
  - !ruby/object:Gem::Dependency
42
178
  name: rspec-benchmark
43
179
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +195,9 @@ dependencies:
59
195
  - - "~>"
60
196
  - !ruby/object:Gem::Version
61
197
  version: '1.0'
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: 1.0.5
62
201
  type: :development
63
202
  prerelease: false
64
203
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,34 +205,57 @@ dependencies:
66
205
  - - "~>"
67
206
  - !ruby/object:Gem::Version
68
207
  version: '1.0'
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: 1.0.5
69
211
  - !ruby/object:Gem::Dependency
70
- name: silent_stream
212
+ name: rspec_junit_formatter
71
213
  requirement: !ruby/object:Gem::Requirement
72
214
  requirements:
73
215
  - - "~>"
74
216
  - !ruby/object:Gem::Version
75
- version: '1'
217
+ version: '0.6'
76
218
  type: :development
77
219
  prerelease: false
78
220
  version_requirements: !ruby/object:Gem::Requirement
79
221
  requirements:
80
222
  - - "~>"
81
223
  - !ruby/object:Gem::Version
82
- version: '1'
224
+ version: '0.6'
83
225
  - !ruby/object:Gem::Dependency
84
- name: yard
226
+ name: rspec-stubbed_env
85
227
  requirement: !ruby/object:Gem::Requirement
86
228
  requirements:
229
+ - - "~>"
230
+ - !ruby/object:Gem::Version
231
+ version: '1.0'
87
232
  - - ">="
88
233
  - !ruby/object:Gem::Version
89
- version: 0.9.20
234
+ version: 1.0.1
90
235
  type: :development
91
236
  prerelease: false
92
237
  version_requirements: !ruby/object:Gem::Requirement
93
238
  requirements:
239
+ - - "~>"
240
+ - !ruby/object:Gem::Version
241
+ version: '1.0'
94
242
  - - ">="
95
243
  - !ruby/object:Gem::Version
96
- version: 0.9.20
244
+ version: 1.0.1
245
+ - !ruby/object:Gem::Dependency
246
+ name: silent_stream
247
+ requirement: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - "~>"
250
+ - !ruby/object:Gem::Version
251
+ version: '1'
252
+ type: :development
253
+ prerelease: false
254
+ version_requirements: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - "~>"
257
+ - !ruby/object:Gem::Version
258
+ version: '1'
97
259
  description: |
98
260
  PrettyFeed provides a modulizer you can include in a job, worker, class, rake task, etc,
99
261
  which allows for simple pass/fail logging colorization.
@@ -115,22 +277,17 @@ files:
115
277
  - lib/pretty_feed/modulizer.rb
116
278
  - lib/pretty_feed/pf_tf.rb
117
279
  - lib/pretty_feed/version.rb
118
- - spec/config/rspec/rspec_core.rb
119
- - spec/config/rspec/silent_stream.rb
120
- - spec/pretty_feed/pf_tf_spec.rb
121
- - spec/pretty_feed_spec.rb
122
- - spec/spec_helper.rb
123
- - spec/support/example_classes.rb
124
280
  homepage: https://github.com/pboling/pretty_feed
125
281
  licenses:
126
282
  - MIT
127
283
  metadata:
128
284
  homepage_uri: https://github.com/pboling/pretty_feed
129
- source_code_uri: https://github.com/pboling/pretty_feed/tree/v0.2.0
130
- changelog_uri: https://github.com/pboling/pretty_feed/blob/v0.2.0/CHANGELOG.md
285
+ source_code_uri: https://github.com/pboling/pretty_feed/tree/v1.0.0
286
+ changelog_uri: https://github.com/pboling/pretty_feed/blob/v1.0.0/CHANGELOG.md
131
287
  bug_tracker_uri: https://github.com/pboling/pretty_feed/issues
132
- documentation_uri: https://www.rubydoc.info/gems/pretty_feed/0.2.0
288
+ documentation_uri: https://www.rubydoc.info/gems/pretty_feed/1.0.0
133
289
  wiki_uri: https://github.com/pboling/pretty_feed/wiki
290
+ funding_uri: https://liberapay.com/pboling
134
291
  rubygems_mfa_required: 'true'
135
292
  post_install_message:
136
293
  rdoc_options: []
@@ -147,14 +304,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
304
  - !ruby/object:Gem::Version
148
305
  version: '0'
149
306
  requirements: []
150
- rubygems_version: 3.3.7
307
+ rubygems_version: 3.4.21
151
308
  signing_key:
152
309
  specification_version: 4
153
- summary: Simple pass/fail logging colorization
154
- test_files:
155
- - spec/config/rspec/rspec_core.rb
156
- - spec/config/rspec/silent_stream.rb
157
- - spec/pretty_feed/pf_tf_spec.rb
158
- - spec/pretty_feed_spec.rb
159
- - spec/spec_helper.rb
160
- - spec/support/example_classes.rb
310
+ summary: Simple pass/fail logging with colorization, and block rescuing/benchmarking
311
+ test_files: []
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.configure do |config|
4
- # Enable flags like --only-failures and --next-failure
5
- config.example_status_persistence_file_path = ".rspec_status"
6
-
7
- # Disable RSpec exposing methods globally on `Module` and `main`
8
- config.disable_monkey_patching!
9
-
10
- config.expect_with :rspec do |c|
11
- c.syntax = :expect
12
- end
13
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.configure do |config|
4
- config.include SilentStream
5
- end
@@ -1,81 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe PrettyFeed::PfTf do
4
- subject(:pftfer) { ExamplePfff.new }
5
- let(:caught) { COMPAT_LIB.nil? ? :stderr : :stdout }
6
- let(:str) { "pear: " }
7
- let(:truthy_value) { :cake }
8
- let(:falsey_value) { false }
9
- let(:color_open) { Regexp.escape("\e[") }
10
- let(:color_close) { Regexp.escape("\e[0m\n") }
11
- let(:falsey_out) { capture(caught) { pftfer.pftf(str, falsey_value) } }
12
- let(:truthy_out) { capture(caught) { pftfer.pftf(str, truthy_value) } }
13
- let(:falsey_out_proc) { capture(caught) { pftfer.pftf(str, falsey_value, ->(a) { a }) } }
14
- let(:truthy_out_proc) { capture(caught) { pftfer.pftf(str, truthy_value, ->(a) { !a.nil? }) } }
15
- let(:truthy_color) { :green }
16
- let(:falsey_color) { :red }
17
-
18
- shared_examples_for "ptft call" do
19
- it "#pftf returns nil when truthy" do
20
- expect(pftfer.pftf(str, truthy_value)).to be_nil
21
- end
22
- it "#pftf returns nil when proc is truthy" do
23
- expect(pftfer.pftf(str, truthy_value, ->(a) { !a.nil? })).to be_nil
24
- end
25
- it "#pftf returns nil when falsey" do
26
- expect(pftfer.pftf(str, falsey_value)).to be_nil
27
- end
28
- it "#pftf returns nil when proc is falsey" do
29
- expect(pftfer.pftf(str, falsey_value, ->(a) { !a })).to be_nil
30
- end
31
- it "#pftf includes prefix when truthy" do
32
- expect(truthy_out).to match("#{str}#{truthy_value}")
33
- end
34
- it "#pftf includes prefix when proc is truthy" do
35
- expect(truthy_out_proc).to match("#{str}#{truthy_value}")
36
- end
37
- it "#pftf includes prefix when falsey" do
38
- expect(falsey_out).to match("#{str}#{falsey_value}")
39
- end
40
- it "#pftf includes prefix when proc is falsey" do
41
- expect(falsey_out_proc).to match("#{str}#{falsey_value}")
42
- end
43
- it "#pftf has output when falsey" do
44
- if COMPAT_LIB.nil?
45
- expect(falsey_out).to eq("Adding stub for missing '#{str}#{falsey_value}'.#{falsey_color}\n")
46
- else
47
- expect(falsey_out).to match(/#{color_open}.*\d{2}m#{Regexp.escape(str.to_s)}#{Regexp.escape(falsey_value.to_s)}#{color_close}/)
48
- end
49
- end
50
- it "#pftf has output when falsey proc" do
51
- if COMPAT_LIB.nil?
52
- expect(falsey_out_proc).to eq("Adding stub for missing '#{str}#{falsey_value}'.#{falsey_color}\n")
53
- else
54
- expect(falsey_out_proc).to match(/#{color_open}.*\d{2}m#{Regexp.escape(str.to_s)}#{Regexp.escape(falsey_value.to_s)}#{color_close}/)
55
- end
56
- end
57
- it "#pftf has output when truthy" do
58
- if COMPAT_LIB.nil?
59
- expect(truthy_out).to eq("Adding stub for missing '#{str}#{truthy_value}'.#{truthy_color}\n")
60
- else
61
- expect(truthy_out).to match(/#{color_open}.*\d{2}m#{Regexp.escape(str.to_s)}#{Regexp.escape(truthy_value.to_s)}#{color_close}/)
62
- end
63
- end
64
- it "#pftf has output when truthy proc" do
65
- if COMPAT_LIB.nil?
66
- expect(truthy_out_proc).to eq("Adding stub for missing '#{str}#{truthy_value}'.#{truthy_color}\n")
67
- else
68
- expect(truthy_out_proc).to match(/#{color_open}.*\d{2}m#{Regexp.escape(str.to_s)}#{Regexp.escape(truthy_value.to_s)}#{color_close}/)
69
- end
70
- end
71
- end
72
-
73
- it_behaves_like "ptft call"
74
-
75
- context "when custom color" do
76
- subject(:pftfer) { ExamplePfffColors.new }
77
- let(:truthy_color) { :cyan }
78
- let(:falsey_color) { :yellow }
79
- it_behaves_like "ptft call"
80
- end
81
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe PrettyFeed do
4
- it "has a version number" do
5
- expect(PrettyFeed::VERSION).not_to be nil
6
- end
7
- end
data/spec/spec_helper.rb DELETED
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "silent_stream"
4
- compat_lib = begin
5
- require "awesome_print"
6
- puts "Testing with awesome_print"
7
- :ap
8
- rescue LoadError # rubocop:disable Lint/SuppressedException
9
- end || begin
10
- require "colored2"
11
- puts "Testing with colored2"
12
- :c2
13
- rescue LoadError # rubocop:disable Lint/SuppressedException
14
- end || begin
15
- require "colorized_string"
16
- puts "Testing with colorized_string"
17
- :cs
18
- rescue LoadError # rubocop:disable Lint/SuppressedException
19
- end
20
-
21
- COMPAT_LIB = compat_lib
22
- DEBUG = ENV["DEBUG"] == "true"
23
-
24
- ruby_version = Gem::Version.new(RUBY_VERSION)
25
- minimum_version = ->(version, engine = "ruby") { ruby_version >= Gem::Version.new(version) && RUBY_ENGINE == engine }
26
- actual_version = lambda do |major, minor|
27
- actual = Gem::Version.new(ruby_version)
28
- major == actual.segments[0] && minor == actual.segments[1] && RUBY_ENGINE == "ruby"
29
- end
30
- debugging = minimum_version.call("2.7") && DEBUG
31
- RUN_COVERAGE = minimum_version.call("2.6") && (ENV["COVER_ALL"] || ENV["CI_CODECOV"] || ENV["CI"].nil?)
32
- ALL_FORMATTERS = actual_version.call(2, 7) && (ENV["COVER_ALL"] || ENV["CI_CODECOV"] || ENV["CI"])
33
-
34
- if DEBUG
35
- if debugging
36
- require "byebug"
37
- elsif minimum_version.call("2.7", "jruby")
38
- require "pry-debugger-jruby"
39
- end
40
- end
41
-
42
- require "simplecov" if RUN_COVERAGE
43
-
44
- # This gem
45
- require "pretty_feed"
46
-
47
- # RSpec Configs
48
- require "config/rspec/rspec_core"
49
- require "config/rspec/silent_stream"
50
-
51
- # Support Files
52
- require "support/example_classes"
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ExamplePfff
4
- include PrettyFeed::PfTf.new
5
- end
6
-
7
- class ExamplePfffColors
8
- include PrettyFeed::PfTf.new(truthy: "cyan", falsey: "yellow")
9
- end