Rails 3 提供了 match
方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:
注:(r3 代表 Rails 3,r4 代表 Rails 4)
# routes.rb
namespace :tasks do | |
namespace :create do | |
desc "Create all survey templates" | |
task :all => [:task1, :task2, :task3] | |
desc "desc1" | |
task :task1 => :environment do | |
end |
# coding: utf-8 | |
require 'rack/urlmap' | |
require File.join(File.dirname(__FILE__), 'app') | |
require File.join(File.dirname(__FILE__), 'api', 'v1') | |
routes = Rack::URLMap.new( | |
'/' => Sinatra::Application, | |
'/api/v1/' => ApiV1 | |
) |
#!/usr/bin/env bash | |
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`. | |
# Please modify the CONSTANT variables to fit your configurations. | |
# The script will start with config set by $PUMA_CONFIG_FILE by default | |
PUMA_CONFIG_FILE=config/puma.rb | |
PUMA_PID_FILE=tmp/pids/puma.pid | |
PUMA_SOCKET=tmp/sockets/puma.sock |
#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
############################################################################# | |
# current prompt | |
############################################################################# | |
# \d – Current date | |
# \t – Current time | |
# \h – Host name | |
# \# – Command number | |
# \u – User name | |
# \W – Current working directory (ie: Desktop/) | |
# \w – Current working directory, full path (ie: /Users/Admin/Desktop) |
# $:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Для работы rvm | |
require 'rvm' | |
require 'rvm/capistrano' | |
require 'bundler/capistrano' | |
require 'puma/capistrano' | |
set :application, "myapp" | |
set :rails_env, "production" | |
ssh_options[:port] = 777 | |
set :port, 777 |
Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv
instead. If you are looking for the previous version of this document, see the revision history.
$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10
$ pyenv install 2.6.9