get_issues 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/get_issues/version.rb +1 -1
- data/lib/get_issues.rb +43 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb7c65b432b3e28c576fa2224130a2d338590214abdfbbdad8968a7e73a0abc0
|
4
|
+
data.tar.gz: 2482bed8567a15ff1e4d8ba275dee4660cb5003275b071c5df07c70b5d1c515b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61a2b4cfd7aa6f23680e1a87faf67d16c4ffb2f05a22bb73a61400a442531dee8c0f1c266c4f2fbcc51f9253227489948d262501d466e27653979d17ecd2e25
|
7
|
+
data.tar.gz: 1f349dcccb24b1938ebb291643c0bd7e63df2c114b6ac930362507626adf158e54162d83e3a3d76e118da2de4b404460e25a852d0473654cbda2c64aea5f7a67
|
data/lib/get_issues/version.rb
CHANGED
data/lib/get_issues.rb
CHANGED
@@ -4,24 +4,50 @@ require "spreadsheet_architect"
|
|
4
4
|
module GetIssues
|
5
5
|
class Error < StandardError; end
|
6
6
|
|
7
|
-
def self.start(prefix_url, private_token, project_name, mile_stone_title)
|
8
|
-
projects_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}"`
|
9
|
-
projects_json = JSON.parse(projects_string)
|
10
|
-
project_json = projects_json.filter { |t| t["name"] == project_name }&.first
|
11
|
-
project_id = project_json["id"]
|
12
7
|
|
13
|
-
|
8
|
+
def self.start_group(prefix_url,private_token,group_name,mile_stone_title)
|
9
|
+
groups_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/groups"`
|
10
|
+
groups_json = JSON.parse(groups_string)
|
11
|
+
group_json = groups_json.filter { |t| t["name"] == group_name }&.first || {}
|
12
|
+
group_id = group_json["id"]
|
13
|
+
if group_id.nil?
|
14
|
+
p "找不到group"
|
15
|
+
end
|
16
|
+
|
17
|
+
milestones_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/groups/#{group_id}/milestones"`
|
14
18
|
milestones_json = JSON.parse(milestones_string)
|
15
19
|
mile_stone_json = milestones_json.filter { |t| t["title"] == mile_stone_title }&.first
|
16
20
|
mile_stone_id = mile_stone_json["id"]
|
21
|
+
if mile_stone_id.nil?
|
22
|
+
p "找不到mile_stone"
|
23
|
+
end
|
17
24
|
|
18
|
-
issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/#{
|
25
|
+
issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/groups/#{group_id}/milestones/#{mile_stone_id}/issues?per_page=10000"`
|
19
26
|
issues_json = JSON.parse(issues_string)
|
20
27
|
issues_json
|
21
28
|
end
|
22
29
|
|
23
|
-
def self.
|
24
|
-
|
30
|
+
def self.start_project(prefix_url, private_token, project_name, mile_stone_title)
|
31
|
+
projects_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/projects"`
|
32
|
+
projects_json = JSON.parse(projects_string)
|
33
|
+
project_json = projects_json.filter { |t| t["name"] == project_name }&.first || {}
|
34
|
+
project_id = project_json["id"]
|
35
|
+
if project_id.nil?
|
36
|
+
p "找不到project"
|
37
|
+
end
|
38
|
+
milestones_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/projects/#{project_id}/milestones"`
|
39
|
+
milestones_json = JSON.parse(milestones_string)
|
40
|
+
mile_stone_json = milestones_json.filter { |t| t["title"] == mile_stone_title }&.first || {}
|
41
|
+
mile_stone_id = mile_stone_json["id"]
|
42
|
+
if mile_stone_id.nil?
|
43
|
+
p "找不到mile_stone"
|
44
|
+
end
|
45
|
+
issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/projects/#{project_id}/milestones/#{mile_stone_id}/issues?per_page=10000"`
|
46
|
+
issues_json = JSON.parse(issues_string)
|
47
|
+
issues_json
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.to_xlsx(issues_json,mile_stone_title)
|
25
51
|
data = []
|
26
52
|
issues_json.each do |issue|
|
27
53
|
assignes_names = issue["assignees"]&.map { |t| t["name"]&.split(" ")&.reverse&.join("") }&.join(",")
|
@@ -35,6 +61,14 @@ module GetIssues
|
|
35
61
|
f.write file_data
|
36
62
|
end
|
37
63
|
end
|
64
|
+
def self.to_xlsx_group(prefix_url,private_token,group_name,mile_stone_title)
|
65
|
+
issues_json = start_group(prefix_url,private_token,group_name,mile_stone_title)
|
66
|
+
to_xlsx(issues_json,mile_stone_title)
|
67
|
+
end
|
68
|
+
def self.to_xlsx_project(prefix_url, private_token, project_name, mile_stone_title)
|
69
|
+
issues_json = start_project(prefix_url, private_token, project_name, mile_stone_title)
|
70
|
+
to_xlsx(issues_json,mile_stone_title)
|
71
|
+
end
|
38
72
|
# 定义xlsx文件格式的头样式
|
39
73
|
def self.init_header_style
|
40
74
|
{ height: 75, background_color: "458B00", color: "FFFFFF", align: :center, font_name: "Arial", font_size: 14, bold: false, italic: false, underline: false }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: get_issues
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '807715333'
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|