File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 6
6
/pkg /
7
7
/spec /reports /
8
8
/tmp /
9
+ /.runa /
Original file line number Diff line number Diff line change @@ -40,6 +40,34 @@ class RunaCli < Thor
40
40
system ( "bundle exec ruby -Ilib main.rb #{ args . join ( " " ) } " )
41
41
end
42
42
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
43
71
end
44
72
45
73
RunaCli . start ( ARGV )
You can’t perform that action at this time.
0 commit comments