Capistrano部署时生成空的application.css样式表 [英] Capistrano generating empty application.css stylesheet when deploying

查看:74
本文介绍了Capistrano部署时生成空的application.css样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Capistrano部署我的Rails应用程序,但是生成的application.css样式表为空。在我的登台环境和生产环境中都会发生这种情况。下面与我的分期有关。



这是使用Rails 3.1.1,Ruby 2.0.0p0和Capistrano 2.14.1



我将尝试提供尽可能多的详细信息(尽管很抱歉,如果提供的详细信息太多)。



日志



运行部署时,会将以下内容添加到 staging.log中:

 已编译application.js(0ms)(pid 15434)
编译的application.css(0ms)(pid 15434)
编译的application.js(1ms)(pid 15428)
编译的application.css(0ms )(pid 15428)

我不确定重复输入是否可能是线索? p>

以下是我运行 cap staging deploy 时输出的一部分:

 命令在730毫秒内完成
在回调`deploy:update_code'后触发
* 2013-04-28 14:04:10执行`deploy: asset:precompile'
在`deploy:assets:precompile'
的回调之前触发* 2013-04-28 14:04:10执行`deploy:assets:update_asset_mtimes'
*执行 [-e /home/somedomain.co.uk/staging/mkn/shared/assets/manifest.yml]& ;&猫/home/somedomain.co.uk/staging/mkn/shared/assets/manifest.yml || echo
服务器:[ homer.somedomain.co.uk]
[homer.somedomain.co.uk]执行命令
的命令在614ms内完成
**更新mtimes大约20个资产...
服务器:[ homer.somedomain.co.uk]
** sftp上传#< StringIO:0x007f945d8d6a28>-> /home/somedomain.co.uk / staging / mkn // TOUCH_ASSETS
[homer.somedomain.co.uk] /home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS
[homer.somedomain.co.uk]完成​​
* sftp上传完成
*执行 cat /home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS |同时读取资产;触摸-cm-\ $ asset\;完成&& rm -f-/home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS
服务器:[ homer.somedomain.co.uk]
[homer.somedomain.co.uk ]执行命令
的命令在812毫秒内完成
*执行 ls -x /home/somedomain.co.uk/staging/mkn/releases
服务器:[ homer.somedomain.co。 uk]
[homer.somedomain.co.uk]执行命令
命令在438毫秒内完成
*执行 cd-/home/somedomain.co.uk/staging/mkn/releases / 20130428130343&&捆绑包执行佣金耙RAILS_ENV =登台RAILS_GROUPS =资产资产:预编译&& cp-/home/somedomain.co.uk/staging/mkn/shared/assets/manifest.yml /home/somedomain.co.uk/staging/mkn/releases/20130428130343/assets_manifest.yml
服务器: [ homer.somedomain.co.uk]
[homer.somedomain.co.uk]执行命令
** [out :: homer.somedomain.co.uk] / home / greggannicott /。 rvm / gems / ruby​​-2.0.0-p0 / gems / bundler-1.3.5 / lib / bundler / runtime.rb:216:警告:不安全的世界可写目录dir /home/somedomain.co.uk/staging/mkn/shared在PATH中,模式040777
** [out :: homer.somedomain.co.uk] /home/greggannicott/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /home/somedomain.co .uk / staging / mkn / shared / bundle / ruby​​ / 2.0.0 / bin / rake资产:预编译:nondigest RAILS_ENV = staging RAILS_GROUPS = assets
** [out :: homer.somedomain.co.uk] /主页/greggannicott/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/runtime.rb:216:警告:不安全的世界可写目录/home/somedomain.co.uk/ staging / mkn / shared in PATH,mode 040777
command in 13990ms
* 2013-04-28 14: 04:26执行`deploy:create_symlink'
*执行 rm -f /home/somedomain.co.uk/staging/mkn/current&& ln -s /home/somedomain.co.uk/staging/mkn/releases/20130428130343 /home/somedomain.co.uk/staging/mkn/current
服务器:[ homer.somedomain.co.uk ]
[homer.somedomain.co.uk]执行命令
命令在581毫秒内完成
**交易:commit
* 2013-04-28 14:04:26执行` deploy:restart'
*执行 touch /home/somedomain.co.uk/staging/mkn/current/tmp/restart.txt
服务器:[ homer.somedomain.co.uk]
[homer.somedomain.co.uk]执行命令
命令在427毫秒内完成



< h2>配置文件

