josephine 0.0.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 +7 -0
- data/bin/josephine +6 -0
- data/lib/josephine.rb +36 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7a11a2c7ca919b87f51af0fb17e9f0b34301e842
|
4
|
+
data.tar.gz: 7e2a7b94899346c7568ed75256f4f8af0a07bb43
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2749d43fae695bd3101bcb75bd63dc614fe4811e8e7ab749ef6431bd1ce7bd278188b640328bc37a0787cb5cadb3ee923be12856271737bbac1c232ccb7bdf34
|
7
|
+
data.tar.gz: e18be64027e727be5620b23870bd9d28dea66abcc48be9e514f6c081b2e8c22454a07cf6f60fb0d443150494752e3f7bf5aab357d01a1703256441afaccad2b7
|
data/bin/josephine
ADDED
data/lib/josephine.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Josephine
|
2
|
+
|
3
|
+
def count_lines(ext)
|
4
|
+
o = 0 # Number of files
|
5
|
+
n = 0 # Number of lines of code
|
6
|
+
m = 0 # Number of lines of comments
|
7
|
+
# files = Dir.glob('./**/*.' + ext)
|
8
|
+
rubyfile = File.join("**", "*#{ext}")
|
9
|
+
files = Dir.glob(rubyfile)
|
10
|
+
files.each do |f|
|
11
|
+
next if f.index('vendor')
|
12
|
+
next if FileTest.directory?(f)
|
13
|
+
o += 1
|
14
|
+
i = 0
|
15
|
+
lines = []
|
16
|
+
File.new(f).each_line do |line|
|
17
|
+
if line.strip[0] == nil
|
18
|
+
n -= 1
|
19
|
+
next
|
20
|
+
end
|
21
|
+
if line.strip[0] == '#'
|
22
|
+
m += 1
|
23
|
+
next
|
24
|
+
end
|
25
|
+
lines << line
|
26
|
+
i += 1
|
27
|
+
end
|
28
|
+
n += i
|
29
|
+
end
|
30
|
+
puts "#{o.to_s} files."
|
31
|
+
puts "#{n.to_s} lines of code."
|
32
|
+
puts "#{(n.to_f/o.to_f).round(2)} LOC/file."
|
33
|
+
puts "#{m.to_s} lines of comments."
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: josephine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cyrus Ghazanfar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: count the number of code line in you files
|
14
|
+
email: cghazanfar10@gmail.com
|
15
|
+
executables:
|
16
|
+
- josephine
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/josephine
|
21
|
+
- lib/josephine.rb
|
22
|
+
homepage: http://rubygems.org/gems/josephine
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.4.6
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: I <3 Josephine
|
46
|
+
test_files: []
|
47
|
+
has_rdoc:
|