Skip to content

Commit

Permalink
initial port from zombor/vendo
Browse files Browse the repository at this point in the history
  • Loading branch information
zombor committed Nov 3, 2010
1 parent ddb1b62 commit f85529c
Show file tree
Hide file tree
Showing 36 changed files with 1,715 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .gitmodules
@@ -0,0 +1,33 @@
[submodule "system"]
path = system
url = git://github.com/kohana/core.git
[submodule "modules/auth"]
path = modules/auth
url = git://github.com/kohana/auth.git
[submodule "modules/auto-modeler"]
path = modules/auto-modeler
url = git://github.com/zombor/Auto-Modeler.git
[submodule "modules/database"]
path = modules/database
url = git://github.com/kohana/database.git
[submodule "modules/image"]
path = modules/image
url = git://github.com/kohana/image.git
[submodule "modules/kostache"]
path = modules/kostache
url = git://github.com/zombor/KOstache.git
[submodule "modules/vendo-core"]
path = modules/vendo-core
url = git://github.com/vendo/core.git
[submodule "modules/vendo-billing"]
path = modules/vendo-billing
url = git://github.com/vendo/billing.git
[submodule "modules/vendo-application"]
path = modules/vendo-application
url = git://github.com/vendo/application.git
[submodule "modules/vendo-admin"]
path = modules/vendo-admin
url = git@github.com:vendo/admin.git
[submodule "modules/vendo-acl"]
path = modules/vendo-acl
url = git://github.com/vendo/acl.git
13 changes: 13 additions & 0 deletions LICENSE
@@ -0,0 +1,13 @@
Copyright (c) 2010, Jeremy Bush <contractfrombelow@gmail.com>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
96 changes: 96 additions & 0 deletions README.md
@@ -0,0 +1,96 @@
Vendo
===

What is it?
---

A lightweight e-commerce framework developed with the Kohana3 php framework.

It's main goal is to provide an excellent starting base for you to develop e-commerce applications with. It's not designed to be a drop-in e-commerce application, like Magento or OpenCart.

What is special about Vendo?
---

1. It will be easy to build applications with
2. The source code will make sense
3. It will be fast
4. It will be easy to write extensions for
5. Development/Support will be as open as possible. Your contributions are welcome and encouraged
6. It will be fully tested to ensure stability and prevent issue regression

How can I help?
---

