Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Commit abff09f

Browse files
committed
Merge pull request #44 from readium/feature/epubReadingSystem
navigator.epubReadingSystem version info / git commit hash, shell script added to XCode build
2 parents 3f16b12 + 4d3bf00 commit abff09f

File tree

6 files changed

+213
-5
lines changed

6 files changed

+213
-5
lines changed

Resources/epubReadingSystem.epub

2.46 KB
Binary file not shown.

Resources/epubReadingSystem.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
ReadiumSDK.READIUM_iOS_sha = '';
3+
ReadiumSDK.READIUM_iOS_tag = '';
4+
ReadiumSDK.READIUM_iOS_clean = '';
5+
ReadiumSDK.READIUM_SDK_sha = '';
6+
ReadiumSDK.READIUM_SDK_tag = '';
7+
ReadiumSDK.READIUM_SDK_clean = '';
8+
ReadiumSDK.READIUM_SHARED_JS_sha = '';
9+
ReadiumSDK.READIUM_SHARED_JS_tag = '';
10+
ReadiumSDK.READIUM_SHARED_JS_clean = '';
11+
ReadiumSDK.READIUM_dateTimeString = '';

Resources/epubReadingSystem.sh

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/bin/sh
2+
3+
echo "###########################################"
4+
echo "###########################################"
5+
6+
pwd=`pwd`
7+
echo "Path:"
8+
echo "${pwd}"
9+
echo "------"
10+
11+
JS_FILE="${pwd}/Resources/epubReadingSystem_.js"
12+
test -z "${CONTENTS_FOLDER_PATH}" || JS_FILE="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/epubReadingSystem.js"
13+
echo "Javascript output:"
14+
echo "${JS_FILE}"
15+
test -z "${CONTENTS_FOLDER_PATH}" && echo "WARNING: file 'epubReadingSystem.js' will NOT be updated in XCode build folder! (running script from raw command line?)"
16+
echo "------"
17+
18+
FIRST=""
19+
20+
GitDo() {
21+
ROOT_DIR=$1
22+
INTERMEDIATE_DIR=$2
23+
GIT_SUBMODULE=$3
24+
SUB_DIR="${ROOT_DIR}${INTERMEDIATE_DIR}${GIT_SUBMODULE}"
25+
TARGET_PREFIX=$4
26+
27+
cd "${SUB_DIR}"
28+
29+
echo "========================="
30+
echo "Git target prefix:"
31+
echo "${TARGET_PREFIX}"
32+
echo "------"
33+
34+
GIT_DIR="${ROOT_DIR}/.git"
35+
echo "Git directory:"
36+
echo "${GIT_DIR}"
37+
echo "------"
38+
39+
echo "Git submodule directory:"
40+
echo "${SUB_DIR}"
41+
echo "------"
42+
43+
# We use "cd" instead! (more reliable, due to vendor submodules not necessarily setup the way we do it internally for Readium)
44+
GIT_DIR_CWD=""
45+
# GIT_DIR_CWD="--git-dir=${GIT_DIR} --work-tree=${SUB_DIR}"
46+
# echo "Git path spec:"
47+
# echo "${GIT_DIR_CWD}"
48+
# echo "------"
49+
50+
GIT_HEAD_PATH="${GIT_DIR}/HEAD"
51+
test -f "${SUB_DIR}/HEAD" && GIT_HEAD_PATH="${SUB_DIR}/HEAD"
52+
test -f "${GIT_DIR}/modules/${GIT_SUBMODULE}/HEAD" && GIT_HEAD_PATH="${GIT_DIR}/modules/${GIT_SUBMODULE}/HEAD"
53+
echo "Git HEAD path:"
54+
echo "${GIT_HEAD_PATH}";
55+
echo "------"
56+
57+
GIT_HEAD=`cat "${GIT_HEAD_PATH}"`
58+
echo "Git HEAD:"
59+
echo "${GIT_HEAD}";
60+
echo "------"
61+
62+
test "${GIT_HEAD#'ref: '}" != "${GIT_HEAD}" && echo "(attached head)" && GIT_SHA=`git ${GIT_DIR_CWD} rev-parse --verify HEAD`
63+
test "${GIT_HEAD#'ref: '}" == "${GIT_HEAD}" && echo "(detached head)" && GIT_SHA="${GIT_HEAD}"
64+
65+
echo "Git SHA:"
66+
echo "${GIT_SHA}"
67+
echo "------"
68+
69+
GIT_TAG=`git ${GIT_DIR_CWD} describe --tags --long ${GIT_SHA}`
70+
echo "Git TAG:"
71+
echo "${GIT_TAG}"
72+
echo "------"
73+
74+
GIT_STATUS=`git ${GIT_DIR_CWD} status --porcelain`
75+
echo "Git STATUS:"
76+
echo "${GIT_STATUS}"
77+
echo "------"
78+
79+
GIT_CLEAN=false
80+
test -z "${GIT_STATUS}" && GIT_CLEAN=true
81+
echo "Git CLEAN:"
82+
echo "${GIT_CLEAN}"
83+
echo "------"
84+
85+
echo "FIRST:"
86+
echo "${FIRST}"
87+
echo "------"
88+
89+
test -z "${FIRST}" && echo $"" > "${JS_FILE}"
90+
FIRST="false"
91+
92+
echo "ReadiumSDK.READIUM_${TARGET_PREFIX}_sha = '${GIT_SHA}';" >> "${JS_FILE}"
93+
echo "ReadiumSDK.READIUM_${TARGET_PREFIX}_tag = '${GIT_TAG}';" >> "${JS_FILE}"
94+
echo "ReadiumSDK.READIUM_${TARGET_PREFIX}_clean = '${GIT_CLEAN}';" >> "${JS_FILE}"
95+
96+
}
97+
98+
99+
100+
GitDo "${pwd}" "" "" "iOS"
101+
102+
GitDo "${pwd}" "/" "readium-sdk" "SDK"
103+
104+
GitDo "${pwd}" "/Resources/" "readium-shared-js" "SHARED_JS"
105+
106+
107+
108+
READIUM_dateTimeString=`date`
109+
echo "ReadiumSDK.READIUM_dateTimeString = '${READIUM_dateTimeString}';" >> "${JS_FILE}"
110+
111+
112+
cat ${JS_FILE}
113+
114+
cd "${pwd}"
115+
116+
echo "###########################################"
117+
echo "###########################################"

