hustle_and_flow 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +192 -16
  3. data/bin/hustle +4 -0
  4. data/lib/hustle_and_flow/binary/runner.rb +8 -4
  5. data/lib/hustle_and_flow/commands/start.rb +18 -19
  6. data/lib/hustle_and_flow/issue_tracker.rb +7 -6
  7. data/lib/hustle_and_flow/issue_trackers/commands/start.rb +17 -0
  8. data/lib/hustle_and_flow/issue_trackers/github/commands/start.rb +99 -0
  9. data/lib/hustle_and_flow/issue_trackers/github/issue.rb +8 -8
  10. data/lib/hustle_and_flow/issue_trackers/github/issues.rb +24 -46
  11. data/lib/hustle_and_flow/issue_trackers/github/tracker.rb +63 -0
  12. data/lib/hustle_and_flow/version.rb +1 -1
  13. data/lib/hustle_and_flow/version_control.rb +19 -0
  14. data/lib/hustle_and_flow/version_controls/commands/start.rb +17 -0
  15. data/lib/hustle_and_flow/{version_control → version_controls}/git/branch.rb +1 -1
  16. data/lib/hustle_and_flow/{version_control → version_controls}/git/branches.rb +8 -2
  17. data/lib/hustle_and_flow/version_controls/git/commands/start.rb +67 -0
  18. data/lib/hustle_and_flow/version_controls/git/repository.rb +70 -0
  19. data/spec/lib/hustle_and_flow/issue_trackers/github/issue_spec.rb +3 -3
  20. data/spec/lib/hustle_and_flow/issue_trackers/github/issues_spec.rb +3 -3
  21. data/spec/lib/hustle_and_flow/issue_trackers/{github_spec.rb → github/tracker_spec.rb} +6 -4
  22. data/spec/lib/hustle_and_flow/vcs_repository_spec.rb +3 -3
  23. data/spec/lib/hustle_and_flow/{version_control → version_controls}/git/branch_spec.rb +2 -2
  24. data/spec/lib/hustle_and_flow/{version_control → version_controls}/git/branches_spec.rb +2 -2
  25. data/spec/lib/hustle_and_flow/{version_control → version_controls}/git/repository_spec.rb +2 -2
  26. data/spec/support/git_repo.rb +4 -4
  27. metadata +20 -16
  28. data/lib/hustle_and_flow/issue_trackers/github.rb +0 -71
  29. data/lib/hustle_and_flow/vcs_repository.rb +0 -19
  30. data/lib/hustle_and_flow/version_control/git/repository.rb +0 -99
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09c8b0e8909c7e772f202f9c4a8d5d51ef65423b
4
- data.tar.gz: 29362f1b7e998396294e1925c69d939ba66dc2a2
3
+ metadata.gz: 4e0388db2dcb3bd47c54a5e03da9956cf4b7a85f
4
+ data.tar.gz: 4a59058b00ec6581f3cd0fc33bb8b6c0bb0fec09
5
5
  SHA512:
6
- metadata.gz: 623381f2772547914f6a2c26604542131eeec13d0c82351b0cd17e4bec7ba5c592ea646f0584f9cfb2032bda48ba839bb2f96d59ce435f2c1924f593ce4f95ba
7
- data.tar.gz: 2f3f3906195c4043b503ab2939c8cc0625effb86badebf5c781a1cd6e928a5632bd18bb96ca0f1448f6aa062aadfca8c818811bb6d69bb24675b54a121a3e3fd
6
+ metadata.gz: 48892f977a6e1a681caf40921f84c0761f9b8ec4de97b1715eefd95fe571c1aeb9b699334d408f48c33073bcd58b4ccb8fe73bfd4ab8b621e9f085d9fa8293cc
7
+ data.tar.gz: 0ea72b1ccb1cd67a9935b842eab8187cc5a61fa6caca0006b7801a9ac8badd65100a9d50922acafdf7e922f8d38dd4fd1ba09e469be43159679e516f82d6d7a3
data/README.md CHANGED
@@ -1,29 +1,205 @@
1
1
  # HustleAndFlow
2
2
 
3
- TODO: Write a gem description
3
+ ## Start
4
4
 
