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,true);
30 //==========================================================================
31 int main(int argc, char **argv)
33 std::string pack("*");
37 // TO DO : make a Wx app
38 wxString name = wxGetTextFromUser(_T("Enter package name (* for all)"),
39 _T("Regenerate package doc"),
41 if (name.IsEmpty()) return 0;
42 pack = bbtk::wx2std(name);
47 pack = std::string(argv[1]);
51 std::cout << "usage : bbRegeneratePackageDoc [package-name]" << std::endl;
57 std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
58 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
60 doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
62 bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
63 I->SetCommandLine(true);
65 I->InterpretLine( "exec freeze");
66 I->InterpretLine( "include "+pack);
69 I->InterpretLine( "include "+pack+"-appli");
70 RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
74 bbtk::Factory::PackageMapType::const_iterator i;
75 for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
76 i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
79 RegenerateDoc(i->second,doc_path);
83 catch (bbtk::Exception e)
85 std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
90 //==========================================================================