rspectacle 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +2 -0
- data/bin/rspectacle +6 -0
- data/lib/rspectacle/file_gather.rb +37 -0
- data/lib/rspectacle/spec_runner.rb +41 -0
- data/lib/rspectacle/version.rb +3 -0
- data/lib/rspectacle.rb +11 -0
- data/rspectacle.gemspec +28 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dc142b452acc516b7597e7eca0f5ccad79fb7d41
|
4
|
+
data.tar.gz: f1e219a72c59e2d00ad5d7413db4b3effdcd787a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7cb215724165b46dde126dbc79c595757741bf68598d1832a460be0c955d6a271120f7da1a7ddccb1f52129ecce5d520d923af9cc2f3e72d784fadc2c91881d
|
7
|
+
data.tar.gz: 480c7a6fac1d3a14794d222edd4ec663d63818c37e39275f692220d0f82e187c061c659733ce5b14fcb7f11ef23dcab4832f7c5b6a0d1aeb58d3a202980b8859
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Corey Finley
|
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,32 @@
|
|
1
|
+
# Rspectacle
|
2
|
+
|
3
|
+
Rspectacle takes the files listed returned by `git status` and runs the
|
4
|
+
associated rspec files.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rspectacle'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install rspectacle
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
$ rspectacle
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it ( https://github.com/finleye/rspectacle/fork )
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/rspectacle
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Rspectacle
|
2
|
+
class FileGather
|
3
|
+
attr_accessor :files
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
self.files = get_staged_files
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_staged_files
|
10
|
+
`git status --porcelain | cut -c4-`.split("\n")
|
11
|
+
end
|
12
|
+
|
13
|
+
def specs_to_run
|
14
|
+
spec_files = convert_to_spec.select{|file| file =~ /_spec\.rb$/}.uniq
|
15
|
+
spec_files.select{|path| File.exist? path}
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def convert_to_spec
|
21
|
+
files.each do |file_path|
|
22
|
+
next if file_path =~ /^spec/
|
23
|
+
in_app = app_paths.any? { |path| file_path =~ path}
|
24
|
+
file_path.gsub!(/^app\//, "") if in_app
|
25
|
+
file_path.gsub!(/\.rb$/, '_spec.rb')
|
26
|
+
file_path.prepend "spec/"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def app_paths
|
31
|
+
[/\/controllers\//, /\/models\//, /\/views\//, /\/helpers\//, /\/workers\//, /\/policies\//]
|
32
|
+
end
|
33
|
+
|
34
|
+
def reject_paths
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Rspectacle
|
2
|
+
class SpecRunner
|
3
|
+
attr_accessor :files
|
4
|
+
|
5
|
+
def initialize(files)
|
6
|
+
self.files = files
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
raise "No Files Found" if files.empty?
|
11
|
+
|
12
|
+
announce_files
|
13
|
+
|
14
|
+
cmd = "bin/rspec #{files.join(' ')}"
|
15
|
+
|
16
|
+
begin
|
17
|
+
PTY.spawn( cmd ) do |stdout, stdin, pid|
|
18
|
+
begin
|
19
|
+
stdout.each do |line|
|
20
|
+
next if line =~ /^cat\r\n$/
|
21
|
+
print line
|
22
|
+
end
|
23
|
+
rescue Errno::EIO
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
rescue PTY::ChildExited
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def announce_files
|
33
|
+
puts ""
|
34
|
+
puts "Running Specs:"
|
35
|
+
files.each do |file|
|
36
|
+
puts "* #{file}"
|
37
|
+
end
|
38
|
+
puts ""
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/rspectacle.rb
ADDED
data/rspectacle.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rspectacle/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rspectacle"
|
8
|
+
spec.version = Rspectacle::VERSION
|
9
|
+
spec.authors = ["Corey Finley"]
|
10
|
+
spec.email = ["finley.corey@gmail.com"]
|
11
|
+
spec.summary = %q{Run specs for altered files}
|
12
|
+
spec.description = %q{Based on git status, all relevant specs are run}
|
13
|
+
spec.homepage = "http://finleye.github.io"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ["rspectacle"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency 'rspec', '~> 2.99'
|
24
|
+
spec.add_development_dependency 'pry', '~> 0.9.12.2'
|
25
|
+
|
26
|
+
spec.add_runtime_dependency 'hashie'
|
27
|
+
spec.add_runtime_dependency 'haml', '~> 4.0.3'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspectacle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Corey Finley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-02 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
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: '2.99'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.99'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.12.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.12.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hashie
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: haml
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.0.3
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.0.3
|
97
|
+
description: Based on git status, all relevant specs are run
|
98
|
+
email:
|
99
|
+
- finley.corey@gmail.com
|
100
|
+
executables:
|
101
|
+
- rspectacle
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- .gitignore
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- bin/rspectacle
|
111
|
+
- lib/rspectacle.rb
|
112
|
+
- lib/rspectacle/file_gather.rb
|
113
|
+
- lib/rspectacle/spec_runner.rb
|
114
|
+
- lib/rspectacle/version.rb
|
115
|
+
- rspectacle.gemspec
|
116
|
+
homepage: http://finleye.github.io
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.0.14
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Run specs for altered files
|
140
|
+
test_files: []
|