www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - A little project

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
I'd like to propose a small project suggested by Walter. If anyone could 
take this up, it would be great. The project is a small utility program 
that could be a good complement to the likes of rdmd.

The program allows you to play with entire D projects as zip files. It 
takes a zip file, extracts the files if needed, and builds it. Many 
improvements can be easily imagined. I paste below a rudimentary 
prototype that I wrote for Linux. It has many shortcomings; don't hold 
them against me, I wrote that script in less time than it takes "retard" 
to switch from smug to sarcastic.

If anyone would like to take this over, that would be great. Thanks!


Andrei






// Accepted extensions
auto extensions = [ "d", "di", "a", "o" ];

int main(string[] args) {
     // The one and only parameter is the zip file
     auto zip = args[1];
     if (!exists(zip)) {
         stderr.writeln("Zip file missing: `", zip, "'");
         stderr.writeln("Usage: dmdz file.zip");
         return 1;
     }
     // Target directory
     auto tgt = "/tmp/" ~ zip;
     // Binary result is the name of the zip without the .zip
     auto bin = replace(zip, ".zip", "");

     // Was the zip file already extracted? If not, extract it
     if (lastModified(zip) >= lastModified(tgt, d_time.min)) {
         system("mkdir --parents " ~ tgt);
         system("unzip " ~ zip " -d " tgt ~ " >/dev/null");
     }

     // Compile all files with accepted extensions
     auto find = "find . -type f -false ";
     foreach (ext; extensions) {
         find ~= " -or -iname '*." ~ ext ~ "'";
     }
     return system("cd " ~ tgt ~ " && dmd -of" ~ bin ~ " `eval " ~ find 
~ "`");
}
Feb 03 2010
next sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
I'll volunteer if no one else has

On 02/03/2010 09:01 PM, Andrei Alexandrescu wrote:
 I'd like to propose a small project suggested by Walter. If anyone could
 take this up, it would be great. The project is a small utility program
 that could be a good complement to the likes of rdmd.

 The program allows you to play with entire D projects as zip files. It
 takes a zip file, extracts the files if needed, and builds it. Many
 improvements can be easily imagined. I paste below a rudimentary
 prototype that I wrote for Linux. It has many shortcomings; don't hold
 them against me, I wrote that script in less time than it takes "retard"
 to switch from smug to sarcastic.

 If anyone would like to take this over, that would be great. Thanks!


 Andrei






 // Accepted extensions
 auto extensions = [ "d", "di", "a", "o" ];

 int main(string[] args) {
 // The one and only parameter is the zip file
 auto zip = args[1];
 if (!exists(zip)) {
 stderr.writeln("Zip file missing: `", zip, "'");
 stderr.writeln("Usage: dmdz file.zip");
 return 1;
 }
 // Target directory
 auto tgt = "/tmp/" ~ zip;
 // Binary result is the name of the zip without the .zip
 auto bin = replace(zip, ".zip", "");

 // Was the zip file already extracted? If not, extract it
 if (lastModified(zip) >= lastModified(tgt, d_time.min)) {
 system("mkdir --parents " ~ tgt);
 system("unzip " ~ zip " -d " tgt ~ " >/dev/null");
 }

 // Compile all files with accepted extensions
 auto find = "find . -type f -false ";
 foreach (ext; extensions) {
 find ~= " -or -iname '*." ~ ext ~ "'";
 }
 return system("cd " ~ tgt ~ " && dmd -of" ~ bin ~ " `eval " ~ find ~ "`");
 }
Feb 04 2010
prev sibling parent torhu <no spam.invalid> writes:
superretard, is it?
Feb 04 2010