ramper 0.0.0 → 0.0.1
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.
- data/bin/ramper +45 -0
- data/lib/ramper.rb +35 -2
- metadata +4 -2
data/bin/ramper
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'ramper'
|
3
|
+
|
4
|
+
usage =
|
5
|
+
"######### USAGE ########
|
6
|
+
# ramper [fmc1] [n] #{Ramper.files_with_most_changes_help}
|
7
|
+
# ramper [fmc2] [n] #{Ramper.files_with_most_commit_help}
|
8
|
+
# ramper [s] #{Ramper.stats_help}
|
9
|
+
# ramper [help] this message
|
10
|
+
########################"
|
11
|
+
|
12
|
+
if ARGV.length == 0
|
13
|
+
puts usage
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_n
|
18
|
+
n = 10
|
19
|
+
if ARGV.length == 2
|
20
|
+
if ARGV[1].to_i > 0
|
21
|
+
n = ARGV[1].to_i
|
22
|
+
else
|
23
|
+
puts usage
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
n
|
29
|
+
end
|
30
|
+
|
31
|
+
case ARGV[0]
|
32
|
+
when 'fmc1'
|
33
|
+
Ramper.files_with_most_changes get_n
|
34
|
+
|
35
|
+
when 'fmc2'
|
36
|
+
Ramper.files_with_most_commit get_n
|
37
|
+
|
38
|
+
when 's'
|
39
|
+
Ramper.stats
|
40
|
+
|
41
|
+
else
|
42
|
+
puts usage
|
43
|
+
exit
|
44
|
+
|
45
|
+
end
|
data/lib/ramper.rb
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
class Ramper
|
2
|
-
def self.
|
3
|
-
puts "
|
2
|
+
def self.version
|
3
|
+
puts "0.0.1v"
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.execute(command)
|
7
|
+
puts "#{command}"
|
8
|
+
puts `#{command}`
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.files_with_most_changes_help
|
12
|
+
"Files with most changes"
|
13
|
+
end
|
14
|
+
def self.files_with_most_changes(n)
|
15
|
+
n = n+1 # TODO Hack, Below returns n+1 lines
|
16
|
+
# http://stackoverflow.com/questions/7686582/finding-most-changed-files-in-git
|
17
|
+
execute("git log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -#{n}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.files_with_most_commit_help
|
21
|
+
"Returns top n files with most commit"
|
22
|
+
end
|
23
|
+
def self.files_with_most_commit(n)
|
24
|
+
# http://stackoverflow.com/questions/5669621/git-find-out-which-files-have-had-the-most-commits
|
25
|
+
puts `git rev-list --objects --all | awk '$2' | sort -k2 | uniq -cf1 | sort -rn |
|
26
|
+
while read frequency sample path
|
27
|
+
do
|
28
|
+
[ "blob" == "$(git cat-file -t $sample)" ] && echo -e "$frequency\t$path";
|
29
|
+
done | head -n #{n}`
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.stats_help
|
33
|
+
"Executes rake stats"
|
34
|
+
end
|
35
|
+
def self.stats
|
36
|
+
execute "rake stats"
|
4
37
|
end
|
5
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,11 +13,13 @@ date: 2015-07-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
14
14
|
description: Ramp Up!
|
15
15
|
email: araina@groupon.com
|
16
|
-
executables:
|
16
|
+
executables:
|
17
|
+
- ramper
|
17
18
|
extensions: []
|
18
19
|
extra_rdoc_files: []
|
19
20
|
files:
|
20
21
|
- lib/ramper.rb
|
22
|
+
- bin/ramper
|
21
23
|
homepage: http://rubygems.org/gems/ramper
|
22
24
|
licenses:
|
23
25
|
- Groupon Inc
|