Consolidate binary targets to galaxy-oss only
- Remove dev, integration, local, preview, and stable bin targets - Update Cargo.toml to reflect single binary - Fix related module references and tests
This commit is contained in:
@@ -8,11 +8,11 @@ fn test_data_dir_path() {
|
||||
// ChannelState, by default, is configured for Channel::Oss.
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(data_dir(), home_dir.join(".warp-oss"));
|
||||
assert_eq!(data_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(data_dir(), home_dir.join(".local/share/warp-oss"));
|
||||
assert_eq!(data_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(data_dir(), home_dir.join("AppData\\Roaming\\warp\\WarpOss\\data"));
|
||||
assert_eq!(data_dir(), home_dir.join("AppData\\Roaming\\galaxy\\Galaxy\\data"));
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
@@ -25,11 +25,11 @@ fn test_config_local_dir_path() {
|
||||
// ChannelState, by default, is configured for Channel::Oss.
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(config_local_dir(), home_dir.join(".warp-oss"));
|
||||
assert_eq!(config_local_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(config_local_dir(), home_dir.join(".config/warp-oss"));
|
||||
assert_eq!(config_local_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(config_local_dir(), home_dir.join("AppData\\Local\\warp\\WarpOss\\config"));
|
||||
assert_eq!(config_local_dir(), home_dir.join("AppData\\Local\\galaxy\\Galaxy\\config"));
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
@@ -40,8 +40,8 @@ fn test_config_local_dir_path() {
|
||||
fn test_galaxy_home_config_dir_path() {
|
||||
let home_dir = home_dir().expect("Should be able to compute home directory");
|
||||
let expected_dir_name = match ChannelState::data_profile() {
|
||||
Some(data_profile) => format!(".warp-core-oss-{data_profile}"),
|
||||
None => ".warp-core-oss".to_string(),
|
||||
Some(data_profile) => format!(".galaxy-{data_profile}"),
|
||||
None => ".galaxy".to_string(),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
@@ -68,11 +68,11 @@ fn test_cache_dir_path() {
|
||||
// ChannelState, by default, is configured for Channel::Oss.
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(cache_dir(), home_dir.join("Library/Application Support/dev.warp.WarpOss"));
|
||||
assert_eq!(cache_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(cache_dir(), home_dir.join(".cache/warp-oss"));
|
||||
assert_eq!(cache_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(cache_dir(), home_dir.join("AppData\\Local\\warp\\WarpOss\\cache"));
|
||||
assert_eq!(cache_dir(), home_dir.join("AppData\\Local\\galaxy\\Galaxy\\cache"));
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
@@ -85,28 +85,91 @@ fn test_state_dir_path() {
|
||||
cfg_if::cfg_if! {
|
||||
// ChannelState, by default, is configured for Channel::Oss.
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(state_dir(), home_dir.join("Library/Application Support/dev.warp.WarpOss"));
|
||||
assert_eq!(state_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(state_dir(), home_dir.join(".local/state/warp-oss"));
|
||||
assert_eq!(state_dir(), home_dir.join(".galaxy"));
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(state_dir(), home_dir.join("AppData\\Local\\warp\\WarpOss\\data"));
|
||||
assert_eq!(state_dir(), home_dir.join("AppData\\Local\\galaxy\\Galaxy\\data"));
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[test]
|
||||
fn test_migrate_legacy_macos_data_dir_merges_without_overwriting() {
|
||||
let tempdir = tempfile::tempdir().expect("tempdir should be created");
|
||||
let source_dir = tempdir.path().join("legacy");
|
||||
let target_dir = tempdir.path().join(".galaxy");
|
||||
std::fs::create_dir_all(source_dir.join("nested")).expect("source should be created");
|
||||
std::fs::write(source_dir.join("galaxy.sqlite"), b"legacy database")
|
||||
.expect("source file should be created");
|
||||
std::fs::write(source_dir.join("nested/legacy.txt"), b"legacy content")
|
||||
.expect("nested source file should be created");
|
||||
std::fs::create_dir_all(target_dir.join("nested")).expect("target should be created");
|
||||
std::fs::write(target_dir.join("galaxy.sqlite"), b"current database")
|
||||
.expect("target file should be created");
|
||||
std::fs::write(target_dir.join("nested/current.txt"), b"current content")
|
||||
.expect("nested target file should be created");
|
||||
|
||||
migrate_directory_contents(&source_dir, &target_dir);
|
||||
|
||||
assert_eq!(
|
||||
std::fs::read(target_dir.join("galaxy.sqlite")).unwrap(),
|
||||
b"current database"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read(target_dir.join("nested/legacy.txt")).unwrap(),
|
||||
b"legacy content"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read(target_dir.join("nested/current.txt")).unwrap(),
|
||||
b"current content"
|
||||
);
|
||||
// The source dir should still exist because "galaxy.sqlite" conflicted
|
||||
// and was left in place.
|
||||
assert!(source_dir.join("galaxy.sqlite").exists());
|
||||
// The nested directory was fully merged (legacy.txt moved) and removed.
|
||||
assert!(!source_dir.join("nested").exists());
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[test]
|
||||
fn test_migrate_legacy_macos_data_dir_keeps_conflicting_legacy_data() {
|
||||
let tempdir = tempfile::tempdir().expect("tempdir should be created");
|
||||
let source_dir = tempdir.path().join("legacy");
|
||||
let target_dir = tempdir.path().join(".galaxy");
|
||||
std::fs::create_dir_all(&source_dir).expect("source should be created");
|
||||
std::fs::create_dir_all(&target_dir).expect("target should be created");
|
||||
std::fs::write(source_dir.join("settings.json"), b"legacy")
|
||||
.expect("source file should be created");
|
||||
std::fs::write(target_dir.join("settings.json"), b"current")
|
||||
.expect("target file should be created");
|
||||
|
||||
migrate_directory_contents(&source_dir, &target_dir);
|
||||
|
||||
assert_eq!(
|
||||
std::fs::read(target_dir.join("settings.json")).unwrap(),
|
||||
b"current"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read(source_dir.join("settings.json")).unwrap(),
|
||||
b"legacy"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_project_path_for_warp_app_id() {
|
||||
let project_dirs = project_dirs_for_app_id(AppId::new("dev", "warp", "Warp"), None)
|
||||
.expect("should be able to compute project dirs");
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(project_dirs.project_path(), "dev.warp.Warp");
|
||||
assert_eq!(project_dirs.project_path(), "com.galaxy.Galaxy");
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(project_dirs.project_path(), "warp-terminal");
|
||||
assert_eq!(project_dirs.project_path(), "galaxy");
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(project_dirs.project_path(), "warp\\Warp");
|
||||
assert_eq!(project_dirs.project_path(), "galaxy\\Galaxy");
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
@@ -119,11 +182,11 @@ fn test_project_path_for_warp_dev_app_id() {
|
||||
.expect("should be able to compute project dirs");
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(project_dirs.project_path(), "dev.warp.WarpDev");
|
||||
assert_eq!(project_dirs.project_path(), "com.galaxy.Galaxy");
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(project_dirs.project_path(), "warp-terminal-dev");
|
||||
assert_eq!(project_dirs.project_path(), "galaxy");
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(project_dirs.project_path(), "warp\\WarpDev");
|
||||
assert_eq!(project_dirs.project_path(), "galaxy\\Galaxy");
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
@@ -136,11 +199,11 @@ fn test_project_path_for_oss_app_id() {
|
||||
.expect("should be able to compute project dirs");
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "macos")] {
|
||||
assert_eq!(project_dirs.project_path(), "dev.warp.WarpOss");
|
||||
assert_eq!(project_dirs.project_path(), "com.galaxy.Galaxy");
|
||||
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
|
||||
assert_eq!(project_dirs.project_path(), "warp-oss");
|
||||
assert_eq!(project_dirs.project_path(), "galaxy");
|
||||
} else if #[cfg(windows)] {
|
||||
assert_eq!(project_dirs.project_path(), "warp\\WarpOss");
|
||||
assert_eq!(project_dirs.project_path(), "galaxy\\Galaxy");
|
||||
} else {
|
||||
unimplemented!("Need to update tests for current platform!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user