githubissues-port 1.1 → 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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDM2NzI5Yzc4OGZhMTM2YjY3NDRhZWUxYjc5MDg5ZTU2YmNjM2JmYQ==
4
+ ZmQ1MzVlNDIwNmI2NWFjN2Q5YzBlODNiMDQ3ODU4MjIyNWVhOGMwNg==
5
5
  data.tar.gz: !binary |-
6
- ZjAzYTQ1YTM1NjY1MmNjYWRlOTQ1ZDFkZTZkNDY1ZGE2ZGM4Nzk5MA==
6
+ MTc1ZDgwNzEzN2M0ODI3ZDFhZmM2N2M3N2FhMmE3NGYzZjQ0M2E3MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Nzg5NjdlNzUwZTc5NzFkMjAxYTFlNGUyNWJkYzM4MzFmNzEyMDUxZjhkZDEw
10
- MjFkNzE1ZTUxZDM5NGNlMzA2YTE1NmZlZjg3ZTMyNjAxYmUyMTZhY2M4NmEw
11
- MDhhZWUxMmM2YTBjNTlhMWNhZTBkNDM3OTM4ODVkYjQ5NTI3OTA=
9
+ MTU3YWUyZGNiOTc2Mzc3ZDE4YzU2NWRjOTM3OTdmOTY4MDE1MDczMjYwMGIw
10
+ ZGUzMWQyYjE3ZTJkMmRkNGYxZDFkOGM5YjlhYWNhMTY1NDlmYWI5MjZjZjA4
11
+ ZGNkNmM4ZTMwMWMyZmM2NzA1ZmMxMWQzNzU3YjlhMmNmNzYwYTY=
12
12
  data.tar.gz: !binary |-
13
- OTVlM2RmMTM4NTEzMmUyNmVjZDk4YTMxZTkwN2Y4YTdiMWJkMzIwZDBlYjAw
14
- Yzg1YzliMzEyYzU4NmIwMmIzOGVjMjc5OGE1ZmM3MGY2N2U0YzljZTVmNjkw
15
- Y2YyMzZlNDJlMDk3MTg4ZjgwNjJkZDEzOThlZjZjMTcyZjA2NDk=
13
+ OTYxMDgxNTVlYWIxMDQ4OTVlYWE3MjFlNjkwYzZhNmM4NGNkMzE3ZDFmNmMx
14
+ N2ZmMjllNDYzNDRlM2JlMjUwMDg3Y2M1N2FmNWUyOGQ4ZDk3MjI0NThjNDZi
15
+ MGE5N2U1YjE3MjRhNmFjZGNlYjhhYjU1Y2U3YjExMDJkYzZkZTg=
@@ -1,4 +1,5 @@
1
- require "githubissues-port/version"
1
+ require "githubissues-port/string"
2
+ require "githubissues-port/array"
2
3
  require 'githubissues-port/export'
3
4
  require 'githubissues-port/import'
4
5
 
@@ -0,0 +1,5 @@
1
+ class Array
2
+ def filter_by_category cat
3
+ self.select{|i| i.category.eql? cat}
4
+ end
5
+ end
@@ -4,10 +4,11 @@ require 'axlsx'
4
4
  module Githubissues
5
5
  module Port
6
6
  class Githubissues::Port::Export
7
+
7
8
  attr_reader :connection, :owner, :repo, :path
8
9
 
9
10
  DEFAULT_FIELDS = %w(number title body labels assignee state milestone created_at closed_at comments labels comments_url events_url html_url labels_url type priority module status)
10
-
11
+
11
12
  def initialize connection, owner, repo, path, options = {}
12
13
  @path, @connection, @owner, @repo = path, connection, owner, repo
13
14
  @fields = (options.has_key? :fields) ? options[:fields] : DEFAULT_FIELDS
@@ -36,7 +37,6 @@ module Githubissues
36
37
 
37
38
  def generate_row issue
38
39
  labels = (issue.labels.nil?) ? [] : issue.labels.map{|l| l.name.downcase}
39
-
40
40
  @fields.collect do |field|
41
41
  case field.downcase
42
42
  when 'assignee'
@@ -50,13 +50,13 @@ module Githubissues
50
50
  when 'closed_at'
51
51
  DateTime.parse issue.closed_at unless issue.closed_at.nil?
52
52
  when 'type'
53
- labels.select{|l| (l =~ /type*/) or (%w(bug duplicate enhancement invalid question wontfix patch).include? l)}.join ', '
53
+ labels.filter_by_category('type').join ', '
54
54
  when 'priority'
55
- labels.select{|l| (l =~ /priority*/) or (%w(high medium low critical).include? l)}.join ', '
55
+ labels.filter_by_category('priority').join ', '
56
56
  when 'module'
57
- labels.select{|l| l =~ /module*/}.join ', '
57
+ labels.filter_by_category('module').join ', '
58
58
  when 'status'
59
- labels.select{|l| l =~ /status*/}.join ', '
59
+ labels.filter_by_category('status').join ', '
60
60
  else
61
61
  issue.send field
62
62
  end
@@ -0,0 +1,15 @@
1
+ class String
2
+ def category
3
+ if (self =~ /type*/) or (%w(bug duplicate enhancement invalid question wontfix patch).include? self)
4
+ 'type'
5
+ elsif (self =~ /priority*/) or (%w(high medium low critical).include? self)
6
+ 'priority'
7
+ elsif self =~ /module*/
8
+ 'module'
9
+ elsif self =~ /status*/
10
+ 'status'
11
+ else
12
+ 'module'
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Githubissues
2
2
  module Port
3
- VERSION = "1.1"
3
+ VERSION = "1.2"
4
4
  end
5
5
  end
@@ -4,10 +4,10 @@ require 'githubissues-port'
4
4
  describe 'githubissues-port exporting and importing to xlsx' do
5
5
  before(:all) do
6
6
  # Replace your test git repo credentials here:
7
- @github_username = '**********'
8
- @github_password = '**********'
9
- @owner = '**********'
10
- @repo = '**********'
7
+ @github_username = 'githubissues-port'
8
+ @github_password = 'Github123'
9
+ @owner = 'githubissues-port'
10
+ @repo = 'foo'
11
11
  @connection = Github.new basic_auth: "#{@github_username}:#{@github_password}"
12
12
  end
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githubissues-port
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramtin Vaziri
@@ -96,8 +96,10 @@ files:
96
96
  - Readme.md
97
97
  - githubissues-port.gemspec
98
98
  - lib/githubissues-port.rb
99
+ - lib/githubissues-port/array.rb
99
100
  - lib/githubissues-port/export.rb
100
101
  - lib/githubissues-port/import.rb
102
+ - lib/githubissues-port/string.rb
101
103
  - lib/githubissues-port/test_spec.rb
102
104
  - lib/githubissues-port/version.rb
103
105
  - spec/fixtures/sample.xlsx