git-commit-autouser 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git_commit_autouser/cli.rb +33 -40
- data/lib/git_commit_autouser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b55add773053e443181b209413e0b08017f8fb9a
|
4
|
+
data.tar.gz: a91a9f04c593d95eb96443b2c1234fc408e55ea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6882c7a8307c22ab0fe4eae233d4ca1c3a7962de11624647a10bac747424c0c93ac8cde2445e05681e86d26564730a78e4a9b426b00c800b12ac2b4d181c8221
|
7
|
+
data.tar.gz: 1339aaa1fa061e332a5e534bdf11ad055a076350b7698397cb669fbad3317cd55a5888e059e331e5dfef4ea652d922a5af5758c7dad0e0a2f594f6a90e173080
|
@@ -1,38 +1,15 @@
|
|
1
1
|
module GitCommitAutouser
|
2
2
|
class Cli
|
3
3
|
def self.start(argv=ARGV)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
users = Config.users
|
8
|
-
abort_no_user_config! if users.empty?
|
9
|
-
|
10
|
-
matched = nil
|
11
|
-
users.each do |user|
|
12
|
-
matched = user.url_regexp.match(remote_url)
|
13
|
-
unless matched.nil?
|
14
|
-
matched = user
|
15
|
-
break
|
16
|
-
end
|
4
|
+
unless Git.remote?("origin")
|
5
|
+
$stderr.puts "[warn] remote `origin` is not configured"
|
17
6
|
end
|
18
7
|
|
19
|
-
|
20
|
-
|
21
|
-
env = {
|
22
|
-
"GIT_COMMITTER_NAME" => matched.name,
|
23
|
-
"GIT_COMMITTER_EMAIL" => matched.email,
|
24
|
-
"GIT_AUTHOR_NAME" => matched.name,
|
25
|
-
"GIT_AUTHOR_EMAIL" => matched.email,
|
26
|
-
}
|
27
|
-
|
28
|
-
env["HUB_CONFIG"] = matched.hub_config
|
29
|
-
|
30
|
-
system env, "git", "commit", *argv
|
31
|
-
exit $?.exitstatus
|
32
|
-
end
|
8
|
+
remote_url = Git.remote_push_url("origin")
|
33
9
|
|
34
|
-
|
35
|
-
|
10
|
+
users = Config.users
|
11
|
+
if users.empty?
|
12
|
+
$stderr.puts <<-EOS
|
36
13
|
No user setting found. You should add to ~/.gitconfig like the following.
|
37
14
|
------
|
38
15
|
[#{Config::USER_CONFIG_PREFIX}github]
|
@@ -44,19 +21,35 @@ No user setting found. You should add to ~/.gitconfig like the following.
|
|
44
21
|
name = "Foo Bar"
|
45
22
|
email = bar@company.com
|
46
23
|
------
|
47
|
-
|
48
|
-
|
49
|
-
|
24
|
+
EOS
|
25
|
+
abort
|
26
|
+
end
|
50
27
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
28
|
+
matched = nil
|
29
|
+
users.each do |user|
|
30
|
+
matched = user.url_regexp.match(remote_url)
|
31
|
+
unless matched.nil?
|
32
|
+
matched = user
|
33
|
+
break
|
34
|
+
end
|
35
|
+
end
|
55
36
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
37
|
+
if matched
|
38
|
+
env = {
|
39
|
+
"GIT_COMMITTER_NAME" => matched.name,
|
40
|
+
"GIT_COMMITTER_EMAIL" => matched.email,
|
41
|
+
"GIT_AUTHOR_NAME" => matched.name,
|
42
|
+
"GIT_AUTHOR_EMAIL" => matched.email,
|
43
|
+
"HUB_CONFIG" => matched.hub_config,
|
44
|
+
}
|
45
|
+
else
|
46
|
+
env = {}
|
47
|
+
$stderr.puts "[warn] No user setting matched. Abort."
|
48
|
+
$stderr.puts "[warn] Remote Url: #{remote_url}"
|
49
|
+
end
|
50
|
+
|
51
|
+
system env, "git", "commit", *argv
|
52
|
+
exit $?.exitstatus
|
60
53
|
end
|
61
54
|
end
|
62
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-commit-autouser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|