Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mbround18/update deps #345

Merged
merged 3 commits into from
May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .autorc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"name": "mbround18",
"email": "[email protected]",
"onlyPublishWithReleaseLabel": true
}
}
14 changes: 14 additions & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Enforce PR labels

on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-label:
runs-on: ubuntu-latest
steps:
- uses: yogevbd/[email protected]
with:
REQUIRED_LABELS_ANY: "major,minor,patch,internal,performance,question,release,tests,wontfix,documentation,bug,dependancies"
REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['major','minr','patch', 'documentation']"
BANNED_LABELS: "banned"
55 changes: 29 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
TZ: "America/Los_Angeles"
AUTO_UPDATE: 1
AUTO_UPDATE_SCHEDULE: "0 1 * * *"
TYPE: Vanilla
build:
context: .
dockerfile: ./Dockerfile.valheim
Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ world backup support, and a user-friendly cli interface.

## Links

- [Getting Started](../README.md)
- [Getting Started](https://github.com/mbround18/valheim-docker/blob/main/README.md)

The repositories Readme contains all relevant information for running with Docker

- [Discussion for Help and Info](https://github.com/mbround18/valheim-docker/discussions)

Discussions are what we use for support as they are easily searchable.

- [Getting Started With & Using Odin](../src/odin/README.md)
- [Getting Started With & Using Odin](https://github.com/mbround18/valheim-docker/blob/main/src/odin/README.md)

You can run your Valheim server without docker! Take a look at Odin's docs.

- [Getting Started With & Using Huginn](../src/huginn/README.md)
- [Getting Started With & Using Huginn](https://github.com/mbround18/valheim-docker/blob/main/src/huginn/README.md)

Want to see the status of your server? Take a look at Huginn! It can run independently of Odin and this repo.

## Tutorials

- [Getting Started With Mods](tutorials/getting_started_with_mods.md)
- [How to transfer files](tutorials/how-to-transfer-files.md)
- [Getting Started With Mods](https://github.com/mbround18/valheim-docker/blob/main/docs/tutorials/getting_started_with_mods.md)
- [How to transfer files](https://github.com/mbround18/valheim-docker/blob/main/docs/tutorials/how-to-transfer-files.md)

13 changes: 10 additions & 3 deletions src/odin/mods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ impl ZipExt for ZipArchive<File> {

let mut outpath = dst_dir.as_ref().join(filepath);

debug!("Extracting file: {:?}", outpath);

if file.name().ends_with('/') {
fs::create_dir_all(&outpath)?;
} else {
Expand All @@ -47,11 +49,13 @@ impl ZipExt for ZipArchive<File> {

// Don't overwrite old cfg files
if outpath.extension().unwrap_or_default() == "cfg" && outpath.exists() {
debug!("File is config with already exiting destination! Adding '.new'");
outpath = outpath.with_extension("cfg.new");
}
let mut outfile = File::create(&outpath)?;

let mut outfile = File::create(&outpath)?;
io::copy(&mut file, &mut outfile)?;
debug!("Extracted file {:?}", outpath);
}

// Get and Set permissions
Expand Down Expand Up @@ -94,7 +98,7 @@ impl ValheimMod {
}

fn try_parse_manifest(&self, archive: &mut ZipArchive<File>) -> Result<Manifest, ZipError> {
debug!("Parsing manifest...");
debug!("Parsing 'manifest.json' ...");
let manifest = archive.by_name("manifest.json")?;
Ok(serde_json::from_reader(manifest).expect("Failed deserializing manifest"))
}
Expand Down Expand Up @@ -132,6 +136,7 @@ impl ValheimMod {

// It's a mod framework based on a specific name and if it has a matching directory in the
// archive
debug!("Validating if file is a framework");
mod_dir_exists && (name == "BepInExPack_Valheim" || name == "BepInEx_Valheim_Full")
}
None => archive
Expand All @@ -147,6 +152,7 @@ impl ValheimMod {
// thunderstore where a manifest is provided, or not.
let (output_dir, archive_dir) = if self.is_mod_framework(archive) {
info!("Installing Framework...");
debug!("Zip file is a framework, processing it in parts.");
let output_dir = PathBuf::from(&common_paths::game_directory());

// All frameworks from thunderstore just need the directory matching the name extracted
Expand Down Expand Up @@ -199,12 +205,13 @@ impl ValheimMod {
}

if self.file_type.eq("dll") {
debug!("Copying downloaded dll to BepInEx plugin directory...");
self.copy_single_file(
&self.staging_location,
&common_paths::bepinex_plugin_directory(),
);
} else if self.file_type.eq("cfg") {
info!("Copying single cfg into config directory");
debug!("Copying single cfg into config directory");
let src_file_path = &self.staging_location;
let cfg_file_name = self.staging_location.file_name().unwrap();

Expand Down