pronto 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pronto.rb +7 -10
- data/lib/pronto/formatter/github_formatter.rb +3 -7
- data/lib/pronto/formatter/json_formatter.rb +1 -1
- data/lib/pronto/formatter/text_formatter.rb +1 -1
- data/lib/pronto/message.rb +1 -1
- data/lib/pronto/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6606bb1e1a787c844899c0ade07a848ce88015f
|
4
|
+
data.tar.gz: 570c767d2f9c327aac7a68c9969849268472c429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 595ba658edf9f057540e2c990e4e6a84535c467757cd3bd434c027d74ffdaa2c95f2b14082592158d90b17efc3ce58bfd278a8ce10bc4791adc13662202d4881
|
7
|
+
data.tar.gz: a2784022f00ba634bf0d84df9994659f5f9f9c75a5df5220ffb38a7906058a22e37c874fc6cc5cdf9b0d75b61e60706c4901495d915bc13f3de68bbbc261f03b
|
data/lib/pronto.rb
CHANGED
@@ -19,11 +19,15 @@ require 'pronto/formatter/formatter'
|
|
19
19
|
|
20
20
|
module Pronto
|
21
21
|
def self.run(commit = 'master', repo_path = '.', formatter = nil)
|
22
|
-
|
23
|
-
|
22
|
+
repo = Rugged::Repository.new(repo_path)
|
23
|
+
commit ||= 'master'
|
24
|
+
merge_base = repo.merge_base(commit, repo.head.target)
|
25
|
+
patches = repo.diff(merge_base, repo.head.target)
|
26
|
+
|
27
|
+
result = run_all_runners(patches, merge_base)
|
24
28
|
|
25
29
|
formatter ||= default_formatter
|
26
|
-
formatter.format(result)
|
30
|
+
formatter.format(result, repo)
|
27
31
|
end
|
28
32
|
|
29
33
|
def self.gem_names
|
@@ -43,13 +47,6 @@ module Pronto
|
|
43
47
|
|
44
48
|
private
|
45
49
|
|
46
|
-
def self.diff(repo_path, commit)
|
47
|
-
repo = Rugged::Repository.new(repo_path)
|
48
|
-
commit ||= 'master'
|
49
|
-
merge_base = repo.merge_base(commit, repo.head.target)
|
50
|
-
repo.diff(merge_base, repo.head.target)
|
51
|
-
end
|
52
|
-
|
53
50
|
def self.run_all_runners(patches, commit)
|
54
51
|
Runner.runners.map do |runner|
|
55
52
|
runner.new.run(patches, commit)
|
@@ -3,15 +3,15 @@ require 'octokit'
|
|
3
3
|
module Pronto
|
4
4
|
module Formatter
|
5
5
|
class GithubFormatter
|
6
|
-
def format(messages)
|
6
|
+
def format(messages, repo)
|
7
7
|
commit_messages = messages.map do |message|
|
8
|
-
|
8
|
+
github_slug = repo.remotes.map(&:github_slug).compact.first
|
9
9
|
sha = message.commit_sha
|
10
10
|
position = message.line.commit_line.position if message.line
|
11
11
|
path = message.path
|
12
12
|
body = message.msg
|
13
13
|
|
14
|
-
create_comment(
|
14
|
+
create_comment(github_slug, sha, position, path, body)
|
15
15
|
end
|
16
16
|
|
17
17
|
"#{commit_messages.compact.count} Pronto messages posted to GitHub"
|
@@ -40,10 +40,6 @@ module Pronto
|
|
40
40
|
def client
|
41
41
|
@client ||= Octokit::Client.new(access_token: access_token)
|
42
42
|
end
|
43
|
-
|
44
|
-
def github_slug(message)
|
45
|
-
message.repo.remotes.map(&:github_slug).compact.first
|
46
|
-
end
|
47
43
|
end
|
48
44
|
end
|
49
45
|
end
|
data/lib/pronto/message.rb
CHANGED
data/lib/pronto/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.4.0
|
48
48
|
type: :runtime
|
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: 2.
|
54
|
+
version: 2.4.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: grit
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|