Skip to content

Commit 2dfd341

Browse files
committed
feat: Add release command (in progress)
1 parent 056063e commit 2dfd341

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/pkg/
77
/spec/reports/
88
/tmp/
9+
/.runa/

exe/runa

+28
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,34 @@ class RunaCli < Thor
4040
system("bundle exec ruby -Ilib main.rb #{args.join(" ")}")
4141
end
4242
map "run" => "run_command"
43+
44+
desc "release", "Release scripts for production execution"
45+
def release
46+
root_dir = File.expand_path(".")
47+
release_script_name = File.basename(root_dir)
48+
FileUtils.mkdir_p(RUNA_DIR)
49+
Dir.chdir(RUNA_DIR) do
50+
path = "#{release_script_name}.bat"
51+
File.write(path, release_script(root_dir))
52+
puts "'#{File.join(root_dir, RUNA_DIR, path)}' generated. It can be copied to any location."
53+
end
54+
end
55+
56+
private
57+
58+
RUNA_DIR = ".runa"
59+
60+
def release_script(root_dir)
61+
# TODO: Linux
62+
lib_dir = File.join(root_dir, "lib").gsub("/", "\\")
63+
runa_dir = File.join(root_dir, RUNA_DIR).gsub("/", "\\")
64+
main_rb = File.join(root_dir, "main.rb").gsub("/", "\\")
65+
66+
<<~EOS
67+
@ECHO OFF
68+
@ruby -I"#{lib_dir}" -I"#{runa_dir}" -rruna_load_path #{main_rb} %*"
69+
EOS
70+
end
4371
end
4472

4573
RunaCli.start(ARGV)

0 commit comments

Comments
 (0)