cleanser 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cleanser +3 -2
- data/lib/cleanser.rb +20 -7
- data/lib/cleanser/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 811c0de6349361fa96a71d9e6606fdc5b79041dd
|
4
|
+
data.tar.gz: 7be10cd4d79c2c19ce2319e19f6007f559007c3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ce963d0d9f35d8e457f0644e595068856ddc72ca170f3e1cfc4d7e891df83b6c720fb14489a2b939e1418862c16b9d08f8f5a84a887a7f33e3e71a41ef3f94
|
7
|
+
data.tar.gz: 1b0ae0e4693b6f8c42efb9d6e2d5dfcb8a8d8b78570b22cc23ed2d952bae7ebe7497e101f9b968f130cfb31eca46f9ebec875b83faa47273b2cd2d4788cecfd8
|
data/bin/cleanser
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
2
|
+
root = File.expand_path("../..", __FILE__)
|
3
|
+
$LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
|
4
|
+
|
4
5
|
require "cleanser"
|
5
6
|
exit Cleanser.cli(ARGV)
|
data/lib/cleanser.rb
CHANGED
@@ -10,9 +10,9 @@ module Cleanser
|
|
10
10
|
expand_folders(files, failing)
|
11
11
|
|
12
12
|
if !files.include?(failing)
|
13
|
-
abort "Files have to include the failing file
|
13
|
+
abort "Files have to include the failing file"
|
14
14
|
elsif files.size < 2
|
15
|
-
abort "Files have to be more than 2
|
15
|
+
abort "Files have to be more than 2"
|
16
16
|
elsif !success?([failing], options)
|
17
17
|
abort "#{failing} fails when run on it's own"
|
18
18
|
elsif success?(files, options)
|
@@ -52,14 +52,23 @@ module Cleanser
|
|
52
52
|
BANNER
|
53
53
|
opts.on("-r", "--rspec", "RSpec") { options[:rspec] = true }
|
54
54
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
55
|
-
opts.on("-v", "--version", "Show Version")
|
55
|
+
opts.on("-v", "--version", "Show Version") do
|
56
|
+
require 'cleanser/version' unless defined?(Cleanser::VERSION)
|
57
|
+
puts Cleanser::VERSION; exit
|
58
|
+
end
|
56
59
|
end.parse!(argv)
|
57
60
|
options
|
58
61
|
end
|
59
62
|
|
60
63
|
def expand_folders(files, failing)
|
61
64
|
files.map! do |f|
|
62
|
-
File.file?(f)
|
65
|
+
if File.file?(f)
|
66
|
+
f
|
67
|
+
elsif f =~ /".+"/
|
68
|
+
f.split(/, ?/).map { |f| f.tr('"', '') }
|
69
|
+
else
|
70
|
+
files_from_folder(f, pattern(failing))
|
71
|
+
end
|
63
72
|
end.flatten!
|
64
73
|
end
|
65
74
|
|
@@ -69,9 +78,9 @@ module Cleanser
|
|
69
78
|
end
|
70
79
|
|
71
80
|
def pattern(test)
|
72
|
-
base =
|
81
|
+
base = File.basename(test)
|
73
82
|
if base =~ /^test_/
|
74
|
-
"#{
|
83
|
+
"#{$&}*"
|
75
84
|
elsif base =~ /(_test|_spec)\.rb/
|
76
85
|
"*#{$1}.rb"
|
77
86
|
else
|
@@ -101,7 +110,11 @@ module Cleanser
|
|
101
110
|
command = if options[:rspec]
|
102
111
|
"bundle exec rspec #{files.join(" ")}"
|
103
112
|
else
|
104
|
-
|
113
|
+
require = files.map do |f|
|
114
|
+
f = "./#{f}" unless f.start_with?("/")
|
115
|
+
"-r #{f.sub(/\.rb$/, "")}"
|
116
|
+
end.join(" ")
|
117
|
+
"bundle exec ruby #{require} -e ''"
|
105
118
|
end
|
106
119
|
puts "Running: #{command}"
|
107
120
|
status = system(command)
|
data/lib/cleanser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cleanser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|
@@ -32,7 +32,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 1.9.3
|
36
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|