#如何将 Rails 应用程序部署到 VPS 上
如果已经在 VPS 上假设好了 Rails 生产环境,接下来就可以将部署应用程序了。
###需要用到的工具
#如何将 Rails 应用程序部署到 VPS 上
如果已经在 VPS 上假设好了 Rails 生产环境,接下来就可以将部署应用程序了。
###需要用到的工具
| class Lisp | |
| def initialize | |
| @env = { | |
| :label => lambda { |(name,val), _| @env[name] = val }, | |
| :quote => lambda { |sexpr, _| sexpr[0] }, | |
| :car => lambda { |(list), _| list[0] }, | |
| :cdr => lambda { |(list), _| list.drop 1 }, | |
| :cons => lambda { |(e,cell), _| [e] + cell }, | |
| :eq => lambda { |(l,r), _| l == r }, | |
| :if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) }, |
install CentOS 6
yum update
yum upgrade
check the server time. sync the time to a time server if needed (service 'ntpd')
download and install Postgresql Server v9.1 rpm package:
rpm -Uvh http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
This should have installed the necessary server package: postgresql91-server.x86_64.
| # simulate template rendering | |
| class Template < Struct.new(:name) | |
| def render | |
| puts "#{name}_begin" | |
| r = "#{name}_begin\n" | |
| r << yield if block_given? | |
| puts "#{name}_end\n" | |
| r << "#{name}_end\n" | |
| end | |
| end |
| #!/usr/bin/ruby1.9 | |
| require 'fiber' | |
| require 'benchmark' | |
| class Ring | |
| attr_reader :id | |
| attr_accessor :attach | |
| def initialize(id) |
| class Avatar < ActiveRecord::Base | |
| attr_accessor :content_type, :original_filename, :image_data | |
| before_save :decode_base64_image | |
| has_attached_file :image, | |
| PAPERCLIP_CONFIG.merge( | |
| :styles => { | |
| :thumb => '32x32#', | |
| :medium => '64x64#', |
| # regexps to check if a string is pure chinese | |
| class String | |
| # 20k chars | |
| CHINESE_UCS2 = /^(?: | |
| [\x4e-\x9e][\x00-\xff] | |
| |\x9f[\x00-\xa5] | |
| )+$/xn | |
| # 20k chars | |
| CHINESE_UTF8 = /^(?: |
Version: 1.0.0 Protocol Version: 2024-11-05 Last Updated: 2026-01-10