Skip to content

Commit

Permalink
feat(customizer): disable saving patched config files
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Sep 16, 2017
1 parent 0738737 commit 88f5a0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/rime/lever/customizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace rime {
// 1.0 X 2.0.custom.X (up-to-date)
// 1.0 Y 1.0.custom.X --> Update: 1.0.custom.Y
//
// DEPRECATED: in favor of auto-patch config compiler plugin
bool Customizer::UpdateConfigFile() {
bool need_update = false;
bool redistribute = false;
Expand Down Expand Up @@ -146,4 +147,9 @@ bool Customizer::UpdateConfigFile() {
return true;
}

bool Customizer::TrashCustomizedCopy() {
// TODO: unimplemented
return false;
}

} // namespace rime
5 changes: 3 additions & 2 deletions src/rime/lever/customizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Copyright RIME Developers
// Distributed under the BSD License
//
// 2012-02-12 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_CUSTOMIZER_H_
#define RIME_CUSTOMIZER_H_

Expand All @@ -20,8 +18,11 @@ class Customizer {
dest_path_(dest_path),
version_key_(version_key) {}

// DEPRECATED: in favor of auto-patch config compiler plugin
bool UpdateConfigFile();

bool TrashCustomizedCopy();

protected:
boost::filesystem::path source_path_;
boost::filesystem::path dest_path_;
Expand Down
7 changes: 4 additions & 3 deletions src/rime/lever/deployment_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ bool SchemaUpdate::Run(Deployer* deployer) {
fs::path user_data_path(deployer->user_data_dir);
fs::path destination_path(user_data_path / (schema_id + ".schema.yaml"));
Customizer customizer(source_path, destination_path, "schema/version");
if (customizer.UpdateConfigFile()) {
LOG(INFO) << "schema '" << schema_id << "' is updated.";
if (customizer.TrashCustomizedCopy()) {
LOG(INFO) << "patched copy of schema '" << schema_id << "' is moved to trash";
}

Schema schema(schema_id, new Config);
Expand Down Expand Up @@ -327,7 +327,8 @@ bool ConfigFileUpdate::Run(Deployer* deployer) {
source_config_path = dest_config_path;
}
Customizer customizer(source_config_path, dest_config_path, version_key_);
return customizer.UpdateConfigFile();
customizer.TrashCustomizedCopy();
return true;
}

bool PrebuildAllSchemas::Run(Deployer* deployer) {
Expand Down

1 comment on commit 88f5a0c

@mrhso
Copy link

@mrhso mrhso commented on 88f5a0c Dec 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

也就是从这个 Commit 开始,小狼毫就无法使用 librime 了吧。

Please sign in to comment.