githubissues-port 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 +8 -8
- data/export.xlsx +0 -0
- data/githubissues-port.gemspec +1 -1
- data/lib/githubissues-port/export.rb +4 -4
- data/lib/githubissues-port/import.rb +22 -8
- data/lib/githubissues-port/version.rb +1 -1
- data/spec/fixtures/sample.xlsx +0 -0
- data/spec/test_spec.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2RhOTg3NWJlMWUxNzc0MjhiZGFhOWZkZDBhNTExNmMxZDI4MTQ2OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjMwMzQxYTg4NGI0MTQxYzcwNjY5MDVjNDU1NjVmMDlhMzUyNTEyOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZmZGE3OWEwZTE3OTE3NDQ2MGFkNDE1NWI1MGFmOGE2Yzk2NjY5M2ZmN2U3
|
10
|
+
NjNmMjUzYzAyNTY3Y2E3NjBmNDQ5MTk1ZmViODZhNmIxMmM4MWI5MzRkMTRl
|
11
|
+
Y2I5YWViNjQ4Mjg0ZTkwNDhkOTQ4Njg5MGIyMTQxMDkwNGRjMWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDgxY2U1ZTJjZWNlMWU2OTg2ZDU0MTBkMDgwNmFjYWYzNmUzYjAyZGZhMmVk
|
14
|
+
NjI1NTllYzUxNDQ2NjE3ZDY4OGI5YjFlMmIwODEyZGVlZmE3N2E5MTMwMTUy
|
15
|
+
N2UzMTJlOGMwNTUyODk3OTMwZmVlMGY4MWY0YTZmZmM1Nzc0OWI=
|
data/export.xlsx
CHANGED
Binary file
|
data/githubissues-port.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'githubissues-port/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "githubissues-port"
|
8
8
|
spec.version = Githubissues::Port::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Ramtin Vaziri", "Ankit gupta", "Hemali Jain"]
|
10
10
|
spec.description = %q{An Excel import/export extension for github issues in Ruby.}
|
11
11
|
spec.summary = %q{github-issues-port is a Ruby gem that facilittes easy import and export of Github Issues in Ruby and Ruyb on Rails.}
|
12
12
|
spec.homepage = "https://github.com/github-issues-port/githubissues-port"
|
@@ -4,18 +4,18 @@ require 'axlsx'
|
|
4
4
|
module Githubissues
|
5
5
|
module Port
|
6
6
|
class Githubissues::Port::Export
|
7
|
-
attr_reader :path
|
8
|
-
def initialize connection, owner, repo, path
|
7
|
+
attr_reader :path, :fields
|
8
|
+
def initialize connection, owner, repo, path, options = {}
|
9
9
|
@path = path
|
10
|
+
fields = (options.has_key? :fields) ? options[:fields] : %w(number title body labels assignee state milestone created_at closed_at comments comments_url events_url html_url labels_url)
|
10
11
|
issues = connection.issues.list user: owner, repo: repo, filter: 'all', auto_pagination: true
|
11
12
|
Axlsx::Package.new do |p|
|
12
13
|
p.workbook.add_worksheet(:name => @repo) do |s|
|
13
|
-
fields = %w(number title body labels assignee state milestone created_at closed_at comments comments_url events_url html_url labels_url)
|
14
14
|
s.add_row fields
|
15
15
|
issues.each do |i|
|
16
16
|
row = Array.new
|
17
17
|
fields.each do |f|
|
18
|
-
row.push case f
|
18
|
+
row.push case f.downcase
|
19
19
|
when 'assignee'
|
20
20
|
i.assignee.login unless i.assignee.nil?
|
21
21
|
when 'labels'
|
@@ -5,18 +5,32 @@ module Githubissues
|
|
5
5
|
module Port
|
6
6
|
class Githubissues::Port::Import
|
7
7
|
attr_reader :path, :messages
|
8
|
-
def initialize connection, owner, repo, path
|
8
|
+
def initialize connection, owner, repo, path, options = {}
|
9
|
+
@path = path
|
10
|
+
fields = (options.has_key? :fields) ? options[:fields] : %w(labels)
|
9
11
|
creek = Creek::Book.new path, :check_file_extension => false
|
10
12
|
sheet= creek.sheets[0]
|
11
13
|
@messages = []
|
12
14
|
sheet.rows.each_with_index do |r, i|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
case i
|
16
|
+
when 0
|
17
|
+
@header = r.invert
|
18
|
+
else
|
19
|
+
number = r["A#{i+1}"]
|
20
|
+
updates = {}
|
21
|
+
break if number.nil?
|
22
|
+
|
23
|
+
fields.each do |f|
|
24
|
+
if @header.has_key? f
|
25
|
+
value = r[@header[f].gsub '1', (i+1).to_s]
|
26
|
+
value = value.split(',').map(&:strip) if f.downcase.eql?'labels' and (!value.nil?)
|
27
|
+
updates[f.downcase] = value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
issue = connection.issues.edit owner, repo, number, updates
|
32
|
+
@messages.push "Issue ##{number} updated: #{updates.inspect}"
|
33
|
+
end
|
20
34
|
end
|
21
35
|
@messages
|
22
36
|
end
|
data/spec/fixtures/sample.xlsx
CHANGED
Binary file
|
data/spec/test_spec.rb
CHANGED
@@ -2,19 +2,19 @@ require 'githubissues-port'
|
|
2
2
|
|
3
3
|
describe 'githubissues-port exporting and importing to xlsx' do
|
4
4
|
before(:all) do
|
5
|
-
my_github_username = '
|
6
|
-
my_github_password = '
|
5
|
+
my_github_username = '*********'
|
6
|
+
my_github_password = '*********'
|
7
7
|
@connection = Github.new basic_auth: "#{my_github_username}:#{my_github_password}"
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'export should be successfull.' do
|
11
|
-
export = Githubissues::Port::Export.new @connection, 'pythonicrubyist', 'test_issues', 'export.xlsx'
|
11
|
+
export = Githubissues::Port::Export.new @connection, 'pythonicrubyist', 'test_issues', 'export.xlsx', fields: ['number', 'title', 'body', 'labels']
|
12
12
|
puts export.path
|
13
13
|
export.should_not be_nil
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'import should be successfull.' do
|
17
|
-
import = Githubissues::Port::Import.new @connection, 'pythonicrubyist', 'test_issues', 'spec/fixtures/sample.xlsx'
|
17
|
+
import = Githubissues::Port::Import.new @connection, 'pythonicrubyist', 'test_issues', 'spec/fixtures/sample.xlsx', fields: ['labels']
|
18
18
|
puts import.messages.inspect
|
19
19
|
import.should_not be_nil
|
20
20
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githubissues-port
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
7
|
+
- Ramtin Vaziri
|
8
|
+
- Ankit gupta
|
9
|
+
- Hemali Jain
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|