Natkeeran
8 years ago
43 changed files with 411 additions and 240 deletions
@ -0,0 +1,14 @@
|
||||
#!/bin/bash |
||||
|
||||
RETURN=0 |
||||
FILES=`find -L $1 -name "*.info" -o -name "*.txt" -o -name "*.md"` |
||||
echo "Testing for files with DOS line endings..." |
||||
for FILE in $FILES |
||||
do |
||||
file $FILE | grep CRLF |
||||
if [ $? == 0 ] |
||||
then |
||||
RETURN=1 |
||||
fi |
||||
done |
||||
exit $RETURN |
@ -0,0 +1,81 @@
|
||||
#!/bin/bash |
||||
mysql -u root -e 'create database drupal;' |
||||
mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';" |
||||
|
||||
# Java (Oracle) |
||||
sudo apt-get install -y software-properties-common |
||||
sudo apt-get install -y python-software-properties |
||||
sudo add-apt-repository -y ppa:webupd8team/java |
||||
sudo apt-get update |
||||
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections |
||||
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections |
||||
sudo apt-get install -y oracle-java8-installer |
||||
sudo update-java-alternatives -s java-8-oracle |
||||
sudo apt-get install -y oracle-java8-set-default |
||||
export JAVA_HOME=/usr/lib/jvm/java-8-oracle |
||||
|
||||
# phpcpd |
||||
#sudo apt-get install -y phpcpd |
||||
|
||||
cd $HOME |
||||
pear channel-discover pear.drush.org |
||||
pear upgrade --force Console_GetoptPlus |
||||
pear upgrade --force pear |
||||
pear channel-discover pear.drush.org |
||||
|
||||
# Drush |
||||
cd /tmp |
||||
php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > drush |
||||
php drush core-status |
||||
chmod +x drush |
||||
sudo mv drush /opt |
||||
sudo ln -s /opt/drush /usr/bin/drush |
||||
|
||||
phpenv rehash |
||||
|
||||
cd $HOME |
||||
drush dl drupal-8.2.2 --drupal-project-rename=drupal |
||||
cd $HOME/drupal |
||||
drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes |
||||
drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/tmp/drush_webserver.log & |
||||
|
||||
ln -s $ISLANDORA_DIR modules/islandora |
||||
drush en -y rdf |
||||
drush en -y responsive_image |
||||
drush en -y syslog |
||||
drush en -y serialization |
||||
drush en -y basic_auth |
||||
drush en -y rest |
||||
|
||||
drush dl rdfui --dev |
||||
drush en -y rdfui |
||||
drush en -y rdf_builder |
||||
|
||||
drush dl restui |
||||
drush en -y restui |
||||
|
||||
drush dl inline_entity_form |
||||
drush en -y inline_entity_form |
||||
|
||||
drush dl media_entity |
||||
drush en -y media_entity |
||||
|
||||
drush dl media_entity_image |
||||
drush en -y media_entity_image |
||||
|
||||
drush dl search_api |
||||
drush -y pm-uninstall search |
||||
drush en -y search_api |
||||
|
||||
cd $HOME/drupal/modules |
||||
git clone https://github.com/DiegoPino/claw-jsonld.git |
||||
drush en -y jsonld |
||||
|
||||
drush -y dl bootstrap |
||||
drush -y en bootstrap |
||||
drush -y config-set system.theme default bootstrap |
||||
|
||||
drush cr |
||||
# The shebang in this file is a bogeyman that is haunting the web test cases. |
||||
rm /home/travis/.phpenv/rbenv.d/exec/hhvm-switcher.bash |
||||
sleep 20 |
@ -0,0 +1,39 @@
|
||||
sudo: true |
||||
language: php |
||||
php: |
||||
- 5.5 |
||||
- 5.6 |
||||
- 7.0 |
||||
- hhvm |
||||
|
||||
matrix: |
||||
allow_failures: |
||||
- php: hhvm |
||||
fast_finish: true |
||||
|
||||
branches: |
||||
only: |
||||
- /^8.x/ |
||||
|
||||
|
||||
before_install: |
||||
- export ISLANDORA_DIR=$TRAVIS_BUILD_DIR |
||||
|
||||
install: |
||||
# - $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh |
||||
- composer install |
||||
- php vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer |
||||
|
||||
|
||||
script: |
||||
- $ISLANDORA_DIR/.scripts/line_endings.sh . |
||||
- php vendor/bin/phpcs --standard=Drupal **/*.module **/*.php --ignore=tests,vendor . |
||||
- php vendor/bin/phpcpd --names *.module,*.inc,*.test,*.php --exclude=vendor . |
||||
|
||||
notifications: |
||||
irc: |
||||
channels: |
||||
- "irc.freenode.org#islandora" |
||||
on_success: change |
||||
on_failure: always |
||||
skip_join: true |
@ -0,0 +1,34 @@
|
||||
{ |
||||
"name": "drupal/islandora", |
||||
"description": "A client for interacting with a Fedora 4 server using CLAW microservices.", |
||||
"type": "drupal-module", |
||||
"homepage": "https://github.com/islandora-claw/islandora", |
||||
"support": { |
||||
"issues": "https://github.com/islandora-claw/CLAW/issues", |
||||
"irc": "irc://irc.freenode.net/islandora" |
||||
}, |
||||
"require-dev": { |
||||
"phpunit/phpunit": "^4.8", |
||||
"drupal/coder": "*", |
||||
"sebastian/phpcpd": "*" |
||||
}, |
||||
"license": "GPL-2.0+", |
||||
"authors": [ |
||||
{ |
||||
"name": "Islandora Foundation", |
||||
"email": "community@islandora.ca", |
||||
"role": "Owner" |
||||
|
||||
}, |
||||
{ |
||||
"name": "Daniel Lamb", |
||||
"email": "dlamb@islandora.ca", |
||||
"role": "Maintainer" |
||||
}, |
||||
{ |
||||
"name": "Diego Pino", |
||||
"email": "dpino@krayon.cl", |
||||
"role": "Maintainer" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,119 @@
|
||||
<?php |
||||
|
||||
namespace Drupal\islandora\Controller; |
||||
|
||||
use Drupal\Core\Controller\ControllerBase; |
||||
use Drupal\Core\Entity\EntityInterface; |
||||
use Drupal\Core\Entity\EntityStorageInterface; |
||||
use Drupal\Core\Url; |
||||
use Symfony\Component\DependencyInjection\ContainerInterface; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
|
||||
/** |
||||
* Class FedoraResourceAddController. |
||||
* |
||||
* @package Drupal\islandora\Controller |
||||
*/ |
||||
class FedoraResourceAddController extends ControllerBase { |
||||
|
||||
/** |
||||
* The Entity storage. |
||||
* |
||||
* @var \Drupal\Core\Entity\EntityStorageInterface |
||||
*/ |
||||
protected $storage; |
||||
|
||||
/** |
||||
* The Entity storage type. |
||||
* |
||||
* @var \Drupal\Core\Entity\EntityStorageInterface |
||||
*/ |
||||
protected $typeStorage; |
||||
|
||||
/** |
||||
* FedoraResourceAddController constructor. |
||||
* |
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $storage |
||||
* The Entity storage. |
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $type_storage |
||||
* The Entity storage type. |
||||
*/ |
||||
public function __construct(EntityStorageInterface $storage, EntityStorageInterface $type_storage) { |
||||
$this->storage = $storage; |
||||
$this->typeStorage = $type_storage; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public static function create(ContainerInterface $container) { |
||||
/** @var EntityTypeManagerInterface $entity_type_manager */ |
||||
$entity_type_manager = $container->get('entity_type.manager'); |
||||
return new static( |
||||
$entity_type_manager->getStorage('fedora_resource'), |
||||
$entity_type_manager->getStorage('fedora_resource_type') |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* Displays add links for available bundles/types for entity fedora_resource. |
||||
* |
||||
* @param \Symfony\Component\HttpFoundation\Request $request |
||||
* The current request object. |
||||
* |
||||
* @return array |
||||
* A render array for a list of the fedora_resource bundles/types that can |
||||
* be added or if there is only one type/bunlde defined for the site, the |
||||
* function returns the add page for that bundle/type. |
||||
*/ |
||||
public function add(Request $request) { |
||||
$types = $this->typeStorage->loadMultiple(); |
||||
if ($types && count($types) == 1) { |
||||
$type = reset($types); |
||||
return $this->addForm($type, $request); |
||||
} |
||||
if (count($types) === 0) { |
||||
return array( |
||||
'#markup' => $this->t('You have not created any %bundle types yet. @link to add a new type.', [ |
||||
'%bundle' => 'Fedora resource', |
||||
'@link' => $this->l($this->t('Go to the type creation page'), Url::fromRoute('entity.fedora_resource_type.add_form')), |
||||
]), |
||||
); |
||||
} |
||||
return array('#theme' => 'fedora_resource_content_add_list', '#content' => $types); |
||||
} |
||||
|
||||
/** |
||||
* Presents the creation form for fedora_resource entities of given type. |
||||
* |
||||
* @param EntityInterface $fedora_resource_type |
||||
* The custom bundle to add. |
||||
* @param \Symfony\Component\HttpFoundation\Request $request |
||||
* The current request object. |
||||
* |
||||
* @return array |
||||
* A form array as expected by drupal_render(). |
||||
*/ |
||||
public function addForm(EntityInterface $fedora_resource_type, Request $request) { |
||||
$entity = $this->storage->create(array( |
||||
'type' => $fedora_resource_type->id(), |
||||
)); |
||||
return $this->entityFormBuilder()->getForm($entity); |
||||
} |
||||
|
||||
/** |
||||
* Provides the page title for this controller. |
||||
* |
||||
* @param EntityInterface $fedora_resource_type |
||||
* The custom bundle/type being added. |
||||
* |
||||
* @return string |
||||
* The page title. |
||||
*/ |
||||
public function getAddFormTitle(EntityInterface $fedora_resource_type) { |
||||
return t('Create of bundle @label', |
||||
array('@label' => $fedora_resource_type->label()) |
||||
); |
||||
} |
||||
|
||||
} |
@ -1,19 +1,11 @@
|
||||
<?php |
||||
/** |
||||
* Created by PhpStorm. |
||||
* User: dpino |
||||
* Date: 8/16/16 |
||||
* Time: 11:49 PM |
||||
*/ |
||||
|
||||
namespace Drupal\islandora; |
||||
|
||||
|
||||
use Drupal\node\NodeViewBuilder; |
||||
|
||||
/** |
||||
* Class FedoraResourceViewBuilder |
||||
* view builder handler. |
||||
* Class FedoraResourceViewBuilder view builder handler. |
||||
* |
||||
* @TODO this should manage how fedora_resource are build to be viewed. |
||||
* |
@ -1,97 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace Drupal\islandora\Controller; |
||||
|
||||
use Drupal\Core\Controller\ControllerBase; |
||||
use Drupal\Core\Entity\EntityInterface; |
||||
use Drupal\Core\Entity\EntityTypeManagerInterface; |
||||
use Drupal\Core\Entity\EntityStorageInterface; |
||||
use Drupal\Core\Url; |
||||
use Symfony\Component\DependencyInjection\ContainerInterface; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
|
||||
|
||||
/** |
||||
* Class FedoraResourceAddController. |
||||
* |
||||
* @package Drupal\islandora\Controller |
||||
*/ |
||||
class FedoraResourceAddController extends ControllerBase { |
||||
|
||||
public function __construct(EntityStorageInterface $storage, EntityStorageInterface $type_storage) { |
||||
$this->storage = $storage; |
||||
$this->typeStorage = $type_storage; |
||||
} |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public static function create(ContainerInterface $container) { |
||||
/** @var EntityTypeManagerInterface $entity_type_manager */ |
||||
$entity_type_manager = $container->get('entity_type.manager'); |
||||
return new static( |
||||
$entity_type_manager->getStorage('fedora_resource'), |
||||
$entity_type_manager->getStorage('fedora_resource_type') |
||||
); |
||||
} |
||||
/** |
||||
* Displays add links for available bundles/types for entity fedora_resource . |
||||
* |
||||
* @param \Symfony\Component\HttpFoundation\Request $request |
||||
* The current request object. |
||||
* |
||||
* @return array |
||||
* A render array for a list of the fedora_resource bundles/types that can be added or |
||||
* if there is only one type/bunlde defined for the site, the function returns the add page for that bundle/type. |
||||
*/ |
||||
public function add(Request $request) { |
||||
$types = $this->typeStorage->loadMultiple(); |
||||
if ($types && count($types) == 1) { |
||||
$type = reset($types); |
||||
return $this->addForm($type, $request); |
||||
} |
||||
if (count($types) === 0) { |
||||
return array( |
||||
'#markup' => $this->t('You have not created any %bundle types yet. @link to add a new type.', [ |
||||
'%bundle' => 'Fedora resource', |
||||
'@link' => $this->l($this->t('Go to the type creation page'), Url::fromRoute('entity.fedora_resource_type.add_form')), |
||||
]), |
||||
); |
||||
} |
||||
return array('#theme' => 'fedora_resource_content_add_list', '#content' => $types); |
||||
} |
||||
|
||||
/** |
||||
* Presents the creation form for fedora_resource entities of given bundle/type. |
||||
* |
||||
* @param EntityInterface $fedora_resource_type |
||||
* The custom bundle to add. |
||||
* @param \Symfony\Component\HttpFoundation\Request $request |
||||
* The current request object. |
||||
* |
||||
* @return array |
||||
* A form array as expected by drupal_render(). |
||||
*/ |
||||
public function addForm(EntityInterface $fedora_resource_type, Request $request) { |
||||
$entity = $this->storage->create(array( |
||||
'type' => $fedora_resource_type->id() |
||||
)); |
||||
return $this->entityFormBuilder()->getForm($entity); |
||||
} |
||||
|
||||
/** |
||||
* Provides the page title for this controller. |
||||
* |
||||
* @param EntityInterface $fedora_resource_type |
||||
* The custom bundle/type being added. |
||||
* |
||||
* @return string |
||||
* The page title. |
||||
*/ |
||||
public function getAddFormTitle(EntityInterface $fedora_resource_type) { |
||||
return t('Create of bundle @label', |
||||
array('@label' => $fedora_resource_type->label()) |
||||
); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue