gitloc-matthewswan 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: 731cdae18dd18d1159d23ac3ab9d4528d72f1186
4
- data.tar.gz: e6dac46ac6b7295c17cfb3a9901c7c68c789690b
3
+ metadata.gz: f03111984ba5bf6b5cc7021c25319be615d53993
4
+ data.tar.gz: f58cccf412c93dead7ef99dd48120248fac73e28
5
5
  SHA512:
6
- metadata.gz: 6972d3961332576c5d80e7ebfff7e19cb3c0268c78a97312c0e19b6f8487c1b6b743e0f3b65d617af76702665292c18d536f9ab4a01e1c515254ff90fc9bb9c3
7
- data.tar.gz: 8430fdc7fc1931f10b3af39711bd32775ac8c57eee9b717a73d57eba3ceb357ba71f20ee35e717dea32b354e103053f0164f69b3be901fbf1f39e001ab668311
6
+ metadata.gz: 918c4d4b835777bb53f64e5b0164f752790e591397a0aeb23d459567554fc66af1b9a2ed2927fe35178621480e154fa360c030f5b150864f2623b1aca1121a71
7
+ data.tar.gz: 58cc4321c4fa9bb83a0af76e221f52b504226d1219815e2ba6c43f154d993392c3d696ff9b44043c8e6b9e2426ab4a34209da858c00080d03ea14370da556ceb
data/bin/gitloc CHANGED
@@ -1,21 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
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
- }
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+ require 'gitloc'
5
+ Gitloc.call(ARGV, $stdout, $stderr)
data/gitloc.gemspec CHANGED
@@ -1,7 +1,10 @@
1
1
  # update to match your information, not mine :)
2
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
3
+ require 'gitloc/version'
4
+
2
5
  Gem::Specification.new do |s|
3
6
  s.name = 'gitloc-matthewswan'
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,3 @@
1
+ class Gitloc
2
+ VERSION = '0.1.1'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitloc-matthewswan
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
  - Matthew Swan
@@ -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