gitloc-GregGlover 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: 30216442c16dddb7e9af8e8576462bc376726b22
4
- data.tar.gz: f7c6652e0237d9e39db6b2be92354874228ae71b
3
+ metadata.gz: 56ef4b5c662f2802e03df0ae032b41d26eb15810
4
+ data.tar.gz: 5c3a45efe0428448c22ea5685e8015a5c0904f51
5
5
  SHA512:
6
- metadata.gz: 3c2bde8bd3e97d63368a2d0c956e388a5ffc414e2f712c8bc9c68e2f10bdaf497a106846e39d5688ac0530d04c487e829bfea6fed1acb24f8aa370c0a2b9c67b
7
- data.tar.gz: 1148448276f432809cb45019642d89c2ae78d596a10f75a98276ae7832681546823e6ff2eafb315c264f16a691bc7234cd3d4a3e2ebddbcb2aeec6f9606aede6
6
+ metadata.gz: 77fbb7cde49d4b60ca8b721d875c5f9d52c630648ef4b378c358f95bf7d2431a09d8ed260f785062bc2e07bd0350a52300462e5b791ff1ebfdd6e655f818638f
7
+ data.tar.gz: 98a53862d53504f0c8a91d6c00c4e4f2bcd06f10f0d9e6d0d2a3411feb309edf9c944037bc3d5137b7e43dd27e8dec146c3217d203fad4ec10809beb7b44835d
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,7 +1,10 @@
1
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
+ require 'gitloc/version'
3
+
1
4
  # update to match your information, not mine :)
2
5
  Gem::Specification.new do |s|
3
6
  s.name = 'gitloc-GregGlover'
4
- s.version = '0.1.0'
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
@@ -0,0 +1,4 @@
1
+ class Gitloc
2
+ VERSION = '0.1.1'
3
+ end
4
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitloc-GregGlover
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
  - Greg Glover
@@ -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