get_issues 0.1.0 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d5f8f6265732e662fd4a7eaa45cbb68e50f4000d32ac6f5e9e6fb2a97371de9
4
- data.tar.gz: a571d91e5bca6f3b10f636c10ebe10e475c26b03a4370cd05c124a7991e7984b
3
+ metadata.gz: 1c41b74b883f3fa6e01474a91c75dd9f3c2ace38b9eeac046c5550b410f8a770
4
+ data.tar.gz: 85b0058de525d90c15e187a2ae920f57d55d75ee17e2922759a18de5edb546cc
5
5
  SHA512:
6
- metadata.gz: 3baede88bbb75dfcd46c211673469f603515910f716f1cf92e8d95400d5940dcad6a2f60fbf78306d4eee9c0669977355b66c6cc758d46b37c11e4aa4793ec04
7
- data.tar.gz: 4db6b4057fdc47ec583ca4bcaa42ced1de17176663db90b12f407435b5f063a7dd04f167525e90018f5b77cbec67552f4e9915457cdf5d96ec7e6e46eca49a69
6
+ metadata.gz: fd60c37b8b36f65c26fe1f2b53c564d3d34e3edaf41d0524d8a1af4253a8e211b8263dab36bc7ce4ac6b7735b917ffb84283cb10aaab62de2d5cc78e93aff85b
7
+ data.tar.gz: a3c2ac9aeb6c2f476dbcb2a720185faa353b39e2718ef8d2f0d1ca6eea82539fb2e341500be6e2985384536b64b4795b2c1410598ac080597f3a542c00e5f1ad
data/.idea/.gitignore CHANGED
@@ -1,8 +1,8 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Datasource local storage ignored files
5
- /dataSources/
6
- /dataSources.local.xml
7
- # Editor-based HTTP Client requests
8
- /httpRequests/
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
data/.idea/.rakeTasks CHANGED
@@ -1,7 +1,7 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Settings><!--This file was automatically generated by Ruby plugin.
3
3
  You are allowed to:
4
4
  1. Remove rake task
5
5
  2. Add existing rake tasks
6
6
  To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
7
+ --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
data/.idea/get_issues.iml CHANGED
@@ -1,18 +1,18 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$">
8
- <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
- </content>
12
- <orderEntry type="inheritedJdk" />
13
- <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, ruby-2.6.1-p33) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.4, ruby-2.6.1-p33) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.1-p33) [gem]" level="application" />
17
- </component>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, ruby-2.6.1-p33) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.4, ruby-2.6.1-p33) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.1-p33) [gem]" level="application" />
17
+ </component>
18
18
  </module>
data/.idea/misc.xml CHANGED
@@ -1,7 +1,7 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.1-p33" project-jdk-type="RUBY_SDK" />
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.1-p33" project-jdk-type="RUBY_SDK" />
7
7
  </project>
data/.idea/modules.xml CHANGED
@@ -1,8 +1,8 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/get_issues.iml" filepath="$PROJECT_DIR$/.idea/get_issues.iml" />
6
- </modules>
7
- </component>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/get_issues.iml" filepath="$PROJECT_DIR$/.idea/get_issues.iml" />
6
+ </modules>
7
+ </component>
8
8
  </project>
data/.idea/vcs.xml CHANGED
@@ -1,6 +1,6 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
6
  </project>
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in get_issues.gemspec
6
6
  gemspec
7
+ gem 'spreadsheet_architect'
8
+
data/Gemfile.lock CHANGED
@@ -1,15 +1,57 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- get_issues (0.1.0)
4
+ get_issues (0.1.2)
5
+ spreadsheet_architect (~> 4.2.0)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ activesupport (6.1.4.1)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ axlsx_styler (1.1.0)
17
+ activesupport (>= 3.1)
18
+ caxlsx (>= 2.0.2)
19
+ builder (3.2.4)
20
+ caxlsx (3.1.0)
21
+ htmlentities (~> 4.3, >= 4.3.4)
22
+ marcel (~> 1.0)
23
+ nokogiri (~> 1.10, >= 1.10.4)
24
+ rubyzip (>= 1.3.0, < 3)
25
+ concurrent-ruby (1.1.9)
26
+ dry-inflector (0.2.1)
27
+ htmlentities (4.3.4)
28
+ i18n (1.8.10)
29
+ concurrent-ruby (~> 1.0)
30
+ marcel (1.0.1)
31
+ mini_portile2 (2.6.1)
9
32
  minitest (5.14.4)
