Class: RailsBestPractices::Reviews::DryBundlerInCapistranoReview
- Inherits:
-
Review
- Object
- Core::Check
- Review
- RailsBestPractices::Reviews::DryBundlerInCapistranoReview
- Defined in:
- lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
Overview
Review config/deploy.rb file to make sure using the bundler’s capistrano recipe.
See the best practice details here rails-bestpractices.com/posts/51-dry-bundler-in-capistrano
Implementation:
Review process:
only check the call nodes to see if there is bundler namespace in config/deploy.rb file,
if the message of call node is :namespace and the arguments of the call node is :bundler,
then it should use bundler's capistrano recipe.
Constant Summary
Constants inherited from Core::Check
Core::Check::CONTROLLER_FILES, Core::Check::HELPER_FILES, Core::Check::MAILER_FILES, Core::Check::MIGRATION_FILES, Core::Check::MODEL_FILES, Core::Check::NODE_TYPES, Core::Check::PARTIAL_VIEW_FILES, Core::Check::ROUTE_FILE, Core::Check::SCHEMA_FILE, Core::Check::VIEW_FILES
Instance Attribute Summary
Attributes inherited from Core::Check
Instance Method Summary collapse
- #interesting_files ⇒ Object
- #interesting_nodes ⇒ Object
-
#start_call(node) ⇒ Object
check call node to see if it is with message :namespace and arguments :bundler.
- #url ⇒ Object
Methods inherited from Review
#equal?, #model_associations, #model_attributes, #models, #remember_variable_use_count, #reset_variable_use_count, #variable, #variable_use_count
Methods inherited from Core::Check
#add_error, #initialize, #method_missing, #node_end, #node_start
Constructor Details
This class inherits a constructor from RailsBestPractices::Core::Check
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RailsBestPractices::Core::Check
Instance Method Details
#interesting_files ⇒ Object
26 27 28 |
# File 'lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb', line 26 def interesting_files /config\/deploy.rb/ end |
#interesting_nodes ⇒ Object
22 23 24 |
# File 'lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb', line 22 def interesting_nodes [:call] end |
#start_call(node) ⇒ Object
check call node to see if it is with message :namespace and arguments :bundler.
the ruby code is
namespace :bundler do
...
end
then the call node is as follows
s(:call, nil, :namespace, s(:arglist, s(:lit, :bundler)))
41 42 43 44 45 |
# File 'lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb', line 41 def start_call(node) if :namespace == node. and equal?(node.arguments[1], "bundler") add_error "dry bundler in capistrano" end end |
#url ⇒ Object
18 19 20 |
# File 'lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb', line 18 def url "http://rails-bestpractices.com/posts/51-dry-bundler-in-capistrano" end |