Skip to content

Commit

Permalink
Fixed: for rails4 version
Browse files Browse the repository at this point in the history
  • Loading branch information
mallowlabs committed Feb 16, 2014
1 parent 1247cb7 commit 3d4b659
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 46 deletions.
13 changes: 8 additions & 5 deletions source/about.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
QuoteIt について
==================================================

`QuoteIt <http://www.codefirst.org/quoteit/>`_ は、さまざな Web サービスのサムネイル・埋め込みドキュメントを
QuoteIt_ は、さまざな Web サービスのサムネイル・埋め込みドキュメントを
取得するための Web API です。
プラグインはユーザ同士で共有され、誰でも自由に追加・変更を行なうことができます
プラグインを追加することで、対応サービスを用意に増やすことができます

QuoteIt の利用方法
--------------------------------------------------
QuoteIt を利用するためには、以下の2つの方法があります。

Heroku にデプロイされているサービスを使う
QuoteIt_ は Heroku にデプロイされています。wedata を通じて自由に作成されたプラグインを利用することができます。プラグインの作成方法は、 :doc:`plugin` で詳しく説明します
QuoteIt_ は `Heroku にデプロイ <https://quoteit.herokuapp.com/>`_ されています。標準プラグインを利用することができます
インハウスにデプロイする
Heroku のサービスからはアクセスできないインハウスのリソースを引用することができます。また、インハウス QuoteIt のプラグインとして Heroku QuoteIt を追加することで、リレーを実現することもできます。インハウスデプロイの方法は、 :doc:`setup` で詳しく説明します。
Heroku のサービスからはアクセスできないインハウスのリソースを引用することができます。
独自に追加したプラグインを利用することができます。プラグインの作成方法は、 :doc:`plugin` で詳しく説明します。
また、インハウス QuoteIt のプラグインとして Heroku QuoteIt を追加することで、リレーを実現することもできます。インハウスデプロイの方法は、 :doc:`setup` で詳しく説明します。


.. _QuoteIt: http://quoteit.heroku.com/
.. _QuoteIt: http://www.codefirst.org/quoteit/

6 changes: 3 additions & 3 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@

# General information about the project.
project = u'QuoteIt'
copyright = u'2011-2012, mzp'
copyright = u'2011-2014, codefirst.org'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1.0'
version = '0.2.0'
# The full version, including alpha/beta/rc tags.
release = '0.1.0'
release = '0.2.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
19 changes: 8 additions & 11 deletions source/plugin.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
プラグイン開発
==================================================

QuoteItで引用できるサービスは、プラグインにより自由に拡張できます。
プラグインはユーザ同士で共有され、誰でも自由に追加・変更を行なうことができます。
QuoteIt で引用できるサービスは、プラグインにより自由に拡張できます。

プラグインの種類
--------------------------------------------------
プラグインにはサムネイルプラグインとClipプラグインの2種類が存在します
プラグインには サムネイルプラグイン と Clip プラグイン の2種類が存在します

サムネイルプラグイン
Twitpicなどの画像共有サービスから、画像を引用するためのプラグインです。 結果は **画像** のURLでなければなりません。
Clipプラグイン
任意のWebサービスから引用するためのプラグインです。 結果には任意のHTMLタグを利用できます。 **埋め込み HTML** を引用する場合には、Clip プラグインが便利です。
Twitpic などの画像共有サービスから、画像を引用するためのプラグインです。 結果は **画像** のURLでなければなりません。
Clip プラグイン
任意の Web サービスから引用するためのプラグインです。 結果には任意の HTML タグを利用できます。 **埋め込み HTML** を引用する場合には、Clip プラグインが便利です。

プラグインの定義
----------------
Expand All @@ -31,7 +30,7 @@ Clipプラグイン
``$1`` , ``$2`` , ``$3`` , ... で ``regexp`` の n番目にマッチしたテキストを参照できます(nは1から9まで)。 また、 ``$$1`` , ``$$2`` , ``$$3`` , ... とすることで、URL エンコードされた値を参照することもできます。


Clipプラグインの場合
Clip プラグインの場合
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``url``
Expand Down Expand Up @@ -64,12 +63,10 @@ Clipプラグインの場合
プラグインのテスト
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

プラグインの動作は、 `Sandboxページ <http://quoteit.heroku.com/sandbox>`_ にて確認できます。
プラグインの動作は、 `Sandboxページ <https://quoteit.herokuapp.com/sandbox>`_ にて確認できます。

