Skip to content

Commit

Permalink
Travis fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spekary committed Apr 25, 2017
1 parent ff53cda commit 6faa87d
Show file tree
Hide file tree
Showing 69 changed files with 4,037 additions and 1,467 deletions.
48 changes: 48 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
language: php

php:
- '5.5'
- '5.6'
- '7.0'
- hhvm
- nightly

install:
- composer install

env:
- DB=mysql
- DB=pgsql POSTGRESQL_VERSION=9.1
- DB=pgsql POSTGRESQL_VERSION=9.2
- DB=pgsql POSTGRESQL_VERSION=9.3
- DB=pgsql POSTGRESQL_VERSION=9.4

before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database qcubed;'; mysql -u root qcubed < test/db/mysql_innodb.sql; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then createdb qcubed -U postgres; psql -d qcubed -f test/db/pgsql.sql -U postgres; fi"

script:
- ./vendor/bin/phpunit -c ./test/phpunit.xml --coverage-clover ./build/logs/clover.xml

# code coverage
addons:
code_climate:
repo_token: 814dfe2ee0ae6198e43e566e32ab85f40379b5abe06cd52b1f6a24e92b5de883

# code coverage
after_script:
- vendor/bin/test-reporter

sudo: false

matrix:
exclude:
- php: hhvm
env: DB=pgsql POSTGRESQL_VERSION=9.1 # driver currently unsupported by HHVM
- php: hhvm
env: DB=pgsql POSTGRESQL_VERSION=9.2 # driver currently unsupported by HHVM
- php: hhvm
env: DB=pgsql POSTGRESQL_VERSION=9.3 # driver currently unsupported by HHVM
- php: hhvm
env: DB=pgsql POSTGRESQL_VERSION=9.4 # driver currently unsupported by HHVM

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Shannon
Copyright (c) 2017 Shannon Pekary [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# qcubed-orm
# QCubed Orm
QCubed Standalone ORM
17 changes: 12 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/qcubed/common"
}
],

"name": "qcubed/orm",
"description": "Database drivers, query support, and code generator for the object relational model for QCubed",
"keywords": ["php", "database", "orm"],
Expand All @@ -12,14 +19,14 @@
},
"require": {
"php": ">=5.5.0",
"qcubed/common": "^4.0"
"qcubed/common": "dev-master"
},
"require-dev" : {
"phpunit/phpunit": "~4.8|~5.0"
},
"autoload": {
"psr-4": {
"QCubed\\Database": "src/Database",
"QCubed\\Query": "src/Query",
"QCubed\\Codegen": "src/Codegen"

"QCubed\\": "src/"
}
}
}
8 changes: 4 additions & 4 deletions install/project/includes/Codegen.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* QCodeGen
* CodeGen
*
* Overrides the Codegen\AbstractBase class.
*
Expand Down Expand Up @@ -29,14 +29,14 @@ public function __construct($objSettingsXml) {
// find a particular template file. Template files found lower down in the order will override the previous ones.
static::$TemplatePaths = array (
__QCUBED_CORE__ . '/codegen/templates/',
__QCUBED__ . '/codegen/templates/'
__INCLUDES__ . '/codegen/templates/'
);
}

/**
* QCodeGen::Pluralize()
* Pluralize()
*
* Example: Overriding the Pluralize method
* An example of overriding the Pluralize method to implement custom plural word forms.
*
* @param string $strName
* @return string
Expand Down
2 changes: 0 additions & 2 deletions install/project/includes/app_includes/model_includes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
<?php
require(__MODEL_GEN__ . '/QQN.class.php');
require(__MODEL_GEN__ . '/_class_pathis.inc.php');
require(__MODEL_GEN__ . '/_type_class_pathis.inc.php');
62 changes: 62 additions & 0 deletions install/project/includes/codegen/Codegen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* CodeGen
*
* Overrides the Codegen\AbstractBase class.
*
* Feel free to override any of those methods here to customize your code generation.
*
*/

/**
* Class Codegen
*
* Overrides the default codegen class. Override and implement any functions here to customize the code generation process.
* @package Project
* @was CodeGen
*/
class Codegen extends \QCubed\Codegen\AbstractBase {

/**
* Construct the CodeGen object.
*
* Gives you an opportunity to read your xml file and make codegen changes accordingly.
*/
public function __construct($objSettingsXml) {
// Specify the paths to your template files here. These paths will be searched in the order declared, to
// find a particular template file. Template files found lower down in the order will override the previous ones.
static::$TemplatePaths = array (
__QCUBED_CORE__ . '/../../orm/templates/',
__DIR__ . '/templates/'
);
}

/**
* CodeGen::Pluralize()
*
* Example: Overriding the Pluralize method
*
* @param string $strName
* @return string
*/
protected function Pluralize($strName) {
// Special Rules go Here
switch (true) {
case ($strName == 'person'):
return 'people';
case ($strName == 'Person'):
return 'People';
case ($strName == 'PERSON'):
return 'PEOPLE';

// Trying to be cute here...
case (strtolower($strName) == 'fish'):
return $strName . 'ies';

// Otherwise, call parent
default:
return parent::Pluralize($strName);
}
}
}

9 changes: 9 additions & 0 deletions install/project/includes/codegen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# About `codegen` directory

The codegen-related class in this directory allow you to override
the functionality of the codegen operation.

Feel free to make any changes to these customizations as you wish.

NOTE: the templates subdirectory is available for you to place customizations to the templates
and subtemplates themselves. Read the README.md file in templates/ to find out more.
31 changes: 31 additions & 0 deletions install/project/includes/codegen/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# About `templates` directory

This directory is for customizations and additions of the QCubed Codegen
Templates and Subtemplates. If there are any template files in this directory which have the
same name as a template or subtemplate file in `/includes/qcubed/_core/codegen/templates`, then the
file in this directory will be used *instead* of the one there.

If there are any template files in this directory in *addition* to the ones in
`/includes/qcubed/_core/codegen/templates`, these additional template files will be
processed as well.

Feel free to add as you wish. Just remember the naming structure for CodeGen
template files:

`/includes/qcubed/_core/codegen/templates/[TYPE]/[MODULE]/[FILE]`

Where `[TYPE]` is the object being generated, for example:
* db_orm
* db_type

And `[MODULE]` is the category of file being generated, for example:
* **class_gen** - templates and subtemplates for the Data Class Gen file
* **class_subclass** - templates and subtemplates for the Data Class customizable subclass
* **drafts** - templates and subtemplates for all things with regards to draft forms/panels
* **model_connector** - templates and subtemplates for the ModelConnector
* **datagrid_connector** - templates and subtemplates for the datagrid connector

And `[FILE]` is the filename of the template or subtemplate, itself.
Note that any file with a "_" prefix is considered a template and will
be processed by the code generator. All other files are considered
subtemplates, and are only processed if envoked by a template.
65 changes: 1 addition & 64 deletions install/project/includes/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,12 @@ configuration of your application, including any global defines that are particu
See the inline documentation in configuration.sample.inc.php for more information.



### prepend.inc.php

This is the top-level include file for any and all PHP scripts which use
Qcubed. Global, application-wide loaders, settings, etc. are in this file.

Feel free to make modifications/changes/additions to this file as you wish.
Note that the QApplication class is defined in prepend.inc as well. Feel free
to make changes, override methods, or add functionality to QApplication as
needed.

See the inline documentation in prepend.inc.php for more information.


### codegen_settings.xml

This file controls overall settings for parts of the code generation. Feel free
to change these as needed.


### codegen_options.json

This file is created and maintained by the ModelConnectorEditor. It has options for
the individual controls that correspond to fields in your database. There may be times
that you need to directly edit this file, and you should feel free to do so.

## Codegen Notes

QCubed is set up to generate a default set of objects and forms to get you started with your application.
Expand All @@ -53,52 +33,9 @@ separate out your hand written code from the generated code, and continue to twe
The codegen process starts at the QCubed start screen by clicking on the codegen link.
PHP is executed to generate the files. Therefore, the target directories for codegen will need to be writable by the web server process.

The codegen process works by instantiating a QCodeGen object. This object then looks in the template directories and begins
The codegen process works by instantiating a CodeGen object. This object then looks in the template directories and begins
to include the php files there that start with an underscore (_). These templates then include other files, which in turn
may include other template files. This combination will eventually generate the forms, model connectors, and data table
interface classes that you will base your application on.


## Model Connectors
Model Connectors are helper classes that have methods which connect form controls to columns in SQLn data tables. Each column
in the data table corresponds to a control that is generated in a model connector class. Your form object calls methods
in the model connector to get copies of the controls and then to place them in the form.

To customize the generated controls, you have the following choices:
- Use the ModelConnectorEditor (see the example on this), to set specific options on each control.
- Create your own code generating templates and place them in your project/includes/codegen/templates directory. Its best
to do this by copying the corresponding file in the qcubed/qcubed/includes/codegen/templates directory and then
editing the file and placing it in the corresponding location in the above project directory. The project directory
files will override the files in the vendor directory.
- Override the generated code by editing the model connectors in your project/includes/connector directory.


### Version 3

QCubed Version 3 introduces the concept of having the controls themselves create the code to interact with the database
for the ModelConnector, rather than the templates. Coupled with this is the ModelConnectorEditDlg dialog, which lets you
right click on a control and edit many of the controls options. These changes get embedded into the generated ModelConnector.
You can see a description of each option by hovering over the item in the dialog.

These new features give the developer the ability to do the following:
- Override the default control type to specify a particular control type
- Allow custom controls and plugins to generate their own model connector code and have that code automatically be used
instead of the default code just by specifying that control in the comments of a column.
- Allow subclasses of standard controls to override the code generation methods to generate different code.
- Specify additional overrides to control many aspects of control creation in the generated model connector.

## Notes for Upgrading from version 2

Many of the problems that caused programmers to create their own templates are now solvable through the new Options
feature available through Comments. However, you are still free to override the templates as needed. In fact, this new
feature is implemented entirely through the templates, so if you want to keep your old templates, simply replace the new
templates with the old ones from version 2.

QLabel no longer accepts a strFormat parameter at create time. You can always set it using the ->Format parameter after
creating the control, or specify this in an override in a Comment option.






27 changes: 0 additions & 27 deletions install/project/includes/configuration/_LICENSE.txt

This file was deleted.

Loading

0 comments on commit 6faa87d

Please sign in to comment.