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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 842a3ae347d1837cf8e6a04854450bce2fd24271
4
- data.tar.gz: 04d023df2c43678b1150cf91349a587a251d8f75
3
+ metadata.gz: de8e4152182d2b3c9a02255c64eb5d844715da08
4
+ data.tar.gz: b1214f41ecf1b744d4071939dd2e3aa5e405e733
5
5
  SHA512:
6
- metadata.gz: 8cea25d78d6c3eaa86786fd73f9f7542052c834367377ac5c27270f4d5c3d45a936e50b5b5c39f574094cb53cf0fe51ad077d1966cd98a21485fecc1cba89a67
7
- data.tar.gz: 09bafc5cc6b88982b7d39720bfc68809917185831ac73176154321e169ccaaee1cf4d7088a1d84520181239050c850203b72e5da37dfa30d0f1c957d3d90f3b6
6
+ metadata.gz: 5e515f9fd08a9ff5f606d24edc7726c6092176b9bf4227c0aa12e97f1fe6604b1a21beeb4c38713448abbe3d73a62c59aa6f44f1dc2593ddacf5088ce6653627
7
+ data.tar.gz: c1f2c043b166d126a54d4c8d9c57e58c633f200b6aecd7e3fbdc7cca09a81fdab18615bfb53e0653466e0a2fb40e176775bc725d3f77d67377ea30d578abb84a
data/README.md CHANGED
@@ -24,6 +24,8 @@ token: your-access-token
24
24
  source: gregbeech/test-1
25
25
  destination: gregbeech/test-2
26
26
  labels:
27
+ add:
28
+ - needs triage
27
29
  exclude:
28
30
  - help wanted
29
31
  - question
@@ -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 = filter_labels(@client.labels_for_issue(@source, id))
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 filter_labels(labels)
34
- return labels unless @exclude_labels
35
- return [] if @exclude_labels == true
36
- labels.reject { |label| @exclude_labels.include?(label.name) }
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Gimp
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Beech