Skip to content

Commit

Permalink
first version of composer and travis
Browse files Browse the repository at this point in the history
  • Loading branch information
liuggio committed May 28, 2012
1 parent 2c45097 commit 2424f8a
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 115 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
vendor/
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: php
php:
- 5.3
- 5.4
env:
- SYMFONY_VERSION=v2.0.10
- SYMFONY_VERSION=origin/2.0
- SYMFONY_VERSION=origin/master
before_script: php vendor/vendors.php
116 changes: 2 additions & 114 deletions Controller/TicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,13 @@ class TicketController extends Controller
* Lists all Ticket entities.
*
*/
<<<<<<< HEAD
public function indexAction($status)
{

$statusId =
=======
public function indexAction($status = self::USER_TAB_STATE_OPEN)
{
//$status could be : Open, Closed, All
>>>>>>> 23d6dda872222a39cfda4d05f6582dab87b03527
$em = $this->getDoctrine()->getEntityManager();
$entities=null;
if ($status == self::USER_TAB_STATE_ALL) {

} else {
$baseQuery = 'SELECT t FROM LiuggioHelpDeskTicketSystemBundle:Ticket t JOIN t.state st where st.code %s :state_closed';
$query = $query = sprintf($baseQuery, '=');
Expand All @@ -53,15 +46,10 @@ public function indexAction($status = self::USER_TAB_STATE_OPEN)
$query = $em->createQuery($query);
$query->setParameter('state_closed', TicketState::STATE_CLOSED);

<<<<<<< HEAD
$entities = $em->getRepository('LiuggioHelpDeskTicketSystemBundle:Ticket')->findBy(array( Ticket=> $status));

=======
//var_dump($query->getSql());
$entities = $query->getResult();
}
// @TODO Pagination
>>>>>>> 23d6dda872222a39cfda4d05f6582dab87b03527
return $this->render('LiuggioHelpDeskTicketSystemBundle:Ticket:index.html.twig', array(
'entities' => $entities
));
Expand All @@ -79,22 +67,17 @@ public function showAction($id)
if (!$entity) {
throw $this->createNotFoundException('Unable to find Ticket entity.');
}

$comment = new Comment();
$comment->setCreatedBy(null);
$comment_form = $this->createForm(new CommentType($entity->getId()), $comment);
if ($entity->getState()->getCode() == TicketState::STATE_CLOSED) {
return $this->render('LiuggioHelpDeskTicketSystemBundle:Ticket:show_closed.html.twig', array(
<<<<<<< HEAD
'entity' => $entity,
));
} else{
=======
'entity' => $entity,
));
}
else {

>>>>>>> 23d6dda872222a39cfda4d05f6582dab87b03527
return $this->render('LiuggioHelpDeskTicketSystemBundle:Ticket:show_open.html.twig', array(
'entity' => $entity,
'comment_form' => $comment_form->createView()
Expand Down Expand Up @@ -160,90 +143,6 @@ public function createAction()
* Displays a form to edit an existing Ticket entity.
*
*/
<<<<<<< HEAD
// public function editAction($id)
// {
// $em = $this->getDoctrine()->getEntityManager();
//
// $entity = $em->getRepository('LiuggioHelpDeskTicketSystemBundle:Ticket')->find($id);
//
// if (!$entity) {
// throw $this->createNotFoundException('Unable to find Ticket entity.');
// }
//
// $editForm = $this->createForm(new TicketType(), $entity);
// $deleteForm = $this->createDeleteForm($id);
//
// return $this->render('LiuggioHelpDeskTicketSystemBundle:Ticket:edit.html.twig', array(
// 'entity' => $entity,
// 'edit_form' => $editForm->createView(),
// 'delete_form' => $deleteForm->createView(),
// ));
// }

// /**
// * Edits an existing Ticket entity.
// *
// */
// public function updateAction($id)
// {
// $em = $this->getDoctrine()->getEntityManager();
//
// $entity = $em->getRepository('LiuggioHelpDeskTicketSystemBundle:Ticket')->find($id);
//
// if (!$entity) {
// throw $this->createNotFoundException('Unable to find Ticket entity.');
// }
//
// $editForm = $this->createForm(new TicketType(), $entity);
// $deleteForm = $this->createDeleteForm($id);
//
// $request = $this->getRequest();
//
// $editForm->bindRequest($request);
//
// if ($editForm->isValid()) {
// $em->persist($entity);
// $em->flush();
//
// return $this->redirect($this->generateUrl('ticket_edit', array('id' => $id)));
// }
//
// return $this->render('LiuggioHelpDeskTicketSystemBundle:Ticket:edit.html.twig', array(
// 'entity' => $entity,
// 'edit_form' => $editForm->createView(),
// 'delete_form' => $deleteForm->createView(),
// ));
// }

// /**
// * Deletes a Ticket entity.
// *
// */
// public function deleteAction($id)
// {
// $form = $this->createDeleteForm($id);
// $request = $this->getRequest();
//
// $form->bindRequest($request);
//
// if ($form->isValid()) {
// $em = $this->getDoctrine()->getEntityManager();
// $entity = $em->getRepository('LiuggioHelpDeskTicketSystemBundle:Ticket')->find($id);
//
// if (!$entity) {
// throw $this->createNotFoundException('Unable to find Ticket entity.');
// }
//
// $em->remove($entity);
// $em->flush();
// }
//
// return $this->redirect($this->generateUrl('ticket'));
// }

/**
=======
public function editAction($id)
{
$em = $this->getDoctrine()->getEntityManager();
Expand Down Expand Up @@ -326,7 +225,6 @@ public function deleteAction($id)
}

/**
>>>>>>> 23d6dda872222a39cfda4d05f6582dab87b03527
* Close the Ticket
*
*/
Expand Down Expand Up @@ -416,20 +314,10 @@ public function rateAction()

}

<<<<<<< HEAD
// private function createDeleteForm($id)
// {
// return $this->createFormBuilder(array('id' => $id))
// ->add('id', 'hidden')
// ->getForm()
// ;
// }
=======
private function createDeleteForm($id)
{
return $this->createFormBuilder(array('id' => $id))
->add('id', 'hidden')
->getForm();
}
>>>>>>> 23d6dda872222a39cfda4d05f6582dab87b03527
}
22 changes: 22 additions & 0 deletions Tests/autoload.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

$vendorDir = __DIR__.'/../vendor';
require_once $vendorDir.'/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';

use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony' => $vendorDir.'/symfony/src',
));
$loader->register();

