分类目录归档:Ruby

使用MailCatcher作为开发环境邮件服务器

MailCatcher 运行一个超级简单的 SMTP 服务器,它可以捕获发送到它的任何消息并在 web 界面中显示。

运行 mailcatcher,将你最喜欢的应用程序设置为 smtp://127.0.0.1:1025,而不是默认的 SMTP 服务器,然后检查 http://127.0.0.1:1080,查看到目前为止的邮件。

file

ubuntu安装MailCatcher

sudo apt install ruby ruby-dev libsqlite3-dev build-essential
sudo gem install mailcatcher

运行

默认运行即可,更多参数如下

mailcatcher -h
Usage: mailcatcher [options]
        --ip IP                      Set the ip address of both servers
        --smtp-ip IP                 Set the ip address of the smtp server
        --smtp-port PORT             Set the port of the smtp server
        --http-ip IP                 Set the ip address of the http server
        --http-port PORT             Set the port address of the http server
        --http-path PATH             Add a prefix to all HTTP paths
        --no-quit                    Don't allow quitting the process
    -f, --foreground                 Run in the foreground
    -v, --verbose                    Be more verbose
    -h, --help                       Display this help information

使用rvm安装多个ruby版本

Step 1: Upgrade Packages

# yum update

Step 2: Installing Recommended Packages

# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel

Step 3: Install RVM ( Ruby Version Manager )

# curl -L get.rvm.io | bash -s stable

Step 4: Setup RVM Environment

# source /etc/profile.d/rvm.sh

Step 5: Install Required Ruby Version

# rvm install 1.9.3

Step 6: Setup Default Ruby Version

# rvm use 1.9.3 --default 

Step 7: Check Current Ruby Version

# ruby --version