garnierjm-dry-report 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ require 'rake/gempackagetask'
|
|
5
5
|
require 'spec/rake/spectask'
|
6
6
|
|
7
7
|
spec = Gem::Specification.new do |s|
|
8
|
-
s.name = '
|
9
|
-
s.version = '0.
|
8
|
+
s.name = 'garnierjm-dry-report'
|
9
|
+
s.version = '0.1'
|
10
10
|
s.has_rdoc = false
|
11
11
|
s.summary = 'Generate duplicate lines report'
|
12
12
|
s.description = s.summary
|
data/TODO
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
Must Have:
|
2
2
|
|
3
|
-
Dev Tasks:
|
4
|
-
-
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
8
|
-
- update http://github.com/garnierjm/dry-report/wikis/home
|
3
|
+
Dev Tasks:
|
4
|
+
- set up CI server http://runcoderun.com/github
|
5
|
+
- DRY plugin source code
|
6
|
+
- fix specs on plugin repo
|
7
|
+
- clean gem code, do not delete crontab plugin!
|
8
|
+
- update http://github.com/garnierjm/dry-report/wikis/home & README (rename it to Textile?)
|
9
|
+
- delete project on rubyforge
|
10
|
+
- communicate: email mailing lists ruby & rails
|
9
11
|
- Add an option for separating HTML/CSS related reports, from JS ones and from Ruby ones.
|
10
|
-
- add geminstaller dependency check (phillipe style) in the rake file:
|
11
|
-
hoe, syntax, rspec, rake
|
12
|
+
- add geminstaller dependency check (phillipe style) in the rake file to run the specs:
|
13
|
+
hoe, syntax, rspec, rake
|
12
14
|
|
13
|
-
Communication Tasks:
|
14
|
-
- new screencast with Netbeans + Autotest + DRY
|
15
|
+
Communication Tasks:
|
15
16
|
- publicize in blogs and plugin sites:
|
16
17
|
. Rails wiki
|
17
18
|
. Rails mailing list, ruby mailing list, citcon mailing list
|
18
19
|
. 2 other Rails plugins sites
|
19
20
|
. wikipedia DRY (also add Simian)
|
20
|
-
. blogs : http://www.google.com/search?q=DRY+Rails&esrch=BetaShortcu
|
21
|
+
. blogs : http://www.google.com/search?q=DRY+Rails&esrch=BetaShortcu
|
22
|
+
. Rails
|
21
23
|
|
22
24
|
Nice to have:
|
23
|
-
|
25
|
+
- new screencast with Netbeans + Autotest + DRY
|
24
26
|
- UML Class & Sequence Diagrams (generated?)
|
25
27
|
- Aptana RadRails report, vim report, other report
|
26
28
|
- Use RR for mocks Reg exp to convert RSpec mocks to RR mocks: dont_allow(@user) do |m| m.$1 end
|
data/lib/dont_repeat_yourself.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
2
|
|
3
3
|
require 'dont_repeat_yourself/cli'
|
4
|
+
require 'dont_repeat_yourself/unit_testing_helpers'
|
4
5
|
|
5
|
-
module DontRepeatYourself
|
6
|
-
|
6
|
+
module DontRepeatYourself
|
7
7
|
end
|
@@ -3,13 +3,7 @@ require 'optparse'
|
|
3
3
|
|
4
4
|
module DontRepeatYourself
|
5
5
|
class CLI
|
6
|
-
|
7
|
-
### Define methods for generating a DRY *_rails_report for Rails project where plugin is installed
|
8
|
-
DEFAULT_REPORT_DESC = "display the default plain report"
|
9
|
-
NETBEANS_REPORT_DESC = "display the report in the Output window of the Netbeans IDE (Ctrl+4)"
|
10
|
-
HTML_REPORT_DESC = "generate an DRY_report.html file in the project root folder"
|
11
|
-
TEXTMATE_REPORT_DESC = "to generate an html report with links which open files in the Textmate editor"
|
12
|
-
|
6
|
+
|
13
7
|
class << self
|
14
8
|
|
15
9
|
def execute
|
@@ -70,7 +70,7 @@ module DontRepeatYourself
|
|
70
70
|
report << report_body.gsub(/TWO_SPACE_CHARS/, " ").gsub(/\n/, "</br>\n")
|
71
71
|
report << report_footer
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def format_duplicate_lines_snippet(block)
|
75
75
|
starts = block.line_number_of_first_duplicate_line
|
76
76
|
ends = block.line_number_of_last_duplicate_line
|
@@ -44,12 +44,16 @@ module DontRepeatYourself
|
|
44
44
|
self
|
45
45
|
end
|
46
46
|
|
47
|
+
def basedir
|
48
|
+
@simian_runner.basedir
|
49
|
+
end
|
50
|
+
|
47
51
|
def report
|
48
52
|
DontRepeatYourself::FormatterFactory.create_report(@report_type, run_simian)
|
49
53
|
end
|
50
54
|
|
51
55
|
# TODO Not very readable: you have to read the code of run_simian to understand
|
52
|
-
def
|
56
|
+
def is_dry?
|
53
57
|
run_simian.duplicate_line_count <= @maximum_number_of_duplicate_lines_i_want_in_my_project
|
54
58
|
end
|
55
59
|
|
@@ -5,18 +5,9 @@ require 'test/unit/assertions'
|
|
5
5
|
module DontRepeatYourself
|
6
6
|
|
7
7
|
module UnitTestingHelpers
|
8
|
-
|
9
|
-
# module RubyAndRailsProjectHelpers
|
8
|
+
|
10
9
|
module RubyProjectHelpers
|
11
|
-
|
12
|
-
# def ruby_code_in_rails_plugin(plugin_name)
|
13
|
-
# DontRepeatYourself::RailsPluginProjectReporter.new(plugin_name)
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# def rails_application
|
17
|
-
# DontRepeatYourself::RailsProjectReporter.new
|
18
|
-
# end
|
19
|
-
|
10
|
+
|
20
11
|
def ruby_project(project_path)
|
21
12
|
DontRepeatYourself::RubyProjectReporter.new(project_path)
|
22
13
|
end
|
@@ -28,7 +19,7 @@ module DontRepeatYourself
|
|
28
19
|
include DontRepeatYourself::UnitTestingHelpers::RubyProjectHelpers
|
29
20
|
|
30
21
|
def assert_dry(project)
|
31
|
-
assert(project.
|
22
|
+
assert(project.is_dry?, project.failure_message)
|
32
23
|
end
|
33
24
|
|
34
25
|
end
|
@@ -39,11 +30,11 @@ module DontRepeatYourself
|
|
39
30
|
|
40
31
|
include DontRepeatYourself::UnitTestingHelpers::RubyProjectHelpers
|
41
32
|
|
42
|
-
class
|
33
|
+
class BeDRYMatcher
|
43
34
|
|
44
35
|
def matches?(project)
|
45
36
|
@project = project
|
46
|
-
@project.
|
37
|
+
@project.is_dry?
|
47
38
|
end
|
48
39
|
|
49
40
|
# TODO Do we really need this? It does not make a lot of sense
|
@@ -52,7 +43,7 @@ module DontRepeatYourself
|
|
52
43
|
end
|
53
44
|
|
54
45
|
def description
|
55
|
-
"
|
46
|
+
"follow the 'Don't Repeat Yourself' principle " << @project.description
|
56
47
|
end
|
57
48
|
|
58
49
|
def failure_message
|
@@ -62,8 +53,8 @@ module DontRepeatYourself
|
|
62
53
|
end
|
63
54
|
|
64
55
|
# Custom expectation matcher
|
65
|
-
def
|
66
|
-
DontRepeatYourself::UnitTestingHelpers::RSpecMatchers::
|
56
|
+
def follow_the_dry_principle
|
57
|
+
DontRepeatYourself::UnitTestingHelpers::RSpecMatchers::BeDRYMatcher.new
|
67
58
|
end
|
68
59
|
|
69
60
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garnierjm-dry-report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Michel Garnier
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-13 00:00:00 -08:00
|
13
13
|
default_executable: dry-report
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|