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)
49 std::string pack("-a");
52 pack = std::string(argv[1]);
56 pack = std::string(argv[1]);
57 std::string param(argv[2]);
58 if (param=="-q") bbtk::MessageManager::SetMessageLevel("max",0);
59 else if (param=="-v") bbtk::MessageManager::SetMessageLevel("all",9);
74 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
75 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
77 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
79 bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
80 I->SetCommandLine(true);
82 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);
89 RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
93 I->InterpretLine( "include *");
94 bbtk::Factory::PackageMapType::const_iterator i;
95 for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
96 i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
99 if (i->second->GetName()=="user") continue;
100 RegenerateDoc(i->second,doc_path);
104 catch (bbtk::Exception e)
106 std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
111 //==========================================================================