sync_issues 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82d9d67cb3f9da0e3200ab9737d7cae2b0c96550
4
- data.tar.gz: eb111a82c59f1c2c3629f35cb4f349f1a7344b88
3
+ metadata.gz: e6ec2a1e421c8518f79623a00467957940783a15
4
+ data.tar.gz: 36447ea778835cca858463eeeec3e633b03c1ed0
5
5
  SHA512:
6
- metadata.gz: c6f42546b6a5c5267218785049b8125e4fc42babb260f87e35ddce7d82125c2c3e19bb7b03cf98ba4c74b647e421bd9c01d03eacec6eaad170371d5f7e1e16e1
7
- data.tar.gz: 64d9f73bd226f8466dd44d55bd1439c385dcc61a044e997d20512e202ab89177c78a7ff1c321a35c292de222e2c88337e53f357db5c9d154c2ee9a677ca98fb1
6
+ metadata.gz: fd6ca399baa4a34133cca84e434b129b07b9c9b9f478ae5d6f9b3d8c9a929a2267864a51625375471369c67dbdb0145d299f5f6a7f22d98ab041153894e2c562
7
+ data.tar.gz: 905384ce86b6e966b01b474750705d130d9379be3f01ef910e3567f964e390defeba6897f89e69225b0466fa37645e1200a7f75bcbc51106e892c9f1ec2db50a
@@ -16,9 +16,10 @@ module SyncIssues
16
16
  sync_issues --version
17
17
 
18
18
  Options:
19
- -u --update Only update existing issues.
20
- -h --help Output this help information.
21
- --version Output the sync_issues version (#{VERSION}).
19
+ -h --help Output this help information.
20
+ -u --update Only update existing issues.
21
+ --no-assignees Do not synchronize assignees.
22
+ --version Output the sync_issues version (#{VERSION}).
22
23
  DOC
23
24
 
24
25
  def initialize
@@ -45,6 +46,7 @@ module SyncIssues
45
46
 
46
47
  def handle_args(options)
47
48
  SyncIssues.synchronizer(options['DIRECTORY'], options['REPOSITORY'],
49
+ sync_assignees: !options['--no-assignees'],
48
50
  update_only: options['--update']).run
49
51
  @exit_status
50
52
  end
@@ -5,12 +5,13 @@ module SyncIssues
5
5
  class Comparison
6
6
  attr_reader :assignee, :changed, :content, :title
7
7
 
8
- def initialize(issue, github_issue)
8
+ def initialize(issue, github_issue, sync_assignee)
9
9
  @changed = []
10
10
  @assignee = github_issue.assignee && github_issue.assignee.login
11
11
  @content = github_issue.body
12
+ @sync_assignee = sync_assignee
12
13
  @title = github_issue.title
13
- compare(issue, github_issue)
14
+ compare(issue)
14
15
  end
15
16
 
16
17
  def changed?
@@ -19,8 +20,8 @@ module SyncIssues
19
20
 
20
21
  private
21
22
 
22
- def compare(issue, github_issue)
23
- unless issue.assignee == @assignee
23
+ def compare(issue)
24
+ if @sync_assignee && issue.assignee != @assignee
24
25
  @changed << 'assignee'
25
26
  @assignee = issue.assignee
26
27
  end
@@ -28,10 +29,9 @@ module SyncIssues
28
29
  @changed << 'title'
29
30
  @title = issue.new_title
30
31
  end
31
- unless content_matches?(issue.content, @content)
32
- @changed << 'body'
33
- @content = issue.content
34
- end
32
+ return if content_matches?(issue.content, @content)
33
+ @changed << 'body'
34
+ @content = issue.content
35
35
  end
36
36
 
37
37
  def content_matches?(first, second)
@@ -10,9 +10,11 @@ module SyncIssues
10
10
  @client.auto_paginate = true
11
11
  end
12
12
 
13
- def create_issue(repository, issue)
13
+ def create_issue(repository, issue, add_assignee)
14
+ kwargs = {}
15
+ kwargs[:assignee] = issue.assignee if add_assignee
14
16
  @client.create_issue(repository.full_name, issue.title, issue.content,
15
- assignee: issue.assignee)
17
+ **kwargs)
16
18
  end
17
19
 
18
20
  def issues(repository)
@@ -6,10 +6,12 @@ require 'English'
6
6
  module SyncIssues
7
7
  # Synchronizer is responsible for the actual synchronization.
8
8
  class Synchronizer
9
- def initialize(directory, repository_names, update_only: false)
9
+ def initialize(directory, repository_names, sync_assignees: true,
10
+ update_only: false)
10
11
  @github = SyncIssues.github
11
12
  @issues = issues(directory)
12
13
  @repositories = repositories(repository_names)
14
+ @sync_assignees = sync_assignees
13
15
  @update_only = update_only
14
16
  end
15
17
 
@@ -82,12 +84,12 @@ module SyncIssues
82
84
  puts "Skipping create issue: #{issue.title}"
83
85
  else
84
86
  puts "Adding issue: #{issue.title}"
85
- @github.create_issue(repository, issue)
87
+ @github.create_issue(repository, issue, @sync_assignees)
86
88
  end
87
89
  end
88
90
 
89
91
  def update_issue(repository, issue, github_issue)
90
- comparison = Comparison.new(issue, github_issue)
92
+ comparison = Comparison.new(issue, github_issue, @sync_assignees)
91
93
  return unless comparison.changed?
92
94
 
93
95
  changed = comparison.changed.join(', ')
@@ -1,4 +1,4 @@
1
1
  # SyncIssues
2
2
  module SyncIssues
3
- VERSION = '0.4.1'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sync_issues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Boe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt