gimp 0.1.0 → 0.1.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 +4 -4
- data/README.md +2 -0
- data/lib/gimp.rb +13 -7
- data/lib/gimp/options.rb +4 -0
- data/lib/gimp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de8e4152182d2b3c9a02255c64eb5d844715da08
|
4
|
+
data.tar.gz: b1214f41ecf1b744d4071939dd2e3aa5e405e733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e515f9fd08a9ff5f606d24edc7726c6092176b9bf4227c0aa12e97f1fe6604b1a21beeb4c38713448abbe3d73a62c59aa6f44f1dc2593ddacf5088ce6653627
|
7
|
+
data.tar.gz: c1f2c043b166d126a54d4c8d9c57e58c633f200b6aecd7e3fbdc7cca09a81fdab18615bfb53e0653466e0a2fb40e176775bc725d3f77d67377ea30d578abb84a
|
data/README.md
CHANGED
data/lib/gimp.rb
CHANGED
@@ -8,19 +8,18 @@ module Gimp
|
|
8
8
|
@options = options
|
9
9
|
@source = options.source
|
10
10
|
@destination = options.destination
|
11
|
-
@exclude_labels = options.labels.exclude if options.labels? && options.labels.exclude?
|
12
11
|
@known_labels = Set.new
|
13
12
|
end
|
14
13
|
|
15
14
|
def move_issue(id)
|
16
15
|
issue = @client.issue(@source, id)
|
17
|
-
labels =
|
16
|
+
labels = new_labels(@client.labels_for_issue(@source, id))
|
18
17
|
comments = @client.issue_comments(@source, id)
|
19
18
|
|
20
19
|
labels.each { |label| ensure_label(label) }
|
21
20
|
new_issue = @client.create_issue(@destination, issue.title, issue.body,
|
22
21
|
assignee: new_assignee(issue),
|
23
|
-
labels: labels.map(&:name))
|
22
|
+
labels: labels.map(&:name).uniq)
|
24
23
|
@client.add_comment(@destination, new_issue.number, "*Issue migrated from #{@source}##{issue.number}*")
|
25
24
|
comments.each { |comment| @client.add_comment(@destination, new_issue.number, comment_text(comment)) }
|
26
25
|
|
@@ -30,10 +29,17 @@ module Gimp
|
|
30
29
|
|
31
30
|
private
|
32
31
|
|
33
|
-
def
|
34
|
-
|
35
|
-
return
|
36
|
-
|
32
|
+
def new_labels(labels)
|
33
|
+
opts = @options.labels
|
34
|
+
return labels unless opts
|
35
|
+
|
36
|
+
labels = case opts.exclude
|
37
|
+
when nil then labels
|
38
|
+
when true then []
|
39
|
+
else labels.reject { |label| opts.exclude.include?(label.name) }
|
40
|
+
end
|
41
|
+
labels << opts.add.map { |name| Hashie::Mash.new(name: name, color: 'ffffff') } if opts.add?
|
42
|
+
labels.flatten
|
37
43
|
end
|
38
44
|
|
39
45
|
def ensure_label(label)
|
data/lib/gimp/options.rb
CHANGED
@@ -37,6 +37,10 @@ module Gimp
|
|
37
37
|
opts.on('-u', '--unassign', 'Do not copy the existing assignee') do
|
38
38
|
@options.unassign = true
|
39
39
|
end
|
40
|
+
opts.on('--add-labels LABELS', Array, 'Add labels') do |labels|
|
41
|
+
@options.labels ||= Hashie::Mash.new
|
42
|
+
@options.labels.add = labels
|
43
|
+
end
|
40
44
|
opts.on('--exclude-labels [LABELS]', Array, 'Exclude labels', ' (exclude specific labels if LABELS supplied)') do |labels|
|
41
45
|
@options.labels ||= Hashie::Mash.new
|
42
46
|
@options.labels.exclude = labels || true
|
data/lib/gimp/version.rb
CHANGED