gitloc-chrisluhring 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d00563db3bb22e2c6b077cb839d34f61f3bd2e0b
4
- data.tar.gz: 15a961ac15d82dfea00b68dfe22e2dfda8a82574
3
+ metadata.gz: ffefc72b1a7ffd885d10227712a536aef0b13d4f
4
+ data.tar.gz: 89f879aee6488449196c7289e0a20fea862a962e
5
5
  SHA512:
6
- metadata.gz: 0696f276958d8c6cd3f4f16ce6d97b1cb4e51949fe4b2851daec8e49d52cb9f953c0cba8952e8d112d8bc5acf5d7bd2c6b95e30afa24607902118932bc21ed1b
7
- data.tar.gz: 2c4efd1bce47c02fef2c758baf5855ac3baff4458944a98bcbf52adb6da956f29af728d1d600e524f35646b773773b4b7e8b5c70de21214d7e834ec7829e3d5b
6
+ metadata.gz: 13c39d3bebf691b810cebdd2164d99be6810767d0f85d5c14a7f21f36380bcf2d1f374ffdb2477cbe437d654e6d7b7020db268be0b7ee3bfbe171596c1bacbdb
7
+ data.tar.gz: ed3941e4cab3cb4d2d11878bcb02e90221fd719fb44e81944fe58c9497b4b5c38f53cd739c746af22284bd753878d9ee9a378224c45954d6c766ea86a886f35d
data/bin/gitloc CHANGED
@@ -1,21 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- require 'tmpdir'
4
- require 'open3'
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,10 @@
1
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
+
3
+ require 'gitloc/version'
4
+
1
5
  Gem::Specification.new do |s|
2
6
  s.name = 'gitloc-chrisluhring'
3
- s.version = '0.1.0'
7
+ s.version = Gitloc::VERSION
4
8
  s.licenses = ['MIT']
5
9
  s.summary = "Example project -- gives lines-of-code information for a git repo"
6
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."
@@ -0,0 +1,3 @@
1
+ class Gitloc
2
+ VERSION = '0.1.1'
3
+ end
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-chrisluhring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Luhring
@@ -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
  - logfile
25
27
  - spec/acceptance_spec.rb
26
28
  - spec/fixtures/2loc