gitloc-Vince 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 -21
- data/gitloc.gemspec +4 -1
- data/lib/gitloc.rb +24 -0
- data/lib/gitloc/version.rb +3 -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: c835d21d8d2cc712fa6705a5ef4c6fd8573840fe
|
4
|
+
data.tar.gz: aef59e724bc28e2a25a58f678bc6227218bcad43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1874657b0f8ebbd8aa495d90504a08bc60b0fad4f724d55ee90a9ae2eeb5be0a82c5754d9ada337e2bad60a8f9b119c16dfc7f8b2f71537c2aa6f2224468f010
|
7
|
+
data.tar.gz: 7246dd5ecc2c6c44f50360d6d91af2923dcd7dad514e48b0b76c801946f3e08043ccf2a95230da0137287ba3b1f74001e4d84ff74487987c0d9b10a2c6d51ba3
|
data/bin/gitloc
CHANGED
@@ -1,23 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'open3'
|
6
|
-
|
7
|
-
repo = ARGV.first
|
8
|
-
|
9
|
-
Dir.mktmpdir { |dir|
|
10
|
-
Dir.chdir dir
|
11
|
-
out, err, status = Open3.capture3 'git', 'clone', repo, 'cloned'
|
12
|
-
unless status.success?
|
13
|
-
$stderr.puts out, err
|
14
|
-
exit "Failed somehow >.<"
|
15
|
-
end
|
16
|
-
Dir.chdir 'cloned'
|
17
|
-
files = Dir['**/*'].reject { |name| File.directory? name }
|
18
|
-
files.each do |filename|
|
19
|
-
loc = File.readlines(filename).count { |line| line !~ /^\s*$/ }
|
20
|
-
puts "#{loc}\t#{filename}"
|
21
|
-
end
|
22
|
-
}
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'gitloc'
|
4
|
+
Gitloc.call(ARGV, $stdout, $stderr)
|
23
5
|
|
data/gitloc.gemspec
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
require 'gitloc/version'
|
3
|
+
|
1
4
|
#nformation, not mine :)
|
2
5
|
Gem::Specification.new do |s|
|
3
6
|
s.name = 'gitloc-Vince'
|
4
|
-
s.version =
|
7
|
+
s.version = Gitloc::VERSION
|
5
8
|
s.licenses = ['MIT']
|
6
9
|
s.summary = "Example project -- gives lines-of-code information for a git repo"
|
7
10
|
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,24 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
require 'gitloc/version'
|
5
|
+
|
6
|
+
class Gitloc
|
7
|
+
def self.call(argv, outstream, errstream)
|
8
|
+
repo = argv.first
|
9
|
+
Dir.mktmpdir { |dir|
|
10
|
+
Dir.chdir dir
|
11
|
+
out, err, status = Open3.capture3 'git', 'clone', repo, 'cloned'
|
12
|
+
unless status.success?
|
13
|
+
errstream.puts out, err
|
14
|
+
exit "Failed somehow >.<"
|
15
|
+
end
|
16
|
+
Dir.chdir 'cloned'
|
17
|
+
files = Dir['**/*'].reject { |name| File.directory? name }
|
18
|
+
files.each do |filename|
|
19
|
+
loc = File.readlines(filename).count { |line| line !~ /^\s*$/ }
|
20
|
+
outstream.puts "#{loc}\t#{filename}"
|
21
|
+
end
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitloc-Vince
|
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
|
- Vince
|
@@ -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
|
- seeing_is_believing-2.2.0.gem
|
25
27
|
- spec/acceptance_spec.rb
|
26
28
|
- spec/fixtures/2loc
|