githubcsv 0.1.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 +15 -0
- data/lib/githubcsv/githubcsv.rb +126 -0
- data/lib/githubcsv.rb +2 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTczZTRiMWRjMTVmODNkNTg2OTYyMzY5ZTY5MDgyMTg3Y2Y1OWRlNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzhjY2FhODQ4N2M4M2IwYWM2MzMxODI3ZTg4MjIxZmMwODMyODU3YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzI4MjNjNzkxOWYxYmI4M2IwZDEwNWQxOTU0ZGQ0NzhmYTRiMTU3ZDk2MzBl
|
10
|
+
NTg5Y2ZmOTZjNTkzYmQxZmI5NzVmNTdiYTg0MzZiYTA0MDcyMGI0NWNhN2Y2
|
11
|
+
OTgxNmU0NzRlNTI4OTlkMDI2ODFjMWRkYzM5M2Y0MDM5OTcyZmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZGY4MWVlNTFlZGU2ODcxMTM5MDNhYTU1NjE3N2Y3NjczYTgzZWJiM2I2Mzli
|
14
|
+
NDMzZDBiMDBlZDZmZDIwOThiNzQzODRiZDJhZmMxNmU2Njg4MGQ0ZGJkNTgx
|
15
|
+
YzYxMjFhNWYzZTE5ZTY4YjliMDJlYjc1YjI1ZWEyZWNkMjJlZmU=
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
require 'csv'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module GitHubCSV
|
6
|
+
|
7
|
+
#current uid and password
|
8
|
+
@USERID
|
9
|
+
@PASSWORD
|
10
|
+
@USER
|
11
|
+
@PROJECT
|
12
|
+
@TIMEZONE_OFFSET
|
13
|
+
@VERBOSE
|
14
|
+
|
15
|
+
def self.initialize(curr_username, curr_password, from_username, from_project, timezone)
|
16
|
+
@USERID = curr_username
|
17
|
+
@PASSWORD = curr_password
|
18
|
+
|
19
|
+
@USER = from_username
|
20
|
+
@PROJECT = from_project
|
21
|
+
@TIMEZONE_OFFSET = timezone
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.run(is_verbose)
|
25
|
+
Octokit.configure do |c|
|
26
|
+
c.connection_options = { ssl: { verify: false } }
|
27
|
+
end
|
28
|
+
@VERBOSE = is_verbose
|
29
|
+
|
30
|
+
client = Octokit::Client.new(:login => @USERID, :password => @PASSWORD)
|
31
|
+
csv = CSV.new(File.open(File.dirname(__FILE__) + "/issues.csv", 'w'))
|
32
|
+
|
33
|
+
if @VERBOSE == 1
|
34
|
+
puts "Initializing CSV file..."
|
35
|
+
end
|
36
|
+
|
37
|
+
#CSV Headers
|
38
|
+
header = [
|
39
|
+
"Summary",
|
40
|
+
"Description",
|
41
|
+
"Date created",
|
42
|
+
"Date modified",
|
43
|
+
"Issue type",
|
44
|
+
"Milestone",
|
45
|
+
"Priority",
|
46
|
+
"Status",
|
47
|
+
"Reporter"
|
48
|
+
]
|
49
|
+
|
50
|
+
csv << header
|
51
|
+
|
52
|
+
if @VERBOSE == 1
|
53
|
+
puts "Downloading GitHub issues..."
|
54
|
+
end
|
55
|
+
|
56
|
+
temp_issues = []
|
57
|
+
issues = []
|
58
|
+
page = 0
|
59
|
+
|
60
|
+
begin
|
61
|
+
page = page +1
|
62
|
+
temp_issues = client.list_issues("#{@USER}/#{@PROJECT}", :state => "closed", :page => page)
|
63
|
+
issues = issues + temp_issues;
|
64
|
+
end while not temp_issues.empty?
|
65
|
+
|
66
|
+
temp_issues = []
|
67
|
+
page = 0
|
68
|
+
|
69
|
+
begin
|
70
|
+
page = page +1
|
71
|
+
temp_issues = client.list_issues("#{@USER}/#{@PROJECT}", :state => "open", :page => page)
|
72
|
+
issues = issues + temp_issues;
|
73
|
+
end while not temp_issues.empty?
|
74
|
+
|
75
|
+
if @VERBOSE == 1
|
76
|
+
puts "Processing #{issues.size} issues..."
|
77
|
+
end
|
78
|
+
|
79
|
+
issues.each do |issue|
|
80
|
+
|
81
|
+
if @VERBOSE == 1
|
82
|
+
puts "Processing issue #{issue['number']}..."
|
83
|
+
end
|
84
|
+
|
85
|
+
#type matching
|
86
|
+
case
|
87
|
+
when issue['labels'].to_s =~ /Bug/i
|
88
|
+
type = "Bug"
|
89
|
+
when issue['labels'].to_s =~ /Feature/i
|
90
|
+
type = "Feature"
|
91
|
+
when issue['labels'].to_s =~ /Task/i
|
92
|
+
type = "Task"
|
93
|
+
end
|
94
|
+
|
95
|
+
#priority matching
|
96
|
+
case
|
97
|
+
when issue['labels'].to_s =~ /HIGH/i
|
98
|
+
priority = "Critical"
|
99
|
+
when issue['labels'].to_s =~ /MEDIUM/i
|
100
|
+
priority = "Major"
|
101
|
+
when issue['labels'].to_s =~ /LOW/i
|
102
|
+
priority = "Minor"
|
103
|
+
end
|
104
|
+
milestone = issue['milestone'] || "None"
|
105
|
+
if (milestone != "None")
|
106
|
+
milestone = milestone['title']
|
107
|
+
end
|
108
|
+
|
109
|
+
#get time and parse it for each issue
|
110
|
+
row = [
|
111
|
+
issue['title'],
|
112
|
+
issue['body'],
|
113
|
+
#DateTime.parse(issue['created_at']).new_offset(TIMEZONE_OFFSET).strftime("%d/%b/%y %l:%M %p"),
|
114
|
+
#DateTime.parse(issue['updated_at']).new_offset(TIMEZONE_OFFSET).strftime("%d/%b/%y %l:%M %p"),
|
115
|
+
"this feature is broken as of gem v0.1.0",
|
116
|
+
"this feature is broken as of gem v0.1.0",
|
117
|
+
type,
|
118
|
+
milestone,
|
119
|
+
priority,
|
120
|
+
issue['state'],
|
121
|
+
issue['user']['login']
|
122
|
+
]
|
123
|
+
csv << row
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
data/lib/githubcsv.rb
ADDED
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: githubcsv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- manan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: octokit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
description: ! 'Parses GitHub repository issues and outputs them as a CSV file. '
|
42
|
+
email: manan.shah.777@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/githubcsv.rb
|
48
|
+
- lib/githubcsv/githubcsv.rb
|
49
|
+
homepage:
|
50
|
+
licenses:
|
51
|
+
- Apache
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.9.0
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.3.0
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Utility to convert GitHub issues to a CSV readable format
|
73
|
+
test_files: []
|