顯示具有 Sinatra 標籤的文章。 顯示所有文章
顯示具有 Sinatra 標籤的文章。 顯示所有文章

2012年8月17日 星期五

如何在 Windows 上 安裝 Thin

如果安裝 Thin 一直出現這樣的錯誤
 error: cannot convert 'stat*' to '_stati64*' for argument '2' to 'int _fstati64(int
, _stati64*)'



參考來源
ruby - Cannot install thin on windows - Stack Overflow

假設已經裝好 DevKit
還沒裝好請參考 Development Kit · oneclick/rubyinstaller Wiki · GitHub

C:\Users\user>gem install eventmachine --pre
Fetching: eventmachine-1.0.0.rc.4-x86-mingw32.gem (100%)
Successfully installed eventmachine-1.0.0.rc.4-x86-mingw32
1 gem installed
Installing ri documentation for eventmachine-1.0.0.rc.4-x86-mingw32...
Installing RDoc documentation for eventmachine-1.0.0.rc.4-x86-mingw32...

C:\Users\user>gem install thin
Fetching: daemons-1.1.9.gem (100%)
Fetching: thin-1.4.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed daemons-1.1.9
Successfully installed thin-1.4.1
2 gems installed
Installing ri documentation for daemons-1.1.9...
Installing ri documentation for thin-1.4.1...
Installing RDoc documentation for daemons-1.1.9...
Installing RDoc documentation for thin-1.4.1...


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