I'm new to ruby and I'm trying to use ocra to pack a script that uses the fxruby gem to create a GUI, however, my command creates an executable that doesn't perform any action, this is the command I'm using:
ocra --no-enc --no-dep-run --gem-full --add-all-core table.rbw
Can anyone tell me what I'm doing wrong? I've searched the internet but couldn't find any useful info, any help is much appreciated.
Are you trying to generate an *.exe for Windows?
I have some scripts that also use FX and they run nicely on Windows.
This is how I generate the file:
ocra MyScript.rb --gem-all --windows
You can also try
ocra --help
And this will display all the parameters available.
Related
So, I have a CLI tool I'm building using the commander gem.
The executable successfully executes correctly when used directly from the bin folder (bin/dynamised), but when I install the gem locally and then run it from the command line (dynamised) it doesn't seem to do anything.
If I add puts 'WORKING' to the top of the file, I see that but nothing else.
EDIT:
output of puts [$0, __FILE__].inspect:
from bin:
["bin/dynamised", "bin/dynamised"]
from installed gem:
["/Users/---------/.rbenv/versions/2.3.0/bin/dynamised", "/Users/---------/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/Dynamised-0.1.4/bin/dynamised"]
Link to gist containing executable.
Not quite sure what's wrong.
Change the very last line of your script to:
Dynamised::CLI.new.run if File.basename($0) == File.basename(__FILE__)
or simply remove this redundant check:
Dynamised::CLI.new.run
I have a Ruby gem with some scripts that are distributed as executables. On Linux, this means that they go on the PATH with the executable bit set when the gem is installed. But on Windows, I don't see that or anything equivalent. So, how can I make those scripts usable from the command line on Windows?
I noticed that the Gem::Installer package has a generate_windows_script command, which from the brief description appears to match what I'm trying to do. Can I use that to help here, and if so, how?
I was having trouble getting jekyll to work with Ruby using cygwin on Windows 7 64-bit. I had better results using rubyinstaller + devkit. It would be really nice if I could use the rubyinstaller ruby inside of cygwin.
However, I get the following message when I try to execute rake.
$ rake page name="pages/about.md"
C:\Ruby193\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby193/bin/rake (LoadError)
Is there any way to make rubyinstaller play nice with cygwin?
I just put a few of these in my .bash_profile:
alias gem=gem.bat
alias irb=irb.bat
alias rake=rake.bat
I never have any of the problems that Luis mentions.
The problem is cygwin converting all the scripts paths into cygwin paths (/cygdrive/...).
There is no solution for that since the invoke of the script is made from bash over rake scrip which invokes native Ruby.
There are a lot of other issues that cygwin will cause, and some are covered in RubyInstaller troubleshooting page
One alternative will be invoking rake.bat directly, skipping cygwin shebang detection.
But cygwin doesn't like batch files, which forces you to do cmd.exe /C rake.bat and that is a noisy command line.
The other alternative is install something like gem-exefy (gem install gem-exefy) and generate executables for your installed gems (rake.exe).
That way you invoke rake.exe instead of letting cygwin figure it out.
Another alternative is use MSYS Bash (included in DevKit) instead of cygwin, which plays way better than cygwin one, but you will still have issues with batch files.
As you can see, mixing non-native (cygwin) with native (RubyInstaller) have a lot of side-effects.
I wrote a program in Ruby but I want to make an executable file from my program in order to run it in any computers( that they don't have ruby).How can I make executable file?
thanks
You could use RubyScript2Exe
http://www.erikveen.dds.nl/rubyscript2exe/
.. it collects all necessary files to run your application on an other machine: the Ruby application, the Ruby interpreter and the Ruby runtime library (stripped down for your application)
You should look at this list of options given your needs:
http://ruby-toolbox.com/categories/packaging_to_executables.html
They all have their strengths and drawbacks. NOTE: I have not used any of them.
Take a look on my rb2exe. It supports Rails and Gemfile.
gem install rb2exe
echo "puts 'Hello world'" > test.rb
rb2exe test.rb
./test
You can also check my detailed step-by-step how to, here:
http://www.learnwithdaniel.com/2016/08/ruby-to-portable-exe-app/
I never used ruby before, I just wanted to play around with HAML and SASS. I downloaded and installed Ruby's Windows installer (v1.9.1). Then, I clicked ruby.exe (the icon with a black window and a multicolored gem in the picture). Finally, I typed gem install haml and pressed Enter. But nothing happened. Am I doing something wrong?
Reference picture:
alt text http://img707.imageshack.us/img707/9863/haml.png
You might need to put the path to Ruby into the PATH environment variable to do this, but this is how I do it:
I open up the command line utility. I then type ruby -S gem install <whatever>. This works like a charm.
I tried running Ruby and it shows a blank screen but lets me type code. When I press CTRL + C to cancel it then executes my code as well. Maybe you need to do that in the manner you are trying to right now. I just find it easier to just ruby -S <statement> instead. IronRuby gives me the REPL no problems though.
ruby.exe is the Ruby interpreter. If you want to type code into it, you obviously need to type Ruby code into it, not DOS command code.
The gem command is a DOS batch file (gem.bat). DOS batch files need to be run from the DOS command interpreter.
Installing Ruby using RubyInstaller, you get an shortcut in the Programs menu that let you open a command prompt with Ruby in the PATH
You use that in case you didn't select the option to add Ruby to the PATH.
Either case, the gem command you typed in should be entered at the command prompt, and not inside Ruby itself.
The latest build (rubyinstaller-1.9.2-p136.exe) had a problem. Rename the folder: c:\ruby192\lib\ruby\site_ruby or delete it altogether and this fixes "gem"
You can do "gem install compass" or if you're behind a proxy you might need to do.
gem install –http-proxy compass
Here's a blog post with all the details:
http://francisshanahan.com/index.php/2011/how-to-theme-sencha-touch-sass-windows/
Hope that helps,
-fs
this is how i installed ruby and sass on my windows machine: How to install ruby and sass on windows?