File: deployment_tasks.h

package info (click to toggle)
librime 1.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,608 kB
  • ctags: 25,041
  • sloc: cpp: 119,202; sh: 21,794; ansic: 7,346; python: 4,372; makefile: 863; perl: 288; ruby: 50
file content (109 lines) | stat: -rw-r--r-- 2,919 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// Copyleft RIME Developers
// License: GPLv3
//
// 2012-02-10 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_DEPLOYMENT_TASKS_H_
#define RIME_DEPLOYMENT_TASKS_H_

#include <string>
#include <rime/deployer.h>

namespace rime {

// initialize/update installation.yaml, default.yaml
class InstallationUpdate : public DeploymentTask {
 public:
  InstallationUpdate(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

// update distributed config files and preset schemas
class WorkspaceUpdate : public DeploymentTask {
 public:
  WorkspaceUpdate(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);

 protected:
  std::string GetSchemaPath(Deployer* deployer,
                            const std::string& schema_id,
                            bool prefer_shared_copy);
};

// update a specific schema, build corresponding dictionary
class SchemaUpdate : public DeploymentTask {
 public:
  explicit SchemaUpdate(const std::string& schema_file)
      : schema_file_(schema_file), verbose_(false) {}
  SchemaUpdate(TaskInitializer arg);
  bool Run(Deployer* deployer);
  void set_verbose(bool verbose) { verbose_ = verbose; }

 protected:
  std::string schema_file_;
  bool verbose_;
};

// update a specific config file
class ConfigFileUpdate : public DeploymentTask {
 public:
  ConfigFileUpdate(const std::string& file_name,
                   const std::string& version_key)
      : file_name_(file_name), version_key_(version_key) {}
  ConfigFileUpdate(TaskInitializer arg);
  bool Run(Deployer* deployer);

 protected:
  std::string file_name_;
  std::string version_key_;
};

// for installer
class PrebuildAllSchemas : public DeploymentTask {
 public:
  PrebuildAllSchemas(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

// create symlinks to prebuilt dictionaries in user directory
class SymlinkingPrebuiltDictionaries : public DeploymentTask {
 public:
  SymlinkingPrebuiltDictionaries(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

// upgrade user dictionaries
class UserDictUpgration : public DeploymentTask {
 public:
  UserDictUpgration(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

class UserDictSync : public DeploymentTask {
 public:
  UserDictSync(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

class BackupConfigFiles : public DeploymentTask {
 public:
  BackupConfigFiles(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

class CleanupTrash : public DeploymentTask {
 public:
  CleanupTrash(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

class CleanOldLogFiles : public DeploymentTask {
 public:
  CleanOldLogFiles(TaskInitializer arg = TaskInitializer()) {}
  bool Run(Deployer* deployer);
};

}  // namespace rime

#endif  // RIME_DEPLOYMENT_TASKS_H_