rails_best_practices 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -22,6 +22,7 @@ By default rails_best_practices will do parse codes in vendor, spec, test and fe
22
22
  -f, --format FORMAT output format
23
23
  --without-color only output plain text without color
24
24
  --with-textmate open file by textmate in html format
25
+ --with-mvim open file by mvim in html format
25
26
  --vendor include vendor files
26
27
  --spec include spec files
27
28
  --test include test files
@@ -54,6 +54,8 @@
54
54
  %td.filename
55
55
  - if textmate
56
56
  %a{:href=>"txmt://open/?url=file://#{File.expand_path(error.filename)}&line=#{error.line_number}"}= error.filename
57
+ - elsif mvim
58
+ %a{:href=>"mvim://open/?url=file://#{File.expand_path(error.filename)}&line=#{error.line_number}"}= error.filename
57
59
  - else
58
60
  = error.filename
59
61
  %td.line-number= error.line_number
@@ -211,7 +211,7 @@ module RailsBestPractices
211
211
  template = File.read(File.join(File.dirname(__FILE__), "..", "assets", "result.html.haml"))
212
212
 
213
213
  File.open("rails_best_practices_output.html", "w+") do |file|
214
- file.puts Haml::Engine.new(template).render(Object.new, :errors => @runner.errors, :textmate => @options["with-textmate"])
214
+ file.puts Haml::Engine.new(template).render(Object.new, :errors => @runner.errors, :textmate => @options["with-textmate"], :mvim => @options["with-mvim"])
215
215
  end
216
216
  end
217
217
  end
@@ -6,6 +6,7 @@ require 'optparse'
6
6
  # -f, --format FORMAT output format
7
7
  # --without-color only output plain text without color
8
8
  # --with-textmate open file by textmate in html format
9
+ # --with-mvim open file by mvim in html format
9
10
  # --vendor include vendor files
10
11
  # --spec include spec files
11
12
  # --test include test files
@@ -35,6 +36,10 @@ OptionParser.new do |opts|
35
36
  options["with-textmate"] = true
36
37
  end
37
38
 
39
+ opts.on("--with-mvim", "open file by mvim in html format") do
40
+ options["with-mvim"] = true
41
+ end
42
+
38
43
  ['vendor', 'spec', 'test', 'features'].each do |pattern|
39
44
  opts.on("--#{pattern}", "include #{pattern} files") do
40
45
  options[pattern] = true
@@ -61,7 +61,7 @@ module RailsBestPractices
61
61
  #
62
62
  # @param [String] filename
63
63
  def lexical_file(filename)
64
- lexical(filename, File.read(filename))
64
+ lexical(filename, File.open(filename, "r:UTF-8") { |f| f.read })
65
65
  end
66
66
 
67
67
  # prepare and review a file's content with filename.
@@ -71,16 +71,16 @@ module RailsBestPractices
71
71
  # content is the source code.
72
72
  [:prepare, :review].each do |process|
73
73
  class_eval <<-EOS
74
- def #{process}(filename, content) # def review(filename, content)
75
- puts filename if @debug # puts filename if @debug
76
- content = parse_erb_or_haml(filename, content) # content = parse_erb_or_haml(filename, content)
77
- node = parse_ruby(filename, content) # node = parse_ruby(filename, content)
78
- node.#{process}(@checker) if node # node.review(@checker) if node
79
- end # end
80
- #
81
- def #{process}_file(filename) # def review_file(filename)
82
- #{process}(filename, File.read(filename)) # review(filename, File.read(filename))
83
- end # end
74
+ def #{process}(filename, content) # def review(filename, content)
75
+ puts filename if @debug # puts filename if @debug
76
+ content = parse_erb_or_haml(filename, content) # content = parse_erb_or_haml(filename, content)
77
+ node = parse_ruby(filename, content) # node = parse_ruby(filename, content)
78
+ node.#{process}(@checker) if node # node.review(@checker) if node
79
+ end # end
80
+ #
81
+ def #{process}_file(filename) # def review_file(filename)
82
+ #{process}(filename, File.open(filename, "r:UTF-8") { |f| f.read }) # review(filename, File.open(filename, "r:UTF-8") { |f| f.read })
83
+ end # end
84
84
  EOS
85
85
  end
86
86
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  module RailsBestPractices
3
- VERSION = "0.7.0"
3
+ VERSION = "0.7.1"
4
4
  end
5
5
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_best_practices
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 0
10
- version: 0.7.0
9
+ - 1
10
+ version: 0.7.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Huang
@@ -15,10 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-15 00:00:00 +08:00
18
+ date: 2011-02-24 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :runtime
22
24
  requirement: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
24
26
  requirements:
@@ -30,11 +32,11 @@ dependencies:
30
32
  - 0
31
33
  - 4
32
34
  version: 2.0.4
33
- prerelease: false
34
35
  version_requirements: *id001
35
- type: :runtime
36
36
  name: ruby_parser
37
37
  - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ type: :runtime
38
40
  requirement: &id002 !ruby/object:Gem::Requirement
