spec_durr 0.0.1

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
+ SHA1:
3
+ metadata.gz: 585e76e15f2a24273e04a448688a601a3fa48bc3
4
+ data.tar.gz: 7235503175a9c689eb4fb457c231f9b544a306f2
5
+ SHA512:
6
+ metadata.gz: 9dcfcc718a53062b56e801e570027707eeca84a765e0934e80c327285dd4213ec3a0944f95517b658e17e7da9eb33843a74b7eee9c03b420e45ed0452eb4b306
7
+ data.tar.gz: 1d33115777f786f3e2968f8288218fd3944389c3d2ec6802fbf21a5df2266a3c82bfbe16d1feec581d4168960ca55c1b36bc5b52223989b0ab2683ac4c9dab74
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in spec_durr.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Woody Peterson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # SpecDurr
2
+
3
+ The dumbest-thing-that-could-work for pretty-printing a directory of
4
+ specs that can't print themselves (currently, in languages that use
5
+ brackets for scoping).
6
+
7
+ ---
8
+
9
+ One of the best things about describing your tests as specs is reading
10
+ through them to make sure you're covering all the positive, negative,
11
+ and edge cases, and generally capturing the business needs.
12
+
13
+ However, some test frameworks, especially those in Objective-C (and some
14
+ in JavaScript) don't provide a simple & pretty green-and-yellow nested
15
+ spec output for finished and pending specs (respectively).
16
+
17
+ So, this just reads through spec files, pulls out the spec descriptions
18
+ with a regex, and prints a nested green-and-yellow output of done &
19
+ pending.
20
+
21
+ Assuming all your specs are passing, it gets the job done.
22
+
23
+ ## Installation
24
+
25
+ Add this line to your application's Gemfile:
26
+
27
+ gem 'spec_durr'
28
+
29
+ And then execute:
30
+
31
+ $ bundle
32
+
33
+ Or install it yourself as:
34
+
35
+ $ gem install spec_durr
36
+
37
+ ## Usage
38
+
39
+ spec_durr Tests/Specs/**/*.m
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( http://github.com/<my-github-username>/spec_durr/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/spec_durr ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spec_durr'
@@ -0,0 +1,37 @@
1
+ COLORS = {
2
+ green: "\e[0;32m",
3
+ yellow: "\e[0;33m",
4
+ none: "\e[0m"
5
+ }
6
+
7
+ if ARGV.empty?
8
+ puts "Example usage: `print_inferior_specs Tests/Specs/**/*.m`"
9
+ exit(1)
10
+ end
11
+
12
+ ARGV.each do |file|
13
+ level = 0
14
+ puts
15
+
16
+ File.readlines(file).each do |line|
17
+ level += line.count("{")
18
+ level -= line.count("}")
19
+
20
+ if match = line.match(/^ *(describe|context|it|pending).*?"(.*?)"/)
21
+ type, description = *match.captures
22
+ color = case type
23
+ when 'it'
24
+ COLORS[:green]
25
+ when 'pending'
26
+ COLORS[:yellow]
27
+ else # describe, context
28
+ COLORS[:none]
29
+ end
30
+
31
+ level += 1 if type == 'pending'
32
+ puts "#{' ' * level}#{color}#{description}#{COLORS[:none]}"
33
+ level -= 1 if type == 'pending'
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,3 @@
1
+ module SpecDurr
2
+ VERSION = "0.0.1"
3
+ end
data/lib/spec_durr.rb ADDED
@@ -0,0 +1,38 @@
1
+ require "spec_durr/version"
2
+
3
+ COLORS = {
4
+ green: "\e[0;32m",
5
+ yellow: "\e[0;33m",
6
+ none: "\e[0m"
7
+ }
8
+
9
+ if ARGV.empty?
10
+ puts "Example usage: `print_inferior_specs Tests/Specs/**/*.m`"
11
+ exit(1)
12
+ end
13
+
14
+ ARGV.each do |file|
15
+ level = 0
16
+ puts
17
+
18
+ File.readlines(file).each do |line|
19
+ level += line.count("{")
20
+ level -= line.count("}")
21
+
22
+ if match = line.match(/^ *(describe|context|it|pending).*?"(.*?)"/)
23
+ type, description = *match.captures
24
+ color = case type
25
+ when 'it'
26
+ COLORS[:green]
27
+ when 'pending'
28
+ COLORS[:yellow]
29
+ else # describe, context
30
+ COLORS[:none]
31
+ end
32
+
33
+ level += 1 if type == 'pending'
34
+ puts "#{' ' * level}#{color}#{description}#{COLORS[:none]}"
35
+ level -= 1 if type == 'pending'
36
+ end
37
+ end
38
+ end
data/spec_durr.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spec_durr/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "spec_durr"
8
+ spec.version = SpecDurr::VERSION
9
+ spec.authors = ["Woody Peterson"]
10
+ spec.email = ["woody.peterson@gmail.com"]
11
+ spec.summary = %q{pretty-print specs that can't print themselves}
12
+ spec.description = %q{The dumbest-thing-that-could-work for pretty-printing a directory of specs that can't print themselves (currently, in languages that use brackets for scoping).}
13
+ spec.homepage = "https://github.com/woahdae/spec_durr"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spec_durr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Woody Peterson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-30 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.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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
+ description: The dumbest-thing-that-could-work for pretty-printing a directory of
42
+ specs that can't print themselves (currently, in languages that use brackets for
43
+ scoping).
44
+ email:
45
+ - woody.peterson@gmail.com
46
+ executables:
47
+ - spec_durr
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - ".gitignore"
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - bin/spec_durr
57
+ - lib/spec_durr.rb
58
+ - lib/spec_durr/spec_durr.rb
59
+ - lib/spec_durr/version.rb
60
+ - spec_durr.gemspec
61
+ homepage: https://github.com/woahdae/spec_durr
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.2.0
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: pretty-print specs that can't print themselves
85
+ test_files: []