get_issues 0.1.2 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +1 -1
- data/get_issues.gemspec +1 -0
- data/lib/get_issues/version.rb +1 -1
- data/lib/get_issues.rb +43 -9
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587b8c56362302e2938510d98cbf0178313181060445999b13f7f0bbae799537
|
4
|
+
data.tar.gz: 6a9d1aaf452391f6a16f3bfc51e51f88f2570fada575f6a0b60eec1fa3c1319e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 579c044bf1549efab620115a82b49c527612f79a9072e896d61cc509ed882987f312061969a46db9eea56056ba50e0dc6393ce8256571b19e7da4ba33c8b051d
|
7
|
+
data.tar.gz: 689184fd5eddc34082cdf13c371cf2ea8b669e651a5928a5a3279e97c04bfe4d1a068d0191f86a46e9f746f6b7a668ecd1f8b3a352d54335a5035b7493d879d8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/get_issues.gemspec
CHANGED
@@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 1.17"
|
36
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
37
37
|
spec.add_development_dependency "minitest", "~> 5.0"
|
38
|
+
spec.add_runtime_dependency "spreadsheet_architect", "~> 4.2.0"
|
38
39
|
end
|
data/lib/get_issues/version.rb
CHANGED
data/lib/get_issues.rb
CHANGED
@@ -3,25 +3,51 @@ require "spreadsheet_architect"
|
|
3
3
|
|
4
4
|
module GetIssues
|
5
5
|
class Error < StandardError; end
|
6
|
+
https://repo.scm.atyun.com.cn/api/v4/projects?sort=asc&&order_by=name&&simple=true&&per_page=1000
|
6
7
|
|
7
|
-
def self.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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?per_page=1000"`
|
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
|
12
16
|
|
13
|
-
milestones_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/#{
|
17
|
+
milestones_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/groups/#{group_id}/milestones?per_page=1000"`
|
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
|
24
|
+
|
25
|
+
issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/groups/#{group_id}/milestones/#{mile_stone_id}/issues?per_page=10000"`
|
26
|
+
issues_json = JSON.parse(issues_string)
|
27
|
+
issues_json
|
28
|
+
end
|
17
29
|
|
18
|
-
|
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?sort=asc&&order_by=name&&simple=true&&per_page=1000"`
|
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&&per_page=1000"`
|
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"`
|
19
46
|
issues_json = JSON.parse(issues_string)
|
20
47
|
issues_json
|
21
48
|
end
|
22
49
|
|
23
|
-
def self.to_xlsx(
|
24
|
-
issues_json = start(prefix_url, private_token, project_name, mile_stone_title)
|
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.6
|
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-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: spreadsheet_architect
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.2.0
|
55
69
|
description: 根据里程碑获取issues
|
56
70
|
email:
|
57
71
|
- 807715333@qq.com
|