5
- ## Installation
5
+ ```
6
+ Usage: start_work_on [-n <issue_type> <issue_title>] [-i <issue_number>]
6
7
 
7
- Add this line to your application's Gemfile:
8
+ -n <issue_type> <issue_title>
8
9
 
9
- gem 'hustle_and_flow'
10
+ Start work on a new issue. This command will:
11
+ * Runs issue-tracker-specific pre-start-new-issue tasks.
10
12
 
11
- And then execute:
13
+ * Checks to see if an issue with that exact type and title
14
+ already exists. If it does, it will perform all of the actions
15
+ as though the "-i" flag was used instead of the "-n" flag.
12
16
 
13
- $ bundle
17
+ * Create a new issue with the given type and title.
14
18
 
15
- Or install it yourself as:
19
+ * Open your default browser so you to supply additional
20
+ information.
16
21
 
17
- $ gem install hustle_and_flow
22
+ * Create a branch with a dasherized version of the issue title
23
+ as well as a dasherized version of the action and issue number
24
+ in accordance with the type of issue tracker you're using.
18
25
 
19
- ## Usage
26
+ For example, if using Github, and the created issue number was
27
+ 42, with a type of "feature" and a title of "Add awesome new
28
+ feature!!!", this command would create a branch name of:
20
29
 
21
- TODO: Write usage instructions here
30
+ feature/add-awesome-new-feature-closes-42
22
31
 
23
- ## Contributing
32
+ * Pushes the newly created branch to Github
24
33
 
25
- 1. Fork it ( https://github.com/[my-github-username]/hustle_and_flow/fork )
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create a new Pull Request
34
+ * Performs any issue tracker-specific post-start-new-issue tasks
35
+
36
+ -i <issue_number>
37
+
38
+ Starts work on an existing issue. This command will:
39
+ * Runs issue-tracker-specific pre-start-existing-issue tasks.
40
+
41
+ * Check to see if the issue exists. If it does, it will display
42
+ the issue information and ask for confirmation. If it does
43
+ not, the user will be alerted and the command will exit.
44
+
45
+ * Assuming the issue exists, and it is unassigned, it will
46
+ assign it to the user. If it is already assigned, the user
47
+ will be asked if they would like to reassign it to themselves.
48
+
49
+ * Assuming the issue exists, the command will check to see if
50
+ there are any branches which already exist that may be
51
+ applicable to work on. They will be displayed in the format:
52
+
53
+ 1. * LT [Jeff Felchner] feature/add-awesome-new-feature-closes-42
54
+ 2. R [Sonny Gonzalez] feature/add-awesome-new-feature-closes-42-alt-1
55
+ 3. L [Drew Montgomery] feature/add-awesome-new-feature-closes-42-alt-2
56
+
57
+ c. Create a new branch
58
+
59
+ This means that there are three branches which are already
60
+ being worked on for that issue. The different parts of the
61
+ listing are as follows:
62
+
63
+ *: Indicates the current branch
64
+ L: Indicates the a local branch
65
+ T: Indicates the local branch is tracking a remote branch
66
+ R: Indicates a remote-only branch
67
+
68
+ The name field indicates the person the branch is currently
69
+ assigned to. If unassigned, it will be first person who
70
+ committed to the branch.
71
+
72
+ If option "c" is chosen, a new branch will be created with an
73
+ additional increment added to the "alt" portion of the name.
74
+
75
+ If no applicable branches exist, one will be created for you.
76
+
77
+ * Runs issue-tracker-specific post-start-existing-issue tasks.
78
+ ```
79
+
80
+ ## Stop
81
+
82
+ ```
83
+ Usage: ready_for_review [-n]
84
+
85
+ Process:
86
+ * Runs issue-tracker-specific pre-ready-for-review tasks.
87
+ For example, if using Github, a pull-request will be
88
+ created for the branch.
89
+
90
+ * Checks to see if the branch is already being reviewed.
91
+ If it is, the command aborts.
92
+
93
+ * Makes sure that the branch is up-to-date with origin/master
94
+
95
+ * Runs all of the tests
96
+
97
+ If the tests fail, the command will abort.
98
+
99
+ * Runs all of the style checks
100
+
101
+ If the style checks fail, the command will abort.
102
+
103
+ * All updated changes are pushed to origin.
104
+
105
+ * The issue modified to indicate that it is ready for review.
106
+
107
+ * By default, the users whose code you have modified, will be
108
+ notified that their assistance is requested for review.
109
+
110
+ * Runs issue-tracker-specific post-ready-for-review tasks.
111
+
112
+ Options:
113
+ -n Skips test run and style checks
114
+ ```
115
+
116
+ ## Review
117
+
118
+ ```
119
+ Usage: start_review [-i <issue_number>] [-r]
120
+
121
+ -i <issue_number>
122
+
123
+ Begins the review of an existing issue (or Pull Request).
124
+ * Runs issue-tracker-specific pre-start-review tasks.
125
+
126
+ * Updates master with origin/master
127
+
128
+ * Retrieves all branches/issues that are ready for review and
129
+ displays them to the user.
130
+
131
+ Ready for Review
132
+ -------------------------------------------------------------------------
133
+ 1. * LT [Jeff Felchner] feature/add-awesome-new-feature-closes-42
134
+ 2. R [Sonny Gonzalez] feature/add-awesome-new-feature-closes-42-alt-1
135
+ 3. L [Drew Montgomery] feature/add-awesome-new-feature-closes-42-alt-2
136
+
137
+ Other Available Branches
138
+ -------------------------------------------------------------------------
139
+ 4. * LT [Michael Myers] refactor/change-things-up
140
+ 5. R [Freddy Kreuger] bugfix/slay-those-bugs
141
+ 6. L [Jason Voorhees] chore/start-a-fire
142
+
143
+ * Checks to see if the issue is currently being reviewed. If so
144
+ the command will abort.
145
+
146
+ * Assigns the issue (or Pull Request if using Github) to the
147
+ reviewer.
148
+
149
+ * Makes sure that the selected branch is up-to-date with
150
+ origin/master
151
+
152
+ * Runs all of the tests
153
+
154
+ If the tests fail, the command will abort.
155
+
156
+ * Runs all of the style checks
157
+
158
+ If the style checks fail, the command will abort.
159
+
160
+ * All updated changes are pushed to origin.
161
+
162
+ * The issue modified to indicate that it is being reviewed.
163
+
164
+ * The user who was previously assigned to the issue will be
165
+ notified that their code is being reviewed.
166
+
167
+ * The user will be presented with a diff command (which will
168
+ also be copied to their clipboard). When run, it will show
169
+ them all of the changes that are being asked to be reviewed.
170
+
171
+ * Runs issue-tracker-specific post-start-review tasks.
172
+
173
+ Options:
174
+ -r Forces the branch to be reviewed by the current user even if
175
+ it appears it is already being reviewed.
176
+ ```
177
+
178
+ ## Finish Review
179
+
180
+ ```
181
+ Usage: finish_review [-m]
182
+
183
+ Completes the review of the current issue (or Pull Request).
184
+ * Runs issue-tracker-specific pre-finish-review tasks.
185
+
186
+ * Adds a git note to all commits stating:
187
+
188
+ Reviewed-by: Your Username <youremail@example.com>
189
+
190
+ * Merges the branch into master using "git-backmerge"
191
+
192
+ * Removes anyone assigned to the issue (or Pull Request)
193
+
194
+ * Marks the issue as "reviewed"
195
+
196
+ * Adds a comment that the issue has been reviewed.
197
+
198
+ * If applicable, make sure that the issue has been marked as
199
+ "finished", "closed", etc.
200
+
201
+ * Runs issue-tracker-specific post-finish-review tasks.
202
+
203
+ Options:
204
+ -m Skips automerging of the branch into master
205
+ ```
data/bin/hustle CHANGED
@@ -2,4 +2,8 @@
2
2
 