我的 Capfile

  load'deploy'
#如果使用Rails的资产管道,则取消注释
load'deploy / assets'
Dir ['vendor / gems / * /食谱/*.rb','供应商/插件/*/recipes/*.rb'].each {| plugin | load(plugin)}
load'config / deploy'#删除该行以跳过任何加载默认任务

我的 con fig / application.rb

 需要File.expand_path('../ boot',__FILE__ )

需要'rails / all'

如果已定义?(捆绑商)
#如果在部署到生产之前预编译资产,请使用以下行
#Bundler.require(* Rails.groups(:assets => %w(开发测试)))
#如果要在生产中延迟编译资产,请使用此行
#Bundler.require(:default,:assets,Rails.env)
结尾

模块块
类Application< Rails :: Application
#config / environments / *中的设置优先于此处指定的设置。
#应用程序配置应放入config / initializers中的文件中
#-该目录中的所有.rb文件都会自动加载。

#具有要自动加载的类和模块的自定义目录。
#config.autoload_paths + =%W(#{config.root} / extras)

#仅按给定的顺序加载此处命名的插件(默认为字母顺序)。
#:all可以用作所有未明确命名的插件的占位符。
#config.plugins = [:exception_notification,:ssl_requirement,:all]

#激活应该一直运行的观察者。
#config.active_record.observers =:cacher,:garbage_collector,:forum_observer

#将Time.zone默认设置为指定区域,并使Active Record自动转换为该区域。
#运行 rake -D time以获取用于查找时区名称的任务列表。默认为UTC。
#config.time_zone ='中部时间(美国和加拿大)'

#默认语言环境为:en并自动加载config / locales / *。rb,yml中的所有翻译。
#config.i18n.load_path + = Dir [Rails.root.join('my','locales','*。{rb,yml}')。to_s]
#config.i18n。 default_locale =:de

#配置Ruby 1.9模板中使用的默认编码。
config.encoding = utf-8

#配置敏感参数,这些参数将从日志文件中过滤掉。
config.filter_parameters + = [:密码]

#启用资产管道
config.assets.enabled = true

#资产版本,如果您想使所有资产过期
config.assets.version ='1.2'

config.generators执行| g |
g.test_framework:rspec,
:fixtures => true,
:view_specs => false,
:helper_specs => false,
:routing_specs => false,
:controller_specs => true,
:request_specs => true
g.fixture_replacement:factory_girl,:dir => 规格/工厂
结束
结束
结束

我的 config / environments / staging.rb

  Nuggets :: Application。 configure do 
#此处指定的设置将优先于config / application.rb中的设置。rb

#两次请求之间未重装代码
config.cache_classes = true

#禁用所有错误报告并打开
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

#禁用Rails的静态资产服务器(Apache或nginx已经做到了)
config.serve_static_assets = false

#压缩JavaScript和CSS
config.assets.compress = true

#Don如果错过了预编译的资产,则回退到资产管道
config.assets.compile = false

#生成资产URL的摘要
config.assets.digest = true

#默认为Rail s.root.join( public / assets)
#config.assets.manifest = YOUR_PATH

#指定服务器用于发送文件的标头
#config。 action_dispatch.x_sendfile_header = X-Sendfile#对于Apache
#config.action_dispatch.x_sendfile_header ='X-Accel-Redirect'#对于nginx

#强制通过SSL进行对应用程序的所有访问,使用Strict-Transport-Security并使用安全cookie。
#config.force_ssl = true

#查看日志中的所有内容(默认为:info)
config.log_level =:debug

#使用
#config.logger = SyslogLogger.new

#在生产环境中使用其他缓存存储区
#config.cache_store =:mem_cache_store

#启用从资产服务器提供图片,样式表和JavaScript的服务
#config.action_controller.asset_host = http://assets.example.com

#预编译其他资产(application.js,application.css和所有非JS / CSS已经添加)
#config.assets.precompile + =%w(search.js)

#禁用传递错误,错误的电子邮件地址将被忽略
#config.action_mailer.raise_delivery_errors = false

#启用线程模式
#config.threadsafe!

#启用I18n的语言环境回退(使任何语言环境的查询回退到
#找不到翻译时的I18n.default_locale)
config.i18n.fallbacks = true

#发送弃用通知到注册的侦听器
config.active_support.deprecation =:notify

#在浏览器
配置中显示完整的错误报告。 think_all_requests_local = true

结束

