gitloc-joshcheek 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/version.rb +3 -0
- data/lib/gitloc.rb +25 -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: 4b1873f050be3c185343f26b8c3280b35ba138e9
|
4
|
+
data.tar.gz: c85f0aae4d3ba91adab62b1fbfe2fb41ffee5cc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77503d71edf83d1a5d42f89f0806b1114014a171dc295610a752fff235c432cf4cf0d6b508cc8e995bbcbd46a743620f0ec3124b5b75a550d16fd1de1c4411b5
|
7
|
+
data.tar.gz: 4ac211de0fc05b7acf9863c54f07d25b43cd709cc8c0357dcc6f18a52515a20398a013afd236d9dc0f737bb6f9a0e7d5f28236ac52b1b846ea8af0faed3a75fd
|
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-joshcheek'
|
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
|
+
|
4
|
+
require 'gitloc/version'
|
5
|
+
|
6
|
+
class Gitloc
|
7
|
+
def self.call(argv, outstream, errstream)
|
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-joshcheek
|
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
|
- Josh Cheek
|
@@ -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
|