3
3
  require 'hustle_and_flow/binary/runner'
4
4
 
5
+ trap 'SIGINT' do
6
+ exit 130
7
+ end
8
+
5
9
  HustleAndFlow::Binary::Runner.start
@@ -19,16 +19,20 @@ class Runner < Thor
19
19
  type: :string,
20
20
  aliases: '-u',
21
21
  desc: 'When searching for issues, it is the status of the issues you would like to view.'
22
- method_option :subject,
22
+ method_option :title,
23
23
  type: :string,
24
- aliases: '-s',
25
- desc: 'The subject (or title) of the issue which should be searched for or created'
24
+ aliases: '-m',
25
+ desc: 'The subject (or message) of the issue which should be searched for or created'
26
26
  method_option :number,
27
27
  type: :string,
28
28
  aliases: '-n',
29
29
  desc: 'The number of the issue which should be searched for.'
30
30
  def start
31
- Commands::Start.new(io: HustleAndFlow::Io::Shell.new, **options).call
31
+ symbolized_options = options.each_with_object({}) do |value, memo|
32
+ memo[value[0].to_sym] = value[1]
33
+ end
34
+
35
+ Commands::Start.new(io: HustleAndFlow::Io::Shell.new, **symbolized_options).call
32
36
  end
33
37
  end
