Skip to content

Commit

Permalink
Merge pull request #31 from psrenergy/feature/examples
Browse files Browse the repository at this point in the history
Renamed psrhub to model and add examples
  • Loading branch information
raphasampaio authored May 6, 2024
2 parents e8a7dd4 + fb24e12 commit 9f4ee83
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "PSRContinuousDeployment"
uuid = "f0087d4c-ff99-426e-93c9-09c1a88911f9"
version = "0.6.0"
version = "0.7.0"

[deps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
Expand Down
23 changes: 21 additions & 2 deletions src/psrhub.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ function bundle_psrhub(
configuration::Configuration,
aws_access_key::AbstractString,
aws_secret_key::AbstractString,
psrhub_version::AbstractString,
psrhub_version::AbstractString;
examples_path::Union{Nothing, AbstractString} = nothing,
)
bucket = "psr-update-modules"

Expand Down Expand Up @@ -46,11 +47,29 @@ function bundle_psrhub(
Log.info("PSRHUB: Removing the $psrhub_zip")
rm(psrhub_zip_path, force = true)

Log.info("PSRHUB: Renaming psrhub.exe to $target.exe")
mv(joinpath(build_path, "psrhub.exe"), joinpath(build_path, "$target.exe"), force = true)

Log.info("PSRHUB: Creating $target.bat")
open(joinpath(build_path, "$target.bat"), "w") do io
writeln(io, "psrhub.exe > psrhub.log 2>&1")
writeln(io, "$target.exe > psrhub.log 2>&1")
return nothing
end

if !isnothing(examples_path)
build_examples_path = joinpath(build_path, "examples")

if isdir(build_examples_path)
Log.info("COMPILE: Removing examples directory")
rm(build_examples_path, force = true, recursive = true)
end

Log.info("COMPILE: Creating examples directory")
mkdir(build_examples_path)

Log.info("PSRHUB: Copying examples")
cp(examples_path, build_examples_path, force = true)
end

return nothing
end

0 comments on commit 9f4ee83

Please sign in to comment.