backlog_jp-pj2json 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bb878e73ad4b878964d778b36298790d3b94aa85
4
+ data.tar.gz: f9d7371ca687b7a32f20cee82f691fa82ae624c4
5
+ SHA512:
6
+ metadata.gz: ff32816405f662890fcddc2fadb4c4e72e2c3a932e65630d9c95c44c88902073f184811ea4ae6fcf349265fa89df13b4ca8db0456ad5a0037bc8813cafaeef96
7
+ data.tar.gz: 487b31544945c6881ec73586be34e8c39d0f70bc35455a9973ec238ffff831ee56af893cb3a133a6b2b64ef861d56222f6e572e3ee5606aef991f44121470c6b
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ vendor
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in backlog_jp-pj2json.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 y13i
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.
@@ -0,0 +1,41 @@
1
+ # BacklogJp::Pj2json
2
+
3
+ Export Backlog.jp project project issues/comments to JSON.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'backlog_jp-pj2json'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install backlog_jp-pj2json
20
+
21
+ ## Usage
22
+
23
+ TODO: Write more usage instructions here
24
+
25
+ ```
26
+ Commands:
27
+ pj2json export --api-key=API_KEY --output=OUTPUT --project-key=PROJECT_KEY --space=SPACE # Export project issues/comments to JSON.
28
+ pj2json help [COMMAND] # Describe available commands or one specific command
29
+ pj2json version # Puts version.
30
+
31
+ Example:
32
+ pj2json export --space my-space --api-key xxxxxxxx --project-key MYPJ --output ./out.json
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/backlog_jp-pj2json/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'backlog_jp/pj2json/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "backlog_jp-pj2json"
8
+ spec.version = BacklogJp::Pj2JSON::VERSION
9
+ spec.authors = ["y13i"]
10
+ spec.email = ["email@y13i.com"]
11
+ spec.summary = %(Export Backlog.jp project to JSON.)
12
+ spec.description = %(Export Backlog.jp project issues/comments to JSON.)
13
+ spec.homepage = "https://github.com/y13i/backlog_jp-pj2json"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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.add_dependency "thor"
22
+ spec.add_dependency "backlog_jp", ">= 0.0.7"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "pry-coolline"
28
+ spec.add_development_dependency "awesome_print"
29
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "backlog_jp/pj2json"
3
+
4
+ BacklogJp::Pj2JSON::CLI.start ARGV
@@ -0,0 +1,2 @@
1
+ require "backlog_jp/pj2json/version"
2
+ require "backlog_jp/pj2json/cli"
@@ -0,0 +1,44 @@
1
+ require "thor"
2
+ require "backlog_jp"
3
+ require "json"
4
+
5
+ class BacklogJp::Pj2JSON::CLI < Thor
6
+ desc "version", "Puts version."
7
+ def version
8
+ puts BacklogJp::Pj2JSON::VERSION
9
+ end
10
+
11
+ desc "export", "Export project issues/comments to JSON."
12
+ method_option :space, required: true
13
+ method_option :api_key, required: true
14
+ method_option :project_key, required: true
15
+ method_option :output, required: true
16
+ def export
17
+ hash = {issues: []}
18
+
19
+ # Collect data
20
+ 1.upto Float::INFINITY do |issue_key|
21
+ begin
22
+ issue = client.get("issues/#{options.project_key}-#{issue_key}")
23
+ puts issue
24
+ comments = client.get("issues/#{options.project_key}-#{issue_key}/comments", count: 100)
25
+ puts comments
26
+ issue[:comments] = comments
27
+ hash[:issues] << issue
28
+ rescue BacklogJp::Client::APIException => exception
29
+ break if exception.message.include? "No Issue."
30
+ abort
31
+ end
32
+ end
33
+
34
+ File.open(options.output, "wb") do |file|
35
+ file.puts JSON.pretty_generate(hash)
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def client
42
+ @client ||= BacklogJp::Client.new space: options.space, api_key: options.api_key
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ module BacklogJp
2
+ module Pj2JSON
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: backlog_jp-pj2json
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - y13i
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
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: backlog_jp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.7
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-coolline
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: awesome_print
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Export Backlog.jp project issues/comments to JSON.
112
+ email:
113
+ - email@y13i.com
114
+ executables:
115
+ - pj2json
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - backlog_jp-pj2json.gemspec
125
+ - bin/pj2json
126
+ - lib/backlog_jp/pj2json.rb
127
+ - lib/backlog_jp/pj2json/cli.rb
128
+ - lib/backlog_jp/pj2json/version.rb
129
+ homepage: https://github.com/y13i/backlog_jp-pj2json
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.4.5
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Export Backlog.jp project to JSON.
153
+ test_files: []