gimp 0.0.2 → 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 +4 -4
- data/.gitignore +1 -0
- data/README.md +24 -13
- data/exe/gimp +26 -13
- data/gimp.gemspec +2 -1
- data/lib/gimp.rb +13 -7
- data/lib/gimp/version.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bc0d185e1b6939980f3b6501584bde1e06d7fa7
|
4
|
+
data.tar.gz: 6280311aa24f27075437ca359e7efbce4f3f120c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edb2a87d60f34229c3d8fd49cb9fbbdf3d75eca74c087b62cd5860419496df0e8e324aa73f731ad07fb5513de12d780487bbf05308104f0e0ea6fda6691773d3
|
7
|
+
data.tar.gz: 1d42802ce61c3e666ad4073dfb15d338b2134a91277283db5a93ca2a72f9d6c5e2e9ea3a622de45a0feea481ee985bd47cc7e6c2217f854f49ad5ed0994653d7
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,39 @@
|
|
1
1
|
# Gimp
|
2
2
|
|
3
|
-
|
3
|
+
Move issues between GitHub repositories.
|
4
4
|
|
5
|
-
|
5
|
+
## Usage
|
6
6
|
|
7
|
-
|
7
|
+
$ gem install gimp
|
8
|
+
$ gimp --help
|
8
9
|
|
9
|
-
|
10
|
+
Authentication uses GitHub access tokens, go to *Edit profile > Personal access tokens* and click *Generate new token*. The default permissions are fine.
|
10
11
|
|
11
|
-
|
12
|
-
gem 'gimp'
|
13
|
-
```
|
12
|
+
Example usage:
|
14
13
|
|
15
|
-
|
14
|
+
$ gimp --token your-access-token --source gregbeech/test-1 --destination gregbeech/test-2 --exclude-labels 'help wanted',question --issues 23,47
|
16
15
|
|
17
|
-
|
16
|
+
Or, more concisely:
|
18
17
|
|
19
|
-
|
18
|
+
$ gimp -t your-access-token -s gregbeech/test-1 -d gregbeech/test-2 --exclude-labels 'help wanted',question -i 23,47
|
20
19
|
|
21
|
-
|
20
|
+
You can set defaults for all command line options in a `.gimp` file, for example:
|
22
21
|
|
23
|
-
|
22
|
+
```yaml
|
23
|
+
token: your-access-token
|
24
|
+
source: gregbeech/test-1
|
25
|
+
destination: gregbeech/test-2
|
26
|
+
labels:
|
27
|
+
exclude:
|
28
|
+
- help wanted
|
29
|
+
- question
|
30
|
+
```
|
31
|
+
|
32
|
+
Which lets you run the above command by just specifying the issue numbers; much handier if you're typically moving between the same two repos.
|
33
|
+
|
34
|
+
$ gimp -i 23,47
|
24
35
|
|
25
|
-
|
36
|
+
Remember to add an entry for `.gimp` to your `.gitignore` file so you don't commit your access token to the repo.
|
26
37
|
|
27
38
|
## Development
|
28
39
|
|
data/exe/gimp
CHANGED
@@ -2,37 +2,50 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'gimp'
|
5
|
+
require 'yaml'
|
6
|
+
require 'hashie/mash'
|
5
7
|
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
+
options = Hashie::Mash.new(File.exist?('.gimp') ? YAML.load_file('.gimp') : {})
|
9
|
+
opts = OptionParser.new do |opts|
|
8
10
|
opts.banner = 'Usage: gimp [options]'
|
9
11
|
|
12
|
+
opts.on('-t', '--token ACCESS_TOKEN', 'GitHub access token') do |access_token|
|
13
|
+
options.access_token = access_token
|
14
|
+
end
|
10
15
|
opts.on('-s', '--source SOURCE', 'Source repository') do |source|
|
11
|
-
options
|
16
|
+
options.source = source
|
12
17
|
end
|
13
18
|
opts.on('-d', '--destination DESTINATION', 'Destination repository') do |destination|
|
14
|
-
options
|
19
|
+
options.destination = destination
|
15
20
|
end
|
16
21
|
opts.on('-i', '--issues ISSUES', Array, 'Issue numbers') do |issues|
|
17
|
-
options
|
18
|
-
end
|
19
|
-
opts.on('-t', '--access-token ACCESS_TOKEN', 'GitHub access token') do |access_token|
|
20
|
-
options[:access_token] = access_token
|
22
|
+
options.issues = issues
|
21
23
|
end
|
22
24
|
opts.on('--exclude-labels [LABELS]', Array, 'Exclude labels', ' (exclude specific labels if LABELS supplied)') do |labels|
|
23
|
-
options
|
25
|
+
options.labels ||= Hashie::Mash.new
|
26
|
+
options.labels.exclude = labels || true
|
24
27
|
end
|
25
28
|
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
26
|
-
options
|
29
|
+
options.verbose = v
|
27
30
|
end
|
28
31
|
opts.on_tail("-h", "--help", "Show this message") do
|
29
32
|
puts opts
|
30
33
|
exit
|
31
34
|
end
|
32
|
-
|
35
|
+
opts.on_tail("--version", "Show version") do
|
36
|
+
puts Gimp::VERSION
|
37
|
+
exit
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.parse!
|
42
|
+
unless options.token? && options.source? && options.destination? && options.issues?
|
43
|
+
puts opts
|
44
|
+
exit
|
45
|
+
end
|
33
46
|
|
34
47
|
mover = Gimp::Mover.new(options)
|
35
|
-
options
|
48
|
+
options.issues.each do |id|
|
36
49
|
new_id = mover.move_issue(id)
|
37
|
-
puts "#{options
|
50
|
+
puts "#{options.source}##{id} -> #{options.destination}##{new_id}"
|
38
51
|
end
|
data/gimp.gemspec
CHANGED
@@ -20,9 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_dependency "octokit", "~> 4.1"
|
23
|
+
spec.add_dependency "hashie", "~> 3.4"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.10"
|
25
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
-
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.3"
|
27
28
|
spec.add_development_dependency "gem-release"
|
28
29
|
end
|
data/lib/gimp.rb
CHANGED
@@ -4,22 +4,22 @@ require "gimp/version"
|
|
4
4
|
module Gimp
|
5
5
|
class Mover
|
6
6
|
def initialize(options)
|
7
|
-
@client = Octokit::Client.new(access_token: options
|
8
|
-
@source = options
|
9
|
-
@destination = options
|
10
|
-
@exclude_labels = options
|
7
|
+
@client = Octokit::Client.new(access_token: options.token)
|
8
|
+
@source = options.source
|
9
|
+
@destination = options.destination
|
10
|
+
@exclude_labels = options.labels.exclude if options.labels? && options.labels.exclude?
|
11
11
|
@known_labels = Set.new
|
12
12
|
end
|
13
13
|
|
14
14
|
def move_issue(id)
|
15
15
|
issue = @client.issue(@source, id)
|
16
|
-
labels = @client.labels_for_issue(@source, id)
|
16
|
+
labels = filter_labels(@client.labels_for_issue(@source, id))
|
17
17
|
comments = @client.issue_comments(@source, id)
|
18
18
|
|
19
19
|
labels.each { |label| ensure_label(label) }
|
20
20
|
new_issue = @client.create_issue(@destination, issue.title, issue.body,
|
21
21
|
assignee: issue.assignee ? issue.assignee.login : nil,
|
22
|
-
labels: labels.map(&:name)
|
22
|
+
labels: labels.map(&:name))
|
23
23
|
@client.add_comment(@destination, new_issue.number, "*Issue migrated from #{@source}##{issue.number}*")
|
24
24
|
comments.each { |comment| @client.add_comment(@destination, new_issue.number, comment_text(comment)) }
|
25
25
|
|
@@ -29,8 +29,14 @@ module Gimp
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
+
def filter_labels(labels)
|
33
|
+
return labels unless @exclude_labels
|
34
|
+
return [] if @exclude_labels == true
|
35
|
+
labels.reject { |label| @exclude_labels.include?(label.name) }
|
36
|
+
end
|
37
|
+
|
32
38
|
def ensure_label(label)
|
33
|
-
return if @
|
39
|
+
return if @known_labels.include?(label.name)
|
34
40
|
@client.label(@destination, label.name)
|
35
41
|
@known_labels << label.name
|
36
42
|
rescue Octokit::NotFound
|
data/lib/gimp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Beech
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hashie
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.4'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +70,16 @@ dependencies:
|
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '3.3'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '3.3'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: gem-release
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|