33
+ nokogiri (1.12.3)
34
+ mini_portile2 (~> 2.6.1)
35
+ racc (~> 1.4)
36
+ nokogiri (1.12.3-x64-mingw32)
37
+ racc (~> 1.4)
38
+ racc (1.5.2)
10
39
  rake (10.5.0)
40
+ rodf (1.1.1)
41
+ builder (>= 3.0)
42
+ dry-inflector (~> 0.1)
43
+ rubyzip (>= 1.0)
44
+ rubyzip (2.3.2)
45
+ spreadsheet_architect (4.2.0)
46
+ axlsx_styler (>= 1.0.0, < 2)
47
+ caxlsx (>= 2.0.2, < 4)
48
+ rodf (>= 1.0.0, < 2)
49
+ tzinfo (2.0.4)
50
+ concurrent-ruby (~> 1.0)
51
+ zeitwerk (2.4.2)
11
52
 
12
53
  PLATFORMS
54
+ ruby
13
55
  x64-mingw32
14
56
 
15
57
  DEPENDENCIES
@@ -17,6 +59,7 @@ DEPENDENCIES
17
59
  get_issues!
18
60
  minitest (~> 5.0)
19
61
  rake (~> 10.0)
62
+ spreadsheet_architect
20
63
 
21
64
  BUNDLED WITH
22
65
  1.17.2
data/README.md CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
  ```ruby
25
- prefix_url = 'https://repo2.scm.atyun.com.cn/api/v4/projects'
25
+ prefix_url = 'https://xxxxxx/api/v4/projects'
26
26
  private_token = 'xxx'
27
27
  group_name = 'xxx'
28
28
  project_name = 'xxx'
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.rb CHANGED
@@ -1,21 +1,47 @@
1
- require 'json'
1
+ require "json"
2
+ require "spreadsheet_architect"
2
3
 
3
4
  module GetIssues
4
5
  class Error < StandardError; end
5
- def self.start(prefix_url,private_token,group_name,project_name,mile_stone_title)
6
+
7
+ def self.start(prefix_url, private_token, project_name, mile_stone_title)
6
8
  projects_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}"`
7
9
  projects_json = JSON.parse(projects_string)
8
- project_json = projects_json.filter{|t| t["name"]==project_name}&.first
10
+ project_json = projects_json.filter { |t| t["name"] == project_name }&.first
9
11
  project_id = project_json["id"]
10
-
11
12
 
12
13
  milestones_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/#{project_id}/milestones"`
13
14
  milestones_json = JSON.parse(milestones_string)
14
- mile_stone_json = milestones_json.filter{|t| t["title"]==milestone_title}&.first
15
+ mile_stone_json = milestones_json.filter { |t| t["title"] == mile_stone_title }&.first
15
16
  mile_stone_id = mile_stone_json["id"]
16
17
 
17
-
18
- issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/#{project_id}/milestones/#{mile_stone_id}/issues"`
18
+ issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/#{project_id}/milestones/#{mile_stone_id}/issues?per_page=10000"`
19
19
  issues_json = JSON.parse(issues_string)
20
+ issues_json
21
+ end
22
+
23
+ def self.to_xlsx(prefix_url, private_token, project_name, mile_stone_title)
24
+ issues_json = start(prefix_url, private_token, project_name, mile_stone_title)
25
+ data = []
26
+ issues_json.each do |issue|
27
+ assignes_names = issue["assignees"]&.map { |t| t["name"]&.split(" ")&.reverse&.join("") }&.join(",")
28
+ milestone = issue["milestone"]["title"] rescue ""
29
+ data << ["##{issue["iid"]}",issue["title"], assignes_names, issue["labels"]&.join(","), milestone]
30
+ end
31
+ headers = %w(编号 标题 负责人 标签 归属端)
32
+ options = { headers: headers, data: data, header_style: init_header_style, row_style: init_row_style }
33
+ file_data = SpreadsheetArchitect.to_xlsx(options)
34
+ file = File.open("#{mile_stone_title}.xlsx".to_s, "wb+") do |f|
35
+ f.write file_data
36
+ end
37
+ end
38
+ # 定义xlsx文件格式的头样式
39
+ def self.init_header_style
40
+ { height: 75, background_color: "458B00", color: "FFFFFF", align: :center, font_name: "Arial", font_size: 14, bold: false, italic: false, underline: false }
41
+ end
42
+
43
+ # 定义xlsx文件的row样式
44
+ def self.init_row_style
45
+ { font_size: 12, align: :left }
20
46
  end
21
47
  end
@@ -1,3 +1,3 @@
1
1
  module GetIssues
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.4"
3
3
  end
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.0
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - '807715333'
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-22 00:00:00.000000000 Z
11
+ date: 2021-08-23 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