我的 config / deploy.rb

 需要 rvm / capistrano 
需要'bundler / capistrano '
#基于:http://guides.beanstalkapp.com/deployments/deploy-with-capistrano.html
设置:应用程序,块
设置:normalize_asset_timestamps,假

设置:scm,:git
设置:repository, ssh://greggannicott@homer.somedomain.co.uk/home/git/nuggets.git
设置:scm_passphrase , *******
ssh_options [:forward_agent] = true

set:user, greggannicott

set:s tages,%w {staging production}
set:default_stage, staging
需要'capistrano / ext / multistage'

#需要添加以下内容以避免失败(http://discuss.joyent.com/viewtopic.php?id=27326)
default_run_options [:pty] = true

命名空间:deploy do
desc告诉乘客重新启动应用程序。
任务:重新启动
运行触摸#{current_path} /tmp/restart.txt
结束
结束

set:bundle_flags,

我的 Gemfile

 来源'http://rubygems.org'

gem'rails','3.1.1'
gem'therubyracer',:platforms => :ruby#由于缺少Javascript运行时环境,我认为这是在Ubuntu上必需的。
gem'rdiscount'
gem'bcrypt-ruby'
gem'will_paginate'
gem'faker'
gem'capistrano'
gem'rvm-capistrano'
gem'sqlite3'

#捆绑边缘Rails:
#gem'rails',:git => ‘git://github.com/rails/rails.git’


#宝石仅用于资产,默认情况下在生产环境中不需要
#。
小组:资产做
宝石 ass-rails,〜> 3.1.4
宝石咖啡轨,〜> 3.1.1'
gem'uglifier','> = 1.0.3'
end

gem'jquery-rails'

group:开发
gem'better_errors'
gem'binding_of_caller'
gem'meta_request'
gem'rspec-rails'
gem'guard-rspec'
gem'guard-spork'
gem'pork'
end

#要使用ActiveModel has_secure_password
#gem'bcrypt-ruby','〜> 3.0.0'

#使用unicorn作为Web服务器
#gem'unicorn'

#使用Capistrano部署
#gem'capistrano'

#要使用调试器
#gem'ruby-debug19',:require => 'ruby-debug'

group:test do
#漂亮的打印测试输出
gem'turn',:require => false
gem'rspec-rails'
gem'factory_girl_rails'
gem'capybara'
gem'guard-rspec'
gem'rb-fsevent',:require =>假
宝石'咆哮'
结束

我的应用程序/资产/样式表目录列表:

  -rw-rw-r-- 1个greggannicott员工350 1月27日13:28 application.css 
-rw-rw-r-- 1 greggannicott工作人员13622 27 Apr 23:35 global.css.scss
-rw-rw-r-- 1 greggannicott工作人员33211 27 Jan 13:28 jquery-ui-1.8.17.custom.css
-rw-rw-r-- 1 greggannicott staff 2208 27 Jan 13:28 media-queries.css
-rw- rw-r-- 1个greggannicott职员178 1月27日13:28 nuggets.css.scss
-rw-rw-r-- 1个greggannicott职员176 27 Jan 13:28 pages.css.scss
- rw-rw-r-- 1个greggannicott职员179 1月27日13:28sessions.css.scss
-rw-rw-r-- 1个greggannicott职员179 1月27日13:28 settings.css.scss
-rw-rw-r-- 1 greggannicott员工175 27 Jan 1:28 tags.css.scss
-rw-rw-r-- 1 greggannicott员工176 27 Jan 13:28 users.css.scss

最后,我的 app / assets / stylesheets / ap plication.css

  / * 
*这是一个清单文件自动包含此目录
*和任何子目录中可用的所有样式表。您可以随意在此文件中添加应用程序范围内的样式,它们会显示在
*编译文件的顶部,但是通常最好为每个样式范围创建一个新文件。
* = require_self
* = require_tree。
* /


解决方案

我发现了答案(至少在较高水平上)。



似乎与Ruby 2.0有关。



当我在服务器上将RVM设置为使用Ruby 1.9.3并进行另一次部署时,它可以正常工作**。是一个小小的矫kill过正:

  rvm install 1.9.3 
rvm use 1.9.3
rvm-默认值1.9.3

**我还在<$ c $中重新引入了以下代码c> config / application.rb 。我之前曾将其注释掉,这是我尝试使其工作的一部分:

  Bundler.require(* Rails.groups (:assets =>%w(开发测试)))


