ruboty-packman 0.1.0 → 0.1.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d66db31edf9ea582775545692a316457b10b68bb239b9357d3386144c7b74bf1
|
4
|
+
data.tar.gz: 2ca8314ece0feac2e6d93629d1e7aa5d3100101476d4dfd775c9ef07dcda393b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08595c6d6d15666222d1d79dc5e910a18e559a9ab15bf188c6a482fb44cdac097207d99c4697d470088cbb41b2b979a3d5e3f7fa32bcb1b314c5c5e5d5623a19'
|
7
|
+
data.tar.gz: e2b9a821899172775d616b7ac732823d84ef1323dce0a7dcf6fe0fe3d0e65a7166114302d7f002b1bbe2e115704de405253f0841c8e763c84c6d3a6b02c77774
|
@@ -4,28 +4,38 @@ module Ruboty
|
|
4
4
|
module Handlers
|
5
5
|
class Packman < Base
|
6
6
|
on(
|
7
|
-
/packman
|
8
|
-
name: '
|
9
|
-
description: '[packman]
|
7
|
+
/packman register (?<organization>.+)\/(?<repository>.+)\z/,
|
8
|
+
name: 'register',
|
9
|
+
description: '[packman] register repository'
|
10
10
|
)
|
11
11
|
|
12
12
|
on(
|
13
|
-
/packman pull-request (?<organization>.+)
|
13
|
+
/packman pull-request (?<organization>.+)\/(?<repository>.+)\z/,
|
14
14
|
name: 'pull_request',
|
15
15
|
description: '[packman] library update'
|
16
16
|
)
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
on(
|
19
|
+
/packman remove (?<organization>.+)\/(?<repository>.+)\z/,
|
20
|
+
name: 'remove',
|
21
|
+
description: '[packman] remove repository'
|
22
|
+
)
|
23
|
+
|
24
|
+
def register(message)
|
25
|
+
action_handler(message).register
|
20
26
|
end
|
21
27
|
|
22
28
|
def pull_request(message)
|
23
|
-
|
29
|
+
action_handler(message).pull_request
|
30
|
+
end
|
31
|
+
|
32
|
+
def remove(message)
|
33
|
+
action_handler(message).remove
|
24
34
|
end
|
25
35
|
|
26
36
|
private
|
27
37
|
|
28
|
-
def
|
38
|
+
def action_handler(message)
|
29
39
|
Ruboty::Packman::Actions::Packman.new(message)
|
30
40
|
end
|
31
41
|
end
|
@@ -4,30 +4,44 @@ module Ruboty
|
|
4
4
|
class Packman < Ruboty::Actions::Base
|
5
5
|
NAMESPACE = 'packman'
|
6
6
|
|
7
|
-
def
|
7
|
+
def register
|
8
8
|
if repositories.include?(repo.full_name)
|
9
|
-
message.reply("already
|
9
|
+
message.reply("already registered. #{repo.full_name}")
|
10
10
|
return
|
11
11
|
end
|
12
12
|
|
13
|
+
message.reply("registering...")
|
13
14
|
repo.sync!
|
14
15
|
|
15
16
|
repositories << repo.full_name
|
16
|
-
message.reply("
|
17
|
+
message.reply("registered:tada: #{repo.full_name}")
|
17
18
|
end
|
18
19
|
|
19
20
|
def pull_request
|
20
21
|
unless repositories.include?(repo.full_name)
|
21
|
-
message.reply("
|
22
|
+
message.reply("not registered. please register #{repo.full_name}")
|
22
23
|
return
|
23
24
|
end
|
24
25
|
|
26
|
+
message.reply("please wait...")
|
25
27
|
repo.sync!
|
26
28
|
repo.bundle_update!
|
27
29
|
repo.push!
|
28
|
-
repo.pull_request!
|
30
|
+
url = repo.pull_request!
|
29
31
|
|
30
|
-
message.reply("pull-requested
|
32
|
+
message.reply("pull-requested:tada: #{url}")
|
33
|
+
end
|
34
|
+
|
35
|
+
def remove
|
36
|
+
unless repositories.include?(repo.full_name)
|
37
|
+
message.reply("not registered. #{repo.full_name}")
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
repo.clean!
|
42
|
+
repositories.delete(repo.full_name)
|
43
|
+
|
44
|
+
message.reply("removed. #{repo.full_name}")
|
31
45
|
end
|
32
46
|
|
33
47
|
private
|
@@ -43,17 +43,22 @@ module Ruboty
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def pull_request!
|
46
|
-
Octokit::Client.new(api_endpoint: api_endpoint, access_token: token).create_pull_request(
|
46
|
+
pr = Octokit::Client.new(api_endpoint: api_endpoint, access_token: token).create_pull_request(
|
47
47
|
full_name,
|
48
48
|
'master',
|
49
49
|
branch_name,
|
50
50
|
"bundle update #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}",
|
51
51
|
'Pull requested from [packman](https://github.com/kimromi/ruboty-packman).'
|
52
52
|
)
|
53
|
+
pr[:html_url]
|
53
54
|
rescue Octokit::UnprocessableEntity => e
|
54
55
|
puts e
|
55
56
|
end
|
56
57
|
|
58
|
+
def clean!
|
59
|
+
FileUtils.rm_rf(sync_directory) if cloned?
|
60
|
+
end
|
61
|
+
|
57
62
|
private
|
58
63
|
|
59
64
|
def repos_dir
|