mwc 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -1
- data/README.md +13 -2
- data/lib/mwc/command.rb +2 -0
- data/lib/mwc/commands/watch.rb +74 -0
- data/lib/mwc/tasks.rb +3 -4
- data/lib/mwc/version.rb +1 -1
- data/{mwasm.gemspec → mwc.gemspec} +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4b4b1574d426900e20e49fb707a5538882b7794ffdd147fea85ec9d6f5d4024
|
4
|
+
data.tar.gz: 8076656677cf17443b8dd2a245e7bbc44c94e015defec1ca1019d78c0ba0fff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61be1d10ff8a8faed53458cb961fdc503e8d10903d0ed0520e379fff50459279b34b8a2e6b409bb93db43895fed0981d9d404a163a53226f5baa877fde7f6911
|
7
|
+
data.tar.gz: 59a0720a29ca89f3f9a6e4e36e025b09632fb7088693f64d6a34ad7c5fc719e1481ebe689e527d819fc3b0d7d61e9562e88a8697930e211b04d1dc3514b1e5a9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mwc (0.
|
4
|
+
mwc (0.4.0)
|
5
|
+
listen (~> 3.2.0)
|
5
6
|
rack (~> 2.0.7)
|
6
7
|
rake (~> 10.0)
|
7
8
|
thor (~> 0.20.3)
|
@@ -15,8 +16,12 @@ GEM
|
|
15
16
|
thor (~> 0.18)
|
16
17
|
childprocess (3.0.0)
|
17
18
|
diff-lcs (1.3)
|
19
|
+
ffi (1.11.3)
|
18
20
|
iniparse (1.4.4)
|
19
21
|
jaro_winkler (1.5.4)
|
22
|
+
listen (3.2.1)
|
23
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
24
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
20
25
|
overcommit (0.51.0)
|
21
26
|
childprocess (>= 0.6.3, < 4)
|
22
27
|
iniparse (~> 1.4)
|
@@ -26,6 +31,9 @@ GEM
|
|
26
31
|
rack (2.0.7)
|
27
32
|
rainbow (3.0.0)
|
28
33
|
rake (10.5.0)
|
34
|
+
rb-fsevent (0.10.3)
|
35
|
+
rb-inotify (0.10.0)
|
36
|
+
ffi (~> 1.0)
|
29
37
|
rspec (3.9.0)
|
30
38
|
rspec-core (~> 3.9.0)
|
31
39
|
rspec-expectations (~> 3.9.0)
|
data/README.md
CHANGED
@@ -82,7 +82,7 @@ end
|
|
82
82
|
### Project
|
83
83
|
|
84
84
|
|Name|Type|Description
|
85
|
-
|
85
|
+
|----|----|-----------
|
86
86
|
|name|string| The project name, will change the generated file name. ex. `mruby.wasm`
|
87
87
|
|shell|string| The shell file template, if you want to use your own html template
|
88
88
|
|source_map|boolean| Enable source map for debug
|
@@ -91,9 +91,20 @@ end
|
|
91
91
|
### mruby
|
92
92
|
|
93
93
|
|Name|Type|Description
|
94
|
-
|
94
|
+
|----|----|-----------
|
95
95
|
|version|string| The prefer mruby version
|
96
96
|
|
97
|
+
## Roadmap
|
98
|
+
|
99
|
+
* [ ] Unit Test
|
100
|
+
* [ ] Download options for mruby
|
101
|
+
* [x] Archive
|
102
|
+
* [ ] Git Submodule
|
103
|
+
* [ ] Integrate to Webpack
|
104
|
+
* [ ] Watch Mode
|
105
|
+
* [x] Auto re-compile
|
106
|
+
* [ ] Add LiveReload support
|
107
|
+
|
97
108
|
## Development
|
98
109
|
|
99
110
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/mwc/command.rb
CHANGED
@@ -6,6 +6,7 @@ require 'mwc/utils/command_registry'
|
|
6
6
|
require 'mwc/config'
|
7
7
|
require 'mwc/commands/init'
|
8
8
|
require 'mwc/commands/compile'
|
9
|
+
require 'mwc/commands/watch'
|
9
10
|
require 'mwc/commands/server'
|
10
11
|
|
11
12
|
module Mwc
|
@@ -22,6 +23,7 @@ module Mwc
|
|
22
23
|
|
23
24
|
add_command Commands::Init
|
24
25
|
add_command Commands::Compile
|
26
|
+
add_command Commands::Watch
|
25
27
|
add_command Commands::Server
|
26
28
|
end
|
27
29
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'listen'
|
4
|
+
|
5
|
+
require 'mwc/utils/command'
|
6
|
+
require 'mwc/tasks'
|
7
|
+
require 'mwc'
|
8
|
+
|
9
|
+
module Mwc
|
10
|
+
module Commands
|
11
|
+
# :nodoc:
|
12
|
+
class Watch < Thor::Group
|
13
|
+
include Thor::Actions
|
14
|
+
include Utils::Command
|
15
|
+
|
16
|
+
name 'watch'
|
17
|
+
description 'watch src changes and auto re-compile'
|
18
|
+
add_option :format, default: 'html', enum: %w[html js wasm]
|
19
|
+
|
20
|
+
DESIRE_FILES = /\.(h|c|cpp|js)$/.freeze
|
21
|
+
|
22
|
+
def prepare
|
23
|
+
@stopped = false
|
24
|
+
@dirs = [
|
25
|
+
Mwc.root.join('src'),
|
26
|
+
Mwc.root.join('include')
|
27
|
+
].map(&:to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
def setup_tasks
|
31
|
+
Tasks.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup_listener
|
35
|
+
@listener = Listen.to(*@dirs, only: DESIRE_FILES) do |*_|
|
36
|
+
Mwc.use(parent_options['env']) do
|
37
|
+
# TODO: Allow change output directory
|
38
|
+
empty_directory('dist')
|
39
|
+
|
40
|
+
compile
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def start
|
46
|
+
puts 'Starting watch file changes...'
|
47
|
+
@listener.start
|
48
|
+
|
49
|
+
Signal.trap(:INT) { exit }
|
50
|
+
sleep
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def task
|
56
|
+
Rake::Task[parent_options['format']]
|
57
|
+
end
|
58
|
+
|
59
|
+
def compile
|
60
|
+
task.invoke
|
61
|
+
puts 'Compiled!'
|
62
|
+
rescue RuntimeError
|
63
|
+
puts 'Compile Failed'
|
64
|
+
ensure
|
65
|
+
reset
|
66
|
+
end
|
67
|
+
|
68
|
+
def reset
|
69
|
+
task.all_prerequisite_tasks.each(&:reenable)
|
70
|
+
task.reenable
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/mwc/tasks.rb
CHANGED
@@ -41,12 +41,11 @@ module Mwc
|
|
41
41
|
# :nodoc:
|
42
42
|
def compile_wasm_task
|
43
43
|
%i[wasm html js].each do |format|
|
44
|
-
|
44
|
+
desc "Compile sources to #{format} WebAssembly"
|
45
|
+
task format => BINARIES do
|
46
|
+
Rake::Task['mruby:all'].invoke
|
45
47
|
compile(format)
|
46
48
|
end
|
47
|
-
|
48
|
-
desc "Compile sources to #{format} WebAssembly"
|
49
|
-
task format => "mruby.#{format}"
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
data/lib/mwc/version.rb
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ['lib']
|
33
33
|
|
34
|
+
spec.add_runtime_dependency 'listen', '~> 3.2.0'
|
34
35
|
spec.add_runtime_dependency 'rack', '~> 2.0.7'
|
35
36
|
spec.add_runtime_dependency 'rake', '~> 10.0'
|
36
37
|
spec.add_runtime_dependency 'thor', '~> 0.20.3'
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mwc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11
|
11
|
+
date: 2019-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: listen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rack
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +162,7 @@ files:
|
|
148
162
|
- lib/mwc/commands/compile.rb
|
149
163
|
- lib/mwc/commands/init.rb
|
150
164
|
- lib/mwc/commands/server.rb
|
165
|
+
- lib/mwc/commands/watch.rb
|
151
166
|
- lib/mwc/compile_options.rb
|
152
167
|
- lib/mwc/config.rb
|
153
168
|
- lib/mwc/environment.rb
|
@@ -164,7 +179,7 @@ files:
|
|
164
179
|
- lib/mwc/utils/hash_accessor.rb
|
165
180
|
- lib/mwc/utils/option.rb
|
166
181
|
- lib/mwc/version.rb
|
167
|
-
-
|
182
|
+
- mwc.gemspec
|
168
183
|
homepage: https://github.com/elct9620/mwc
|
169
184
|
licenses:
|
170
185
|
- MIT
|