stefon 0.0.3 → 0.0.4
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 +4 -4
- data/README.md +1 -2
- data/lib/stefon/cli.rb +2 -2
- data/lib/stefon/surveyor/grit_util.rb +9 -1
- data/lib/stefon/version.rb +1 -1
- data/spec/surveyor/grit_util_spec.rb +33 -0
- data/stefon.gemspec +2 -1
- metadata +27 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8de9d96b587955909cd3f13739ae73e93c2c6a56
|
4
|
+
data.tar.gz: 3b1bdf0537aba3ee67e061e0379ed0d222ba0796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1db71348b554b5038ac9243dd84b53d43780b55eae48899f1d6e3456aa38dab2004af2679ae90fdfe5c7d3934d97ccd0907321069e259b78719744674add8396
|
7
|
+
data.tar.gz: 1485ecd44bf051997b0107b297e5e5e3f4190791f98a39837e4489bbfc6484bbb975b4584eb1a97ecfc725ee0acf9f3be52edb56acd4a0ed6e4e2e63be4292ec
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Stefon
|
2
2
|
|
3
|
-
Get tips on who to ask for a code review.
|
3
|
+
Get tips on who to ask for a code review, runs on Ruby 1.9.2 and above.
|
4
4
|
|
5
5
|
A name inspired by the SNL character Bill Hader played:
|
6
6
|

