cobratest 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 120077fadf9a43383baded33ec94e2311d8303ca
4
- data.tar.gz: dbbd9ff0b1b7d037ad43977cbcbb7cec082eb151
3
+ metadata.gz: 2ff70bef30e32aeb2861e2ed2418efd28c8fd884
4
+ data.tar.gz: dfaf1f67eb5ad013669c2be46ea42ae139b06957
5
5
  SHA512:
6
- metadata.gz: 91828934322b9a296432c03d23dac45b30535f4acedd8d9c57d0e832c1493a730a5c897d2740416bfe0940cf76a2412b2b50edfc68c87c9a27f17b247984ec6c
7
- data.tar.gz: b814ccd69cc2d804f52bd4e33808e4d03f14856ba6d41e6c9694d7d0ec991d8274d09aae89e3df8d376be5f4a05573f76b039145e37a8e5ddaf21f3e847f8fae
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 (#cobra) to also print all transitively affected components.
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 #cobra folder structures in `spec/examples`. Here is an example run when changing a file in component `C`:
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.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 runner for your #cobra application}
11
- spec.description = %q{A test runner that optimizes the tests it runs based on the recent changes of your application. Makes use of #cobra dependencies to infer which parts of the application are definitely unaffected. Science! BOOM!}
12
- spec.homepage = 'https://github.com/shageman/cobradeps'
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.add_development_dependency 'bundler', '~> 1.5'
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
- raw_gemfile.split("\n").inject([]) do |memo, line|
55
- match = line.match(/gem\s+["']([^'"]+)["'](.*)/)
56
- if match
57
- memo << {name: match[1], options: OptionParser.new(match[2]).parse}
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.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: 2014-05-29 00:00:00.000000000 Z
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.5'
20
- type: :development
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.5'
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: '0'
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: '0'
55
- description: 'A test runner that optimizes the tests it runs based on the recent changes
56
- of your application. Makes use of #cobra dependencies to infer which parts of the
57
- application are definitely unaffected. Science! BOOM!'
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
- - Gemfile
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
- - lib/cobratest.rb
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.0.3
97
+ rubygems_version: 2.6.10
97
98
  signing_key:
98
99
  specification_version: 4
99
- summary: 'A test runner for your #cobra application'
100
+ summary: A test selector for your component-based Rails application
100
101
  test_files: []