food_formatter 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/.circleci/config.yml +9 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/demo.gif +0 -0
- data/food_formatter.gemspec +21 -0
- data/lib/food_formatter.rb +72 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de1aec992a1f1786adbe81071cec7577c31796b1418d95f4dbe7a778930e6603
|
4
|
+
data.tar.gz: 430982330d9394431dae1ae103ec46a65896b55dfc8d10649e258016223ff893
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e8a4bcfc0f7e539a8f35ade6925fda42895c605e898b5facbda1603598b01582bf24ef718de82f00b9dea299b2574a215485fed0e3d3c850f7f1d71da37609c
|
7
|
+
data.tar.gz: 27ddf81ef41abfd73e3906637eabf09941edf386877aa43d2a1d909ca52a248f84ac8342963811550b67f8f5599292782af8e19278282b17204beccf7f999de1
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at taki3@users.noreply.github.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 taki3
|
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,37 @@
|
|
1
|
+
# FoodFormatter
|
2
|
+
|
3
|
+
[![CircleCI](https://img.shields.io/circleci/project/github/ayindi/food_formatter.svg)](https://circleci.com/gh/ayindi/food_formatter)
|
4
|
+
|
5
|
+
## Description
|
6
|
+
|
7
|
+
The FoodFormatter makes pleasure you on the result of RSpec.
|
8
|
+
|
9
|
+
***DEMO:***
|
10
|
+
|
11
|
+
![](https://github.com/ayindi/food_formatter/blob/master/demo.gif)
|
12
|
+
|
13
|
+
## Instlattion
|
14
|
+
|
15
|
+
First:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem install food_formatter
|
19
|
+
```
|
20
|
+
|
21
|
+
or in your Gemfile
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'food_formatter'
|
25
|
+
```
|
26
|
+
|
27
|
+
Then, when running rspec:
|
28
|
+
|
29
|
+
```
|
30
|
+
rspec --format FoodFormatter
|
31
|
+
```
|
32
|
+
|
33
|
+
Or, if you want to use FoodFormatter as your default formatter, simply put the options in your `.rspec` file:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
--format FoodFormatter
|
37
|
+
```
|
data/Rakefile
ADDED
data/demo.gif
ADDED
Binary file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'food_formatter'
|
6
|
+
spec.version = '0.1.0'
|
7
|
+
spec.authors = ['taki3']
|
8
|
+
spec.email = ['taki3@users.noreply.github.com']
|
9
|
+
|
10
|
+
spec.summary = 'The RSpec formatter of emoji food'
|
11
|
+
spec.homepage = 'https://github.com/ayindi/food_formatter'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
|
15
|
+
spec.require_paths = ['lib']
|
16
|
+
|
17
|
+
spec.add_development_dependency 'bundler'
|
18
|
+
spec.add_development_dependency 'pry-byebug'
|
19
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
20
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
21
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class FoodFormatter < RSpec::Core::Formatters::ProgressFormatter
|
2
|
+
RSpec::Core::Formatters.register self, *%i(example_passed example_pending example_failed dump_pending dump_failures)
|
3
|
+
|
4
|
+
def example_passed(_notification)
|
5
|
+
@output.print(' 🥗 ')
|
6
|
+
end
|
7
|
+
|
8
|
+
def example_pending(_notification)
|
9
|
+
@output.print(' 🍺 ')
|
10
|
+
end
|
11
|
+
|
12
|
+
def example_failed(_notification)
|
13
|
+
@output.print(' 🥩 ')
|
14
|
+
end
|
15
|
+
|
16
|
+
def dump_pending(notification)
|
17
|
+
return if notification.pending_examples.empty?
|
18
|
+
|
19
|
+
formatted = "\n🍺 🍺 🍺 Pending 🍺 🍺 🍺\n"
|
20
|
+
|
21
|
+
notification.pending_notifications.each_with_index do |pending, index|
|
22
|
+
formatted << pending.fully_formatted(index + 1, ::RSpec::Core::Formatters::ConsoleCodes)
|
23
|
+
end
|
24
|
+
|
25
|
+
@output.puts(formatted)
|
26
|
+
end
|
27
|
+
|
28
|
+
def dump_failures(notification)
|
29
|
+
return if notification.failure_notifications.empty?
|
30
|
+
|
31
|
+
formatted = "\n🥩 🥩 🥩 Failure 🥩 🥩 🥩\n"
|
32
|
+
notification.failure_notifications.each_with_index do |failure, index|
|
33
|
+
formatted += failure.fully_formatted(index + 1, ::RSpec::Core::Formatters::ConsoleCodes)
|
34
|
+
end
|
35
|
+
|
36
|
+
@output.puts(formatted)
|
37
|
+
end
|
38
|
+
|
39
|
+
def dump_summary(summary)
|
40
|
+
@output.puts(totals_line(summary))
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def totals_line(summary)
|
46
|
+
@output.puts("#{example_count(summary)} #{failure_count(summary)} #{pending_count(summary)}")
|
47
|
+
end
|
48
|
+
|
49
|
+
def example_count(summary)
|
50
|
+
"#{summary.example_count} #{pluralize(summary.example_count, 'example')}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def failure_count(summary)
|
54
|
+
return if summary.failure_count.zero?
|
55
|
+
|
56
|
+
formatted = ''
|
57
|
+
summary.failure_count.times { formatted << '🥩 ' }
|
58
|
+
formatted << pluralize(summary.failure_count, 'failure')
|
59
|
+
end
|
60
|
+
|
61
|
+
def pending_count(summary)
|
62
|
+
return if summary.pending_count.zero?
|
63
|
+
|
64
|
+
formatted = ''
|
65
|
+
summary.pending_count.times { formatted << '🍺 ' }
|
66
|
+
formatted << pluralize(summary.pending_count, 'pending')
|
67
|
+
end
|
68
|
+
|
69
|
+
def pluralize(count, string)
|
70
|
+
"#{string}#{'s' unless count == 1}"
|
71
|
+
end
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: food_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- taki3
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- taki3@users.noreply.github.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".circleci/config.yml"
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- demo.gif
|
85
|
+
- food_formatter.gemspec
|
86
|
+
- lib/food_formatter.rb
|
87
|
+
homepage: https://github.com/ayindi/food_formatter
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.7.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: The RSpec formatter of emoji food
|
111
|
+
test_files: []
|