34
38
  end
@@ -1,32 +1,31 @@
1
- require 'thor/shell/basic'
2
- require 'hustle_and_flow/vcs_repository'
3
- require 'hustle_and_flow/issue_tracker'
1
+ require 'hustle_and_flow/version_control'
2
+ require 'hustle_and_flow/issue_trackers/commands/start'
3
+ require 'hustle_and_flow/version_controls/commands/start'
4
4
 
5
5
  module HustleAndFlow
6
6
  module Commands
7
7
  class Start
8
- attr_accessor :repo,
9
- :tracker,
10
- :me,
11
- :io,
12
- :issue_data
8
+ attr_accessor :io,
9
+ :options
13
10
 
14
11
  def initialize(io:, **args)
15
- self.repo = VcsRepository.new(path: Dir.pwd)
16
- self.tracker = IssueTracker.new(repo: repo)
17
- self.me = repo.user
18
12
  self.io = io
19
- self.issue_data = args.select { |_k, v| v }
13
+ self.options = args
20
14
  end
21
15
 
22
16
  def call
23
- issue = tracker.start(io: io,
24
- me: me,
25
- issue_data: issue_data)
26
- _branch = repo.start(io: io,
27
- number: issue.number,
28
- title: issue.title,
29
- branch_template: issue.to_branch_name(version: '*****'))
17
+ repo = VersionControl.new(path: Dir.pwd)
18
+ issue = IssueTrackers::Commands::Start.call \
19
+ io: io,
20
+ repo: repo,
21
+ me: repo.user,
22
+ options: options
23
+ _branch = VersionControls::Commands::Start.call \
24
+ io: io,
25
+ repo: repo,
26
+ number: issue.number,
27
+ title: issue.title,
28
+ branch_template: issue.to_branch_name(version: '*****')
30
29
  rescue Git::GitExecuteError => e
31
30
  io.say 'There was a problem running a git command.'
32
31
  io.say e.message
@@ -1,14 +1,15 @@
1
- require 'hustle_and_flow/issue_trackers/github'
1
+ require 'hustle_and_flow/issue_trackers/github/tracker'
2
2
 
3
3
  module HustleAndFlow
4
4
  class IssueTracker
5
5
  attr_accessor :adapter
6
6
 
7
- def initialize(**args)
8
- self.adapter = HustleAndFlow::
9
- IssueTrackers::
10
- Github.
11
- new(repo: args[:repo])
7
+ def initialize(repo:)
8
+ self.adapter = self.class.detect.new(repo: repo)
9
+ end
10
+
11
+ def self.detect
12
+ ::HustleAndFlow::IssueTrackers::Github::Tracker
12
13
  end
13
14
 
14
15
  def method_missing(name, *args)
