Rakefile in atome-0.5.5.6.5 vs Rakefile in atome-0.5.5.6.6
- old
+ new
@@ -4,15 +4,43 @@
require 'digest/sha2'
require 'bundler/gem_tasks'
load 'exe/atome'
task :cleanup do
- `gem cleanup atome;yes | gem uninstall atome;cd pkg`
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `gem cleanup atome`
+ `echo yes | gem uninstall atome`
+ `cd pkg`
+
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `gem cleanup atome;yes | gem uninstall atome;cd pkg`
+ else
+ # Code à exécuter sous Unix/Linux
+ `gem cleanup atome;yes | gem uninstall atome;cd pkg`
+ end
+
+
end
task :reset_cache do
- `rm -r -f ./tmp`
- `rm -r -f ./pkg`
+
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `rmdir /s /q .\\tmp`
+ `rmdir /s /q .\\pkg`
+
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `rm -r -f ./tmp`
+ `rm -r -f ./pkg`
+ else
+ # Code à exécuter sous Unix/Linux
+ `rm -r -f ./tmp`
+ `rm -r -f ./pkg`
+ end
+
end
def resolve_requires(file_path, root_path, processed_files = Set.new, depth = 0)
return '' unless File.exist?(file_path)
return '' if processed_files.include?(file_path) || depth > 10 # check circular dependencies and depth
@@ -49,11 +77,22 @@
script_source = './test/application'
wasi_file = 'wasi-vfs-osx_arm'
host_mode = 'pure_wasm'
create_application(source, destination, project_name)
wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
- `open ./tmp/#{project_name}/src/index.html`
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `start "" ".\\tmp\\#{project_name}\\src\\index.html"`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `open ./tmp/#{project_name}/src/index.html`
+ else
+ # Code à exécuter sous Unix/Linux
+ `open ./tmp/#{project_name}/src/index.html`
+ end
+
+
puts 'atome wasm is build and running!'
end
task :test_wasm_osx_x86 do
# wasi Source here : https://github.com/kateinoigakukun/wasi-vfs/releases
@@ -63,11 +102,22 @@
script_source = './test/application'
wasi_file = 'wasi-vfs-osx_x86'
host_mode = 'pure_wasm'
create_application(source, destination, project_name)
wasm_common(source, destination, project_name, wasi_file, script_source, host_mode, script_source)
- `open ./tmp/#{project_name}/src/index.html`
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `start "" ".\\tmp\\#{project_name}\\src\\index.html"`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `open ./tmp/#{project_name}/src/index.html`
+ else
+ # Code à exécuter sous Unix/Linux
+ `open ./tmp/#{project_name}/src/index.html`
+ end
+
+
puts 'atome wasm is build and running!'
end
task :test_wasm_windows do
# wasi Source here : https://github.com/kateinoigakukun/wasi-vfs/releases
project_name = :test
@@ -76,11 +126,20 @@
script_source = './test/application'
wasi_file = 'wasi-vfs.exe pack'
host_mode = 'pure_wasm'
create_application(source, destination, project_name)
wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
- `open ./tmp/#{project_name}/src/index.html`
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `start "" ".\\tmp\\#{project_name}\\src\\index.html"`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `open ./tmp/#{project_name}/src/index.html`
+ else
+ # Code à exécuter sous Unix/Linux
+ `open ./tmp/#{project_name}/src/index.html`
+ end
puts 'atome wasm is build and running!'
end
task :test_wasm_unix do
# wasi Source here : https://github.com/kateinoigakukun/wasi-vfs/releases
project_name = :test
@@ -89,11 +148,20 @@
script_source = './test/application'
wasi_file = 'wasi-vfs-unix pack tmp'
host_mode = 'pure_wasm'
create_application(source, destination, project_name)
wasm_common(source, destination, project_name, wasi_file, host_mode, script_source)
- `open ./tmp/#{project_name}/src/index.html`
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `start "" ".\\tmp\\#{project_name}\\src\\index.html"`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `open ./tmp/#{project_name}/src/index.html`
+ else
+ # Code à exécuter sous Unix/Linux
+ `open ./tmp/#{project_name}/src/index.html`
+ end
puts 'atome wasm is build and running!'
end
task :test_opal do
project_name = :test
@@ -114,11 +182,21 @@
# build Opal extensions
build_opal_extensions(source, destination, project_name)
# build application
build_opal_application(source, destination, project_name)
# open the app
- `open #{destination}/#{project_name}/src/index_opal.html`
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `start "" "#{destination}\\#{project_name}\\src\\index_opal.html"`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `open #{destination}/#{project_name}/src/index_opal.html`
+ else
+ # Code à exécuter sous Unix/Linux
+ `open #{destination}/#{project_name}/src/index_opal.html`
+ end
+
puts 'atome opal is build and running!'
end
task :server_wasm do
project_name = :test
source = '.'
@@ -155,11 +233,22 @@
build_opal_application(source, destination, project_name)
# build and open the app
threads = []
threads << Thread.new do
sleep 1
- `open http://localhost:9292`
+
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `start "" "http://localhost:9292"`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `open http://localhost:9292`
+ else
+ # Code à exécuter sous Unix/Linux
+ `open http://localhost:9292`
+ end
+
end
build_for_server(destination, project_name, 9292, :production)
end
task :test_osx do
@@ -243,22 +332,30 @@
build_for_osx(destination)
puts 'atome osx is running'
-
-
-
-
end
task :build_gem do
# building the gem
`rake build` # run build_app thru ARGV in exe atome
# installing the gem
- `cd pkg; gem install atome --local`
- # open the app
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ # Code à exécuter sous Windows
+ `cd pkg && gem install atome --local`
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/
+ # Code à exécuter sous MacOS
+ `cd pkg; gem install atome --local`
+ # open the app
+ else
+ # Code à exécuter sous Unix/Linux
+ `cd pkg; gem install atome --local`
+ # open the app
+ end
+
+
puts 'atome gem built and installed'
end
# task :run_wasm_client_code do
# app_name = :test