forked from alexblunck/Dash-Docset-Creator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-docset.php
39 lines (30 loc) · 1.25 KB
/
create-docset.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
<?php
include('functions.php');
include('docset.config.php');
//Create DOCSET_NAME.docset & other need Directories
//mkdir($config['docset_filename']);
mkdir('output/'.$config['docset_filename']);
mkdir('output/'.$config['docset_filename'].'/Contents');
mkdir('output/'.$config['docset_filename'].'/Contents/Resources');
mkdir('output/'.$config['docset_filename'].'/Contents/Resources/Documents');
mkdir('output/'.$config['docset_filename'].'/Contents/Resources/Documents/docs');
//Create Info.plist
include('create-info.php');
//Create Tokens.xml
include('create-tokens.php');
//Create Nodes.xml
include('create-nodes.php');
//Copy Icon file to docset root
copy('icon_goes_in_here/icon.png', 'output/'.$config['docset_filename'].'/icon.png');
//Copy all files from "files" dir to "docs" dir
foreach($files as $filename) {
copy('files_go_here/'.$filename, 'output/'.$config['docset_filename'].'/Contents/Resources/Documents/docs/'.$filename);
}
//Create Indexes with XCodes docseutil script
///Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index laravel.docset
$command = $config['docset_docseutil_path'].' index '.'output/'.$config['docset_filename'];
if (shell_exec($command)) {
echo 'Docset Created Successfully !';
} else {
echo 'docseutil Error!';
}