プラグインの登録・反映
--------------------------------------------------

完成したプラグインをWedataに登録することで、QuoteItに反映させることができます
完成したプラグインを `config/quote_it.json <https://github.com/codefirst/QuoteIt/blob/master/config/quote_it.json>`_ に登録することで、QuoteIt に反映させることができます

1. サムネイルプラグインは `QuoteIt-thumbnail DB <http://wedata.net/databases/QuoteIt-thumbnail/items>`_ に、Clipプラグインは `QuoteIt-clip DB <http://wedata.net/databases/QuoteIt-clip/items>`_ に登録します。 なお登録にはOpenIDが必要です。
2. `Upgradeページ <http://quoteit.heroku.com/upgrade>`_ から反映させます。
55 changes: 28 additions & 27 deletions source/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ QuoteIt で、インハウスのリソースを引用したい場合に参照し
--------------------------------------------------
QuoteIt を利用するためには、以下のソフトウェアが必要です。

* Ruby 1.9.2
* Bundler 1.0.7 or later
* MongoDB 1.8.1 or later
* memcached 1.4.9 or later
* Ruby 2.0.0 or later
* Bundler 1.3.5 or later
* PostgreSQL 9.3 or later

デプロイ方法
--------------------------------------------------
Expand All @@ -21,25 +20,26 @@ QuoteIt を利用するためには、以下のソフトウェアが必要です

$ git clone git://github.com/codefirst/QuoteIt.git

2. MongoDB を立ち上げます
2. 必要な gem をインストールします
::

$ mongod --dbpath <dir_name>
$ bundle install --path .bundle --without development test

3. memcached を立ち上げます
3. アセットをコンパイルします
::

$ memcached -vv
$ bundle exec rake assets:precompile RAILS_ENV=production

4. 必要な gem をインストールします
4. DB をセットアップします
::

$ bundle install --path vendor/bundle
$ bundle exec rake db:migrate RAILS_ENV=production
$ bundle exec rake db:seed

5. QuoteIt を立ち上げます。
::

$ bundle exec padrino start
$ bundle exec rails s -e production

6. QuoteIt にアクセスします。
::
Expand All @@ -48,41 +48,42 @@ QuoteIt を利用するためには、以下のソフトウェアが必要です

プラグインの追加
--------------------------------------------------
インハウスにデプロイした QuoteIt へのプラグインの追加は CUI から行います。
ここでは例として debeso_ を引用するプラグインを作成します。

QuoteIt にはローカルのプラグインを追加する機構がないため、
コンソールを利用して、プラグインを追加します。

::

$ bundle exec padrino console

以下のコードを実行します。
インハウスにデプロイした QuoteIt へのプラグインの追加は config/quote_it.json に追記をしたのち、
以下の rake タスクを実行します。

::

Html.create(:name => 'debeso', :regexp => 'http://localhost/debeso/codes/edit/(\d+)', :clip => 'http://localhost/debeso/api/v1/snippets/$1.json', :url => 'http://localhost/debeso/', :transform => 'json["content"]')
$ bundle exec rake db:seed

Heroku QuoteIt へのリレー
--------------------------------------------------
インハウス QuoteIt で処理されなかった URL を Heroku QuoteIt_ へ
移譲することもできます。

以下の設定を config/quote_it.json に追記します。

::

$ bundle exec padrino console
{
"regexp": "(.+)",
"clip": "https://quoteit.herokuapp.com/clip.html?u=$$1",
"transform": "content",
"service": {
"name": "QuoteIt",
"url": "https://quoteit.herokuapp.com/"
}
}

以下のコードを実行します
DB に登録します

::

Html.create(:name => 'QuoteIt', :regexp => '(.+)', :clip => 'http://quoteit.heroku.com/clip.html?u=$$1', :url => 'http://quoteit.heroku.com', :transform => 'content')
$ bundle exec rake db:seed

.. note::

QuoteIt は、プラグインが登録された順に処理をしていくため、
QuoteIt プラグインは必ず最後に登録して下さい。

.. _QuoteIt: http://quoteit.heroku.com/
.. _QuoteIt: https://quoteit.herokuapp.com/
.. _debeso: http://www.codefirst.org/debeso/

0 comments on commit 3d4b659

Please sign in to comment.