lounge_lizard 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +33 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +50 -0
  10. data/Rakefile +43 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/circle.yml +14 -0
  14. data/ext/drafter/CHANGELOG.md +278 -0
  15. data/ext/drafter/Dockerfile +17 -0
  16. data/ext/drafter/Makefile +62 -0
  17. data/ext/drafter/appveyor.yml +17 -0
  18. data/ext/drafter/bin/drafter +0 -0
  19. data/ext/drafter/build/Makefile +387 -0
  20. data/ext/drafter/build/drafter.Makefile +6 -0
  21. data/ext/drafter/build/drafter.target.mk +159 -0
  22. data/ext/drafter/build/ext/snowcrash/libmarkdownparser.target.mk +141 -0
  23. data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +154 -0
  24. data/ext/drafter/build/ext/snowcrash/libsundown.target.mk +149 -0
  25. data/ext/drafter/build/ext/snowcrash/perf-libsnowcrash.target.mk +147 -0
  26. data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
  27. data/ext/drafter/build/gyp-mac-tool +606 -0
  28. data/ext/drafter/build/libdrafter.target.mk +186 -0
  29. data/ext/drafter/build/libsos.target.mk +137 -0
  30. data/ext/drafter/build/out/Release/drafter +0 -0
  31. data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
  32. data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
  33. data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
  34. data/ext/drafter/build/out/Release/libsos.a +0 -0
  35. data/ext/drafter/build/out/Release/libsundown.a +0 -0
  36. data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
  37. data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
  38. data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
  39. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/ConversionContext.o +0 -0
  40. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/NamedTypesRegistry.o +0 -0
  41. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractAPI.o +0 -0
  42. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractDataStructure.o +0 -0
  43. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractElementFactory.o +0 -0
  44. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractSourceMap.o +0 -0
  45. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Render.o +0 -0
  46. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
  47. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
  48. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
  49. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
  50. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
  51. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter_private.o +0 -0
  52. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ComparableVisitor.o +0 -0
  53. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Element.o +0 -0
  54. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ExpandVisitor.o +0 -0
  55. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/IsExpandableVisitor.o +0 -0
  56. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/JSONSchemaVisitor.o +0 -0
  57. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/PrintVisitor.o +0 -0
  58. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Query.o +0 -0
  59. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Registry.o +0 -0
  60. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/RenderJSONVisitor.o +0 -0
  61. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeCompactVisitor.o +0 -0
  62. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeVisitor.o +0 -0
  63. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/TypeQueryVisitor.o +0 -0
  64. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/VisitorUtils.o +0 -0
  65. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
  66. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
  67. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
  68. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
  69. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
  70. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
  71. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
  72. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
  73. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
  74. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
  75. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
  76. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
  77. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
  78. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
  79. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
  80. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
  81. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
  82. data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
  83. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
  84. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
  85. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o +0 -0
  86. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
  87. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
  88. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
  89. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
  90. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.o +0 -0
  91. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
  92. data/ext/drafter/circle.yml +32 -0
  93. data/ext/drafter/config.gypi +10 -0
  94. data/ext/drafter/config.mk +5 -0
  95. data/ext/drafter/configure +224 -0
  96. data/ext/drafter/drafter.gyp +189 -0
  97. data/ext/drafter/drafter.xcworkspace/contents.xcworkspacedata +13 -0
  98. data/ext/drafter/ext/snowcrash/Makefile +58 -0
  99. data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
  100. data/ext/drafter/ext/snowcrash/common.gypi +165 -0
  101. data/ext/drafter/ext/snowcrash/configure +197 -0
  102. data/ext/drafter/ext/snowcrash/ext/markdown-parser/Makefile +90 -0
  103. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +10 -0
  104. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile +84 -0
  105. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile.win +33 -0
  106. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/smartypants.c +72 -0
  107. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/sundown.c +80 -0
  108. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini.h +37 -0
  109. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +108 -0
  110. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +84 -0
  111. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.c +647 -0
  112. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.h +77 -0
  113. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.c +389 -0
  114. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html_block_names.txt +25 -0
  115. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.c +297 -0
  116. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.h +51 -0
  117. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.c +225 -0
  118. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.h +96 -0
  119. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/html_blocks.h +206 -0
  120. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c +2726 -0
  121. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.h +147 -0
  122. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.c +204 -0
  123. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.h +58 -0
  124. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.c +81 -0
  125. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.h +29 -0
  126. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/sundown.def +20 -0
  127. data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj +188 -0
  128. data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/msvc.sln +38 -0
  129. data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj +206 -0
  130. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc +160 -0
  131. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h +90 -0
  132. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc +152 -0
  133. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h +103 -0
  134. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc +388 -0
  135. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.h +106 -0
  136. data/ext/drafter/ext/snowcrash/snowcrash.gyp +196 -0
  137. data/ext/drafter/ext/snowcrash/src/ActionParser.h +560 -0
  138. data/ext/drafter/ext/snowcrash/src/AssetParser.h +123 -0
  139. data/ext/drafter/ext/snowcrash/src/AttributesParser.h +123 -0
  140. data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
  141. data/ext/drafter/ext/snowcrash/src/Blueprint.h +489 -0
  142. data/ext/drafter/ext/snowcrash/src/BlueprintParser.h +845 -0
  143. data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
  144. data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.h +345 -0
  145. data/ext/drafter/ext/snowcrash/src/BlueprintUtility.h +111 -0
  146. data/ext/drafter/ext/snowcrash/src/CodeBlockUtility.h +276 -0
  147. data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +157 -0
  148. data/ext/drafter/ext/snowcrash/src/HTTP.cc +49 -0
  149. data/ext/drafter/ext/snowcrash/src/HTTP.h +108 -0
  150. data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +117 -0
  151. data/ext/drafter/ext/snowcrash/src/HeadersParser.h +377 -0
  152. data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
  153. data/ext/drafter/ext/snowcrash/src/MSON.h +405 -0
  154. data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +103 -0
  155. data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +135 -0
  156. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
  157. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
  158. data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +166 -0
  159. data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +106 -0
  160. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
  161. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
  162. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
  163. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
  164. data/ext/drafter/ext/snowcrash/src/MSONUtility.h +506 -0
  165. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +214 -0
  166. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +390 -0
  167. data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
  168. data/ext/drafter/ext/snowcrash/src/ParameterParser.h +516 -0
  169. data/ext/drafter/ext/snowcrash/src/ParametersParser.h +222 -0
  170. data/ext/drafter/ext/snowcrash/src/PayloadParser.h +733 -0
  171. data/ext/drafter/ext/snowcrash/src/Platform.h +33 -0
  172. data/ext/drafter/ext/snowcrash/src/RegexMatch.h +32 -0
  173. data/ext/drafter/ext/snowcrash/src/RelationParser.h +87 -0
  174. data/ext/drafter/ext/snowcrash/src/ResourceGroupParser.h +297 -0
  175. data/ext/drafter/ext/snowcrash/src/ResourceParser.h +536 -0
  176. data/ext/drafter/ext/snowcrash/src/Section.cc +48 -0
  177. data/ext/drafter/ext/snowcrash/src/Section.h +60 -0
  178. data/ext/drafter/ext/snowcrash/src/SectionParser.h +246 -0
  179. data/ext/drafter/ext/snowcrash/src/SectionParserData.h +109 -0
  180. data/ext/drafter/ext/snowcrash/src/SectionProcessor.h +299 -0
  181. data/ext/drafter/ext/snowcrash/src/Signature.cc +75 -0
  182. data/ext/drafter/ext/snowcrash/src/Signature.h +103 -0
  183. data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +442 -0
  184. data/ext/drafter/ext/snowcrash/src/SourceAnnotation.h +166 -0
  185. data/ext/drafter/ext/snowcrash/src/StringUtility.h +323 -0
  186. data/ext/drafter/ext/snowcrash/src/UriTemplateParser.cc +195 -0
  187. data/ext/drafter/ext/snowcrash/src/UriTemplateParser.h +240 -0
  188. data/ext/drafter/ext/snowcrash/src/ValuesParser.h +111 -0
  189. data/ext/drafter/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
  190. data/ext/drafter/ext/snowcrash/src/snowcrash.cc +90 -0
  191. data/ext/drafter/ext/snowcrash/src/snowcrash.h +44 -0
  192. data/ext/drafter/ext/snowcrash/src/win/RegexMatch.cc +78 -0
  193. data/ext/drafter/ext/snowcrash/tools/gyp/AUTHORS +12 -0
  194. data/ext/drafter/ext/snowcrash/tools/gyp/DEPS +23 -0
  195. data/ext/drafter/ext/snowcrash/tools/gyp/OWNERS +1 -0
  196. data/ext/drafter/ext/snowcrash/tools/gyp/PRESUBMIT.py +137 -0
  197. data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +136 -0
  198. data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/OWNERS +6 -0
  199. data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/cq_config.json +15 -0
  200. data/ext/drafter/ext/snowcrash/tools/gyp/codereview.settings +10 -0
  201. data/ext/drafter/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
  202. data/ext/drafter/ext/snowcrash/tools/gyp/gyp +8 -0
  203. data/ext/drafter/ext/snowcrash/tools/gyp/gyp.bat +5 -0
  204. data/ext/drafter/ext/snowcrash/tools/gyp/gyp_main.py +16 -0
  205. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
  206. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
  207. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1096 -0
  208. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
  209. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
  210. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +270 -0
  211. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.pyc +0 -0
  212. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +445 -0
  213. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.pyc +0 -0
  214. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +548 -0
  215. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
  216. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.py +608 -0
  217. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  218. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
  219. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +54 -0
  220. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
  221. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  222. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/analyzer.py +741 -0
  223. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
  224. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1248 -0
  225. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +99 -0
  226. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +425 -0
  227. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +94 -0
  228. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
  229. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2218 -0
  230. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
  231. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3467 -0
  232. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2427 -0
  233. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.pyc +0 -0
  234. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1300 -0
  235. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  236. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2899 -0
  237. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
  238. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +605 -0
  239. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +1093 -0
  240. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.pyc +0 -0
  241. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
  242. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.pyc +0 -0
  243. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
  244. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.py +46 -0
  245. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.pyc +0 -0
  246. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +314 -0
  247. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1664 -0
  248. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  249. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.py +276 -0
  250. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.pyc +0 -0
  251. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2927 -0
  252. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  253. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
  254. data/ext/drafter/ext/snowcrash/tools/gyp/pylintrc +307 -0
  255. data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples +81 -0
  256. data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
  257. data/ext/drafter/ext/snowcrash/tools/gyp/setup.py +19 -0
  258. data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
  259. data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
  260. data/ext/drafter/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +275 -0
  261. data/ext/drafter/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
  262. data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
  263. data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_sln.py +169 -0
  264. data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
  265. data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
  266. data/ext/drafter/ext/sos/Makefile +62 -0
  267. data/ext/drafter/ext/sos/src/sos.cc +235 -0
  268. data/ext/drafter/ext/sos/src/sos.h +188 -0
  269. data/ext/drafter/ext/sos/src/sosJSON.h +121 -0
  270. data/ext/drafter/ext/sos/src/sosYAML.h +105 -0
  271. data/ext/drafter/src/ConversionContext.cc +39 -0
  272. data/ext/drafter/src/ConversionContext.h +34 -0
  273. data/ext/drafter/src/NamedTypesRegistry.cc +405 -0
  274. data/ext/drafter/src/NamedTypesRegistry.h +28 -0
  275. data/ext/drafter/src/NodeInfo.h +143 -0
  276. data/ext/drafter/src/RefractAPI.cc +579 -0
  277. data/ext/drafter/src/RefractAPI.h +28 -0
  278. data/ext/drafter/src/RefractDataStructure.cc +1199 -0
  279. data/ext/drafter/src/RefractDataStructure.h +26 -0
  280. data/ext/drafter/src/RefractElementFactory.cc +107 -0
  281. data/ext/drafter/src/RefractElementFactory.h +67 -0
  282. data/ext/drafter/src/RefractSourceMap.cc +29 -0
  283. data/ext/drafter/src/RefractSourceMap.h +57 -0
  284. data/ext/drafter/src/Render.cc +157 -0
  285. data/ext/drafter/src/Render.h +40 -0
  286. data/ext/drafter/src/Serialize.cc +160 -0
  287. data/ext/drafter/src/Serialize.h +289 -0
  288. data/ext/drafter/src/SerializeAST.cc +507 -0
  289. data/ext/drafter/src/SerializeAST.h +29 -0
  290. data/ext/drafter/src/SerializeResult.cc +170 -0
  291. data/ext/drafter/src/SerializeResult.h +34 -0
  292. data/ext/drafter/src/SerializeSourcemap.cc +331 -0
  293. data/ext/drafter/src/SerializeSourcemap.h +21 -0
  294. data/ext/drafter/src/Version.h +40 -0
  295. data/ext/drafter/src/config.cc +91 -0
  296. data/ext/drafter/src/config.h +38 -0
  297. data/ext/drafter/src/drafter.cc +137 -0
  298. data/ext/drafter/src/drafter.h +102 -0
  299. data/ext/drafter/src/drafter_private.cc +85 -0
  300. data/ext/drafter/src/drafter_private.h +34 -0
  301. data/ext/drafter/src/main.cc +137 -0
  302. data/ext/drafter/src/refract/AppendDecorator.h +58 -0
  303. data/ext/drafter/src/refract/Build.h +67 -0
  304. data/ext/drafter/src/refract/ComparableVisitor.cc +43 -0
  305. data/ext/drafter/src/refract/ComparableVisitor.h +62 -0
  306. data/ext/drafter/src/refract/Element.cc +409 -0
  307. data/ext/drafter/src/refract/Element.h +656 -0
  308. data/ext/drafter/src/refract/ElementFwd.h +37 -0
  309. data/ext/drafter/src/refract/ElementInserter.h +59 -0
  310. data/ext/drafter/src/refract/Exception.h +31 -0
  311. data/ext/drafter/src/refract/ExpandVisitor.cc +359 -0
  312. data/ext/drafter/src/refract/ExpandVisitor.h +58 -0
  313. data/ext/drafter/src/refract/FilterVisitor.h +52 -0
  314. data/ext/drafter/src/refract/IsExpandableVisitor.cc +140 -0
  315. data/ext/drafter/src/refract/IsExpandableVisitor.h +31 -0
  316. data/ext/drafter/src/refract/Iterate.h +160 -0
  317. data/ext/drafter/src/refract/JSONSchemaVisitor.cc +675 -0
  318. data/ext/drafter/src/refract/JSONSchemaVisitor.h +73 -0
  319. data/ext/drafter/src/refract/PrintVisitor.cc +164 -0
  320. data/ext/drafter/src/refract/PrintVisitor.h +50 -0
  321. data/ext/drafter/src/refract/Query.cc +13 -0
  322. data/ext/drafter/src/refract/Query.h +38 -0
  323. data/ext/drafter/src/refract/Registry.cc +114 -0
  324. data/ext/drafter/src/refract/Registry.h +43 -0
  325. data/ext/drafter/src/refract/RenderJSONVisitor.cc +255 -0
  326. data/ext/drafter/src/refract/RenderJSONVisitor.h +51 -0
  327. data/ext/drafter/src/refract/SerializeCompactVisitor.cc +167 -0
  328. data/ext/drafter/src/refract/SerializeCompactVisitor.h +56 -0
  329. data/ext/drafter/src/refract/SerializeVisitor.cc +214 -0
  330. data/ext/drafter/src/refract/SerializeVisitor.h +55 -0
  331. data/ext/drafter/src/refract/TypeQueryVisitor.cc +46 -0
  332. data/ext/drafter/src/refract/TypeQueryVisitor.h +110 -0
  333. data/ext/drafter/src/refract/Visitor.h +126 -0
  334. data/ext/drafter/src/refract/VisitorUtils.cc +63 -0
  335. data/ext/drafter/src/refract/VisitorUtils.h +231 -0
  336. data/ext/drafter/src/reporting.cc +263 -0
  337. data/ext/drafter/src/reporting.h +39 -0
  338. data/ext/drafter/src/stream.h +148 -0
  339. data/ext/drafter/tools/homebrew/drafter.rb +18 -0
  340. data/ext/drafter/tools/make-tarball.sh +39 -0
  341. data/ext/drafter/tools/refract-filter.py +96 -0
  342. data/ext/drafter/tools/release.sh +17 -0
  343. data/ext/drafter/vcbuild.bat +203 -0
  344. data/lib/lounge_lizard/binding.rb +29 -0
  345. data/lib/lounge_lizard/version.rb +3 -0
  346. data/lib/lounge_lizard.rb +18 -0
  347. data/lounge_lizard.gemspec +37 -0
  348. metadata +547 -0
