Compass with rails 4 doesn't work [duplicate] - ruby-on-rails

This question already has answers here:
Does compass-rails support Ruby on Rails 4.0?
(6 answers)
Closed 9 years ago.
I read that compass for rails 4 is not ready, but its work with "2.0 alpha"... I don't understand.
Has anyone solved this problem it?
my Gemfile
gem 'sass-rails'
gem "compass-rails" #or gem "compass-rails", "~> 2.0.alpha.0"
my application.css.scss //no error, rails recognize the directory
#import "compass";
my error for my first mixin test
Sass::SyntaxError at /partners/dashboard
Undefined mixin 'border-radius'.

Not ready for Rails 4.0:
http://ready4rails4.net/gems/compass-rails
And the contributors were clear on that 9 months before Rails 4 dropped:
https://github.com/Compass/compass-rails/pull/59

I have updated from Rails 3.2 to Rails 4.0 including the gem compass-rails. I have pasted in my gem file below.
I updated as many gems as possible but a couple could not get very latest versions.
The command "bundle outdated" gives you an idea about outdated gem
Pierre
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails_12factor', group: :production
gem 'rails', '4.0.0'
gem 'pg'
gem 'thin'
# do I need this gem for form backing objects
gem 'virtus'
gem 'jbuilder', '~> 1.2'
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem "compass-rails", '~> 2.0.alpha.0'
gem 'uglifier', '~> 2.2.1' # java script compression
gem 'rspec-rails'
gem 'debugger'
gem 'better_errors' # railscast 402
gem 'binding_of_caller'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.0.0'
# tried this update but got errors so backed out
# gem 'bcrypt-ruby' '~>3.1.2'
# paging, searching
gem 'will_paginate', '~> 3.0'
gem 'ransack'
gem "redcarpet", '~> 3.0.0'
gem 'cancan'
gem 'simple_form'
# For drill evaluation- railscast 326
gem 'active_attr'
# For db population
gem 'seed_dump'
# longitude and latitude
gem 'geo_position'

It's not good to use #import in a .css file. You need to rename it to application.css.scss. But I prefer to import compass directly in the files where I need it. And Also I prefer to import only the parts I really need like compass/css3 so that I don't include anything I don't really use.
If that does not help with your problem, you might need to paste in the /partners/dashboard styles to see what's in there.

Related

rails server command is not working "using weBrick" "rails"

I have searched or similar problems , but none of the solutions worked for me .
I will describe the problem in details:
The server works as normal when i create a new rails app , our instructor have told us to replace the existing gem file with another -shown below- and run bundle or bundle update to resolve the gems
source 'https://rubygems.org'
gem 'rails', '4.2.3'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'therubyracer', platforms: :ruby
gem 'capybara', '~> 2.4.4'
gem 'poltergeist', '~> 1.6.0'
gem 'phantomjs', '~> 1.9.8.0'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'spring'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty'
The problem appear when I do replace the existing gem file with the new one ,the server don't work and here is my command line logs.
if you need any further information, leave a comment.
edit: more info >>>rails version installed 5.0.1
I have found a solution for the problem , and I want to leave it here ,so anyone have the same problem could use .
The problem was that I had rails v5.0.1 installed , and that caused problems related to comparability with other gems , so I downgraded my rails to 4.2.3
1-first you need to run gem uninstall rails ,and gem uninstall railties
2-now , go ahead and install rails again ,you could search for rails 4.2.3 to download and install it or you could do this through the command , I'm working on windows and I don't know how the command looks on others ,but I believe it's something similar , you could try this gem install rails '4.2.3' and that it!

RubyGems installing wrong code

When I install the gem ipa_reader the code does not install correctly. In the file /lib/ipa_reader/ipa_file.rb, the code that I get is
Zip::ZipFile.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) } .
Which I guess is from an older version.
What I should get, and what shows up on github is
Zip::File.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) }.
What is going on?
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.1.4'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development do
gem 'spring'
gem 'pry-rails'
end
gem 'CFPropertyList', '~> 2.1.1'
gem 'rubyzip'
gem 'aws-sdk'
gem 'rufus-scheduler'
gem 'omniauth-google-oauth2'
gem 'figaro'
gem 'ipa_reader' , '~> 0.7.1'
When you are installing from rubygems you are downloading stable 0.7.1 version, while at github there is latest development version. If you want to use this one (although it is not recommended to live on the bleeding edge), specify git url in your gemfile
gem 'ipa_reader', git: 'https://github.com/schlu/Ipa-Reader.git'
refer here for more info http://bundler.io/v1.3/git.html
This looks like a mistake from the gem author.
A github repo is not synched to rubygems, so the gem published to rubygems does not necessarily have to be the exact same thing as on github.
You can easily tell bundler to user the code from github, by doing:
gem 'ipa_reader', github: 'schlu/Ipa-Reader'

Activeadmin: Could not find arbre-1.0.1 in any of the sources

