Sha256: 660141638672d28d7ffb83799ebb149479b1c739f0ffe919bcde60f2d5e85b70

Contents?: true

Size: 1.38 KB

Versions: 14

Compression:

Stored size: 1.38 KB

Contents

# encoding: utf-8
require 'rails_best_practices/reviews/review'

module RailsBestPractices
  module Reviews
    # Review config/deploy.rb file to make sure using the bundler's capistrano recipe.
    #
    # See the best practice details here http://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.
    class DryBundlerInCapistranoReview < Review
      def url
        "http://rails-bestpractices.com/posts/51-dry-bundler-in-capistrano"
      end

      def interesting_nodes
        [:call]
      end

      def interesting_files
        /config\/deploy.rb/
      end

      # 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)))
      def start_call(node)
        if :namespace == node.message and equal?(node.arguments[1], "bundler")
          add_error "dry bundler in capistrano"
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
rails_best_practices-0.10.1 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.10.0 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-raydog153-0.9.1 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.9.0 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.8.2 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.8.1 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.8.0 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.7.5 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.7.4 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.7.3 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.7.2 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.7.1 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.7.0 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb
rails_best_practices-0.6.7 lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb