2016-10-19 51 views
0

我已經寫在窗口小腳本的項目,我有我的寶石文件中的三個寶石創建Windows可執行文件紅寶石APP

我使用旅行在Ubuntu Ruby創建了包,但在rake任務時,腳本嘗試下載這些寶石這三個寶石給出錯誤,因爲我認爲它的窗口特定的寶石,並尋找一些依賴關係

我把這些寶石保存在項目中,並在gem文件中引用,該腳本創建好zip文件,但是當我運行在Windows上錯誤的Win32 ...寶石沒有找到

rake package:win32 outputs when it try to fetch gems 

```shell 
Fetching gem metadata from http://rubygems.org/............ 
Fetching version metadata from http://rubygems.org/. 
Resolving dependencies... 
Using jmespath 1.3.1 
Using ffi 1.9.14 
Using mini_magick 4.3.6 
Installing win32-api 1.4.8 (was 1.6.0) with native extensions 
Using bundler 1.13.5 
Using aws-sdk-core 2.6.10 
Using rautomation 0.17.0 
Using win32-clipboard 0.6.4 
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    /home/vishalgarg/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20161019-3963-1e9bkxl.rb extconf.rb 
checking for strncpy_s()... no 
creating Makefile 

make "DESTDIR=" clean 

make "DESTDIR=" 
compiling win32/api.c 
win32/api.c:2:21: fatal error: windows.h: No such file or directory 
#include <windows.h> 
        ^
compilation terminated. 
make: *** [api.o] Error 1 

make failed, exit code 2 


``` 

回答

0

所以最後我得到了答案,所以旅行紅寶石簡化版,工作對我來說,因爲它的一些侷限性

因此其良好的用OCRA寶石(https://github.com/larsch/ocra

簡單走在Windows上安裝寶石(我已經對窗口的應用程序) 和運行命令

ocra <Ruby file name > --verbose --gem-full --no-dep-run --add-all-core --gemfile Gemfile 

它將生成exe文件,你就可以在任何Windows運行