mruby_app 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/exe/mapp +5 -0
- data/lib/mruby_app.rb +4 -0
- data/lib/mruby_app/cli.rb +40 -0
- data/lib/mruby_app/mruby/main.rb +21 -0
- data/lib/mruby_app/version.rb +3 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2d3533479b7bd02178a001a586c1e2487db1e5e05ddf3e72bcd10d8fe70ddf47
|
4
|
+
data.tar.gz: de71e394c1674485d5524b4267aaa5579afcfd163ae7e95489181d714cd319c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4988327fd4ffe73e1d3e2c7271cd8127e6379a19dd19ce2cc008169427454ba92ade723eccd51b4159907ed807c91af0e464ba324329dc235361af70fad7494b
|
7
|
+
data.tar.gz: 1d5a0031a94821ba67c05742df693f50337766432a763ec424ef6eb4a64e68f44933f531d354354d8005ae4e2beedcc6218458ff722e190cb6b5220aa3104e18
|
data/exe/mapp
ADDED
data/lib/mruby_app.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module MrubyApp
|
2
|
+
module CLI
|
3
|
+
def self.start
|
4
|
+
has_mundler = File.file?(File.join(Dir.pwd, "Mundlefile"))
|
5
|
+
|
6
|
+
mrbc = "mrbc"
|
7
|
+
mrbc = "mundle exec mrbc" if has_mundler
|
8
|
+
|
9
|
+
mruby = "mruby"
|
10
|
+
mruby = "mundle exec mruby" if has_mundler
|
11
|
+
|
12
|
+
file = Tempfile.new('foo')
|
13
|
+
output = file.path
|
14
|
+
|
15
|
+
app_files = Dir.glob(File.join("app", "**", "*.rb"))
|
16
|
+
additional = Dir.glob(File.join(__dir__, "mruby", "*.rb"))
|
17
|
+
additional.map! { |f| File.expand_path(f) }
|
18
|
+
|
19
|
+
compile = (%W(#{mrbc} -g -o#{output}) + app_files + additional).join(" ")
|
20
|
+
chmod = "chmod +x #{output}"
|
21
|
+
execute = "#{mruby} -d #{output}"
|
22
|
+
|
23
|
+
# TODO: build
|
24
|
+
# build = (%W(#{mrbc} -Bapp -g -o./build.c) + app_files + additional).join(" ")
|
25
|
+
# system(build)
|
26
|
+
|
27
|
+
system(compile) || raise("Failed to compiled")
|
28
|
+
system(chmod) || raise("Failed to chmod")
|
29
|
+
begin
|
30
|
+
system(execute)
|
31
|
+
rescue Interrupt
|
32
|
+
end
|
33
|
+
ensure
|
34
|
+
if file
|
35
|
+
file.close
|
36
|
+
file.unlink
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Object
|
2
|
+
def method_missing(meth, *args, &blk)
|
3
|
+
raise NoMethodError, "Undefined method '#{meth}' for #{self.class} - #{self.inspect}"
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
begin
|
8
|
+
main
|
9
|
+
rescue => e
|
10
|
+
$stderr.print "\n\e[31m"
|
11
|
+
$stderr.print e.inspect
|
12
|
+
$stderr.puts "\e[0m"
|
13
|
+
e.backtrace.each.with_index do |line, index|
|
14
|
+
file = line.split(":").first
|
15
|
+
next if file == __FILE__
|
16
|
+
|
17
|
+
$stderr.print "\e[36m"
|
18
|
+
$stderr.puts line
|
19
|
+
$stderr.print "\e[0m"
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mruby_app
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Inkpen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: A CLI tool for using Ruby (mruby) code as a project.
|
28
|
+
email:
|
29
|
+
- dan2552@gmail.com
|
30
|
+
executables:
|
31
|
+
- mapp
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- exe/mapp
|
36
|
+
- lib/mruby_app.rb
|
37
|
+
- lib/mruby_app/cli.rb
|
38
|
+
- lib/mruby_app/mruby/main.rb
|
39
|
+
- lib/mruby_app/version.rb
|
40
|
+
homepage: https://github.com/Dan2552/mruby_app
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubygems_version: 3.0.3
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: A CLI tool for using Ruby (mruby) code as a project.
|
63
|
+
test_files: []
|