locat 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.
- data/.ruby +7 -4
 - data/HISTORY.rdoc +11 -0
 - data/README.rdoc +2 -2
 - data/lib/locat/command.rb +24 -1
 - data/lib/locat/gitloc.rb +6 -1
 - data/lib/locat/template.rb +7 -14
 - metadata +19 -7
 
    
        data/.ruby
    CHANGED
    
    | 
         @@ -1,13 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: locat
         
     | 
| 
       3 
     | 
    
         
            -
            version: 0.1. 
     | 
| 
      
 3 
     | 
    
         
            +
            version: 0.1.1
         
     | 
| 
       4 
4 
     | 
    
         
             
            title: LOCat
         
     | 
| 
       5 
5 
     | 
    
         
             
            summary: Lines of Code Attache
         
     | 
| 
       6 
     | 
    
         
            -
            description: LOCat is a customizable  
     | 
| 
      
 6 
     | 
    
         
            +
            description: LOCat is a customizable Lines-Of-Code analysis tool. LOC might not be the most useful metric in the universe, but it still provides useful information and can be a lot of fun.
         
     | 
| 
       7 
7 
     | 
    
         
             
            loadpath: 
         
     | 
| 
       8 
8 
     | 
    
         
             
            - lib
         
     | 
| 
       9 
9 
     | 
    
         
             
            manifest: MANIFEST
         
     | 
| 
       10 
10 
     | 
    
         
             
            requires: 
         
     | 
| 
      
 11 
     | 
    
         
            +
            - name: grit
         
     | 
| 
      
 12 
     | 
    
         
            +
              version: 0+
         
     | 
| 
      
 13 
     | 
    
         
            +
              group: []
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       11 
15 
     | 
    
         
             
            - name: ansi
         
     | 
| 
       12 
16 
     | 
    
         
             
              version: 0+
         
     | 
| 
       13 
17 
     | 
    
         
             
              group: []
         
     | 
| 
         @@ -39,8 +43,7 @@ maintainers: [] 
     | 
|
| 
       39 
43 
     | 
    
         
             
            resources: 
         
     | 
| 
       40 
44 
     | 
    
         
             
              home: http://rubyworks.github.com/locat
         
     | 
| 
       41 
45 
     | 
    
         
             
              code: http://github.com/rubyworks/locat
         
     | 
| 
       42 
     | 
    
         
            -
              docs: http:// 
     | 
| 
       43 
     | 
    
         
            -
              wiki: http://wiki.github.com/rubyworks/locat
         
     | 
| 
      
 46 
     | 
    
         
            +
              docs: http://rubydoc.info/gems/locat/frames
         
     | 
| 
       44 
47 
     | 
    
         
             
              bugs: http://github.com/rubyworks/locat/issues
         
     | 
| 
       45 
48 
     | 
    
         
             
              mail: http://groups.google.com/group/rubyworks-mailinglist
         
     | 
| 
       46 
49 
     | 
    
         
             
            repositories: 
         
     | 
    
        data/HISTORY.rdoc
    ADDED
    
    
    
        data/README.rdoc
    CHANGED
    
    
    
        data/lib/locat/command.rb
    CHANGED
    
    | 
         @@ -18,6 +18,9 @@ module LOCat 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    options[:config] ||= []
         
     | 
| 
       19 
19 
     | 
    
         
             
                    options[:config] << name
         
     | 
| 
       20 
