copyist 0.1.0 → 0.2.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/.env.sample +20 -5
- data/.env.test +25 -7
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -1
- data/README.md +11 -5
- data/copyist.gemspec +3 -3
- data/exe/copyist +2 -1
- data/lib/copyist.rb +12 -8
- data/lib/copyist/application.rb +7 -0
- data/lib/copyist/jira.rb +116 -0
- data/lib/copyist/job.rb +27 -23
- data/lib/copyist/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd206b686340bbe5bd3128aba695172ed20dc8f7668efffbc5069b479c36ad49
|
|
4
|
+
data.tar.gz: dff18b24a291c853e1d3f79c5f5a7d79607ae21550f3725fc4f3edaa02135c47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f45f2e8540fa79166e6cad97cb69fccaf1860a5f23cdec4b32d421898ae621981ce6bdad8ce566562420c841944b0c4bef3de40d0bba2d5e1c8b85441df067a4
|
|
7
|
+
data.tar.gz: 615d0224924e737ae3cd48b07c144744e88d1830f527a74bd49293dfbdbd5937766f1543a457f525df3bd64621d1e267719c49d20c240e6ae9c2dd9521c2e8b7
|
data/.env.sample
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
# ---- for github section ---- #
|
|
2
|
+
|
|
3
|
+
GITHUB_PERSONAL_TOKEN=
|
|
2
4
|
GITHUB_USER_NAME=
|
|
3
5
|
GITHUB_REPO_NAME=
|
|
4
6
|
|
|
7
|
+
|
|
8
|
+
# ---- for JIRA section ---- #
|
|
9
|
+
|
|
10
|
+
JIRA_API_TOKEN=
|
|
11
|
+
JIRA_SUBDOMAIN_NAME=
|
|
12
|
+
JIRA_USER_NAME=
|
|
13
|
+
JIRA_PROJECT_NAME=
|
|
14
|
+
JIRA_ISSUE_TYPE_ID=
|
|
15
|
+
|
|
16
|
+
JIRA_PARENT_PROJECT_IDENTIFIRE='parent:'
|
|
17
|
+
|
|
18
|
+
# ---- common section ---- #
|
|
19
|
+
|
|
20
|
+
LABEL_IDENTIFIRE='labels:'
|
|
21
|
+
GLOBAL_LABELS='copyist_generated'
|
|
22
|
+
|
|
5
23
|
# standard style
|
|
6
24
|
TITLE_IDENTIFIRE='#'
|
|
7
25
|
SKIP_IDENTIFIRES='skip_line:,#####'
|
|
8
|
-
LABEL_IDENTIFIRE='labels:'
|
|
9
|
-
|
|
10
|
-
GLOBAL_LABELS='copyist_generated'
|
|
11
26
|
|
|
12
27
|
# # alternative style
|
|
13
28
|
# TITLE_IDENTIFIRE='###'
|
|
14
29
|
# SKIP_IDENTIFIRES='#,##'
|
|
15
|
-
# LABEL_IDENTIFIRE='labels:'
|
|
16
30
|
|
|
17
31
|
# template must have '{ticket_description_block}'. That will be replaced by the tickets description.
|
|
18
32
|
# TEMPLATE_FILE_PATH='../template.md'
|
|
33
|
+
|
data/.env.test
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# ---- for github section ---- #
|
|
2
|
+
GITHUB_PERSONAL_TOKEN=foobar_token
|
|
3
|
+
GITHUB_USER_NAME=foo
|
|
4
|
+
GITHUB_REPO_NAME=bar
|
|
4
5
|
|
|
5
|
-
TITLE_IDENTIFIRE='#'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
# ---- for JIRA section ---- #
|
|
8
|
+
JIRA_API_TOKEN=hoobar_token
|
|
9
|
+
JIRA_SUBDOMAIN_NAME=xyz
|
|
10
|
+
JIRA_USER_NAME=hoo
|
|
11
|
+
JIRA_PROJECT_NAME=bar
|
|
12
|
+
JIRA_ISSUE_TYPE_ID=123
|
|
13
|
+
|
|
14
|
+
JIRA_PARENT_PROJECT_IDENTIFIRE='parent:'
|
|
15
|
+
|
|
16
|
+
# ---- common section ---- #
|
|
8
17
|
|
|
9
18
|
LABEL_IDENTIFIRE='labels:'
|
|
19
|
+
GLOBAL_LABELS='copyist_generated'
|
|
20
|
+
|
|
21
|
+
# standard style
|
|
22
|
+
TITLE_IDENTIFIRE='#'
|
|
23
|
+
SKIP_IDENTIFIRES='skip_line:,#####'
|
|
24
|
+
|
|
25
|
+
# # alternative style
|
|
26
|
+
# TITLE_IDENTIFIRE='###'
|
|
27
|
+
# SKIP_IDENTIFIRES='#,##'
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
# template must have '{ticket_description_block}'. That will be replaced by the tickets description.
|
|
30
|
+
# TEMPLATE_FILE_PATH='../template.md'
|
|
12
31
|
|
|
13
|
-
TEMPLATE_FILE_PATH=
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion:
|
|
2
|
+
TargetRubyVersion: 3.0
|
|
3
|
+
Exclude:
|
|
4
|
+
- 'test/**/*.rb'
|
|
5
|
+
- 'test/*.rb'
|
|
3
6
|
|
|
4
7
|
Style/StringLiterals:
|
|
5
8
|
Enabled: true
|
|
@@ -11,3 +14,7 @@ Style/StringLiteralsInInterpolation:
|
|
|
11
14
|
|
|
12
15
|
Layout/LineLength:
|
|
13
16
|
Max: 120
|
|
17
|
+
|
|
18
|
+
# TODO: consider tightening the rule (default: 10)
|
|
19
|
+
Metrics/MethodLength:
|
|
20
|
+
Max: 25
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -3,11 +3,9 @@ This application is a tool that can parse a file written in markdown and generat
|
|
|
3
3
|
|
|
4
4
|
The word 'Copyist' means 'Hikko (筆耕)' in Japanese.
|
|
5
5
|
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
1. clone this repository
|
|
9
|
-
1. `$ bundle install`
|
|
10
6
|
## How to use
|
|
7
|
+
### step0. Installation
|
|
8
|
+
- `$ gem install copyist`
|
|
11
9
|
|
|
12
10
|
### step1. set ENV
|
|
13
11
|
- set your github personal token to GITHUB_PERSONAL_TOKEN
|
|
@@ -30,7 +28,7 @@ example
|
|
|
30
28
|
```
|
|
31
29
|
|
|
32
30
|
### step3. run copyist
|
|
33
|
-
1. `$
|
|
31
|
+
1. `$ copyist job path/to/markdown_file.md`
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
## Required or Optional Settings (to ENV or .env)
|
|
@@ -103,6 +101,14 @@ example)
|
|
|
103
101
|
$ export ENVFILE_PATH=.env
|
|
104
102
|
```
|
|
105
103
|
|
|
104
|
+
## Experimental Feature
|
|
105
|
+
Implemented a feature to generate JIRA child issues.
|
|
106
|
+
(Because the team I belong to switched from GIthub to JIRA)
|
|
107
|
+
|
|
108
|
+
By setting the `JIRA_PARENT_PROJECT_IDENTIFIRE` key to the prepared markdown, you can create a ticket for a child issue that is connected to an already existing parent issue.
|
|
109
|
+
|
|
110
|
+
Please check the implementation for details.
|
|
111
|
+
|
|
106
112
|
|
|
107
113
|
## Development
|
|
108
114
|
|
data/copyist.gemspec
CHANGED
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = ""
|
|
13
13
|
spec.homepage = "https://github.com/ymstshinichiro/copyist"
|
|
14
14
|
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
|
16
16
|
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/ymstshinichiro/copyist"
|
|
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
|
|
30
30
|
# Uncomment to register a new dependency of your gem
|
|
31
31
|
# spec.add_dependency "example-gem", "~> 1.0"
|
|
32
|
-
spec.add_dependency
|
|
33
|
-
spec.add_dependency
|
|
32
|
+
spec.add_dependency "dotenv"
|
|
33
|
+
spec.add_dependency "thor"
|
|
34
34
|
|
|
35
35
|
# For more information and examples about making a new gem, checkout our
|
|
36
36
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/exe/copyist
CHANGED
data/lib/copyist.rb
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
require 'net/http'
|
|
3
|
-
require 'json'
|
|
4
|
-
require 'dotenv'
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
6
|
-
require
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
require "thor"
|
|
4
|
+
require "net/http"
|
|
5
|
+
require "json"
|
|
6
|
+
require "dotenv"
|
|
7
|
+
require "base64"
|
|
8
|
+
|
|
9
|
+
require "copyist"
|
|
10
|
+
require_relative "copyist/version"
|
|
11
|
+
require_relative "copyist/application"
|
|
12
|
+
require_relative "copyist/job"
|
|
13
|
+
require_relative "copyist/jira"
|
data/lib/copyist/application.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Copyist
|
|
2
4
|
class Application < Thor
|
|
3
5
|
def self.exit_on_failure?
|
|
@@ -8,5 +10,10 @@ module Copyist
|
|
|
8
10
|
def job(file)
|
|
9
11
|
Copyist::Job.new(file).run
|
|
10
12
|
end
|
|
13
|
+
|
|
14
|
+
desc "jira path/to/markdown_file.md", "Parses the markdown file to creates a jira-subtasks"
|
|
15
|
+
def jira(file)
|
|
16
|
+
Copyist::Jira.new(file).run
|
|
17
|
+
end
|
|
11
18
|
end
|
|
12
19
|
end
|
data/lib/copyist/jira.rb
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Copyist
|
|
4
|
+
class Jira
|
|
5
|
+
IssueTicket = Struct.new(:title, :description, :labels, :parent)
|
|
6
|
+
|
|
7
|
+
attr_accessor(:title_identifire, :skip_identifires, :label_identifire, :global_labels, :template_file_path,
|
|
8
|
+
:basic_auth, :parent_identifire)
|
|
9
|
+
|
|
10
|
+
def initialize(argv)
|
|
11
|
+
@source_md_file_path = argv
|
|
12
|
+
|
|
13
|
+
env_path = ENV["ENVFILE_PATH"]
|
|
14
|
+
Dotenv.load(env_path) if env_path && !env_path.empty?
|
|
15
|
+
|
|
16
|
+
if ENV["JIRA_USER_NAME"].empty? || ENV["JIRA_PROJECT_NAME"].empty?
|
|
17
|
+
raise "set JIRA_USER_NAME and JIRA_PROJECT_NAME to env"
|
|
18
|
+
end
|
|
19
|
+
raise "set TITLE_IDENTIFIRE to env" if ENV["TITLE_IDENTIFIRE"].empty?
|
|
20
|
+
raise "set JIRA_PARENT_PROJECT_IDENTIFIRE to env" if ENV["JIRA_PARENT_PROJECT_IDENTIFIRE"].empty?
|
|
21
|
+
|
|
22
|
+
@parent_identifire = "#{ENV["JIRA_PARENT_PROJECT_IDENTIFIRE"]} "
|
|
23
|
+
|
|
24
|
+
@title_identifire = "#{ENV["TITLE_IDENTIFIRE"]} "
|
|
25
|
+
@skip_identifires = ENV["SKIP_IDENTIFIRES"]&.size&.nonzero? ? Regexp.new("^#{ENV["SKIP_IDENTIFIRES"].split(",").join(" |")}") : nil
|
|
26
|
+
@label_identifire = ENV["LABEL_IDENTIFIRE"]&.size&.nonzero? ? "#{ENV["LABEL_IDENTIFIRE"]} " : nil
|
|
27
|
+
|
|
28
|
+
@global_labels = ENV["GLOBAL_LABELS"]&.size&.nonzero? ? ENV["GLOBAL_LABELS"] : nil
|
|
29
|
+
@template_file_path = ENV["TEMPLATE_FILE_PATH"]&.size&.nonzero? ? ENV["TEMPLATE_FILE_PATH"] : nil
|
|
30
|
+
|
|
31
|
+
@basic_auth = Base64.urlsafe_encode64("#{ENV["JIRA_USER_NAME"]}:#{ENV["JIRA_API_TOKEN"]}")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def run
|
|
35
|
+
puts "make subtasks to JIRA from markdown"
|
|
36
|
+
|
|
37
|
+
tickets_from_markdown.each do |ticket|
|
|
38
|
+
response = request_to_jira(ticket)
|
|
39
|
+
puts response.message
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
puts "process finished"
|
|
43
|
+
rescue StandardError => e
|
|
44
|
+
puts ["fatal error.", "-------", e.backtrace, "------"].flatten.join("\n")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def tickets_from_markdown
|
|
48
|
+
tickets = []
|
|
49
|
+
get_markdown.each do |line|
|
|
50
|
+
next if skip_identifires && line.match?(skip_identifires)
|
|
51
|
+
|
|
52
|
+
if line.match?(/^#{title_identifire}/)
|
|
53
|
+
tickets << IssueTicket.new(line.gsub(/#{title_identifire}|\*|\*\*|`/, ""), [], [], nil)
|
|
54
|
+
|
|
55
|
+
elsif line.match?(/^#{parent_identifire}/)
|
|
56
|
+
tickets&.last&.parent = line.gsub(/#{parent_identifire}|\*|\*\*|`/, "")
|
|
57
|
+
|
|
58
|
+
elsif label_identifire && line.match?(/^#{label_identifire}/)
|
|
59
|
+
(tickets&.last&.labels || []) << line.gsub(label_identifire, "").chomp.split(",").map(&:strip)
|
|
60
|
+
|
|
61
|
+
else
|
|
62
|
+
(tickets&.last&.description || []) << line
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
tickets.each { |i| i.description = make_description(i.description) }
|
|
67
|
+
tickets
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def make_description(description_text_array)
|
|
73
|
+
description = description_text_array.join("\n")
|
|
74
|
+
|
|
75
|
+
if template_file_path
|
|
76
|
+
template = File.open(template_file_path, "r", &:read)
|
|
77
|
+
description = template.gsub("{ticket_description_block}", description)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
description
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def request_to_jira(ticket)
|
|
84
|
+
uri = get_uri
|
|
85
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
86
|
+
http.use_ssl = uri.scheme === "https"
|
|
87
|
+
|
|
88
|
+
headers = { "Authorization" => "Basic #{basic_auth}" }
|
|
89
|
+
headers["Content-Type"] = "application/json"
|
|
90
|
+
body = make_request_body(ticket)
|
|
91
|
+
|
|
92
|
+
http.post(uri.path, body.to_json, headers)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def make_request_body(ticket)
|
|
96
|
+
{
|
|
97
|
+
fields: {
|
|
98
|
+
project: { key: ENV["JIRA_PROJECT_NAME"] },
|
|
99
|
+
parent: { key: ticket.parent },
|
|
100
|
+
summary: ticket.title,
|
|
101
|
+
description: ticket.description,
|
|
102
|
+
issuetype: { "id": ENV["JIRA_ISSUE_TYPE_ID"] },
|
|
103
|
+
labels: (global_labels&.split(",")&.map(&:strip) + ticket.labels).flatten.uniq
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def get_uri
|
|
109
|
+
URI.parse("https://#{ENV["JIRA_SUBDOMAIN_NAME"]}.atlassian.net/rest/api/2/issue/")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def get_markdown
|
|
113
|
+
File.new(@source_md_file_path).readlines.map(&:chomp)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
data/lib/copyist/job.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Copyist
|
|
2
4
|
class Job
|
|
3
5
|
IssueTicket = Struct.new(:title, :description, :labels)
|
|
@@ -7,30 +9,32 @@ module Copyist
|
|
|
7
9
|
def initialize(argv)
|
|
8
10
|
@source_md_file_path = argv
|
|
9
11
|
|
|
10
|
-
env_path = ENV[
|
|
12
|
+
env_path = ENV["ENVFILE_PATH"]
|
|
11
13
|
Dotenv.load(env_path) if env_path && !env_path.empty?
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
if ENV["GITHUB_USER_NAME"].empty? || ENV["GITHUB_REPO_NAME"].empty?
|
|
16
|
+
raise "set GITHUB_USER_NAME and GITHUB_REPO_NAME to .env file"
|
|
17
|
+
end
|
|
18
|
+
raise "set TITLE_IDENTIFIRE to .env file" if ENV["TITLE_IDENTIFIRE"].empty?
|
|
15
19
|
|
|
16
|
-
@title_identifire = "#{ENV[
|
|
17
|
-
@skip_identifires = ENV[
|
|
18
|
-
@label_identifire = ENV[
|
|
20
|
+
@title_identifire = "#{ENV["TITLE_IDENTIFIRE"]} "
|
|
21
|
+
@skip_identifires = ENV["SKIP_IDENTIFIRES"]&.size&.nonzero? ? Regexp.new("^#{ENV["SKIP_IDENTIFIRES"].split(",").join(" |")}") : nil
|
|
22
|
+
@label_identifire = ENV["LABEL_IDENTIFIRE"]&.size&.nonzero? ? "#{ENV["LABEL_IDENTIFIRE"]} " : nil
|
|
19
23
|
|
|
20
|
-
@global_labels = ENV[
|
|
21
|
-
@template_file_path = ENV[
|
|
24
|
+
@global_labels = ENV["GLOBAL_LABELS"]&.size&.nonzero? ? ENV["GLOBAL_LABELS"] : nil
|
|
25
|
+
@template_file_path = ENV["TEMPLATE_FILE_PATH"]&.size&.nonzero? ? ENV["TEMPLATE_FILE_PATH"] : nil
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def run
|
|
25
|
-
puts
|
|
29
|
+
puts "make tickets to Github from markdown"
|
|
26
30
|
|
|
27
31
|
tickets_from_markdown.each do |ticket|
|
|
28
32
|
response = request_to_github(ticket)
|
|
29
33
|
puts response.message
|
|
30
34
|
end
|
|
31
|
-
puts
|
|
32
|
-
rescue => e
|
|
33
|
-
puts [
|
|
35
|
+
puts "process finished"
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
puts ["fatal error.", "-------", e.backtrace, "------"].flatten.join("\n")
|
|
34
38
|
end
|
|
35
39
|
|
|
36
40
|
def tickets_from_markdown
|
|
@@ -39,17 +43,17 @@ module Copyist
|
|
|
39
43
|
next if skip_identifires && line.match?(skip_identifires)
|
|
40
44
|
|
|
41
45
|
if line.match?(/^#{title_identifire}/)
|
|
42
|
-
tickets << IssueTicket.new(line.gsub(/#{title_identifire}|\*|\*\*|`/,
|
|
46
|
+
tickets << IssueTicket.new(line.gsub(/#{title_identifire}|\*|\*\*|`/, ""), [], [])
|
|
43
47
|
|
|
44
48
|
elsif label_identifire && line.match?(/^#{label_identifire}/)
|
|
45
|
-
(tickets&.last&.labels || []) << line.gsub(label_identifire,
|
|
49
|
+
(tickets&.last&.labels || []) << line.gsub(label_identifire, "").chomp.split(",").map(&:strip)
|
|
46
50
|
|
|
47
51
|
else
|
|
48
52
|
(tickets&.last&.description || []) << line
|
|
49
53
|
end
|
|
50
54
|
end
|
|
51
55
|
|
|
52
|
-
tickets.each{ |i| i.description = make_description(i.description) }
|
|
56
|
+
tickets.each { |i| i.description = make_description(i.description) }
|
|
53
57
|
tickets
|
|
54
58
|
end
|
|
55
59
|
|
|
@@ -59,8 +63,8 @@ module Copyist
|
|
|
59
63
|
description = description_text_array.join
|
|
60
64
|
|
|
61
65
|
if template_file_path
|
|
62
|
-
template = File.open(template_file_path, "r"
|
|
63
|
-
description = template.gsub(
|
|
66
|
+
template = File.open(template_file_path, "r", &:read)
|
|
67
|
+
description = template.gsub("{ticket_description_block}", description)
|
|
64
68
|
end
|
|
65
69
|
|
|
66
70
|
description
|
|
@@ -71,7 +75,7 @@ module Copyist
|
|
|
71
75
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
72
76
|
http.use_ssl = uri.scheme === "https"
|
|
73
77
|
|
|
74
|
-
headers = { Authorization: "token #{ENV[
|
|
78
|
+
headers = { Authorization: "token #{ENV["GITHUB_PERSONAL_TOKEN"]}" }
|
|
75
79
|
body = make_request_body(ticket)
|
|
76
80
|
|
|
77
81
|
http.post(uri.path, body.to_json, headers)
|
|
@@ -79,18 +83,18 @@ module Copyist
|
|
|
79
83
|
|
|
80
84
|
def make_request_body(ticket)
|
|
81
85
|
{
|
|
82
|
-
title:
|
|
83
|
-
body:
|
|
84
|
-
labels: (global_labels&.split(
|
|
86
|
+
title: ticket.title,
|
|
87
|
+
body: ticket.description,
|
|
88
|
+
labels: (global_labels&.split(",")&.map(&:strip) + ticket.labels).flatten.uniq
|
|
85
89
|
}
|
|
86
90
|
end
|
|
87
91
|
|
|
88
92
|
def get_uri
|
|
89
|
-
URI.parse("https://api.github.com/repos/#{ENV[
|
|
93
|
+
URI.parse("https://api.github.com/repos/#{ENV["GITHUB_USER_NAME"]}/#{ENV["GITHUB_REPO_NAME"]}/issues")
|
|
90
94
|
end
|
|
91
95
|
|
|
92
96
|
def get_markdown
|
|
93
97
|
File.new(@source_md_file_path).readlines
|
|
94
98
|
end
|
|
95
99
|
end
|
|
96
|
-
end
|
|
100
|
+
end
|
data/lib/copyist/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: copyist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ymstshinichiro
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-08-
|
|
11
|
+
date: 2021-08-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: dotenv
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: thor
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
@@ -63,6 +63,7 @@ files:
|
|
|
63
63
|
- exe/copyist
|
|
64
64
|
- lib/copyist.rb
|
|
65
65
|
- lib/copyist/application.rb
|
|
66
|
+
- lib/copyist/jira.rb
|
|
66
67
|
- lib/copyist/job.rb
|
|
67
68
|
- lib/copyist/version.rb
|
|
68
69
|
homepage: https://github.com/ymstshinichiro/copyist
|
|
@@ -72,7 +73,7 @@ metadata:
|
|
|
72
73
|
homepage_uri: https://github.com/ymstshinichiro/copyist
|
|
73
74
|
source_code_uri: https://github.com/ymstshinichiro/copyist
|
|
74
75
|
changelog_uri: https://github.com/ymstshinichiro/copyist/blob/master/CHANGELOG.md
|
|
75
|
-
post_install_message:
|
|
76
|
+
post_install_message:
|
|
76
77
|
rdoc_options: []
|
|
77
78
|
require_paths:
|
|
78
79
|
- lib
|
|
@@ -80,15 +81,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
80
81
|
requirements:
|
|
81
82
|
- - ">="
|
|
82
83
|
- !ruby/object:Gem::Version
|
|
83
|
-
version:
|
|
84
|
+
version: 3.0.0
|
|
84
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
86
|
requirements:
|
|
86
87
|
- - ">="
|
|
87
88
|
- !ruby/object:Gem::Version
|
|
88
89
|
version: '0'
|
|
89
90
|
requirements: []
|
|
90
|
-
rubygems_version: 3.
|
|
91
|
-
signing_key:
|
|
91
|
+
rubygems_version: 3.2.15
|
|
92
|
+
signing_key:
|
|
92
93
|
specification_version: 4
|
|
93
94
|
summary: parse markdown to create github issues
|
|
94
95
|
test_files: []
|