git-copilot 0.1.0 → 0.2.0
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/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/git/copilot/cli.rb +35 -3
- data/lib/git/copilot/configuration.rb +15 -0
- data/lib/git/copilot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28bd030a9e78802dfbfb4d18795f56807308aa62045f840b69aec6b617e4251b
|
4
|
+
data.tar.gz: 0f907a3b725d66e8024c2cf695f367dbe0ca09a84159de38d6788d37b9f0ba29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2388eaad908b14599501a84c3d2278e5505af83801b9590ef239dd05703bfb7af928dcf837988c8ee5c09c819359a367066af52eeba0428dabdf843aab8d7ed1
|
7
|
+
data.tar.gz: d86b7c929a14c2a42befdda7905bf9aad340a9579b453425c0800fb9ed98205a6cd910a867c3208c84569bca9d05a86cd076cca28a6bc774d12c40b49ee14a15
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -113,10 +113,17 @@ users:
|
|
113
113
|
george:
|
114
114
|
name: George Geoffries
|
115
115
|
email: george.geoffries@example.com
|
116
|
+
current_pairs:
|
117
|
+
- george
|
116
118
|
```
|
117
119
|
|
118
120
|
## Development
|
119
121
|
|
122
|
+
1. Clone this repo
|
123
|
+
1. Run `bin/setup` to install dependencies
|
124
|
+
1. Run `bundle exec rake` to run all tests
|
125
|
+
1. You can run `bin/console` to open an IRB console with Git Co-pilot already loaded
|
126
|
+
|
120
127
|
## Contributing
|
121
128
|
|
122
129
|
Bug reports and pull requests are welcome on GitHub at https://github.com/atmattpatt/git-copilot.
|
data/lib/git/copilot/cli.rb
CHANGED
@@ -17,13 +17,20 @@ module Git::Copilot
|
|
17
17
|
say "Writing configuration file to #{config_file_path}"
|
18
18
|
File.write(config_file_path, empty_configuration)
|
19
19
|
|
20
|
+
if yes?("Set up a global git alias? (This will allow you to run `git copilot`)")
|
21
|
+
system("git config --global alias.copilot '\!git-copilot'")
|
22
|
+
end
|
23
|
+
|
20
24
|
solo
|
21
25
|
end
|
22
26
|
|
23
27
|
desc "solo", "Prepare a commit message template for solo work"
|
24
28
|
def solo
|
29
|
+
clear_pairs
|
30
|
+
commit_config
|
25
31
|
write_template
|
26
32
|
set_git_commit_template
|
33
|
+
status
|
27
34
|
end
|
28
35
|
|
29
36
|
desc "pair USERNAME...", "Prepare a commit message template for pairing"
|
@@ -35,8 +42,29 @@ module Git::Copilot
|
|
35
42
|
end
|
36
43
|
end.compact
|
37
44
|
|
38
|
-
|
45
|
+
if authors.empty?
|
46
|
+
return say_status "ERROR", "No users to pair with. " \
|
47
|
+
"Did you mean to run git-copilot solo?", :red
|
48
|
+
end
|
49
|
+
|
50
|
+
self.current_pairs = authors
|
51
|
+
commit_config
|
52
|
+
write_template
|
39
53
|
set_git_commit_template
|
54
|
+
|
55
|
+
status
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "status", "Show the current pairs, if any"
|
59
|
+
def status
|
60
|
+
if current_pairs.empty?
|
61
|
+
say "Now working solo", :green
|
62
|
+
else
|
63
|
+
say "Now working with #{pluralize_pairs(current_pairs.length)}:"
|
64
|
+
current_pairs.each do |author|
|
65
|
+
say format("%{name} <%{email}>", name: author.name, email: author.email), :green
|
66
|
+
end
|
67
|
+
end
|
40
68
|
end
|
41
69
|
|
42
70
|
desc "user SUBCOMMAND", "Manage users that Git Co-pilot knows about"
|
@@ -44,8 +72,8 @@ module Git::Copilot
|
|
44
72
|
|
45
73
|
private
|
46
74
|
|
47
|
-
def write_template
|
48
|
-
File.write(commit_message_template_path, template(authors:
|
75
|
+
def write_template
|
76
|
+
File.write(commit_message_template_path, template(authors: current_pairs))
|
49
77
|
end
|
50
78
|
|
51
79
|
def set_git_commit_template
|
@@ -66,5 +94,9 @@ module Git::Copilot
|
|
66
94
|
"users" => {},
|
67
95
|
)
|
68
96
|
end
|
97
|
+
|
98
|
+
def pluralize_pairs(number)
|
99
|
+
number == 1 ? "1 pair" : "#{number} pairs"
|
100
|
+
end
|
69
101
|
end
|
70
102
|
end
|
@@ -39,6 +39,7 @@ module Git::Copilot::Configuration
|
|
39
39
|
"users" => users.each_with_object({}) do |(username, user), memo|
|
40
40
|
memo[username.to_s] = user.to_h
|
41
41
|
end,
|
42
|
+
"current_pairs" => current_pairs.map(&:username),
|
42
43
|
}
|
43
44
|
end
|
44
45
|
|
@@ -52,6 +53,20 @@ module Git::Copilot::Configuration
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
def current_pairs
|
57
|
+
@current_pairs ||= configuration.fetch("current_pairs", []).map do |username|
|
58
|
+
users.fetch(username)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def clear_pairs
|
63
|
+
self.current_pairs = []
|
64
|
+
end
|
65
|
+
|
66
|
+
def current_pairs=(usernames)
|
67
|
+
@current_pairs = usernames.to_a.flatten
|
68
|
+
end
|
69
|
+
|
55
70
|
def add_user(username, name, email)
|
56
71
|
user = User.new(username, name, email)
|
57
72
|
users.store(user.username, user)
|
data/lib/git/copilot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-copilot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Patterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|