issue-beaver 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.
- data/issue-beaver.gemspec +2 -1
- data/lib/issue_beaver/models/merger.rb +7 -11
- data/lib/issue_beaver/runner.rb +6 -4
- data/lib/issue_beaver/version.rb +3 -0
- data/lib/issue_beaver.rb +1 -0
- metadata +3 -2
data/issue-beaver.gemspec
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'issue_beaver/version'
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
5
6
|
s.name = "issue-beaver"
|
6
|
-
s.version =
|
7
|
+
s.version = IssueBeaver::VERSION
|
7
8
|
s.platform = Gem::Platform::RUBY
|
8
9
|
s.authors = ["Stephan Eckardt"]
|
9
10
|
s.email = ["mail@stephaneckardt.com"]
|
@@ -101,8 +101,8 @@ module IssueBeaver
|
|
101
101
|
|
102
102
|
class Match
|
103
103
|
|
104
|
-
TITLE_THRESHOLD = 0.
|
105
|
-
|
104
|
+
TITLE_THRESHOLD = 0.2
|
105
|
+
TITLE_LENGTH = 8
|
106
106
|
|
107
107
|
def initialize(todo, issue)
|
108
108
|
@todo = todo
|
@@ -113,29 +113,25 @@ module IssueBeaver
|
|
113
113
|
|
114
114
|
|
115
115
|
def sane?
|
116
|
-
(title_degree < TITLE_THRESHOLD)
|
117
|
-
((body_degree < BODY_THRESHOLD) && (body_accuracy < 0.1))
|
116
|
+
(title_degree < TITLE_THRESHOLD) && (title_length > TITLE_LENGTH)
|
118
117
|
end
|
119
118
|
|
120
119
|
|
121
120
|
def degree
|
122
|
-
title_degree
|
121
|
+
title_degree
|
123
122
|
end
|
124
123
|
|
125
124
|
|
126
125
|
def title_degree() levenshtein(@issue.title, @todo.title) end
|
127
126
|
|
128
|
-
|
129
|
-
def body_degree() levenshtein(@issue.body, @todo.body) end
|
130
|
-
|
131
|
-
|
132
|
-
def body_accuracy() 1.0/[@issue.body.to_s.length, @todo.body.to_s.length].min.to_f end
|
127
|
+
def title_length() [@issue.title.to_s.length, @todo.title.to_s.length].min end
|
133
128
|
|
134
129
|
|
135
130
|
private
|
136
131
|
|
132
|
+
# Normalized levenshtein distance
|
137
133
|
def levenshtein(a, b)
|
138
|
-
Levenshtein.
|
134
|
+
Levenshtein.normalized_distance(a.to_s, b.to_s)
|
139
135
|
end
|
140
136
|
|
141
137
|
end
|
data/lib/issue_beaver/runner.rb
CHANGED
@@ -9,7 +9,7 @@ module IssueBeaver
|
|
9
9
|
def self.run(*args)
|
10
10
|
command = args[0]
|
11
11
|
runner = self.new
|
12
|
-
command = args[0]
|
12
|
+
command = args[0] || "help"
|
13
13
|
command = "unknown" unless COMMANDS.include? command
|
14
14
|
runner.send(command, *args)
|
15
15
|
end
|
@@ -57,16 +57,18 @@ module IssueBeaver
|
|
57
57
|
end
|
58
58
|
|
59
59
|
|
60
|
-
def help
|
61
|
-
puts "
|
60
|
+
def help(*args)
|
61
|
+
puts "Issue Beaver version #{IssueBeaver::VERSION}"
|
62
|
+
puts "usage: issuebeaver <command> [directory]"
|
63
|
+
puts " Available commands: #{COMMANDS.join(", ")}"
|
62
64
|
end
|
63
65
|
|
64
66
|
|
65
67
|
private
|
66
68
|
|
67
69
|
def unknown(command = "", *args, &block)
|
68
|
-
puts "#{command}: Command not found"
|
69
70
|
help
|
71
|
+
puts "#{command}: Command not found"
|
70
72
|
end
|
71
73
|
|
72
74
|
|
data/lib/issue_beaver.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: issue-beaver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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: 2012-
|
12
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: treetop
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- lib/issue_beaver/shared/attributes_model.rb
|
218
218
|
- lib/issue_beaver/shared/hash.rb
|
219
219
|
- lib/issue_beaver/shared/model_collection.rb
|
220
|
+
- lib/issue_beaver/version.rb
|
220
221
|
- lib/password/password.rb
|
221
222
|
- spec/fixtures/ruby.rb
|
222
223
|
- spec/fixtures/ruby2.rb
|