Sha256: d9c428941c073c83cbce063716086d966eb8c210881458b913963ee036eae07e

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module RailsBestPractices
  module Reviews
    # Prepare Gemfile and review Capfile file to make sure using turbo-sprocket-rails3
    #
    # See the best practice details here https://rails-bestpractices.com/posts/2012/11/23/speed-up-assets-precompile-with-turbo-sprockets-rails3/
    #
    # Implementation:
    #
    # Review process:
    #   only check if turbo-sprockets-rails3 gem is not used and load 'deploy/assets' in Capfile.
    class UseTurboSprocketsRails3Review < Review
      interesting_nodes :command
      interesting_files CAPFILE
      url 'https://rails-bestpractices.com/posts/2012/11/23/speed-up-assets-precompile-with-turbo-sprockets-rails3/'

      # check command node to see if load 'deploy/assets'
      add_callback :start_command do |node|
        if Prepares.gems.gem_version('rails').to_i == 3
          if !Prepares.gems.has_gem?('turbo-sprockets-rails3') && node.message.to_s == 'load' &&
               node.arguments.to_s == 'deploy/assets'
            add_error 'speed up assets precompile with turbo-sprockets-rails3'
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_best_practices-1.23.2 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb
rails_best_practices-1.23.1 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb
rails_best_practices-1.23.0 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb
rails_best_practices-1.22.1 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb
rails_best_practices-1.22.0 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb
rails_best_practices-1.21.0 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb
rails_best_practices-1.20.1 lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb