abcing 0.0.2 → 0.0.3

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: 45e899cf0ef2f320559a335f595b930645c907fb
4
- data.tar.gz: 6a8ec6dc306953b4c4f3a2953a5fc9446aafa978
3
+ metadata.gz: 44e2acf631192f7e19859f1eceef233fe3a6d89c
4
+ data.tar.gz: ed85447226cc1a8fc749f8320a9ee47707b44e96
5
5
  SHA512:
6
- metadata.gz: 9f5f80cec5d7a39ff0a4d28d15afda88da2c266502fcb6b6fc508e97cc9286a0f55649c69f8bc1b4199da91589692c8ea03cdb2e2e2f01020ec412f56d700131
7
- data.tar.gz: b07b409904e7f4cea6f5f2471ad2db8631b5b431674abda1806840610dde5770a2840312c5b30d8fd18408190c22aa9997f9e6bd21e3cdaa447900dd7a03d3aa
6
+ metadata.gz: 99d392ca8b0d58ecb0d9298ced3a084bc524e26c2555ef9c89a3c0c29d713d05b259fde6d57bbf64eee9a134f6740979661a5874673408601424d901328cebeb
7
+ data.tar.gz: 42c2b29d3f429522ce7bb20876cbfc71df2627c46826aeedf441462822a0b57b993b7983f1ee54c386f7e69e42ffd98c6c09ffc261a41c03e79d75e5a59ace02
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ script: "bundle exec rspec"
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # ABCing
2
2
 
