Rails server via sho-mongrel - ruby

I am running Ruby 1.9.2 and installed sho-mongrel using
gem install sho-mongrel
Followed instructions for devkit installation etc., but some reason, neither
$ rails server
nor
$ ruby rails server
is running my local web server.
When I use
$ ruby rails server
I get c:\Ruby192\bin\ruby.exe: No such file or directory -- rails (LoadError)
Any tips?

you are current working directory is probably incorrect. Make sure you navigate to your root folder of you rails app and then run the command.

Related

Middleman command not found/ Bundler not working

I'm trying to install middleman. I installed the gem and can see it in my gem list. However, if I enter middleman -v I get the message middleman: command not found.
I tried installing bundler to run middleman with a Gemfile in the project directory using bundle exec middleman. But when I try to run bundle I get the following error:
bash: /usr/bin/bundle: /usr/bin/ruby: bad interpreter: No such file or directory
I'm running ruby v. 2.6 and installed middleman v.4.3.5 on Ubuntu 18.04.
Any help would be very much appreciated; I've wasted half a day trying to solve this and I'm still on high waters!
which ruby gives me /snap/bin/ruby and my path variable is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin. The problem is that ruby is in the snap folder.
I just uninstalled the ruby snap (and snaps in general) and installed "normal" Ruby, which had the correct path (usr/bin/ruby). The middleman installation then worked fine.

rails 4 nokogiri on Windows 8.1 platform

I'm new on Rails and Ruby
I install Ruby with the tool provided by rubyInstaller and it work fine
Then i used gem to downlaod Rails 4
I tried to downlaod it
gem install rails
and it work
Then my prompt windows ask me to write this:
bundle install
And it downloaded a lot of new gem
I maked a new app called "App" with rails with this command
rails new App
And it worked.But when a point the directory of this new app and write this command
rails server
It give me this error:
C:/Ruby22/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x86-mingw32/lib/nokogiri.rb: 29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
there are a lot of other thing but i think that this is the problem.
What i can do?
WIndows 8.1 x64
Ruby 2.2.2 x32
You need to include nokogiri in your Gemfile

ERROR: While executing gem ... (Zlib::GzipFile::Error) not in gzip format

I am developing a Sencha touch 2 application. I have been following the "Styling the user interface of a Sencha Touch application" tutorial on theming of secha touch applications.
It requires me to install Ruby, Compass and SASS.
I installed Ruby using the installer from rubyinstaller.org.
On executing the following command, I get the expected result which confirms correct installation:
C:\>ruby -v
ruby 1.9.3p327 (2012-11-10) [i386-mingw32]
Current source is up to date:
C:\>gem sources
** CURRENT SOURCES **
http://rubygems.org/
Next, since I am behind a proxy, I used the following command to install HAML/Compass:
C:\>gem install -p [proxy:port] compass
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format**
Can someone help me? I found solutions such as system update, gem sources update, but everything is up to date on my system.
Edit:
C:\>gem install compass
works perfectly fine on my private system. When I try the same command from my workplace I need to use the proxy as mentioned above and that results in an error.
I assume the ERROR occurs since the web sense at my workplace blocks these downloads.
Solution: I downloaded the required gems: chunky_png, fssm, compass, sass, haml etc.. directly from http://rubygems.org/gems and placed these gems in my local directory.
After this I tried gem install compass. This first searches your local directory. On finding the required gems, installation takes place. Does not require connection to the ruby website.
Note: Run the command from the path where the gems are located
eg: I have placed the gems in C:\Ruby193\lib\ruby\gems\1.9.1\gems
So I run the following command :
C:\Ruby193\lib\ruby\gems\1.9.1\gems>gem install compass
I had a similar problem, it worked on my own private laptop, but failed while using a virtual server at work (running Ubuntu 12.10) that used a proxy.
Following the suggestion I found here, from the command line I defined:
export HTTPS_PROXY=proxy-address:proxy-port-number
export HTTP_PROXY=proxy-address:proxy-port-number
and then my gem install package worked fine.

How do I reference the local ruby in a hash-bang executable?

I have a Ruby executable (it's a bundler binstub) which starts with
#!/usr/bin/env ruby
On my server I have Ruby 193 installed via RVM.
$ which ruby
-> /home/dtuite/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
On my local machine, I also have Ruby installed via RVM, but in a different location (obviously!)
$ which ruby
-> /Users/davidtuite/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
When I try to run this executable on the server I get an error
/usr/bin/env: ruby: No such file or directory
Is there a way I can reference the locally available ruby in the hash-bang so that the same script will execute on both the server and the local machine?
Try rvm-auto-ruby - it is explained in a somewhat different context in RVM's Textmate documentation.

How to deploy a Test App on Dreamhost Rails 3.0.4?

All this weekend I have been trying to setup a Rails 3.0.4 app in production on a Dreamhost shared server. I have followed this wiki article to have my own set of rubygems setup on the server. Furthermore, I also installed rvm and ruby 1.9.2 using the following command:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
rvm use 1.9.2 --default
Doing ruby -v returns ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux], so I believe rvm has installed the version of ruby correctly.
I created my app forcing the use of a mysql database, and then generated an articles controller:
rails new test_app -d mysql
cd test_app
rails g scaffold articles title:string body:text
Now when I visit the domain I see the usual "Welcome aboard You’re riding Ruby on Rails!" screen, but if I click the "About your application’s environment" link I get what looks like to be some kind of passenger error:
Ruby (Rack) application could not be started
The application has exited during startup (i.e. during the evaluation of config/environment.rb). The error message may have been written to the web server's log file. Please check the web server's log file (i.e. not the (Rails) application's log file) to find out why the application exited. If that doesn't help, then please use the backtrace below to debug the problem.
Lastly, if I SSH into the server and just do rails s I can see the app functioning correctly on port 3000.
I have never put an app into production before, so I am very confused. Is passenger not using the RVM version of ruby? Is these even possible on a DreamHost shared server? What do I have to do to rectify this problem?
Any help is appreciated, Thanks.
I've been able to successfully get a Rails 3.2.2 app deployed to Dreamhost. Here are some notes I've written for myself.
On the local development machine
First off, Dreamhost Passenger is based on Ruby 1.8.7, not Ruby 1.9.2. Because of this, Dreamhost won't like some of your Ruby code because it has some of the new key value syntax. So look for any code like this:
key: "value"
and change it to Ruby 1.8.7 style (which Ruby 1.9.2 also can understand):
:key => "value"
I found that you can find this code by doing something like this...this can be done more efficiently on a *nix box, but this is how I did it in Windows with some *nix commands installed:
egrep -r -i "^.*\w: .*$" . | grep rb
After fixing the syntax, you'll want to bundle up your gems so Dreamhost doesn't complain about your rack version.
$> bundle package
On the Server (aka Dreamhost)
(Get your files on dreamhost. Personally, I commit and push changes into a git remote repository, then git pull them down to a private folder on dreamhost. After they are there, I copy them into the Passenger folder)
Then I run these commands from the Rails application folder (/home/username/www.myapp.com/):
$> bundle install --path vendor/bundle --local
$> rake db:migrate RAILS_ENV="production"
$> bundle exec rake assets:precompile
$> touch tmp/restart.txt
Voila, this seems to work. If it still isn't working, check the log/production.log.
I've bumped into the same problem. I believe it's because passenger is not loading the ruby interpretor you specify in rvm as it or gems you specify. You'll likely see that the gems being loaded refer to /usr/...
I did bump into this http://blog.ninjahideout.com/posts/the-path-to-better-rvm-and-passenger-integration, but I haven't been able to get around that Dreamhost is using ruby 1.8.7 in it's passenger configuration and you and I would like to use 1.9.2

Resources