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 '"<<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);
31 //==========================================================================
32 int main(int argc, char **argv)
34 std::string pack("-a");
38 // TO DO : make a Wx app
39 wxString name = wxGetTextFromUser(_T("Enter package name (* for all)"),
40 _T("Regenerate package doc"),
42 if (name.IsEmpty()) return 0;
43 pack = bbtk::wx2std(name);
48 pack = std::string(argv[1]);
52 std::cout << "usage : bbRegeneratePackageDoc [<package name>|-a]" << std::endl;
58 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
59 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
61 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
63 bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
64 I->SetCommandLine(true);
66 I->InterpretLine( "exec freeze");
69 I->InterpretLine( "include "+pack);
70 I->InterpretLine( "include "+pack+"-appli");
71 RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
75 I->InterpretLine( "include *");
76 bbtk::Factory::PackageMapType::const_iterator i;
77 for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
78 i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
81 if (i->second->GetName()=="user") continue;
82 RegenerateDoc(i->second,doc_path);
86 catch (bbtk::Exception e)
88 std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
93 //==========================================================================