Class: SkadateGems::Dev::Remote::ScriptBatch

Inherits:
ExecPHP::ScriptBatch
  • Object
show all
Defined in:
lib/skadategems/dev/remote.rb

Overview

PHP script batch.

Instance Method Summary collapse

Constructor Details

#initializeScriptBatch

Initializes a remote script batch which automatically finds and requires Skadate’s ‘config.php` file.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/skadategems/dev/remote.rb', line 145

def initialize
  super do |script|
    script << <<-PHPSCRIPT
$try_dir = dirname(__FILE__);
while (!(file_exists($config_file = $try_dir . '/internals/config.php')
	|| file_exists($config_file = $try_dir . '/internals/$config.php')))
{
	$prev_dir = $try_dir;
	if ($prev_dir == ($try_dir = dirname($try_dir))) {
		throw new Exception('Error: unable to find a config file');
	}
}

require_once $config_file;

define('DIR_INTERNALS', dirname($config_file) . DIRECTORY_SEPARATOR);
    PHPSCRIPT
  end
end