spl_autoload_register(function($class) {
$class = ltrim($class, '\\');
if (0 === strpos($class, 'Liuggio\HelpDeskTicketSystemBundle\\')) {
$file = __DIR__.'/../'.str_replace('\\', '/', substr($class, strlen('Liuggio\HelpDeskTicketSystemBundle\\'))).'.php';
if (file_exists($file)) {
require $file;
}
}
});
7 changes: 7 additions & 0 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

if (file_exists($file = __DIR__.'/autoload.php')) {
require_once $file;
} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
require_once $file;
}
29 changes: 29 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "Liuggio/help-desk-ticket-system-bundle",
"description": "This bundle provides an help desk and ticketing system for support your customer.",
"keywords": ["menu"],
"type": "symfony-bundle",
"license": "MIT",
"authors": [
{
"name": "Giulio De Donato",
"homepage": "http://www.welcometothebundle.com",
"email": "liuggio@gmail.com"
},
{
"name": "Erin Hima",
"email": "erinhima@gmail.com"
},
{
"name": "Tvision developers",
"homepage": "https://github.com/tvision"
}
],
"require": {
"symfony/framework-bundle": ">=2.0,<2.2-dev"
},
"autoload": {
"psr-0": { "Liuggio\\HelpDeskTicketSystemBundle": "" }
},
"target-dir": "Liuggio/HelpDeskTicketSystemBundle"
}
20 changes: 20 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="false" bootstrap="Tests/bootstrap.php">
<testsuites>
<testsuite name="Help Desk Ticket System Bundle">
<directory suffix="Test.php">./Tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
22 changes: 22 additions & 0 deletions vendor/vendors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php

set_time_limit(0);

$vendorDir = __DIR__;
$deps = array(
array('symfony', 'https://github.com/symfony/symfony', isset($_SERVER['SYMFONY_VERSION']) ? $_SERVER['SYMFONY_VERSION'] : 'origin/master'),
);

foreach ($deps as $dep) {
list($name, $url, $rev) = $dep;

echo "> Installing/Updating $name\n";

$installDir = $vendorDir.'/'.$name;
if (!is_dir($installDir)) {
system(sprintf('git clone -q %s %s', escapeshellarg($url), escapeshellarg($installDir)));
}

system(sprintf('cd %s && git fetch -q origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
}

0 comments on commit 2424f8a

Please sign in to comment.