gitloc-javi-rev 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: 0e1d644445abdf53daf32cd420839b76c49ea345
4
- data.tar.gz: f84fa5479334b60b2a62ea477af6de02c0d8540e
3
+ metadata.gz: e1c41495b609a382d4e6c227a40332c0016ac7e7
4
+ data.tar.gz: 4d53747efd6deabd1650cc733801804166f92769
5
5
  SHA512:
6
- metadata.gz: 4e600bc9e69450d3503c71f510ff746524b8e8bf508fac072ffe40fe54bc135c44b115823134a450e31bc455579b74427260fd48716628f73e7cb1487077fd71
7
- data.tar.gz: 81c0b7ad9ac5d474844d4d435645e7d34ae7ec41336e05f617d4a3f60deef03a751a4aab19e49df6e4e640e083022b79bbd8144d49f8ecdd9ceb6e50d69a5385
6
+ metadata.gz: 1c683358df105590c6cfecd237dcb7f3b4b5a770e25b8d318fb96dc5fa28e5ac99eca70267136e0110f72d7af21e68eeced67fc1ff7e258a4c887580a9e4e385
7
+ data.tar.gz: 6b8489d0d2c53bf2c7b6d0f8fc6d9b87dc10776daafc08c941c083d0cc31aaedf82af5cbdfa53bbb16e2576bc6e9d6aee92dcae0659166b9772bd0968d0907a2
data/Readme.md CHANGED
@@ -8,7 +8,7 @@ Takes a git url, prints out information about how many lines of code it has.
8
8
 
9
9
  The MIT License (MIT)
10
10
 
11
- Copyright (c) 2015 Josh Cheek
11
+ Copyright (c) 2016 Javier Revuelta
12
12
 
13
13
  Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  of this software and associated documentation files (the "Software"), to deal
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)
@@ -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-javi-rev'
4
- s.version = '0.1.0'
7
+ s.version = '0.1.1'
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."
@@ -11,3 +14,5 @@ Gem::Specification.new do |s|
11
14
  s.homepage = 'https://github.com/Javi-Rev/elective-building-a-gem'
12
15
  s.executables << 'gitloc'
13
16
  end
17
+
18
+
@@ -0,0 +1,23 @@
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
+ Dir.mktmpdir { |dir|
9
+ Dir.chdir dir
10
+ out, err, status = Open3.capture3 'git', 'clone', repo, 'cloned'
11
+ unless status.success?
12
+ errstream.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
+ outstream.puts "#{loc}\t#{filename}"
20
+ end
21
+ }
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ class Gitloc
2
+ VERSION = '0.1.1'
3
+ end
@@ -1,12 +1,12 @@
1
1
  require 'open3' # we'll use this to invoke the binary
2
2
 
3
3
  RSpec.describe 'gitloc binary' do
4
- let(:binpath) { File.expand_path '../../bin/gitloc', __FILE__ }
5
- let(:repopath) { File.expand_path '../..', __FILE__ }
4
+ let(:binpath) { File.expand_path '../../bin/gitloc', __FILE__ }
5
+ let(:repopath) { File.expand_path '../..', __FILE__ }
6
6
 
7
- it 'takes a git repository and tells me how many lines of code are in each file' do
8
- stdout, stderr, exitstatus = Open3.capture3(binpath, repopath)
9
- expect(stdout).to match /2.*?spec\/fixtures\/2loc/
10
- expect(exitstatus).to be_success
11
- end
7
+ it 'takes a git repository and tells me how many lines of code are in each file' do
8
+ stdout, stderr, exitstatus = Open3.capture3(binpath, repopath)
9
+ expect(stdout).to match /2.*?spec\/fixtures\/2loc/
10
+ expect(exitstatus).to be_success
11
+ end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitloc-javi-rev
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
  - Javier Revuelta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Example project for the Turing School of Software and Design, see https://github.com/JoshCheek/elective-building-a-gem
14
14
  -- gives lines-of-code information for a git repo.
@@ -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/Javi-Rev/elective-building-a-gem