39
41
  none: false
40
42
  requirements:
@@ -46,11 +48,11 @@ dependencies:
46
48
  - 0
47
49
  - 9
48
50
  version: 0.0.9
49
- prerelease: false
50
51
  version_requirements: *id002
51
- type: :runtime
52
52
  name: ruby-progressbar
53
53
  - !ruby/object:Gem::Dependency
54
+ prerelease: false
55
+ type: :runtime
54
56
  requirement: &id003 !ruby/object:Gem::Requirement
55
57
  none: false
56
58
  requirements:
@@ -61,11 +63,11 @@ dependencies:
61
63
  - 1
62
64
  - 2
63
65
  version: "1.2"
64
- prerelease: false
65
66
  version_requirements: *id003
66
- type: :runtime
67
67
  name: colored
68
68
  - !ruby/object:Gem::Dependency
69
+ prerelease: false
70
+ type: :runtime
69
71
  requirement: &id004 !ruby/object:Gem::Requirement
70
72
  none: false
71
73
  requirements:
@@ -77,11 +79,11 @@ dependencies:
77
79
  - 6
78
80
  - 6
79
81
  version: 2.6.6
80
- prerelease: false
81
82
  version_requirements: *id004
82
- type: :runtime
83
83
  name: erubis
84
84
  - !ruby/object:Gem::Dependency
85
+ prerelease: false
86
+ type: :runtime
85
87
  requirement: &id005 !ruby/object:Gem::Requirement
86
88
  none: false
87
89
  requirements:
@@ -93,11 +95,11 @@ dependencies:
93
95
  - 0
94
96
  - 18
95
97
  version: 3.0.18
96
- prerelease: false
97
98
  version_requirements: *id005
98
- type: :runtime
99
99
  name: haml
100
100
  - !ruby/object:Gem::Dependency
101
+ prerelease: false
102
+ type: :runtime
101
103
  requirement: &id006 !ruby/object:Gem::Requirement
102
104
  none: false
103
105
  requirements:
@@ -107,11 +109,11 @@ dependencies:
107
109
  segments:
108
110
  - 0
109
111
  version: "0"
110
- prerelease: false
111
112
  version_requirements: *id006
112
- type: :runtime
113
113
  name: i18n
114
114
  - !ruby/object:Gem::Dependency
115
+ prerelease: false
116
+ type: :runtime
115
117
  requirement: &id007 !ruby/object:Gem::Requirement
116
118
  none: false
117
119
  requirements:
@@ -121,11 +123,11 @@ dependencies:
121
123
  segments:
122
124
  - 0
123
125
  version: "0"
124
- prerelease: false
125
126
  version_requirements: *id007
126
- type: :runtime
127
127
  name: activesupport
128
128
  - !ruby/object:Gem::Dependency
129
+ prerelease: false
130
+ type: :development
129
131
  requirement: &id008 !ruby/object:Gem::Requirement
130
132
  none: false
131
133
  requirements:
@@ -135,11 +137,11 @@ dependencies:
135
137
  segments:
136
138
  - 0
137
139
  version: "0"
138
- prerelease: false
139
140
  version_requirements: *id008
140
- type: :development
141
141
  name: rake
142
142
  - !ruby/object:Gem::Dependency
143
+ prerelease: false
144
+ type: :development
143
145
  requirement: &id009 !ruby/object:Gem::Requirement
144
146
  none: false
145
147
  requirements:
@@ -151,11 +153,11 @@ dependencies:
151
153
  - 4
152
154
  - 0
153
155
  version: 2.4.0
154
- prerelease: false
155
156
  version_requirements: *id009
156
- type: :development
157
157
  name: rspec
158
158
  - !ruby/object:Gem::Dependency
159
+ prerelease: false
160
+ type: :development
159
161
  requirement: &id010 !ruby/object:Gem::Requirement
160
162
  none: false
161
163
  requirements:
@@ -166,11 +168,11 @@ dependencies:
166
168
  - 0
167
169
  - 6
168
170
  version: "0.6"
169
- prerelease: false
170
171
  version_requirements: *id010
171
- type: :development
172
172
  name: watchr
173
173
  - !ruby/object:Gem::Dependency
174
+ prerelease: false
175
+ type: :development
174
176
  requirement: &id011 !ruby/object:Gem::Requirement
175
177
  none: false
176
178
  requirements:
@@ -182,9 +184,7 @@ dependencies:
182
184
  - 0
183
185
  - 0
184
186
  version: 1.0.0
185
- prerelease: false
186
187
  version_requirements: *id011
187
- type: :development
188
188
  name: bundler
189
189
  description: a code metric tool for rails codes, written in Ruby.
190
190
  email:
@@ -335,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
335
  requirements: []
336
336
 
337
337
  rubyforge_project:
338
- rubygems_version: 1.4.2
338
+ rubygems_version: 1.5.2
339
339
  signing_key:
340
340
  specification_version: 3
341
341
  summary: a code metric tool for rails codes.