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