Resources/host_app_feedback.js

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// LauncherOSX
1+
// LauncheriOS
22
//
33
// Created by Boris Schneiderman.
44
// Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved.
@@ -26,11 +26,62 @@
2626
// OF THE POSSIBILITY OF SUCH DAMAGE.
2727

2828
ReadiumSDK.HostAppFeedback = function() {
29+
30+
var initNavigatorEpubReadingSystem = function() {
31+
32+
// Adjust to taste (application/vendor -level metadata):
33+
window.navigator.epubReadingSystem.name = "Readium SDKLauncher-iOS";
34+
window.navigator.epubReadingSystem.version = "1.0.0";
35+
36+
// Readium "internal" version:
37+
ReadiumSDK.READIUM_version = "1.0.0";
38+
39+
// Do not edit the following lines! (low-level metadata)
40+
// The templated values ("ReadiumSDK.READIUM_"-prefixed values) are auto-generated by the build script,
41+
// see the "epubReadingSystem.js" file.
42+
43+
window.navigator.epubReadingSystem.readium = {};
44+
window.navigator.epubReadingSystem.readium.buildInfo = {};
45+
46+
window.navigator.epubReadingSystem.readium.buildInfo.dateTime = ReadiumSDK.READIUM_dateTimeString;
47+
//new Date(timestamp).toString();
48+
49+
window.navigator.epubReadingSystem.readium.buildInfo.version = ReadiumSDK.READIUM_version;
50+
51+
window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories = [];
52+
53+
var repo1 = {};
54+
repo1.name = "SDKLauncher-iOS";
55+
repo1.sha = ReadiumSDK.READIUM_iOS_sha;
56+
repo1.tag = ReadiumSDK.READIUM_iOS_tag;
57+
repo1.clean = ReadiumSDK.READIUM_iOS_clean;
58+
repo1.url = "https://github.com/readium/" + repo1.name + "/tree/" + repo1.sha;
59+
window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories.push(repo1);
60+
61+
var repo2 = {};
62+
repo2.name = "readium-sdk";
63+
repo2.sha = ReadiumSDK.READIUM_SDK_sha;
64+
repo2.tag = ReadiumSDK.READIUM_SDK_tag;
65+
repo2.clean = ReadiumSDK.READIUM_SDK_clean;
66+
repo2.url = "https://github.com/readium/" + repo2.name + "/tree/" + repo2.sha;
67+
window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories.push(repo2);
68+
69+
var repo3 = {};
70+
repo3.name = "readium-shared-js";
71+
repo3.sha = ReadiumSDK.READIUM_SHARED_JS_sha;
72+
repo3.tag = ReadiumSDK.READIUM_SHARED_JS_tag;
73+
repo3.clean = ReadiumSDK.READIUM_SHARED_JS_clean;
74+
repo3.url = "https://github.com/readium/" + repo3.name + "/tree/" + repo3.sha;
75+
window.navigator.epubReadingSystem.readium.buildInfo.gitRepositories.push(repo3);
76+
77+
// Debug check:
78+
//console.debug(JSON.stringify(window.navigator.epubReadingSystem, undefined, 2));
79+
};
80+
2981
ReadiumSDK.on(ReadiumSDK.Events.READER_INITIALIZED, function() {
30-
31-
window.navigator.epubReadingSystem.name = "Launcher-iOS";
32-
window.navigator.epubReadingSystem.version = "0.0.1";
33-
82+
83+
initNavigatorEpubReadingSystem();
84+
3485
ReadiumSDK.reader.on(ReadiumSDK.Events.PAGINATION_CHANGED, this.onPaginationChanged, this);
3586
ReadiumSDK.reader.on(ReadiumSDK.Events.SETTINGS_APPLIED, this.onSettingsApplied, this);
3687
ReadiumSDK.reader.on(ReadiumSDK.Events.MEDIA_OVERLAY_STATUS_CHANGED, this.onMediaOverlayStatusChanged, this);

Resources/reader.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
<script src="readium-shared-js/js/views/media_overlay_player.js" type="text/javascript"></script>
4747
<script src="readium-shared-js/js/views/media_overlay_data_injector.js" type="text/javascript"></script>
4848
<script src="readium-shared-js/js/views/annotations_manager.js" type="text/javascript"></script>
49+
50+
<script src="epubReadingSystem.js" type="text/javascript"></script>
4951
<script src="host_app_feedback.js" type="text/javascript"></script>
5052

5153
<script type="text/javascript">

SDKLauncher-iOS.xcodeproj/project.pbxproj

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@
100100
34E12BAA180301A2004DCB68 /* Icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = 34E12B9D180301A2004DCB68 /* Icon-76.png */; };
101101
34E12BAB180301A2004DCB68 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 34E12B9E180301A2004DCB68 /* [email protected] */; };
102102
8307EC6919E3DE4A00B00468 /* mathjax in Resources */ = {isa = PBXBuildFile; fileRef = 8307EC6719E3DDEC00B00468 /* mathjax */; };
103+
83919F161A1E074200FC8118 /* epubReadingSystem.js in Resources */ = {isa = PBXBuildFile; fileRef = A250D199754564056CB0267E /* epubReadingSystem.js */; };
103104
83EBB4A419F56C1C0083E8F1 /* annotations.css in Resources */ = {isa = PBXBuildFile; fileRef = 83EBB4A319F56C1C0083E8F1 /* annotations.css */; };
104105
85DE51A117FDDCAC00F55130 /* page-blanche-20130322.epub in Resources */ = {isa = PBXBuildFile; fileRef = 85DE51A017FDDCAC00F55130 /* page-blanche-20130322.epub */; };
106+
A250D5118ECA530997C6E72B /* epubReadingSystem.js in Sources */ = {isa = PBXBuildFile; fileRef = A250D199754564056CB0267E /* epubReadingSystem.js */; };
105107
A250D5FFC597F4E5EB74D3AC /* epub30-test-0120-20131022.epub in Resources */ = {isa = PBXBuildFile; fileRef = A250D58D34D67FC218608A1F /* epub30-test-0120-20131022.epub */; };
106108
A250D8E19073D0C5B921BA5F /* epub30-test-0220-20131022.epub in Resources */ = {isa = PBXBuildFile; fileRef = A250D54A5C423A86C6099037 /* epub30-test-0220-20131022.epub */; };
109+
A250DD9ED6B68B6BD9F73160 /* epubReadingSystem.epub in Resources */ = {isa = PBXBuildFile; fileRef = A250DD41B691E2CA16B1735D /* epubReadingSystem.epub */; };
107110
/* End PBXBuildFile section */
108111

109112
/* Begin PBXContainerItemProxy section */
@@ -291,8 +294,10 @@
291294
8307EC6719E3DDEC00B00468 /* mathjax */ = {isa = PBXFileReference; lastKnownFileType = folder; path = mathjax; sourceTree = "<group>"; };
292295
83EBB4A319F56C1C0083E8F1 /* annotations.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = annotations.css; sourceTree = "<group>"; };
293296
85DE51A017FDDCAC00F55130 /* page-blanche-20130322.epub */ = {isa = PBXFileReference; lastKnownFileType = file; path = "page-blanche-20130322.epub"; sourceTree = "<group>"; };
297+
A250D199754564056CB0267E /* epubReadingSystem.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = epubReadingSystem.js; sourceTree = "<group>"; };
294298
A250D54A5C423A86C6099037 /* epub30-test-0220-20131022.epub */ = {isa = PBXFileReference; lastKnownFileType = file.epub; path = "epub30-test-0220-20131022.epub"; sourceTree = "<group>"; };
295299
A250D58D34D67FC218608A1F /* epub30-test-0120-20131022.epub */ = {isa = PBXFileReference; lastKnownFileType = file.epub; path = "epub30-test-0120-20131022.epub"; sourceTree = "<group>"; };
300+
A250DD41B691E2CA16B1735D /* epubReadingSystem.epub */ = {isa = PBXFileReference; lastKnownFileType = file.epub; path = epubReadingSystem.epub; sourceTree = "<group>"; };
296301
/* End PBXFileReference section */
297302

298303
/* Begin PBXFrameworksBuildPhase section */
@@ -324,6 +329,7 @@
324329
341A1F701790BC6800E603C4 /* host_app_feedback.js */,
325330
3403516116CE93F2009E3B88 /* reader.css */,
326331
3403516216CE93F2009E3B88 /* reader.html */,
332+
A250D199754564056CB0267E /* epubReadingSystem.js */,
327333
);
328334
name = Injection;
329335
sourceTree = "<group>";
@@ -337,6 +343,7 @@
337343
340535BA16BC793700D4A802 /* wasteland-20120118.epub */,
338344
A250D58D34D67FC218608A1F /* epub30-test-0120-20131022.epub */,
339345
A250D54A5C423A86C6099037 /* epub30-test-0220-20131022.epub */,
346+
A250DD41B691E2CA16B1735D /* epubReadingSystem.epub */,
340347
);
341348
name = EPub;
342349
sourceTree = "<group>";
@@ -674,6 +681,7 @@
674681
340FC15516BC3B4600346A59 /* Sources */,
675682
340FC15616BC3B4600346A59 /* Frameworks */,
676683
340FC15716BC3B4600346A59 /* Resources */,
684+
83919F191A1E074C00FC8118 /* ShellScript */,
677685
);
678686
buildRules = (
679687
);
@@ -746,6 +754,7 @@
746754
isa = PBXResourcesBuildPhase;
747755
buildActionMask = 2147483647;
748756
files = (
757+
83919F161A1E074200FC8118 /* epubReadingSystem.js in Resources */,
749758
8307EC6919E3DE4A00B00468 /* mathjax in Resources */,
750759
34B56B5E1723158E00A5A4B8 /* childrens-literature-20130206.epub in Resources */,
751760
3462FBEB16BC40F9003C79E1 /* Default.png in Resources */,
@@ -779,11 +788,28 @@
779788
34E12BA1180301A2004DCB68 /* Icon-40.png in Resources */,
780789
A250D5FFC597F4E5EB74D3AC /* epub30-test-0120-20131022.epub in Resources */,
781790
A250D8E19073D0C5B921BA5F /* epub30-test-0220-20131022.epub in Resources */,
791+
A250DD9ED6B68B6BD9F73160 /* epubReadingSystem.epub in Resources */,
782792
);
783793
runOnlyForDeploymentPostprocessing = 0;
784794
};
785795
/* End PBXResourcesBuildPhase section */
786796

