githelp 0.1.4 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.config/peco/config.json +6 -0
- data/00README +8 -0
- data/Gemfile +2 -4
- data/Makefile +10 -0
- data/README.md +9 -122
- data/bin/gh +2 -0
- data/exe/getghdata +100 -0
- data/exe/githelp +42 -67
- data/getdata +100 -0
- data/githelp +57 -0
- metadata +13 -52
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/data.txt +0 -12
- data/data/adddelete.rb +0 -10
- data/data/afteradd.rb +0 -16
- data/data/appear.rb +0 -16
- data/data/branch.rb +0 -33
- data/data/cat-file.rb +0 -19
- data/data/change.rb +0 -95
- data/data/checkout.rb +0 -27
- data/data/commit.rb +0 -7
- data/data/freq.rb +0 -13
- data/data/fresh.rb +0 -7
- data/data/grep.rb +0 -8
- data/data/ignore.rb +0 -11
- data/data/log.rb +0 -8
- data/data/ls-files.rb +0 -15
- data/data/mv.rb +0 -7
- data/data/removed.rb +0 -17
- data/data/reset.rb +0 -11
- data/data/rm.rb +0 -8
- data/data/shortlog.rb +0 -13
- data/data/show.rb +0 -7
- data/data/status.rb +0 -11
- data/data/tag.rb +0 -27
- data/exe/githelp-changed +0 -9
- data/exe/githelp-fileadded +0 -25
- data/exe/githelp-unchanged +0 -9
- data/githelp.gemspec +0 -28
- data/lib/githelp.rb +0 -51
- data/lib/githelp/args.rb +0 -17
- data/lib/githelp/branches.rb +0 -40
- data/lib/githelp/changes.rb +0 -36
- data/lib/githelp/files.rb +0 -27
- data/lib/githelp/git_check.rb +0 -15
- data/lib/githelp/glossary.rb +0 -17
- data/lib/githelp/numbers.rb +0 -14
- data/lib/githelp/params.rb +0 -17
- data/lib/githelp/patterns.rb +0 -20
- data/lib/githelp/tags.rb +0 -29
- data/lib/githelp/version.rb +0 -3
data/data/commit.rb
DELETED
data/data/freq.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
# https://bayashi.net/diary/2015/0224
|
4
|
-
[
|
5
|
-
[
|
6
|
-
"(よく|頻繁に)(編集|修正)されているファイルを(リスト|表示)する",
|
7
|
-
'git log --name-only --pretty="format:" | grep -ve "^$" | sort | uniq -c | sort -r | more'
|
8
|
-
],
|
9
|
-
[
|
10
|
-
"ファイルの(編集|修正)のランキングを(リスト|表示)する",
|
11
|
-
'git log --name-only --pretty="format:" | grep -ve "^$" | sort | uniq -c | sort -r | more'
|
12
|
-
],
|
13
|
-
]
|
data/data/fresh.rb
DELETED
data/data/grep.rb
DELETED
data/data/ignore.rb
DELETED
data/data/log.rb
DELETED
data/data/ls-files.rb
DELETED
data/data/mv.rb
DELETED
data/data/removed.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
if params.length > 0 && files.length > 0
|
3
|
-
|
4
|
-
[
|
5
|
-
[
|
6
|
-
"「(#{files.join('|')})」ファイルから「(#{params.join('|')})」という名前が消えたのはいつ?",
|
7
|
-
'git log --oneline | awk \'{print $1}\' | xargs -J xxx git show xxx #{$1} | grep -C10 \'^-.*#{$2}\''
|
8
|
-
],
|
9
|
-
[
|
10
|
-
"「(#{params.join('|')})」という名前が「(#{files.join('|')})」ファイルから消えたのはいつ?",
|
11
|
-
'git log --oneline | awk \'{print $1}\' | xargs -J xxx git show xxx #{$2} | grep -C10 \'^-.*#{$1}\''
|
12
|
-
]
|
13
|
-
]
|
14
|
-
else
|
15
|
-
nil
|
16
|
-
end
|
17
|
-
|
data/data/reset.rb
DELETED
data/data/rm.rb
DELETED
data/data/shortlog.rb
DELETED
data/data/show.rb
DELETED
data/data/status.rb
DELETED
data/data/tag.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
if params.length > 0
|
3
|
-
[
|
4
|
-
[
|
5
|
-
"現在使われているタグを(リスト|表示)する",
|
6
|
-
'git tag'
|
7
|
-
],
|
8
|
-
[
|
9
|
-
"現在のコミットIDに「(#{params.join('|')})」というタグを関連付けする",
|
10
|
-
'git tag #{$1}'
|
11
|
-
],
|
12
|
-
[
|
13
|
-
"「(#{params.join('|')})」というタグを現在のコミットIDに関連付けする",
|
14
|
-
'git tag #{$1}'
|
15
|
-
],
|
16
|
-
[
|
17
|
-
"「(#{tags.join('|')})」というタグを(削除する|消す)",
|
18
|
-
'git tag -d #{$1}'
|
19
|
-
],
|
20
|
-
[
|
21
|
-
"「(#{tags.join('|')})」というタグのついたコミットを表示する",
|
22
|
-
'git show #{$1}'
|
23
|
-
],
|
24
|
-
]
|
25
|
-
else
|
26
|
-
nil
|
27
|
-
end
|
data/exe/githelp-changed
DELETED
data/exe/githelp-fileadded
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
filename = ARGV[0]
|
5
|
-
|
6
|
-
commit = nil
|
7
|
-
res = 'notfound'
|
8
|
-
|
9
|
-
`git log --name-status --oneline`.split(/\n/).each { |line|
|
10
|
-
if line =~ /^([0-9a-f]{7})/
|
11
|
-
commit = $1
|
12
|
-
else
|
13
|
-
line.chomp!
|
14
|
-
a = line.split(/\s+/)
|
15
|
-
if a[1] == filename
|
16
|
-
res = commit
|
17
|
-
end
|
18
|
-
end
|
19
|
-
}
|
20
|
-
|
21
|
-
if ARGV[1] == 'range'
|
22
|
-
puts "#{res}^..#{res}"
|
23
|
-
else
|
24
|
-
puts res
|
25
|
-
end
|
data/exe/githelp-unchanged
DELETED
data/githelp.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'githelp/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "githelp"
|
8
|
-
spec.version = Githelp::VERSION
|
9
|
-
spec.authors = ["Toshiyuki Masui"]
|
10
|
-
spec.email = ["masui@pitecan.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{GitHelp - long summary}
|
13
|
-
spec.description = %q{GitHelp - short desc}
|
14
|
-
spec.homepage = "http://GitHub.com/masui/GitHelp"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
# spec.executables = ["githelp", "githelp-changed"]
|
21
|
-
spec.require_paths = ["lib", "data"]
|
22
|
-
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency "minitest"
|
26
|
-
|
27
|
-
spec.add_runtime_dependency "re_expand"
|
28
|
-
end
|
data/lib/githelp.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require "githelp/version"
|
4
|
-
require 're_expand'
|
5
|
-
|
6
|
-
require "githelp/args"
|
7
|
-
require "githelp/files"
|
8
|
-
require "githelp/params"
|
9
|
-
require "githelp/patterns"
|
10
|
-
require "githelp/tags"
|
11
|
-
require "githelp/numbers"
|
12
|
-
require "githelp/branches"
|
13
|
-
require "githelp/changes"
|
14
|
-
require "githelp/glossary"
|
15
|
-
require "githelp/git_check"
|
16
|
-
|
17
|
-
module Githelp
|
18
|
-
#
|
19
|
-
# パタンを指定してコマンド候補リストを得る
|
20
|
-
#
|
21
|
-
def githelp(pat)
|
22
|
-
|
23
|
-
datadir = File.expand_path('../../data', __FILE__)
|
24
|
-
# $LOAD_PATH.unshift File.expand_path('../data', __FILE__)
|
25
|
-
|
26
|
-
entries = []
|
27
|
-
Dir.open(datadir).each { |file|
|
28
|
-
next unless File.file?("#{datadir}/#{file}")
|
29
|
-
next if file !~ /\.rb$/
|
30
|
-
# require file
|
31
|
-
a = eval File.read("#{datadir}/#{file}")
|
32
|
-
entries += a if a
|
33
|
-
}
|
34
|
-
|
35
|
-
g = ExpandRuby::Generator.new # re_expandのジェネレータ
|
36
|
-
entries.each { |entry|
|
37
|
-
g.add entry[0], entry[1] if entry
|
38
|
-
}
|
39
|
-
res = g.generate pat
|
40
|
-
listed = {}
|
41
|
-
res[0].find_all { |a| # 0 ambig
|
42
|
-
if listed[a[1]]
|
43
|
-
false
|
44
|
-
else
|
45
|
-
listed[a[1]] = true
|
46
|
-
end
|
47
|
-
}
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
|
data/lib/githelp/args.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
#
|
3
|
-
|
4
|
-
module Githelp
|
5
|
-
def args(argv=ARGV)
|
6
|
-
a = []
|
7
|
-
argv.each { |arg|
|
8
|
-
if arg =~ /^(\d+)([^\d]+)?$/ then
|
9
|
-
a << $1
|
10
|
-
a << $2 if $2.to_s != ''
|
11
|
-
else
|
12
|
-
a << arg.sub(/^['"]/,'').sub(/['"]$/,'').sub('「','').sub('」','')
|
13
|
-
end
|
14
|
-
}
|
15
|
-
a.length > 0 ? a : ['']
|
16
|
-
end
|
17
|
-
end
|
data/lib/githelp/branches.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Githelp
|
4
|
-
def git_branch
|
5
|
-
begin
|
6
|
-
`git branch`
|
7
|
-
rescue
|
8
|
-
nil
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def branches
|
13
|
-
b = git_branch
|
14
|
-
if b
|
15
|
-
b.split(/\n/).map { |line|
|
16
|
-
line.chomp!
|
17
|
-
line.sub(/^../,'')
|
18
|
-
}
|
19
|
-
else
|
20
|
-
[ '##BRANCH##' ]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def branch
|
25
|
-
b = git_branch
|
26
|
-
if b
|
27
|
-
b.split(/\n/).map { |line|
|
28
|
-
line.chomp!
|
29
|
-
if line =~ /^\* (.*)$/ then
|
30
|
-
return $1
|
31
|
-
end
|
32
|
-
}
|
33
|
-
''
|
34
|
-
else
|
35
|
-
''
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
|
data/lib/githelp/changes.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Githelp
|
4
|
-
def git_log_wc(since,file)
|
5
|
-
begin
|
6
|
-
`git log --oneline --since='#{since}' #{file} | wc`
|
7
|
-
rescue
|
8
|
-
nil
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def changed(since)
|
13
|
-
files(true).find_all { |file|
|
14
|
-
wc = git_log_wc(since,file)
|
15
|
-
if wc
|
16
|
-
wc !~ / 0 /
|
17
|
-
else
|
18
|
-
false
|
19
|
-
end
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
def unchanged(since)
|
24
|
-
files(true).find_all { |file|
|
25
|
-
wc = git_log_wc(since,file)
|
26
|
-
if wc
|
27
|
-
wc =~ / 0 /
|
28
|
-
else
|
29
|
-
false
|
30
|
-
end
|
31
|
-
}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
|
data/lib/githelp/files.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
#
|
3
|
-
# 見えるファイル名のリストを作る
|
4
|
-
#
|
5
|
-
|
6
|
-
def files(force=false, argv=ARGV)
|
7
|
-
#
|
8
|
-
# 引数の中にファイル名とマッチするものがあればファイルリストを取得
|
9
|
-
#
|
10
|
-
list = begin
|
11
|
-
`git ls-files`.split(/\n/)
|
12
|
-
rescue
|
13
|
-
[]
|
14
|
-
end
|
15
|
-
matched = false
|
16
|
-
list.each { |file|
|
17
|
-
args.each { |arg|
|
18
|
-
matched = true if file.match arg
|
19
|
-
}
|
20
|
-
}
|
21
|
-
if (argv.length > 0 && matched) || force
|
22
|
-
list
|
23
|
-
else
|
24
|
-
['##DUMMYFILE##']
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|