Home > derrata

derrata

Derrata is a project mainly written in RUBY and JAVASCRIPT, it's free.

================================================================================ エレコマ(Elephant Commerce) http://ec.kbmj.com/

エレコマのダウンロードありがとうございます。 エレコマは、Ruby on Railsで開発したECommerceシステムです。 オープンソースとして、MIT Licenseを採用しています。

このREADMEでは、エレコマを稼動させるまでの必要最低限の手順を記載しています。

================================================================================ エレコマ 動作環境

エレコマを動かすに辺り、以下の環境を奨励します。 (下記環境以外でも動作する可能性はあります)

  • OS : CentOS 5.4
  • DB : postgresql 8.3系
  • Ruby : 1.8.7
  • Rails : 2.3.2

================================================================================ エレコマ 依存plugin

エレコマではpluginを含めて配布をしていません。 以下のpluginが依存しています。各自インストールをお願いします。

active-form http://github.com/realityforge/rails-active-form.git rev: f1e74bec3d87c23cfc05ca7df11925c08e55514f

acts_as_list git://github.com/rails/acts_as_list.git rev: 8771a632dc26a7782800347993869c964133ea29

acts_as_paranoid git://github.com/technoweenie/acts_as_paranoid.git rev: b0a5d2b8ba89eae03f673e4af2e52619260fcc30

acts_as_tree git://github.com/rails/acts_as_tree.git rev: 20988cac158bcf7f7535a3c5dd193165797d719a

ar_fixtures http://topfunky.net/svn/plugins/ar_fixtures/ rev: 271

jpmobile git://github.com/darashi/jpmobile.git rev: 256897e357eb48f3be61bdb207ca4eccb2c0d007

jpmobile_emoticon_filter http://taslam-plugins.googlecode.com/svn/trunk/jpmobile_emoticon_filter/ rev: 49

mbmail git://github.com/tmtysk/mbmail.git rev: 654ce3ec2dfa10ac3b05cd9354eb84456d206a6d

resource_controller git://github.com/jamesgolick/resource_controller.git rev: 48359daa1e01c47f1d7b5f37441742123d395e11

will_paginate git://github.com/mislav/will_paginate.git rev: 839d821041a4cfaa4dfbcc5719ea17ff196189c7

yaml_waml git://github.com/kakutani/yaml_waml.git rev: 1b292b3e0df9a7e69ed90eebdca327a0888b0a12

================================================================================ エレコマ インストール手順

