locat 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 30139bab3135e5869d5f033601a83cd95a5576e1
4
+ data.tar.gz: d47140e87ede5fe4bec6262035ce50c4fe85771d
5
+ SHA512:
6
+ metadata.gz: 5a9e8bc7d8b8bb360690ab1489b66d618b213ea45a0891e2f4dc71d56ac63e4e03c21e1b4a82e3dc156753debf2590d8c5d0c327f12c80e0f6ea5e20b9ba861a
7
+ data.tar.gz: 20095f2ba61639db03bbfed6716dd6cacccee51d3288ae89c9fe7b4805c594d9deac1e0837f17bb5f2c3a0a8e945688d240eb08fcf58de06aa7e0b8506310c66
data/.index ADDED
@@ -0,0 +1,61 @@
1
+ ---
2
+ revision: 2013
3
+ type: ruby
4
+ sources:
5
+ - var
6
+ authors:
7
+ - name: Trans
8
+ email: transfire@gmail.com
9
+ organizations: []
10
+ requirements:
11
+ - name: grit
12
+ - name: ansi
13
+ - name: json
14
+ - groups:
15
+ - build
16
+ development: true
17
+ name: detroit
18
+ - groups:
19
+ - test
20
+ development: true
21
+ name: qed
22
+ conflicts: []
23
+ alternatives: []
24
+ resources:
25
+ - type: home
26
+ uri: http://rubyworks.github.com/locat
27
+ label: Homepage
28
+ - type: code
29
+ uri: http://github.com/rubyworks/locat
30
+ label: Source Code
31
+ - type: docs
32
+ uri: http://rubydoc.info/gems/locat/frames
33
+ label: Documentation
34
+ - type: bugs
35
+ uri: http://github.com/rubyworks/locat/issues
36
+ label: Issue Tracker
37
+ - type: mail
38
+ uri: http://groups.google.com/group/rubyworks-mailinglist
39
+ label: Mailing List
40
+ repositories:
41
+ - name: upstream
42
+ scm: git
43
+ uri: git://github.com/rubyworks/locat.git
44
+ categories: []
45
+ copyrights:
46
+ - holder: Rubyworks
47
+ year: '2011'
48
+ license: BSD-2-Clause
49
+ customs: []
50
+ paths:
51
+ lib:
52
+ - lib
53
+ name: locat
54
+ title: LOCat
55
+ summary: Lines of Code Attache
56
+ created: '2011-07-07'
57
+ description: LOCat is a customizable Lines-Of-Code analysis tool. LOC might not be
58
+ the most useful metric in the universe, but it still provides useful information
59
+ and can be a lot of fun.
60
+ version: 0.2.3
61
+ date: '2014-01-13'
File without changes
@@ -1,6 +1,18 @@
1
- = RELEASE HISTORY
1
+ # RELEASE HISTORY
2
2
 
3
- == 0.2.0 | 2011-11-04
3
+ ## 0.2.3 | 2014-01-13
4
+
5
+ This is a minor release that deals with a couple of minor issues,
6
+ albeit the issue with a broken grit dependency can cause locat to crash.
7
+
8
+ Changes:
9
+
10
+ * If Grit fails then gracely skip git timeline analysis.
11
+ * Don't try to create logging directory if it already exists.
12
+ * Fix missing YAML requirement.
13
+
14
+
15
+ ## 0.2.0 | 2011-11-04
4
16
 
5
17
  This release upgrades the HighCharts javascript dependency a notch
6
18
  to v2.1.6, and provides a default configuration when none is provided
@@ -12,7 +24,7 @@ Changes:
12
24
  * Update HighCharts dependency to 2.1.6.
13
25
 
14
26
 
15
- == 0.1.2 | 2011-07-11
27
+ ## 0.1.2 | 2011-07-11
16
28
 
17
29
  Doh. Can I not write one line of code with a bug creeping
18
30
  into it! Any how, this release just fixes a typo in the CLI
@@ -24,7 +36,7 @@ Changes:
24
36
  * Set default encoding.
25
37
 
26
38
 
27
- == 0.1.1 | 2011-07-10
39
+ ## 0.1.1 | 2011-07-10
28
40
 
29
41
  This release fixes a few issues reported by friendly cats.
30
42
  It also adds a new command line option to set the document
@@ -38,7 +50,7 @@ Changes:
38
50
  * Add grit dependency. #2
39
51
 
40
52
 
