run-run-spec 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: e261424a24edec90864f3a3cf504e9ccc79bb8be
4
+ data.tar.gz: 46cfea20c1d43f8b95d0ab7b530acdba70ad4ce9
5
+ SHA512:
6
+ metadata.gz: bd051cf091915a808ff6d2cb17384ead0d65d7413e35e82bcd977ee5db99a90dde6794a1fbe78ee245858f81600ac038d745c9acfd3f06d759ce4f3bc2ecaacc
7
+ data.tar.gz: 95bf350755500eb8fbab846865b0cddf465f1794efa1117c49bc8c66ac46180341374cee9e9c243e2ede05003c1f1d7bd67d59b267cfd67082f744a72d36a28c
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -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 ishihata@33i.co.jp. 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
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in run-run-spec.gemspec
4
+ gemspec
@@ -0,0 +1,34 @@
1
+ # RunRunSpec
2
+
3
+ the stick man will run for the safety of your code
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'run-run-spec'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install run-run-spec
20
+
21
+ ## Usage
22
+
23
+ You run RSpec with options
24
+
25
+ ```
26
+ rspec --format RunRunSpec --color spec
27
+ ```
28
+
29
+ or write in `.rspec`
30
+
31
+ ```
32
+ --format RunRunSpec
33
+ --color
34
+ ```
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,126 @@
1
+ require 'rspec/core'
2
+ require 'rspec/core/formatters/base_text_formatter'
3
+
4
+ class RunRunSpec < RSpec::Core::Formatters::BaseTextFormatter
5
+ RSpec::Core::Formatters.register self, :example_passed, :example_pending, :example_failed, :start_dump
6
+
7
+ attr_accessor :progress_count, :success_count, :failed_count, :max_length
8
+
9
+ def initialize(output)
10
+ super output
11
+
12
+ self.progress_count = 0
13
+ self.success_count = 0
14
+ self.failed_count = 0
15
+ self.max_length = IO.console.winsize.last
16
+ end
17
+
18
+ def increment
19
+ self.progress_count += 1
20
+ end
21
+
22
+ def increment_success_count
23
+ self.success_count += 1
24
+ end
25
+
26
+ def increment_failed_count
27
+ self.failed_count += 1
28
+ end
29
+
30
+ def example_passed(_notification)
31
+ increment
32
+ increment_success_count
33
+
34
+ output.print RSpec::Core::Formatters::ConsoleCodes.wrap(hashiru, :success)
35
+
36
+ back_pointer(hashiru)
37
+ end
38
+
39
+ def example_pending(_notification)
40
+ increment
41
+
42
+ output.print RSpec::Core::Formatters::ConsoleCodes.wrap(tomaru, :pending)
43
+
44
+ back_pointer(tomaru)
45
+ end
46
+
47
+ def example_failed(_notification)
48
+ increment
49
+ increment_failed_count
50
+
51
+ output.print RSpec::Core::Formatters::ConsoleCodes.wrap(korobu, :failure)
52
+
53
+ back_pointer(korobu)
54
+ end
55
+
56
+ def start_dump(_notification)
57
+ if self.failed_count.zero?
58
+ output.print RSpec::Core::Formatters::ConsoleCodes.wrap(goal, :success)
59
+ else
60
+ output.print RSpec::Core::Formatters::ConsoleCodes.wrap(failed, :failure)
61
+ end
62
+ end
63
+
64
+ def now_position
65
+ (self.max_length / @example_count.to_f * self.success_count).to_i
66
+ end
67
+
68
+ def back_pointer(str)
69
+ strs = str.split("\n")
70
+ line_num = strs.count
71
+
72
+ output.print "\e[#{line_num}A"
73
+ end
74
+
75
+ def goal
76
+ <<-"EOF"
77
+ #{' ' * (now_position - 8)}  |>
78
+ #{' ' * (now_position - 8)} ○ノ|
79
+ #{' ' * (now_position - 7)}\/| 
80
+ #{'_' * (now_position - 7)}\/ >__
81
+ EOF
82
+ end
83
+
84
+ def failed
85
+ <<-"EOF"
86
+ #{adjust_str(' ', '', 7, ' ')}
87
+ #{adjust_str(' ', '', 7, '|>')}
88
+ #{adjust_str('_', ' _| ̄|○_', 8, '|_')}
89
+ EOF
90
+ end
91
+
92
+ def hashiru
93
+ effect_line = self.progress_count % 2 == 0 ? '==' : ' '
94
+
95
+ <<-"EOF"
96
+ #{adjust_str(' ', effect_line + ' ヘ○ノ', 7, ' ')}
97
+ #{adjust_str(' ', effect_line + ' ノ ', 7, '|>')}
98
+ #{adjust_str('_', effect_line + '/>_', 9, '|_')}
99
+ EOF
100
+ end
101
+
102
+ def tomaru
103
+ <<-"EOF"
104
+ #{adjust_str(' ', ' ヘ○ヘ', 7, '')}
105
+ #{adjust_str(' ', ' |∧ ', 7, '|>')}
106
+ #{adjust_str('_', '/__', 7, '|_')}
107
+ EOF
108
+ end
109
+
110
+ def korobu
111
+ <<-"EOF"
112
+ #{adjust_str(' ', '', 7, '')}
113
+ #{adjust_str(' ', '', 7, '|>')}
114
+ #{adjust_str('_', ' ヽ_○ノ ', 9, '|_')}
115
+ EOF
116
+ end
117
+
118
+ def adjust_str(padstr, printstr, rpad, endstr)
119
+ rpad_length = self.max_length - (printstr.length + now_position + rpad)
120
+ if rpad_length < 0
121
+ "#{padstr * (now_position + rpad_length)}#{printstr}#{endstr}"
122
+ else
123
+ "#{padstr * now_position}#{printstr}#{padstr * rpad_length}#{endstr}"
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,3 @@
1
+ module RunRunSpec
2
+ VERSION = "0.1.0"
3
+ end
@@ -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 'run_run_spec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "run-run-spec"
8
+ spec.version = RunRunSpec::VERSION
9
+ spec.authors = ["pekepek"]
10
+ spec.email = ["ishihata@33i.co.jp"]
11
+
12
+ spec.summary = %q{the stick man will run for the safety of your code}
13
+ spec.description = ''
14
+ spec.homepage = "https://github.com/pekepek/run-run-spec"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.13"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_dependency "rspec"
24
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: run-run-spec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - pekepek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-23 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: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ''
56
+ email:
57
+ - ishihata@33i.co.jp
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - CODE_OF_CONDUCT.md
64
+ - Gemfile
65
+ - README.md
66
+ - Rakefile
67
+ - lib/run_run_spec.rb
68
+ - lib/run_run_spec/version.rb
69
+ - run-run-spec.gemspec
70
+ homepage: https://github.com/pekepek/run-run-spec
71
+ licenses: []
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.5.1
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: the stick man will run for the safety of your code
93
+ test_files: []