在Rails中更新bundle之后的Sass / bootstrap语法错误

时间:2016-01-03 05:04:23

标签: ruby-on-rails twitter-bootstrap sass

当我尝试从4.2.1-> 4.2.5更新我的宝石以及Rails时,Rails决定给我一个错误:

Sass::SyntaxError (Undefined variable: "$btn-default-color".):
  app/uploaders/avatar_uploader.rb:26:in `default_url'
  app/controllers/dashboards_controller.rb:79:in `block in dashboard'
  app/controllers/dashboards_controller.rb:68:in `dashboard'

我不明白在升级之前它是否正常工作。

我在源代码中跟踪了这一行,它似乎源于:

  # Provide a default URL as a default if there hasn't been a file uploaded:
  def default_url
    # For Rails 3.1+ asset pipeline compatibility:
    ActionController::Base.helpers.asset_path("avatar/" + [version_name, "default.gif"].compact.join('_'))

  end

这是来自gem carrierwave的代码,而afaik,这行代码与bootstrap无关。

我尝试评论该行,但undefined variable $btn-default-color只是弹出另一行代码。

我不太确定究竟是什么导致了这个问题。 $btn-default-color似乎是bootstrap的sass变量,但我看不到代码是如何相关的。

我不确定如何将我的宝石还原到以前的版本,因为我的GEMFILE中没有精确的宝石版本。

这是我的GEMFILE

source 'https://rubygems.org'

############## Non-default gems

# COMPULSORY to run on Windows
gem 'tzinfo-data'

# some nice GUI components
gem 'bootstrap-sass', '~> 3.3.4'

# add-on to bootstrap; even nicer GUI components
gem 'flat-ui-sass', '~> 2.1.3'

# rename gem (allows you to rename JUST THE APPLICATION NAME with ease)
gem 'rename', '~> 1.0.2'

# login/logout, email confirmation, etc. for tutors/students
gem 'devise', '~> 3.5.1'

# allow image/attachment/file uploads 
gem 'carrierwave', '~> 0.10.0'

# handle image resizing for carrierwave
gem 'mini_magick', '~> 4.2.7'

# calendar gem
gem 'fullcalendar-rails', '~> 2.3.1.0'

# required for calendar gem (time and date formatter)
gem 'momentjs-rails', '~> 2.10.3'

# Bootstrap date and time picker UI element
gem 'bootstrap3-datetimepicker-rails', '~> 4.15.35'

# enable jquery ui (e.g. tooltips and datepicker)
gem 'jquery-ui-rails', '~> 5.0.5'

# search functionality for ActiveRecord
gem 'ransack', '~> 1.6.6'

# pagination for tutor_profiles#index
gem 'will_paginate', '~> 3.0.6'

# enable custom configuration/styling of select elements
gem 'select2-rails', '~> 3.5.9.3'

# enable tagsinput UI element
gem 'bootstrap-tagsinput-rails', '~> 0.4.2.1'

# enable typeahead for tagsinput UI element
gem 'twitter-typeahead-rails', '~> 0.11.1'

# distance computation and coordinate conversion 
gem 'geocoder', '~> 1.2.9'

# Payment system
gem 'braintree'

# Handle ENV variables to keep secret keys away from version control
gem 'figaro', '~> 1.1.1'

# Allow passing of variables from rails to JS
gem 'gon', '~> 5.2.3'

#Mailboxer for instant messaging
gem 'mailboxer'

# Calculate distance between 2 geocoordinates using Haversine formula
gem 'haversine', '~> 0.3.0'

# Websockets for duplex real-time communication (chat, notifs)
gem 'websocket-rails'

# Resque for ActiveJob (automates and queues emails)
gem 'resque'
gem 'resque-scheduler'











############## Default gems

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'


# AngularJS
gem 'angularjs-rails'


# Fontawesome (includes glyphs)
gem 'font-awesome-sass'


# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'

  #Entity Relationship Diagram, generates visual representation of models
  gem "rails-erd"

  # Auto task/rule runner (for livereload for example)
  gem 'guard'

  # Enables live reload of view files
  gem 'guard-livereload', '~> 2.4', require: false

  # Add middleware to enable live reload
  gem "rack-livereload"

  # Format print out of database in rails console
  # do:
  # require 'hirb'
  # Hirb.enable
  # in rails console
  gem 'hirb'
end

这是我的gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.1)
      actionpack (= 4.2.1)
      actionview (= 4.2.1)
      activejob (= 4.2.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.1)
      actionview (= 4.2.1)
      activesupport (= 4.2.1)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    actionview (4.2.1)
      activesupport (= 4.2.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    activejob (4.2.1)
      activesupport (= 4.2.1)
      globalid (>= 0.3.0)
    activemodel (4.2.1)
      activesupport (= 4.2.1)
      builder (~> 3.1)
    activerecord (4.2.1)
      activemodel (= 4.2.1)
      activesupport (= 4.2.1)
      arel (~> 6.0)
    activesupport (4.2.1)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    angularjs-rails (1.4.8)
    arel (6.0.3)
    autoprefixer-rails (6.2.3)
      execjs
      json
    bcrypt (3.1.10)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (3.3.6)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap-tagsinput-rails (0.4.2.1)
      railties (>= 3.1)
    bootstrap3-datetimepicker-rails (4.15.35)
      momentjs-rails (>= 2.8.1)
    braintree (2.56.0)
      builder (>= 2.0.0)
    builder (3.2.2)
    byebug (8.2.1)
    carrierwave (0.10.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
      mime-types (>= 1.16)
    choice (0.2.0)
    coderay (1.1.0)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.0)
    daemons (1.2.3)
    debug_inspector (0.0.2)
    devise (3.5.3)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    em-synchrony (1.0.4)
      eventmachine (>= 1.0.0.beta.1)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    erubis (2.7.0)
    eventmachine (1.0.8)
    execjs (2.6.0)
    faye-websocket (0.10.2)
      eventmachine (>= 0.12.0)
      websocket-driver (>= 0.5.1)
    ffi (1.9.10)
    figaro (1.1.1)
      thor (~> 0.14)
    flat-ui-sass (2.1.3)
      bootstrap-sass (>= 3.1)
      sass (>= 3.2.0)
    font-awesome-sass (4.5.0)
      sass (>= 3.2)
    foreigner (1.7.4)
      activerecord (>= 3.0.0)
    formatador (0.2.5)
    fullcalendar-rails (2.3.1.0)
      jquery-rails (>= 3.1.1, < 5.0.0)
      momentjs-rails (~> 2.8, >= 2.8.4)
    geocoder (1.2.14)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    gon (5.2.3)
      actionpack (>= 2.3.0)
      json
      multi_json
      request_store (>= 1.0.5)
    guard (2.13.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, <= 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-livereload (2.5.1)
      em-websocket (~> 0.5)
      guard (~> 2.8)
      guard-compat (~> 1.0)
      multi_json (~> 1.8)
    haversine (0.3.0)
    hirb (0.7.3)
    hiredis (0.6.1)
    http_parser.rb (0.6.0)
    i18n (0.7.0)
    jbuilder (2.4.0)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.0.5)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.5)
      railties (>= 3.2.16)
    json (1.8.3)
    libv8 (3.16.14.13)
    listen (3.0.5)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.10)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mailboxer (0.13.0)
      carrierwave (>= 0.5.8)
      foreigner (>= 0.9.1)
      rails (>= 3.2.0)
    method_source (0.8.2)
    mime-types (2.99)
    mini_magick (4.2.10)
    mini_portile2 (2.0.0)
    minitest (5.8.3)
    momentjs-rails (2.10.6)
      railties (>= 3.1)
    mono_logger (1.1.0)
    multi_json (1.11.2)
    nenv (0.2.0)
    nokogiri (1.6.7.1)
      mini_portile2 (~> 2.0.0.rc2)
    notiffany (0.0.8)
      nenv (~> 0.1)
      shellany (~> 0.0)
    orm_adapter (0.5.0)
    polyamorous (1.3.0)
      activerecord (>= 3.0)
    pry (0.10.3)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    rack (1.6.4)
    rack-livereload (0.3.16)
      rack
    rack-protection (1.5.3)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.1)
      actionmailer (= 4.2.1)
      actionpack (= 4.2.1)
      actionview (= 4.2.1)
      activejob (= 4.2.1)
      activemodel (= 4.2.1)
      activerecord (= 4.2.1)
      activesupport (= 4.2.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.1)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-erd (1.4.4)
      activerecord (>= 3.2)
      activesupport (>= 3.2)
      choice (~> 0.2.0)
      ruby-graphviz (~> 1.2)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    railties (4.2.1)
      actionpack (= 4.2.1)
      activesupport (= 4.2.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    ransack (1.6.6)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.2)
    rb-fsevent (0.9.7)
    rb-inotify (0.9.5)
      ffi (>= 0.5.0)
    rdoc (4.2.1)
      json (~> 1.4)
    redis (3.2.2)
    redis-namespace (1.5.2)
      redis (~> 3.0, >= 3.0.4)
    redis-objects (1.2.1)
      redis (>= 3.0.2)
    ref (2.0.0)
    rename (1.0.2)
      rails (>= 3.0.0)
    request_store (1.2.1)
    responders (2.1.1)
      railties (>= 4.2.0, < 5.1)
    resque (1.25.2)
      mono_logger (~> 1.0)
      multi_json (~> 1.0)
      redis-namespace (~> 1.3)
      sinatra (>= 0.9.2)
      vegas (~> 0.1.2)
    resque-scheduler (4.0.0)
      mono_logger (~> 1.0)
      redis (~> 3.0)
      resque (~> 1.25)
      rufus-scheduler (~> 3.0)
    ruby-graphviz (1.2.2)
    rufus-scheduler (3.2.0)
    sass (3.4.20)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    select2-rails (3.5.9.3)
      thor (~> 0.14)
    shellany (0.0.1)
    sinatra (1.4.6)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    slop (3.6.0)
    spring (1.6.1)
    sprockets (3.5.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.11)
    therubyracer (0.12.2)
      libv8 (~> 3.16.14.0)
      ref
    thin (1.6.4)
      daemons (~> 1.0, >= 1.0.9)
      eventmachine (~> 1.0, >= 1.0.4)
      rack (~> 1.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.1)
    turbolinks (2.5.3)
      coffee-rails
    twitter-typeahead-rails (0.11.1)
      actionpack (>= 3.1)
      jquery-rails
      railties (>= 3.1)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    tzinfo-data (1.2015.7)
      tzinfo (>= 1.0.0)
    uglifier (2.7.2)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    vegas (0.1.11)
      rack (>= 1.0.0)
    warden (1.2.4)
      rack (>= 1.0)
    web-console (2.2.1)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)
    websocket-driver (0.6.3)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    websocket-rails (0.7.0)
      em-synchrony
      faye-websocket
      hiredis
      rack
      rails
      redis
      redis-objects
      thin
    will_paginate (3.0.7)

PLATFORMS
  ruby

DEPENDENCIES
  angularjs-rails
  bcrypt (~> 3.1.7)
  bootstrap-sass (~> 3.3.4)
  bootstrap-tagsinput-rails (~> 0.4.2.1)
  bootstrap3-datetimepicker-rails (~> 4.15.35)
  braintree
  byebug
  carrierwave (~> 0.10.0)
  coffee-rails (~> 4.1.0)
  devise (~> 3.5.1)
  figaro (~> 1.1.1)
  flat-ui-sass (~> 2.1.3)
  font-awesome-sass
  fullcalendar-rails (~> 2.3.1.0)
  geocoder (~> 1.2.9)
  gon (~> 5.2.3)
  guard
  guard-livereload (~> 2.4)
  haversine (~> 0.3.0)
  hirb
  jbuilder (~> 2.0)
  jquery-rails
  jquery-ui-rails (~> 5.0.5)
  mailboxer
  mini_magick (~> 4.2.7)
  momentjs-rails (~> 2.10.3)
  rack-livereload
  rails (= 4.2.1)
  rails-erd
  ransack (~> 1.6.6)
  rename (~> 1.0.2)
  resque
  resque-scheduler
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  select2-rails (~> 3.5.9.3)
  spring
  sqlite3
  therubyracer
  turbolinks
  twitter-typeahead-rails (~> 0.11.1)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (~> 2.0)
  websocket-rails
  will_paginate (~> 3.0.6)

BUNDLED WITH
   1.10.6

1 个答案:

答案 0 :(得分:0)

我仍然不知道更新我的宝石如何触发这个,但显然我忘了删除这一行(我不再使用flat-ui)

config.assets.precompile += ['flat-ui/**/*']

在我的application.rb文件中。

通配符显然与导致问题的部分匹配rails bootstrap-sass assets compilation error - undefined variable alert-padding