Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 753b9a0d08
Fetching contributors…

Cannot retrieve contributors at this time

executable file 57 lines (49 sloc) 1.809 kb
* Updates various files with new version number from VERSION. Designed to be run from a hook before git commit.
* Requires ruby and the crxmake gem: gem source -a; sudo gem install crxmake
$version = trim(file_get_contents('VERSION'));
echo "This script builds the Chrome extension only.\n";
echo "Current VERSION is $version. Change? (blank to keep) ";
$stdin = fopen('php://stdin', 'r');
$new_version = trim(fgets($stdin, 100));
if ( !$new_version )
echo "Keeping version at $version.\n";
define('VERSION', $version);
define('VERSION', $new_version);
file_put_contents('VERSION', VERSION."\n");
$files = array(
'updates.xml' => "/(updatecheck.*version=')[\d.]*(')/",
'chromevimbindings.safariextension/manifest.json' => '/("version": ")[\d.]*(",)/',
echo "Updating files to indicate version ".VERSION."...\n";
foreach ( $files as $file => $pattern )
$contents = preg_replace_callback($pattern, function($m) {
return $m[1].VERSION.$m[2];
}, file_get_contents($file));
echo " $file\n";
if ($contents) file_put_contents($file, $contents);
echo "...updated.\n";
echo "Removing old extension...";
system("rm chromevimbindings.crx", $return);
echo ( !$return ) ? "removed.\n" : "FAILED!\n";
echo "Building extension...";
$params = array(
'extension' => 'chromevimbindings.safariextension',
'output_crx' => 'chromevimbindings.crx',
'key_file' => 'chromevimbindings.pem',
system("crxmake --pack-extension={$params['extension']} --extension-output={$params['output_crx']}", $return);
#system("crxmake --pack-extension={$params['extension']} --extension-output={$params['output_crx']} --pack-extension-key={$params['key_file']}", $return);
echo ( !$return ) ? "built.\n" : "FAILED!\n";
Jump to Line
Something went wrong with that request. Please try again.