librime: deployment_tasks.h Source File

| librime 1.2 Rime Input Method Engine, the core library

deployment_tasks.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2012-02-10 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_DEPLOYMENT_TASKS_H_
8#define RIME_DEPLOYMENT_TASKS_H_
9
10#include <rime/common.h>
11#include <rime/deployer.h>
12
13namespace rime {
14
15// detects changes in either user configuration or upgraded shared data
16 class DetectModifications : public DeploymentTask {
17 public:
18 DetectModifications(TaskInitializer arg = TaskInitializer());
19 // Unlike other tasks, its return value indicates whether modifications
20 // has been detected and workspace needs update.
21 bool Run(Deployer* deployer);
22
23 protected:
24 vector<path> data_dirs_;
25};
26
27// initialize/update installation.yaml
28 class RIME_DLL InstallationUpdate : public DeploymentTask {
29 public:
30 InstallationUpdate(TaskInitializer arg = TaskInitializer()) {}
31 bool Run(Deployer* deployer);
32};
33
34// update distributed config files and preset schemas
35 class RIME_DLL WorkspaceUpdate : public DeploymentTask {
36 public:
37 WorkspaceUpdate(TaskInitializer arg = TaskInitializer()) {}
38 bool Run(Deployer* deployer);
39
40 protected:
41 string GetSchemaPath(Deployer* deployer,
42 const string& schema_id,
43 bool prefer_shared_copy);
44};
45
46// update a specific schema, build corresponding dictionary
47 class RIME_DLL SchemaUpdate : public DeploymentTask {
48 public:
49 explicit SchemaUpdate(const path& source_path) : source_path_(source_path) {}
50 SchemaUpdate(TaskInitializer arg);
51 bool Run(Deployer* deployer);
52 void set_verbose(bool verbose) { verbose_ = verbose; }
53
54 protected:
55 path source_path_;
56 bool verbose_ = false;
57};
58
59// update a specific config file
60 class ConfigFileUpdate : public DeploymentTask {
61 public:
62 ConfigFileUpdate(const string& file_name, const string& version_key)
63 : file_name_(file_name), version_key_(version_key) {}
64 ConfigFileUpdate(TaskInitializer arg);
65 bool Run(Deployer* deployer);
66
67 protected:
68 string file_name_;
69 string version_key_;
70};
71
72// for installer
73 class PrebuildAllSchemas : public DeploymentTask {
74 public:
75 PrebuildAllSchemas(TaskInitializer arg = TaskInitializer()) {}
76 bool Run(Deployer* deployer);
77};
78
79// create symlinks to prebuilt dictionaries in user directory
80 class SymlinkingPrebuiltDictionaries : public DeploymentTask {
81 public:
82 SymlinkingPrebuiltDictionaries(TaskInitializer arg = TaskInitializer()) {}
83 bool Run(Deployer* deployer);
84};
85
86// upgrade user dictionaries
87 class UserDictUpgrade : public DeploymentTask {
88 public:
89 UserDictUpgrade(TaskInitializer arg = TaskInitializer()) {}
90 bool Run(Deployer* deployer);
91};
92
93 class UserDictSync : public DeploymentTask {
94 public:
95 UserDictSync(TaskInitializer arg = TaskInitializer()) {}
96 bool Run(Deployer* deployer);
97};
98
99 class BackupConfigFiles : public DeploymentTask {
100 public:
101 BackupConfigFiles(TaskInitializer arg = TaskInitializer()) {}
102 bool Run(Deployer* deployer);
103};
104
105 class CleanupTrash : public DeploymentTask {
106 public:
107 CleanupTrash(TaskInitializer arg = TaskInitializer()) {}
108 bool Run(Deployer* deployer);
109};
110
111 class CleanOldLogFiles : public DeploymentTask {
112 public:
113 CleanOldLogFiles(TaskInitializer arg = TaskInitializer()) {}
114 bool Run(Deployer* deployer);
115};
116
117} // namespace rime
118
119#endif // RIME_DEPLOYMENT_TASKS_H_
deployer.h
common.h
RIME_DLL
#define RIME_DLL
Definition rime_api.h:33
rime
Definition algebra.cc:12
rime::TaskInitializer
std::any TaskInitializer
Definition deployer.h:22
rime::path
Definition common.h:84
rime::DeploymentTask::DeploymentTask
DeploymentTask()=default
rime::Deployer
Definition deployer.h:32
rime::DetectModifications::data_dirs_
vector< path > data_dirs_
Definition deployment_tasks.h:24
rime::DetectModifications::DetectModifications
DetectModifications(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.cc:36
rime::DetectModifications::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:44
rime::InstallationUpdate::InstallationUpdate
InstallationUpdate(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:30
rime::WorkspaceUpdate::WorkspaceUpdate
WorkspaceUpdate(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:37
rime::WorkspaceUpdate::GetSchemaPath
string GetSchemaPath(Deployer *deployer, const string &schema_id, bool prefer_shared_copy)
rime::SchemaUpdate
Definition deployment_tasks.h:47
rime::SchemaUpdate::source_path_
path source_path_
Definition deployment_tasks.h:55
rime::SchemaUpdate::verbose_
bool verbose_
Definition deployment_tasks.h:56
rime::SchemaUpdate::set_verbose
void set_verbose(bool verbose)
Definition deployment_tasks.h:52
rime::SchemaUpdate::SchemaUpdate
SchemaUpdate(const path &source_path)
Definition deployment_tasks.h:49
rime::ConfigFileUpdate::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:431
rime::ConfigFileUpdate::file_name_
string file_name_
Definition deployment_tasks.h:68
rime::ConfigFileUpdate::version_key_
string version_key_
Definition deployment_tasks.h:69
rime::ConfigFileUpdate::ConfigFileUpdate
ConfigFileUpdate(const string &file_name, const string &version_key)
Definition deployment_tasks.h:62
rime::PrebuildAllSchemas::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:454
rime::PrebuildAllSchemas::PrebuildAllSchemas
PrebuildAllSchemas(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:75
rime::SymlinkingPrebuiltDictionaries::SymlinkingPrebuiltDictionaries
SymlinkingPrebuiltDictionaries(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:82
rime::SymlinkingPrebuiltDictionaries::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:472
rime::UserDictUpgrade::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:505
rime::UserDictUpgrade::UserDictUpgrade
UserDictUpgrade(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:89
rime::UserDictSync::UserDictSync
UserDictSync(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:95
rime::UserDictSync::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:522
rime::BackupConfigFiles::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:541
rime::BackupConfigFiles::BackupConfigFiles
BackupConfigFiles(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:101
rime::CleanupTrash::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:588
rime::CleanupTrash::CleanupTrash
CleanupTrash(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:107
rime::CleanOldLogFiles::Run
bool Run(Deployer *deployer)
Definition deployment_tasks.cc:624
rime::CleanOldLogFiles::CleanOldLogFiles
CleanOldLogFiles(TaskInitializer arg=TaskInitializer())
Definition deployment_tasks.h:113