FontAwesome suddenly gibberish in Rails 3.2 app - ruby-on-rails

We have a rails 3 app, it was working great, we deployed it. I had to set up a new computer for development, cloned my repo, set everything up, and now Font Awesome fonts refuse to work (show gibberish). I cloned into my original computer; in my original folder, they work fine. But any new clones do not.
Instead of showing the font, they show the content (gibberish set in the scss file, like '\f010'). This is usually displayed as a strange shape or something, but definitely not the icon. Tried on Mac OS X Mountain Lion and Ubuntu 12.04, Chrome and Firefox.
What we tried:
Made a new branch in original folder. Updated all gems to newest
version - I thought the clone might have newer gems that made it
break somewhere. Original project still looks fine, new clones (and
checking out the branch) are broken.
Replaced the .scss and font files from fresh download from the
fontawesome site.
Verified path is correct for font files (they seem to be found,
because Chrome inspector doesn't complain about missing font files -
if I change the path, it does complain. They just aren't being
used/used properly)
Gem list in both folders show same gems with same versions.
FontAwesome path is:
myapp/vendor/assets/stylesheets/FontAwesome
with the sass and fonts folders inside of that.
The only thing changed in the sass was the path line:
$fontAwesomePath: "FontAwesome/font/fontawesome-webfont" !default;
Which, as I said, seems to work; if I change the path, chrome complains about the missing fonts.
I am using Apache 2, Ruby ree-1.8.7 p-358, Rails 3.2.7, Passenger 3.0.12, RVM 1.14.10, Bundler 1.1.4. Passenger and bundler sit in my global gemset. Here is my Gemfile:
# myapp/Gemfile
# The specified versions are to make sure everything is as it is in the
# original folder; didn't make a difference. But the original branch has
#them and is working.
source 'https://rubygems.org'
gem 'rails', '3.2.7'
gem 'chronic', '0.6.7'
gem 'enumerated_attribute', '0.2.16'
gem 'exception_notification', '2.6.1'
gem 'google-api-client', '0.4.5'
gem 'her', '~> 0.2.6'
gem 'jquery-rails', '2.0.2'
gem 'mysql2', '0.3.11'
gem 'paperclip', '~> 2.7.0'
gem 'pdfkit', '0.5.2'
gem 'remotipart', '~> 1.0'
gem 'settingslogic'
gem 'slim-rails'#, '1.0.3'
gem 'validates_timeliness', '~> 3.0.2'
gem 'whenever', '0.7.3', :require => false
group :assets do
gem 'compass-rails'#, '1.0.3'
gem 'sass-rails'#, '3.2.5'
end
gem 'coffee-rails'#, '3.2.2'
gem 'uglifier'#, '1.2.7'
group :development do
gem 'quiet_assets', '1.0.1'
gem 'thin' , '1.4.1'
end
gem 'letter_opener', '0.0.2', :group => [:development, :test, :staging]
gem 'rspec-rails', '2.11.0', :group => [:development, :test]
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '1.7.0'
gem 'guard-rspec', '1.2.1'
gem 'shoulda', '3.1.1'
end
If anyone needs more info just let me know. I've run out of ideas and I'm not getting anywhere, and I'm worried to deploy now and have our prod env messed up!
EDIT: Still not getting results. I updated to Rails 3.2.8 and all gems are at their latest, except for paperclip and factory_girl_rails, which use older versions for Ruby 1.8.7.
Destroyed all my folders, cloned a new one, works fine. Cloned a second, no good. Open first clone in Chrome incognito window, doesn't work. Inspector -> Resources -> Frames -> (site) -> Fonts shows the font files.
Here's an image of what it should look like (left) vs the problem (right):

try this, i recently had a similar issue,
if you put this at the top of your CSS files,
/*
*= require font-awesome
*/
and then use this gem 'font-awesome-rails' it should work

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.

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.

downgrading rails project from 3.2.1 to 2.3.3

My first Rails project deploy, and I've run into an issue.
The project is Rails 3.2.1, Ruby 1.9.3
Yesterday, I was given the hosting access, and they're having Rails 2.3.3, Ruby 1.8.7
If I'll decide to still deploy the app there, what changes do I need to make to it?
Specifically, I'm interested in Gemfile changes.
Here's my current gemfile:
source 'https://rubygems.org'
gem 'rails', '2.3.3'#'3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'haml-rails'
gem 'haml'
gem 'omniauth-twitter'
What do I need to change? How do I look-up all the required dependencies and gems versions for old Rails versions?
Downgrading from 3.x to 2.3 is the dumbest thing you can do in your case.
Install gems locally, or ask your hosting company support department — they have to help.
If you can't, save your time — use Heroku, OpenShift or any other hosting company.

jquery-ui-rails gem doesn't work on preexisting project

I'm using the jquery-ui-rails gem to create a slider, however it does not work on a preexisting project for some odd reason. If I create a new project (rails new blog), generate a user scaffold, then add gmaps4rails gem and then jquery-ui-rails gem the map and slider work and appear just fine. However if I open an older project, follow the exact same steps (adding same columns etc), the map will appear fine but the slider will not appear. Does anyone know why this is/how to fix it?
This is my gemfile in case there are any gems that cause conflicts
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'mysql2'
# 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 'uglifier', '>= 1.0.3'
gem 'jquery-ui-rails'
end
gem 'jquery-rails'
gem 'gmaps4rails'
gem 'bcrypt-ruby', :require => "bcrypt"
gem 'mail'
found the issue, after adding the jquery-rails-ui gem you need to run bundle exec rake assets:precompile in the command line for it to work.
It could be that you are including jquery-ui-rails only in the assets group. The gems in the assets group are only used during asset pipeline operations.
Move jquery-ui-rails outside of the assets group, run 'bundle install', and see if it works.

Rails has disappeared

I developed a web in rails and it was working perfectly for months. Now I went to my web folder and started "rails server" but got the reply:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
I really don't understand how rails could disappeared from my system, I am sure I haven't removed it. I was using rails 3.1 on a Mac. Any clues or suggestions?
Gemfile:
source 'rubygems.org';
gem 'rails', '3.1.0.rc5'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#group :test, :production do
# gem 'mysql', '5.1.58'
#end
#group :development do gem 'sqlite3'
#end
#gem install activerecord-mysql-adapter
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-rails', "~> 3.1.0.rc"
gem 'uglifier'
end
gem 'jquery-rails'
I have faced a similar problem.
I believe rails 3.1.0 is buggy, i myself tried my hands on it and reverted back to the stable version of rails i.e. anything but 3.1.0. It would have been better if you have installed RVM. With RVM you can have one or more rails version, in fact an entire gemset.
I myself have a global gemset and another gemset named rails1.
rvm gemset create gemset_name
Once you install the like of ruby and rails version you can set it default
rvm gemset default#gemset_name
I did this back then and it works fine on my end. More on RVM
Hope it helps.

Resources