@@ -0,0 +1,606 @@
1
+ #!/usr/bin/env python
2
+ # Generated by gyp. Do not edit.
3
+ # Copyright (c) 2012 Google Inc. All rights reserved.
4
+ # Use of this source code is governed by a BSD-style license that can be
5
+ # found in the LICENSE file.
6
+
7
+ """Utility functions to perform Xcode-style build steps.
8
+
9
+ These functions are executed via gyp-mac-tool when using the Makefile generator.
10
+ """
11
+
12
+ import fcntl
13
+ import fnmatch
14
+ import glob
15
+ import json
16
+ import os
17
+ import plistlib
18
+ import re
19
+ import shutil
20
+ import string
21
+ import subprocess
22
+ import sys
23
+ import tempfile
24
+
25
+
26
+ def main(args):
27
+ executor = MacTool()
28
+ exit_code = executor.Dispatch(args)
29
+ if exit_code is not None:
30
+ sys.exit(exit_code)
31
+
32
+
33
+ class MacTool(object):
34
+ """This class performs all the Mac tooling steps. The methods can either be
35
+ executed directly, or dispatched from an argument list."""
36
+
37
+ def Dispatch(self, args):
38
+ """Dispatches a string command to a method."""
39
+ if len(args) < 1:
40
+ raise Exception("Not enough arguments")
41
+
42
+ method = "Exec%s" % self._CommandifyName(args[0])
43
+ return getattr(self, method)(*args[1:])
44
+
45
+ def _CommandifyName(self, name_string):
46
+ """Transforms a tool name like copy-info-plist to CopyInfoPlist"""
47
+ return name_string.title().replace('-', '')
48
+
49
+ def ExecCopyBundleResource(self, source, dest, convert_to_binary):
50
+ """Copies a resource file to the bundle/Resources directory, performing any
51
+ necessary compilation on each resource."""
52
+ extension = os.path.splitext(source)[1].lower()
53
+ if os.path.isdir(source):
54
+ # Copy tree.
55
+ # TODO(thakis): This copies file attributes like mtime, while the
56
+ # single-file branch below doesn't. This should probably be changed to
57
+ # be consistent with the single-file branch.
58
+ if os.path.exists(dest):
59
+ shutil.rmtree(dest)
60
+ shutil.copytree(source, dest)
61
+ elif extension == '.xib':
62
+ return self._CopyXIBFile(source, dest)
63
+ elif extension == '.storyboard':
64
+ return self._CopyXIBFile(source, dest)
65
+ elif extension == '.strings':
66
+ self._CopyStringsFile(source, dest)
67
+ else:
68
+ shutil.copy(source, dest)
69
+
70
+ if extension in ('.plist', '.strings') and convert_to_binary == 'True':
71
+ self._ConvertToBinary(dest)
72
+
73
+ def _CopyXIBFile(self, source, dest):
74
+ """Compiles a XIB file with ibtool into a binary plist in the bundle."""
75
+
76
+ # ibtool sometimes crashes with relative paths. See crbug.com/314728.
77
+ base = os.path.dirname(os.path.realpath(__file__))
78
+ if os.path.relpath(source):
79
+ source = os.path.join(base, source)
80
+ if os.path.relpath(dest):
81
+ dest = os.path.join(base, dest)
82
+
83
+ args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices']
84
+
85
+ if os.environ['XCODE_VERSION_ACTUAL'] > '0700':
86
+ args.extend(['--auto-activate-custom-fonts'])
87
+ if 'IPHONEOS_DEPLOYMENT_TARGET' in os.environ:
88
+ args.extend([
89
+ '--target-device', 'iphone', '--target-device', 'ipad',
90
+ '--minimum-deployment-target',
91
+ os.environ['IPHONEOS_DEPLOYMENT_TARGET'],
92
+ ])
93
+ else:
94
+ args.extend([
95
+ '--target-device', 'mac',
96
+ '--minimum-deployment-target',
97
+ os.environ['MACOSX_DEPLOYMENT_TARGET'],
98
+ ])
99
+
100
+ args.extend(['--output-format', 'human-readable-text', '--compile', dest,
101
+ source])
102
+
103
+ ibtool_section_re = re.compile(r'/\*.*\*/')
104
+ ibtool_re = re.compile(r'.*note:.*is clipping its content')
105
+ ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE)
106
+ current_section_header = None
107
+ for line in ibtoolout.stdout:
108
+ if ibtool_section_re.match(line):
109
+ current_section_header = line
110
+ elif not ibtool_re.match(line):
111
+ if current_section_header:
112
+ sys.stdout.write(current_section_header)
113
+ current_section_header = None
114
+ sys.stdout.write(line)
115
+ return ibtoolout.returncode
116
+
117
+ def _ConvertToBinary(self, dest):
118
+ subprocess.check_call([
119
+ 'xcrun', 'plutil', '-convert', 'binary1', '-o', dest, dest])
120
+
121
+ def _CopyStringsFile(self, source, dest):
122
+ """Copies a .strings file using iconv to reconvert the input into UTF-16."""
123
+ input_code = self._DetectInputEncoding(source) or "UTF-8"
124
+
125
+ # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call
126
+ # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints
127
+ # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing
128
+ # semicolon in dictionary.
129
+ # on invalid files. Do the same kind of validation.
130
+ import CoreFoundation
131
+ s = open(source, 'rb').read()
132
+ d = CoreFoundation.CFDataCreate(None, s, len(s))
133
+ _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None)
134
+ if error:
135
+ return
136
+
137
+ fp = open(dest, 'wb')
138
+ fp.write(s.decode(input_code).encode('UTF-16'))
139
+ fp.close()
140
+
141
+ def _DetectInputEncoding(self, file_name):
142
+ """Reads the first few bytes from file_name and tries to guess the text
143
+ encoding. Returns None as a guess if it can't detect it."""
144
+ fp = open(file_name, 'rb')
145
+ try:
146
+ header = fp.read(3)
147
+ except e:
148
+ fp.close()
149
+ return None
150
+ fp.close()
151
+ if header.startswith("\xFE\xFF"):
152
+ return "UTF-16"
153
+ elif header.startswith("\xFF\xFE"):
154
+ return "UTF-16"
155
+ elif header.startswith("\xEF\xBB\xBF"):
156
+ return "UTF-8"
157
+ else:
158
+ return None
159
+
160
+ def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys):
161
+ """Copies the |source| Info.plist to the destination directory |dest|."""
162
+ # Read the source Info.plist into memory.
163
+ fd = open(source, 'r')
164
+ lines = fd.read()
165
+ fd.close()
166
+
167
+ # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild).
168
+ plist = plistlib.readPlistFromString(lines)
169
+ if keys:
170
+ plist = dict(plist.items() + json.loads(keys[0]).items())
171
+ lines = plistlib.writePlistToString(plist)
172
+
173
+ # Go through all the environment variables and replace them as variables in
174
+ # the file.
175
+ IDENT_RE = re.compile(r'[/\s]')
176
+ for key in os.environ:
177
+ if key.startswith('_'):
178
+ continue
179
+ evar = '${%s}' % key
180
+ evalue = os.environ[key]
181
+ lines = string.replace(lines, evar, evalue)
182
+
183
+ # Xcode supports various suffices on environment variables, which are
184
+ # all undocumented. :rfc1034identifier is used in the standard project
185
+ # template these days, and :identifier was used earlier. They are used to
186
+ # convert non-url characters into things that look like valid urls --
187
+ # except that the replacement character for :identifier, '_' isn't valid
188
+ # in a URL either -- oops, hence :rfc1034identifier was born.
189
+ evar = '${%s:identifier}' % key
190
+ evalue = IDENT_RE.sub('_', os.environ[key])
191
+ lines = string.replace(lines, evar, evalue)
192
+
193
+ evar = '${%s:rfc1034identifier}' % key
194
+ evalue = IDENT_RE.sub('-', os.environ[key])
195
+ lines = string.replace(lines, evar, evalue)
196
+
197
+ # Remove any keys with values that haven't been replaced.
198
+ lines = lines.split('\n')
199
+ for i in range(len(lines)):
200
+ if lines[i].strip().startswith("<string>${"):
201
+ lines[i] = None
202
+ lines[i - 1] = None
203
+ lines = '\n'.join(filter(lambda x: x is not None, lines))
204
+
205
+ # Write out the file with variables replaced.
206
+ fd = open(dest, 'w')
207
+ fd.write(lines)
208
+ fd.close()
209
+
210
+ # Now write out PkgInfo file now that the Info.plist file has been
211
+ # "compiled".
212
+ self._WritePkgInfo(dest)
213
+
214
+ if convert_to_binary == 'True':
215
+ self._ConvertToBinary(dest)
216
+
217
+ def _WritePkgInfo(self, info_plist):
218
+ """This writes the PkgInfo file from the data stored in Info.plist."""
219
+ plist = plistlib.readPlist(info_plist)
220
+ if not plist:
221
+ return
222
+
223
+ # Only create PkgInfo for executable types.
224
+ package_type = plist['CFBundlePackageType']
225
+ if package_type != 'APPL':
226
+ return
227
+
228
+ # The format of PkgInfo is eight characters, representing the bundle type
229
+ # and bundle signature, each four characters. If that is missing, four
230
+ # '?' characters are used instead.
231
+ signature_code = plist.get('CFBundleSignature', '????')
232
+ if len(signature_code) != 4: # Wrong length resets everything, too.
233
+ signature_code = '?' * 4
234
+
235
+ dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo')
236
+ fp = open(dest, 'w')
237
+ fp.write('%s%s' % (package_type, signature_code))
238
+ fp.close()
239
+
240
+ def ExecFlock(self, lockfile, *cmd_list):
241
+ """Emulates the most basic behavior of Linux's flock(1)."""
242
+ # Rely on exception handling to report errors.
243
+ fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
244
+ fcntl.flock(fd, fcntl.LOCK_EX)
245
+ return subprocess.call(cmd_list)
246
+
247
+ def ExecFilterLibtool(self, *cmd_list):
248
+ """Calls libtool and filters out '/path/to/libtool: file: foo.o has no
249
+ symbols'."""
250
+ libtool_re = re.compile(r'^.*libtool: (?:for architecture: \S* )?'
251
+ r'file: .* has no symbols$')
252
+ libtool_re5 = re.compile(
253
+ r'^.*libtool: warning for library: ' +
254
+ r'.* the table of contents is empty ' +
255
+ r'\(no object file members in the library define global symbols\)$')
256
+ env = os.environ.copy()
257
+ # Ref:
258
+ # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c
259
+ # The problem with this flag is that it resets the file mtime on the file to
260
+ # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone.
261
+ env['ZERO_AR_DATE'] = '1'
262
+ libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env)
263
+ _, err = libtoolout.communicate()
264
+ for line in err.splitlines():
265
+ if not libtool_re.match(line) and not libtool_re5.match(line):
266
+ print >>sys.stderr, line
267
+ # Unconditionally touch the output .a file on the command line if present
268
+ # and the command succeeded. A bit hacky.
269
+ if not libtoolout.returncode:
270
+ for i in range(len(cmd_list) - 1):
271
+ if cmd_list[i] == "-o" and cmd_list[i+1].endswith('.a'):
272
+ os.utime(cmd_list[i+1], None)
273
+ break
274
+ return libtoolout.returncode
275
+
276
+ def ExecPackageFramework(self, framework, version):
277
+ """Takes a path to Something.framework and the Current version of that and
278
+ sets up all the symlinks."""
279
+ # Find the name of the binary based on the part before the ".framework".
280
+ binary = os.path.basename(framework).split('.')[0]
281
+
282
+ CURRENT = 'Current'
283
+ RESOURCES = 'Resources'
284
+ VERSIONS = 'Versions'
285
+
286
+ if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)):
287
+ # Binary-less frameworks don't seem to contain symlinks (see e.g.
288
+ # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle).
289
+ return
290
+
291
+ # Move into the framework directory to set the symlinks correctly.
292
+ pwd = os.getcwd()
293
+ os.chdir(framework)
294
+
295
+ # Set up the Current version.
296
+ self._Relink(version, os.path.join(VERSIONS, CURRENT))
297
+
298
+ # Set up the root symlinks.
299
+ self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary)
300
+ self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES)
301
+
302
+ # Back to where we were before!
303
+ os.chdir(pwd)
304
+
305
+ def _Relink(self, dest, link):
306
+ """Creates a symlink to |dest| named |link|. If |link| already exists,
307
+ it is overwritten."""
308
+ if os.path.lexists(link):
309
+ os.remove(link)
310
+ os.symlink(dest, link)
311
+
312
+ def ExecCompileXcassets(self, keys, *inputs):
313
+ """Compiles multiple .xcassets files into a single .car file.
314
+
315
+ This invokes 'actool' to compile all the inputs .xcassets files. The
316
+ |keys| arguments is a json-encoded dictionary of extra arguments to
317
+ pass to 'actool' when the asset catalogs contains an application icon
318
+ or a launch image.
319
+
320
+ Note that 'actool' does not create the Assets.car file if the asset
321
+ catalogs does not contains imageset.
322
+ """
323
+ command_line = [
324
+ 'xcrun', 'actool', '--output-format', 'human-readable-text',
325
+ '--compress-pngs', '--notices', '--warnings', '--errors',
326
+ ]
327
+ is_iphone_target = 'IPHONEOS_DEPLOYMENT_TARGET' in os.environ
328
+ if is_iphone_target:
329
+ platform = os.environ['CONFIGURATION'].split('-')[-1]
330
+ if platform not in ('iphoneos', 'iphonesimulator'):
331
+ platform = 'iphonesimulator'
332
+ command_line.extend([
333
+ '--platform', platform, '--target-device', 'iphone',
334
+ '--target-device', 'ipad', '--minimum-deployment-target',
335
+ os.environ['IPHONEOS_DEPLOYMENT_TARGET'], '--compile',
336
+ os.path.abspath(os.environ['CONTENTS_FOLDER_PATH']),
337
+ ])
338
+ else:
339
+ command_line.extend([
340
+ '--platform', 'macosx', '--target-device', 'mac',
341
+ '--minimum-deployment-target', os.environ['MACOSX_DEPLOYMENT_TARGET'],
342
+ '--compile',
343
+ os.path.abspath(os.environ['UNLOCALIZED_RESOURCES_FOLDER_PATH']),
344
+ ])
345
+ if keys:
346
+ keys = json.loads(keys)
347
+ for key, value in keys.iteritems():
348
+ arg_name = '--' + key
349
+ if isinstance(value, bool):
350
+ if value:
351
+ command_line.append(arg_name)
352
+ elif isinstance(value, list):
353
+ for v in value:
354
+ command_line.append(arg_name)
355
+ command_line.append(str(v))
356
+ else:
357
+ command_line.append(arg_name)
358
+ command_line.append(str(value))
359
+ # Note: actool crashes if inputs path are relative, so use os.path.abspath
360
+ # to get absolute path name for inputs.
361
+ command_line.extend(map(os.path.abspath, inputs))
362
+ subprocess.check_call(command_line)
363
+
364
+ def ExecMergeInfoPlist(self, output, *inputs):
365
+ """Merge multiple .plist files into a single .plist file."""
366
+ merged_plist = {}
367
+ for path in inputs:
368
+ plist = self._LoadPlistMaybeBinary(path)
369
+ self._MergePlist(merged_plist, plist)
370
+ plistlib.writePlist(merged_plist, output)
371
+
372
+ def ExecCodeSignBundle(self, key, entitlements, provisioning):
373
+ """Code sign a bundle.
374
+
375
+ This function tries to code sign an iOS bundle, following the same
376
+ algorithm as Xcode:
377
+ 1. pick the provisioning profile that best match the bundle identifier,
378
+ and copy it into the bundle as embedded.mobileprovision,
379
+ 2. copy Entitlements.plist from user or SDK next to the bundle,
380
+ 3. code sign the bundle.
381
+ """
382
+ substitutions, overrides = self._InstallProvisioningProfile(
383
+ provisioning, self._GetCFBundleIdentifier())
384
+ entitlements_path = self._InstallEntitlements(
385
+ entitlements, substitutions, overrides)
386
+ subprocess.check_call([
387
+ 'codesign', '--force', '--sign', key, '--entitlements',
388
+ entitlements_path, '--timestamp=none', os.path.join(
389
+ os.environ['TARGET_BUILD_DIR'],
390
+ os.environ['FULL_PRODUCT_NAME'])])
391
+
392
+ def _InstallProvisioningProfile(self, profile, bundle_identifier):
393
+ """Installs embedded.mobileprovision into the bundle.
394
+
395
+ Args:
396
+ profile: string, optional, short name of the .mobileprovision file
397
+ to use, if empty or the file is missing, the best file installed
398
+ will be used
399
+ bundle_identifier: string, value of CFBundleIdentifier from Info.plist
400
+
401
+ Returns:
402
+ A tuple containing two dictionary: variables substitutions and values
403
+ to overrides when generating the entitlements file.
404
+ """
405
+ source_path, provisioning_data, team_id = self._FindProvisioningProfile(
406
+ profile, bundle_identifier)
407
+ target_path = os.path.join(
408
+ os.environ['BUILT_PRODUCTS_DIR'],
409
+ os.environ['CONTENTS_FOLDER_PATH'],
410
+ 'embedded.mobileprovision')
411
+ shutil.copy2(source_path, target_path)
412
+ substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.')
413
+ return substitutions, provisioning_data['Entitlements']
414
+
415
+ def _FindProvisioningProfile(self, profile, bundle_identifier):
416
+ """Finds the .mobileprovision file to use for signing the bundle.
417
+
418
+ Checks all the installed provisioning profiles (or if the user specified
419
+ the PROVISIONING_PROFILE variable, only consult it) and select the most
420
+ specific that correspond to the bundle identifier.
421
+
422
+ Args:
423
+ profile: string, optional, short name of the .mobileprovision file
424
+ to use, if empty or the file is missing, the best file installed
425
+ will be used
426
+ bundle_identifier: string, value of CFBundleIdentifier from Info.plist
427
+
428
+ Returns:
429
+ A tuple of the path to the selected provisioning profile, the data of
430
+ the embedded plist in the provisioning profile and the team identifier
431
+ to use for code signing.
432
+
433
+ Raises:
434
+ SystemExit: if no .mobileprovision can be used to sign the bundle.
435
+ """
436
+ profiles_dir = os.path.join(
437
+ os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles')
438
+ if not os.path.isdir(profiles_dir):
439
+ print >>sys.stderr, (
440
+ 'cannot find mobile provisioning for %s' % bundle_identifier)
441
+ sys.exit(1)
442
+ provisioning_profiles = None
443
+ if profile:
444
+ profile_path = os.path.join(profiles_dir, profile + '.mobileprovision')
445
+ if os.path.exists(profile_path):
446
+ provisioning_profiles = [profile_path]
447
+ if not provisioning_profiles:
448
+ provisioning_profiles = glob.glob(
449
+ os.path.join(profiles_dir, '*.mobileprovision'))
450
+ valid_provisioning_profiles = {}
451
+ for profile_path in provisioning_profiles:
452
+ profile_data = self._LoadProvisioningProfile(profile_path)
453
+ app_id_pattern = profile_data.get(
454
+ 'Entitlements', {}).get('application-identifier', '')
455
+ for team_identifier in profile_data.get('TeamIdentifier', []):
456
+ app_id = '%s.%s' % (team_identifier, bundle_identifier)
457
+ if fnmatch.fnmatch(app_id, app_id_pattern):
458
+ valid_provisioning_profiles[app_id_pattern] = (
459
+ profile_path, profile_data, team_identifier)
460
+ if not valid_provisioning_profiles:
461
+ print >>sys.stderr, (
462
+ 'cannot find mobile provisioning for %s' % bundle_identifier)
463
+ sys.exit(1)
464
+ # If the user has multiple provisioning profiles installed that can be
465
+ # used for ${bundle_identifier}, pick the most specific one (ie. the
466
+ # provisioning profile whose pattern is the longest).
467
+ selected_key = max(valid_provisioning_profiles, key=lambda v: len(v))
468
+ return valid_provisioning_profiles[selected_key]
469
+
470
+ def _LoadProvisioningProfile(self, profile_path):
471
+ """Extracts the plist embedded in a provisioning profile.
472
+
473
+ Args:
474
+ profile_path: string, path to the .mobileprovision file
475
+
476
+ Returns:
477
+ Content of the plist embedded in the provisioning profile as a dictionary.
478
+ """
479
+ with tempfile.NamedTemporaryFile() as temp:
480
+ subprocess.check_call([
481
+ 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name])
482
+ return self._LoadPlistMaybeBinary(temp.name)
483
+
484
+ def _MergePlist(self, merged_plist, plist):
485
+ """Merge |plist| into |merged_plist|."""
486
+ for key, value in plist.iteritems():
487
+ if isinstance(value, dict):
488
+ merged_value = merged_plist.get(key, {})
489
+ if isinstance(merged_value, dict):
490
+ self._MergePlist(merged_value, value)
491
+ merged_plist[key] = merged_value
492
+ else:
493
+ merged_plist[key] = value
494
+ else:
495
+ merged_plist[key] = value
496
+
497
+ def _LoadPlistMaybeBinary(self, plist_path):
498
+ """Loads into a memory a plist possibly encoded in binary format.
499
+
500
+ This is a wrapper around plistlib.readPlist that tries to convert the
501
+ plist to the XML format if it can't be parsed (assuming that it is in
502
+ the binary format).
503
+
504
+ Args:
505
+ plist_path: string, path to a plist file, in XML or binary format
506
+
507
+ Returns:
508
+ Content of the plist as a dictionary.
509
+ """
510
+ try:
511
+ # First, try to read the file using plistlib that only supports XML,
512
+ # and if an exception is raised, convert a temporary copy to XML and
513
+ # load that copy.
514
+ return plistlib.readPlist(plist_path)
515
+ except:
516
+ pass
517
+ with tempfile.NamedTemporaryFile() as temp:
518
+ shutil.copy2(plist_path, temp.name)
519
+ subprocess.check_call(['plutil', '-convert', 'xml1', temp.name])
520
+ return plistlib.readPlist(temp.name)
521
+
522
+ def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix):
523
+ """Constructs a dictionary of variable substitutions for Entitlements.plist.
524
+
525
+ Args:
526
+ bundle_identifier: string, value of CFBundleIdentifier from Info.plist
527
+ app_identifier_prefix: string, value for AppIdentifierPrefix
528
+
529
+ Returns:
530
+ Dictionary of substitutions to apply when generating Entitlements.plist.
531
+ """
532
+ return {
533
+ 'CFBundleIdentifier': bundle_identifier,
534
+ 'AppIdentifierPrefix': app_identifier_prefix,
535
+ }
536
+
537
+ def _GetCFBundleIdentifier(self):
538
+ """Extracts CFBundleIdentifier value from Info.plist in the bundle.
539
+
540
+ Returns:
541
+ Value of CFBundleIdentifier in the Info.plist located in the bundle.
542
+ """
543
+ info_plist_path = os.path.join(
544
+ os.environ['TARGET_BUILD_DIR'],
545
+ os.environ['INFOPLIST_PATH'])
546
+ info_plist_data = self._LoadPlistMaybeBinary(info_plist_path)
547
+ return info_plist_data['CFBundleIdentifier']
548
+
549
+ def _InstallEntitlements(self, entitlements, substitutions, overrides):
550
+ """Generates and install the ${BundleName}.xcent entitlements file.
551
+
552
+ Expands variables "$(variable)" pattern in the source entitlements file,
553
+ add extra entitlements defined in the .mobileprovision file and the copy
554
+ the generated plist to "${BundlePath}.xcent".
555
+
556
+ Args:
557
+ entitlements: string, optional, path to the Entitlements.plist template
558
+ to use, defaults to "${SDKROOT}/Entitlements.plist"
559
+ substitutions: dictionary, variable substitutions
560
+ overrides: dictionary, values to add to the entitlements
561
+
562
+ Returns:
563
+ Path to the generated entitlements file.
564
+ """
565
+ source_path = entitlements
566
+ target_path = os.path.join(
567
+ os.environ['BUILT_PRODUCTS_DIR'],
568
+ os.environ['PRODUCT_NAME'] + '.xcent')
569
+ if not source_path:
570
+ source_path = os.path.join(
571
+ os.environ['SDKROOT'],
572
+ 'Entitlements.plist')
573
+ shutil.copy2(source_path, target_path)
574
+ data = self._LoadPlistMaybeBinary(target_path)
575
+ data = self._ExpandVariables(data, substitutions)
576
+ if overrides:
577
+ for key in overrides:
578
+ if key not in data:
579
+ data[key] = overrides[key]
580
+ plistlib.writePlist(data, target_path)
581
+ return target_path
582
+
583
+ def _ExpandVariables(self, data, substitutions):
584
+ """Expands variables "$(variable)" in data.
585
+
586
+ Args:
587
+ data: object, can be either string, list or dictionary
588
+ substitutions: dictionary, variable substitutions to perform
589
+
590
+ Returns:
591
+ Copy of data where each references to "$(variable)" has been replaced
592
+ by the corresponding value found in substitutions, or left intact if
593
+ the key was not found.
594
+ """
595
+ if isinstance(data, str):
596
+ for key, value in substitutions.iteritems():
597
+ data = data.replace('$(%s)' % key, value)
598
+ return data
599
+ if isinstance(data, list):
600
+ return [self._ExpandVariables(v, substitutions) for v in data]
601
+ if isinstance(data, dict):
602
+ return {k: self._ExpandVariables(data[k], substitutions) for k in data}
603
+ return data
604
+
605
+ if __name__ == '__main__':
606
+ sys.exit(main(sys.argv[1:]))