797+
/* Begin PBXShellScriptBuildPhase section */
798+
83919F191A1E074C00FC8118 /* ShellScript */ = {
799+
isa = PBXShellScriptBuildPhase;
800+
buildActionMask = 2147483647;
801+
files = (
802+
);
803+
inputPaths = (
804+
);
805+
outputPaths = (
806+
);
807+
runOnlyForDeploymentPostprocessing = 0;
808+
shellPath = /bin/sh;
809+
shellScript = ./Resources/epubReadingSystem.sh;
810+
};
811+
/* End PBXShellScriptBuildPhase section */
812+
787813
/* Begin PBXSourcesBuildPhase section */
788814
340FC15516BC3B4600346A59 /* Sources */ = {
789815
isa = PBXSourcesBuildPhase;
@@ -843,6 +869,7 @@
843869
341652A816C2F9E700AFDB8B /* SpineItemListController.m in Sources */,
844870
342817DD18DBC48700C8434E /* NavigationElementItem.m in Sources */,
845871
34212FCF18F0649500A9109F /* GCDAsyncSocket.m in Sources */,
872+
A250D5118ECA530997C6E72B /* epubReadingSystem.js in Sources */,
846873
);
847874
runOnlyForDeploymentPostprocessing = 0;
848875
};

0 commit comments

Comments
 (0)