loco 0.0.6 → 0.0.7

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 40da6a3ed7aa1a48189d81c7f5bdf2653e6fb55a
4
+ data.tar.gz: 5093f9e12a141b8d2ade9a3e3876ec14254804a9
5
+ SHA512:
6
+ metadata.gz: f9595f2a0cc5f27c5beddb0ea859ef69fedd515b2224f5b29cd6cbee5dc87282b07bad16815a596b55c4c2af6cff30ffec38f50215b0acbe815dafbbcb395ef9
7
+ data.tar.gz: 9642bb1a7a1799b75ff5db62548e8097bb9fe2369a5093abc56f6abeb53810a76e986742294fc9e108ddc0e516f8929f84c1f6ee00c76e22a252185bb83e2360
data/.loco ADDED
@@ -0,0 +1 @@
1
+ puts "this is the config file"
data/bin/loco CHANGED
@@ -9,20 +9,6 @@ require "loco"
9
9
  settings = "./.loco"
10
10
  load settings if File.exist?(settings)
11
11
 
12
- patterns = {
13
- :all => { :pattern => /.*/ },
14
- :js => { :pattern => /.*\.js$/ },
15
- :rb => { :pattern => /.*\.rb$/ },
16
- :haml => { :pattern => /.*\.haml$/ },
17
- :views => { :pattern => /^app\/views\// },
18
- :app => { :pattern => /^app\// },
19
- :models => { :pattern => /^app\/models\// },
20
- :migrations=> { :pattern => /^db\/migrate\// },
21
- :spec => { :pattern => /^spec\// },
22
- :empty => { :pattern => /.*/, :size => 0 },
23
- :size => { :pattern => /.*/, :size => ARGV[1].to_i }
24
- }
25
-
26
12
  help = {
27
13
  :all => "show loc for all files",
28
14
  :js => "show loc for all .js files",
@@ -34,10 +20,8 @@ help = {
34
20
  :migrations => "show loc for all db/migrate/** files",
35
21
  :spec => "show loc for all spec/** files",
36
22
  :empty => "show details for empty files",
37
- :size => "show details for files of length specified by ENV['SIZE']",
23
+ :size => "show details for files of length specified by ENV['SIZE'] ; e.g. `SIZE=1 loco size` to obtain info about files only 1 line long",
38
24
  :help => "show this help"
39
25
  }
40
26
 
41
- command = (ARGV[0] || "all").to_sym
42
- Loco::Counter.new.analyse_loc patterns[command]
43
-
27
+ Loco::Counter.new.analyse_command ARGV[0]
@@ -23,7 +23,7 @@ module Loco
23
23
  /^public\/fonts/,
24
24
  /\.#.+/,
25
25
  /\.png/,
26
- /\.pdf/,
26
+ /\.pdf$/,
27
27
  /\.ico/,
28
28
  /lib\/tasks\/.+\.txt/,
29
29
  /^README/,
@@ -31,6 +31,20 @@ module Loco
31
31
  /^public\/javascripts\/jquery/
32
32
  ]
33
33
 
34
+ PATTERNS = {
35
+ :all => { :pattern => /.*/ },
36
+ :js => { :pattern => /.*\.js$/ },
37
+ :rb => { :pattern => /.*\.rb$/ },
38
+ :haml => { :pattern => /.*\.haml$/ },
39
+ :views => { :pattern => /^app\/views\// },
40
+ :app => { :pattern => /^app\// },
41
+ :models => { :pattern => /^app\/models\// },
42
+ :migrations=> { :pattern => /^db\/migrate\// },
43
+ :spec => { :pattern => /^spec\// },
44
+ :empty => { :pattern => /.*/, :size => 0 },
45
+ :size => { :pattern => /.*/, :size => ENV["SIZE"].to_i }
46
+ }
47
+
34
48
  def exclude? path
35
49
  EXCLUDE.each { |regex|
36
50
  if path =~ regex
@@ -40,6 +54,11 @@ module Loco
40
54
  false
41
55
  end
42
56
 
57
+ def analyse_command command=nil
58
+ command ||= :all
59
+ analyse_loc PATTERNS[command.to_sym]
60
+ end
61
+
43
62
  def analyse_loc opts={ }
44
63
  regexp = opts[:pattern]
45
64
  @stats = []
@@ -88,3 +107,7 @@ module Loco
88
107
  end
89
108
  end
90
109
  end
110
+
111
+
112
+ def self.load_dot_loco
113
+ end
@@ -8,7 +8,7 @@ module Loco
8
8
 
9
9
  def initialize(path)
10
10
  @path = path
11
- @lines = count_lines(path)
11
+ @lines = File.file?(path) ? count_lines(path) : 0
12
12
  end
13
13
 
14
14
  def blank? str
@@ -1,3 +1,3 @@
1
1
  module Loco
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,20 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
- prerelease:
4
+ version: 0.0.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - Conan Dalton
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-15 00:00:00.000000000 Z
11
+ date: 2020-02-29 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! 'Count lines of code in project files, excluding a bunch of common
15
- defaults, and show (a) for each N, how many files have N lines of code; (b) how
16
- many files of each type and average LOC per file of that type; (c) longest files
17
- and their length '
13
+ description: 'Count lines of code in project files, excluding a bunch of common defaults,
14
+ and show (a) for each N, how many files have N lines of code; (b) how many files
15
+ of each type and average LOC per file of that type; (c) longest files and their
16
+ length '
18
17
  email:
19
18
  - conan@conandalton.net
20
19
  executables:
@@ -22,7 +21,8 @@ executables:
22
21
  extensions: []
23
22
  extra_rdoc_files: []
24
23
  files:
25
- - .gitignore
24
+ - ".gitignore"
25
+ - ".loco"
26
26
  - Gemfile
27
27
  - LICENSE.txt
28
28
  - README.md
@@ -38,26 +38,25 @@ files:
38
38
  homepage: https://github.com/conanite/loco
39
39
  licenses:
40
40
  - MIT
41
+ metadata: {}
41
42
  post_install_message:
42
43
  rdoc_options: []
43
44
  require_paths:
44
45
  - lib
45
46
  required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
47
  requirements:
48
- - - ! '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
- none: false
53
52
  requirements:
54
- - - ! '>='
53
+ - - ">="
55
54
  - !ruby/object:Gem::Version
56
55
  version: '0'
57
56
  requirements: []
58
57
  rubyforge_project:
59
- rubygems_version: 1.8.24
58
+ rubygems_version: 2.5.2.3
60
59
  signing_key:
61
- specification_version: 3
60
+ specification_version: 4
62
61
  summary: Produce statistics concerning numbers of lines of code in project files
63
62
  test_files: []