rspeck 0.1.2 → 0.1.3

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.
data/bin/rspeck CHANGED
@@ -1,5 +1,17 @@
1
1
  #!/usr/bin/env ruby -w
2
+ #rubygems ignores any shebang and just calls Kernel#load
3
+ #on your 'bin' file anyway. So this script calls out to
4
+ #your shell as soon as it can. Lolruby.
2
5
 
3
- require File.join(File.dirname(__FILE__),'..','lib', 'runner')
6
+ script = <<-EOF
7
+ ACK=`command -v ack-grep || command -v ack`
4
8
 
5
- Spectr::Runner.new.run(ARGV)
9
+ $ACK "#{ARGV.join(' ')}" spec/ | cut -d: -f1-2 | while read line
10
+
11
+ do
12
+ echo "######### testing "$line " #########"
13
+ bundle exec rake spec SPEC=$line
14
+ done
15
+ EOF
16
+
17
+ system(script)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspeck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-14 00:00:00.000000000 Z
12
+ date: 2013-06-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: rspec + ack = <3
15
15
  email: jk@soundcloud.com
@@ -19,10 +19,6 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - bin/rspeck
22
- - lib/colors.rb
23
- - lib/finder.rb
24
- - lib/parsor.rb
25
- - lib/runner.rb
26
22
  homepage: https://github.com/jkischkel/rspeck
27
23
  licenses: []
28
24
  post_install_message:
data/lib/colors.rb DELETED
@@ -1,22 +0,0 @@
1
- class String
2
-
3
- def colorize(color_code)
4
- "\e[#{color_code}m#{self}\e[0m"
5
- end
6
-
7
- def red
8
- colorize(31)
9
- end
10
-
11
- def green
12
- colorize(32)
13
- end
14
-
15
- def yellow
16
- colorize(33)
17
- end
18
-
19
- def pink
20
- colorize(35)
21
- end
22
- end
data/lib/finder.rb DELETED
@@ -1,23 +0,0 @@
1
- module Spectr
2
- module Finder
3
-
4
- def detect_finder
5
- return 'ack' if /^\/\w+/ === `which ack`
6
- return 'ack-grep' if /^\/\w+/ === `which ack-grep`
7
- raise 'ack[-grep] not found!'
8
- end
9
-
10
- def find(pattern, path)
11
- regex = /(\W|\A)it\W.*#{pattern}/
12
- results = `#{detect_finder} \"#{regex}\" #{path} --ruby`
13
-
14
- results.split(/\n/).map do |line|
15
- parts = line.split(/:/).map(&:chomp).map(&:strip)
16
-
17
- { :file => parts[0],
18
- :line => parts[1],
19
- :spec => parts[2] }
20
- end
21
- end
22
- end
23
- end
data/lib/parsor.rb DELETED
@@ -1,26 +0,0 @@
1
- require 'getoptlong'
2
-
3
- module Spectr
4
- module ArgsHelper
5
-
6
- ARGUMENTS = ['--help', '-h', GetoptLong::NO_ARGUMENT]
7
-
8
- def print_help
9
- puts 'rspeck "example matcher" [DIRECTORY...]'
10
- end
11
-
12
- def parse(args)
13
- opts = GetoptLong.new(ARGUMENTS)
14
-
15
- opts.each do |opt, arg|
16
- case opt
17
- when '--help'
18
- print_help
19
- exit 0
20
- end
21
- end
22
-
23
- args
24
- end
25
- end
26
- end
data/lib/runner.rb DELETED
@@ -1,34 +0,0 @@
1
- require_relative 'parsor.rb'
2
- require_relative 'finder.rb'
3
- require_relative 'colors.rb'
4
-
5
- require 'open3'
6
-
7
- module Spectr
8
- class Runner
9
- include Finder, ArgsHelper
10
-
11
- def run(arguments)
12
- args = parse(arguments)
13
-
14
- if args.empty?
15
- puts 'No spec pattern given!'
16
- exit 1
17
- end
18
-
19
- path = args[1] || 'spec/'
20
-
21
- matches = find(args.first, path)
22
-
23
- matches.each do |match|
24
- puts "## testing #{match[:file]}:#{match[:line]} ##".yellow
25
- puts match[:spec].green
26
-
27
- cmd = "bundle exec rake spec SPEC=#{match[:file]}:#{match[:line]}"
28
-
29
- o, _, _ = Open3.capture3(cmd)
30
- puts o.pink
31
- end
32
- end
33
- end
34
- end