get_issues 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34661abc538a1adc4907e7eb2e312f8f2e5b6f1b7971ed424dee266ff80c3737
4
- data.tar.gz: 63171b876881280829529ac9efe650ead817b0658f8588561c1b3c38d01c857a
3
+ metadata.gz: c647790e195bc2bf3094c7ee73839692f4f2bf67f538c3e20b35dd495a2f1360
4
+ data.tar.gz: ee006ee93851277ecf3f6c92126a6d6bfb2f4afec3c4a15775d875b312fa40e2
5
5
  SHA512:
6
- metadata.gz: e3a17ffd858660f8f32b3dc6dbee700df48cec0637e1431a75d90d2346f274754b53f7455037767f38ab5d77277cedb86f97ada52a72a291af4f23fe056c5989
7
- data.tar.gz: 108950b36ddff39ecb35c830141419803991ebaa9e38b5ad953f68118b88a5d528a20083ff2bcc65b5240fa69a608f4f5059c32f0cf33644c1e41a0c93fd8594
6
+ metadata.gz: 72fef0227a84cb21832358b28bac2c0837b1c25828da2be79f7fd4f5fd7f09f527260250bd4e2d276138516c46a590daf752c619c743bfe381fcd136e2719bd4
7
+ data.tar.gz: 7837421247d2ee2070ee605c32e459160e82f7835d5a24e13045edcc4b0a5ce98e889e98cff51ea8da59b39b16804ff7bbe11efd911916693f9028164a62fb60
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
@@ -6,10 +6,51 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ activesupport (6.1.4.1)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 1.6, < 2)
12
+ minitest (>= 5.1)
13
+ tzinfo (~> 2.0)
14
+ zeitwerk (~> 2.3)
15
+ axlsx_styler (1.1.0)
16
+ activesupport (>= 3.1)
17
+ caxlsx (>= 2.0.2)
18
+ builder (3.2.4)
19
+ caxlsx (3.1.0)
20
+ htmlentities (~> 4.3, >= 4.3.4)
21
+ marcel (~> 1.0)
22
+ nokogiri (~> 1.10, >= 1.10.4)
23
+ rubyzip (>= 1.3.0, < 3)
24
+ concurrent-ruby (1.1.9)
25
+ dry-inflector (0.2.1)
26
+ htmlentities (4.3.4)
27
+ i18n (1.8.10)
28
+ concurrent-ruby (~> 1.0)
29
+ marcel (1.0.1)
30
+ mini_portile2 (2.6.1)
9
31
  minitest (5.14.4)
32
+ nokogiri (1.12.3)
33
+ mini_portile2 (~> 2.6.1)
34
+ racc (~> 1.4)
35
+ nokogiri (1.12.3-x64-mingw32)
36
+ racc (~> 1.4)
37
+ racc (1.5.2)
10
38
  rake (10.5.0)
39
+ rodf (1.1.1)
40
+ builder (>= 3.0)
41
+ dry-inflector (~> 0.1)
42
+ rubyzip (>= 1.0)
43
+ rubyzip (2.3.2)
44
+ spreadsheet_architect (4.2.0)
45
+ axlsx_styler (>= 1.0.0, < 2)
46
+ caxlsx (>= 2.0.2, < 4)
47
+ rodf (>= 1.0.0, < 2)
48
+ tzinfo (2.0.4)
49
+ concurrent-ruby (~> 1.0)
50
+ zeitwerk (2.4.2)
11
51
 
12
52
  PLATFORMS
53
+ ruby
13
54
  x64-mingw32
14
55
 
15
56
  DEPENDENCIES
@@ -17,6 +58,7 @@ DEPENDENCIES
17
58
  get_issues!
18
59
  minitest (~> 5.0)
19
60
  rake (~> 10.0)
61
+ spreadsheet_architect
20
62
 
21
63
  BUNDLED WITH
22
64
  1.17.2
data/lib/get_issues.rb CHANGED
@@ -1,22 +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,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"]==mile_stone_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
18
  issues_string = `curl --header "PRIVATE-TOKEN: #{private_token}" "#{prefix_url}/#{project_id}/milestones/#{mile_stone_id}/issues"`
19
19
  issues_json = JSON.parse(issues_string)
20
20
  issues_json
21
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 }
46
+ end
22
47
  end
@@ -1,3 +1,3 @@
1
1
  module GetIssues
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
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.1
4
+ version: 0.1.2
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