3 #include <bbtkInterpreter.h>
4 #include <bbtkConfigurationFile.h>
5 #include <bbtkUtilities.h>
7 //==========================================================================
8 void RegenerateDoc ( bbtk::Package::Pointer p, std::string& doc_path )
10 std::string pack_name(p->GetName());
11 std::string pack_path = doc_path + pack_name;
13 if ( ! bbtk::Utilities::FileExists(pack_path) )
15 std::string command("mkdir \"" +pack_path+ "\"");
16 system( command.c_str() );
18 std::string pack_index(pack_path);
19 pack_index += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
20 pack_index += "index.html";
22 std::cout << "* Generating doc for package '"<<pack_name<<"' in "
23 << pack_index << std::endl;
25 p->SetDocURL(pack_index);
26 p->SetDocRelativeURL("index.html");
27 p->CreateHtmlPage(pack_index,"bbtk",pack_name,"","",0,0,false); //true);
33 std::cout << "usage : bbRegeneratePackageDoc [<package name>|-a] [-q|-v]"
35 << " -a : All packages"<<std::endl
36 << " -q : Quiet"<<std::endl
37 << " -v : Verbose"<<std::endl;
40 //==========================================================================
41 int main(int argc, char **argv)
43 std::string pack("-a");
46 pack = std::string(argv[1]);
50 pack = std::string(argv[1]);
51 std::string param(argv[2]);
52 if (param=="-q") bbtk::MessageManager::SetMessageLevel("max",0);
53 else if (param=="-v") bbtk::MessageManager::SetMessageLevel("all",9);
68 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
69 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
71 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
73 bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
74 I->SetCommandLine(true);
76 I->InterpretLine( "exec freeze_no_error");
79 I->InterpretLine( "include "+pack);
80 I->InterpretLine( "include "+pack+"-appli");
81 RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
85 I->InterpretLine( "include *");
86 bbtk::Factory::PackageMapType::const_iterator i;
87 for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
88 i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
91 if (i->second->GetName()=="user") continue;
92 RegenerateDoc(i->second,doc_path);
96 catch (bbtk::Exception e)
98 std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
103 //==========================================================================