ruby_git_issue 1.0.2 → 1.1.0
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 +20 -22
- data/lib/ruby_git_issue.rb +7 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 006d3fe62b5731a39bc61d26ab1da17617e9315482139876cf2d363d31f04457
|
4
|
+
data.tar.gz: b7eb6b364c8d70e58eb020d2a655eba34d9814a23ffcda7d866d5f9d278022b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7eea7ef1b021c28134d5d42b443032715197eee8882179368c0117c04d71a711234fbdce86ffef48a13ce353a201115845dd2e5b31788efce2dd73f512be170b
|
7
|
+
data.tar.gz: d2a04811172c5aa9c9b9a36b9eed2dab258e265afccdbde3ad1b40bc1128efa207ea91118ad4118d6ec87db97462142a9008fcfe39d2f99854be3f22eaeef32e
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# RubyGitIssue
|
2
2
|
|
3
|
-
Dependent on `octokit` gem which helps to call Github APIs.
|
3
|
+
Dependent on `octokit` gem which helps to call Github APIs.
|
4
4
|
|
5
5
|
Using this module `RubyGitIssue` we can create GitHub issues while rails throw an exception
|
6
6
|
|
7
|
-
It can tag, assign to members, assign to organization project, and also set the issue on board as well.
|
7
|
+
It can tag, assign to members, assign to organization project, and also set the issue on board as well.
|
8
8
|
|
9
9
|
Things you may want to cover:
|
10
10
|
|
@@ -14,18 +14,17 @@ Things you may want to cover:
|
|
14
14
|
|
15
15
|
`gem install ruby_git_issue`
|
16
16
|
|
17
|
-
OR
|
17
|
+
OR
|
18
18
|
|
19
19
|
- Add to you Gemfile
|
20
20
|
|
21
21
|
`gem 'ruby_git_issue'`
|
22
|
-
|
22
|
+
|
23
23
|
- Access the library in Ruby
|
24
24
|
`require 'ruby_git_issue'`
|
25
|
-
|
26
|
-
|
25
|
+
|
27
26
|
## Usage
|
28
|
-
|
27
|
+
|
29
28
|
Before using the gem, we need to get the repository's *ADMIN* `token`. With this only we can have access to the features of the gem
|
30
29
|
|
31
30
|
Repository Users can also create an issue with this gem but, usage will be limited to issue creation only
|
@@ -39,61 +38,61 @@ Things you may want to cover:
|
|
39
38
|
|
40
39
|
#### Generate issue on repo
|
41
40
|
`generate_issue` method will generate the issue for you on GitHub
|
42
|
-
|
41
|
+
|
43
42
|
`client.generate_issue`
|
44
43
|
|
45
44
|
#### OR
|
46
|
-
|
45
|
+
|
47
46
|
#### Generate issue on (organization) project
|
48
|
-
|
47
|
+
|
49
48
|
`generate_issue(git_column)` method will generate the issue for you and assign to a project board as well
|
50
|
-
|
49
|
+
|
51
50
|
To get the `git_column` we need to follow below process
|
52
51
|
|
53
52
|
`projects = client.get_org_projects`
|
54
53
|
|
55
54
|
find the id of the project from above call
|
56
55
|
|
57
|
-
There will be columns and cards on the project
|
56
|
+
There will be columns and cards on the project
|
58
57
|
|
59
58
|
With project's id get project's columns
|
60
59
|
|
61
60
|
`get_projects_columns(project_id)`
|
62
61
|
|
63
|
-
find the id of the column from the above call and
|
64
|
-
|
62
|
+
find the id of the column from the above call and
|
63
|
+
|
65
64
|
`client.generate_issue(git_column)`
|
66
65
|
|
67
66
|
### Setup middelware on exception_notification
|
68
67
|
|
69
68
|
* Install gem '[exception_notification](https://github.com/smartinez87/exception_notification)'
|
70
69
|
|
71
|
-
* Setup middelware
|
70
|
+
* Setup middelware
|
72
71
|
|
73
72
|
* Add file to `lib/exception_notifier/github_notifier.rb`
|
74
73
|
|
75
74
|
require 'action_dispatch'
|
76
75
|
module ExceptionNotifier
|
77
76
|
class GithubNotifier < BaseNotifier
|
78
|
-
|
77
|
+
|
79
78
|
class MissingController
|
80
79
|
def method_missing(*args, &block)
|
81
80
|
end
|
82
81
|
end
|
83
|
-
|
82
|
+
|
84
83
|
def initialize(options)
|
85
84
|
@default_options = options
|
86
85
|
end
|
87
|
-
|
86
|
+
|
88
87
|
def call(exception, options={})
|
89
88
|
unless options[:env].nil?
|
90
89
|
request = ActionDispatch::Request.new(options[:env])
|
91
90
|
git_options = @default_options.merge!({exception_data: exception, request: request})
|
92
|
-
|
93
|
-
|
91
|
+
client = RubyGitIssue.new(git_options)
|
92
|
+
client.issue_options = { title: "#{@default_options[:prefix]}: #{exception.message}",
|
94
93
|
labels: @default_options[:labels],
|
95
94
|
assignees: @default_options[:assignees] }
|
96
|
-
|
95
|
+
client.generate_issue(@default_options[:column_id])
|
97
96
|
end
|
98
97
|
end
|
99
98
|
end
|
@@ -111,4 +110,3 @@ Things you may want to cover:
|
|
111
110
|
assignees: [ENV['GIT_ASSIGNEES']],
|
112
111
|
column_id: ENV['GIT_COLUMN']
|
113
112
|
}
|
114
|
-
|
data/lib/ruby_git_issue.rb
CHANGED
@@ -30,8 +30,13 @@ class RubyGitIssue
|
|
30
30
|
# column_id ## Integer => Get column id from project and its columns
|
31
31
|
# column_id can be blank as well. Issue will not be assigned to and project column if column_id is blank
|
32
32
|
def generate_issue(column_id=nil)
|
33
|
-
|
34
|
-
|
33
|
+
existing_issue = client.list_issues("#{organization}/#{repo}").select{|issue| issue[:title] == issue_options[:title]}.try(:first)
|
34
|
+
if existing_issue.nil?
|
35
|
+
issue_data = client.create_issue("#{organization}/#{repo}", issue_options[:title], compose_body(exception_data, request), issue_options)
|
36
|
+
add_issue_to_project(issue_data, column_id) unless column_id.nil?
|
37
|
+
else
|
38
|
+
client.add_comment("#{organization}/#{repo}", existing_issue.number, compose_body(exception_data, request))
|
39
|
+
end
|
35
40
|
end
|
36
41
|
|
37
42
|
# Get Github project based on the organization passed while initializing client
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_git_issue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arpit Vaishnav
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
version: 2.1.0
|
53
53
|
description: When rails throws excpetion, this gem will create issue and if project
|
54
54
|
available, it will create project, assign developer and set tags if availabe
|
55
|
-
email:
|
55
|
+
email: arpitvaishnav@gmail.com
|
56
56
|
executables: []
|
57
57
|
extensions: []
|
58
58
|
extra_rdoc_files: []
|
@@ -62,7 +62,7 @@ files:
|
|
62
62
|
- lib/ruby_git_issue.rb
|
63
63
|
homepage: https://github.com/HLth-care/ruby_git_issue
|
64
64
|
licenses:
|
65
|
-
-
|
65
|
+
- MIT
|
66
66
|
metadata: {}
|
67
67
|
post_install_message:
|
68
68
|
rdoc_options: []
|