From 505a6d630ea64f92078a3232aea4d4f07b97001b Mon Sep 17 00:00:00 2001
From: Helior Colorado <me@helior.info>
Date: Mon, 9 Apr 2012 18:39:20 -0700
Subject: [PATCH] Moved implementation of hook_requirements to install file.

---
 respondjs.install |   43 +++++++++++++++++++++++++++++++++++++++++++
 respondjs.module  |   43 -------------------------------------------
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/respondjs.install b/respondjs.install
index 1ff2bd1..0bbfadb 100644
--- a/respondjs.install
+++ b/respondjs.install
@@ -1,6 +1,49 @@
 <?php
 
 /**
+ * Implements hook_requirements().
+ */
+function respondjs_requirements($phase) {
+  $requirements = array();
+  if ($phase == "runtime") {
+    $library_path = respondjs_get_library_file();
+    $requirements['respondjs'] = array(
+      'title' => t('Respond.js script'),
+      'value' => t('Enabled'),
+    );
+    // If CSS aggregated is not enabled, inform users it will not work.
+    if (variable_get('preprocess_css') != 1) {
+      $requirements['respondjs']['value'] = t('Respond.js will not work with CSS aggregation disabled.');
+      if (variable_get('respondjs_quiet', RESPONDJS_QUIET_DEFAULT) == 1) {
+        // If the user disabled the warning, reduce the severity of this requirement.
+        $requirements['respondjs']['severity'] = REQUIREMENT_WARNING;
+        $requirements['respondjs']['description'] = t('The Respond.js module is enabled, but CSS aggregation is disabled. The script cannot function until <a href="@url">CSS agregation is enabled</a>.', array('@url' => url('admin/config/development/performance')));
+      }
+      else {
+        // By default, failure to meet this requirement will result in an admin warning.
+        $requirements['respondjs']['severity'] = REQUIREMENT_ERROR;
+        $requirements['respondjs']['description'] = t('The Respond.js module is enabled, but CSS aggregation is disabled. The script cannot function until <a href="@url1">CSS agregation is enabled</a>. You can <a href="@url2">disable this warning</a>.', array('@url1' => url('admin/config/development/performance'), '@url2' => url('admin/config/media/respondjs')));
+      }
+    }
+    // If Libraries API is enabled but respond.js is not found within the sites/all/libraries folder
+    // report a warning. The module will fall back to its included copy so this isn't a showstopper.
+    if (function_exists('libraries_get_path') && strpos($library_path,'libraries/respondjs') === FALSE) {
+      $requirements['respondjs']['value'] = t('Respond.js is not correctly using Libraries API');
+      $requirements['respondjs']['severity'] = REQUIREMENT_WARNING;
+      $requirements['respondjs']['description'] = t('Please install <a href="https://raw.github.com/scottjehl/Respond/master/respond.min.js">Respond.js</a> in <b>'. libraries_get_path('respondjs') .'</b>. The module is using its included copy at <b>'.drupal_get_path('module','respondjs') .'/lib</b>');
+    }
+    // If the included copy of respond.js has been removed or renamed report an error.
+    // At this point the module cannot function properly.
+    if (!file_exists($library_path)) {
+      $requirements['respondjs']['value'] = t('Respond.js is not correctly installed');
+      $requirements['respondjs']['severity'] = REQUIREMENT_ERROR;
+      $requirements['respondjs']['description'] = t('Please install <a href="https://raw.github.com/scottjehl/Respond/master/respond.min.js">Respond.js</a> in the repsondjs folder under /lib');
+    }
+  }
+  return $requirements;
+}
+
+/**
  * Implements hook_uninstall().
  */
 function respondjs_uninstall() {
diff --git a/respondjs.module b/respondjs.module
index 7467ae1..93313d5 100644
--- a/respondjs.module
+++ b/respondjs.module
@@ -65,49 +65,6 @@ function respondjs_library() {
 }
 
 /**
- * Implements hook_requirements().
- */
-function respondjs_requirements($phase) {
-  $requirements = array();
-  if ($phase == "runtime") {
-    $library_path = respondjs_get_library_file();
-    $requirements['respondjs'] = array(
-      'title' => t('Respond.js script'),
-      'value' => t('Enabled'),
-    );
-    // If CSS aggregated is not enabled, inform users it will not work.
-    if (variable_get('preprocess_css') != 1) {
-      $requirements['respondjs']['value'] = t('Respond.js will not work with CSS aggregation disabled.');
-      if (variable_get('respondjs_quiet', RESPONDJS_QUIET_DEFAULT) == 1) {
-        // If the user disabled the warning, reduce the severity of this requirement.
-        $requirements['respondjs']['severity'] = REQUIREMENT_WARNING;
-        $requirements['respondjs']['description'] = t('The Respond.js module is enabled, but CSS aggregation is disabled. The script cannot function until <a href="@url">CSS agregation is enabled</a>.', array('@url' => url('admin/config/development/performance')));
-      }
-      else {
-        // By default, failure to meet this requirement will result in an admin warning.
-        $requirements['respondjs']['severity'] = REQUIREMENT_ERROR;
-        $requirements['respondjs']['description'] = t('The Respond.js module is enabled, but CSS aggregation is disabled. The script cannot function until <a href="@url1">CSS agregation is enabled</a>. You can <a href="@url2">disable this warning</a>.', array('@url1' => url('admin/config/development/performance'), '@url2' => url('admin/config/media/respondjs')));
-      }
-    }
-    // If Libraries API is enabled but respond.js is not found within the sites/all/libraries folder
-    // report a warning. The module will fall back to its included copy so this isn't a showstopper.
-    if (function_exists('libraries_get_path') && strpos($library_path,'libraries/respondjs') === FALSE) {
-      $requirements['respondjs']['value'] = t('Respond.js is not correctly using Libraries API');
-      $requirements['respondjs']['severity'] = REQUIREMENT_WARNING;
-      $requirements['respondjs']['description'] = t('Please install <a href="https://raw.github.com/scottjehl/Respond/master/respond.min.js">Respond.js</a> in <b>'. libraries_get_path('respondjs') .'</b>. The module is using its included copy at <b>'.drupal_get_path('module','respondjs') .'/lib</b>');
-    }
-    // If the included copy of respond.js has been removed or renamed report an error.
-    // At this point the module cannot function properly.
-    if (!file_exists($library_path)) {
-      $requirements['respondjs']['value'] = t('Respond.js is not correctly installed');
-      $requirements['respondjs']['severity'] = REQUIREMENT_ERROR;
-      $requirements['respondjs']['description'] = t('Please install <a href="https://raw.github.com/scottjehl/Respond/master/respond.min.js">Respond.js</a> in the repsondjs folder under /lib');
-    }
-  }
-  return $requirements;
-}
-
-/**
  * Helper function gets the path to the library directory
  */
 function respondjs_get_library_path() {
-- 
1.7.6