41
- == 0.1.0 | 2011-07-08 | The Cat's Meow
53
+ ## 0.1.0 | 2011-07-08 | The Cat's Meow
42
54
 
43
55
  This is the first release of LOCat a
44
56
  fancy LOC analysis tool.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ BSD-2-Clause License
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are
4
+ permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of
7
+ conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
10
+ of conditions and the following disclaimer in the documentation and/or other materials
11
+ provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY Thomas Sawyer ``AS IS'' AND ANY EXPRESS OR IMPLIED
14
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
15
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Thomas Sawyer OR
16
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
+
@@ -1,19 +1,19 @@
1
- = LOCat
1
+ # LOCat
2
2
 
3
- {Homepage}[http://rubyworks.github.com/locat] |
4
- {Development}[http://github.com/rubyworks/locat] |
5
- {Issue Tracker}[http://github.com/rubyworks/locat/issues] |
6
- {Mailing List}[http://groups.google.com/group/rubyworks-mailinglist]
3
+ [Homepage](http://rubyworks.github.com/locat) |
4
+ [Development](http://github.com/rubyworks/locat) |
5
+ [Issue Tracker](http://github.com/rubyworks/locat/issues) |
6
+ [Mailing List](http://groups.google.com/group/rubyworks-mailinglist)
7
7
 
8
- {<img src="http://travis-ci.org/rubyworks/locat.png" />}[http://travis-ci.org/rubyworks/locat]
8
+ [<img src="http://travis-ci.org/rubyworks/locat.png" />](http://travis-ci.org/rubyworks/locat)
9
9
 
10
10
 
11
- == DESCRIPTION
11
+ ## DESCRIPTION
12
12
 
13
13
  LOCat is a fancy Lines-Of-Code analysis tool.
14
14
 
15
15
 
16
- == SYNOPSIS
16
+ ## SYNOPSIS
17
17
 
18
18
  Define a `.locat` Ruby script in your project, e.g.
19
19
 
@@ -43,12 +43,14 @@ Then run `locat`, e.g.
43
43
 
44
44
  $ locat -o locat.html
45
45
 
46
+ The config file can also be located at `etc/locat.rb` or `config/locat.rb`.
46
47
 
47
- == COPYRIGHT
48
48
 
49
- Copyright (c) 2011 Thomas Sawyer, Rubyworks
49
+ ## COPYRIGHT
50
+
51
+ Copyright (c) 2011 Rubyworks
50
52
 
51
53
  BSD 2-Clause License
52
54
 
53
- See COPYING.rdoc for details.
55
+ See LICENSE.md for details.
54
56
 
data/lib/locat/command.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module LOCat
2
2
 
3
+ require 'yaml'
4
+
3
5
  #
4
6
  def self.cli(*argv)
5
7
  options = {}
@@ -81,7 +83,10 @@ module LOCat
81
83
 
82
84
  #
83
85
  def default_config_files
84
- Dir['.locat{,/*.rb}'].select{ |f| File.file?(f) }
86
+ files = []
87
+ files.concat Dir['.locat{,.rb}']
88
+ files.concat Dir['{etc/,config/}locat.rb']
89
+ files.select{ |f| File.file?(f) }
85
90
  end
86
91
 
87
92
  #
@@ -94,14 +99,14 @@ module LOCat
94
99
  @counter ||= Counter.new(matcher, :files=>files)
95
100
  end
96
101
 
97
- # Access to .ruby metadata. This only really cares about
98
- # the `title` field (at this point). If no `.ruby` file
102
+ # Access to .index metadata. This only really cares about
103
+ # the `title` field (at this point). If no `.index` file
99
104
  # is found, the title is set to the basename of the current
100
105
  # working directory.
101
106
  def metadata
102
107
  @metadata ||= (
103
- if File.file?('.ruby')
104
- data = YAML.load(File.new('.ruby'))
108
+ if File.file?('.index')
109
+ data = YAML.load(File.new('.index'))
105
110
  else
106
111
  data = {}
107
112
  end
@@ -133,7 +138,8 @@ module LOCat
133
138
  #
134
139
  def save_file(text)
135
140
  if output
136
- FileUtils.mkdir_p(File.dirname(output))
141
+ dir = File.dirname(output)
142
+ FileUtils.mkdir_p(dir) unless File.directory?(dir)
137
143
  File.open(File.join(output), 'w') do |f|
138
144
  f << text
139
145
  end
data/lib/locat/counter.rb CHANGED
@@ -121,14 +121,16 @@ module LOCat
121
121
 
122
122
  #
123
123
  def scm
124
- if scm?
124
+ return nil unless scm?
125
+ begin
125
126
  gitloc.timeline_table
126
- else
127
+ rescue
128
+ warn "Can't generate git timeline. Skipping."
127
129
  nil
128
130
  end
129
131
  end
130
132
 
131
- private
133
+ private
132
134
 
133
135
  # Resolve file glob.
134
136
  def resolve_files(pattern)
data/lib/locat/gitloc.rb CHANGED
@@ -42,7 +42,7 @@ module LOCat
42
42
 
43
43
  #
44
44
  def title
45
- "'#{repo.head.name}' branch JavaScript LOC #{@per_day ? 'per day' : 'per commit'}"
45
+ "'#{repo.head.name}' branch LOC #{@per_day ? 'per day' : 'per commit'}"
46
46
  end
47
47
 
48
48
  # Count lines by groups.
metadata CHANGED
@@ -1,71 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Trans
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-11-04 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: grit
16
- requirement: &26222540 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *26222540
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: ansi
27
- requirement: &26255180 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *26255180
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: json
38
- requirement: &26254680 !ruby/object:Gem::Requirement
39
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
- - - ! '>='
45
+ - - '>='
42
46
  - !ruby/object:Gem::Version
43
47
  version: '0'
44
48
  type: :runtime
45
49
  prerelease: false
46
- version_requirements: *26254680
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: detroit
49
- requirement: &26254160 !ruby/object:Gem::Requirement
50
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ! '>='
59
+ - - '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *26254160
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: qed
60
- requirement: &26253640 !ruby/object:Gem::Requirement
61
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
62
72
  requirements:
63
- - - ! '>='
73
+ - - '>='
64
74
  - !ruby/object:Gem::Version
65
75
  version: '0'
66
76
  type: :development
67
77
  prerelease: false
68
- version_requirements: *26253640
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: LOCat is a customizable Lines-Of-Code analysis tool. LOC might not be
70
84
  the most useful metric in the universe, but it still provides useful information
71
85
  and can be a lot of fun.
@@ -75,12 +89,12 @@ executables:
75
89
  - locat
76
90
  extensions: []
77
91
  extra_rdoc_files:
78
- - HISTORY.rdoc
79
- - README.rdoc
80
- - QED.rdoc
81
- - COPYING.rdoc
92
+ - LICENSE.txt
93
+ - README.md
94
+ - HISTORY.md
95
+ - DEMO.md
82
96
  files:
83
- - .ruby
97
+ - .index
84
98
  - bin/locat
85
99
  - lib/locat/command.rb
86
100
  - lib/locat/counter.rb
@@ -91,37 +105,33 @@ files:
91
105
  - lib/locat/template/javascript.js
92
106
  - lib/locat/template.rb
93
107
  - lib/locat.rb
94
- - spec/applique/locat.rb
95
- - spec/fixtures/.locat
96
- - spec/fixtures/lib/example.rb
97
- - spec/testrun.rdoc
98
- - HISTORY.rdoc
99
- - README.rdoc
100
- - QED.rdoc
101
- - COPYING.rdoc
108
+ - README.md
109
+ - HISTORY.md
110
+ - DEMO.md
111
+ - LICENSE.txt
102
112
  homepage: http://rubyworks.github.com/locat
103
113
  licenses:
104
114
  - BSD-2-Clause
115
+ metadata: {}
105
116
  post_install_message:
106
117
  rdoc_options: []
107
118
  require_paths:
108
119
  - lib
109
120
  required_ruby_version: !ruby/object:Gem::Requirement
110
- none: false
111
121
  requirements:
112
- - - ! '>='
122
+ - - '>='
113
123
  - !ruby/object:Gem::Version
114
124
  version: '0'
115
125
  required_rubygems_version: !ruby/object:Gem::Requirement
116
- none: false
117
126
  requirements:
118
- - - ! '>='
127
+ - - '>='
119
128
  - !ruby/object:Gem::Version
120
129
  version: '0'
121
130
  requirements: []
122
131
  rubyforge_project:
123
- rubygems_version: 1.8.10
132
+ rubygems_version: 2.0.3
124
133
  signing_key:
125
- specification_version: 3
134
+ specification_version: 4
126
135
  summary: Lines of Code Attache
127
136
  test_files: []
137
+ has_rdoc:
data/.ruby DELETED
@@ -1,50 +0,0 @@
1
- ---
2
- source:
3
- - meta
4
- authors:
5
- - name: Trans
6
- email: transfire@gmail.com
7
- copyrights:
8
- - holder: Rubyworks
9
- year: '2011'
10
- license: BSD-2-Clause
11
- replacements: []
12
- alternatives: []
13
- requirements:
14
- - name: grit
15
- - name: ansi
16
- - name: json
17
- - name: detroit
18
- groups:
19
- - build
20
- development: true
21
- - name: qed
22
- groups:
23
- - test
24
- development: true
25
- dependencies: []
26
- conflicts: []
27
- repositories:
28
- - uri: git://github.com/rubyworks/locat.git
29
- scm: git
30
- name: upstream
31
- resources:
32
- home: http://rubyworks.github.com/locat
33
- code: http://github.com/rubyworks/locat
34
- docs: http://rubydoc.info/gems/locat/frames
35
- bugs: http://github.com/rubyworks/locat/issues
36
- mail: http://groups.google.com/group/rubyworks-mailinglist
37
- extra: {}
38
- load_path:
39
- - lib
40
- revision: 0
41
- created: '2011-07-07'
42
- summary: Lines of Code Attache
43
- title: LOCat
44
- version: 0.2.0
45
- name: locat
46
- description: LOCat is a customizable Lines-Of-Code analysis tool. LOC might not be
47
- the most useful metric in the universe, but it still provides useful information
48
- and can be a lot of fun.
49
- organization: Rubyworks
50
- date: '2011-11-04'
data/COPYING.rdoc DELETED
@@ -1,30 +0,0 @@
1
- = COPYRIGHT NOTICES
2
-
3
- == LOCat
4
-
5
- Copyright:: (c) 2011 Thomas Sawyer, Rubyworks
6
- License:: BSD-2-Clause
7
- Website:: http://rubyworks.github.com/locat
8
-
9
- Copyright (c) 2011 Thomas Sawyer. All rights reserved.
10
-
11
- Redistribution and use in source and binary forms, with or without modification, are
12
- permitted provided that the following conditions are met:
13
-
14
- 1. Redistributions of source code must retain the above copyright notice, this list of
15
- conditions and the following disclaimer.
16
-
17
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
18
- of conditions and the following disclaimer in the documentation and/or other materials
19
- provided with the distribution.
20
-
21
- THIS SOFTWARE IS PROVIDED BY Thomas Sawyer ``AS IS'' AND ANY EXPRESS OR IMPLIED
22
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
23
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Thomas Sawyer OR
24
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
@@ -1,12 +0,0 @@
1
- require 'locat'
2
- require 'fileutils'
3
-
4
- When 'Given an example ruby project' do
5
- FileUtils.rm 'locat.html' if File.exist?('locat.html')
6
- FileUtils.cp_r(File.dirname(__FILE__) + '/../fixtures/.', '.')
7
- end
8
-
9
- When 'with a `.locat` file' do |text|
10
- File.open('.locat', 'w'){ |f| f << text }
11
- end
12
-
data/spec/fixtures/.locat DELETED
@@ -1,18 +0,0 @@
1
-
2
- match 'lib/**.rb' do |file, line|
3
- case line
4
- when /^\s*#/
5
- 'Comment'
6
- when /^\s*$/
7
- 'Blank'
8
- else
9
- 'Code'
10
- end
11
- end
12
-
13
- match 'test/**.rb' do |file, line|
14
- unless line.strip.empty?
15
- 'Test'
16
- end
17
- end
18
-
@@ -1,7 +0,0 @@
1
- # Just an example
2
- class Example
3
- # example method
4
- def self.example
5
- puts "Surprise! It's an example!"
6
- end
7
- end
data/spec/testrun.rdoc DELETED
@@ -1,21 +0,0 @@
1
- == Test Run
2
-
3
- Given an example ruby project with a `.locat` file:
4
-
5
- match 'lib/**.rb' do |file, line|
6
- case line
7
- when /^\s*#/
8
- 'Comment'
9
- when /^\s*$/
10
- 'Blank'
11
- else
12
- 'Code'
13
- end
14
- end
15
-
16
- Running the locat command should produce the expected HTML file.
17
-
18
- LOCat.cli('--output', 'locat.html')
19
-
20
- File.assert.exist?('locat.html')
21
-