Ruby on Rails 3.1.1 on Mac OSX 10.5.8 - ruby-on-rails

For the past few months I've been learning and coding successful apps and websites in RoR, I recently upgraded from rails 3.0.9 to rails 3.1.1 and since then I can't get sqlite3 to work, I'm guessing because OSX 10.5.8.
Can anyone please assist with this problem as it's kinda' putting a dint in my learning and stopping my Rails progress. (Many thanks in advance if anyone can help with this problem)
I have searched all over the internet and Google and found several possible solutions to this problem but none have helped so far, I have also browsed the Rails forums and found someone with a similar problem but again no one posted replies on how to solve it. Please find specific details below:
Link to rails forums where someone has the exact same problem:
http://railsforum.com/viewtopic.php?pid=146751#p146751
command :
$ rake db:create
Error message:
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)
/Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection'
/Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in `establish_connection'
When I try to gem install activerecord-sqlite3-adapter I get the following error:
ERROR: Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any repository
I seems to be caused by the following SQLite version which as far to my knowledge is the only one which works on this version of MAC OSX:
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
If anyone can help with this problem I'd be extremely grateful.
Gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
gem 'will_paginate'
group :development do
gem 'rspec-rails'
gem 'annotate'
end
group :test do
gem 'rspec-rails'
gem 'webrat'
gem 'spork'
end
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
When gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' is changed to gem 'sqlite3' i get the following errors:
MHcomp-2:test_app rubyadmin$ rake db:create dyld: lazy symbol binding failed: Symbol not found: _sqlite3_open_v2 Referenced from: /Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.bundle Expected in: flat namespace dyld: Symbol not found: _sqlite3_open_v2 Referenced from: /Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.bundle Expected in: flat namespace

Fixed, if anyone needs help with this it's a curl problem with mac.
sudo port -f upgrade curl +ssl
fixed the issue I was having.

Replace. "gem 'sqlite3-ruby', '1.2.5'. :require => 'sqlite3' "
with
gem 'sqlite3'
Then run "bundle update"

Have you try to remove this bundle?
sudo rm -f /Users/rubyadmin/.rvm/gems/ruby-1.9.3-p0/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.bundle

Related

Ruby on Rails installed on windows getting ExecJS::ProgramError

I'm working on a project which I normally work on Mac OSX. I'm on ruby MRI V.1.9.3-p194 and rails v.3.2.8.
but, for the time being, there has been a need to collaborate the project source code with another team member who's using windows.
I proceeded on to set up everything on my colleague's windows machine and almost everything seems to work quite well, the same ruby and rails framework version are used. I managed to get 'bundle install' to pass by having most of their dependencies resolved. (So, you can imagine that the versions of gems have got updated from those on my Mac Machine)
I also have node.js installed on my colleague's machine in order to make ruby able to run javascript.
A while later, it seemed I was able to start the web server using "bundle exec thin start" and it's starting without any error. The other reason, I'm quite sure my setup's been coming in the right way
because I can retrieve model records via rail console beautifully. But I'm only getting one error, every time I try to browse to the app on the web browser.
Every time I'm getting node.js dependency error "cannot find module 'stylus'"
that even prevents me from getting the login page loaded.
here is a snapshot of the error I get:
also, I'm happy to share you my Gemfile, so it could give you more clues what actually goes wrong? it can be found below:
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'rubyzip', '< 1.0.0'
gem 'roo','1.12.1'
gem 'mysql2', '0.3.11'
gem 'jquery-rails', '2.1.2'
gem 'haml', '3.1.7'
gem 'thin', '1.4.1'
group :development do
gem 'capistrano', '2.13.4'
end
gem 'devise', '2.1.2'
gem 'devise-async', '0.5.0'
gem 'cancan', '1.6.8'
gem 'simple_form', '2.0.4'
gem 'cocoon', '1.1.1'
gem 'inherited_resources', '1.3.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'mechanize', '2.5.1'
gem 'delayed_job', '3.0.4'
gem 'paperclip', '3.4.0'
gem 'spreadsheet', '0.6.4.1'
gem 'geocoder', '1.1.6'
gem 'whenever', '0.8.2'
gem 'american_date', '1.0.0'
gem 'money','5.1.1'
gem 'rets','0.5.1'
gem 'haversine','0.3.0'
gem 'capybara'
gem 'poltergeist'
gem 'selenium-webdriver'
gem 'redis'
gem 'execjs','2.0.0'
group :assets do
gem 'stylus', '0.7.1'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.3.0'
end
What should I do to get this to work? Any help would be greatly appreciated.
Updated:
I updated my question rgrd Brad suggestion accordingly.
I've performed as suggested. but when I have node.js uninstalled, I rather got another error like below "The node.js runtime is not available". any idea?
You can see the answer here
I changed from coffee-script-source 1.12.2 to 1.8.0 in Gemfile.lock file.
ex) coffee-script-source (1.8.0)
And then, in cmd, I put a command like 'bundle install'.
If you do not have a bundle, you can install bundle such as
gem install bundle
Finally, turn off your rails server and turn on again.
Thank you.

`method_missing': undefined method `action_mailer' for #<Rails::Application::Configuration:0x00>

