Rakefile in atome-0.5.5.6.8 vs Rakefile in atome-0.5.5.6.9

- old
+ new

@@ -14,57 +14,29 @@ cleanup_command = manager['cleanup'] begin cleanup_command.invoke('atome') rescue Gem::SystemExitException => e - puts "Erreur lors du nettoyage : #{e.message}" + puts "Error : #{e.message}" end begin uninstaller = Gem::Uninstaller.new('atome', { executables: true, all: true, force: true }) uninstaller.uninstall rescue Gem::InstallError => e - puts "Erreur lors de la désinstallation : #{e.message}" + puts "Error uninstalling : #{e.message}" end Dir.chdir('pkg') do - # Effectuez vos opérations dans le dossier 'pkg' + # treatment here end - # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ - # # code to exec for Windows - # `gem cleanup atome` - # `echo yes | gem uninstall atome` - # `cd pkg` - # - # elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ - # # code to exec for MacOS - # `gem cleanup atome;yes | gem uninstall atome;cd pkg` - # else - # # code to exec for Unix/Linux - # `gem cleanup atome;yes | gem uninstall atome;cd pkg` - # end end task :reset_cache do FileUtils.rm_rf('./tmp') FileUtils.rm_rf('./pkg') - # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ - # # code to exec for Windows - # `rmdir /s /q .\\tmp` - # `rmdir /s /q .\\pkg` - # - # elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ - # # code to exec for MacOS - # `rm -r -f ./tmp` - # `rm -r -f ./pkg` - # else - # # code to exec for 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 @@ -140,77 +112,10 @@ 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 -# project_name = :test -# source = '.' -# destination = './tmp' -# 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) -# if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ -# # code to exec for Windows -# `start "" ".\\tmp\\#{project_name}\\src\\index.html"` -# elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ -# # code to exec for MacOS -# `open ./tmp/#{project_name}/src/index.html` -# else -# # code to exec for 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 -# source = '.' -# destination = './tmp' -# 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) -# if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ -# # code to exec for Windows -# `start "" ".\\tmp\\#{project_name}\\src\\index.html"` -# elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ -# # code to exec for MacOS -# `open ./tmp/#{project_name}/src/index.html` -# else -# # code to exec for 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 -# source = '.' -# destination = './tmp' -# 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) -# if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ -# # code to exec for Windows -# `start "" ".\\tmp\\#{project_name}\\src\\index.html"` -# elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ -# # code to exec for MacOS -# `open ./tmp/#{project_name}/src/index.html` -# else -# # code to exec for 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 source = '.' destination = './tmp' @@ -251,11 +156,10 @@ 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` puts 'atome wasm is build and running!' build_for_server(destination, project_name, 9292, :production) end task :test_server do @@ -402,38 +306,105 @@ puts 'atome gem built and installed' end task :push_gem do + # pushing the gem - # # pushing the gem - # if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ - # # code to exec for Windows - # `cd pkg && gem push atome` - # elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ - # # code to exec for MacOS - # `cd pkg; gem push atome` - # # open the app - # else - # # code to exec for Unix/Linux - # `cd pkg; gem push atome` - # # open the app - # end - # - # puts 'atome gem pushed' + dir_path = './pkg' + entries = Dir.entries(dir_path) + + gem_files = entries.select { |file| file.end_with?('.gem') } + + sorted_versions = gem_files.map { |file| + file.scan(/\d+\.\d+\.\d+\.\d+\.\d+/).first + }.compact.sort_by { |version| Gem::Version.new(version) } + + latest_version = sorted_versions.last + latest_file = gem_files.find { |file| file.include?(latest_version) } + + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ + # code to exec for Windows + `cd pkg && gem push #{latest_file}` + elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ + # code to exec for MacOS + `cd pkg; gem push #{latest_file}` + # open the app + else + # code to exec for Unix/Linux + `cd pkg; gem push #{latest_file}` + end + puts "#{latest_file} pushed" end -# task :run_wasm_client_code do -# app_name = :test -# dest_path = './tmp/' -# user_code = './test/application' -# # user_code = './vendor/assets/application' -# # user_code = './test/client/delices_de_vezelin' -# application_location = "#{dest_path}#{app_name}" -# source_file = "#{user_code}/index.rb" -# new_file_content = generate_resolved_file(source_file) -# index_html = File.read('vendor/assets/src/index.html') -# index_html = index_html.sub('</html>', "<script type='text/ruby' >#{new_file_content}</script>\n</html>") -# File.write("#{application_location}/src/index.html", index_html) -# `open #{application_location}/src/index.html` -# puts 'atome wasm user code executed' -# end + +task :full_test do + + # building the gem + `rake build` # run build_app thru ARGV in exe atome + # installing the gem + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ + # code to exec for Windows + `cd pkg && gem install atome --local` + elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ + # code to exec for MacOS + `cd pkg; gem install atome --local` + # open the app + else + # code to exec for Unix/Linux + `cd pkg; gem install atome --local` + # open the app + end + + puts 'atome gem built and installed' + + # now building new test app + project_name = :test + source = '.' + destination = './tmp' + script_source = './test/application' + create_application(source, destination, project_name) + # 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 + build_opal_parser(source, destination, project_name) + # build atome kernel + build_atome_kernel_for_opal(source, destination, project_name) + # build host_mode + build_host_mode(destination, project_name, 'web-opal') + # build Opal extensions + build_opal_extensions(source, destination, project_name) + # build application + build_opal_application(source, destination, project_name) + # open the app + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ + # code to exec for Windows + `start "" "#{destination}\\#{project_name}\\src\\index_opal.html"` + elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ + # code to exec for MacOS + `open #{destination}/#{project_name}/src/index_opal.html` + else + # code to exec for Unix/Linux + `open #{destination}/#{project_name}/src/index_opal.html` + end + + puts 'atome opal is build and running!' + + # now running the app + if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ + # code to exec for Windows + `cd #{destination} && atome run server` + elsif RbConfig::CONFIG['host_os'] =~ /darwin|mac os/ + # code to exec for MacOS + `cd #{destination}; atome run server` + # open the app + else + # code to exec for Unix/Linux + `cd #{destination}; atome run server` + # open the app + end + +end + +