gitloc-joshcheek 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Readme.md +30 -0
- data/bin/gitloc +21 -0
- data/gitloc.gemspec +12 -0
- data/spec/acceptance_spec.rb +12 -0
- data/spec/fixtures/2loc +2 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6195de997bbb5d3bbe2993824c638456ee250971
|
4
|
+
data.tar.gz: ae621decc4dd278a3d7a09521fd12b9b899431e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2e4df721bc01b22954cfdb6804e33446b1800b847594fdee62ec57cbb534b11b456f4c01765329d1c61a9bb8d793dbb53313b4f11fcda53e529da759b1c49d3f
|
7
|
+
data.tar.gz: 40e2d2f174ee7b5fb9fca3749f6185e02650b17c1b4ec07572b5baaae47811b72d96eba54c56aa2becef099ec5162a3634b6bcfc8e93bae8c3294d233952d691
|
data/Readme.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Gitloc
|
2
|
+
======
|
3
|
+
|
4
|
+
Takes a git url,
|
5
|
+
prints out information about how many lines of code it has.
|
6
|
+
|
7
|
+
[MIT License](http://opensource.org/licenses/MIT)
|
8
|
+
-------------------------------------------------
|
9
|
+
|
10
|
+
The MIT License (MIT)
|
11
|
+
|
12
|
+
Copyright (c) 2015 Josh Cheek
|
13
|
+
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
16
|
+
in the Software without restriction, including without limitation the rights
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
19
|
+
furnished to do so, subject to the following conditions:
|
20
|
+
|
21
|
+
The above copyright notice and this permission notice shall be included in
|
22
|
+
all copies or substantial portions of the Software.
|
23
|
+
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
30
|
+
THE SOFTWARE.
|
data/bin/gitloc
ADDED
@@ -0,0 +1,21 @@
|
|
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
|
+
}
|
data/gitloc.gemspec
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'gitloc-joshcheek'
|
3
|
+
s.version = '0.1.0'
|
4
|
+
s.licenses = ['MIT']
|
5
|
+
s.summary = "Example project -- gives lines-of-code information for a git repo"
|
6
|
+
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."
|
7
|
+
s.authors = ["Josh Cheek"]
|
8
|
+
s.email = 'josh.cheek@gmail.com'
|
9
|
+
s.files = Dir["**/*"].select { |f| File.file? f }
|
10
|
+
s.homepage = 'https://github.com/JoshCheek/elective-building-a-gem'
|
11
|
+
s.executables << 'gitloc'
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'open3' # we'll use this to invoke the binary
|
2
|
+
|
3
|
+
RSpec.describe 'gitloc binary' do
|
4
|
+
let(:binpath) { File.expand_path '../../bin/gitloc', __FILE__ }
|
5
|
+
let(:repopath) { File.expand_path '../..', __FILE__ }
|
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
|
12
|
+
end
|
data/spec/fixtures/2loc
ADDED
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitloc-joshcheek
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Cheek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Example project for the Turing School of Software and Design, see https://github.com/JoshCheek/elective-building-a-gem
|
14
|
+
-- gives lines-of-code information for a git repo.
|
15
|
+
email: josh.cheek@gmail.com
|
16
|
+
executables:
|
17
|
+
- gitloc
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- Readme.md
|
22
|
+
- bin/gitloc
|
23
|
+
- gitloc.gemspec
|
24
|
+
- spec/acceptance_spec.rb
|
25
|
+
- spec/fixtures/2loc
|
26
|
+
homepage: https://github.com/JoshCheek/elective-building-a-gem
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.4.1
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: Example project -- gives lines-of-code information for a git repo
|
50
|
+
test_files: []
|
51
|
+
has_rdoc:
|