1. Create an issue in this project for your feature/request
2. Follow the [pull request](http://help.github.com/pull-requests/) procedures

How to install Vendo
---

Vendo has many parts:

1. vendo-core: the core models and vendo base/exception classes
2. vendo-acl: ACL classes
3. vendo-billing: billing/order models and payment gateway classes
4. vendo-admin: the admin application to manage the database for vendo
5. vendo-application: a sample e-commerce application

If you just want to demo the whole vendo-application, do:

1. Check out this repository with the --recursive flag
2. cd to modules/kostache and run `git submodule init` and `git submodule update`
3. Install the database:
* Run the schema.sql file located in application/schema/
* OR (if you are doing development work, use the migrations)
* [Liquibase 1.95.](http://www.liquibase.org/download) is used for migrations
* Install the database connector. [Mysql](http://dev.mysql.com/downloads/connector/j/) is recommended.
* Run `liquibase --driver=com.mysql.jdbc.Driver --classpath=/path/to/mysql-connector-java-5.1.13-bin.jar --changeLogFile=application/schema/schema.xml --url="jdbc:mysql://<hostname>/<database_name>" --username=<username> --password=<password> migrate`
4. Make sure the application/photos/ directory is writable by the webserver

If you'd like to use Vendo to develop your e-commerce application, you can omit the vendo-application module, and use the other four (you still need the database). Sometime in the near future, the modules will be broken into their own repositories.

You can use the vendo-application as a starting point, or for inspiration on how to build an application with Vendo.

Using vendo-application as a base
---

You can use the vendo-application module as a base for your e-commerce application. If you are happy with the functionality of the stock controllers but not the views (you should probably never use them as-is), you can replace the view class and templates in your application to get a customized skin on top of it.

Testing
---

One goal of Vendo is to be completely tested. This helps prevent bugs and defines a stable API. We use phpunit for unit tests, and plan on using cucumber for behavior tests once the application ui is stable.

If you contribute code, please make sure that you use TDD or BDD, depending on your contribution.

To run the phpunit tests, simple run `phpunit` from the root of the repository. All tests should pass. Please file an issue if they do not pass on your system.

Integration
---

If you are using the Kohana Template Controller, put this in an extended template controller:

public function after()
{
$this->template->{{$your_body_variable}} = $this->request->response;

return parent::after();
}

Then make a templates/layout.mustache file in your application directory with this in it:

{{>body}}

If you take this method, you will need to output the category links, cart link, and the account admin links manually.

This method is untested, so please provide feedback. :)

Tech
---

Here's a list of tech used to build Vendo:

* [Kohana](http://github.com/kohana/kohana)
* [KOstache](http://github.com/zombor/KOstache)
* [Mustache.php](http://github.com/bobthecow/mustache.php)
* [Auto Modeler](http://github.com/zombor/Auto-Modeler)
120 changes: 120 additions & 0 deletions application/bootstrap.php
@@ -0,0 +1,120 @@
<?php defined('SYSPATH') or die('No direct script access.');

//-- Environment setup --------------------------------------------------------

// Load the base, low-level functions
require SYSPATH.'base'.EXT;

// Load the core Kohana class
require SYSPATH.'classes/kohana/core'.EXT;

if (is_file(APPPATH.'classes/kohana'.EXT))
{
// Application extends the core
require APPPATH.'classes/kohana'.EXT;
}
else
{
// Load empty core extension
require SYSPATH.'classes/kohana'.EXT;
}

/**
* Set the default time zone.
*
* @see http://kohanaframework.org/guide/using.configuration
* @see http://php.net/timezones
*/
date_default_timezone_set('America/Chicago');

/**
* Set the default locale.
*
* @see http://kohanaframework.org/guide/using.configuration
* @see http://php.net/setlocale
*/
setlocale(LC_ALL, 'en_US.utf-8');

/**
* Enable the Kohana auto-loader.
*
* @see http://kohanaframework.org/guide/using.autoloading
* @see http://php.net/spl_autoload_register
*/
spl_autoload_register(array('Kohana', 'auto_load'));

/**
* Enable the Kohana auto-loader for unserialization.
*
* @see http://php.net/spl_autoload_call
* @see http://php.net/manual/var.configuration.php#unserialize-callback-func
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');

//-- Configuration and initialization -----------------------------------------

/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array(
'base_url' => '/',
));

/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));

/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File);

/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(
array(
'vendo-admin' => MODPATH.'vendo-admin',
'vendo-application' => MODPATH.'vendo-application',
'vendo-core' => MODPATH.'vendo-core',
'vendo-billing' => MODPATH.'vendo-billing',
'vendo-acl' => MODPATH.'vendo-acl',
'auth' => MODPATH.'auth',
'database' => MODPATH.'database',
'auto-modeler' => MODPATH.'auto-modeler',
'image' => MODPATH.'image',
'kostache' => MODPATH.'kostache',

'unittest' => MODPATH.'unittest',
)
);

Session::$default = 'cookie';
Session::instance();

/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set(
'admin',
'<directory>/(<controller>(/<action>(/<id>)))',
array('directory' => 'admin')
);

Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'home',
'action' => 'index',
));
File renamed without changes.
Empty file added application/config/.gitignore
Empty file.
16 changes: 16 additions & 0 deletions application/config/auth.php
@@ -0,0 +1,16 @@
<?php defined('SYSPATH') or die('No direct access allowed.');

return array(

'driver' => 'AutoModeler_ORM',
'hash_method' => 'sha1',
'salt_pattern' => '1, 3, 5, 9, 14, 15, 20, 21, 28, 30',
'lifetime' => 1209600,
'session_key' => 'auth_user',

// Username/password combinations for the Auth File driver
'users' => array(
// 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02',
),

);
7 changes: 7 additions & 0 deletions application/config/session.php
@@ -0,0 +1,7 @@
<?php defined('SYSPATH') or die('No direct script access.');

return array(
'cookie' => array(
'encrypted' => FALSE,
),
);
Empty file added application/logs/.gitignore
Empty file.
Empty file added application/photos/.gitignore
Empty file.

0 comments on commit f85529c

Please sign in to comment.