CentOS 5.4でのインストールを想定しています。 前提条件は以下となります。 -ダウンロードページからエレコマをダウンロード済み。

  1. rubyのインストール $ sudo yum install gcc $ sudo yum install zlib-devel $ sudo yum install openssl-devel $ sudo yum install ncurses-devel $ sudo yum install readline-devel $ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz $ tar zxf ruby-1.8.7-p174.tar.gz $ cd ruby-1.8.7-p174 $ ./configure $ make $ sudo make install

  2. gemのインストール $ wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz $ tar zxf rubygems-1.3.5.tgz $ cd rubygems-1.3.5 $ sudo ruby setup.rb

  3. ImageMagickのインストール $ sudo yum install libjpeg-devel libpng-devel gd-devel freetype-devel $ wget ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.5.8-4.tar.gz $ cd ImageMagick-6.5.8-4 $ ./configure $ make $ sudo make install

  4. Rmagickのインストール $ alias sudo="sudo PATH=$PATH" $ sudo gem install rmagick -v 2.12.2 $ unalias sudo

  5. 依存するgemのインストール $ sudo gem install rails -v 2.3.2 $ sudo gem install gettext -v 2.1.0 $ sudo gem install gruff -v 0.3.6 $ sudo gem install rspec-rails -v 1.2.9 $ wget http://www.artonx.org/data/lhalib/lhalib-0.8.1.gem $ sudo gem install lhalib-0.8.1.gem

  6. PostgreSQLのインストール $ sudo yum install postgresql-devel $ sudo yum install postgresql-server $ sudo gem install postgres

  7. ecユーザの作成

    adduser ec

    passwd ec

    (パスワード変更)

  8. アプリケーションの展開

    cd /usr/local

    tar zxf (DOWNLOAD_PATH)/elecoma-.tar.gz

    mv elecoma- ec

    chown -R ec:ec /usr/local/ec

  9. postgresqlのセットアップ

    vim /var/lib/pgsql/data/pg_hba.conf

    (password cryptを設定します)

    /etc/init.d/postgresql start

    su - postgres

    $ psql template1

    alter user postgres with password 'xxxx';

    q

    $ createuser ec Shall the new role be a superuser? (y/n) y $ psql template1

    alter user ec with password 'elephant';

    q

    $ createdb --owner=ec ec_dev CREATE DATABASE $ createdb --owner=ec ec_test CREATE DATABASE $ createdb --owner=ec ec CREATE DATABASE $ psql -l List of databases Name | Owner | Encoding -----------+----------+---------- ec | ec | UTF8 ec_dev | ec | UTF8 ec_test | ec | UTF8 postgres | postgres | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8 (6 rows)

  10. 開発向けセットアップ

    su - ec

    $ cd /usr/local/ec/ $ cd config $ cp database.example.yml database.yml $ vim database.yml $ diff database.example.yml database.yml 3,4c3,4 < username: postgres < password:

    username: ec password: elephant $ cd environments $ vim development.rb (メールサーバの設定を変更) $ vim production.rb (メールサーバの設定を変更) $ vim test.rb (メールサーバの設定を変更)

  11. gitのインストール $ wget http://kernel.org/pub/software/scm/git/git-1.6.5.5.tar.gz $ tar zxf git-1.6.5.5.tar.gz $ cd git-1.6.5.5 $ ./configure $ make $ sudo make install

  12. プラグインのインストール $ ruby script/plugin install git://github.com/realityforge/rails-active-form.git $ ruby script/plugin install git://github.com/rails/acts_as_list.git $ ruby script/plugin install git://github.com/technoweenie/acts_as_paranoid.git $ ruby script/plugin install git://github.com/rails/acts_as_tree.git $ ruby script/plugin install http://topfunky.net/svn/plugins/ar_fixtures/ $ ruby script/plugin install git://github.com/darashi/jpmobile.git $ ruby script/plugin install http://taslam-plugins.googlecode.com/svn/trunk/jpmobile_emoticon_filter/ $ cd vendor/plugins $ git clone git://github.com/tmtysk/mbmail.git mbmail $ cd mbmail $ git checkout 654ce3ec2dfa10ac3b05cd9354eb84456d206a6d $ rm -fr lib/jpmobile $ rm -fr .git $ cd ../../.. $ ruby script/plugin install git://github.com/jamesgolick/resource_controller.git $ ruby script/plugin install git://github.com/mislav/will_paginate.git $ ruby script/plugin install git://github.com/kakutani/yaml_waml.git

  13. passengerのインストール $ sudo yum install gcc-c++ $ sudo yum install httpd-devel $ sudo gem install passenger $ sudo passenger-install-apache2-module

  14. apacheの設定 $ sudo vim /etc/httpd/conf.d/ec.conf LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.7/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.7 PassengerRuby /usr/local/bin/ruby

<VirtualHost *:80> ServerName ec.example.com DocumentRoot /usr/local/ec/public RailsEnv production <Directory /usr/local/ec/public> AllowOverride all Options -MultiViews

  1. production DBの作成

    su - ec

    $ rake db:migrate RAILS_ENV=production

  2. apache の再起動 $ sudo /etc/init.d/apache restart

  3. script/mailを起動 $ ./script/mail_restart.sh -e production (メールマガジン送信用のプロセスを立ち上げます)

※webrickでの起動も可能です。 $ ruby ./script/server -p production

================================================================================

  • エレコマの管理者ユーザー追加

    エレコマを起動した直後は管理者ユーザーが存在しません。 ユーザー登録は、RAILS_ROOT/test/fixtures/admin_users.yml の5,6,8行目を任意のものに修正した後、 コンソールから以下のようにデータを登録します。

