ruby-appraiser 1.0.2 → 1.0.3

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.
data/README.md CHANGED
@@ -45,6 +45,7 @@ config files.
45
45
  $ bundle exec ruby-appraiser --help
46
46
  Usage: ruby-appraiser [inspector...] [options]
47
47
  -v, --[no-]verbose Run verbosely
48
+ -t, --trace Include backtrace on failure
48
49
  --list List available adapters
49
50
  --silent Silence output
50
51
  --mode=MODE Set the mode. [staged,authored,touched,all]
@@ -55,7 +56,7 @@ Usage: ruby-appraiser [inspector...] [options]
55
56
  Contributing:
56
57
  -------------
57
58
 
58
- 1. Write an adapter! Take a look at the existing adapters for help.
59
+ 1. Write an adapter! Take a look at the existing adapter gems for help.
59
60
 
60
61
  ```ruby
61
62
  class Foo < RubyAppraiser::Adapter
@@ -44,11 +44,6 @@ class RubyAppraiser::Adapter
44
44
  attempt_require_adapter(adapter_type, gem_name)
45
45
  end
46
46
 
47
- # look in the adapter directory
48
- Dir::glob(File::expand_path('../adapter/*.rb', __FILE__)) do |filepath|
49
- require filepath
50
- end
51
-
52
47
  # return the registry
53
48
  registry
54
49
  end
@@ -54,9 +54,12 @@ class RubyAppraiser
54
54
  end.map { |path| relative_path path }
55
55
  end
56
56
 
57
- def add_defect(defect, *args)
58
- unless defect.kind_of? Defect
59
- defect = Defect.new(defect, *args)
57
+ def add_defect(*args)
58
+ if args.first.kind_of?(Defect)
59
+ defect = args.shift
60
+ else
61
+ file, line, desc = *args
62
+ defect = Defect.new(relative_path(file), line, desc)
60
63
  end
61
64
  defects << defect if match?(defect.location)
62
65
  end
@@ -70,7 +73,7 @@ class RubyAppraiser
70
73
  end
71
74
 
72
75
  def project_root
73
- @project_root ||= (`git rev-parse --show-toplevel`).chomp
76
+ @project_root ||= RubyAppraiser::Git.project_root
74
77
  end
75
78
 
76
79
  def relative_path(path)
@@ -24,7 +24,7 @@ class RubyAppraiser
24
24
  puts available_adapters
25
25
  exit 1
26
26
  end
27
- opts.on('-t', '--trace', 'Enable backtrace')
27
+ opts.on('-t', '--trace', 'Enable backtrace on failure')
28
28
  opts.on('--silent', 'Silence output') do |silent|
29
29
  @options[:silent] = true
30
30
  end
@@ -5,6 +5,10 @@ class RubyAppraiser
5
5
  module Git
6
6
  extend self
7
7
 
8
+ def project_root
9
+ run('rev-parse', '--show-toplevel', &:read).chomp
10
+ end
11
+
8
12
  def authored_lines(options = {})
9
13
  diff_command = ['diff']
10
14
  if options[:range]
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class RubyAppraiser
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-appraiser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-14 00:00:00.000000000 Z
12
+ date: 2013-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -78,7 +78,6 @@ files:
78
78
  - bin/ruby-appraiser
79
79
  - lib/ruby-appraiser.rb
80
80
  - lib/ruby-appraiser/adapter.rb
81
- - lib/ruby-appraiser/adapter/line-length.rb
82
81
  - lib/ruby-appraiser/appraisal.rb
83
82
  - lib/ruby-appraiser/cli.rb
84
83
  - lib/ruby-appraiser/defect.rb
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'ruby-appraiser'
4
-
5
- class RubyAppraiser::Adapter::LineLength < RubyAppraiser::Adapter
6
- def appraise
7
- source_files.each do |source_file|
8
- File.open(source_file) do |source|
9
- source.each_line do |line|
10
- line_length = line.chomp.length
11
- if line_length > 80
12
- add_defect(source_file, source.lineno,
13
- "Line too long [#{line_length}/80]")
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end