pretty_feed 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9092c93db2f35d0d54b1194e6044e7183b37af1faca2a10eab4b2b5ba81c38e8
4
+ data.tar.gz: 74d467066d0c10d78ad82f10dc1a74d7e90a4da6b716541aed106d60304d9d48
5
+ SHA512:
6
+ metadata.gz: 4a828968a0a4525a47c631c73fa10c18be3a4f912f47089d0b66e4aa136909e74bc80cf777bffa3ed5de0330a37ba2481e9856218eef5764dae866f0546c30b1
7
+ data.tar.gz: 223a4bcfc83f2ee7b39fd31b8504770bea3fc34db2f908121884ec805645831a05ab6a5b4222b58827ced389f36286ea6438568e776499ed70f05b3afc4685f6
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ ## [Unreleased]
2
+
3
+ ### Added
4
+
5
+
6
+ ### Changed
7
+
8
+
9
+ ### Fixed
10
+
11
+
12
+ ### Removed
13
+
14
+
15
+ ## [0.1.0] - 2022-03-21
16
+
17
+ ### Added
18
+
19
+ Initial Release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders 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, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at peter.boling@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,25 @@
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/pretty_feed][source]
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].
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!
8
+
9
+ ## Contributors
10
+
11
+ [![Contributors](https://contrib.rocks/image?repo=pboling/pretty_feed)][contributors]
12
+
13
+ Made with [contributors-img][contrib-rocks].
14
+
15
+ [comment]: <> (Following links are used by README, CONTRIBUTING)
16
+
17
+ [conduct]: https://github.com/pboling/pretty_feed/blob/master/CODE_OF_CONDUCT.md
18
+
19
+ [contrib-rocks]: https://contrib.rocks
20
+
21
+ [contributors]: https://github.com/pboling/pretty_feed/graphs/contributors
22
+
23
+ [comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
24
+
25
+ [source]: https://github.com/pboling/pretty_feed/
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Peter Boling
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # PrettyFeed
2
+
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
+
5
+ If `ColorizedString` (from the [`colorize` gem](https://github.com/fazibear/colorize) is defined it will use that. It is preferred because it doesn't pollute the `String` class with color methods. Alternatively, it will 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!
6
+
7
+ 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.
8
+
9
+ ## Installation
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add pretty_feed
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install pretty_feed
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ namespace :scrub do
23
+ task :blurb => :environment do |_t, _args|
24
+ include PrettyFeed::PfTf.new(truthy: 'green', falsey: 'blue')
25
+ pf("this will be green", true)
26
+ # => "this will be green" # in the console
27
+ pf("this will be blue", false)
28
+ # => "this will be blue" # in the console
29
+ end
30
+ end
31
+ ```
32
+
33
+ Instead of passing truthy or falsey values, you can pass a proc that will be evaluated with the value passed to it as an argument.
34
+
35
+ ```ruby
36
+ namespace :scrub do
37
+ task :blurb => :environment do |_t, someth|
38
+ include PrettyFeed::PfTf.new(truthy: 'green', falsey: 'blue')
39
+ pf("might be green or blue", someth, ->(a) { a })
40
+ # => the color will depend on what someth is and how the proc evaluates it.
41
+ end
42
+ end
43
+ ```
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ See [CONTRIBUTING.md][contributing]
54
+
55
+ ## Contributors
56
+
57
+ [![Contributors](https://contrib.rocks/image?repo=pboling/pretty_feed)]("https://github.com/pboling/pretty_feed/graphs/contributors")
58
+
59
+ Made with [contributors-img](https://contrib.rocks).
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of
64
+ the [MIT License][license] [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][license-ref].
65
+ See [LICENSE][license] for the official [Copyright Notice][copyright-notice-explainer].
66
+
67
+ * Copyright (c) 2022 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
68
+
69
+ [copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
70
+
71
+ ## Code of Conduct
72
+
73
+ Everyone interacting in the PrettyFeed project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/pretty_feed/blob/main/CODE_OF_CONDUCT.md).
74
+
75
+ ## Versioning
76
+
77
+ This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations of this scheme should be reported as
78
+ bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be
79
+ immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new
80
+ major versions.
81
+
82
+ As a result of this policy, you can (and should) specify a dependency on this gem using
83
+ the [Pessimistic Version Constraint][pvc] with two digits of precision.
84
+
85
+ For example:
86
+
87
+ ```ruby
88
+ spec.add_dependency "pretty_feed", "~> 0.1"
89
+ ```
90
+
91
+ [copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
92
+
93
+ [gh_discussions]: https://github.com/pboling/pretty_feed/discussions
94
+
95
+ [conduct]: https://github.com/pboling/pretty_feed/blob/main/CODE_OF_CONDUCT.md
96
+
97
+ [contributing]: https://github.com/pboling/pretty_feed/blob/main/CONTRIBUTING.md
98
+
99
+ [security]: https://github.com/pboling/pretty_feed/blob/main/SECURITY.md
100
+
101
+ [license]: https://github.com/pboling/pretty_feed/blob/main/LICENSE.txt
102
+
103
+ [license-ref]: https://opensource.org/licenses/MIT
104
+
105
+ [semver]: http://semver.org/
106
+
107
+ [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
108
+
109
+ [railsbling]: http://www.railsbling.com
110
+
111
+ [peterboling]: http://www.peterboling.com
112
+
113
+ [aboutme]: https://about.me/peter.boling
114
+
115
+ [angelme]: https://angel.co/peter-boling
116
+
117
+ [coderme]:http://coderwall.com/pboling
118
+
119
+ [followme-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
120
+
121
+ [tweetme]: http://twitter.com/galtzo
122
+
123
+ [politicme]: https://nationalprogressiveparty.org
124
+
125
+ [documentation]: https://rubydoc.info/github/pboling/pretty_feed/main
126
+
127
+ [source]: https://github.com/pboling/pretty_feed/
128
+
129
+ [actions]: https://github.com/pboling/pretty_feed/actions
130
+
131
+ [issues]: https://github.com/pboling/pretty_feed/issues
132
+
133
+ [climate_maintainability]: https://codeclimate.com/github/pboling/pretty_feed/maintainability
134
+
135
+ [climate_coverage]: https://codeclimate.com/github/pboling/pretty_feed/test_coverage
136
+
137
+ [codecov_coverage]: https://codecov.io/gh/pboling/pretty_feed
138
+
139
+ [code_triage]: https://www.codetriage.com/pboling/pretty_feed
140
+
141
+ [blogpage]: http://www.railsbling.com/tags/pretty_feed/
142
+
143
+ [rubygems]: https://rubygems.org/gems/pretty_feed
144
+
145
+ [chat]: https://gitter.im/pboling/pretty_feed?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
146
+
147
+ [maintenancee_policy]: https://guides.rubyonrails.org/maintenance_policy.html#security-issues
148
+
149
+ [liberapay_donate]: https://liberapay.com/pboling/donate
150
+
151
+ [gh_sponsors]: https://github.com/sponsors/pboling
data/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 0.x | :white_check_mark: |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Peter Boling is the primary maintainer of this gem. Please find a way
12
+ to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
13
+ possible.
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrettyFeed
4
+ # Provide compatibility with Polluted and Unpolluted Strings
5
+ module Compat
6
+ module_function
7
+
8
+ define_method(:[]) do |str, color|
9
+ if defined?(ColorizedString)
10
+ ColorizedString[str]
11
+ elsif str.respond_to?(color.to_sym)
12
+ str
13
+ else
14
+ mod = Module.new do
15
+ define_method(color.to_sym) do
16
+ warn "String '#{self}' doesn't respond to #{color}"
17
+ self
18
+ end
19
+ end
20
+
21
+ str.singleton_class.send(:include, mod)
22
+ str
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrettyFeed
4
+ # Provides the pf (print_feed) method
5
+ module Modulizer
6
+ def to_mod(truthy:, falsey:)
7
+ Module.new do
8
+ define_method(:pftf) do |prefix = nil, value = "", proc = nil|
9
+ cvalue = if proc.nil?
10
+ value
11
+ else
12
+ proc.respond_to?(:call) ? proc.call(value) : proc
13
+ end
14
+ color = cvalue ? truthy : falsey
15
+ puts PrettyFeed::Compat["#{prefix}#{value}", color].send(color)
16
+ end
17
+ end
18
+ end
19
+
20
+ module_function :to_mod
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrettyFeed
4
+ # Pretty Feed Truthy Falsey
5
+ #
6
+ # Usage in a rake task, for example:
7
+ #
8
+ # namespace :scrub do
9
+ # task :blurb => :environment do |_t, args|
10
+ # include PrettyFeed::PfTf.new(truthy: 'green', falsey: 'blue')
11
+ # pf("this will be green", true)
12
+ # # => "this will be green" # but in green
13
+ # pf("this will be blue", false)
14
+ # # => "this will be blue" # but in blue
15
+ # end
16
+ # end
17
+ #
18
+ class PfTf < Module
19
+ def initialize(truthy: "green", falsey: "red")
20
+ # Ruby's Module initializer doesn't take any arguments
21
+ super()
22
+ @truthy = truthy
23
+ @falsey = falsey
24
+ end
25
+
26
+ def included(base)
27
+ modulizer = Modulizer.to_mod(truthy: @truthy, falsey: @falsey)
28
+ base.send(:prepend, modulizer)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PrettyFeed
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "pretty_feed/version"
4
+ require_relative "pretty_feed/compat"
5
+ require_relative "pretty_feed/modulizer"
6
+ require_relative "pretty_feed/pf_tf"
7
+
8
+ # Namespace for this library
9
+ module PrettyFeed
10
+ end
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.configure do |config|
4
+ config.include SilentStream
5
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe PrettyFeed::PfTf do
4
+ subject(:pftfer) { ExamplePfff.new }
5
+ shared_examples_for "ptft call" do
6
+ it "#pftf returns nil when truthy" do
7
+ expect(pftfer.pftf("hi: ", true)).to be_nil
8
+ end
9
+ it "#pftf returns nil when falsey" do
10
+ expect(pftfer.pftf("hi: ", false)).to be_nil
11
+ end
12
+ it "#pftf includes prefix when truthy" do
13
+ str = "hi: "
14
+ output = capture(:stdout) { pftfer.pftf(str, true) }
15
+ expect(output).to match(str)
16
+ end
17
+ it "#pftf includes prefix when falsey" do
18
+ str = "hi: "
19
+ output = capture(:stdout) { pftfer.pftf(str, false) }
20
+ expect(output).to match(str)
21
+ end
22
+ end
23
+
24
+ it_behaves_like "ptft call"
25
+ it "#pftf has output when falsey" do
26
+ if COMPAT_LIB.nil?
27
+ output = capture(:stderr) { pftfer.pftf("hi: ", false) }
28
+ expect(output).to eq("String 'hi: false' doesn't respond to red\n")
29
+ elsif COMPAT_LIB == :cs
30
+ output = capture(:stdout) { pftfer.pftf("hi: ", false) }
31
+ expect(output).to eq("\e[0;31;49mhi: false\e[0m\n")
32
+ else
33
+ output = capture(:stdout) { pftfer.pftf("hi: ", false) }
34
+ expect(output).to eq("\e[1;31mhi: false\e[0m\n")
35
+ end
36
+ end
37
+ it "#pftf has output when truthy" do
38
+ if COMPAT_LIB.nil?
39
+ output = capture(:stderr) { pftfer.pftf("hi: ", true) }
40
+ expect(output).to eq("String 'hi: true' doesn't respond to green\n")
41
+ elsif COMPAT_LIB == :cs
42
+ output = capture(:stdout) { pftfer.pftf("hi: ", true) }
43
+ expect(output).to eq("\e[0;32;49mhi: true\e[0m\n")
44
+ else
45
+ output = capture(:stdout) { pftfer.pftf("hi: ", true) }
46
+ expect(output).to eq("\e[1;32mhi: true\e[0m\n")
47
+ end
48
+ end
49
+
50
+ context "when custom color" do
51
+ subject(:pftfer) { ExamplePfffColors.new }
52
+ it_behaves_like "ptft call"
53
+ it "#pftf has output when falsey" do
54
+ if COMPAT_LIB.nil?
55
+ output = capture(:stderr) { pftfer.pftf("hi: ", false) }
56
+ expect(output).to eq("String 'hi: false' doesn't respond to yellow\n")
57
+ elsif COMPAT_LIB == :cs
58
+ output = capture(:stdout) { pftfer.pftf("hi: ", false) }
59
+ expect(output).to eq("\e[0;33;49mhi: false\e[0m\n")
60
+ else
61
+ output = capture(:stdout) { pftfer.pftf("hi: ", false) }
62
+ expect(output).to eq("\e[1;33mhi: false\e[0m\n")
63
+ end
64
+ end
65
+ it "#pftf has output when truthy" do
66
+ if COMPAT_LIB.nil?
67
+ output = capture(:stderr) { pftfer.pftf("hi: ", true) }
68
+ expect(output).to eq("String 'hi: true' doesn't respond to cyan\n")
69
+ elsif COMPAT_LIB == :cs
70
+ output = capture(:stdout) { pftfer.pftf("hi: ", true) }
71
+ expect(output).to eq("\e[0;36;49mhi: true\e[0m\n")
72
+ else
73
+ output = capture(:stdout) { pftfer.pftf("hi: ", true) }
74
+ expect(output).to eq("\e[1;35mhi: true\e[0m\n")
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,48 @@
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
+ RUN_COVERAGE = ENV["CI_CODECOV"] || ENV["CI"].nil?
24
+
25
+ ruby_version = Gem::Version.new(RUBY_VERSION)
26
+ minimum_version = ->(version, engine = "ruby") { ruby_version >= Gem::Version.new(version) && RUBY_ENGINE == engine }
27
+ coverage = minimum_version.call("2.7") && RUN_COVERAGE
28
+ debugging = minimum_version.call("2.7") && DEBUG
29
+
30
+ if DEBUG
31
+ if debugging
32
+ require "byebug"
33
+ elsif minimum_version.call("2.7", "jruby")
34
+ require "pry-debugger-jruby"
35
+ end
36
+ end
37
+
38
+ require "simplecov" if coverage
39
+
40
+ # This gem
41
+ require "pretty_feed"
42
+
43
+ # RSpec Configs
44
+ require "config/rspec/rspec_core"
45
+ require "config/rspec/silent_stream"
46
+
47
+ # Support Files
48
+ require "support/example_classes"
@@ -0,0 +1,9 @@
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
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pretty_feed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Peter Boling
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-03-21 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: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-benchmark
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-block_is_expected
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: silent_stream
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '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.20
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.20
97
+ description: |
98
+ PrettyFeed provides a modulizer you can include in a job, worker, class, rake task, etc,
99
+ which allows for simple pass/fail logging colorization.
100
+ Defaults are `truthy: 'green'` and `falsey: 'red'`.
101
+ email:
102
+ - peter.boling@gmail.com
103
+ executables: []
104
+ extensions: []
105
+ extra_rdoc_files: []
106
+ files:
107
+ - CHANGELOG.md
108
+ - CODE_OF_CONDUCT.md
109
+ - CONTRIBUTING.md
110
+ - LICENSE.txt
111
+ - README.md
112
+ - SECURITY.md
113
+ - lib/pretty_feed.rb
114
+ - lib/pretty_feed/compat.rb
115
+ - lib/pretty_feed/modulizer.rb
116
+ - lib/pretty_feed/pf_tf.rb
117
+ - 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
+ homepage: https://github.com/pboling/pretty_feed
125
+ licenses:
126
+ - MIT
127
+ metadata:
128
+ homepage_uri: https://github.com/pboling/pretty_feed
129
+ source_code_uri: https://github.com/pboling/pretty_feed/tree/v0.1.0
130
+ changelog_uri: https://github.com/pboling/pretty_feed/blob/v0.1.0/CHANGELOG.md
131
+ bug_tracker_uri: https://github.com/pboling/pretty_feed/issues
132
+ documentation_uri: https://www.rubydoc.info/gems/pretty_feed/0.1.0
133
+ wiki_uri: https://github.com/pboling/pretty_feed/wiki
134
+ rubygems_mfa_required: 'true'
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: 2.6.0
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubygems_version: 3.3.7
151
+ signing_key:
152
+ 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