20 
     | 
    
         
             
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  opt.on('-t', '--title TITLE', 'title to put on report' do |title|
         
     | 
| 
      
 22 
     | 
    
         
            +
                    options[:title] = title
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
       21 
24 
     | 
    
         
             
                  opt.on('-D', '--debug', 'run in debug mode') do
         
     | 
| 
       22 
25 
     | 
    
         
             
                    $DEBUG = true
         
     | 
| 
       23 
26 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -42,6 +45,7 @@ module LOCat 
     | 
|
| 
       42 
45 
     | 
    
         
             
                  @output       = nil
         
     | 
| 
       43 
46 
     | 
    
         
             
                  @format       = 'highchart'
         
     | 
| 
       44 
47 
     | 
    
         
             
                  @config       = default_config_files
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @title        = nil
         
     | 
| 
       45 
49 
     | 
    
         | 
| 
       46 
50 
     | 
    
         
             
                  options.each do |k,v|
         
     | 
| 
       47 
51 
     | 
    
         
             
                    send("#{k}=", v)
         
     | 
| 
         @@ -57,6 +61,9 @@ module LOCat 
     | 
|
| 
       57 
61 
     | 
    
         
             
                # List of configuration files.
         
     | 
| 
       58 
62 
     | 
    
         
             
                attr_accessor :config
         
     | 
| 
       59 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
                # List of configuration files.
         
     | 
| 
      
 65 
     | 
    
         
            +
                attr_accessor :title
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       60 
67 
     | 
    
         
             
                # Output file.
         
     | 
| 
       61 
68 
     | 
    
         
             
                attr_reader :output
         
     | 
| 
       62 
69 
     | 
    
         | 
| 
         @@ -87,9 +94,25 @@ module LOCat 
     | 
|
| 
       87 
94 
     | 
    
         
             
                  @counter ||= Counter.new(matcher, :files=>files)
         
     | 
| 
       88 
95 
     | 
    
         
             
                end
         
     | 
| 
       89 
96 
     | 
    
         | 
| 
      
 97 
     | 
    
         
            +
                # Access to .ruby metadata. This only really cares about
         
     | 
| 
      
 98 
     | 
    
         
            +
                # the `title` field (at this point). If no `.ruby` file
         
     | 
| 
      
 99 
     | 
    
         
            +
                # is found, the title is set to the basename of the current
         
     | 
| 
      
 100 
     | 
    
         
            +
                # working directory.
         
     | 
| 
      
 101 
     | 
    
         
            +
                def metadata
         
     | 
| 
      
 102 
     | 
    
         
            +
                  @metadata ||= (
         
     | 
| 
      
 103 
     | 
    
         
            +
                    if File.file?('.ruby')
         
     | 
| 
      
 104 
     | 
    
         
            +
                      data = YAML.load(File.new('.ruby'))
         
     | 
| 
      
 105 
     | 
    
         
            +
                    else
         
     | 
| 
      
 106 
     | 
    
         
            +
                      data = {}
         
     | 
| 
      
 107 
     | 
    
         
            +
                    end
         
     | 
| 
      
 108 
     | 
    
         
            +
                    data['title'] = title if title
         
     | 
| 
      
 109 
     | 
    
         
            +
                    data
         
     | 
| 
      
 110 
     | 
    
         
            +
                  )
         
     | 
| 
      
 111 
     | 
    
         
            +
                end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
       90 
113 
     | 
    
         
             
                #
         
     | 
| 
       91 
114 
     | 
    
         
             
                def template
         
     | 
| 
       92 
     | 
    
         
            -
                  @template ||= Template.new(counter)
         
     | 
| 
      
 115 
     | 
    
         
            +
                  @template ||= Template.new(counter, metadata)
         
     | 
| 
       93 
116 
     | 
    
         
             
                end
         
     | 
| 
       94 
117 
     | 
    
         | 
| 
       95 
118 
     | 
    
         
             
                # Save.
         
     | 
    
        data/lib/locat/gitloc.rb
    CHANGED
    
    
    
        data/lib/locat/template.rb
    CHANGED
    
    | 
         @@ -7,13 +7,17 @@ module LOCat 
     | 
|
| 
       7 
7 
     | 
    
         
             
                DIRECTORY = File.dirname(__FILE__) + '/template'
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                #
         
     | 
| 
       10 
     | 
    
         
            -
                def initialize(counter)
         
     | 
| 
       11 
     | 
    
         
            -
                  @counter 
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(counter, metadata)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @counter  = counter
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @metadata = metadata
         
     | 
| 
       12 
13 
     | 
    
         
             
                end
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
                #
         
     | 
| 
       15 
16 
     | 
    
         
             
                attr :counter
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
                #
         
     | 
| 
      
 19 
     | 
    
         
            +
                attr :metadata
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       17 
21 
     | 
    
         
             
                #
         
     | 
| 
       18 
22 
     | 
    
         
             
                def total
         
     | 
| 
       19 
23 
     | 
    
         
             
                  counter.total
         
     | 
| 
         @@ -64,7 +68,7 @@ module LOCat 
     | 
|
| 
       64 
68 
     | 
    
         | 
| 
       65 
69 
     | 
    
         
             
                #
         
     | 
| 
       66 
70 
     | 
    
         
             
                def title
         
     | 
| 
       67 
     | 
    
         
            -
                  "The LOCat on " + metadata['title']
         
     | 
| 
      
 71 
     | 
    
         
            +
                  "The LOCat on " + (metadata['title'] || File.basename(Dir.pwd))
         
     | 
| 
       68 
72 
     | 
    
         
             
                end
         
     | 
| 
       69 
73 
     | 
    
         | 
| 
       70 
74 
     | 
    
         
             
                #
         
     | 
| 
         @@ -83,17 +87,6 @@ module LOCat 
     | 
|
| 
       83 
87 
     | 
    
         | 
| 
       84 
88 
     | 
    
         
             
                private
         
     | 
| 
       85 
89 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
                # Access to .ruby metadata.
         
     | 
| 
       87 
     | 
    
         
            -
                def metadata
         
     | 
| 
       88 
     | 
    
         
            -
                  @metadata ||= (
         
     | 
| 
       89 
     | 
    
         
            -
                    if File.file?('.ruby')
         
     | 
| 
       90 
     | 
    
         
            -
                      YAML.load(File.new('.ruby'))
         
     | 
| 
       91 
     | 
    
         
            -
                    else
         
     | 
| 
       92 
     | 
    
         
            -
                      {}
         
     | 
| 
       93 
     | 
    
         
            -
                    end
         
     | 
| 
       94 
     | 
    
         
            -
                  )
         
     | 
| 
       95 
     | 
    
         
            -
                end
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
90 
     | 
    
         
             
                #
         
     | 
| 
       98 
91 
     | 
    
         
             
                def __binding__
         
     | 
| 
       99 
92 
     | 
    
         
             
                  binding
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: locat
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors: 
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Thomas Sawyer
         
     | 
| 
         @@ -10,10 +10,10 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            date: 2011-07- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2011-07-10 00:00:00 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       16 
     | 
    
         
            -
              name:  
     | 
| 
      
 16 
     | 
    
         
            +
              name: grit
         
     | 
| 
       17 
17 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       18 
18 
     | 
    
         
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
       19 
19 
     | 
    
         
             
                none: false
         
     | 
| 
         @@ -24,7 +24,7 @@ dependencies: 
     | 
|
| 
       24 
24 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       25 
25 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
       26 
26 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       27 
     | 
    
         
            -
              name:  
     | 
| 
      
 27 
     | 
    
         
            +
              name: ansi
         
     | 
| 
       28 
28 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
       30 
30 
     | 
    
         
             
                none: false
         
     | 
| 
         @@ -32,10 +32,10 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                - - ">="
         
     | 
| 
       33 
33 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       34 
34 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       35 
     | 
    
         
            -
              type: : 
     | 
| 
      
 35 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: *id002
         
     | 
| 
       37 
37 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       38 
     | 
    
         
            -
              name:  
     | 
| 
      
 38 
     | 
    
         
            +
              name: detroit
         
     | 
| 
       39 
39 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       40 
40 
     | 
    
         
             
              requirement: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
       41 
41 
     | 
    
         
             
                none: false
         
     | 
| 
         @@ -45,7 +45,18 @@ dependencies: 
     | 
|
| 
       45 
45 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       46 
46 
     | 
    
         
             
              type: :development
         
     | 
| 
       47 
47 
     | 
    
         
             
              version_requirements: *id003
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 49 
     | 
    
         
            +
              name: qed
         
     | 
| 
      
 50 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 51 
     | 
    
         
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 52 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 53 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 54 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 55 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 56 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 57 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 58 
     | 
    
         
            +
              version_requirements: *id004
         
     | 
| 
      
 59 
     | 
    
         
            +
            description: LOCat is a customizable Lines-Of-Code analysis tool. LOC might not be the most useful metric in the universe, but it still provides useful information and can be a lot of fun.
         
     | 
| 
       49 
60 
     | 
    
         
             
            email: transfire@gmail.com
         
     | 
| 
       50 
61 
     | 
    
         
             
            executables: 
         
     | 
| 
       51 
62 
     | 
    
         
             
            - locat
         
     | 
| 
         @@ -65,6 +76,7 @@ files: 
     | 
|
| 
       65 
76 
     | 
    
         
             
            - lib/locat/template/javascript.js
         
     | 
| 
       66 
77 
     | 
    
         
             
            - lib/locat/template.rb
         
     | 
| 
       67 
78 
     | 
    
         
             
            - lib/locat.rb
         
     | 
| 
      
 79 
     | 
    
         
            +
            - HISTORY.rdoc
         
     | 
| 
       68 
80 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       69 
81 
     | 
    
         
             
            - COPYING.rdoc
         
     | 
| 
       70 
82 
     | 
    
         
             
            homepage: http://rubyworks.github.com/locat
         
     |