This repository has been archived by the owner on Jun 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module EasyBib | ||
module Php | ||
def to_php_yaml(obj) | ||
# This is an ugly quick hack: Ruby Yaml adds object info !map:Chef::Node::ImmutableMash which | ||
# the Symfony Yaml parser doesnt like. So lets remove it. First Chef 11.4/Ruby 1.8, | ||
# then Chef 11.10/Ruby 2.0 | ||
yaml = YAML.dump(obj) | ||
content = yaml.gsub('!map:Chef::Node::ImmutableMash', '') | ||
content.gsub('!ruby/hash:Chef::Node::ImmutableMash', '') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'test/unit' | ||
require 'chef' | ||
require File.join(File.dirname(__FILE__), '../libraries', 'php.rb') | ||
|
||
class TestPhp < Test::Unit::TestCase | ||
include EasyBib::Php | ||
|
||
def test_to_php_json | ||
assert_equal( | ||
"--- \nBLA: \n", | ||
to_php_yaml(Chef::Node::ImmutableMash.new(['BLA'])) | ||
) | ||
end | ||
end |