runa 0.1.0 → 0.2.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: 0a644cf437951c516a29f5c014f909dd97aa2dc29e3ab955dd66964b43eb1e32
4
- data.tar.gz: 80ec546ad6eda45bfc4b52f78cb4103b93d08dd93a417670dc28a8999dfdc6f5
3
+ metadata.gz: 260b2cf570fb222aa1a71e6bd9eb44bd08194b878f11c9f58a80267e8fd49a58
4
+ data.tar.gz: 9c8ed4bc10a3013ea7d04bacdbb3eb039dc6503f6d2b3e58226ee698b11d36bd
5
5
  SHA512:
6
- metadata.gz: cb5fcbc25e03d3a5c896c73cc363ddb1e4ecfdc0df52e44fe6404f04e3601ffa6ab127ffa8d0c8a557fe9fc1ac695201f6eb7f8ac950e3bef8206e2f9eba301e
7
- data.tar.gz: f69d6620ce222401370c20b3bb70eb1857cbee9843d97eb00eecf015464d1b2fc219f4112bd29a78334baff4d66f5c911034026d766b35f26de700ff576ce00b
6
+ metadata.gz: ff244c05be35715fa140c7b9f5e800e295d07ac33c57cffe19ee9fd6f485bda88118dffedbfb4b9ed8d90e6a33c931331a40dd8449b2baa5dd3a5e7b89ac6971
7
+ data.tar.gz: 81ffcabaa804a8654966790ce260aabe41ee044587bdc33e10184062dfa0ed5063ebb2911e065afb3af2645e2071921eba533f28c63fa64ba98227f7c703eaef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
- ## [Unreleased]
1
+ ## [0.2.0] - 2023-05-29
2
+ - Add subcommand release
2
3
 
3
4
  ## [0.1.0] - 2023-05-16
4
5
 
5
6
  - Initial release
7
+ - Add subcommands new, instal, and run
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2023 ongaeshi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,31 +1,31 @@
1
1
  # Runa
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ Runa is a command line interface for easily creating Ruby applications.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/runa`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ ## Install
6
6
 
7
- ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
7
+ ```
8
+ $ gem install runa
9
+ ```
18
10
 
19
11
  ## Usage
20
12
 
21
- TODO: Write usage instructions here
13
+ Create a new application.
22
14
 
23
- ## Development
15
+ ```
16
+ $ runa new runa_app
17
+ $ cd runa_app
18
+ ```
24
19
 
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test-unit` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
20
+ If you need a gem, Write it in the `Gemfile`.
26
21
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
22
+ ```
23
+ $ code Gemfile
24
+ $ runa install
25
+ ```
28
26
 
29
- ## Contributing
27
+ Run application.
30
28
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/runa.
29
+ ```
30
+ $ runa run
31
+ ```
data/exe/runa CHANGED
@@ -24,7 +24,7 @@ class RunaCli < Thor
24
24
  FileUtils.mkdir_p("lib/#{name}")
25
25
  File.write("lib/#{name}.rb", "require \"#{name}/lib\"\n")
26
26
  File.write("lib/#{name}/lib.rb", "module #{module_name}\nend\n")
27
- File.write(".gitignore", "/vendor\n")
27
+ File.write(".gitignore", "/vendor/\n/.runa/\n")
28
28
  File.write("Gemfile", "# frozen_string_literal: true\n\nsource \"https://rubygems.org\"\n\n# gem \"rails\"\n")
29
29
  File.write("main.rb", "require \"#{name}\"\n\nputs \"Hello, world!\"")
30
30
  end
@@ -40,6 +40,41 @@ 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
+ File.write("runa_load_path.rb", load_path_script)
51
+ path = "#{release_script_name}.bat"
52
+ File.write(path, release_script(root_dir))
53
+ puts "'#{File.join(root_dir, RUNA_DIR, path)}' generated. It can be copied to any location."
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ RUNA_DIR = ".runa"
60
+
61
+ def release_script(root_dir)
62
+ # TODO: Linux
63
+ lib_dir = File.join(root_dir, "lib").tr("/", "\\")
64
+ runa_dir = File.join(root_dir, RUNA_DIR).tr("/", "\\")
65
+ main_rb = File.join(root_dir, "main.rb").tr("/", "\\")
66
+
67
+ <<~EOS
68
+ @ECHO OFF
69
+ @ruby -I"#{lib_dir}" -I"#{runa_dir}" -rruna_load_path #{main_rb} %*"
70
+ EOS
71
+ end
72
+
73
+ def load_path_script
74
+ str = `bundle exec ruby -e 'puts \$LOAD_PATH.grep(/vendor\\/bundle/)'`
75
+ paths = str.split("\n").map { |e| "\"#{e}\"" }.join(",")
76
+ "$LOAD_PATH.unshift(#{paths})\n"
77
+ end
43
78
  end
44
79
 
45
80
  RunaCli.start(ARGV)
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.1.0"
4
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.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-05-15 00:00:00.000000000 Z
11
+ date: 2023-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -36,6 +36,7 @@ files:
36
36
  - CHANGELOG.md
37
37
  - Gemfile
38
38
  - Gemfile.lock
39
+ - LICENSE.txt
39
40
  - README.md
40
41
  - Rakefile
41
42
  - exe/runa