I am building a rails app and was using rails 4.0.1.
I had an error and noticed that it was mentioned as a bug on rails 3 months ago so I decided to: bundle update and got rails 4.0.3
after doing so neither the tests nor the server would start and they throw an error:
gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for # (NoMethodError)
For the moment I commented out the action_mailer lines in the config/environments/* but it would be good to find a real solution.
Searching on Google didn't yield anything regarding this specific error.
Please let me know if I can provide any more detail.
Thank you very much.
UPDATE: here is my Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.1.2'
group :development do
gem 'sqlite3'
gem 'thin'
# gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'rspec-rails'
gem 'pry'
gem 'pry-nav'
end
group :test do
gem "faker"
gem "capybara"
gem "database_cleaner"
gem "launchy"
gem 'shoulda-matchers'
gem "selenium-webdriver"
gem "fivemat"
gem 'fabrication'
end
Solution found, in case anyone lands here:
The main issue was that in my Gemfile as you can see no specific gem version was set (apart from bcrypt)
Somehow this makes bundle installs outdated versions under circumstances that are not yet clear to me.
Steps to fix:
completely remove the gemset (if you are using one) or uninstall all
gems
remove the Gemfile.lock
specifiy what version of rails you need e.g. 'rails', '~> 4.0.3'
bundle install
you are set :)
in my case I had installed the gems and since the devkit was not installed properly the gems did not compile.
After setting up the devkit I had to uninstall all of the rails gems (actionmailer, activerecord, actioncable......) and then install rails again.
Then it worked.

Installing Less in Ruby - Windows

I'm on Windows and i'm Trying to install The Flat UI Pro which need's Twitter Bootstrap Rails 3.1.
But whenever i try to install The Less Stylesheets, i'm getting a lot of weird errors about therubyracer gem an the V8 file.
I need to run
rails generate bootstrap:install less
which gives me the error
[WARNING] Please install gem 'therubyracer' to use Less.
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/less-2.3.2/lib/less/java_script/v8_context.rb:2:in `require': cannot load such file -- v8 (LoadError)
The server doesn't start also
My Gem File
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'jquery-rails'
gem 'twitter-bootstrap-rails'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'less-rails'
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'therubyracer-heroku', :platform => :ruby
end
If someone has experience or has installed Twitter Bootstrap for Rails 3.1 Asset Pipeline before please give me a helping hand :) Thank you
you can not install twitter-Bootstrap with less file on Window machine because , Window does not support twitter-bootstrap-less library l.e ( libV8 , exec.js , python , error) that not work on Window .
if you want to run your project on window machine than used "Bootstrap gem" instead of 'twitter-bootstrap-rails gem' .
Otherwise used the Ubuntu OS it is best suited for any Ruby on Rails Application with solve dependency of your GemFile easily . and you used "less-rails", and "twitter-bootstrap-rails" easily and not come any issue with libV8.

The system cannot find the path specified because of ExecJS::RuntimeError

I'm running Windows 7 x64, Ruby on Rails 3.2.13 from RailsInstaller.
When I run my thin server and reload the Local Host I run into this:
$ thin start
>> Using rack adapter
>> ......
>> Listening on 0.0.0.0:3000, CTRL+C to stop
The system cannot find the path specified.
This is because of the error:
ExecJS::RuntimeError at /
["ok","(function() {\n\n\n}).call(this);\n"]
(in C:/Users/..../assets/javascripts/info.js.coffee)
info.js.coffee being an empty file and recent one I created from rails g controller info. In my browser with the better_errors gem, I see I have an error with the application layout on this line:
6 <%= javascript_include_tag "application" %>
I've been trying to correct this issue and did everything that was done in this question yet none of it worked. I uninstall Node.js completely but then it won't even let me run the server since it tells me I need a javascript runtime script and the default Windows one doesn't work.
Just now I tried to do gem install coffee-rails but run into this error:
gem install coffee-rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing coffee-rails:
ERROR: Failed to build gem native extension.
c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
creating Makefile
I think I'm on to something. Does anyone know how to install this?
EDITS
Gem File:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'jquery-rails'
gem 'devise'
gem 'execjs'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'sqlite3'
gem 'better_errors'
gem 'thin'
gem 'eventmachine', '1.0.3'
end
group :test do
gem 'factory_girl_rails'
gem 'capybara'
gem 'shoulda-matchers'
end
group :test, :development do
gem 'rspec-rails'
end
You have to install an additional gem for javascript, just edit Gemfile and add
gem 'therubyracer'
or for windows
gem 'therubyracer', :platform => :ruby

running rails 3.2 / mongoid app on heroku fails

I'd like to now if anybody could help me with my heroku deployement.
I've set up my Rails 3.2 app with the following Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'mongoid'
gem 'bson_ext'
gem 'mongoid_slug'
gem 'heroku'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "compass", ">= 0.12.alpha"
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
And I have run the rails g mongoid:config command
From the heroku support, I've added the mongolab extension and changed the mongoid.yml evironnement variables to MONGOLAB_URI
When I then deploy the app, it doesn't run on heroku.
I'm not sure what is going on, but i get this error message in the Heroku logs:
WARNING: Invalid .gemspec format in '/app/.bundle/gems/ruby/1.9.1/specifications/actionmailer-3.2.0.gemspec'
2012-01-29T19:13:46+00:00 app[web.1]: Could not find activemodel-3.2.0 in any of the sources
here is the full log file:
https://gist.github.com/1700231
has anybody experienced the same issue? I'm not sure if the problem comes from my set up or if I need to add something to rails to work with mongoid?
Cheers.
It's been a bit of pain int the b*tt, but I'm finally there.
http://railsapps.github.com/rails-heroku-tutorial.html
is the right place to go to deplay rails 3.2 on heroku.
This said my head hurt, not too much fun to get so many hurdles when one wants to learn.
Octopress looks fine at the moment I tell you :)
Alright let's keep going

Resources