runa 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +4 -1
- data/README.md +34 -0
- data/exe/runa +39 -20
- data/lib/runa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe8ddbd576436a3027eab72ac6c6dd8b06abd9478b79db9e770f6b35f7c046fa
|
4
|
+
data.tar.gz: 53446e3a8c1d0ad7e2036b89bf8916ffb47f67b34c725b6b86745dba46947de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ec89be51ba7b7f6e3f8dab32857a25ac84e0c2c45c147ce31505bf4fd97bcb421355836927177ad8c5756189708c7e6eb01ad343494d40c0533aacfa9635fc3
|
7
|
+
data.tar.gz: dc9d62f052f7fbdf8a8781b18d4d3e1b80b438f4373a768054b68afab1fd2633861f4c7eadf99e49c7eb6c010f1ffe0698d98b56f3a4491c395676b5ae5c1606
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
runa (0.
|
4
|
+
runa (0.2.0)
|
5
5
|
thor
|
6
6
|
|
7
7
|
GEM
|
@@ -11,6 +11,7 @@ GEM
|
|
11
11
|
json (2.6.3)
|
12
12
|
language_server-protocol (3.17.0.3)
|
13
13
|
lint_roller (1.0.0)
|
14
|
+
os (1.1.4)
|
14
15
|
parallel (1.23.0)
|
15
16
|
parser (3.2.2.1)
|
16
17
|
ast (~> 2.4.1)
|
@@ -53,8 +54,10 @@ GEM
|
|
53
54
|
|
54
55
|
PLATFORMS
|
55
56
|
x64-mingw-ucrt
|
57
|
+
x86_64-linux
|
56
58
|
|
57
59
|
DEPENDENCIES
|
60
|
+
os (~> 1.1)
|
58
61
|
rake (~> 13.0)
|
59
62
|
runa!
|
60
63
|
standard (~> 1.3)
|
data/README.md
CHANGED
@@ -28,4 +28,38 @@ Run application.
|
|
28
28
|
|
29
29
|
```
|
30
30
|
$ runa run
|
31
|
+
Hello, World!
|
31
32
|
```
|
33
|
+
|
34
|
+
Generate scripts for production execution.
|
35
|
+
|
36
|
+
Mac/Linux/WSL
|
37
|
+
|
38
|
+
```
|
39
|
+
$ runa gen
|
40
|
+
Generate '.runa/runa_app'
|
41
|
+
'.runa/runa_app' is the script to run. Copy it to any location and use it.
|
42
|
+
|
43
|
+
$ chmod +x .runa/runa_app
|
44
|
+
|
45
|
+
$ cp .runa/runa_app path/to/bin
|
46
|
+
|
47
|
+
$ runa_app
|
48
|
+
Hello, World!
|
49
|
+
```
|
50
|
+
|
51
|
+
Windows
|
52
|
+
|
53
|
+
```
|
54
|
+
PS> runa gen
|
55
|
+
Generate '.runa/runa_load_path.rb'
|
56
|
+
Generate '.runa/runa_app.bat'
|
57
|
+
'.runa/runa_app.bat' is the script to run. Copy it to any location and use it.
|
58
|
+
|
59
|
+
PS> cp .runa\runa_app.bat path\to\bin
|
60
|
+
|
61
|
+
PS> runa_app
|
62
|
+
Hello, world!
|
63
|
+
```
|
64
|
+
|
65
|
+
|
data/exe/runa
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "runa"
|
4
4
|
require "thor"
|
5
5
|
require "fileutils"
|
6
|
+
require "os"
|
6
7
|
|
7
8
|
class RunaCli < Thor
|
8
9
|
def self.exit_on_failure?
|
@@ -19,12 +20,14 @@ class RunaCli < Thor
|
|
19
20
|
|
20
21
|
FileUtils.mkdir_p(name)
|
21
22
|
Dir.chdir(name) do
|
23
|
+
FileUtils.mkdir_p(RUNA_DIR)
|
24
|
+
File.write("#{RUNA_DIR}/.gitkeep", "")
|
22
25
|
FileUtils.mkdir_p(".bundle")
|
23
26
|
File.write(".bundle/config", "---\nBUNDLE_PATH: \"vendor/bundle\"\n")
|
24
27
|
FileUtils.mkdir_p("lib/#{name}")
|
25
28
|
File.write("lib/#{name}.rb", "require \"#{name}/lib\"\n")
|
26
29
|
File.write("lib/#{name}/lib.rb", "module #{module_name}\nend\n")
|
27
|
-
File.write(".gitignore", "/vendor/\n/.runa
|
30
|
+
File.write(".gitignore", "/vendor/\n/.runa/*\n!/.runa/.gitkeep\n")
|
28
31
|
File.write("Gemfile", "# frozen_string_literal: true\n\nsource \"https://rubygems.org\"\n\n# gem \"rails\"\n")
|
29
32
|
File.write("main.rb", "require \"#{name}\"\n\nputs \"Hello, world!\"")
|
30
33
|
end
|
@@ -33,6 +36,7 @@ class RunaCli < Thor
|
|
33
36
|
desc "install", "Install gems"
|
34
37
|
def install
|
35
38
|
system("bundle install")
|
39
|
+
generate_load_path_script
|
36
40
|
end
|
37
41
|
|
38
42
|
desc "run [ARGS]", "Run application with arguments"
|
@@ -41,33 +45,48 @@ class RunaCli < Thor
|
|
41
45
|
end
|
42
46
|
map "run" => "run_command"
|
43
47
|
|
44
|
-
desc "
|
45
|
-
def
|
48
|
+
desc "generate", "Generate scripts for production execution"
|
49
|
+
def generate
|
46
50
|
root_dir = File.expand_path(".")
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
puts "'#{File.join(root_dir, RUNA_DIR, path)}' generated. It can be copied to any location."
|
54
|
-
end
|
51
|
+
generate_script_name = File.basename(root_dir)
|
52
|
+
generate_load_path_script
|
53
|
+
path = File.join(RUNA_DIR, generate_script_name)
|
54
|
+
path += ".bat" if OS.windows?
|
55
|
+
File.write(path, generate_script(root_dir))
|
56
|
+
puts "Generate '#{path}'\n'#{path}' is the script to run. Copy it to any location and use it."
|
55
57
|
end
|
58
|
+
map "gen" => "generate"
|
56
59
|
|
57
60
|
private
|
58
61
|
|
59
62
|
RUNA_DIR = ".runa"
|
60
63
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
def generate_script(root_dir)
|
65
|
+
lib_dir = File.join(root_dir, "lib")
|
66
|
+
runa_dir = File.join(root_dir, RUNA_DIR)
|
67
|
+
main_rb = File.join(root_dir, "main.rb")
|
68
|
+
|
69
|
+
if OS.windows?
|
70
|
+
lib_dir = lib_dir.tr("/", "\\")
|
71
|
+
runa_dir = runa_dir.tr("/", "\\")
|
72
|
+
main_rb = main_rb.tr("/", "\\")
|
73
|
+
|
74
|
+
<<~EOS
|
75
|
+
@ECHO OFF
|
76
|
+
@ruby -I"#{lib_dir}" -I"#{runa_dir}" -rruna_load_path #{main_rb} %*
|
77
|
+
EOS
|
78
|
+
else
|
79
|
+
<<~EOS
|
80
|
+
#!/bin/sh
|
81
|
+
ruby -I"#{lib_dir}" -I"#{runa_dir}" -rruna_load_path #{main_rb} $@
|
82
|
+
EOS
|
83
|
+
end
|
84
|
+
end
|
66
85
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
86
|
+
def generate_load_path_script
|
87
|
+
path = "#{RUNA_DIR}/runa_load_path.rb"
|
88
|
+
File.write(path, load_path_script)
|
89
|
+
puts "Generate '#{path}'"
|
71
90
|
end
|
72
91
|
|
73
92
|
def load_path_script
|
data/lib/runa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ongaeshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|