christmas_tree_formatter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: facb0dcf485d1e4e1456c4f84c86728d37ffab70
4
+ data.tar.gz: 719f9f514c2c756c476203104992b8faaf471c78
5
+ SHA512:
6
+ metadata.gz: cacef2c6846f363a25a75362bcd0fe9f5856e6ba616a979a2a14e9699917d318f759ffb4850d95d94b87e11fd2b73e0776fd360567821d85dd094d4216f683cf
7
+ data.tar.gz: 69fd4344bf5c26c7679745966f463d37000d75c2deeade11c37f9da418698e9d2c9a9f65e351ee6ce8d90ea1cd7d2d1fd206b267194bb96f08bb4bb4edebe264
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --require spec_helper
2
+ --require christmas_tree_formatter
3
+ --format ChristmasTreeFormatter
4
+ --color
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ 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. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in christmas_tree_formatter.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Anders Carlsson and Kim Burgestrand
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.
@@ -0,0 +1,53 @@
1
+ # ChristmasTreeFormatter
2
+
3
+ Christmas tree formatter for RSpec.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'christmas_tree_formatter'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install christmas_tree_formatter
20
+
21
+ ## Usage
22
+
23
+ Add to `.rspec`:
24
+
25
+ ```
26
+ --require christmas_tree_formatter
27
+ --format ChristmasTreeFormatter
28
+ ```
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
33
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
34
+ prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To
37
+ release a new version, update the version number in `version.rb`, and then run
38
+ `bundle exec rake release`, which will create a git tag for the version, push
39
+ git commits and tags, and push the `.gem` file to
40
+ [rubygems.org](https://rubygems.org).
41
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitHub at
45
+ <https://github.com/elabs/christmas_tree_formatter>. This project is intended
46
+ to be a safe, welcoming space for collaboration, and contributors are expected
47
+ to adhere to the [Contributor Covenant](http://contributor-covenant.org) code
48
+ of conduct.
49
+
50
+ ## License
51
+
52
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
53
+
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ namespace :spec do
5
+ Dir["./spec/*_spec.rb"].each do |file|
6
+ task_name = File.basename(file, "_spec.rb")
7
+ RSpec::Core::RakeTask.new(task_name) do |task|
8
+ task.pattern = file
9
+ end
10
+ end
11
+ end
12
+
13
+ task default: "spec:medium"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "christmas_tree_formatter"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "christmas_tree_formatter"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "christmas_tree_formatter"
8
+ spec.version = ChristmasTreeFormatter::VERSION
9
+ spec.authors = ["Anders Carlsson", "Kim Burgestrand"]
10
+ spec.email = ["andersc@elabs.se", "kim@elabs.se"]
11
+
12
+ spec.summary = %q{Format your RSpec dots like a christmas tree!}
13
+ spec.homepage = "https://github.com/elabs/christmas_tree_formatter"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rspec-core", "~> 3.0"
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ end
@@ -0,0 +1,70 @@
1
+ # encoding: UTF-8
2
+
3
+ require "rspec/core"
4
+ require "rspec/core/formatters/base_text_formatter"
5
+
6
+ class ChristmasTreeFormatter < RSpec::Core::Formatters::BaseTextFormatter
7
+ VERSION = "0.1.0"
8
+
9
+ include RSpec::Core::Formatters
10
+
11
+ RSpec::Core::Formatters.register self, :start, :example_passed, :example_pending, :example_failed, :stop
12
+
13
+ def start(_notification)
14
+ super
15
+
16
+ max_width = 80
17
+ @width = 1
18
+ @width += 2 until (@width * 2) >= @example_count || @width >= max_width
19
+ @row = 0
20
+ @column = start_column_for_row
21
+
22
+ output.print (" " * @column)
23
+ end
24
+
25
+ def example_passed(_notification)
26
+ print_current("•", :success)
27
+ end
28
+
29
+ def example_pending(_notification)
30
+ print_current(blink("•"), :pending)
31
+ end
32
+
33
+ def example_failed(_notification)
34
+ print_current("•", :failure)
35
+ end
36
+
37
+ def stop(_notification)
38
+ print_current("•", :white) until @column == start_column_for_row
39
+ extra_space = " " * ((end_column_for_row - @column) / 2)
40
+ output.print extra_space
41
+ base = "H"
42
+ output.print "\e[38;5;52m#{base}\e[0m"
43
+ end
44
+
45
+ private
46
+
47
+ def print_current(symbol, type)
48
+ output.print ConsoleCodes.wrap(symbol, type)
49
+ @column += 1
50
+ if @column >= end_column_for_row
51
+ @row += 1
52
+ @column = start_column_for_row
53
+ output.print "\n" + (" " * @column)
54
+ end
55
+ end
56
+
57
+ def start_column_for_row
58
+ [@width/2 - @row, 0].max
59
+ end
60
+
61
+ def end_column_for_row
62
+ middle = @row > 0 ? 1 : 0
63
+ [@width/2 + @row + middle, @width].min
64
+ end
65
+
66
+ def blink(text)
67
+ "\e[5m#{text}\e[0m"
68
+ end
69
+ end
70
+
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: christmas_tree_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anders Carlsson
8
+ - Kim Burgestrand
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2015-12-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec-core
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '3.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '3.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.10'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.10'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ description:
71
+ email:
72
+ - andersc@elabs.se
73
+ - kim@elabs.se
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - CODE_OF_CONDUCT.md
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - christmas_tree_formatter.gemspec
88
+ - lib/christmas_tree_formatter.rb
89
+ homepage: https://github.com/elabs/christmas_tree_formatter
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.3
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Format your RSpec dots like a christmas tree!
113
+ test_files: []