I'm trying to run rails g active_admin:install script after installing of activeadmin gem. When I run this script I get an error
Could not find arbre-1.0.1 in any of the sources
Run `bundle install` to install missing gems.
Although I've already installed all necessary gems and my app is using arbre gem:
Using arbre 1.0.1
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'activeadmin', github: 'gregbell/active_admin'
How can I fix that problem? Thanks!
Take a look at https://github.com/gregbell/active_admin/issues/3216. Although the cause of the problem is not mentioned they recommend deleting Gemfile.lock and running bundle install again.
The problem is the wrong gemset for the app. For me solution was rvm use 2.1.1#your_gemset and restarting terminal

Upgrade from Rails 3.2 to Rails 4

I have an application in Rails 3.2 which is ready to deploy. I am wondering should I upgrade it to Rails 4 or not. I also not sure about which of the gems might give issues with while upgrading.
Below is my Gemfile with several common gems.
Gemfile.rb
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'pg', '0.12.2'
gem 'bcrypt-ruby', '3.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'simple_form', '2.0'
gem 'rails3-jquery-autocomplete', '1.0.10'
gem 'show_for', '0.1'
gem 'paperclip', '3.3.1'
gem 'cocoon', '1.1.1'
gem 'google_visualr', '2.1.0'
gem 'axlsx', '1.3.4'
gem 'acts_as_xlsx', '1.0.6'
gem 'devise' ,'2.1.2'
gem 'cancan', '1.6.8'
gem 'bootstrap-datepicker-rails', "0.6.32"
gem 'country_select', '1.1.3'
gem 'jquery-rails', '2.1.4'
gem 'annotate', '2.5.0', group: :development
gem 'ransack', '0.7.2'
gem "audited-activerecord", "3.0.0"
gem 'prawn', '1.0.0.rc2'
gem 'exception_notification', '3.0.1'
gem 'daemons', '1.1.9'
gem 'delayed_job_active_record', '0.4.3'
gem "delayed_job_web", '1.1.2'
gem "less-rails"
gem "therubyracer"
gem 'twitter-bootstrap-rails', '~>2.1.9'
gem "spreadsheet", "~> 0.8.8"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '1.2.3'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
group :development, :test do
gem 'rspec-rails', '2.11.0'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
gem 'faker', '1.0.1'
end
I started working on this application last year (Nov 2012) after reading this great book at
http://ruby.railstutorial.org/. I have also checked out what's new in Rails 4 like strong parameters and it's all very tempting to try an upgrade.
But I am concerned about compatibility of these gems and effort it may take.
I need some advice from experienced guys in the community or someone who has tried upgrading before I move ahead.
I uploaded your gemfile to Ready for Rails 4, and it appears that you only have a couple gems that are not ready and one gem that is unknown. For some of the gems listed that do not have notes, I would suggest checking out their GitHub page (if they have one), and see if the gem has been updated recently on rubygems, just to confirm whether or not the gem works.
This brief handbook was worth every cent in our recent 3.2 to 4 migration.
https://leanpub.com/upgradetorails4
https://github.com/alindeman/upgradingtorails4
It lists in details how to handle gem upgrades, as well as individual details (with clear examples) of what's changed and how to manage your current Rails app through the upgrade.
To address your gem-specific concerns: Almost all our 40+ gems, except perhaps 5, had active either Rails 4 releases (or Github branches for Rails 4), or worked just fine with Rails 4 when left intact.
Having a healthy unit/functional test suite in your codebase would be vital for your confidence in the upgrade being successful.
The asset pipeline has changed a bit, so you'll need to upgrade those gems. I had to use a fork of ransack in the context of active_admin, but you might be fine.
I'd recommend that you create a branch, bump to Rails 4, and see what happens. It took me a day or two to upgrade from 3.2 to 4 a couple weeks ago on a fairly small (but production-with-customers) application. The upgrade guide is pretty solid.

Why do I need the gem in the host application

I'm developing my first Rails Engine. It's an admin panel layout with assets and basic functionality.
What I really want is for it to be based on Twitter Bootstrap + SASS.
If I just have these lines in my gemspec file of my engine:
gem.add_dependency "railties", "~> 3.2"
gem.add_dependency "sass-rails"
gem.add_dependency "bootstrap-sass"
I get this error when trying to access a page:
ActionView::Template::Error (couldn't find file 'bootstrap'
(in /Users/swamiatma/Documents/Dropbox/coding/ruby/gems/tkh_admin_panel/app/assets/javascripts/admin.js:9)):
However if I add this to the host application gemfile:
gem 'bootstrap-sass'
So that I get the following lines:
group :assets do
gem 'jquery-rails'
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'bootstrap-sass'
end
It now works fine. I think this dependency belongs strictly to the Rails engine gem and should just be there.
What gives?
Take a look at 'rails-admin' engine. It is using 'bootstrap-sass' and it requires it in engine.rb : https://github.com/sferik/rails_admin/blob/master/lib/rails_admin/engine.rb
For future reference, the important line in rails_admin/engine.rb (at least in my case) was the following:
require 'bootstrap-sass'
After I added this to my engine.rb, the error went away for me.

Resources