gitloc-JamesMarkWilton 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/bin/gitloc +3 -19
- data/gitloc.gemspec +4 -1
- data/lib/gitloc.rb +24 -0
- data/lib/gitloc/version.rb +3 -0
- data/test/acceptance_test.rb +0 -2
- 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: 05fae6e60fdcfc63d1be2816adcfc6f28a1def49
|
4
|
+
data.tar.gz: 11f5aa66958210e6d4d87a4918ff03dfe6f883f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dc5ecdd2ff1ceafd4942c440bcaaf2802f427d632abb7f08f3bbc8c1bdf7cd52bbb4529528c675d4fc5044e73c8d5def6d068d4b2a91b4a6964aa9b26bf3df1
|
7
|
+
data.tar.gz: 1ad38abeef0c5a0cc6a6af9a4740aaaa804fcb3520fcd1d238961d7b0e406aec2c63e5d48a2eb219cd06dbf3a16626ddb04060190f06389289e79a43508d3bd1
|
data/bin/gitloc
CHANGED
@@ -1,21 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require '
|
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
|
-
gitloc = File.readlines(filename).count { |line| line !~ /^\s*$/ }
|
19
|
-
puts "#{gitloc}\t#{filename}"
|
20
|
-
end
|
21
|
-
}
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'gitloc'
|
5
|
+
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-JamesMarkWilton'
|
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 CodePlatoon Coding Bootcamp, 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
|
+
require 'gitloc/version'
|
4
|
+
|
5
|
+
class Gitloc
|
6
|
+
def self.call(argv, outstream, errstream)
|
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
|
+
gitloc = File.readlines(filename).count { |line| line !~ /^\s*$/ }
|
20
|
+
puts "#{gitloc}\t#{filename}"
|
21
|
+
end
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
data/test/acceptance_test.rb
CHANGED
@@ -6,8 +6,6 @@ RSpec.describe 'gitloc binary' do
|
|
6
6
|
|
7
7
|
it 'takes a git repository and tells me how many lines of code are in each file' do
|
8
8
|
stdout, stderr, exitstatus = Open3.capture3(binpath, repopath)
|
9
|
-
require "pry"
|
10
|
-
binding.pry
|
11
9
|
expect(stdout).to match /2.*?test\/fixtures\/2loc/
|
12
10
|
expect(exitstatus).to be_success
|
13
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitloc-JamesMarkWilton
|
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
|
- James Wilton
|
@@ -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
|
- test/acceptance_test.rb
|
25
27
|
- test/fixtures/2loc
|
26
28
|
homepage: https://github.com/JoshCheek/elective-building-a-gem
|