ruby_git_issue 1.1.0 → 1.1.1
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 +80 -92
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 863250a8fd2a9ccdc1c876b9fc7529e5cca6d49806cbefc7abd45c86780dcee9
|
4
|
+
data.tar.gz: 1f23afa5209342d4c98392d5ca4aeebfaa5c6ed66d8d7f324a56b7f455b449f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a4e21beee0131208fe24baa347746769499f4352b35c422629b479b08915123b08cce9bb9edd0d094eb6915d2d334d7394d7dd96c55bd2114aef19d2bfaa06d
|
7
|
+
data.tar.gz: d177d10db2b6ea7ef27dac49e86bab253713b36e5673d05a1db2cdec40d4fd4179d4dbff658690b55a2361dff8a69762200d6b49b7438458cede25c03197992c
|
data/README.md
CHANGED
@@ -9,104 +9,92 @@ It can tag, assign to members, assign to organization project, and also set the
|
|
9
9
|
Things you may want to cover:
|
10
10
|
|
11
11
|
## Installation
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
Install via Rubygems
|
13
|
+
```ruby
|
14
|
+
gem install ruby_git_issue
|
15
|
+
```
|
16
|
+
OR
|
17
|
+
Add to you Gemfile
|
18
|
+
```ruby
|
19
|
+
gem 'ruby_git_issue'
|
20
|
+
```
|
21
|
+
Access the library in Ruby
|
22
|
+
```ruby
|
23
|
+
require 'ruby_git_issue'
|
24
|
+
```
|
26
25
|
## Usage
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
client = RubyGitIssue.new(options)
|
37
|
-
client.issue_options = { title: "Exception[#{Rails.env}]": e.message, labels: ["BUG", "Enhancement"], assignees: ['github_repo_username_1', 'github_repo_username_2'] }
|
38
|
-
|
26
|
+
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
|
27
|
+
Repository Users can also create an issue with this gem but, usage will be limited to issue creation only
|
28
|
+
To get the token goto [Developer Settings](https://github.com/settings/apps) > [Personal Access token](https://github.com/settings/tokens) > Generate new token
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
options = { token: "above_mentioned", repo: "on_which_repo_you_want_issu", organization: "organization", exception_data: e, request: request}
|
32
|
+
client = RubyGitIssue.new(options)
|
33
|
+
client.issue_options = { title: "Exception[#{Rails.env}]": e.message, labels: ["BUG", "Enhancement"], assignees: ['github_repo_username_1', 'github_repo_username_2'] }
|
34
|
+
```
|
39
35
|
#### Generate issue on repo
|
40
36
|
`generate_issue` method will generate the issue for you on GitHub
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
```ruby
|
38
|
+
client.generate_issue
|
39
|
+
```
|
44
40
|
#### OR
|
45
|
-
|
46
41
|
#### Generate issue on (organization) project
|
47
|
-
|
48
42
|
`generate_issue(git_column)` method will generate the issue for you and assign to a project board as well
|
49
|
-
|
50
43
|
To get the `git_column` we need to follow below process
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
find the id of the column from the above call and
|
63
|
-
|
64
|
-
`client.generate_issue(git_column)`
|
44
|
+
```ruby
|
45
|
+
projects = client.get_org_projects
|
46
|
+
```
|
47
|
+
Find the id of the project from above call. There will be columns and cards on the project. With project's id get project's columns.
|
48
|
+
```ruby
|
49
|
+
client.get_projects_columns(project_id)
|
50
|
+
```
|
51
|
+
Find the id of the column from the above call and
|
52
|
+
```ruby
|
53
|
+
client.generate_issue(git_column)
|
54
|
+
```
|
65
55
|
|
66
56
|
### Setup middelware on exception_notification
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
column_id: ENV['GIT_COLUMN']
|
112
|
-
}
|
57
|
+
* Install gem '[exception_notification](https://github.com/smartinez87/exception_notification)'
|
58
|
+
* Setup middelware
|
59
|
+
Add file to `lib/exception_notifier/github_notifier.rb`
|
60
|
+
```ruby
|
61
|
+
require 'action_dispatch'
|
62
|
+
module ExceptionNotifier
|
63
|
+
class GithubNotifier < BaseNotifier
|
64
|
+
|
65
|
+
class MissingController
|
66
|
+
def method_missing(*args, &block)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def initialize(options)
|
71
|
+
@default_options = options
|
72
|
+
end
|
73
|
+
|
74
|
+
def call(exception, options={})
|
75
|
+
unless options[:env].nil?
|
76
|
+
request = ActionDispatch::Request.new(options[:env])
|
77
|
+
git_options = @default_options.merge!({exception_data: exception, request: request})
|
78
|
+
client = RubyGitIssue.new(git_options)
|
79
|
+
client.issue_options = { title: "#{@default_options[:prefix]}: #{exception.message}",
|
80
|
+
labels: @default_options[:labels],
|
81
|
+
assignees: @default_options[:assignees] }
|
82
|
+
client.generate_issue(@default_options[:column_id])
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
```
|
88
|
+
Add middelware to envrionment file on rails project
|
89
|
+
```ruby
|
90
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
91
|
+
github: {
|
92
|
+
prefix: 'Exception [Development]: ',
|
93
|
+
repo: ENV['GIT_REPO'],
|
94
|
+
token: ENV['GIT_TOKEN'],
|
95
|
+
organization: ENV['GIT_ORG'],
|
96
|
+
labels: ["BUG"],
|
97
|
+
assignees: [ENV['GIT_ASSIGNEES']],
|
98
|
+
column_id: ENV['GIT_COLUMN']
|
99
|
+
}
|
100
|
+
```
|