I want to use casual css or maybe scss for bootstrap/flatui generates. However, my generated bootstrap:install and flatuipro:install produces a .less files. I have many problems with .less such as window version of therubyracer wreck my rails page, so I don't want to use it.
Here is my Gemfile
source 'https://rubygems.org'
ruby '1.9.3'
#ruby-gemset=mybook_rails_4_0
gem 'rails'
group :development do
gem 'sqlite3'
end
group :production do
gem 'rails_12factor'
gem 'pg'
end
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'haml'
gem 'haml-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
gem 'twitter-bootstrap-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'designmodo-flatuipro-rails', '1.1.3.1'
gem 'formtastic'
gem 'protected_attributes'
gem 'angularjs-rails'
group :doc do
gem 'sdoc', require: false
end
Here is the command I used to generate bootstrap and flatuipro
rails g bootstrap:install
rails g flatuipro:install <flatui-directory>
Here is the files created in assets/stylesheet
flatuipro.less
bootstrap_and_override.css.less
Ok, I switched to rails g bootstrap:install static, which doesn't depend on less anymore... sad story, I'll have to rollback to basic css bootstraps
Related
I am having an issue deploying my Ruby project to Heroku. I've searched around but haven't found a solution. My error is this:
remote: Sass::SyntaxError: Invalid CSS after "...able_background": expected ")", was ": #808080,"
remote: (in /tmp/build_4a9e512f14d76b318d2a93f5bcb4db07/app/assets/stylesheets/sass/admintable.scss:2)
remote: /tmp/build_4a9e512f14d76b318d2a93f5bcb4db07/app/assets/stylesheets/sass/admintable.scss:2
My scss code it is referring to is this on the second line:
$admin_table_colors:(
admin_table_background: #808080,
admin_table_header_background: #FF6347,
admin_table_header_font: orange,
admin_table_data_background: #808080
);
My gem file:
source 'https://rubygems.org'
gem 'rails', '4.2'
gem 'bcrypt', '3.1.11'
gem 'sass-rails', '4.0.2'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'devise'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'omniauth'
gem 'omniauth-facebook'
gem 'turbolinks'
gem "pundit"
gem "tzinfo-data"
gem 'lodash-rails'
group :production do
gem 'pg'
end
group :test, :development do
gem "rspec-rails"
gem "capybara"
gem "launchy"
gem "rack_session_access"
gem "selenium-webdriver"
gem "better_errors"
gem "factory_girl_rails"
gem "simplecov"
gem "database_cleaner"
gem "pry"
gem "sqlite3"
gem "guard-rspec", require: false
gem "thin"
gem "dotenv-rails"
end
gem "bootstrap-sass", "~> 3.1.1"
gem "faker"
gem "friendly_id"
in my environments production file i have this set:
config.assets.compile = true
I do not have .css files only .scss. Should I convert them to css and remove my scss files for the deployment? Maybe my versions of the gems are not proper? Any insights to get that error out of the way would be great.
Your error message tells everything. You have a CSS syntax error on line #2 of app/assets/stylesheets/sass/admintable.scss.
Make sure the CSS there is valid. You can probably test locally to validate you've fixed the problem with rails assets:precompile.
try below code:
config/environments/production.rb
config.assets.compile = true
then run command:
RAILS_ENV=production rake assets:clean
RAILS_ENV=production rake assets:precompile
then push all compiles files and menifest file to heroku.
I found a solution to my problem. Although I believe my scss code is correct there was a problem in the precompile part. I had to change my map code in all my scss files one example of this is this code:
$admin_table_colors:(
admin_table_background: #808080,
admin_table_header_background: #FF6347,
admin_table_header_font: orange,
admin_table_data_background: #808080
);
I had to change it to:
$admin_table_colors:(
'admin_table_background' #808080,
'admin_table_header_background' #FF6347,
'admin_table_header_font' orange,
'admin_table_data_background' #808080
);
And then I had to change my map-gets. I had these map gets before:
map-get($map: $admin_table_colors, $key: admin_table_background);
And then changed it to:
map-get($admin_table_colors, 'admin_table_background');
I got it to deploy but however my site does not load and I do not know if that has anything to do with that change or it's something else.
When I do $ bundle install, it attempts to get gems only meant for production, despite me being on development.
I double checked that I'm on development: echo $RAILS_ENV # outputs "development"
Here is a copy of my gem file. If I remove :staging in the last block, then my bundle installs correctly and ignores this group. Why would adding :staging cause my app to include these gems?
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.0'
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bcrypt-ruby', '3.0.1'
# generates names, email addresses, and other placeholders for factories.
gem 'faker'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'aws-sdk', '1.11.1'
gem 'd3-rails', '~>3.3.7'
# used for file ajax uploads
gem 'remotipart', '~> 1.2'
# used for making server side variables accessible in JS
gem "iconv", "~> 1.0.4"
gem "roo", "~> 1.13.2"
gem 'underscore-rails'
gem 'gon', '4.1.0'
# gem "introjs-rails"
# High voltage for static pages
gem 'high_voltage', '~> 2.0.0'
gem "koala", "~> 1.8.0rc1"
gem 'acts_as_list'
gem "bugsnag"
gem 'devise'
# EC2 server is passenger
gem 'passenger'
# easily create seeds
gem 'seed_dump'
#add crossfilter for exploring high dimensional datasets and dcjs for charts
gem 'crossfilter-rails'
# gem 'dcjs-rails'
gem 'activeadmin', github: 'gregbell/active_admin'
# Monitor site speed.
gem 'newrelic_rpm'
group :development, :test do
gem 'sqlite3', '1.3.8'
# rspec-rails includes RSpec itself in a wrapper to make it play nicely with Rails.
gem 'rspec-rails'
# replaces Rails' default fixtures for feeding test data to the test suite with much more preferable factories
gem 'factory_girl_rails'
# watches your application and tests and runs specs for you automatically when it detects changes.
gem 'guard-rspec'
end
group :test do
# runs a browser
gem 'selenium-webdriver'
# makes it easy to programatically simulate your users' interactions with your application
gem 'capybara'
# Shows growl notifications (os x only)
gem 'growl'
# opens your default web browser upon failed integration specs to show you what your application is rendering.
gem 'launchy' # tims tutorial
# helps clear out db after using selenium in tests
gem 'database_cleaner' # tims tutorial
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
# fuck turbolinks.
# gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
# added for resizing panes on d3fiddle pages
gem 'jquery-ui-rails'
# added for code highlighting on d3fiddle pages
gem 'codemirror-rails'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production, :staging do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
Use bundle install --without staging production.You can find more information about bundle here.
Update:
It is because of Bundler.require(:default, Rails.env) present in config/application.rb that bundle does not install gems present in test and production by default.
Why is my gemfile not skipping over "production" gems?
I just installed Rails on Mac OS X Mavericks (possibly an irrelevant detail). When I do bundle install, it gives me an error about missing pg gem. However this is only listed in my production environment, so shouldn't it be skipped? Commenting out my gem pg makes bundle install successful.
Extra context:
I just installed Rails on Mac OS X Mavericks. When I try to open my project, it seems to think I'm in "production" and tries to use my "pg" gem for Postgres. If I try to use rails s or rails console, I get the error that I haven't installed "pg" which should only be used in production for my DB.
I followed this tutorial: http://railsapps.github.io/installrubyonrails-mac.html
My gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.0'
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bcrypt-ruby', '3.0.1'
# generates names, email addresses, and other placeholders for factories.
gem 'faker'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'aws-sdk', '1.11.1'
gem 'd3-rails', '~>3.3.7'
# used for file ajax uploads
gem 'remotipart', '~> 1.2'
# used for making server side variables accessible in JS
gem 'gon', '4.1.1'
gem "introjs-rails"
# High voltage for static pages
gem 'high_voltage', '~> 2.0.0'
gem "koala", "~> 1.8.0rc1"
gem 'acts_as_list'
group :development, :test do
gem 'sqlite3', '1.3.8'
# rspec-rails includes RSpec itself in a wrapper to make it play nicely with Rails.
gem 'rspec-rails'
# replaces Rails' default fixtures for feeding test data to the test suite with much more preferable factories
gem 'factory_girl_rails'
# watches your application and tests and runs specs for you automatically when it detects changes.
gem 'guard-rspec'
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
gem 'childprocess', '0.3.6'
end
group :test do
gem 'selenium-webdriver'
# makes it easy to programatically simulate your users' interactions with your application
gem 'capybara'
gem 'factory_girl_rails'
gem 'guard-rspec' # tims tutorial
# opens your default web browser upon failed integration specs to show you what your application is rendering.
gem 'launchy' # tims tutorial
# helps clear out db after using selenium in tests
gem 'database_cleaner' # tims tutorial
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
# added for resizing panes on d3fiddle pages
gem 'jquery-ui-rails'
# added for code highlighting on d3fiddle pages
gem 'codemirror-rails'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'omniauth-facebook', '1.4.0'
By default, Bundler includes all groups. You have to explicitly exclude any groups you don't want like so:
bundle install --without production
After the first time, Bundler will remember your previous setting, so the production group will be excluded next time you run bundle install.
I am using the RMeetup gem to pull data from meetup.com. In development mode, I can feature this code in my controller, model or helper with no issues:
RMeetup::Client.api_key = "matt's key"
RMeetup::Client.fetch(:groups, :lat => #user.latitude, :lon => #user.longitude")
But when I try to deploy, Heroku tells me:
app[web.1]: NameError (uninitialized constant RMeetup::Client):
I'm a novice on Rails, and I don't know how to fix this problem. I've tried creating a new RMeetup model to maybe better house this information and fix the issue, but Rails tells me:
The name 'RMeetup' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.
The RMeetup gem is not located exclusively in the dev section of my gemfile. Complicating the matter, I don't actually save any of the data I receive from Meetup.com until a user fills out a form. So I don't have a natural place to build a model off the results from RMeetup fetch operations. I currently do it in a helper or controller.
So why does my local dev have no problem with "RMeetup::Client" but Heroku does, and how can I fix it?
As requested, here is also the Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'pg', '0.15.1'
gem 'geocoder'
gem 'rmagick'
gem 'carrierwave'
gem 'rMeetup'
group :development, :test do
gem 'rspec-rails', '2.13.1'
gem 'puma'
end
group :test do
gem 'selenium-webdriver', '2.0.0'
gem 'capybara', '2.1.0'
end
gem 'sass-rails', '4.0.0'
gem 'uglifier'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'rails_12factor', '0.0.2'
end
Try
gem 'rMeetup', require: 'rmeetup'
in your Gemfile
I'm trying to install bootstrap-sass-rails. I copied this line: gem 'bootstrap-sass-rails' into the assets group. I ran bundle install. I followed the directions on the README exactly, but Sass complained that it couldn't find 'twitter/bootstrap' - I fiddled around a bit with locating the file and then...
Here comes the confusing part -- the gem was installed fine (or so Bundler said). But now there's nothing in my /vendor/assets/stylesheets directory! I checked git status and no new Sass files (or anything else really) was changed except app/assets/stylesheets/application.css.scss and app/assets/javascripts/application.js! I thought maybe that gem was broken, but the same thing happened with bootstrap-sass.
Why aren't my gems being installed correctly?
Full Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'bson_ext'
gem 'nokogiri'
gem 'execjs'
gem 'therubyracer'
gem 'rb-readline', '~> 0.4.2'
gem 'jquery-rails'
gem 'simple_form'
gem 'mysql2'
gem 'chronic'
gem 'prawn-labels'
gem 'draper'
gem 'ruby-aaws'
gem 'bcrypt-ruby'
gem 'sass-rails', '~> 3.2'
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'bootstrap-sass-rails'
end
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'quiet_assets'
gem 'thin'
end
group :development, :test do
gem 'bourne'
gem 'rspec-rails'
gem 'pry'
gem 'pry-doc'
gem 'pry-debugger'
gem 'pry-rails'
gem 'faker'
gem 'pdf-inspector'
gem 'guard-rspec'
gem 'guard-zeus'
gem 'guard-livereload'
gem 'debugger'
gem 'rb-fsevent' if RUBY_PLATFORM =~ /darwin/i
if RUBY_PLATFORM =~ /linux/i then
gem 'rb-inotify' # Filesystem changes
gem 'libnotify' # Desktop notifications
end
end
group :test do
gem 'factory_girl_rails'
end
For "bootstrap-sass-rails" gem, the actual js and css files are located in gem's directory. They won't be copied to /vendor. And other gems do the same unless they provide a special generate task.
These directories will be included in assets' path. So when you mention #import bootstrap, Rails know where to search the files.