committer-tools 0.1.2 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f27491ec9dd9013f8a904670616d75b24104ed0
4
- data.tar.gz: 0abe91d59fad9d7bf04198a39a89bdaa9ad612b7
3
+ metadata.gz: baeeea1ac89f7a3b0800b9efbbb0d04676cb58a7
4
+ data.tar.gz: 52c6f3bfcaca868db6934ee022b86ef893bcfe27
5
5
  SHA512:
6
- metadata.gz: a2d65c2d115afcb9b730523dee35d2b5abc2683c06efa9499097b12a4f2bf519392cd58623117e7531b838085c7d8217a64a3d41271c69b9cc43b1ae523dd94d
7
- data.tar.gz: 8c19598e5de009b554f6cf655e76954e85f4a8c1a6cf58155f61292cde40827cf8187d0027ba7152d0ca07df8c254845a32849942c729f0580590923854ab743
6
+ metadata.gz: 976ad1e3c7a8e839f3aa2e3d80951f2af7bbecfb9997674051d53a50d0a0767223b4cdd2bfbf778f0304c27ca6b350c2bc238085fba8538a7bf81610edd118b2
7
+ data.tar.gz: 579389cdec2c8ea71bb73e48df0c8d6c94f8eeeab45b5b27f583a8809cc530fd82f4830e9b7dd09645295e239d3d09df3751e6a6ff228060da1736ae778c2314
data/README.md CHANGED
@@ -19,8 +19,9 @@ gem install committer-tools
19
19
  - get pr from github api
20
20
  - put together metadata for commit
21
21
  - do a few checks, make sure ok to land
22
+ - pauses, lets you squash, make any edits necessary
22
23
  - add metadata to commit message
23
- - make sure final commit message ok
24
+ - one final round of commit message validation
24
25
  - What this does not automates:
25
26
  - pushing the actual commit
26
27
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'committer-tools'
5
- spec.version = '0.1.2'
5
+ spec.version = '0.1.3'
6
6
  spec.authors = 'Jon Moss'
7
7
  spec.email = 'me@jonathanmoss.me'
8
8
 
data/exe/committer-tools CHANGED
@@ -5,10 +5,35 @@ require 'committer-tools'
5
5
 
6
6
  trap("SIGINT") { exit 0 }
7
7
 
8
- if ARGV.shift == 'land'
9
- Preparer.new.run
10
- else
11
- puts "Welcome to committer-tools!"
12
- puts "Currently the only command is 'land', which will ready a Node.js Foundation pull request to be landed."
13
- exit 0
8
+ class Commander
9
+ COMMANDS = {
10
+ 'land' => "Ready a Node.js Foundation pull request to be landed"
11
+ }
12
+
13
+ def run(command)
14
+ if COMMANDS.keys.include?(command)
15
+ run_command(command)
16
+ else
17
+ run_usage
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def run_command(command)
24
+ github_pr = Preparer.new.run
25
+
26
+ if command == 'land'
27
+ LandCommand.new.run(github_pr)
28
+ end
29
+ end
30
+
31
+ def run_usage
32
+ puts "Welcome to committer-tools!"
33
+
34
+ puts "Available commands:\n"
35
+ COMMANDS.each { |k, v| puts "--> #{k}: #{v}" }
36
+ end
14
37
  end
38
+
39
+ Commander.new.run(ARGV.shift)
@@ -12,9 +12,9 @@ class HTTPHelper
12
12
  end
13
13
 
14
14
  class Lander
15
- def run(pr, github_pr, metadata)
15
+ def run(github_pr, metadata)
16
16
  check_to_land(github_pr, metadata)
17
- introduce_commit(pr, metadata)
17
+ introduce_commit(github_pr, metadata)
18
18
 
19
19
  puts "[\u{2714}] Commit(s) applied locally. Please update to your liking, and then type 'continue'."
20
20
  continue = gets.strip!
@@ -56,7 +56,7 @@ class Lander
56
56
  end
57
57
  end
58
58
 
59
- def introduce_commit(pr, metadata)
59
+ def introduce_commit(github_pr, metadata)
60
60
  # Clear current status
61
61
  `git am --abort`
62
62
  `git rebase --abort`
@@ -67,7 +67,7 @@ class Lander
67
67
  `git merge --ff-only upstream/master`
68
68
 
69
69
  # Download and apply patch
70
- `curl -L https://github.com/#{pr[:org]}/#{pr[:repo]}/pull/#{pr[:id]}.patch | git am --whitespace=fix`
70
+ `curl -L https://github.com/#{github_pr['base']['user']['login']}/#{github_pr['base']['repo']['name']}/pull/#{github_pr['number']}.patch | git am --whitespace=fix`
71
71
  end
72
72
 
73
73
  def validate_commit
@@ -133,10 +133,7 @@ end
133
133
  class Preparer
134
134
  def run
135
135
  pr = get_pr()
136
- github_pr = get_github_pr(pr)
137
- metadata = get_metadata(github_pr)
138
-
139
- Lander.new.run(pr, github_pr, metadata)
136
+ get_github_pr(pr)
140
137
  end
141
138
 
142
139
  private
@@ -147,10 +144,6 @@ class Preparer
147
144
  )
148
145
  end
149
146
 
150
- def get_metadata(github_pr)
151
- MetadataCollector.new.collect(github_pr)
152
- end
153
-
154
147
  def get_pr
155
148
  puts "Please enter PR ID:"
156
149
  pr_id = gets.strip!
@@ -164,3 +157,10 @@ class Preparer
164
157
  end
165
158
  end
166
159
  end
160
+
161
+ class LandCommand
162
+ def run(github_pr)
163
+ metadata = MetadataCollector.new.collect(github_pr)
164
+ Lander.new.run(github_pr, metadata)
165
+ end
166
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: committer-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Moss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  requirements: []
61
61
  rubyforge_project:
62
- rubygems_version: 2.6.14
62
+ rubygems_version: 2.6.13
63
63
  signing_key:
64
64
  specification_version: 4
65
65
  summary: A Node.js collaborator CLI utility.