runa 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a522391930171e4e77161f28e2291cf2be945d88338ccfed28c7870e74a5ddf7
4
- data.tar.gz: b2c43a43fa11ac1a7945a3930e52c1773d2947955bc9acd519dc8bde01f8974e
3
+ metadata.gz: 271c1000bf8af7eccc88aa0be7a0aa4b33e5bea595f594aa37e6c2401a829c86
4
+ data.tar.gz: 4c5fa2123e0b5035dca582cc373762d83e5160d98721f5a98278276b5ab5b7d1
5
5
  SHA512:
6
- metadata.gz: cb319f1f1c8053dce8f794fc793e3f0f7b23a56aacd94bf9bf1b0a66a267c3c723b54b719f09d81f2b5ddd59b4482dfac87cb37117e17d8e6f78171673e8e243
7
- data.tar.gz: d36be1c15076965e1a75dd485244f4d29f8692ac1b8fe25be57c70e8f4fda32c3c621893c37ddeb9934ec774159d225680b1688f9957d3e5660b1ed6e3f70c67
6
+ metadata.gz: 7aae1569645d9695a2d447fb1a4fe899a6fcc53fb9bebac390b517be9f42c338f21178fa6fb1c7a70615b372f2f16574c5ecc8c6b51ab42487bdb3cf56eeea65
7
+ data.tar.gz: 8ef6ea23f1a42d11d0f7f502125d47b45bc4ae045686ef9768a2c2a7aa376d6e55545e8e687609d4b11ec05dc60c88d144d7954f4acdb7399ee4e988e160fda0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.4.0] - 2023-06-24
2
+ - Rename generate command to deploy
3
+ - Add add_gem command
4
+ - Show message when new command
5
+
1
6
  ## [0.3.0] - 2023-06-13
2
7
  - Rename release command to generate(gen)
3
8
  - Support Mac/Linux/WSL
data/README.md CHANGED
@@ -41,7 +41,7 @@ Generate '.runa/runa_load_path.rb'
41
41
  ### Run application
42
42
 
43
43
  ```
44
- $ runa run
44
+ $ runa run runa_app.rb
45
45
  Hello, World!
46
46
  ```
47
47
 
@@ -50,12 +50,11 @@ Hello, World!
50
50
  Mac/Linux/WSL
51
51
 
52
52
  ```
53
- $ runa deploy
53
+ $ runa deploy runa_app.rb path/to/bin
54
54
  Generate '.runa/runa_app'
55
- '.runa/runa_app' is the script to run. Copy it to any location and use it.
55
+ Deploy execution script to 'path/to/bin/runa_app'.
56
56
 
57
- $ chmod +x .runa/runa_app
58
- $ cp .runa/runa_app path/to/bin
57
+ $ chmod +x path/to/bin/runa_app
59
58
  $ runa_app
60
59
  Hello, World!
61
60
  ```
@@ -63,12 +62,10 @@ Hello, World!
63
62
  Windows
64
63
 
65
64
  ```
66
- PS> runa deploy
65
+ PS> runa deploy runa_app.rb path\to\bin
67
66
  Generate '.runa/runa_load_path.rb'
68
- Generate '.runa/runa_app.bat'
69
- '.runa/runa_app.bat' is the script to run. Copy it to any location and use it.
67
+ Deploy execution script to 'path\to\bin\runa_app.bat'.
70
68
 
71
- PS> cp .runa\runa_app.bat path\to\bin
72
69
  PS> runa_app
73
70
  Hello, world!
74
71
  ```
data/exe/runa CHANGED
@@ -29,13 +29,13 @@ class RunaCli < Thor
29
29
  File.write("lib/#{name}/lib.rb", "module #{module_name}\nend\n")
30
30
  File.write(".gitignore", "/vendor/\n/.runa/*\n!/.runa/.gitkeep\n")
31
31
  File.write("Gemfile", "# frozen_string_literal: true\n\nsource \"https://rubygems.org\"\n\n# gem \"rails\"\n")
32
- File.write("main.rb", "require \"#{name}\"\n\nputs \"Hello, world!\"")
32
+ File.write("#{name}.rb", "require \"#{name}\"\n\nputs \"Hello, world!\"")
33
33
  end
34
34
 
35
35
  puts "Created '#{name}' application."
36
36
  end
37
37
 
38
- desc "gem_add", "Add gems"
38
+ desc "gem_add [GEMS]", "Add gems"
39
39
  def gem_add(*gems)
40
40
  system("bundle add #{gems.join(" ")}")
41
41
  deploy_load_path_script
@@ -47,31 +47,41 @@ class RunaCli < Thor
47
47
  deploy_load_path_script
48
48
  end
49
49
 
50
- desc "run [ARGS]", "Run application with arguments"
51
- def run_command(*args)
52
- system("bundle exec ruby -Ilib main.rb #{args.join(" ")}")
50
+ desc "run SCRIPT_FILE [ARGS]", "Run application with arguments"
51
+ def run_command(script_file, *args)
52
+ system("bundle exec ruby -Ilib #{script_file} #{args.join(" ")}")
53
53
  end
54
54
  map "run" => "run_command"
55
55
 
56
- desc "deploy", "Deploy scripts for production execution"
57
- def deploy
56
+ desc "deploy SCRIPT_FILE DEPLOY_PATH", "Deploy scripts for production execution"
57
+ def deploy(script_file, deploy_path)
58
58
  root_dir = File.expand_path(".")
59
- deploy_script_name = File.basename(root_dir)
60
59
  deploy_load_path_script
61
- path = File.join(RUNA_DIR, deploy_script_name)
62
- path += ".bat" if OS.windows?
63
- File.write(path, deploy_script(root_dir))
64
- puts "Generate '#{path}'\n'#{path}' is the script to run. Copy it to any location and use it."
60
+ path = nil
61
+ if File.directory?(deploy_path)
62
+ deploy_script_name = File.basename(script_file, ".*")
63
+ path = File.join(deploy_path, deploy_script_name)
64
+ path += ".bat" if OS.windows?
65
+ else
66
+ path = deploy_path
67
+ end
68
+ if !File.exist?(path)
69
+ File.write(path, deploy_script(root_dir, script_file))
70
+ puts "Deploy execution script to '#{path}'."
71
+ else
72
+ puts "Error: '#{path}' is already exists."
73
+ exit(1)
74
+ end
65
75
  end
66
76
 
67
77
  private
68
78
 
69
79
  RUNA_DIR = ".runa"
70
80
 
71
- def deploy_script(root_dir)
81
+ def deploy_script(root_dir, script_file)
72
82
  lib_dir = File.join(root_dir, "lib")
73
83
  runa_dir = File.join(root_dir, RUNA_DIR)
74
- main_rb = File.join(root_dir, "main.rb")
84
+ main_rb = File.join(root_dir, script_file)
75
85
 
76
86
  if OS.windows?
77
87
  lib_dir = lib_dir.tr("/", "\\")
data/lib/runa/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Runa
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
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.0
4
+ version: 0.5.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-06-23 00:00:00.000000000 Z
11
+ date: 2023-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor