Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

murh

  • Loading branch information...
commit 99400d00c46ae979c84dc4d6fd74b430b63e9910 1 parent 59dbfdb
@holdenk authored
Showing with 32 additions and 26 deletions.
  1. +30 −24 django.pm
  2. +2 −2 php.pm
View
54 django.pm
@@ -3,38 +3,44 @@ use strict;
sub check_django_settings {
my $rt = shift @_;
- #Now days we want full names like django.db.backends.sqlite3
- if ($rt =~ /\'ENGINE\'\s*:\s*\'(sqlite3|mysql|postgresql|oracle)\'/) {
- return 1;
- }
- #DATABASE_FOO has been replaced with
- #DATABASES = {'default':{ 'FOO':'BAZ'},...}
- if ($rt =~ /DATABASE\_(ENGINE|NAME|USER|PASSWORD|HOST|PORT)/) {
- return 1;
+ if ($rt =~ /django/) {
+ #Now days we want full names like django.db.backends.sqlite3
+ if ($rt =~ /\'ENGINE\'\s*:\s*\'(sqlite3|mysql|postgresql|oracle)\'/) {
+ return 1;
+ }
+ #DATABASE_FOO has been replaced with
+ #DATABASES = {'default':{ 'FOO':'BAZ'},...}
+ if ($rt =~ /DATABASE\_(ENGINE|NAME|USER|PASSWORD|HOST|PORT)/) {
+ return 1;
+ }
}
return 0;
}
sub fix_django_settings {
my $rt = shift @_;
- #Now days we want full names like django.db.backends.sqlite3
- if ($rt =~ /\'ENGINE\'\s*:\s*\'(sqlite3|mysql|postgresql|oracle)\'/) {
- $rt =~ s/\'ENGINE\'\s*:\s*\'(sqlite3|mysql|postgresql|oracle)\'/\'ENGINE\':'django.db.backends.$1'/g;
- }
- #DATABASE_FOO has been replaced with
- #DATABASES = {'default':{ 'FOO':'BAZ'},...}
- if ($rt =~ /DATABASE\_(ENGINE|NAME|USER|PASSWORD|HOST|PORT)\s*\=\s*[\'\"]/) {
- my @lines = split /\n/, $rt;
- for (my $j = 0;$j < $#lines; ++$j) {
- #We want to grab all of the DATABASE_ lines sitting together
- my %shineys;
- if ($lines[$j] =~ /DATABASE\_(.*)/) {
- for my ($k = $j; $k < $#lines && $lines[$k] =~ /DATABASE\_(.*?)\s*\=/ ; ++$k) {
- if ($lines[$k] =~ /DATABASES\_(.*?)\s*\=\s*(.*)/) {
- $lines[$k] = "$1 : $2";
+ if ($rt =~ /django/) {
+ #Now days we want full names like django.db.backends.sqlite3
+ if ($rt =~ /\'ENGINE\'\s*:\s*\'(sqlite3|mysql|postgresql|oracle)\'/) {
+ $rt =~ s/\'ENGINE\'\s*:\s*\'(sqlite3|mysql|postgresql|oracle)\'/\'ENGINE\':'django.db.backends.$1'/g;
+ }
+ #DATABASE_FOO has been replaced with
+ #DATABASES = {'default':{ 'FOO':'BAZ'},...}
+ if ($rt =~ /DATABASE\_(ENGINE|NAME|USER|PASSWORD|HOST|PORT)\s*\=\s*[\'\"]/) {
+ my @lines = split /\n/, $rt;
+ for (my $j = 0;$j < $#lines; ++$j) {
+ #We want to grab all of the DATABASE_ lines sitting together
+ my %shineys;
+ if ($lines[$j] =~ /DATABASE\_(.*)/) {
+ for my ($k = $j; $k < $#lines && $lines[$k] =~ /DATABASE\_(.*?)\s*\=/ ; ++$k) {
+ if ($lines[$k] =~ /DATABASES\_(.*?)\s*\=\s*(.*)/) {
+ $lines[$k] = "$1 : $2";
+ }
+ }
}
+
}
+ $rt = join($line,'\n');
}
-
}
return $rt;
}
View
4 php.pm
@@ -34,8 +34,8 @@ sub addFunction {
$file_contents = "include_once(\"$func\.php\");\n".$file_contents;
}
$file_path = dirname($path);
- `cp $phpFunctionDir.$func\.php $file_path`;
- `git add $file_path`;
+ `cp $phpFunctionDir.$func\.php $file_path`;
+ `cd $file_path;git add $func\.php`;
}
Please sign in to comment.
Something went wrong with that request. Please try again.