@@ -0,0 +1,17 @@
1
+ require 'hustle_and_flow/issue_tracker'
2
+ require 'hustle_and_flow/issue_trackers/github/commands/start'
3
+
4
+ module HustleAndFlow
5
+ module IssueTrackers
6
+ module Commands
7
+ class Start
8
+ def self.call(**args)
9
+ issue_tracker_type = IssueTracker.detect.name.gsub('::Tracker', '')
10
+ command_class = const_get("::#{issue_tracker_type}::Commands::Start")
11
+
12
+ command_class.call(**args)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,99 @@
1
+ require 'hustle_and_flow/issue_trackers/github/tracker'
2
+ require 'hustle_and_flow/issue_trackers/github/issues'
3
+ require 'hustle_and_flow/formatters/issue_table_formatter'
4
+
5
+ module HustleAndFlow
6
+ module IssueTrackers
7
+ module Github
8
+ module Commands
9
+ class Start
10
+ attr_accessor :mode,
11
+ :labels,
12
+ :statuses,
13
+ :title,
14
+ :number,
15
+ :me,
16
+ :issues,
17
+ :tracker,
18
+ :io
19
+
20
+ def initialize(**args)
21
+ self.mode = args[:options][:create]
22
+ self.labels = args[:options][:type]
23
+ self.statuses = args[:options][:status]
24
+ self.title = args[:options][:title]
25
+ self.number = args[:options][:number]
26
+ self.me = args[:me]
27
+ self.io = args[:io]
28
+ self.tracker = Github::Tracker.new(repo: args[:repo])
29
+ self.issues = Issues.new(tracker: tracker,
30
+ io: io,
31
+ statuses: statuses)
32
+ end
33
+
34
+ def call
35
+ if !issue_specified? && mode == 'search'
36
+ applicable_issues = issues.filter_by(issue_data)
37
+
38
+ io.print_formatted_table \
39
+ data: Formatters::IssueTableFormatter.new(applicable_issues).to_ary,
40
+ title: 'Available Issues'
41
+
42
+ self.number = io.choose_issue until issue_specified?
43
+ end
44
+
45
+ if issue_specified?
46
+ issue = issues.find_or_create(issue_data)
47
+
48
+ if io.correct_issue?(issue)
49
+ issue.start(me: me)
50
+ end
51
+ else
52
+ fail ArgumentError.new("You must specify both type and a title when starting a new issue")
53
+ end
54
+ end
55
+
56
+ def self.call(**args)
57
+ new(**args).call
58
+ end
59
+
60
+ private
61
+
62
+ def mode=(other)
63
+ @mode = other.nil? ? 'search' : 'create'
64
+ end
65
+
66
+ def labels
67
+ @labels ||= []
68
+ end
69
+
70
+ def labels=(other)
71
+ other = other.to_s
72
+
73
+ @labels = other.split(',')
74
+ end
75
+
76
+ def statuses=(other)
77
+ other = other.
78
+ to_s.
79
+ split(',')
80
+
81
+ @statuses = other.empty? ? [:open] : other
82
+ end
83
+
84
+ def issue_specified?
85
+ (labels.any? && title) || number
86
+ end
87
+
88
+ def issue_data
89
+ {
90
+ number: number,
91
+ labels: labels.empty? ? nil : labels,
92
+ title: title,
93
+ }.each_with_object({}) { |item, memo| memo[item[0]] = item[1] unless item[1].nil? }
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -4,7 +4,7 @@ require 'hustle_and_flow/io/shell'
4
4
 
5
5
  module HustleAndFlow
6
6
  module IssueTrackers
7
- class Github
7
+ module Github
8
8
  class Issue
9
9
  DEFAULT_CATEGORY_LABELS = %w{feature bug refactor test style chore docs spike}
10
10
  ISSUE_ACTIONS = %w{closes references fixes}
@@ -25,12 +25,10 @@ class Issue
25
25
  data: tracker.client.create_issue(tracker.repo_name,
26
26
  title,
27
27
  body,
28
- **args))
28
+ args))
29
29
  end
30
30
 
31
31
  def start(me: nil)
32
- return unless io.correct_issue?(self)
33
-
34
32
  reopen.
35
33
  assign_issue? to: me
36
34
  end
@@ -58,8 +56,10 @@ class Issue
58
56
  five_minutes_ago <= created_at
59
57
  end
60
58
 
61
- def has_label?(other)
62
- labels.include?(other)
59
+ def has_label?(other = [])
60
+ other = !other.is_a?(Array) ? [other] : other
61
+
62
+ (labels & other).any?
63
63
  end
64
64
 
65
65
  def has_body?
@@ -84,7 +84,7 @@ class Issue
84
84
  assignee == other
85
85
  end
86
86
 
87
- def match?(type: nil, **args)
87
+ def match?(labels: nil, **args)
88
88
  result = true
89
89
  conditions = args
90
90
 
@@ -92,7 +92,7 @@ class Issue
92
92
  result &&= public_send(key) == value
93
93
  end
94
94
 
95
- type ? (result && has_label?(type)) : result
95
+ result &&= labels ? has_label?(labels) : true
96
96
  end
97
97
 
98
98
  def contact
@@ -1,48 +1,25 @@
1
1
  require 'hustle_and_flow/issue_trackers/github/issue'
2
- require 'hustle_and_flow/formatters/issue_table_formatter'
3
2
 
4
3
  module HustleAndFlow
5
4
  module IssueTrackers
6
- class Github
5
+ module Github
7
6
  class Issues
8
7
  include Enumerable
9
8
 
10
9
  attr_accessor :tracker,
11
- :query,
12
- :issues
13
-
14
- def initialize(tracker:, issues: nil, query: { state: :all })
15
- self.tracker = tracker
16
- self.query = query
17
- self.issues = issues
18
- end
19
-
20
- def self.start(tracker:, issues: nil, io:, me:, issue_data:)
21
- new(tracker: tracker,
22
- issues: issues).
23
- start(io: io,
24
- me: me,
25
- issue_data: issue_data)
26
- end
27
-
28
- def start(io:, me:, issue_data:)
29
- issue_data = issue_data.merge(status: 'open')
30
-
31
- unless issue_specified?(issue_data)
32
- applicable_issues = filter_by(issue_data)
33
-
34
- io.print_formatted_table \
35
- data: Formatters::IssueTableFormatter.new(applicable_issues).to_ary,
36
- title: 'Available Issues'
37
-
38
- issue_data[:number] = io.choose_issue until issue_specified?(issue_data)
39
- end
40
-
41
- find_or_create(issue_data).start(me: me)
10
+ :statuses,
11
+ :issues,
12
+ :io
13
+
14
+ def initialize(tracker:, io:, issues: nil, statuses: nil)
15
+ self.io = io
16
+ self.tracker = tracker
17
+ self.statuses = statuses
18
+ self.issues = issues
42
19
  end
43
20
 
44
21
  def find_or_create(**args)
45
- find(**args) || Issue.create(tracker: tracker, **args)
22
+ find(**args) || Issue.create(tracker: tracker, io: io, **args)
46
23
  end
47
24
 
48
25
  def each
@@ -51,38 +28,39 @@ class Issues
51
28
  end
52
29
  end
53
30
 
54
- private
55
-
56
- def filter_by(*args)
57
- self.class.new(tracker: tracker,
31
+ def filter_by(**args)
32
+ self.class.new(io: io,
33
+ tracker: tracker,
58
34
  issues: issues.select do |issue|
59
- issue if issue.match?(*args)
35
+ issue if issue.match?(**args)
60
36
  end)
61
37
  end
62
38
 
63
- def find(type: nil, title: nil, number: nil, **args)
39
+ private
40
+
41
+ def find(labels: nil, title: nil, number: nil)
64
42
  issues.find do |issue|
65
- issue.match?(type: type, title: title) ||
43
+ issue.match?(labels: labels, title: title) ||
66
44
  issue.match?(number: number.to_i)
67
45
  end
68
46
  end
69
47
 
70
48
  def issues
71
49
  @issues ||= client.
72
- issues(tracker.repo_name, query).
50
+ issues(tracker.repo_name, query: { state: statuses }).
73
51
  map do |issue_data|
74
52
  Issue.new(tracker: tracker,
75
53
  data: issue_data)
76
54
  end
77
55
  end
78
56
 
79
- def issue_specified?(data)
80
- (data[:type] && data[:title]) || data[:number]
81
- end
82
-
83
57
  def client
84
58
  tracker.client
85
59
  end
60
+
61
+ def statuses=(other)
62
+ @statuses ||= other.nil? ? [:all] : other
63
+ end
86
64
  end
87
65
  end
88
66
  end
@@ -0,0 +1,63 @@
1
+ require 'octokit'
2
+
3
+ module HustleAndFlow
4
+ module IssueTrackers
5
+ module Github
6
+ class Tracker
7
+ attr_accessor :client,
8
+ :repo
9
+
10
+ def initialize(repo:)
11
+ Octokit.auto_paginate = true
12
+
13
+ self.client = Octokit::Client.new(netrc: true)
14
+ self.repo = repo
15
+ end
16
+
17
+ def repo_name
18
+ repo.base_name
19
+ end
20
+
21
+ # def ready_for_review(branch)
22
+ #
23
+ # No issue number
24
+ # Find by title
25
+ # Has issue number
26
+ # Find by number
27
+ #
28
+ # Issue found
29
+ # Issue closed
30
+ # Ask to reopen issue
31
+ # Issue open
32
+ # Issue being reviewed
33
+ # Issue not being reviewed
34
+ # Issue not found
35
+ # Ask to create issue
36
+ #
37
+ # Lookup Pull Request from Issue and Version Number
38
+ #
39
+ # Pull Request Found
40
+ # How are PR's found?
41
+ #
42
+ # PR Title Format: #15 v1 - My Issue Title
43
+ #
44
+ # Pull Request Closed
45
+ # Reopen PR
46
+ # Pull Request Open
47
+ # Use found PR
48
+ # Pull Request Not Found
49
+ # Create New PR
50
+ #
51
+ # pull_request = PullRequest.find_or_create_from_branch_name(branch.name)
52
+ # issue = Issue.find_or_create_from_branch_name(branch.name)
53
+ #
54
+ # issue.ready_for_review(reviewer_names: branch.overwritten_authors)
55
+ # end
56
+ #
57
+ # def update_pull_request(branch)
58
+ # client.create_pull_request()
59
+ # end
60
+ end
61
+ end
62
+ end
63
+ end