3
- ![alt tag](https://s3-eu-west-1.amazonaws.com/abcing/coverage.png)
3
+ [![ABCing Gem Version](https://badge.fury.io/rb/abcing.svg)](http://badge.fury.io/rb/abcing)
4
+ [![ABCing Travis build](https://travis-ci.org/emileswarts/ABCing.svg?branch=master)](https://travis-ci.org/emileswarts/ABCing.svg)
5
+ ![](http://ruby-gem-downloads-badge.herokuapp.com/abcing/0.0.2?type=total&color=brightgreen)
6
+ ![abcing gem](https://s3-eu-west-1.amazonaws.com/abcing/coverage.png)
4
7
 
5
8
  Dumbed down automated test coverage metrics.
6
9
  Checks your working directory for class names, and tries to match them in the test directories.
@@ -11,6 +14,13 @@ If it finds a matching class name in one of your test directories, you get a gre
11
14
  If it finds a class name in the working directory but not in the test directory, it is printed in red.
12
15
  Other letters (not present in your working directory or test directories) are printed in yellow.
13
16
 
17
+ ## Usage
18
+
19
+ $ abcing /path/to/project/root
20
+
21
+ Right now this will check /path/to/project/root/spec and /path/to/project/root/features to find test files.
22
+ It will use app/ and lib/ to find classes that should be tested.
23
+
14
24
  ## Installation
15
25
 
16
26
  Add this line to your application's Gemfile:
@@ -27,12 +37,6 @@ Or install it yourself as:
27
37
 
28
38
  $ gem install abcing
29
39
 
30
- ## Usage
31
-
32
- abcing /path/to/project/root
33
-
34
- Currently this only considers app/ and lib/ for the scan.
35
- It will check spec/ and features/ for matching class names found in the working directory.
36
40
 
37
41
  ## Contributing
38
42
 
@@ -44,4 +48,7 @@ It will check spec/ and features/ for matching class names found in the working
44
48
 
45
49
  ## TODO
46
50
 
47
- 1. check for presence of config file for scan params
51
+ 1. Check for presence of config file for scan params
52
+ 2. Add verbose mode that mentions the class names scanned for results
53
+ 3. Add score results
54
+ 4. Improve performance
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Abcing::VERSION
9
9
  spec.authors = ["Emile"]
10
10
  spec.email = ["emile.swarts123@gmail.com"]
11
- spec.summary = %q{Dumb code metrics}
12
- spec.description = %q{See coverage by alphabet}
13
- spec.homepage = ""
11
+ spec.summary = %q{Idiot code metrics}
12
+ spec.description = %q{Find classes mentioned in your application but not in your test suite.}
13
+ spec.homepage = "https://github.com/emileswarts/ABCing"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -13,15 +13,21 @@ module ABCing
13
13
  end
14
14
 
15
15
  def run
16
- app_directories = ["#{@working_dir}/app", "#{@working_dir}/lib"]
17
- test_directories = ["#{@working_dir}/spec", "#{@working_dir}/features"]
16
+ app_directories = [
17
+ "#{@working_dir}/app",
18
+ "#{@working_dir}/lib"
19
+ ]
20
+
21
+ test_directories = [
22
+ "#{@working_dir}/spec",
23
+ "#{@working_dir}/features"
24
+ ]
18
25
 
19
26
  params = {
20
27
  app_directories: app_directories,
21
28
  test_directories: test_directories }
22
29
 
23
30
  scan_results = ABCing::Scanner.new(params).results
24
-
25
31
  ABCing::Renderer.new(scan_results).render
26
32
  end
27
33
  end
@@ -5,23 +5,11 @@ module ABCing
5
5
  end
6
6
 
7
7
  def find
8
- @target_directories.collect do |dir|
9
- matching_files(dir)
10
- end.flatten
8
+ @target_directories.collect { |d| files_for_directory(d) }.flatten.sort
11
9
  end
12
10
 
13
11
  private
14
12
 
15
- def matching_files(directory)
16
- files_for_directory(directory).select do |f|
17
- is_class_file? f
18
- end
19
- end
20
-
21
- def is_class_file?(file)
22
- File.read(file).include?('class ')
23
- end
24
-
25
13
  def files_for_directory(directory)
26
14
  Dir["#{directory}/**/*.rb"]
27
15
  end
@@ -10,7 +10,7 @@ module ABCing
10
10
  results = {}
11
11
 
12
12
  @alphabet.each do |a|
13
- results[a.to_sym] = colour(a)
13
+ results[a] = colour(a)
14
14
  end
15
15
 
16
16
  results
@@ -13,7 +13,7 @@ module ABCing
13
13
 
14
14
  def report
15
15
  coloured_letters.map do |coloured_letter, colour|
16
- coloured_letter.to_s.send(colour)
16
+ coloured_letter.send(colour)
17
17
  end.join(' ')
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module Abcing
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -2,34 +2,18 @@
2
2
  require_relative '../lib/abcing/alphabet_match'
3
3
 
4
4
  describe ABCing::AlphabetMatch do
5
- before(:each) do
6
- Dir.mkdir 'dummy'
7
- end
8
-
9
- after(:each) do
10
- FileUtils.rm_rf 'dummy'
11
- end
12
-
13
5
  it 'collects 2 letters' do
14
- class_names = ['Bar', 'Foo']
15
- matcher = ABCing::AlphabetMatch.new(class_names)
16
-
6
+ matcher = ABCing::AlphabetMatch.new ['Bar', 'Foo']
17
7
  expect(matcher.letters).to eq(['B', 'F'])
18
8
  end
19
9
 
20
10
  it 'Only collects unique letters' do
21
- class_names = ['Zoo', 'Zebra']
22
-
23
- matcher = ABCing::AlphabetMatch.new(class_names)
24
-
11
+ matcher = ABCing::AlphabetMatch.new(['Zoo', 'Zebra'])
25
12
  expect(matcher.letters).to eq(['Z'])
26
13
  end
27
14
 
28
15
  it 'Orders letter results alphabetically' do
29
- class_names = ['Cobra', 'Acid', 'Bee']
30
-
31
- matcher = ABCing::AlphabetMatch.new(class_names)
32
-
16
+ matcher = ABCing::AlphabetMatch.new(['Cobra', 'Acid', 'Bee'])
33
17
  expect(matcher.letters).to eq(['A', 'B', 'C'])
34
18
  end
35
19
  end
@@ -4,26 +4,20 @@ require 'abcing/class_file_finder'
4
4
  describe ABCing::ClassFileFinder do
5
5
  before(:each) do
6
6
  Dir.mkdir 'dummy'
7
- out_file = File.new("dummy/foo.rb", "w")
8
- out_file.puts("class Foo; end;")
9
- out_file.close
10
7
 
11
- out_file = File.new("dummy/bar.rb", "w")
12
- out_file.puts("class Foo; end;")
13
- out_file.close
8
+ ['foo', 'bar'].each do |name|
9
+ File.write("dummy/#{ name }.rb", '')
10
+ end
14
11
  end
15
12
 
13
+ let(:expected_results) { ['dummy/bar.rb', 'dummy/foo.rb'] }
14
+
16
15
  after(:each) do
17
16
  FileUtils.rm_rf 'dummy'
18
17
  end
19
18
 
20
19
  context 'Included files' do
21
20
  it 'Finds files with class defined in them' do
22
- expected_results = [
23
- 'dummy/bar.rb',
24
- 'dummy/foo.rb',
25
- ]
26
-
27
21
  finder = ABCing::ClassFileFinder.new(['dummy'])
28
22
  expect(finder.find).to eq(expected_results)
29
23
  end
@@ -31,14 +25,7 @@ describe ABCing::ClassFileFinder do
31
25
 
32
26
  context 'Excluded files' do
33
27
  it 'that do not have a .rb extension' do
34
- out_file = File.new("dummy/foo_config.txt", "w")
35
- out_file.puts("class FooConfig; end;")
36
- out_file.close
37
-
38
- expected_results = [
39
- 'dummy/bar.rb',
40
- 'dummy/foo.rb',
41
- ]
28
+ File.write('dummy/foo_config.txt', '')
42
29
 
43
30
  finder = ABCing::ClassFileFinder.new(['dummy'])
44
31
  expect(finder.find).to eq(expected_results)
@@ -8,7 +8,7 @@ describe ABCing::ColourAlphabetResult do
8
8
  }
9
9
 
10
10
  result = ABCing::ColourAlphabetResult.new(params).calculate
11
- expect(result).to include(A: :green, B: :green)
11
+ expect(result).to include('A' => :green, 'B' => :green)
12
12
  end
13
13
 
14
14
  it 'does not find a test for a class letter' do
@@ -18,7 +18,7 @@ describe ABCing::ColourAlphabetResult do
18
18
  }
19
19
 
20
20
  result = ABCing::ColourAlphabetResult.new(params).calculate
21
- expect(result).to include(A: :green, B: :red)
21
+ expect(result).to include('A' => :green, 'B' => :red)
22
22
  end
23
23
 
24
24
  it 'does not find an application class or test class from the letter of the alphabet' do
@@ -28,7 +28,7 @@ describe ABCing::ColourAlphabetResult do
28
28
  }
29
29
 
30
30
  result = ABCing::ColourAlphabetResult.new(params).calculate
31
- expect(result).to include(A: :yellow, B: :yellow)
31
+ expect(result).to include('A' => :yellow, 'B' => :yellow)
32
32
  end
33
33
 
34
34
 
@@ -5,4 +5,10 @@ describe ABCing::Scanner do
5
5
  params = { app_directories: [], test_directories: [] }
6
6
  scanner = ABCing::Scanner.new(params)
7
7
  end
8
+
9
+ context 'Raises an error' do
10
+ it 'when supplied with nil params' do
11
+ expect { ABCing::Scanner.new(nil) }.to raise_error()
12
+ end
13
+ end
8
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abcing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emile
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-22 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.2.0
55
- description: See coverage by alphabet
55
+ description: Find classes mentioned in your application but not in your test suite.
56
56
  email:
57
57
  - emile.swarts123@gmail.com
58
58
  executables:
@@ -62,6 +62,7 @@ extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
64
  - ".rspec"
65
+ - ".travis.yml"
65
66
  - Gemfile
66
67
  - Gemfile.lock
67
68
  - LICENSE.txt
@@ -82,8 +83,8 @@ files:
82
83
  - spec/class_name_finder_spec.rb
83
84
  - spec/colour_alphabet_result_spec.rb
84
85
  - spec/renderer_spec.rb
85
- - spec/scan_result_spec.rb
86
- homepage: ''
86
+ - spec/scanner_spec.rb
87
+ homepage: https://github.com/emileswarts/ABCing
87
88
  licenses:
88
89
  - MIT
89
90
  metadata: {}
@@ -106,11 +107,11 @@ rubyforge_project:
106
107
  rubygems_version: 2.2.2
107
108
  signing_key:
108
109
  specification_version: 4
109
- summary: Dumb code metrics
110
+ summary: Idiot code metrics
110
111
  test_files:
111
112
  - spec/alphabet_match_spec.rb
112
113
  - spec/class_file_finder_spec.rb
113
114
  - spec/class_name_finder_spec.rb
114
115
  - spec/colour_alphabet_result_spec.rb
115
116
  - spec/renderer_spec.rb
116
- - spec/scan_result_spec.rb
117
+ - spec/scanner_spec.rb