rails_best_practices 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +5 -1
- data/lib/rails_best_practices.rb +1 -0
- data/lib/rails_best_practices/checks.rb +2 -0
- data/lib/rails_best_practices/checks/add_model_virtual_attribute_check.rb +1 -0
- data/lib/rails_best_practices/checks/always_add_db_index_check.rb +1 -0
- data/lib/rails_best_practices/checks/check.rb +1 -0
- data/lib/rails_best_practices/checks/dry_bundler_in_capistrano_check.rb +27 -0
- data/lib/rails_best_practices/checks/isolate_seed_data_check.rb +1 -0
- data/lib/rails_best_practices/checks/keep_finders_on_their_own_model_check.rb +1 -0
- data/lib/rails_best_practices/checks/law_of_demeter_check.rb +1 -0
- data/lib/rails_best_practices/checks/move_code_into_controller_check.rb +1 -0
- data/lib/rails_best_practices/checks/move_code_into_helper_check.rb +1 -0
- data/lib/rails_best_practices/checks/move_code_into_model_check.rb +1 -0
- data/lib/rails_best_practices/checks/move_finder_to_named_scope_check.rb +1 -0
- data/lib/rails_best_practices/checks/move_model_logic_into_model_check.rb +1 -0
- data/lib/rails_best_practices/checks/needless_deep_nesting_check.rb +1 -0
- data/lib/rails_best_practices/checks/not_use_default_route_check.rb +1 -0
- data/lib/rails_best_practices/checks/overuse_route_customizations_check.rb +1 -0
- data/lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb +1 -0
- data/lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb +1 -0
- data/lib/rails_best_practices/checks/use_before_filter_check.rb +1 -0
- data/lib/rails_best_practices/checks/use_model_association_check.rb +1 -0
- data/lib/rails_best_practices/checks/use_observer_check.rb +1 -0
- data/lib/rails_best_practices/checks/use_scope_access_check.rb +1 -0
- data/lib/rails_best_practices/command.rb +1 -0
- data/lib/rails_best_practices/core.rb +1 -0
- data/lib/rails_best_practices/core/checking_visitor.rb +1 -0
- data/lib/rails_best_practices/core/core_ext.rb +1 -0
- data/lib/rails_best_practices/core/error.rb +1 -0
- data/lib/rails_best_practices/core/runner.rb +3 -0
- data/lib/rails_best_practices/core/visitable_sexp.rb +1 -0
- data/lib/rails_best_practices/version.rb +2 -1
- data/rails_best_practices.yml +1 -0
- metadata +4 -3
data/README.textile
CHANGED
@@ -40,7 +40,7 @@ Wiki: "http://github.com/flyerhzm/rails_best_practices/wiki":http://github.com/f
|
|
40
40
|
h2. Install
|
41
41
|
|
42
42
|
<pre><code>
|
43
|
-
|
43
|
+
gem install rails_best_practices
|
44
44
|
</code></pre>
|
45
45
|
|
46
46
|
*************************************************
|
@@ -84,6 +84,7 @@ MoveCodeIntoControllerCheck: { }
|
|
84
84
|
MoveCodeIntoModelCheck: { }
|
85
85
|
MoveCodeIntoHelperCheck: { array_count: 3 }
|
86
86
|
ReplaceInstanceVariableWithLocalVariableCheck: { }
|
87
|
+
DryBundlerInCapistranoCheck: { }
|
87
88
|
</code></pre>
|
88
89
|
|
89
90
|
*************************************************
|
@@ -121,6 +122,9 @@ h2. Implementation
|
|
121
122
|
## Move code into helper
|
122
123
|
## Replace instance variable with local variable
|
123
124
|
|
125
|
+
* Deployment
|
126
|
+
## Dry bundler in capistrano
|
127
|
+
|
124
128
|
*************************************************
|
125
129
|
|
126
130
|
h2. Contribute
|
data/lib/rails_best_practices.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'rails_best_practices/checks/move_finder_to_named_scope_check'
|
2
3
|
require 'rails_best_practices/checks/use_model_association_check'
|
3
4
|
require 'rails_best_practices/checks/use_scope_access_check'
|
@@ -17,3 +18,4 @@ require 'rails_best_practices/checks/move_code_into_controller_check'
|
|
17
18
|
require 'rails_best_practices/checks/move_code_into_model_check'
|
18
19
|
require 'rails_best_practices/checks/move_code_into_helper_check'
|
19
20
|
require 'rails_best_practices/checks/replace_instance_variable_with_local_variable_check'
|
21
|
+
require 'rails_best_practices/checks/dry_bundler_in_capistrano_check'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rails_best_practices/checks/check'
|
3
|
+
|
4
|
+
module RailsBestPractices
|
5
|
+
module Checks
|
6
|
+
# Check config/deploy.rb file to make sure using the bundler's capistrano recipe.
|
7
|
+
#
|
8
|
+
# Implementation: check the method call,
|
9
|
+
# if there is a call "namespace :bundler", then it should use bundler's capistrano recipe.
|
10
|
+
class DryBundlerInCapistranoCheck < Check
|
11
|
+
|
12
|
+
def interesting_nodes
|
13
|
+
[:call]
|
14
|
+
end
|
15
|
+
|
16
|
+
def interesting_file
|
17
|
+
'config/deploy.rb'
|
18
|
+
end
|
19
|
+
|
20
|
+
def evaluate_start(node)
|
21
|
+
if :namespace == node.message and "bundler" == node.arguments.to_ruby_string
|
22
|
+
add_error "dry bundler in capistrano"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'rubygems'
|
2
3
|
require 'ruby_parser'
|
3
4
|
require 'erb'
|
@@ -24,6 +25,8 @@ module RailsBestPractices
|
|
24
25
|
def check(filename, content)
|
25
26
|
if filename =~ /.*\.erb/
|
26
27
|
content = ERB.new(content).src
|
28
|
+
# remove the coding line which exists in Ruby 1.9
|
29
|
+
content.gsub!(/#coding:US-ASCII\n/, '')
|
27
30
|
end
|
28
31
|
if filename =~ /.*\.haml/
|
29
32
|
require 'haml'
|
data/rails_best_practices.yml
CHANGED
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:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Huang
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/rails_best_practices/checks/move_model_logic_into_model_check.rb
|
139
139
|
- lib/rails_best_practices/checks/not_use_default_route_check.rb
|
140
140
|
- lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb
|
141
|
+
- lib/rails_best_practices/checks/dry_bundler_in_capistrano_check.rb
|
141
142
|
- lib/rails_best_practices/checks/isolate_seed_data_check.rb
|
142
143
|
- lib/rails_best_practices/checks/always_add_db_index_check.rb
|
143
144
|
- lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb
|