#include
Inheritance diagram for SequenceRunner:
Public Methods |
|
| ? | SequenceRunner () |
| void? | begin () |
| void? | filter (const cmt_string &line) |
| void? | end () |
Private Attributes |
|
| bool? | started |
| bool? | running |
| cmt_string? | style |
| cmt_string? | vdir |
| cmt_string? | package |
| cmt_string? | version |
| cmt_string? | filename |
| cmt_string? | buffer |
| cmt_string? | pwd |
This is run as follows:
> cd ../demo > cmt run_sequence xxx.cmt
where xxx.cmt is a text file containing descriptions of sequence steps:
sequence_step : package-creation | file-description | package-access | cmt-action | comment
package-creation : "%package"
This creates a package from the current location, at version v1 structuration style is considered. Requirements file follows the statement.
requirements-file : file-contents
file-description : "%file"
Create a files relatively to the last created package.
package-access : "%cdpackage"
Move to the cmt directory of the specified package
cmt-action : "%cmt"
Perform the specified cmt action.
file-contents : line ...
comment : %%% ...
Definition at line 61 of file cmt_sequence.h.
|
| ? |
Definition at line 10 of file cmt_sequence.cxx. 00011 {
00012 }
|
|
| ? |
Reimplemented from Awk. Definition at line 14 of file cmt_sequence.cxx. References buffer, CmtSystem::file_separator(), filename, CmtSystem::getenv(), pwd, running, started, style, and vdir. 00015 {
00016 started = false;
00017 running = false;
00018 if (style == CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"))
00019 {
00020 vdir = CmtSystem::file_separator ();
00021 vdir += "v1";
00022 }
00023 else
00024 {
00025 vdir = "";
00026 }
00027 package = "";
00028 filename = "";
00029 buffer = "";
00030 pwd = "";
00031 }
|
|
| ? |
Reimplemented from Awk. Definition at line 158 of file cmt_sequence.cxx. References buffer, filename, running, and cmt_string::write(). |
|
| ? |
Reimplemented from Awk. Definition at line 33 of file cmt_sequence.cxx. References buffer, CmtSystem::command_separator(), CmtSystem::dirname(), CmtSystem::execute(), CmtSystem::file_separator(), filename, CmtSystem::getenv(), CmtSystem::mkdir(), cmt_string::replace(), running, cmt_vector< cmt_string >::size(), CmtSystem::split(), cmt_string::substr(), and cmt_string::write(). 00034 {
00035 //cout << "line=[" << line << "]" << endl;
00036
00037 CmtSystem::cmt_string_vector words;
00038
00039 CmtSystem::split (line, " \t", words);
00040
00041 cmt_string verb;
00042
00043 if (words.size () > 0) verb = words[0];
00044
00045 if (verb.substr (0, 2) == "%%")
00046 {
00047 if (verb.substr (0, 3) == "%%%") return;
00048
00049 if (running)
00050 {
00051 buffer.write (filename);
00052 cout << "%%Writing file " << filename << endl;
00053 //cout << buffer << endl;
00054 buffer = "";
00055
00056 running = false;
00057 }
00058 }
00059
00060 if (verb == "%%package")
00061 {
00062 package = words[1];
00063 version = words[2];
00064
00065 if (version == "") version = "v1";
00066
00067 cmt_string command = "cmt create ";
00068 command += package;
00069 command += " ";
00070 command += version;
00071
00072 CmtSystem::execute (command);
00073 cout << "%% creating package " << package << " with command [" << command << "]" << endl;
00074
00075 if (style == CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"))
00076 {
00077 vdir = CmtSystem::file_separator ();
00078 vdir += version;
00079 }
00080 else
00081 {
00082 vdir = "";
00083 }
00084
00085 filename = package;
00086 filename += vdir;
00087 filename += CmtSystem::file_separator ();
00088 filename += "cmt";
00089 filename += CmtSystem::file_separator ();
00090 filename += "requirements";
00091
00092 started = true;
00093 }
00094 else if (verb == "%%file")
00095 {
00096 cmt_string file = words[1];
00097
00098 cmt_string d = package;
00099 d += vdir;
00100 d += CmtSystem::file_separator ();
00101 d += file;
00102 CmtSystem::dirname (d, d);
00103
00104 CmtSystem::mkdir (d);
00105 cout << "%% creating directory " << d << endl;
00106
00107 buffer = "";
00108
00109 filename = package;
00110 filename += vdir;
00111 filename += CmtSystem::file_separator ();
00112 filename += file;
00113 started = true;
00114 }
00115 else if (verb == "%%cdpackage")
00116 {
00117 package = words[1];
00118
00119 pwd = package;
00120 pwd += vdir;
00121 pwd += CmtSystem::file_separator ();
00122 pwd += "cmt";
00123 cout << "%% moving to package " << package << endl;
00124 }
00125 else if (verb == "%%cmt")
00126 {
00127 cmt_string command;
00128
00129 if (pwd != "")
00130 {
00131 command = "cd ";
00132 command += pwd;
00133 command += " ";
00134 command += CmtSystem::command_separator ();
00135 command += " ";
00136 }
00137
00138 command += line;
00139 command.replace ("%%", "");
00140
00141 cout << "%% executing cmt command " << line << endl;
00142
00143 CmtSystem::execute (command);
00144 }
00145 else
00146 {
00147 buffer += line;
00148 buffer += "\n";
00149 }
00150
00151 if (started)
00152 {
00153 started = false;
00154 running = true;
00155 }
00156 }
|
|
| ? |
Definition at line 78 of file cmt_sequence.h. Referenced by begin(), end(), and filter(). |
|
| ? |
Definition at line 77 of file cmt_sequence.h. Referenced by begin(), end(), and filter(). |
|
| ? |
Definition at line 75 of file cmt_sequence.h. |
|
| ? |
Definition at line 79 of file cmt_sequence.h. Referenced by begin(). |
|
| ? |
Definition at line 72 of file cmt_sequence.h. Referenced by begin(), end(), and filter(). |
|
| ? |
Definition at line 71 of file cmt_sequence.h. Referenced by begin(). |
|
| ? |
Definition at line 73 of file cmt_sequence.h. Referenced by begin(). |
|
| ? |
Definition at line 74 of file cmt_sequence.h. Referenced by begin(). |
|
| ? |
Definition at line 76 of file cmt_sequence.h. |