把程序推到heroku遇到bundle问题的解决方法

编程时改动Gemfile而没有再执行bundle install却直接push到heroku时,会出现如下错误:

You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control

解决方法:

rm -rf .bundle && bundle install && git add Gemfile.lock && git commit -m "Added Gemfile.lock"
Advertisements

Mac上安装MacVim与spf13的各种问题之解决办法

前提

使用公司电脑,之前不知安装了什么。

安装MacVim,启动时

执行命令

mvim text.rb

错误信息

dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /opt/local/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5

问题原因与解决办法

卸载macports!

sudo port -fp uninstall installed

参照 http://guide.macports.org/chunked/installing.macports.uninstalling.html

安装spf13时

前提

先安装vundle

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

参照 https://github.com/gmarik/vundle

执行安装spf13的命令

curl http://j.mp/spf13-vim3 -L -o - | sh

参考 http://vim.spf13.com/

错误信息

fatal: Not a git repository (or any of the parent directories): .git
setting up symlinks
update/install plugins using Vundle
E282: Cannot read from "/Users/username/.spf13-vim-3/.vimrc.bundles"Vim: Reading from stdin...

问题原因与解决办法

先移除再安装

rm -rf /Users/username/.spf13-vim-3 && curl http://j.mp/spf13-vim3 -L -o - | sh

Perfect!!

在CentOS 5.8上搭建Ruby on Rails服务器

版本

  • Ruby : 1.9.3-p194
  • Rails : 3.2.8
  • Nginx : 1.2.3
  • MySQL : 5.0.95

安装必要的软件

yum update
yum -y install gcc gcc-c++ autoconf
yum -y install openssl-devel zlib-devel readline-devel curl-devel gettext-devel
yum -y install httpd-devel sqlite-devel

安装 YAML

cd /usr/local/src
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure
make && make install

安装 Git

wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
tar xzvf git-latest.tar.gz
cd git-2012-10-22 #Today's date
autoconf
./configure
make
sudo make install

安装 Ruby

mkdir ~/src
cd ~/src
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure
make
sudo make install

安装 Rails

gem install rails

安装 Passenger

gem install passenger

安装 Nginx

passenger-install-nginx-module

创建 Nginx 链接

ln -s /usr/local/nginx/sbin/nginx /usr/sbin/

为 Nokogiri 安装必要的 lib

yum install -y libxml2-devel libxslt-devel

安装 MySQL

yum install -y mysql-server mysql-devel

初始化 MySQL

mysql_install_db

重启 MySQL 服务

service mysqld start
chkconfig mysqld on

为 root 用户设置密码

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root_pass');

创建用户

create user 'new_user' identified by 'new_pass';

创建数据库

create database new_production default character set utf8 collate utf8_unicode_ci;
grant all on new_production.* to 'new_user'@'123.456.789.0' identified by 'new_pass';
grant all on new_production.* to 'new_user'@'%' identified by 'new_pass';
flush privileges;

安装 MySQL Gem

gem install mysql2 -- --with-mysql-config=/usr/lib/mysql/mysql_config

安装语言支持

yum groupinstall chinese-support

如果安装过程有错误

vim /etc/yum/pluginconf.d/fastestmirror.conf
#Change
enabled=1
#to
enabled=0