Sha256: 4c5ca8043b16a36a7cba5032bf08f463a654c47160173a71698328b09da48f0b

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

require 'rails/version'

module ActiveAdmin
  module DependencyChecker
    class << self
      def check!
        if rails_3_1?
          unless meta_search_1_1? && sass_rails_3_1?
            warn "ActiveAdmin requires meta_search >= 1.1.0.pre and sass-rails ~> 3.1.0.rc to work with rails >= 3.1.0"
          end
        end

        if pry_rails_before_0_1_6?
          warn "ActiveAdmin is not compatible with pry-rails < 0.1.6. Please upgrade pry-rails."
        end
      end

      def rails_3_1?
        Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1
      end

      def meta_search_1_1?
        Gem.loaded_specs['meta_search'].version.to_s >= "1.1"
      end

      def sass_rails_3_1?
        require 'sass/rails/version'
        ::Sass::Rails::VERSION >= "3.1"
      rescue LoadError
        false
      end

      def pry_rails_before_0_1_6?
        begin
          PryRails::VERSION < "0.1.6"
        rescue NameError
          false
        end
      end

      def cancan?
        !!Gem.loaded_specs['cancan']
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activeadmin-0.6.6 lib/active_admin/dependency_checker.rb
activeadmin-0.6.5 lib/active_admin/dependency_checker.rb
activeadmin-0.6.4 lib/active_admin/dependency_checker.rb
activeadmin-0.6.3 lib/active_admin/dependency_checker.rb
activeadmin-0.6.2 lib/active_admin/dependency_checker.rb
activeadmin-0.6.1 lib/active_admin/dependency_checker.rb