Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions servers/rest_server/includes/ServicesFormatter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ class ServicesXMLFormatter implements ServicesFormatterInterface {

class ServicesYAMLFormatter implements ServicesFormatterInterface {
public function render($data) {
if (($library = libraries_load('spyc')) && !empty($library['loaded'])) {
return Spyc::YAMLDump($data, 4, 60);
}
else {
watchdog('REST Server', 'Spyc library not found!', array(), WATCHDOG_ERROR);
return '';
}
module_load_include('php', 'rest_server', 'lib/spyc');
return Spyc::YAMLDump($data, 4, 60);
}
}

Expand Down
9 changes: 2 additions & 7 deletions servers/rest_server/includes/ServicesParser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,8 @@ class ServicesParserFile implements ServicesParserInterface {

class ServicesParserYAML implements ServicesParserInterface {
public function parse(ServicesContextInterface $context) {
if (($library = libraries_load('spyc')) && !empty($library['loaded'])) {
return Spyc::YAMLLoadString($context->getPostData());
}
else {
watchdog('REST Server', 'Spyc library not found!', array(), WATCHDOG_ERROR);
return array();
}
module_load_include('php', 'rest_server', 'lib/spyc');
return Spyc::YAMLLoadString($context->getPostData());
}
}

Expand Down
1 change: 0 additions & 1 deletion servers/rest_server/rest_server.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ description = Provides a REST server.
package = Services - servers

dependencies[] = services
dependencies[] = libraries

backdrop = 1.x
type = module
23 changes: 0 additions & 23 deletions servers/rest_server/rest_server.install
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,6 @@
* Install, uninstall and update the rest server module.
*/

/**
* Implements hook_requirements().
*/
function rest_server_requirements($phase) {
$requirements = array();

// Report the version of libraries.
if ($phase == 'runtime') {
backdrop_load('module', 'libraries');
$libraries = rest_server_libraries_info();
foreach ($libraries as $name => $info) {
$library = libraries_detect($name);
$requirements[$name] = array(
'title' => $library['name'],
'severity' => $library['installed'] ? REQUIREMENT_OK : REQUIREMENT_WARNING,
'value' => $library['installed'] ? l($library['version'], $library['vendor url']) : $library['error message'],
);
}
}

return $requirements;
}

/**
* Implements hook_uninstall().
*/
Expand Down
36 changes: 7 additions & 29 deletions servers/rest_server/rest_server.module
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ function rest_server_request_parsers() {
'text/xml' => 'ServicesParserXML',
);

if (($library = libraries_load('spyc')) && !empty($library['loaded'])) {
$parsers['application/x-yaml'] = 'ServicesParserYAML';
}
module_load_include('php', 'rest_server', 'lib/spyc');
$parsers['application/x-yaml'] = 'ServicesParserYAML';

backdrop_alter('rest_server_request_parsers', $parsers);
}
Expand Down Expand Up @@ -104,12 +103,11 @@ function rest_server_response_formatters() {
),
);

if (($library = libraries_load('spyc')) && !empty($library['loaded'])) {
$formatters['yaml'] = array(
'mime types' => array('text/plain', 'application/x-yaml', 'text/yaml'),
'formatter class' => 'ServicesYAMLFormatter',
);
}
module_load_include('php', 'rest_server', 'lib/spyc');
$formatters['yaml'] = array(
'mime types' => array('text/plain', 'application/x-yaml', 'text/yaml'),
'formatter class' => 'ServicesYAMLFormatter',
);

backdrop_alter('rest_server_response_formatters', $formatters);
}
Expand Down Expand Up @@ -172,26 +170,6 @@ function _rest_server_add_default_and_remove_unknown(&$array, $keys, $default) {
}
}

/**
* Implements hook_libraries_info().
*/
function rest_server_libraries_info() {
$libraries['spyc'] = array(
'name' => 'Spyc',
'vendor url' => 'https://github.com/mustangostang/spyc',
'download url' => 'https://raw.githubusercontent.com/mustangostang/spyc/0.6.3/Spyc.php',
'version arguments' => array(
'file' => 'Spyc.php',
'pattern' => '@version\s+([0-9a-zA-Z\.-]+)@',
),
'files' => array(
'php' => array('Spyc.php'),
),
);

return $libraries;
}

/**
* Implements hook_autoload_info().
*/
Expand Down
8 changes: 0 additions & 8 deletions services.make.example

This file was deleted.

6 changes: 0 additions & 6 deletions tests/services.tests.info
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ description = TBD
group = Services
file = functional/ServicesSecurityTests.test

[ServicesSpycLibraryTests]
name = ServicesSpycLibraryTests
description = TBD
group = Services
file = unit/ServicesSpycLibraryTests.test

[ServicesUITest]
name = ServicesUITests
description = TBD
Expand Down
40 changes: 0 additions & 40 deletions tests/unit/ServicesSpycLibraryTests.test

This file was deleted.