Rakefile in atome-0.5.6.3.1 vs Rakefile in atome-0.5.6.3.5

- old
+ new

@@ -1,26 +1,36 @@ # frozen_string_literal: true + + require 'fileutils' require 'securerandom' require 'digest/sha2' require 'rubygems' require 'rubygems/command_manager' require 'rubygems/uninstaller' require 'bundler/gem_tasks' load 'exe/atome' -folder_name = 'lib/eVe' +# folder_name = 'lib/eVe' +# +# # allow or deny eVe gem content to be copied to local eVe or not +refresh_eVe=true +# +# # if refresh_eVe +# # # doesn't work +# # `bundle update` +# # end +# +# unless Dir.exist?(folder_name) +# Dir.mkdir(folder_name) +# File.open('lib/eVe/eVe_relative.rb', 'w') do |file| +# end +# File.open('lib/eVe/eVe.rb', 'w') do |file| +# end +# end -unless Dir.exist?(folder_name) - Dir.mkdir(folder_name) - File.open('lib/eVe/eVe_relative.rb', 'w') do |file| - end - File.open('lib/eVe/eVe.rb', 'w') do |file| - end -end - task :cleanup do manager = Gem::CommandManager.instance cleanup_command = manager['cleanup'] @@ -75,12 +85,12 @@ def generate_resolved_file(source_file_path) root_path = File.dirname(File.expand_path(source_file_path)) resolve_requires(source_file_path, root_path) end -def wasm_params(source, destination, project_name, wasi_file, host_mode, script_source) - create_application(source, destination, project_name) +def wasm_params(source, destination, project_name, wasi_file, host_mode, script_source, refresh_eVe) + create_application(source, destination, project_name, refresh_eVe) wasm_common(source, destination, project_name, wasi_file, host_mode, script_source) end task :test_wasm do project_name = :test @@ -102,23 +112,23 @@ 'wasi-vfs-osx_x86' end destination = './tmp' script_source = './test/application' - wasm_params(source, destination, project_name, wasi_file, host_mode, script_source) + wasm_params(source, destination, project_name, wasi_file, host_mode, script_source,refresh_eVe) system "open", file_path when /linux|bsd/ destination = './tmp' script_source = './test/application' wasi_file = 'wasi-vfs-unix pack tmp' - wasm_params(source, destination, project_name, wasi_file, host_mode, script_source) + wasm_params(source, destination, project_name, wasi_file, host_mode, script_source,refresh_eVe) system "xdg-open", file_path when /mswin|mingw|cygwin/ destination = '.\\tmp' script_source = '.\\test\\application' wasi_file = 'wasi-vfs.exe pack' - wasm_params(source, destination, project_name, wasi_file, host_mode, script_source) + wasm_params(source, destination, project_name, wasi_file, host_mode, script_source,refresh_eVe) system "start", file_path else raise "Système d'exploitation non reconnu" end @@ -128,11 +138,11 @@ task :test_opal do project_name = :test source = '.' destination = './tmp' script_source = './test/application' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) # the line below is to add addition script to the application folder (useful for test per example) add_to_application_folder(script_source, destination, project_name) # build opal build_opal_library(source, destination, project_name) # build parser @@ -164,22 +174,40 @@ source = '.' destination = './tmp' script_source = './test/application' wasi_file = 'wasi-vfs-osx_arm' host_mode = 'pure_wasm' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) wasm_common(source, destination, project_name, wasi_file, host_mode, script_source) puts 'atome wasm is build and running!' + threads = [] + threads << Thread.new do + + sleep 1 + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ + # code to exec for Windows + `start http://localhost:9292` + # `start #{destination}\\#{project_name}\\src\\index_server.html` + + elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ + # code to exec for MacOS + `open http://localhost:9292` + else + # code to exec for Unix/Linux + `open http://localhost:9292` + end + + end build_for_wasm_server(destination, project_name, 9292, :production) end task :test_server do project_name = :test source = '.' destination = './tmp' script_source = './test/application' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) # the line below is to add addition script to the application folder (useful for test per example) add_to_application_folder(script_source, destination, project_name) # build opal build_opal_library(source, destination, project_name) # build parser @@ -218,11 +246,11 @@ task :opal_server_rebuild do project_name = :test source = '.' destination = './tmp' script_source = './test/application' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) # the line below is to add addition script to the application folder (useful for test per example) add_to_application_folder(script_source, destination, project_name) # build opal build_opal_library(source, destination, project_name) # build parser @@ -263,11 +291,11 @@ source = '.' destination = './tmp' script_source = './test/application' wasi_file = 'wasi-vfs-osx_arm' host_mode = 'tauri' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) wasm_common(source, destination, project_name, wasi_file, host_mode, script_source) destination = './tmp' # build and open the app build_for_osx(destination, :dev) puts 'atome osx is running' @@ -278,11 +306,11 @@ source = '.' destination = './tmp' script_source = './test/application' wasi_file = 'wasi-vfs-osx_arm' host_mode = 'tauri' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) wasm_common(source, destination, project_name, wasi_file, host_mode, script_source) destination = './tmp' # build and open the app build_for_osx(destination, :build) puts 'atome osx is running' @@ -304,11 +332,11 @@ task :osx_server do project_name = :test source = '.' destination = './tmp' script_source = './test/application' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) # the line below is to add addition script to the application folder (useful for test per example) add_to_application_folder(script_source, destination, project_name) # build opal build_opal_library(source, destination, project_name) # build parser @@ -327,11 +355,11 @@ source = '.' destination = './tmp' script_source = './test/application' wasi_file = 'wasi-vfs-osx_arm' host_mode = 'tauri' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) wasm_common(source, destination, project_name, wasi_file, host_mode, script_source) destination = './tmp' threads = [] threads << Thread.new do build_for_opal_server(destination, project_name, 9292, :production) @@ -423,10 +451,10 @@ # now building new test app project_name = :test source = '.' destination = './tmp' script_source = './test/application' - create_application(source, destination, project_name) + create_application(source, destination, project_name, refresh_eVe) # the line below is to add addition script to the application folder (useful for test per example) add_to_application_folder(script_source, destination, project_name) # build opal build_opal_library(source, destination, project_name) # build parser