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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 498aaa7929e49eedb7de42a6a1003d7c599a8a28
4
- data.tar.gz: 84b5ee67a79f4aa5182110afc1f87bd09d47e9e6
3
+ metadata.gz: 811c0de6349361fa96a71d9e6606fdc5b79041dd
4
+ data.tar.gz: 7be10cd4d79c2c19ce2319e19f6007f559007c3f
5
5
  SHA512:
6
- metadata.gz: 897729da315f468c7fe74e4a1c0c520dea48de54d77c562daf8a0e90efaf52f54c510f09047330811a4e41cd063399a9f9440bb81fac154f84d658de0850a18c
7
- data.tar.gz: 4d97456a739ac5a6192c12584f8826218b5b701ce0079d757dceef9ade83b18040a67e2930d79157ceb7e91ea47b2df97a11ca4d4cedb741981178ab378f3c15
6
+ metadata.gz: 68ce963d0d9f35d8e457f0644e595068856ddc72ca170f3e1cfc4d7e891df83b6c720fb14489a2b939e1418862c16b9d08f8f5a84a887a7f33e3e71a41ef3f94
7
+ data.tar.gz: 1b0ae0e4693b6f8c42efb9d6e2d5dfcb8a8d8b78570b22cc23ed2d952bae7ebe7497e101f9b968f130cfb31eca46f9ebec875b83faa47273b2cd2d4788cecfd8
data/bin/cleanser CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH << File.expand_path("../../lib", __FILE__)
3
- require "rubygems" if RUBY_VERSION < "1.9"
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, use the copy helper"
13
+ abort "Files have to include the failing file"
14
14
  elsif files.size < 2
15
- abort "Files have to be more than 2, use the copy helper"
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"){ require 'cleanser/version'; puts Cleanser::VERSION; exit}
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) ? f : files_from_folder(f, pattern(failing))
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 = test.split($/).last
81
+ base = File.basename(test)
73
82
  if base =~ /^test_/
74
- "#{$1}*"
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
- "bundle exec ruby #{files.map { |f| "-r./#{f.sub(/\.rb$/, "")}" }.join(" ")} -e ''"
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)
@@ -1,3 +1,3 @@
1
1
  module Cleanser
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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: 2014-07-13 00:00:00.000000000 Z
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: '0'
35
+ version: 1.9.3
36
36
  required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="