我的slug大小是89.5MB,这是巨大的.
但是存储库大小非常小:
$ du -hsc
8.0M .
8.0M total
Run Code Online (Sandbox Code Playgroud)
在这篇博客文章:http://dazedthots.blogspot.com/2011/07/reducing-slug-size-heroku.html之后,Heroku上有一个更改Gemfiles的错误.我已经改变了几次,包括git依赖,但现在,唯一的git依赖是"rails_admin".见下文:
source 'http://rubygems.org'
gem 'rails', '~> 3.1.0'
gem 'rails-i18n', '~> 0.1.3'
gem 'pg', '~> 0.11.0'
gem 'rake', '~> 0.8.7'
gem 'thin', '~> 1.2.11'
gem 'heroku', '~> 2.4.0'
gem 'squeel', '~> 0.8.6'
gem 'devise', '~> 1.4.2'
gem 'slim-rails', '~> 0.2.0'
gem 'simple_form', '~> 1.4.2'
gem 'will_paginate', '~> 3.0'
gem 'sunspot_rails', '~> 1.2.1'
gem 'jquery-rails', '~> 1.0.12'
gem 'modernizr-rails', '~> 2.0.6'
gem 'rails_admin', git: 'https://github.com/sferik/rails_admin.git'
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Passenger来托管我的rails应用程序,但正如本期所述,在rails 3.2.1中,日志记录有点不可思议.有人已经通过修复发布了一个提交(已被拉入主分支).如何告诉我的应用程序使用主分支而不是特定版本的rails gem?另外,是否有一种方法可以指定提交,以防更改稍后被另一次拉取覆盖?
像(在我的Gemfile中):
gem 'rails', git => 'git://github.com/rails/rails.git:<commit hash>'
Run Code Online (Sandbox Code Playgroud) 我已经浏览了我的应用程序,当我通过gem包含它时,我很难找到Twitter Bootstrap源的确切位置.如果我想查看Bootstrap .css,我该如何找到它?
根据我的理解,将其作为宝石包含在内的替代方案是下载并直接包含源代码,对吗?一种方法比另一种更好.
最后,如果我想修改Bootstrap css,最好的方法是什么?如果我在我的应用程序中有源,我想我可以去那里修改一些东西.如果我把它作为宝石包括在内怎么样?
关于如何工作的一些澄清将非常感激.将源代码放在我的应用程序目录中某个地方是有意义的,我可以指向它相对于.html文件...但是使用Gemfile我觉得事情是在一个小黑盒子里......
这是日志:http://pastebin.com/CAgur9xd
Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160720-8272-c88sgk.rb extconf.rb --with-cflags=-std=c99
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby2.2.0/bin/$(RUBY_BASE_NAME)
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable …Run Code Online (Sandbox Code Playgroud) 我正在Windows机器上构建一个rails网站但是当我检查我的Gemfile.lock时,我的Travis版本出现以下错误:
Your bundle only supports platforms ["x86-mingw32"] but your local platforms are ["ruby", "x86_64-linux"], and there's no compatible match between those two
Run Code Online (Sandbox Code Playgroud)
名单
这是完整的日志:https://travis-ci.org/bikebike/BikeBike/builds/222395810#L654
我查看了我的Gemfile.lock并说明:
PLATFORMS
x86-mingw32
Run Code Online (Sandbox Code Playgroud)
这似乎是问题的一部分.我已经尝试将任何特定于Windows的宝石放在一个platforms块中:
platforms 'mswin', 'mingw', 'mswin64', 'x64_mingw' do
gem 'tzinfo-data'
group :test do
gem 'wdm', '>= 0.1.0'
gem 'win32console', require: false
end
end
Run Code Online (Sandbox Code Playgroud)
但是Gemfile.lock看起来是一样的.
这是我的完整Gemfile和Gemfile.lock.
我可以通过从git中删除Gemfile.lock文件来暂时解决这个问题,但这不是最佳做法.无论如何,我可以提交我的Gemfile.lock文件并继续在我的Windows机器上开发?
我试图使用RCenvironment,.bashrc,.MacOSX/environment.plist和/etc/launchd.conf设置这些并重新启动计算机.... IntelliJ仍然没有拿起我的env变量:
Gemfile p"ENVIRONMENT:#{ENV ['VAR_PRIVATE_GEM_USERNAME']}"#输出"环境:"
我正在寻找简单但好的方法来清理gemfile并使rails更快地启动.如何获得所有必需宝石与所有加载宝石的列表.
我在Ubuntu 10.04上,我必须推送到Heroku的应用程序有一个Gemfile.lock,这个应用程序是由另一个程序员开发的.
当我使用bundle install命令时,这将安装必要的宝石以运行应用程序rails s.
是否bundle install在我的Gemfile或Gemfile.lock中获取特定的gem?
我的Gemfile和Gemfile.lock不一样.
我必须删除Gemfile.lock吗?
这是我的Gemfile:
source 'http://rubygems.org'
#ruby '1.9.3'
gem 'rails', "= 3.1.11"
#gem "rake", "= 0.8.7"
gem 'racc'
# gem 'sqlite3'
#gem 'acts_as_list', '>= 0.1.0'
#gem 'acts_as_tree'
gem 'paperclip'
gem 'aws-s3', :require => 'aws/s3'
gem 'aws-sdk'
gem 'gravatar_image_tag'
gem 'kaminari'
gem 'jquery-rails', '~> 2.1'
gem 'RedCloth', '>= 3.301'
gem 'carmen', :git => 'git://github.com/alvatarc/carmen.git', :branch => '0.2.x'
#gem 'carmen'
gem 'sass-rails'
gem 'http_accept_language'
gem 'right_aws'
gem 'exception_notification'
group :development …Run Code Online (Sandbox Code Playgroud) 我正在Windows上开发Ruby on Rails.
我们的本地网络出了问题,无法访问https://www.rubygems.org,好像被阻止了什么.
但我可以通过http://www.proxyfoxy.com访问它.
以下是结果bundle install:
$ bundle install
从https://rubygems.org/获取源索引
由于错误而重试抓取器(2/4):Bundler :: HTTPError无法从https://rubygems.org/获取规范
由于错误而重试抓取器(3/4):Bundler :: HTTPError无法从https://rubygems.org/获取规范
由于错误而重试抓取器(4/4):Bundler :: HTTPError无法从https://rubygems.org/获取规范
无法从https://rubygems.org/获取规格
有没有其他方法来安装宝石bundle install?
在我正在研究的rails项目中,我使用此Gemfile插入了对rspec,黄瓜和自动测试的支持(部分)
gem 'rspec-rails'
gem 'cucumber-rails'
gem 'autotest-standalone'
gem 'autotest-rails-pure'
gem 'zentest-without-autotest'
Run Code Online (Sandbox Code Playgroud)
但是为了使用自动测试运行测试,我需要执行,bundle exec autotest否则它将失败并显示此消息
$ autotest
loading autotest/cucumber_rails_rspec_rspec2
Error loading Autotest style autotest/cucumber_rails_rspec_rspec2 (no such file to load -- autotest/cucumber_rails_rspec_rspec2). Aborting.
Run Code Online (Sandbox Code Playgroud)
现在我正在使用Mac进行开发,我想启用autotest-growl和autotest-fsevents gem,但是如果我将这些行插入我的 ~/.autotest
require 'autotest/growl'
require 'autotest/fsevent'
Run Code Online (Sandbox Code Playgroud)
然后我需要在Gemfile中插入相应的gems,一切正常,但它会破坏我的CI服务器上的构建(在Linux上)
如何在不为本地和CI环境维护不同的Gemfile的情况下解决这个问题?
编辑:
目前我在Gemfile中用这些行解决了
if RUBY_PLATFORM.downcase.include?("darwin") # I'm on Mac
gem 'autotest-fsevent'
gem 'autotest-growl'
end
Run Code Online (Sandbox Code Playgroud)
它既可以在本地也可以在CI服务器上运行,我不知道它是否会弄乱一些东西,目前它似乎完美无缺.
任何更干净的方式仍然是受欢迎的.
EDIT2:
我切换到群组解决方案.虽然之前的monkeypatch在开发和持续集成方面都运行良好,但如果您使用capistrano bundler任务进行部署或使用bundle install --deployment选项(在生产中建议),它将在生产中出现错误
使用该if RUBY_PLATFORM.downcase.include?("darwin")行时,您将在部署时收到此错误.
# bundle install --deployment --without development test
You are trying to install …Run Code Online (Sandbox Code Playgroud)