gitloc-jackyeh 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gitloc +3 -20
- data/gitloc.gemspec +4 -1
- data/lib/gitloc.rb +25 -0
- data/lib/gitloc/version.rb +4 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e2f9e6536af86d8f631fdba80a9616afb904ad1
|
4
|
+
data.tar.gz: 17f5976e30d7b43a6d315e5c6925744f5a64e0e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb9c6e03e5e38b0158904cc9dcbe6b7e591ee01d78cffbbda10f1c1af971ceeea5af171970e8f56fa8ebbdf6403f5d62caa913651a40310d12e48762c0da654
|
7
|
+
data.tar.gz: ae3cd0c824854296fa57ccd877127dbaaae9a0d6f3827cd3f52884f6a98905c5a0df824e44506a2c995debe6f4000453c0285ecfbeb9c17f1624bcef5a1c0e64
|
data/bin/gitloc
CHANGED
@@ -1,21 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
repo = ARGV.first
|
7
|
-
|
8
|
-
Dir.mktmpdir { |dir|
|
9
|
-
Dir.chdir dir
|
10
|
-
out, err, status = Open3.capture3 'git', 'clone', repo, 'cloned'
|
11
|
-
unless status.success?
|
12
|
-
$stderr.puts out, err
|
13
|
-
exit "Failed somehow >.<"
|
14
|
-
end
|
15
|
-
Dir.chdir 'cloned'
|
16
|
-
files = Dir['**/*'].reject { |name| File.directory? name }
|
17
|
-
files.each do |filename|
|
18
|
-
loc = File.readlines(filename).count { |line| line !~ /^\s*$/ }
|
19
|
-
puts "#{loc}\t#{filename}"
|
20
|
-
end
|
21
|
-
}
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'gitloc'
|
4
|
+
Gitloc.call(ARGV, $stdout, $stderr)
|
data/gitloc.gemspec
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
require 'gitloc/version'
|
3
|
+
|
1
4
|
Gem::Specification.new do |s|
|
2
5
|
s.name = 'gitloc-jackyeh'
|
3
|
-
s.version =
|
6
|
+
s.version = Gitloc::VERSION
|
4
7
|
s.licenses = ['MIT']
|
5
8
|
s.summary = "Example project -- gives lines-of-code information for a git repo"
|
6
9
|
s.description = "Example project for the Turing School of Software and Design, see https://github.com/JoshCheek/elective-building-a-gem -- gives lines-of-code information for a git repo."
|
data/lib/gitloc.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'open3'
|
3
|
+
require 'gitloc/version'
|
4
|
+
|
5
|
+
class Gitloc
|
6
|
+
def self.call(argv, outstream, errstream)
|
7
|
+
|
8
|
+
repo = argv.first
|
9
|
+
|
10
|
+
Dir.mktmpdir { |dir|
|
11
|
+
Dir.chdir dir
|
12
|
+
out, err, status = Open3.capture3 'git', 'clone', repo, 'cloned'
|
13
|
+
unless status.success?
|
14
|
+
errstream.puts out, err
|
15
|
+
exit "Failed somehow >.<"
|
16
|
+
end
|
17
|
+
Dir.chdir 'cloned'
|
18
|
+
files = Dir['**/*'].reject { |name| File.directory? name }
|
19
|
+
files.each do |filename|
|
20
|
+
loc = File.readlines(filename).count { |line| line !~ /^\s*$/ }
|
21
|
+
outstream.puts "#{loc}\t#{filename}"
|
22
|
+
end
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitloc-jackyeh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Yeh
|
@@ -21,6 +21,8 @@ files:
|
|
21
21
|
- Readme.md
|
22
22
|
- bin/gitloc
|
23
23
|
- gitloc.gemspec
|
24
|
+
- lib/gitloc.rb
|
25
|
+
- lib/gitloc/version.rb
|
24
26
|
- spec/acceptance_spec.rb
|
25
27
|
- spec/fixtures/2loc
|
26
28
|
homepage: https://github.com/JoshCheek/elective-building-a-gem
|