草庐IT

external-assets-working-directori

全部标签

ruby-on-rails - rails Assets 管道 "Cannot allocate memory - nodejs"

我们刚刚从Rails3.0.7升级到Rails3.2.5,并为暂存服务器即时使用Assets管道编译,但有时我们会遇到这个异常!Showing/var/rails/appname/app/views/common/_my_partial.html.hamlwhereline#raised:Cannotallocatememory-nodejs/tmp/execjs20120613-17090-thoc8f.js2>&1Extractedsource(aroundline#):Traceoftemplateinclusion:app/views/layouts/application.h

ruby-on-rails - rake Assets :precompile attempting to connect to database

我正在尝试调试为什么我的应用程序在我运行rakeassets:precompile--trace时尝试连接到我的数据库。我可能在堆栈跟踪中遗漏了一些东西...有人看到相关行吗?DEPRECATIONWARNING:TheInstanceMethodsmoduleinsideActiveSupport::Concernwillbenolongerincludedautomatically.PleasedefineinstancemethodsdirectlyinActionController::Baseinstead.(calledfromat/Users/Kyle/Desktop/s

ruby - 魔术注释(#Encoding : utf-8 ) in ruby​​ work?

ruby中的神奇注释是如何工作的?我在说:#Encoding:utf-8这是预处理指令吗?这种结构还有其他用途吗? 最佳答案 源文件顶部的Ruby解释器说明-这称为魔法注释。在处理您的源代码之前,解释器会读取这一行并设置正确的编码。我相信对于解释语言来说这很常见。至少Python使用相同的方法。您可以通过多种不同的方式指定编码(其中一些可以被编辑器识别):#encoding:UTF-8#coding:UTF-8#-*-coding:UTF-8-*-您可以在thisarticle中阅读有关源编码的一些有趣内容.我所知道的唯一具有类似结

ruby-on-rails - rails : Logging for code in the lib directory?

为保存在lib目录中的代码配置日志记录的最佳/最简单方法是什么? 最佳答案 有两种方法:假设您的库是独立的并且有一个模块,您可以将logger属性添加到您的模块并在您的库代码中的任何地方使用它。moduleMyLibrarymattr_accessor:loggerend然后,您可以使用config/initializers/中的初始化程序,或使用config/environment.rb中的config.after_initializeblock来初始化你的记录器,像这样:require'mylibrary'MyLibrary.l

ruby - 当我将参数传递给我的脚本时,使用 gets() 会出现 "No such file or directory"错误

您好,我正在制作一个简单的ruby​​脚本,我在其中使用gets.chomp和参数制作表单,问题是当gets.chomp使用脚本返回时当我应用参数test时出现错误。代码:#!usr/bin/rubydefformulario(quien)while(1)print"[+]Word:"word=gets.chompprintquien+"->"+wordendendquien=ARGV[0]formulario(quien)错误:[+]Word:C:/Users/test/test.rb:8:in`gets':Nosuchfileordirectory@rb_sysopen-test(

ruby - Windows 上的 Jekyll : Pygments not working

在我一直使用RC之前,我已经更新到最新的JekyllBuild(1.0.3)。更新代码解析后(使用Pygments)不再起作用。我总是收到以下错误:C:/Ruby193/lib/ruby/gems/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162:warning:cannotclosefdbeforespawn←[31mLiquidException:Nosuchfileordirectory-/bin/shin2012-01-17-test-post.md←[0m有没有人也遇到过这个问题?我对ruby一无所知,所以我不能自己调试:

ruby-on-rails - gem 更新后 : test fail with "Asset was not declared to be precompiled in production"

由于我更新了几个gem,所以所有测试都失败并出现错误:ActionView::Template::Error:Assetwasnotdeclaredtobeprecompiledinproduction.AddRails.application.config.assets.precompile+=%w(favicons/manifest.json.erb)toconfig/initializers/assets.rbandrestartyourserverapp/views/layouts/_faviconsheader.html.erb:14:in_app_views_layouts

ruby-on-rails - 反编译开发 Assets 管道

我正在为我的生产环境编译我的Assets管道,它适用于我的所有环境。如何为我的开发环境反编译Assets管道?我检查了我的配置/开发环境,但找不到修复。在此先感谢您的帮助... 最佳答案 要删除预编译Assets,请使用:rakeassets:clean这基本上是删除public/assets目录。如果您需要在特定环境中运行它,您可能需要包含RAILS_ENV变量。 关于ruby-on-rails-反编译开发Assets管道,我们在StackOverflow上找到一个类似的问题:

ruby-on-rails - "rake assets:precompile"给出 punc 错误

我正在尝试为生产预编译我的Assets,但Rails似乎不合作。$bundleexecrakeassets:precompile/home/drderp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby/home/drderp/.rvm/gems/ruby-1.9.3-p194@global/bin/rakeassets:precompile:allRAILS_ENV=productionRAILS_GROUPS=assetsrakeaborted!Unexpectedtokenpunc,expectedpunc(line:213,col:13,pos:5986

Ruby 的 File.open 给出 "No such file or directory - text.txt (Errno::ENOENT)"错误

我在我的Win7机器上安装了Ruby1.9.2。创建了一个简单的analyzer.rb文件。它有这一行:File.open("text.txt").each{|line|putsline}当我运行代码时,它给我这个错误:analyzer.rb:1:in`initialize':Nosuchfileordirectory-text.txt(Errno::ENOENT)fromanalyzer.rb:1:in`open'fromanalyzer.rb:1:in`'Exitcode:1我不明白。在与analyzer.rb文件相同的目录中有一个text.txt文件。我还尝试输入文件的绝对路径C