|
@@ -52,7 +52,6 @@ which is identical to `stefon -f`, to see something like:
|
|
52
52
|
|
53
53
|
|
54
54
|
## Todos / Comming improvements
|
55
|
-
* use rugged instead of grit for ruby 2 support
|
56
55
|
* use Github API to get a list of contributors for a project (and filter suggestions)
|
57
56
|
* loading user preferences (list of users to exclude) - maybe with dotfiles instead of yml files
|
58
57
|
* handle errors from surveryors
|
data/lib/stefon/cli.rb
CHANGED
@@ -28,12 +28,12 @@ module Stefon
|
|
28
28
|
where [options] are:
|
29
29
|
EOS
|
30
30
|
opt :limit,
|
31
|
-
'Limit the number of people that stephon suggests '
|
31
|
+
'Limit the number of people that stephon suggests '\
|
32
32
|
'sending a code review to',
|
33
33
|
default: 4,
|
34
34
|
short: '-l'
|
35
35
|
opt :full_report,
|
36
|
-
'Boolean for whether or not to include '
|
36
|
+
'Boolean for whether or not to include '\
|
37
37
|
"information about how you affected someone's code",
|
38
38
|
default: false,
|
39
39
|
short: '-f'
|
@@ -27,7 +27,7 @@ module Stefon
|
|
27
27
|
# recent commit, since in this case, stefon would always recommend
|
28
28
|
# the current user anyway. In the future, an error may be raised here
|
29
29
|
def initialize
|
30
|
-
@repo = Grit::Repo.new
|
30
|
+
@repo = Grit::Repo.new find_git_repo
|
31
31
|
commits = @repo.commits(GitUtil::CURRENT_BRANCH)
|
32
32
|
@num_sui_commits = commits.find_index do |commit|
|
33
33
|
commit.author.name != @repo.config['user.name']
|
@@ -36,6 +36,14 @@ module Stefon
|
|
36
36
|
@last_xeno_commit = commits[@num_sui_commits]
|
37
37
|
end
|
38
38
|
|
39
|
+
def find_git_repo
|
40
|
+
until File.exist?('.git')
|
41
|
+
fail 'Could not find a git repository!' if Dir.pwd == '/'
|
42
|
+
Dir.chdir '..'
|
43
|
+
end
|
44
|
+
Dir.pwd
|
45
|
+
end
|
46
|
+
|
39
47
|
def blame_for(filename)
|
40
48
|
@repo.blame(filename, @last_xeno_commit)
|
41
49
|
end
|
data/lib/stefon/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'fakefs/safe'
|
5
|
+
|
6
|
+
describe Stefon::Surveyor::GritUtil do
|
7
|
+
context 'when there is no git repo in the current directory' do
|
8
|
+
before :each do
|
9
|
+
Grit::Repo.any_instance.stub(:commits).and_return([])
|
10
|
+
end
|
11
|
+
around :each do |example|
|
12
|
+
@randomizer = (1..99_999).to_a.sample # FakeFS doesn't reset btw tests!
|
13
|
+
FakeFS do
|
14
|
+
Dir.mkdir "/repo_root_#{@randomizer}"
|
15
|
+
Dir.mkdir "/repo_root_#{@randomizer}/1_dir_too_deep"
|
16
|
+
Dir.mkdir "/repo_root_#{@randomizer}/1_dir_too_deep/2_dirs_too_deep"
|
17
|
+
Dir.chdir "/repo_root_#{@randomizer}/1_dir_too_deep/2_dirs_too_deep"
|
18
|
+
example.run
|
19
|
+
end
|
20
|
+
end
|
21
|
+
it 'can still initialize if there is a git repo in a parent directory' do
|
22
|
+
Dir.mkdir "/repo_root_#{@randomizer}/.git/"
|
23
|
+
grit = Stefon::Surveyor::GritUtil.new
|
24
|
+
grit.repo.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'raises an error if there is no git repo in parent directories' do
|
28
|
+
expect do
|
29
|
+
Stefon::Surveyor::GritUtil.new
|
30
|
+
end.to raise_error 'Could not find a git repository!'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/stefon.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_runtime_dependency 'gitlab-grit', '1.0.0'
|
27
27
|
spec.add_runtime_dependency 'trollop', '~> 2.0'
|
28
|
+
spec.add_development_dependency 'fakefs', '~> 0.5'
|
28
29
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
29
|
-
spec.add_development_dependency
|
30
|
+
spec.add_development_dependency 'rake', '~> 10.1'
|
30
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stefon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Kavalerov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-grit
|
@@ -28,42 +28,56 @@ dependencies:
|
|
28
28
|
name: trollop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
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: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fakefs
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.5'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - ~>
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '1.3'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - ~>
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.3'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '10.1'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '10.1'
|
69
83
|
description: |2
|
@@ -76,7 +90,7 @@ executables:
|
|
76
90
|
extensions: []
|
77
91
|
extra_rdoc_files: []
|
78
92
|
files:
|
79
|
-
- .gitignore
|
93
|
+
- ".gitignore"
|
80
94
|
- Gemfile
|
81
95
|
- LICENSE.txt
|
82
96
|
- README.md
|
@@ -100,6 +114,7 @@ files:
|
|
100
114
|
- spec/spec_helper.rb
|
101
115
|
- spec/surveyor/editor_spec.rb
|
102
116
|
- spec/surveyor/git_util_spec.rb
|
117
|
+
- spec/surveyor/grit_util_spec.rb
|
103
118
|
- spec/surveyor/surveyor_spec.rb
|
104
119
|
- stefon.gemspec
|
105
120
|
homepage: https://github.com/ilyakava/stefon
|
@@ -112,12 +127,12 @@ require_paths:
|
|
112
127
|
- lib
|
113
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
129
|
requirements:
|
115
|
-
- -
|
130
|
+
- - ">="
|
116
131
|
- !ruby/object:Gem::Version
|
117
132
|
version: '0'
|
118
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
134
|
requirements:
|
120
|
-
- -
|
135
|
+
- - ">="
|
121
136
|
- !ruby/object:Gem::Version
|
122
137
|
version: '0'
|
123
138
|
requirements: []
|
@@ -132,4 +147,5 @@ test_files:
|
|
132
147
|
- spec/spec_helper.rb
|
133
148
|
- spec/surveyor/editor_spec.rb
|
134
149
|
- spec/surveyor/git_util_spec.rb
|
150
|
+
- spec/surveyor/grit_util_spec.rb
|
135
151
|
- spec/surveyor/surveyor_spec.rb
|