forked from rauchg/PluginsKit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.php
77 lines (62 loc) · 1.53 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
// exec('cd /Users/willy/Sites/Personal/MooForge/git/133e9b9b0617820f673562f71f614253cc51d397; /opt/local/bin/git pull', $output, $result);
//
// echo $result;
require_once(dirname(__FILE__) . '/../lib/vendor/symfony/lib/yaml/sfYamlParser.class.php');
/**
* Moo .js files parser
*
* @package forge
* @subpackage parser
* @author Guillermo Rauch
**/
class ForgeJSParser
{
protected
$requires = array(),
$provides = null;
public function __construct($data){
$this->data = $data;
preg_match_all('#(?m)/\*\s*(^---(\s*$.*?)^\.\.\.)\s*#sm', $this->data, $yaml);
if (!isset($yaml[1]) || !$yaml[1][0]){
throw new ForgeJSParserException('Could not find required YAML header in JS file.');
}
$this->rawYaml = trim($yaml[2][0]);
try {
$this->yaml = new sfYamlParser();
$this->yaml = $this->yaml->parse($this->rawYaml);
} catch (InvalidArgumentException $e){
throw new ForgeJSParserException('Error parsing the YAML fragment in the JS. Make sure it\'s valid YAML.');
}
print_r($this->yaml);
}
public function getData(){
return $this->yaml;
}
public function getRawData(){
return $this->rawYaml;
}
} // END class ForgeJSParser
class ForgeJSParserException extends Exception {}
new ForgeJSParser('/*
---
provides:
- MerryGoRound
license: MIT-style
requires:
core/1.2.3:
- Class.Extras
- Element.Event
- Element.Style
- Element.Dimensions
- Fx.Tween
- String
- Array
description: A fully-automated, flexible, customizable carousel class for Mootools.
authors:
- 3n
...
*/
sad
asd
asd');