Skip to content
Permalink
Browse files

Merge pull request #57 from danielbachhuber/require-spyc

Require `spyc` dependency with a proper autoloader
  • Loading branch information...
danielbachhuber committed Oct 4, 2017
2 parents 5151f24 + 5fd285e commit b28ad95cdfe5501ec916d2faf685aa4db5d9448c
Showing with 6 additions and 4 deletions.
  1. +1 −0 .travis.yml
  2. +2 −1 composer.json
  3. +2 −2 php/class-dictator-cli-command.php
  4. +1 −1 php/class-dictator.php
@@ -1,4 +1,5 @@
language: php
dist: precise

php:
- 5.3
@@ -12,9 +12,10 @@
"role": "Developer"
}
],
"prefer-stable": true,
"minimum-stability": "dev",
"require": {

"wp-cli/mustangostang-spyc": "^0.6.3"
},
"autoload": {
"files": [ "dictator.php" ]
@@ -215,7 +215,7 @@ private function load_state_file( $file ) {
WP_CLI::error( sprintf( "File doesn't exist: %s", $file ) );
}
$yaml = spyc_load( file_get_contents( $file ) );
$yaml = Mustangostang\Spyc::YAMLLoadString( file_get_contents( $file ) );
if ( empty( $yaml ) ) {
WP_CLI::error( sprintf( "Doesn't appear to be a Yaml file: %s", $file ) );
}
@@ -269,7 +269,7 @@ private function validate_state_data( $yaml ) {
*/
private function write_state_file( $state_data, $file ) {
$spyc = new Spyc;
$spyc = new Mustangostang\Spyc;
$file_data = $spyc->dump( $state_data, 2, 0 );
// $spyc->dump() prepends "---\n" :(
$file_data = substr( $file_data, 4 );
@@ -133,7 +133,7 @@ public static function get_state_schema_obj( $name ) {
$schema_file = dirname( dirname( __FILE__ ) ) . '/schemas/' . $schema_file;
}
$schema_yaml = spyc_load( file_get_contents( $schema_file ) );
$schema_yaml = Mustangostang\Spyc::YAMLLoadString( file_get_contents( $schema_file ) );
return new MetaYaml( $schema_yaml );

0 comments on commit b28ad95

Please sign in to comment.
You can’t perform that action at this time.