pike.git / lib / modules / Tools.pmod / Monger.pmod / MongerDeveloper.pike

version» Context lines:

pike.git/lib/modules/Tools.pmod/Monger.pmod/MongerDeveloper.pike:1:   // -*- Pike -*-    - // $Id: MongerDeveloper.pike,v 1.3 2008/01/04 20:51:11 nilsson Exp $ + // $Id: MongerDeveloper.pike,v 1.4 2008/01/13 17:03:13 nilsson Exp $      #pike __REAL_VERSION__    - constant version = ("$Revision: 1.3 $"/" ")[1]; + constant version = ("$Revision: 1.4 $"/" ")[1];   constant description = "MongerDeveloper: the Pike module manger.";      private string default_repository = "http://modules.gotpike.org:8000/xmlrpc/index.pike";   private string default_builddir = getenv("HOME") + "/.monger";   private string repository;   private string builddir;      private int use_force=0;   private int use_local=0;   private string my_command;
pike.git/lib/modules/Tools.pmod/Monger.pmod/MongerDeveloper.pike:60:   //! ($HOME/.monger)   void set_default_directory()   {    builddir = default_builddir;   }      //!   int add_new_version(string module_name, string version,    string changes, string license)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       data->changes = changes;    data->license = license;       return x->new_module_version(module_id, version, data, ({username, password}));      }      //!   int update_version(string module_name, string version,    string|void changes, string|void license)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       if(changes)    data->changes = changes;    if(license)    data->license = license;       return x->update_module_version(module_id, version, data, ({username, password}));      }      //!   int user_change_password(string|void _username, string _newpassword)   { -  mixed e; // for catching errors -  int module_id; -  +     object x = xmlrpc_handler(repository); -  +     if(!_username) _username = username; -  +     return x->user_change_password(_username, _newpassword, ({username, password}));   }      //!   int user_change_email(string|void _username, string _newemail)   { -  mixed e; // for catching errors -  int module_id; -  +     object x = xmlrpc_handler(repository); -  +     if(!_username) _username = username; -  +     return x->user_change_email(_username, _newemail, ({username, password}));   }      //!   int set_version_active(string module_name, string version,    int active)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       return x->set_module_version_active(module_id, version, active,    ({username, password}));      }      //!   int set_module_source(string module_name, string version,    string filename)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       string contents = Stdio.read_file(filename);       if(!contents || !strlen(contents)) error("unable to read file %s.\n", filename);
pike.git/lib/modules/Tools.pmod/Monger.pmod/MongerDeveloper.pike:168:    MIME.encode_base64(contents),    ({username, password}));      }      //!   int set_dependency(string module_name, string version,    string dependency, string min_version, string max_version,    int(0..1) required)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       return x->set_dependency(module_id, version, dependency, min_version,    max_version, required,    ({username, password}));      }      //!   int delete_dependency(string module_name, string version,    string dependency, string min_version, string max_version)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       return x->delete_dependency(module_id, version, dependency, min_version,    max_version,    ({username, password}));      }      //!   array get_dependencies(string module_name, string version)   { -  mixed e; // for catching errors +     int module_id;    mapping data = ([]);       object x = xmlrpc_handler(repository);       module_id=(int)(x->get_module_id(module_name));       array a = x->get_module_dependencies(module_id, version);    foreach(a, mapping r)    if(r->dependency == "0") r->dependency = "Pike";
pike.git/lib/modules/Tools.pmod/Monger.pmod/MongerDeveloper.pike:280:    "use --force --version=ver to force %s of a particular version.\n",    my_command, my_command);       mapping vi = x->get_module_version_info((int)module_id, dv);       return vi + info;   }      private void do_download(string name, string|void version)   { -  mixed e; // for catching errors -  int module_id; -  +     mapping vi = get_module_action_data(name, version);       if(vi->download)    {    write("beginning download of version %s...\n", vi->version);    array rq = Protocols.HTTP.get_url_nice(vi->download);    if(!rq)    exit(1, "download error: unable to access download url\n");    else    {    Stdio.write_file(vi->filename, rq[1]);    write("wrote module to file %s (%d bytes)\n", vi->filename, sizeof(rq[1]));    }    }    else    exit(1, "download error: no download available for this module version.\n");   }      private void do_install(string name, string|void version)   { -  mixed e; // for catching errors -  int module_id; +     int res;       mapping vi = get_module_action_data(name, version);       if(vi->download)    {    original_dir = getcwd();    cd(builddir);       write("beginning download of version %s...\n", vi->version);
pike.git/lib/modules/Tools.pmod/Monger.pmod/MongerDeveloper.pike:413:    {    write("removing directory %s\n", dir);    Stdio.recursive_rm(dir);    }       cd(original_dir);   }      private void do_list(string|void name)   { -  mixed e; // for catching errors +     array results;       object x = xmlrpc_handler(repository);       if(name && strlen(name)) -  { +     results=x->get_modules_match(name); -  } +     else    results=x->get_modules();    -  +     foreach(results, string r) -  { +     write("%s\n", r);   } - } +       string generate_components(string root_directory)   { -  object s; +  Stdio.Stat s = file_stat(root_directory);    -  s = file_stat(root_directory); -  +     if(!s ||!s->isdir)    {    throw(Error.Generic(root_directory + " is not a directory.\n"));    }       array components = ({});    string pdir;       foreach(Filesystem.Traversion(root_directory); string dir; string file)    {