Can Sinatra be used with IronRuby? - sinatra

I'm trying to install the following ruby gem on my mac:
http://www.sinatrarb.com/intro.html
I get the following message:
michael-rosarios-macbook:bin michaelrosario1$ mono ir.exe igem sinatra
ERROR: While executing gem ... (RuntimeError)
Unknown command sinatra
michael-rosarios-macbook:bin michaelrosario1$
Can someone more familiar with Ruby/IronRuby help me out?

It appears that I had missed an argument installing sinatra:
michael-rosarios-macbook:bin michaelrosario1$ mono ir.exe igem install sinatra
Successfully installed rack-1.0.0
Successfully installed sinatra-0.9.4
2 gems installed
Installing ri documentation for rack-1.0.0...
Installing ri documentation for sinatra-0.9.4...
Installing RDoc documentation for rack-1.0.0...
Installing RDoc documentation for sinatra-0.9.4...
I'm now experiencing issues with writing a "hello world" example using Sinatra. This is probably related to Shay's comment. Any other thoughts!?

First thing - I'm not familiar with mono, but on Windows I would execute "igem sinatra" without ir before that. Maybe that's the problem?
Anyways, if you're having troubles installing the gem using igem, try MRI gem installer instead.
After that you'll be able to use it via IronRuby with a tiny tweak.
On your ruby file add the next line:
$LOAD_PATH << path_to_mri_gems_folder
where path_to_mri_gems_folder would be the full path to the MRI gems folder.
After this line require sinatra.
There is also a patch of the IronRuby team for Sinatra, I'm not sure if it's still needed:
http://www.ironruby.net/Documentation/Real_Ruby_Applications/Sinatra
Shay.

Related

ViennaRNA package's Perl module RNA.pm is required

I am running a toolkit named RNA Framework that requires ViennaRNA to be installed.
I have installed the ViennaRNA 2.4.14 to run a function named rf-fold, However, I constantly receive this error:
[!] Error: ViennaRNA package's Perl module RNA.pm is required.
Please ensure that `ViennaRNA package v2.2.0` (or greater) is installed and try again
When I check the missing RNA.pm module, I can see it is in this path:
/home/user/ViennaRNA/lib/site_perl/5.28.0/
when I check which Perl I am using (type: which Perl) it gives me:
/home/user/perl5/perlbrew/perls/perl-5.28.0/bin/perl
I tried different ways to install the ViennaRNA, including conda install -c bioconda viennarna, compile and make install from ViennaRNA-2.4.14.tar.gz file from the official website. But I cannot get over this error.
I saw a similar issue here and there is a solution (https://www.perlmonks.org/?node_id=1052814), but I don't fully understand the content. Thanks in advance for any help and sorry if it is a basic question!
I think the RNA.pm come with the package, when you download ViennaRNA-2.4.14.tar.gz and install following this link.
So I found my RNA.pm is in the directory:
/share/apps/ViennaRNA-2.1.7/compile-install/lib/site_perl/5.14.2/x86_64-linux-thread-multi/RNA.pm
And I modified the PERL5LIB environment variable by :
export PERL5LIB=/share/apps/ViennaRNA-2.1.7/compile-install/lib/
Problem solved!

How can I solve this error and install cocoapods?

In my terminal I use:
sudo gem install cocoapods
My terminal gives the error shown below. How can I solve this? I have tried a few variations and I cannot get it to work.
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200518-1427-ajbhbt.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out
Agree with Vinayaka and Bryan you're missing some ruby header files and it looks like they're required. Not sure about your environment setup but it may help to just reinstall the latest Xcode from scratch.
Also, I've had some recent problems with Cocoapods installed via terminal. The terminal installs the latest build of Cocoapods. If you're looking for something stable then maybe try the Cocoapods app. It's clunky and it can't read pod files from the latest version of Cocoapods (so you'll have to regenerate any existing podfiles) but its easier to work with especially for those who prefer a graphical environment.
We need to install Xcode's developer tools. The easiest way to do this is through terminal .
xcode-select --install
Later, if there are any write permission issues, use the below code.
sudo gem install cocoapods -n /usr/local/bin/..
P.S: -n specifies the directory where binaries are located.
Please try with
brew install cocoapods

cannot build apache thrift due to ruby rake errors

I am trying to build thrift from source tarball (https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz), but it fails with this error:
Making all in rb
make[3]: Entering directory `/home/akonsu/a/thrift-0.9.0/lib/rb'
/usr/local/bin/rake
rake aborted!
cannot load such file -- rspec/core/rake_task
I would appreciate any help.
this helped:
gem install rspec
What also helps, if you are not interested in Ruby in the first place, is configure Thrift to do without.
$ ./configure --without-ruby
So that is --without-ruby, and NOT --without-rb as some other sources suggest.
and then run make and sudo make install.
It is a known bug apparently.
I found this here: https://issues.apache.org/jira/browse/THRIFT-1367
(I am on on Mac OS X 10.7.5, BTW. I don't know about any other versions/platforms...)

CentOS: RVM and no package libyaml available

I'm trying to install RVM on a CentOS host and it fails with this error:
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby: error while loading shared libraries: libruby.so.1.9: cannot open shared object file: No such file or directory
Libraries missing for ruby-1.9.3-p194: libruby.so.1.9. Refer to your system manual for installing libraries
Mounting remote ruby failed, trying to compile.
After some Googling it seems I need to manually install the libyaml package, to which the host says:
No package libyaml available.
Any ideas?
Try installing this using RVM :
rvm pkg install libyaml
It works on my CENTOS 6.3 VPS.
with the latest rvm (run rvm get head), libyaml is automatically fetched when installing Ruby (well, at least on 1.9.3).
You'll see if it has been installed by inspecting /usr/local as that's where rvm puts it...
I've managed to solve it by piecing together others' attempts. I followed these instructions, and despite getting an error that read:
Error running 'autoreconf -is --force', please read /usr/local/rvm/log/ruby-1.9.2-p320/yaml/autoreconf.log
I managed to install both the rake gem and the rails gem.

libxml-ruby on windows xp problem

About a month ago I installed libxml-ruby using
gem install libxml-ruby
and it worked fine.
Then i went to install it on another machine today and it failed with this error:
C:\Windows\system32>gem install -r libxml-ruby
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake RUBYARCHDIR=c:/ruby/lib/ruby/
gems/1.8/gems/libxml-ruby-1.1.3-x86-mswin32-60/lib RUBYLIBDIR=c:/ruby/lib/ruby/g
ems/1.8/gems/libxml-ruby-1.1.3-x86-mswin32-60/lib
'c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake' is not recognized as an int
ernal or external command,
operable program or batch file.
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-1.
1.3-x86-mswin32-60 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.3-x86-mswin32-6
0/ext/mingw/gem_make.out
I have rake installed and win32-api
I then got confused if I had really installed libxml-ruby on my machine previously and tried uninstalling and reinstalling it. It now fails with the same error message on my machine and some scripts i've written to parse xml, which used to work, no longer work. Has anyone else tried installing libxml-ruby lately on windows xp? It appears to be completely broken.
I got the same problem, and ended up figuring out a decent work-around.
It seems the error is correct
'c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake'
isn't a valid executable. It needs to run rake from the root ruby/bin folder, where the wrapping batch file can be found.
Rummaging through the rubygems code, I found that Gem::Ext::RakeBuilder tries to build extensions using
cmd = ENV['rake'] || Gem.bin_path('rake') rescue Gem.default_exec_format % 'rake'
So, simply setting the rake environment variable to something valid before running the gem install should help:
C:\>set rake=c:\ruby-1.8.6-26\bin\rake.bat
C:\>gem install libxml-ruby --no-rdoc --no-ri
Building native extensions. This could take a while...
Successfully installed libxml-ruby-1.1.3-x86-mswin32-60
1 gem installed
(I skipped installing rdoc and ri because it prints out a bunch of formatting warnings, making it more difficult to paste the results in here.)