cobratest 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/cobratest.gemspec +7 -6
- data/lib/cobratest/gemfile_scraper.rb +12 -32
- data/lib/cobratest.rb +2 -2
- metadata +27 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff70bef30e32aeb2861e2ed2418efd28c8fd884
|
4
|
+
data.tar.gz: dfaf1f67eb5ad013669c2be46ea42ae139b06957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 984c0b3d3c4c794e22152532f508850222b58c2781c784b8a3075a604f66eac0882792ade3cb538f030b3089ea1700dd503bd2b9c794699d124a99c14f13aa61
|
7
|
+
data.tar.gz: 76227aec01e1ef88b6a70024051051bd12cf183601227aa310d8488ca74f8fa94f99ab2a803dad9c02d3276b0f399cfe32b0478e210d360f3cb45b07fc183073
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# cobratest [![Build Status](https://travis-ci.org/shageman/cobratest.svg?branch=master)](https://travis-ci.org/shageman/cobratest) [![Gem Version](https://badge.fury.io/rb/cobratest.svg)](http://badge.fury.io/rb/cobratest) [![Code Climate](https://codeclimate.com/github/shageman/cobratest.png)](https://codeclimate.com/github/shageman/cobratest) [![Dependency Status](https://gemnasium.com/shageman/cobratest.svg)](https://gemnasium.com/shageman/cobratest)
|
2
2
|
|
3
|
-
Prints a list of the components that have changed since the last commit and for which tests need to be run. Uses the dependencies within component-based Ruby/Rails applications (#
|
3
|
+
Prints a list of the components that have changed since the last commit and for which tests need to be run. Uses the dependencies within component-based Ruby/Rails applications (#cbra) to also print all transitively affected components.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -30,7 +30,7 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
## Example
|
32
32
|
|
33
|
-
There are sample #
|
33
|
+
There are sample #cbra folder structures in `spec/examples`. Here is an example run when changing a file in component `C`:
|
34
34
|
|
35
35
|
± |master ✗| → bin/cobratest ~/workspace/cobratest/spec/examples/letters/A
|
36
36
|
/Users/stephan/workspace/cobratest/spec/examples/letters/B/test.sh
|
data/cobratest.gemspec
CHANGED
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'cobratest'
|
7
|
-
spec.version = '0.1.
|
7
|
+
spec.version = '0.1.2'
|
8
8
|
spec.authors = ['Stephan Hagemann']
|
9
9
|
spec.email = ['stephan.hagemann@gmail.com']
|
10
|
-
spec.summary = %q{A test
|
11
|
-
spec.description = %q{A test
|
12
|
-
spec.homepage = 'https://github.com/shageman/
|
10
|
+
spec.summary = %q{A test selector for your component-based Rails application}
|
11
|
+
spec.description = %q{A test selector that suggests the tests based on the recent changes of your application. Makes use of #cbra dependencies to infer which parts of the application are definitely unaffected and can thus be omitted from the current test run.}
|
12
|
+
spec.homepage = 'https://github.com/shageman/cobratest'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
15
15
|
spec.files = %w(
|
@@ -29,7 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.
|
32
|
+
spec.add_dependency 'bundler', '~> 1.13'
|
33
|
+
|
33
34
|
spec.add_development_dependency 'rake'
|
34
|
-
spec.add_development_dependency 'rspec'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.5'
|
35
36
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "bundler"
|
2
|
+
|
1
3
|
module Cbratest
|
2
4
|
class GemfileScraper
|
3
5
|
def initialize(root_path)
|
@@ -45,17 +47,17 @@ module Cbratest
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
def raw_gemfile
|
49
|
-
path = File.expand_path(File.join(@root_path, "Gemfile"))
|
50
|
-
File.read(path)
|
51
|
-
end
|
52
|
-
|
53
50
|
def gem_dependencies
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
gemfile_path = File.join(@root_path, "Gemfile")
|
52
|
+
lockfile_path = File.join(@root_path, "Gemfile.lock")
|
53
|
+
::Bundler::Definition.build(gemfile_path, lockfile_path, nil).dependencies.inject([]) do |memo, dep|
|
54
|
+
path = dep.source.path.to_s if dep.source && dep.source.is_a_path?
|
55
|
+
if path == "."
|
56
|
+
path = nil
|
57
|
+
elsif path && !path.match(/#{dep.name}/)
|
58
|
+
path = "#{path}/#{dep.name}"
|
58
59
|
end
|
60
|
+
memo << { name: dep.name, options: { path: path }}
|
59
61
|
memo
|
60
62
|
end
|
61
63
|
end
|
@@ -67,27 +69,5 @@ module Cbratest
|
|
67
69
|
tr("-", "_").
|
68
70
|
downcase
|
69
71
|
end
|
70
|
-
|
71
|
-
class OptionParser
|
72
|
-
def initialize(options)
|
73
|
-
@options = options
|
74
|
-
end
|
75
|
-
|
76
|
-
def parse
|
77
|
-
{}.merge(path).merge(direct)
|
78
|
-
end
|
79
|
-
|
80
|
-
private
|
81
|
-
|
82
|
-
def path
|
83
|
-
match = @options.match(/path(?:\s*=>|:)\s+["']([^'"]+)["']/)
|
84
|
-
match ? {path: match[1]} : {}
|
85
|
-
end
|
86
|
-
|
87
|
-
def direct
|
88
|
-
match = @options.match(/direct(?:\s*=>|:)\s+true/)
|
89
|
-
match ? {direct: true} : {}
|
90
|
-
end
|
91
|
-
end
|
92
72
|
end
|
93
|
-
end
|
73
|
+
end
|
data/lib/cobratest.rb
CHANGED
@@ -23,8 +23,8 @@ module Cbratest
|
|
23
23
|
|
24
24
|
|
25
25
|
outputs "\nChanges since last commit"
|
26
|
-
root_dir = `cd #{path} && git rev-parse --show-toplevel`.chomp
|
27
|
-
changes = `cd #{root_dir} && git status -s -u`.split("\n").map { |file| File.join(root_dir, file.sub(/^.../, "")) }
|
26
|
+
root_dir = `cd "#{path}" && git rev-parse --show-toplevel`.chomp
|
27
|
+
changes = `cd "#{root_dir}" && git status -s -u`.split("\n").map { |file| File.join(root_dir, file.sub(/^.../, "")) }
|
28
28
|
outputs changes
|
29
29
|
|
30
30
|
|
metadata
CHANGED
@@ -1,60 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobratest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Hagemann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
-
type: :
|
19
|
+
version: '1.13'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
description: 'A test
|
56
|
-
of your application. Makes use of #
|
57
|
-
application are definitely unaffected
|
54
|
+
version: '3.5'
|
55
|
+
description: 'A test selector that suggests the tests based on the recent changes
|
56
|
+
of your application. Makes use of #cbra dependencies to infer which parts of the
|
57
|
+
application are definitely unaffected and can thus be omitted from the current test
|
58
|
+
run.'
|
58
59
|
email:
|
59
60
|
- stephan.hagemann@gmail.com
|
60
61
|
executables:
|
@@ -62,18 +63,18 @@ executables:
|
|
62
63
|
extensions: []
|
63
64
|
extra_rdoc_files: []
|
64
65
|
files:
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
65
70
|
- bin/cobratest
|
66
71
|
- cobratest.gemspec
|
67
|
-
-
|
72
|
+
- lib/cobratest.rb
|
68
73
|
- lib/cobratest/affected_component_finder.rb
|
69
74
|
- lib/cobratest/gemfile_scraper.rb
|
70
75
|
- lib/cobratest/tests_to_run_selector.rb
|
71
76
|
- lib/cobratest/transitive_affected_component_finder.rb
|
72
|
-
|
73
|
-
- LICENSE
|
74
|
-
- Rakefile
|
75
|
-
- README.md
|
76
|
-
homepage: https://github.com/shageman/cobradeps
|
77
|
+
homepage: https://github.com/shageman/cobratest
|
77
78
|
licenses:
|
78
79
|
- MIT
|
79
80
|
metadata: {}
|
@@ -83,18 +84,18 @@ require_paths:
|
|
83
84
|
- lib
|
84
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
91
|
requirements:
|
91
|
-
- -
|
92
|
+
- - ">="
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.6.10
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
|
-
summary:
|
100
|
+
summary: A test selector for your component-based Rails application
|
100
101
|
test_files: []
|