Create script run-me to change JSOTemplate to the new name of the package#15
Create script run-me to change JSOTemplate to the new name of the package#15abelsiqueira wants to merge 2 commits intomainfrom
Conversation
|
Don't Github templates support placeholders? |
|
I haven't found it on the docs. |
|
For one, we should detect a trailing It seems on macOS giving an extension to There's also an error when processing binary files, such as This worked for me: diff --git a/run-me.jl b/run-me.jl
index 3b57c17..ed2e181 100644
--- a/run-me.jl
+++ b/run-me.jl
@@ -16,16 +16,13 @@ This script will help using JSOTemplate by performing the following steps:
""")
-files = readdir()
-deleteat!(files, findfirst(files .== ".git"))
-while !all(isfile.(files))
- idx = findall(.!isfile.(files))
- for dir in files[idx]
- append!(files, readdir(dir, join=true))
- end
- deleteat!(files, idx)
+files = split(readchomp(`git ls-tree -r main --name-only`), "\n")
+for file ∈ files
+ file_type = readchomp(`file $file`)
+ match(r"text", file_type) == nothing && continue # skip binary files
+ run(`sed -i "" "s/JSOTemplate/$pkgname/g" "$file"`)
end
-run(`sed -i "s/JSOTemplate/$pkgname/g" $files`)
println(green("✓ All occurrences of JSOTemplate should have been changed to $pkgname"))
lines = readlines("Project.toml")
@@ -38,7 +35,7 @@ for line in lines
end
new_uuid = string(uuid4())
files = ["Project.toml", "test/Project.toml", "docs/Project.toml"] |> x -> filter(isfile, x)
-run(`sed -i "s/$uuid/$new_uuid/g" $files`)
+run(`sed -i "" "s/$uuid/$new_uuid/g" $files`)
println(green("✓ UUID has been updated in $files"))
mv("src/JSOTemplate.jl", "src/$pkgname.jl")
@@ -49,4 +46,4 @@ println(green("✓ run-me.jl was removed"))
run(`git add src/$pkgname.jl`)
run(`git commit -am ":robot: [run-me.jl] Change JSOTemplate to $pkgname"`)
-println(green("✓ commit was created"))
\ No newline at end of file
+println(green("✓ commit was created"))BTW, just for fun: julia> macro green_str(s)
"\033[0;32m" * s * "\033[0m"
end
julia> green"BLA"
"\e[0;32mBLA\e[0m"
julia> println(green"BLA") # shows in green
BLA
`` |
|
Now it fails on Linux :/ |
Yes. |
@dpo, this should work on mac too, but can you test?