3 #include <bbtkInterpreter.h>
4 #include <bbtkConfigurationFile.h>
5 #include <bbtkUtilities.h>
7 //==========================================================================
8 void RegenerateDoc ( bbtk::Package::Pointer p, std::string& doc_path )
11 std::string pack_name(p->GetName());
12 std::string pack_path = doc_path + pack_name;
14 if ( ! bbtk::Utilities::FileExists(pack_path) )
16 std::string command("mkdir \"" +pack_path+ "\"");
17 system( command.c_str() );
19 std::string pack_index(pack_path);
20 pack_index += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
21 pack_index += "index.html";
23 std::cout << "* Generating doc for package '"<<pack_name<<"' in "
24 << pack_index << std::endl;
26 p->SetDocURL(pack_index);
27 p->SetDocRelativeURL("index.html");
30 p->CreateHtmlPage(pack_index,"bbtk",pack_name,"","",0,0,true); //true);
38 std::cout << "usage : bbRegeneratePackageDoc [<package name>|-a] [-q|-v]"
40 << " -a : All packages"<<std::endl
41 << " -q : Quiet"<<std::endl
42 << " -v : Verbose"<<std::endl;
45 //==========================================================================
46 int main(int argc, char **argv)
48 std::string pack("-a");
51 pack = std::string(argv[1]);
55 pack = std::string(argv[1]);
56 std::string param(argv[2]);
57 if (param=="-q") bbtk::MessageManager::SetMessageLevel("max",0);
58 else if (param=="-v") bbtk::MessageManager::SetMessageLevel("all",9);
73 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
74 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
76 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
77 bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
78 I->SetCommandLine(true);
80 //std::cout<<"JCP bbRegeneratePackageDoc.cpp I->InterpretLine( exec freeze_no_error);"<<std::endl;
81 I->InterpretLine( "exec freeze_no_error");
85 I->InterpretLine( "include "+pack);
86 I->InterpretLine( "include "+pack+"-appli");
87 bbtk::Package::Pointer p = I->GetExecuter()->GetFactory()->GetPackage(pack);
88 //std::cout<<"JCP bbRegeneratePackageDoc.cpp RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);"<<std::endl;
89 RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
93 //std::cout<<"JCP bbRegeneratePackageDoc.cpp I->InterpretLine( include );"<<std::endl;
94 I->InterpretLine( "include *");
95 bbtk::Factory::PackageMapType::const_iterator i;
96 for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
97 i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
100 //std::cout<<" if (i->second->GetName()==user) continue;"<<std::endl;
101 if (i->second->GetName()=="user") continue;
102 RegenerateDoc(i->second,doc_path);
106 catch (bbtk::Exception e)
108 std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
111 // JGRR & CM : this kills this never-ending process when it's supposed to!
112 std::cout << "bbRegeneratePackageDoc has finished normally. It will be aborted on purpose."<< std::endl;
117 //==========================================================================