I'm attempting to deploy my Rails app using Capistrano, but the resulting application.css stylesheet is empty. This happens for both my staging and production environments. The below relate to my staging one.

This is using Rails 3.1.1, Ruby 2.0.0p0 and Capistrano 2.14.1

I'll attempt to provide as much detail as possible (although sorry if it is too much detail).

Logs

When the deploy is run, the following is added to `staging.log':

Compiled application.js  (0ms)  (pid 15434)
Compiled application.css  (0ms)  (pid 15434)
Compiled application.js  (1ms)  (pid 15428)
Compiled application.css  (0ms)  (pid 15428)

I'm not sure if the double entries might be a clue?

The following is part of the output when I run cap staging deploy:

    command finished in 730ms
    triggering after callbacks for `deploy:update_code'
  * 2013-04-28 14:04:10 executing `deploy:assets:precompile'
    triggering before callbacks for `deploy:assets:precompile'
  * 2013-04-28 14:04:10 executing `deploy:assets:update_asset_mtimes'
  * executing "[ -e /home/somedomain.co.uk/staging/mkn/shared/assets/manifest.yml ] && cat /home/somedomain.co.uk/staging/mkn/shared/assets/manifest.yml || echo"
    servers: ["homer.somedomain.co.uk"]
    [homer.somedomain.co.uk] executing command
    command finished in 614ms
 ** Updating mtimes for ~20 assets...
    servers: ["homer.somedomain.co.uk"]
 ** sftp upload #<StringIO:0x007f945d8d6a28> -> /home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS
    [homer.somedomain.co.uk] /home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS
    [homer.somedomain.co.uk] done
  * sftp upload complete
  * executing "cat /home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS | while read asset; do touch -cm -- \"$asset\"; done && rm -f -- /home/somedomain.co.uk/staging/mkn//TOUCH_ASSETS"
    servers: ["homer.somedomain.co.uk"]
    [homer.somedomain.co.uk] executing command
    command finished in 812ms
  * executing "ls -x /home/somedomain.co.uk/staging/mkn/releases"
    servers: ["homer.somedomain.co.uk"]
    [homer.somedomain.co.uk] executing command
    command finished in 438ms
  * executing "cd -- /home/somedomain.co.uk/staging/mkn/releases/20130428130343 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile && cp -- /home/somedomain.co.uk/staging/mkn/shared/assets/manifest.yml /home/somedomain.co.uk/staging/mkn/releases/20130428130343/assets_manifest.yml"
    servers: ["homer.somedomain.co.uk"]
    [homer.somedomain.co.uk] executing command
 ** [out :: homer.somedomain.co.uk] /home/greggannicott/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /home/somedomain.co.uk/staging/mkn/shared in PATH, mode 040777
 ** [out :: homer.somedomain.co.uk] /home/greggannicott/.rvm/rubies/ruby-2.0.0-p0/bin/ruby /home/somedomain.co.uk/staging/mkn/shared/bundle/ruby/2.0.0/bin/rake assets:precompile:nondigest RAILS_ENV=staging RAILS_GROUPS=assets
 ** [out :: homer.somedomain.co.uk] /home/greggannicott/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /home/somedomain.co.uk/staging/mkn/shared in PATH, mode 040777
    command finished in 13990ms
  * 2013-04-28 14:04:26 executing `deploy:create_symlink'
  * executing "rm -f /home/somedomain.co.uk/staging/mkn/current && ln -s /home/somedomain.co.uk/staging/mkn/releases/20130428130343 /home/somedomain.co.uk/staging/mkn/current"
    servers: ["homer.somedomain.co.uk"]
    [homer.somedomain.co.uk] executing command
    command finished in 581ms
 ** transaction: commit
  * 2013-04-28 14:04:26 executing `deploy:restart'
  * executing "touch /home/somedomain.co.uk/staging/mkn/current/tmp/restart.txt"
    servers: ["homer.somedomain.co.uk"]
    [homer.somedomain.co.uk] executing command
    command finished in 427ms

Configuration Files

My Capfile:

load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks

My config/application.rb:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  #Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

module Nuggets
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Custom directories with classes and modules you want to be autoloadable.
    # config.autoload_paths += %W(#{config.root}/extras)

    # Only load the plugins named here, in the order given (default is alphabetical).
    # :all can be used as a placeholder for all plugins not explicitly named.
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

    # Activate observers that should always be running.
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de

    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"

    # Configure sensitive parameters which will be filtered from the log file.
    config.filter_parameters += [:password]

    # Enable the asset pipeline
    config.assets.enabled = true

    # Version of your assets, change this if you want to expire all your assets
    config.assets.version = '1.2'

    config.generators do |g|
      g.test_framework :rspec,
        :fixtures => true,
        :view_specs => false,
        :helper_specs => false,
        :routing_specs => false,
        :controller_specs => true,
        :request_specs => true
      g.fixture_replacement :factory_girl, :dir => "spec/factories"
    end
  end
end

My config/environments/staging.rb:

Nuggets::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to Rails.root.join("public/assets")
  # config.assets.manifest = YOUR_PATH

  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # See everything in the log (default is :info)
  config.log_level = :debug

  # Use a different logger for distributed setups
  # config.logger = SyslogLogger.new

  # Use a different cache store in production
  # config.cache_store = :mem_cache_store

  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "http://assets.example.com"

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  # config.assets.precompile += %w( search.js )

  # Disable delivery errors, bad email addresses will be ignored
  # config.action_mailer.raise_delivery_errors = false

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify

  # Show full error reports in the browser
  config.consider_all_requests_local       = true

end

My config/deploy.rb:

require "rvm/capistrano"
require 'bundler/capistrano'
# Based on: http://guides.beanstalkapp.com/deployments/deploy-with-capistrano.html
set :application, "nuggets"
set :normalize_asset_timestamps, false

set :scm, :git
set :repository, "ssh://greggannicott@homer.somedomain.co.uk/home/git/nuggets.git"
set :scm_passphrase, "*******"
ssh_options[:forward_agent] = true

set :user, "greggannicott"

set :stages, %w{staging production}
set :default_stage, "staging"
require 'capistrano/ext/multistage'

# The following needs to be added to avoid a failure (http://discuss.joyent.com/viewtopic.php?id=27326)
default_run_options[:pty] = true

namespace :deploy do
  desc "Tell Passenger to restart the app."
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

set :bundle_flags,    ""

My Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.1.1'
gem 'therubyracer', :platforms => :ruby # I believe this is required to run on Ubuntu due to a lack of a Javascript runtime env..
gem 'rdiscount'
gem 'bcrypt-ruby'
gem 'will_paginate'
gem 'faker'
gem 'capistrano'
gem 'rvm-capistrano'
gem 'sqlite3'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.4'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'meta_request'
  gem 'rspec-rails'
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'spork'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
  gem 'rspec-rails'
  gem 'factory_girl_rails'
  gem 'capybara'
  gem 'guard-rspec'
  gem 'rb-fsevent', :require => false
  gem 'growl'
end

My app/assets/stylesheets directory listing:

-rw-rw-r--  1 greggannicott  staff    350 27 Jan 13:28 application.css
-rw-rw-r--  1 greggannicott  staff  13622 27 Apr 23:35 global.css.scss
-rw-rw-r--  1 greggannicott  staff  33211 27 Jan 13:28 jquery-ui-1.8.17.custom.css
-rw-rw-r--  1 greggannicott  staff   2208 27 Jan 13:28 media-queries.css
-rw-rw-r--  1 greggannicott  staff    178 27 Jan 13:28 nuggets.css.scss
-rw-rw-r--  1 greggannicott  staff    176 27 Jan 13:28 pages.css.scss
-rw-rw-r--  1 greggannicott  staff    179 27 Jan 13:28 sessions.css.scss
-rw-rw-r--  1 greggannicott  staff    179 27 Jan 13:28 settings.css.scss
-rw-rw-r--  1 greggannicott  staff    175 27 Jan 13:28 tags.css.scss
-rw-rw-r--  1 greggannicott  staff    176 27 Jan 13:28 users.css.scss

Finally, my app/assets/stylesheets/application.css:

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new file per style scope.
 *= require_self
 *= require_tree .
*/

解决方案

I've found the answer (at a high level at least).

It appears it has something to do with Ruby 2.0.

When I set RVM on the server to use Ruby 1.9.3, and did another deploy it worked**.

I'm new to RVM so what I did might be a slight overkill:

rvm install 1.9.3
rvm use 1.9.3
rvm --default 1.9.3

** I also re-introduced the following line of code in config/application.rb. I'd previously commented it out as part of my attempt to get this to work:

Bundler.require(*Rails.groups(:assets => %w(development test)))

这篇关于Capistrano部署时生成空的application.css样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