github_issue_maker 0.0.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 +7 -0
- data/lib/github_issue_maker.rb +56 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7e98746e8a0702ab79f76ac943fec81eb57f48dc75fbcc0e49b8e73ff411520e
|
4
|
+
data.tar.gz: 4cc151786f694988ac8833ca075ca2359d5183a8b0e62db8feabcb13711def84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bd5292214e6788cfd9fdc7eabb811f052aa36544c5026451e3ca573ff8750c769290f130168b9d0b2864a762db13a151eaafef6379a0c3e8871ae3b505046e16
|
7
|
+
data.tar.gz: fbea4d689d5fb2070afd1f1527b6ac70b1ffbfda983446c735f522d0249d27ebdcbce73ddbf84828066a26b701b4c79c04eeebb80235a9ab92f22ff6fea1e9e6
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module GithubIssueMaker
|
2
|
+
def create_github_issue!
|
3
|
+
set_config_variables
|
4
|
+
|
5
|
+
s3 = Aws::S3::Client.new
|
6
|
+
s3_body = Base64.decode64(self.send(@instance_details[:screenshot_column]).gsub(/^data:image\/\w+;base64,/, ''))
|
7
|
+
s3.put_object(bucket: @s3_details[:bucket], acl: 'public-read', key: file_name, body: s3_body,
|
8
|
+
content_type: 'image/png')
|
9
|
+
|
10
|
+
github = Github.new oauth_token: @github_details[:access_token]
|
11
|
+
file_name = "#{SecureRandom.hex}/issue.png"
|
12
|
+
issue = github.issues.create(user: @github_details[:user], repo: @github_details[:repo],
|
13
|
+
title: @github_details[:issue_title], body: github_issue_body(file_name),
|
14
|
+
labels: @github_details[:labels])
|
15
|
+
issue[:html_url]
|
16
|
+
end
|
17
|
+
|
18
|
+
def github_issue_body(screenshot_url)
|
19
|
+
body = []
|
20
|
+
body << "# Description \n #{description_section}"
|
21
|
+
body << "# User \n #{user_section}"
|
22
|
+
body << "# Url \n #{url_section}"
|
23
|
+
body << "# Screenshot \n #{screenshot_section(screenshot_url)}"
|
24
|
+
body << "# HEAD \n #{git_head_section}"
|
25
|
+
body.join("\n \n")
|
26
|
+
end
|
27
|
+
|
28
|
+
def description_section
|
29
|
+
self.send(@instance_details[:description_column])
|
30
|
+
end
|
31
|
+
|
32
|
+
def user_section
|
33
|
+
user = self.send(@instance_details[:user_method])
|
34
|
+
"#{user.try(:email) || user.try(:login)} - (#{user.try(:id)})"
|
35
|
+
end
|
36
|
+
|
37
|
+
def url_section
|
38
|
+
self.send(@instance_details[:url_column])
|
39
|
+
end
|
40
|
+
|
41
|
+
def screenshot_section(screenshot_url)
|
42
|
+
""
|
43
|
+
end
|
44
|
+
|
45
|
+
def git_head_section
|
46
|
+
self.send(@instance_details[:git_hash_column])
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def set_config_variables
|
52
|
+
@instance_details = GITHUB_ISSUE_MAKER_CONFIG[:instance_details]
|
53
|
+
@github_details = GITHUB_ISSUE_MAKER_CONFIG[:github_details]
|
54
|
+
@s3_details = GITHUB_ISSUE_MAKER_CONFIG[:s3_details]
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: github_issue_maker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jared Loucks
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A GitHub Issue creation gem
|
14
|
+
email: jaredbrianming@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/github_issue_maker.rb
|
20
|
+
homepage: http://rubygems.org/gems/github_issue_maker
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.7.6
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Creates GitHub Issues from a UserIssue model
|
44
|
+
test_files: []
|