2012年8月10日 星期五

Sinatra

on Windows

首先需要 安裝 Ruby
選擇安裝 Ruby Installer 一鍵安裝 免設定
在這邊安裝的版本是 Ruby 1.9.3-p194

打開 Command Line
確認一下環境&版本

C:\Users\user>ruby -v

ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

C:\Users\user>gem -v

1.8.23


安裝 Sinatra

C:\Users\user>gem install sinatra

Fetching: rack-1.4.1.gem (100%)

Fetching: rack-protection-1.2.0.gem (100%)

Fetching: tilt-1.3.3.gem (100%)

Fetching: sinatra-1.3.2.gem (100%)

Successfully installed rack-1.4.1

Successfully installed rack-protection-1.2.0

Successfully installed tilt-1.3.3

Successfully installed sinatra-1.3.2

4 gems installed

Installing ri documentation for rack-1.4.1...

Installing ri documentation for rack-protection-1.2.0...

Installing ri documentation for tilt-1.3.3...

Installing ri documentation for sinatra-1.3.2...

Installing RDoc documentation for rack-1.4.1...

Installing RDoc documentation for rack-protection-1.2.0...

Installing RDoc documentation for tilt-1.3.3...

Installing RDoc documentation for sinatra-1.3.2...

寫個測試程式

# myapp.rb
require 'sinatra'

get '/' do
  'Hello world!'
end


執行

C:\Users\user>ruby myapp.rb
[2012-08-10 15:36:21] INFO  WEBrick 1.3.1
[2012-08-10 15:36:21] INFO  ruby 1.9.3 (2012-04-20) [i386-mingw32]
== Sinatra/1.3.2 has taken the stage on 4567 for development with backup from WEBrick
[2012-08-10 15:36:21] INFO  WEBrick::HTTPServer#start: pid=140360 port=4567


就跟他的網頁一樣

簡潔


製作 APNS 憑證
How to build an Apple Push Notification provider server (tutorial)

gem for APNS
https://github.com/jpoz/APNS

沒有留言:

張貼留言