Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin 機構で config.ru を操作 #315

Merged
merged 15 commits into from
Jun 5, 2013
Merged

plugin 機構で config.ru を操作 #315

merged 15 commits into from
Jun 5, 2013

Conversation

machu
Copy link
Member

@machu machu commented May 20, 2013

#277 の作業&レビュー用 pull request です。

方針

  • config.ru にはルーティング情報およびcoreが使用する必須ミドルウェアを記載しない
    • config.ruはtDiary設置者が任意でRackミドルウェアを追加するために使う
  • ルーティング情報はTDiary::Application内に保持
  • プラグインからルーティング情報を書き換え可能にする

作業状況

  • TDiary::Applicationの役割 (Rack→CGI変換) を TDiary::Dispatcherへ移動
  • config.ruのルーティング情報を TDiary::Applicationに移動
  • TDiary::Applicationをプラグインからカスタマイズ可能にする

@machu
Copy link
Member Author

machu commented Jun 2, 2013

ルーティングを外部から設定できるようにしました。レビューをお願いします!

  • TDiary::Application::Configuration に設定を保持。
  • プラグインからは builder でルーティングを追加可能。 authenticate で認証時のミドルウェアを指定。
  • 使い方の例は tdiary/application.rb および tdiary/application/extensions/omniouth.rb を参考。

プラグインだとtDiaryプラグインと紛らわしいので、名前は拡張 (extensions) にしました。

レビューでOKであれば、ドキュメントを書きます。

@hsbt
Copy link
Member

hsbt commented Jun 4, 2013

明日見るのメモ


Dir["#{File.dirname(__FILE__)}/acceptance/support/**/*.rb"].each {|f| require f}

Capybara.app = Rack::Builder.new do
map '/' do
run TDiary::Application.new(:index)
run TDiary::Dispatcher.index
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは cool ですねえ

hsbt added a commit that referenced this pull request Jun 5, 2013
plugin 機構で config.ru を操作
@hsbt hsbt merged commit ca8b874 into master Jun 5, 2013
@hsbt hsbt deleted the routing branch June 5, 2013 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants