jsg 0.1.0 → 0.1.1
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/exe/jsg +37 -8
- data/lib/jsg/version.rb +1 -1
- metadata +2 -3
- data/template/serve.sh +0 -1
- /data/template/{.gitignore → gitignore} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 403d8e26f8694b1dcd29406d069d6b1a64774f3290f5422347b0bad791b9ee5c
|
4
|
+
data.tar.gz: 8771f3e2158e38ad976f3d188bfcf2fbd890d211d543139031718dc68376f593
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c2708f22fef8d75a31dcbc2ed67f27a35a33490f21e2a4611a791cc7c9c644898be362afea8701115da932b6709ea9c91eb92d5166a5b99e523c24768b234c
|
7
|
+
data.tar.gz: 7bd3d4203d3a39baaabc4acffb9a88f1a0246c69fcb6db0a512205e3ced2868803d241489c55c84eb04b05a54d244132283d942134185ff56a00cb9edb610789
|
data/exe/jsg
CHANGED
@@ -12,8 +12,7 @@ module JSG
|
|
12
12
|
destination = File.join(Dir.pwd, project_name)
|
13
13
|
|
14
14
|
if Dir.exist?(destination)
|
15
|
-
|
16
|
-
return
|
15
|
+
raise "Sorry #{destination} already exists, please choose other name or delete the folder"
|
17
16
|
end
|
18
17
|
FileUtils.mkdir_p(destination)
|
19
18
|
|
@@ -32,6 +31,8 @@ module JSG
|
|
32
31
|
|
33
32
|
relative_path = file_path.sub("#{base_path}/", "").gsub(/\.erb$/, "")
|
34
33
|
new_file_path = File.join(destination, relative_path)
|
34
|
+
|
35
|
+
new_file_path.gsub!("gitignore", ".gitignore")
|
35
36
|
FileUtils.mkdir_p(File.dirname(new_file_path))
|
36
37
|
File.write(new_file_path, result)
|
37
38
|
end
|
@@ -39,8 +40,26 @@ module JSG
|
|
39
40
|
|
40
41
|
def self.build
|
41
42
|
system("bundle install")
|
42
|
-
|
43
|
-
|
43
|
+
system("rbwasm build -o assets/ruby-app.wasm")
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.server
|
47
|
+
require 'webrick'
|
48
|
+
|
49
|
+
port = 8080
|
50
|
+
|
51
|
+
loop do
|
52
|
+
begin
|
53
|
+
server = WEBrick::HTTPServer.new(BindAddres: '0.0.0.0', :Port => port, :DocumentRoot => Dir.pwd)
|
54
|
+
trap('INT') { server.shutdown }
|
55
|
+
puts "Serving at port http://0.0.0.0.:#{port}"
|
56
|
+
server.start
|
57
|
+
break
|
58
|
+
rescue Errno::EADDRINUSE
|
59
|
+
port += 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
44
63
|
end
|
45
64
|
end
|
46
65
|
|
@@ -52,17 +71,27 @@ when "new"
|
|
52
71
|
project_name = ARGV.shift # Next argument should be the project name
|
53
72
|
|
54
73
|
if project_name
|
55
|
-
|
56
|
-
|
74
|
+
begin
|
75
|
+
JSG.create_project(project_name)
|
76
|
+
# check if we have an internet connection or think about caching this somewhere.
|
77
|
+
Dir.chdir(project_name) do
|
78
|
+
JSG.build
|
79
|
+
end
|
80
|
+
rescue StandardError => e
|
81
|
+
end
|
57
82
|
else
|
58
83
|
puts "Error: Project name is required."
|
59
|
-
puts "For help, run: jsg new --help"
|
84
|
+
#puts "For help, run: jsg new --help"
|
60
85
|
exit 1
|
61
86
|
end
|
62
87
|
when "build"
|
63
88
|
JSG.build
|
89
|
+
when "serve", "server"
|
90
|
+
JSG.server
|
64
91
|
else
|
65
92
|
puts "Unknown command: #{command}"
|
66
|
-
puts "Use 'jsg new
|
93
|
+
puts "Use 'jsg new projectname' for creating new projects."
|
94
|
+
puts "Use 'jsg build to build the .wasm file of the project."
|
95
|
+
puts "Use 'jsg server to start a server."
|
67
96
|
exit 1
|
68
97
|
end
|
data/lib/jsg/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andi
|
@@ -61,11 +61,10 @@ files:
|
|
61
61
|
- jsg.rb
|
62
62
|
- lib/jsg/version.rb
|
63
63
|
- sig/jsg.rbs
|
64
|
-
- template/.gitignore
|
65
64
|
- template/Gemfile
|
66
65
|
- template/assets/browser.script.iife.js
|
66
|
+
- template/gitignore
|
67
67
|
- template/index.html.erb
|
68
|
-
- template/serve.sh
|
69
68
|
- template/src/main.rb
|
70
69
|
homepage: https://github.com/largo/jsg
|
71
70
|
licenses:
|
data/template/serve.sh
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby -run -e httpd . -p 8080
|
File without changes
|