gimp 0.0.1 → 0.0.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 +4 -4
- data/.gitignore +2 -0
- data/exe/gimp +38 -0
- data/gimp.gemspec +3 -0
- data/lib/gimp.rb +41 -1
- data/lib/gimp/version.rb +1 -1
- metadata +33 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2efc54d0ab69a86eb2e8044b7aa483471014cd39
|
4
|
+
data.tar.gz: 3813510a831fb99adc1ee7bcbb49c36c14eda671
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163112534431caf1ae915651794f1c892974093a913af39665ee19325314690aa23e3473c8c345c203b3e47f7ebc382c7268b8c23e84da8e463af3e8d19bbdec
|
7
|
+
data.tar.gz: 5d5b8d63d6e11c088b0a1450199027914346b510992f4bf7b224f4d3a8546aa5969284d7de057f1c5f1cbf263b4ed113c504ad3d6ece1b46923d4c789aff3619
|
data/.gitignore
CHANGED
data/exe/gimp
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'gimp'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = 'Usage: gimp [options]'
|
9
|
+
|
10
|
+
opts.on('-s', '--source SOURCE', 'Source repository') do |source|
|
11
|
+
options[:source] = source
|
12
|
+
end
|
13
|
+
opts.on('-d', '--destination DESTINATION', 'Destination repository') do |destination|
|
14
|
+
options[:destination] = destination
|
15
|
+
end
|
16
|
+
opts.on('-i', '--issues ISSUES', Array, 'Issue numbers') do |issues|
|
17
|
+
options[:issues] = issues
|
18
|
+
end
|
19
|
+
opts.on('-t', '--access-token ACCESS_TOKEN', 'GitHub access token') do |access_token|
|
20
|
+
options[:access_token] = access_token
|
21
|
+
end
|
22
|
+
opts.on('--exclude-labels [LABELS]', Array, 'Exclude labels', ' (exclude specific labels if LABELS supplied)') do |labels|
|
23
|
+
options[:exclude_labels] = labels
|
24
|
+
end
|
25
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
26
|
+
options[:verbose] = v
|
27
|
+
end
|
28
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
29
|
+
puts opts
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
end.parse!
|
33
|
+
|
34
|
+
mover = Gimp::Mover.new(options)
|
35
|
+
options[:issues].each do |id|
|
36
|
+
new_id = mover.move_issue(id)
|
37
|
+
puts "#{options[:source]}##{id} -> #{options[:destination]}##{new_id}"
|
38
|
+
end
|
data/gimp.gemspec
CHANGED
@@ -19,7 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.add_dependency "octokit", "~> 4.1"
|
23
|
+
|
22
24
|
spec.add_development_dependency "bundler", "~> 1.10"
|
23
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
26
|
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "gem-release"
|
25
28
|
end
|
data/lib/gimp.rb
CHANGED
@@ -1,5 +1,45 @@
|
|
1
|
+
require "octokit"
|
1
2
|
require "gimp/version"
|
2
3
|
|
3
4
|
module Gimp
|
4
|
-
|
5
|
+
class Mover
|
6
|
+
def initialize(options)
|
7
|
+
@client = Octokit::Client.new(access_token: options[:access_token])
|
8
|
+
@source = options[:source]
|
9
|
+
@destination = options[:destination]
|
10
|
+
@exclude_labels = options[:exclude_labels] || []
|
11
|
+
@known_labels = Set.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def move_issue(id)
|
15
|
+
issue = @client.issue(@source, id)
|
16
|
+
labels = @client.labels_for_issue(@source, id)
|
17
|
+
comments = @client.issue_comments(@source, id)
|
18
|
+
|
19
|
+
labels.each { |label| ensure_label(label) }
|
20
|
+
new_issue = @client.create_issue(@destination, issue.title, issue.body,
|
21
|
+
assignee: issue.assignee ? issue.assignee.login : nil,
|
22
|
+
labels: labels.map(&:name) - @exclude_labels)
|
23
|
+
@client.add_comment(@destination, new_issue.number, "*Issue migrated from #{@source}##{issue.number}*")
|
24
|
+
comments.each { |comment| @client.add_comment(@destination, new_issue.number, comment_text(comment)) }
|
25
|
+
|
26
|
+
@client.close_issue(@source, id)
|
27
|
+
new_issue.number
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def ensure_label(label)
|
33
|
+
return if @exclude_labels.include?(label.name) || @known_labels.include?(label.name)
|
34
|
+
@client.label(@destination, label.name)
|
35
|
+
@known_labels << label.name
|
36
|
+
rescue Octokit::NotFound
|
37
|
+
@client.add_label(@destination, label.name, label.color)
|
38
|
+
@known_labels << label.name
|
39
|
+
end
|
40
|
+
|
41
|
+
def comment_text(comment)
|
42
|
+
"*@#{comment.user.login} commented at #{comment.created_at}*\n\n---\n\n#{comment.body}"
|
43
|
+
end
|
44
|
+
end
|
5
45
|
end
|
data/lib/gimp/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Beech
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,10 +66,25 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gem-release
|
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'
|
55
83
|
description: Move issues between GitHub repos from the command line.
|
56
84
|
email:
|
57
85
|
- greg@gregbeech.com
|
58
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- gimp
|
59
88
|
extensions: []
|
60
89
|
extra_rdoc_files: []
|
61
90
|
files:
|
@@ -69,6 +98,7 @@ files:
|
|
69
98
|
- Rakefile
|
70
99
|
- bin/console
|
71
100
|
- bin/setup
|
101
|
+
- exe/gimp
|
72
102
|
- gimp.gemspec
|
73
103
|
- lib/gimp.rb
|
74
104
|
- lib/gimp/version.rb
|