$ rake db:fixtures:load FIXTURES=admin_users RAILS_ENV=production

ユーザーを登録した後、管理画面:http://サイトドメイン/adminにアクセスすると、 ログイン画面が表示されますので、RAILS_ROOT/test/fixtures/admin_users.ymlで指定した 登録したログインIDとパスワードでログインしてください。

================================================================================

  • エレコマの住所マスタ更新

    エレコマの住所マスタは郵便事業株式会社の郵便番号マスタを利用しています。 登録はコンソールから以下のように行ないます。

$ ruby script/runner -e production Zip.import

郵便番号マスタは以下のサイトにて配布されているものを自動的に取り込みます。 http://www.post.japanpost.jp/zipcode/download.html

住所マスタ更新機能はLhaLibに依存しています。 LhaLibの詳細については以下のサイトをご確認ください。 http://www.artonx.org/collabo/backyard/?LhaLibEn

================================================================================

  • エレコマの商品追加

    エレコマを起動した直後は商品が存在していません。 管理画面から、商品の追加を行う必要があります。

  1. 管理者ユーザーでログインする

  2. 商品の登録

    商品登録には、カテゴリ、規格が必要となります。

    カテゴリの登録 -管理画面の商品管理 -> カテゴリ管理 よりカテゴリを登録する

規格の管理 -管理画面の商品管理 -> 規格管理 より規格を登録する

商品の登録

1つずつ登録する場合

  • 管理画面の商品管理 -> 商品登録 より商品の登録を行う

CSVで一括登録する場合

  • 管理画面の商品管理 -> 商品マスタ -> CSVアップロード から アップロードする

商品登録後、商品の規格を設定します。

商品規格の登録

  1. 商品登録完了画面もしくは商品マスタの商品一覧 -> 規格登録 から規格を選択し「表示する」ボタンを押下する
  2. 規格リストが表示されるので、必要な規格の登録項目にチェックを入れ、商品コード、在庫数、価格を入力し、登録を行う

以上で、商品がフロント画面に表示されるようになります

================================================================================

  • ユニットテスト

    エレコマではユニットテストにRspecを利用しています。 利用するには、以下を実行してRspecのインストールを行なってください。

  1. gemsのインストール

    $ sudo gem install rspec $ sudo gem install rspec-rails

  2. rspecの実行

    $ rake spec このコマンドを発行するとユニットテストが実行されます。 ※ $ ruby ./script/spec ./spec でも実行可能です。

================================================================================

  • エレコマ ライセンス

    本ソフトウェアはMIT Licenceを採用しています。 ライセンスの詳細についてはCOPYRIGHTファイルを参照してください。

配布物に含まれる「エレコマ」のロゴはクリエイティブ・コモンズノ表示-継承 2.1 日本ライセンスに従った範囲内でご利用いただけます。

================================================================================

  • 配布物に含まれる別プロジェクトのファイル

    1. TypePad 絵文字アイコン画像 配布物に含まれる以下のファイルはTypePad 絵文字アイコン画像を利用しています。 public/images/emoticons/* TypePad 絵文字アイコンは以下のライセンスに基づきます。

TypePad 絵文字アイコン画像 by Six Apart Ltd is licensed under a Creative Commons 表示 2.1 日本 License. Permissions beyond the scope of this license may be available at http://start.typepad.jp/typecast/.

  1. さざなみフォント 配布物に含まれる以下のファイルはさざなみフォントを利用しています。 lib/sazanami-gothic.ttf さざなみフォントは以下のライセンスに基づきます。

Copyright (c) 1990-2003 Wada Laboratory, the University of Tokyo. All rights reserved. Copyright (c) 2003-2004 Electronic Font Open Laboratory (/efont/). All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the Wada Laboratory, the University of Tokyo nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY WADA LABORATORY, THE UNIVERSITY OF TOKYO AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LABORATORY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Previous:opensim-map