githubissues-port 0.1

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGIyYWY1OTk1YzcyOTVlMWQxZmY0MzQ1MmYyN2NjODcyYjFiZWIzYg==
5
+ data.tar.gz: !binary |-
6
+ YjAxNDZlZjdkNjRiYmExM2RlZTM3M2Y4YzBiYTMwNDhjZmQ2YzVlNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZmEwM2Y1NGY5YzQ3NzcyOTE0NjQ3NGFhM2RlZmQ0OWFhYjlkNWNiZmE2YWJj
10
+ OGVhMDIwODE2OGI0ZGNhZDBlOWM2NmU5ZDVhZjU4N2M0ZmI1Nzk3ODEwYzg2
11
+ MGE4OTk3ZmZlZTU1Y2E5YmY5NzExYzdmNTZmMmU2Yzg4MTUxMDU=
12
+ data.tar.gz: !binary |-
13
+ MDcxYzFiYjg3MTY5NWZhZWEwOTU1MDIzMGU1N2U1NjUzZDI0MWUwZTBkYWIz
14
+ OWYyODhmZDZjOTEyNDU1MDQ2MzYyOGQ0ZGYxNWYwMDM4NzU4YTBjOTgzODRh
15
+ MTZjNDkyMjZiMDNjM2JhZDFmZjFjZGVkY2MzZGNjZTVmM2E3YTg=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in creek.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,57 @@
1
+ = githubissues-port-- An Excel import/export extension for github issues for Ruby
2
+
3
+ githubissues-port is a Ruby gem that facilittes easy import and export of Github Issues in Ruby and Ruyb on Rails.
4
+
5
+
6
+ == Installation
7
+
8
+ githubissues-port can be used from the command line or as part of a Ruby web framework. To install the gem using terminal, run the following command:
9
+
10
+ gem install githubissues-port
11
+
12
+ To use it in Rails, add this line to your Gemfile:
13
+
14
+ gem "githubissues-port"
15
+
16
+
17
+ == Basic Usage
18
+ githubissues-port can simply import or export issues from an Excel file.:
19
+
20
+ require 'githubissues-port'
21
+ require 'github_api'
22
+
23
+ your_github_username = '***********'
24
+ your_github_password = '***********'
25
+
26
+ owner = '***********'
27
+ repo = '***********'
28
+
29
+ connection = Github.new basic_auth: "#{your_github_username}:#{your_github_password}"
30
+
31
+ Githubissues::Port::Import.new connection, owner, repo, 'import.xlsx'
32
+
33
+ Githubissues::Port::Export.new connection, owner, repo, 'export.xlsx'
34
+
35
+ == Contributing
36
+
37
+ Contributions are welcomed. You can fork a repository, add your code changes to the forked branch, ensure all existing unit tests pass, create new unit tests cover your new changes and finally create a pull request.
38
+
39
+ After forking and then cloning the repository locally, install Bundler and then use it
40
+ to install the development gem dependecies:
41
+
42
+ gem install bundler
43
+ bundle install
44
+
45
+ Once this is complete, you should be able to run the test suite:
46
+
47
+ rake
48
+
49
+
50
+ == Bug Reporting
51
+
52
+ Please use the {Issues}[https://github.com/githubissues-port/githubissues-port/issues] page to report bugs or suggest new enhancements.
53
+
54
+
55
+ == License
56
+
57
+ Creek has been published under {MIT License}[https://github.com/githubissues-port/githubissues-port/blob/master/LICENSE.txt]
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ # If you want to make this the default task
7
+ task :default => :spec
data/export.xlsx ADDED
Binary file
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'githubissues-port/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "githubissues-port"
8
+ spec.version = Githubissues::Port::VERSION
9
+ spec.authors = ["pythonicrubyist", "ankit8898", "hemalijain"]
10
+ spec.email = ["pythonicrubyist@gmail.com"]
11
+ spec.description = %q{An Excel import/export extension for github issues in Ruby.}
12
+ 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.}
13
+ spec.homepage = "https://github.com/github-issues-port/githubissues-port"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '>= 1.9.2'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency 'rspec', '~> 2.13.0'
26
+
27
+ spec.add_dependency 'github_api'
28
+ spec.add_dependency 'axlsx'
29
+ spec.add_dependency 'creek'
30
+ end
@@ -0,0 +1,35 @@
1
+ require 'github_api'
2
+ require 'axlsx'
3
+
4
+ module Githubissues
5
+ module Port
6
+ class Githubissues::Port::Export
7
+ attr_reader :path
8
+ def initialize connection, owner, repo, path
9
+ @path = path
10
+ issues = connection.issues.list user: owner, repo: repo, filter: 'all', auto_pagination: true
11
+ Axlsx::Package.new do |p|
12
+ 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
+ s.add_row fields
15
+ issues.each do |i|
16
+ row = Array.new
17
+ fields.each do |f|
18
+ row.push case f
19
+ when 'assignee'
20
+ i.assignee.login unless i.assignee.nil?
21
+ when 'labels'
22
+ i.labels.map(&:name).join(', ') unless i.labels.nil?
23
+ else
24
+ i.send f
25
+ end
26
+ end unless issues.nil?
27
+ s.add_row row
28
+ end
29
+ end
30
+ p.serialize path
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,25 @@
1
+ require 'github_api'
2
+ require 'creek'
3
+
4
+ module Githubissues
5
+ module Port
6
+ class Githubissues::Port::Import
7
+ attr_reader :path, :messages
8
+ def initialize connection, owner, repo, path
9
+ creek = Creek::Book.new path, :check_file_extension => false
10
+ sheet= creek.sheets[0]
11
+ @messages = []
12
+ sheet.rows.each_with_index do |r, i|
13
+ next if i.eql? 0
14
+ number = r["A#{i+1}"]
15
+ break if number.nil?
16
+ label_string = r["D#{i+1}"]
17
+ labels = (label_string.nil?) ? [] : label_string.split(',')
18
+ issue = connection.issues.edit owner, repo, number, labels: labels
19
+ @messages.push "The label for issue ##{number} updated to #{labels.join(',')}."
20
+ end
21
+ @messages
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ module Githubissues
2
+ module Port
3
+ VERSION = "0.1"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require "githubissues-port/version"
2
+ require 'githubissues-port/export'
3
+ require 'githubissues-port/import'
4
+
5
+ module Githubissues
6
+ module Port
7
+ # Your code goes here...
8
+ end
9
+ end
Binary file
data/spec/test_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'githubissues-port'
2
+
3
+ describe 'githubissues-port exporting and importing to xlsx' do
4
+ before(:all) do
5
+ my_github_username = '***********'
6
+ my_github_password = '***********'
7
+ @connection = Github.new basic_auth: "#{my_github_username}:#{my_github_password}"
8
+ end
9
+
10
+ it 'export should be successfull.' do
11
+ export = Githubissues::Port::Export.new @connection, 'pythonicrubyist', 'test_issues', 'export.xlsx'
12
+ puts export.path
13
+ export.should_not be_nil
14
+ end
15
+
16
+ it 'import should be successfull.' do
17
+ import = Githubissues::Port::Import.new @connection, 'pythonicrubyist', 'test_issues', 'spec/fixtures/sample.xlsx'
18
+ puts import.messages.inspect
19
+ import.should_not be_nil
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: githubissues-port
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - pythonicrubyist
8
+ - ankit8898
9
+ - hemalijain
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2014-01-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: '1.3'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: rspec
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: 2.13.0
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 2.13.0
57
+ - !ruby/object:Gem::Dependency
58
+ name: github_api
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: axlsx
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: creek
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ description: An Excel import/export extension for github issues in Ruby.
100
+ email:
101
+ - pythonicrubyist@gmail.com
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - .gitignore
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.rdoc
110
+ - Rakefile
111
+ - export.xlsx
112
+ - githubissues-port.gemspec
113
+ - lib/githubissues-port.rb
114
+ - lib/githubissues-port/export.rb
115
+ - lib/githubissues-port/import.rb
116
+ - lib/githubissues-port/version.rb
117
+ - spec/fixtures/sample.xlsx
118
+ - spec/test_spec.rb
119
+ homepage: https://github.com/github-issues-port/githubissues-port
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: 1.9.2
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.2.0
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: github-issues-port is a Ruby gem that facilittes easy import and export of
143
+ Github Issues in Ruby and Ruyb on Rails.
144
+ test_files:
145
+ - spec/fixtures/sample.xlsx
146
+ - spec/test_spec.rb