blink1_rspec3_formatter 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c6ff50101ea53307349ecd975cc57197ff8bc6b
4
+ data.tar.gz: 5786516e26dba3b56d1aa36a84c5865cc2f4e3af
5
+ SHA512:
6
+ metadata.gz: 09968454d0de9fe9bf0a6c4bf3e7268fe2728ac46ceaf1a8d00190c3deb0cea5ccf453ad92d0514fb4785110120b7779e40e74f6cd27665a982d007e7c98889d
7
+ data.tar.gz: a774e2884bde432f204690a08bdf4202c87baa4abbe5d1347c5211e716e5eeff5a12a72547651ef9eb4b16be8c5a12460a015011a68b9f38dfff014aac13f7e2
@@ -0,0 +1,120 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ ### JetBrains template
11
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
12
+
13
+ *.iml
14
+
15
+ ## Directory-based project format:
16
+ .idea/
17
+ # if you remove the above rule, at least ignore the following:
18
+
19
+ # User-specific stuff:
20
+ # .idea/workspace.xml
21
+ # .idea/tasks.xml
22
+ # .idea/dictionaries
23
+
24
+ # Sensitive or high-churn files:
25
+ # .idea/dataSources.ids
26
+ # .idea/dataSources.xml
27
+ # .idea/sqlDataSources.xml
28
+ # .idea/dynamic.xml
29
+ # .idea/uiDesigner.xml
30
+
31
+ # Gradle:
32
+ # .idea/gradle.xml
33
+ # .idea/libraries
34
+
35
+ # Mongo Explorer plugin:
36
+ # .idea/mongoSettings.xml
37
+
38
+ ## File-based project format:
39
+ *.ipr
40
+ *.iws
41
+
42
+ ## Plugin-specific files:
43
+
44
+ # IntelliJ
45
+ /out/
46
+
47
+ # mpeltonen/sbt-idea plugin
48
+ .idea_modules/
49
+
50
+ # JIRA plugin
51
+ atlassian-ide-plugin.xml
52
+
53
+ # Crashlytics plugin (for Android Studio and IntelliJ)
54
+ com_crashlytics_export_strings.xml
55
+ crashlytics.properties
56
+ crashlytics-build.properties
57
+ ### OSX template
58
+ .DS_Store
59
+ .AppleDouble
60
+ .LSOverride
61
+
62
+ # Icon must end with two \r
63
+ Icon
64
+
65
+ # Thumbnails
66
+ ._*
67
+
68
+ # Files that might appear in the root of a volume
69
+ .DocumentRevisions-V100
70
+ .fseventsd
71
+ .Spotlight-V100
72
+ .TemporaryItems
73
+ .Trashes
74
+ .VolumeIcon.icns
75
+
76
+ # Directories potentially created on remote AFP share
77
+ .AppleDB
78
+ .AppleDesktop
79
+ Network Trash Folder
80
+ Temporary Items
81
+ .apdisk
82
+ ### Ruby template
83
+ *.gem
84
+ *.rbc
85
+ /.config
86
+ /coverage/
87
+ /InstalledFiles
88
+ /pkg/
89
+ /spec/reports/
90
+ /spec/examples.txt
91
+ /test/tmp/
92
+ /test/version_tmp/
93
+ /tmp/
94
+
95
+ ## Specific to RubyMotion:
96
+ .dat*
97
+ .repl_history
98
+ build/
99
+
100
+ ## Documentation cache and generated files:
101
+ /.yardoc/
102
+ /_yardoc/
103
+ /doc/
104
+ /rdoc/
105
+
106
+ ## Environment normalisation:
107
+ /.bundle/
108
+ /vendor/bundle
109
+ /lib/bundler/man/
110
+
111
+ # for a library or gem, you might want to ignore these files since the code is
112
+ # intended to run in multiple environments; otherwise, check them in:
113
+ # Gemfile.lock
114
+ # .ruby-version
115
+ # .ruby-gemset
116
+
117
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
118
+ .rvmrc
119
+
120
+ work.rb
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install:
5
+ - gem install bundler -v 1.10.6
6
+ - sudo apt-get update
7
+ - sudo apt-get install libusb-1.0-0-dev
8
+ script:
9
+ - bundle exec rake spec
10
+ addons:
11
+ code_climate:
12
+ repo_token: cad5a0a048f74f6e3c7811ab4bf252440a44d9f93037504c3e4cb1ac52e01eea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blink1_rspec_result.gemspec
4
+ gemspec
@@ -0,0 +1,38 @@
1
+ # Blink1Rspec3Formatter
2
+
3
+ [![Build Status](https://travis-ci.org/yoichiro-manabe/blink1_rspec3_formatter.svg?branch=master)](https://travis-ci.org/yoichiro-manabe/blink1_rspec3_formatter)
4
+
5
+ [![Code Climate](https://codeclimate.com/github/yoichiro-manabe/blink1_rspec3_formatter/badges/gpa.svg)](https://codeclimate.com/github/yoichiro-manabe/blink1_rspec3_formatter)
6
+
7
+ This enables indicating **RSpec 3** status with blink(1). When executing rspec3 is below code, blink(1) is blink for rspec result.
8
+
9
+ ```ruby
10
+ rspec --format Blink1Rspec3Formatter --format document
11
+ ```
12
+
13
+ blink(1) bright pattern:
14
+
15
+ * rspec result is success => RGB( 0, 255, 35)
16
+ * rspec result is pending => RGB(255, 200, 0) and blink pending count.
17
+ * rspec result is success => RGB(255, 10, 30) and blink error example count.
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'blink1_rspec3_formatter'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ $ bundle install
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install blink1_rspec3_formatter
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yoichiro_manabe/blink1_rspec3_formatter.
38
+
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blink1_rspec3_formatter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "blink1_rspec3_formatter"
8
+ spec.version = Blink1Rspec3FormatterVersion::VERSION
9
+ spec.authors = ["ymanabe"]
10
+ spec.email = ["ymanabe@beaglesoft.net"]
11
+
12
+ spec.summary = %q{Blink the blink1 at executed rspec finished.}
13
+ spec.description = %q{Blink the blink1 at executed rspec finished..}
14
+ spec.homepage = "https://github.com/yoichiro-manabe/blink1-rspec3-formatter"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "rb-blink1"
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,63 @@
1
+ # require "blink1_rspec_formatter/version"
2
+ require 'pp'
3
+ require 'blink1'
4
+
5
+ class Blink1Rspec3Formatter
6
+
7
+ BLINK_TIMES = 7
8
+ COLOR_SUCCESS = [0, 255, 35]
9
+ COLOR_PENDING = [255, 200, 0]
10
+ COLOR_FAIL = [255, 10, 30]
11
+
12
+ RSpec::Core::Formatters.register self, :close, :dump_failures, :dump_pending
13
+
14
+ def initialize(output)
15
+ @output = output
16
+ @status = {failure: 0, pending: 0}
17
+ end
18
+
19
+ def dump_failures(notification)
20
+ unless notification.failure_notifications.empty?
21
+ @status[:failure] = notification.failed_examples.size
22
+ end
23
+ end
24
+
25
+ def dump_pending(notification)
26
+ unless notification.pending_examples.empty?
27
+ @status[:pending] = notification.pending_examples.size
28
+ end
29
+ end
30
+
31
+ def close(notification)
32
+
33
+ blink1 = Blink1.new
34
+ blink1.open
35
+
36
+ blink_color_and_count = get_color_and_blink_count
37
+ color = blink_color_and_count[:color]
38
+ count = blink_color_and_count[:count]
39
+
40
+ if count > 0
41
+ blink1.blink(color[0], color[1], color[2], count)
42
+ end
43
+
44
+ blink1.set_rgb(color[0], color[1], color[2])
45
+
46
+ sleep(BLINK_TIMES)
47
+
48
+ blink1.off
49
+ blink1.close
50
+ end
51
+
52
+ private
53
+
54
+ def get_color_and_blink_count
55
+ if @status[:failure] > 0
56
+ {count: @status[:failure], color: COLOR_FAIL}
57
+ elsif @status[:pending] > 0
58
+ {count: @status[:pending], color: COLOR_PENDING}
59
+ else
60
+ {count: 0, color: COLOR_SUCCESS}
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,3 @@
1
+ class Blink1Rspec3FormatterVersion
2
+ VERSION = "0.1.4"
3
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blink1_rspec3_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - ymanabe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rb-blink1
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
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: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Blink the blink1 at executed rspec finished..
70
+ email:
71
+ - ymanabe@beaglesoft.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - README.md
80
+ - Rakefile
81
+ - blink1_rspec3_formatter.gemspec
82
+ - lib/blink1_rspec3_formatter.rb
83
+ - lib/blink1_rspec3_formatter/version.rb
84
+ homepage: https://github.com/yoichiro-manabe/blink1-rspec3-formatter
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.4.5.1
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Blink the blink1 at executed rspec finished.
108
+ test_files: []