ghissues 0.0.3
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 +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/bin/ghissues +79 -0
- data/example/multi_issues.yml +50 -0
- data/example/one_issue.yml +19 -0
- data/example/schema.yml +34 -0
- data/ghissues.gemspec +27 -0
- data/lib/ghissues.rb +5 -0
- data/lib/ghissues/ghissues.rb +43 -0
- data/lib/ghissues/version.rb +3 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c760c716e2b474ca480d7aade6631e0d6f6bd908
|
4
|
+
data.tar.gz: be3a8e68ccf18806b5e861e71061d88588f87fa9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 711c39503babf201e46c1c6d68e5b291f44f32c6757ba23f40c6e90149e4cafe8bc8852b4823ffbcf18e20fb6b35b035f3161160f846f55c11626acbecac7793
|
7
|
+
data.tar.gz: 7d2942860e6ce074bb8685494fcc3507c459b31986cd8408119f7186e1db3ef1cbdf52bfd51c5e8dd5fbb9cbc3b74af583a1fbf8540bbec1b419d95404967b76
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 いざわゆきみつ (Yukimitsu Izawa)
|
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.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Ghissues
|
2
|
+
|
3
|
+
Github issue registrator with Yaml data file.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Create gem file.
|
8
|
+
|
9
|
+
$ rake build
|
10
|
+
|
11
|
+
|
12
|
+
install it yourself as:
|
13
|
+
|
14
|
+
$ gem install pkg/ghissues-x.xx.gem
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
$ ghissues -f <yaml data file>
|
19
|
+
|
20
|
+
## YAML format
|
21
|
+
|
22
|
+
required: gh_user, gh_token, gh_repos, title
|
23
|
+
|
24
|
+
optional: times, body, milestone, labels, assignee
|
25
|
+
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it ( https://github.com/[my-github-username]/ghissues/fork )
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/ghissues
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'ghissues'
|
4
|
+
|
5
|
+
require 'erb'
|
6
|
+
require 'yaml'
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
Version = Ghissues::VERSION
|
10
|
+
|
11
|
+
# parsing options
|
12
|
+
begin
|
13
|
+
params = ARGV.getopts('f:')
|
14
|
+
rescue => e
|
15
|
+
puts e.to_s
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
|
19
|
+
unless params['f']
|
20
|
+
puts "-f required."
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
dataFile = params['f']
|
24
|
+
|
25
|
+
# check data file readable.
|
26
|
+
unless FileTest.readable?(dataFile)
|
27
|
+
puts "can\'t read #{dataFile}"
|
28
|
+
exit 1
|
29
|
+
end
|
30
|
+
|
31
|
+
# read from yaml data file.
|
32
|
+
issues = YAML.load_file(dataFile)
|
33
|
+
|
34
|
+
#values for erb replacement.
|
35
|
+
@times = issues['config']['times']
|
36
|
+
|
37
|
+
# config Ghissues.
|
38
|
+
config = {
|
39
|
+
:user => issues['config']['gh_user'],
|
40
|
+
:token => issues['config']['gh_token'],
|
41
|
+
:repo => issues['config']['gh_repos']
|
42
|
+
}
|
43
|
+
Ghissues::Ghissues.initialize(config)
|
44
|
+
|
45
|
+
# registry issues to github repos.
|
46
|
+
issues['data'].each do |issue|
|
47
|
+
title = ERB.new(issue['title']).result
|
48
|
+
|
49
|
+
if issue['body']
|
50
|
+
body = ERB.new(issue['body']).result
|
51
|
+
else
|
52
|
+
body = nil
|
53
|
+
end
|
54
|
+
|
55
|
+
option = { }
|
56
|
+
|
57
|
+
if issue['milestone']
|
58
|
+
option[:milestone] = Ghissues::Ghissues.milestoneText2number(ERB.new(issue['milestone']).result)
|
59
|
+
end
|
60
|
+
|
61
|
+
if issue['labels']
|
62
|
+
option[:labels] = ERB.new(issue['labels'].join(',')).result
|
63
|
+
end
|
64
|
+
|
65
|
+
if issue['assignee']
|
66
|
+
option[:assignee] = ERB.new(issue['assignee']).result
|
67
|
+
end
|
68
|
+
puts title
|
69
|
+
puts body
|
70
|
+
puts option.to_s
|
71
|
+
|
72
|
+
# create github issue.
|
73
|
+
begin
|
74
|
+
Octokit.create_issue(issues['config']['gh_repos'], title, body, option )
|
75
|
+
rescue => e
|
76
|
+
puts e.to_s
|
77
|
+
exit 1
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
config:
|
2
|
+
times: 21
|
3
|
+
gh_user: izawa
|
4
|
+
gh_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
5
|
+
gh_repos: izawa/kanazawarb.meetup
|
6
|
+
|
7
|
+
data:
|
8
|
+
- title: 第#<%= @times %>回meetup 施設予約をする
|
9
|
+
body: |
|
10
|
+
- [x] 施設予約アカウントを取得
|
11
|
+
- [ ] 希望日を予約
|
12
|
+
- [ ] 予約日をアナウンス
|
13
|
+
milestone: meetup <%= @times %> pre-process
|
14
|
+
|
15
|
+
- title: doorkeeperを立てる
|
16
|
+
milestone: meetup <%= @times %> pre-process
|
17
|
+
|
18
|
+
- title: 告知活動を行う(申し込み開始時 - 各種SNS)
|
19
|
+
milestone: meetup <%= @times %> pre-process
|
20
|
+
|
21
|
+
- title: 告知活動を行う(一週間前 - 各種SNS)
|
22
|
+
milestone: meetup <%= @times %> pre-process
|
23
|
+
|
24
|
+
- title: 告知活動を行う(前々日 - 各種SNS)
|
25
|
+
milestone: meetup <%= @times %> pre-process
|
26
|
+
|
27
|
+
- title: meettup<%= @times %>懇親会のお店を予約する
|
28
|
+
body: |
|
29
|
+
- [ ] お店の選定
|
30
|
+
- [ ] 予約の実施
|
31
|
+
milestone: meetup <%= @times %> pre-process
|
32
|
+
|
33
|
+
- title: ツイートまとめを作成する(togetter)
|
34
|
+
milestone: meetup <%= @times %> post-process
|
35
|
+
|
36
|
+
- title: ツイートまとめを告知する(各種SNS)
|
37
|
+
milestone: meetup <%= @times %> post-process
|
38
|
+
|
39
|
+
- title: 写真アルバムを作成する(30days)
|
40
|
+
milestone: meetup <%= @times %> post-process
|
41
|
+
|
42
|
+
- title: 写真アルバムを告知する(各種SNS)
|
43
|
+
milestone: meetup <%= @times %> post-process
|
44
|
+
|
45
|
+
- title: レポートページを作成する(github pages)
|
46
|
+
milestone: meetup <%= @times %> post-process
|
47
|
+
|
48
|
+
- title: レポートページを告知する(各種SNS)
|
49
|
+
milestone: meetup <%= @times %> post-process
|
50
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
config:
|
2
|
+
times: 21
|
3
|
+
gh_user: izawa
|
4
|
+
gh_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
5
|
+
gh_repos: izawa/kanazawarb.meetup
|
6
|
+
|
7
|
+
data:
|
8
|
+
- title: 第#<%= @times %>回meetup 施設予約をする
|
9
|
+
body: |
|
10
|
+
- [x] 施設予約アカウントを取得
|
11
|
+
- [ ] 希望日を予約
|
12
|
+
- [ ] 予約日をアナウンス
|
13
|
+
milestone: meetup <%= @times %> pre-process
|
14
|
+
labels:
|
15
|
+
- bug
|
16
|
+
- question
|
17
|
+
- help wanted
|
18
|
+
- some label
|
19
|
+
assignee: kiyohara
|
data/example/schema.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# ghissues data yaml schema for kwalify.
|
2
|
+
type: map
|
3
|
+
mapping:
|
4
|
+
"config":
|
5
|
+
required: yes
|
6
|
+
type: map
|
7
|
+
mapping:
|
8
|
+
"times":
|
9
|
+
type: text
|
10
|
+
"gh_user":
|
11
|
+
required: yes
|
12
|
+
"gh_token":
|
13
|
+
required: yes
|
14
|
+
"gh_repos":
|
15
|
+
required: yes
|
16
|
+
"data":
|
17
|
+
required: yes
|
18
|
+
type: seq
|
19
|
+
sequence:
|
20
|
+
- type: map
|
21
|
+
mapping:
|
22
|
+
"title":
|
23
|
+
required: yes
|
24
|
+
type: text
|
25
|
+
"body":
|
26
|
+
type: text
|
27
|
+
"milestone":
|
28
|
+
type: text
|
29
|
+
"labels":
|
30
|
+
type: seq
|
31
|
+
sequence:
|
32
|
+
- type: text
|
33
|
+
"assignee":
|
34
|
+
type: text
|
data/ghissues.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ghissues/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ghissues"
|
8
|
+
spec.version = Ghissues::VERSION
|
9
|
+
spec.authors = ["Izawa Yukimitsu"]
|
10
|
+
spec.email = ["izawa@izawa.org"]
|
11
|
+
spec.summary = %q{Auto issue registration program for Github.}
|
12
|
+
spec.description = %q{Auto issue registration program for Github.}
|
13
|
+
spec.homepage = ""
|
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_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 0"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "octokit", "~> 3"
|
25
|
+
end
|
26
|
+
|
27
|
+
# gem build ghissues.gemspec
|
data/lib/ghissues.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
|
3
|
+
module Ghissues
|
4
|
+
class Ghissues
|
5
|
+
@@milestones = []
|
6
|
+
@@config = { }
|
7
|
+
|
8
|
+
def self.initialize(config)
|
9
|
+
@@config = config
|
10
|
+
initialize_octokit(config[:user], config[:token])
|
11
|
+
fetchMilestones(config[:repo])
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.initialize_octokit(user, token)
|
15
|
+
Octokit.configure do |c|
|
16
|
+
c.login = user
|
17
|
+
c.access_token = token
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.fetchMilestones(repo)
|
22
|
+
@@milestones = Octokit.list_milestones(repo)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.milestoneText2number(str)
|
26
|
+
return nil unless str
|
27
|
+
if @@milestones.size > 0
|
28
|
+
match_array = @@milestones.select { |item| item[:title] == str }
|
29
|
+
if match_array.size > 0
|
30
|
+
return match_array[0][:number]
|
31
|
+
else
|
32
|
+
ret = Octokit.create_milestone(@@config[:repo], str)
|
33
|
+
fetchMilestones(@@config[:repo])
|
34
|
+
return ret[:number]
|
35
|
+
end
|
36
|
+
else
|
37
|
+
ret = Octokit.create_milestone(@@config[:repo], str)
|
38
|
+
fetchMilestones(@@config[:repo])
|
39
|
+
return ret[:number]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ghissues
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Izawa Yukimitsu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: octokit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
55
|
+
description: Auto issue registration program for Github.
|
56
|
+
email:
|
57
|
+
- izawa@izawa.org
|
58
|
+
executables:
|
59
|
+
- ghissues
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/ghissues
|
69
|
+
- example/multi_issues.yml
|
70
|
+
- example/one_issue.yml
|
71
|
+
- example/schema.yml
|
72
|
+
- ghissues.gemspec
|
73
|
+
- lib/ghissues.rb
|
74
|
+
- lib/ghissues/ghissues.rb
|
75
|
+
- lib/ghissues/version.rb
|
76
|
+
homepage: ''
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.4.5
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Auto issue registration program for Github.
|
100
|
+
test_files: []
|