punchlist 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 568d844bdbe03811439d0da0a9771692dac2d6a4
4
+ data.tar.gz: 53e847e4a97b8e7e98738627ddc17e2fd1ab32d5
5
+ SHA512:
6
+ metadata.gz: c661539cc917dce77c885d8b4b2910500335800fd6e993b82c26c85b1ad6830e766149f23e6de3458956e57ccd87dd7709de7f6df8762ad78f2df1f7041323d1
7
+ data.tar.gz: f4a407e49ae8708bd1323a0d6460d2543b3372f3e7b6d3cb8c4e98880b84971fd4a97d799d1c75b509060d7a3d8747fa9f641a0d0b3b8d821a3a911c87fba540
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Vincent Broz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'quality/rake/task'
4
+
5
+ Quality::Rake::Task.new do |task|
6
+ task.skip_tools = ['reek']
7
+ task.output_dir = 'metrics'
8
+ end
9
+
10
+ desc 'Run specs'
11
+ RSpec::Core::RakeTask.new(:spec) do |task|
12
+ task.pattern = 'spec/**/*_spec.rb'
13
+ task.rspec_opts = '--format doc'
14
+ end
15
+
16
+ desc 'Run features'
17
+ RSpec::Core::RakeTask.new(:feature) do |task|
18
+ task.pattern = 'feature/**/*_spec.rb'
19
+ task.rspec_opts = '--format doc'
20
+ end
21
+
22
+ task :clear_metrics do |_t|
23
+ ret =
24
+ system('git checkout coverage/.last_run.json metrics/*_high_water_mark')
25
+ fail unless ret
26
+ end
27
+
28
+ desc 'Default: Run specs and check quality.'
29
+ task localtest: [:clear_metrics, :spec, :feature, :quality]
30
+ task default: [:localtest]
data/bin/punchlist ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/punchlist'
4
+
5
+ Punchlist::Punchlist.new(ARGV).run
@@ -0,0 +1,5 @@
1
+ # Counts the number of 'todo' comments in your code ('Comment
2
+ # annotations').
3
+ module Punchlist
4
+ VERSION = '0.0.1'
5
+ end
data/lib/punchlist.rb ADDED
@@ -0,0 +1,65 @@
1
+ module Punchlist
2
+ # Counts the number of 'todo' comments in your code.
3
+ class Punchlist
4
+ def initialize(args,
5
+ outputter: STDOUT,
6
+ globber: Dir,
7
+ file_opener: File)
8
+ @args = args
9
+ @outputter = outputter
10
+ @globber = globber
11
+ @file_opener = file_opener
12
+ end
13
+
14
+ def run
15
+ if @args[0] == '--glob'
16
+ @source_files_glob = @args[1]
17
+ elsif @args[0]
18
+ @outputter.puts "USAGE: punchlist\n"
19
+ return 0 # XXX: need to vary return based on good or bad arguments
20
+ end
21
+
22
+ analyze_files
23
+
24
+ 0
25
+ end
26
+
27
+ def source_files_glob
28
+ @source_files_glob ||=
29
+ '{app,lib,test,spec,feature}/**/*.{rb,swift,scala,js,cpp,c,java,py}'
30
+ end
31
+
32
+ def analyze_files
33
+ source_files.each do |filename|
34
+ output = look_for_punchlist_items(filename)
35
+ @outputter.puts render(output)
36
+ end
37
+ end
38
+
39
+ def source_files
40
+ @globber.glob(source_files_glob)
41
+ end
42
+
43
+ def punchlist_line_regexp
44
+ /XXX|TODO/
45
+ end
46
+
47
+ def look_for_punchlist_items(filename)
48
+ lines = []
49
+ line_num = 0
50
+ @file_opener.open(filename, 'r') do |file|
51
+ file.each_line do |line|
52
+ line_num += 1
53
+ lines << [filename, line_num, line] if line =~ punchlist_line_regexp
54
+ end
55
+ end
56
+ lines
57
+ end
58
+
59
+ def render(output)
60
+ output.map do |filename, line_num, line|
61
+ "#{filename}:#{line_num}: #{line}"
62
+ end.join("\n")
63
+ end
64
+ end
65
+ end
data/punchlist.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # ; -*-Ruby-*-
2
+ # -*- encoding: utf-8 -*-
3
+ $LOAD_PATH.push File.join(File.dirname(__FILE__), 'lib')
4
+ require 'punchlist/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'punchlist'
8
+ s.version = Punchlist::VERSION
9
+
10
+ s.authors = ['Vince Broz']
11
+ s.description = 'punchlist finds the largest source files in your project ' \
12
+ 'and reports on them'
13
+ s.email = ['vince@broz.cc']
14
+ s.executables = ['punchlist']
15
+ # s.extra_rdoc_files = ["CHANGELOG", "License.txt"]
16
+ s.license = 'MIT'
17
+ s.files = Dir['License.txt', 'README.md',
18
+ 'Rakefile',
19
+ 'bin/punchlist',
20
+ '{lib}/**/*',
21
+ 'punchlist.gemspec'] & `git ls-files -z`.split("\0")
22
+ # s.rdoc_options = ["--main", "README.md"]
23
+ s.require_paths = ['lib']
24
+ s.homepage = 'http://github.com/apiology/punchlist'
25
+ # s.rubyforge_project = %q{punchlist}
26
+ s.rubygems_version = '1.3.6'
27
+ s.summary = 'Finds largest source files in a project'
28
+
29
+ s.add_development_dependency('bundler')
30
+ s.add_development_dependency('rake')
31
+ s.add_development_dependency('quality')
32
+ s.add_development_dependency('rspec')
33
+ s.add_development_dependency('simplecov')
34
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: punchlist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Vince Broz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: quality
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: punchlist finds the largest source files in your project and reports
84
+ on them
85
+ email:
86
+ - vince@broz.cc
87
+ executables:
88
+ - punchlist
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - License.txt
93
+ - Rakefile
94
+ - bin/punchlist
95
+ - lib/punchlist.rb
96
+ - lib/punchlist/version.rb
97
+ - punchlist.gemspec
98
+ homepage: http://github.com/apiology/punchlist
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.4.6
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Finds largest source files in a project
122
+ test_files: []