plugin_hex.mk 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. # Hex plugin.
  2. #
  3. # In order to run these tests, a local Hex.pm instance must
  4. # be started and available on port 4000, and the HEX=1 variable
  5. # must be set.
  6. HEX_TARGETS = $(call list_targets,hex)
  7. .PHONY: hex $(HEX_TARGETS)
  8. hex: $(HEX_TARGETS)
  9. ifeq ($(shell netcat -z localhost 4000 && echo ok),ok)
  10. hex-user-create: init
  11. $i "Bootstrap a new OTP application named $(APP)"
  12. $t mkdir $(APP)/
  13. $t cp ../erlang.mk $(APP)/
  14. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  15. $i "Configure a local Hex provider"
  16. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  17. $i "Create a Hex user"
  18. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  19. $i "Check that the user exists"
  20. $t curl -sf http://localhost:4000/api/users/$(APP) >/dev/null
  21. # @todo Fix this.
  22. #hex-user-create-password-with-dollar-sign: init
  23. #
  24. # $i "Bootstrap a new OTP application named $(APP)"
  25. # $t mkdir $(APP)/
  26. # $t cp ../erlang.mk $(APP)/
  27. # $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  28. #
  29. # $i "Configure a local Hex provider"
  30. # $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  31. #
  32. # $i "Create a Hex user"
  33. # $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="123$$567" HEX_EMAIL=$(APP)@noone.nope $v
  34. #
  35. # $i "Check that the user exists"
  36. # $t curl --user "$(APP):123$$567" -sf http://localhost:4000/api/users/$(APP) >/dev/null
  37. # @todo Fix this.
  38. #hex-user-create-password-with-backslash: init
  39. #
  40. # $i "Bootstrap a new OTP application named $(APP)"
  41. # $t mkdir $(APP)/
  42. # $t cp ../erlang.mk $(APP)/
  43. # $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  44. #
  45. # $i "Configure a local Hex provider"
  46. # $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  47. #
  48. # $i "Create a Hex user"
  49. # $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="123\\567" HEX_EMAIL=$(APP)@noone.nope $v
  50. #
  51. # $i "Check that the user exists"
  52. # $t curl --user "$(APP):123\\567" -sf http://localhost:4000/api/users/$(APP) >/dev/null
  53. hex-user-create-password-with-space: init
  54. $i "Bootstrap a new OTP application named $(APP)"
  55. $t mkdir $(APP)/
  56. $t cp ../erlang.mk $(APP)/
  57. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  58. $i "Configure a local Hex provider"
  59. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  60. $i "Create a Hex user"
  61. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="123 567" HEX_EMAIL=$(APP)@noone.nope $v
  62. $i "Check that the user exists"
  63. $t curl --user "$(APP):123 567" -sf http://localhost:4000/api/users/$(APP) >/dev/null
  64. hex-key-add: init
  65. $i "Bootstrap a new OTP application named $(APP)"
  66. $t mkdir $(APP)/
  67. $t cp ../erlang.mk $(APP)/
  68. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  69. $i "Configure a local Hex provider"
  70. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  71. $i "Create a Hex user"
  72. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  73. $i "Create a key for that user"
  74. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" $v
  75. $i "Check that the key exists"
  76. $t curl --user $(APP):1234567 -sf http://localhost:4000/api/keys/$(shell hostname)-erlang-mk >/dev/null
  77. hex-tarball-create: init
  78. $i "Bootstrap a new OTP application named $(APP)"
  79. $t mkdir $(APP)/
  80. $t cp ../erlang.mk $(APP)/
  81. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  82. $i "Create a release tarball"
  83. $t $(MAKE) -C $(APP) hex-tarball-create $v
  84. $i "Confirm the tarball contents can be extracted"
  85. $t cd $(APP)/.erlang.mk/ && tar xf $(APP).tar
  86. $i "Confirm the tarball contains a CHECKSUM file"
  87. $t test -f $(APP)/.erlang.mk/CHECKSUM
  88. $i "Confirm the tarball contains a VERSION file containing '3'"
  89. $t cat $(APP)/.erlang.mk/VERSION | grep -q ^3$$
  90. $i "Confirm the tarball contains a valid metadata.config file"
  91. $t $(ERL) -eval " \
  92. {ok, _} = file:consult(\"$(APP)/.erlang.mk/metadata.config\"), \
  93. halt(0)"
  94. $i "Confirm the tarball contains a contents.tar.gz file that can be extracted"
  95. $t cd $(APP)/.erlang.mk/ && tar xf contents.tar.gz
  96. $i "Confirm contents.tar.gz contains the expected files"
  97. $t printf "%s\n" \
  98. erlang.mk \
  99. Makefile \
  100. ebin/$(APP).app \
  101. src/$(APP)_app.erl \
  102. src/$(APP)_sup.erl | sort > $(APP)/.erlang.mk/EXPECT
  103. $t cd $(APP)/.erlang.mk/ && tar tf contents.tar.gz | sort | diff EXPECT -
  104. hex-tarball-create-with-deps: init
  105. $i "Bootstrap a new OTP application named $(APP)"
  106. $t mkdir $(APP)/
  107. $t cp ../erlang.mk $(APP)/
  108. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  109. $i "Add Cowlib to the list of dependencies"
  110. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.10.1\n"}' $(APP)/Makefile
  111. ifdef LEGACY
  112. $i "Add Cowlib to the applications key in the .app.src file"
  113. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  114. endif
  115. $i "Create a release tarball"
  116. $t $(MAKE) -C $(APP) hex-tarball-create $v
  117. $i "Confirm the tarball contents can be extracted"
  118. $t cd $(APP)/.erlang.mk/ && tar xf $(APP).tar
  119. $i "Confirm the tarball contains a metadata.config file that lists Cowlib as requirement"
  120. $t $(ERL) -eval " \
  121. {ok, Metadata} = file:consult(\"$(APP)/.erlang.mk/metadata.config\"), \
  122. {_, [{<<\"cowlib\">>, Cowlib}]} = lists:keyfind(<<\"requirements\">>, 1, Metadata), \
  123. {_, <<\"cowlib\">>} = lists:keyfind(<<\"app\">>, 1, Cowlib), \
  124. {_, false} = lists:keyfind(<<\"optional\">>, 1, Cowlib), \
  125. {_, <<\"2.10.1\">>} = lists:keyfind(<<\"requirement\">>, 1, Cowlib), \
  126. halt(0)"
  127. hex-release-publish: init
  128. $i "Bootstrap a new OTP application named $(APP)"
  129. $t mkdir $(APP)/
  130. $t cp ../erlang.mk $(APP)/
  131. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  132. $i "Configure a local Hex provider"
  133. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  134. $i "Add extra Hex metadata"
  135. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  136. $i "Create a Hex user"
  137. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  138. $i "Create a key for that user"
  139. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  140. $i "Publish the release"
  141. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  142. $i "Check that the release exists"
  143. $t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 >/dev/null
  144. hex-release-publish-with-deps: init
  145. $i "Bootstrap a new OTP application named $(APP)"
  146. $t mkdir $(APP)/
  147. $t cp ../erlang.mk $(APP)/
  148. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  149. $i "Add Cowlib to the list of dependencies"
  150. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = 2.10.1\n"}' $(APP)/Makefile
  151. ifdef LEGACY
  152. $i "Add Cowlib to the applications key in the .app.src file"
  153. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  154. endif
  155. $i "Build the application"
  156. $t $(MAKE) -C $(APP) $v
  157. $i "Configure a local Hex provider for Cowlib"
  158. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/deps/cowlib/Makefile
  159. $i "Configure a local Hex provider"
  160. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  161. $i "Add extra Hex metadata"
  162. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  163. $i "Create a Hex user"
  164. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  165. $i "Create a key for that user"
  166. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  167. $i "Publish the Cowlib release"
  168. $t $(MAKE) -C $(APP)/deps/cowlib hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  169. $i "Publish the release"
  170. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  171. $i "Check that the release exists and includes Cowlib as requirement"
  172. $t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 | grep -q cowlib
  173. hex-release-replace: init
  174. $i "Bootstrap a new OTP application named $(APP)"
  175. $t mkdir $(APP)/
  176. $t cp ../erlang.mk $(APP)/
  177. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  178. $i "Configure a local Hex provider"
  179. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  180. $i "Add extra Hex metadata"
  181. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  182. $i "Create a Hex user"
  183. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  184. $i "Create a key for that user"
  185. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  186. $i "Publish the release"
  187. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  188. $i "Update the project description"
  189. $t sed -i.bak s/"PROJECT_DESCRIPTION = New project"/"PROJECT_DESCRIPTION = Best project"/ $(APP)/Makefile
  190. $i "Publish the release again, replacing the existing one"
  191. $t $(MAKE) -C $(APP) hex-release-replace HEX_SECRET=`cat $(APP)/hex.key` $v
  192. $i "Check that the release was replaced"
  193. $t curl -sf http://localhost:4000/api/packages/$(APP) | grep -q "Best project"
  194. hex-release-delete: init
  195. $i "Bootstrap a new OTP application named $(APP)"
  196. $t mkdir $(APP)/
  197. $t cp ../erlang.mk $(APP)/
  198. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  199. $i "Configure a local Hex provider"
  200. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  201. $i "Add extra Hex metadata"
  202. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  203. $i "Create a Hex user"
  204. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  205. $i "Create a key for that user"
  206. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  207. $i "Publish the release"
  208. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  209. $i "Delete the release"
  210. $t $(MAKE) -C $(APP) hex-release-delete HEX_SECRET=`cat $(APP)/hex.key` $v
  211. $i "Check that the release was deleted"
  212. $t ! curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 >/dev/null
  213. hex-release-retire: init
  214. $i "Bootstrap a new OTP application named $(APP)"
  215. $t mkdir $(APP)/
  216. $t cp ../erlang.mk $(APP)/
  217. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  218. $i "Configure a local Hex provider"
  219. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  220. $i "Add extra Hex metadata"
  221. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  222. $i "Create a Hex user"
  223. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  224. $i "Create a key for that user"
  225. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  226. $i "Publish the release"
  227. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  228. $i "Retire the release"
  229. $t $(MAKE) -C $(APP) hex-release-retire HEX_SECRET=`cat $(APP)/hex.key` $v
  230. $i "Check that the release was retired"
  231. $t ! curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 | grep -q \"retirement\":null
  232. hex-release-unretire: init
  233. $i "Bootstrap a new OTP application named $(APP)"
  234. $t mkdir $(APP)/
  235. $t cp ../erlang.mk $(APP)/
  236. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  237. $i "Configure a local Hex provider"
  238. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  239. $i "Add extra Hex metadata"
  240. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  241. $i "Create a Hex user"
  242. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  243. $i "Create a key for that user"
  244. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  245. $i "Publish the release"
  246. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  247. $i "Retire the release"
  248. $t $(MAKE) -C $(APP) hex-release-retire HEX_SECRET=`cat $(APP)/hex.key` $v
  249. $i "Unretire the release"
  250. $t $(MAKE) -C $(APP) hex-release-unretire HEX_SECRET=`cat $(APP)/hex.key` $v
  251. $i "Check that the release is no longer retired"
  252. $t curl -sf http://localhost:4000/api/packages/$(APP)/releases/0.1.0 | grep -q \"retirement\":null
  253. hex-docs-tarball-create: init
  254. $i "Bootstrap a new OTP application named $(APP)"
  255. $t mkdir $(APP)/
  256. $t cp ../erlang.mk $(APP)/
  257. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  258. $i "Generate a doc/overview.edoc file"
  259. $t mkdir $(APP)/doc
  260. $t printf "%s\n" \
  261. "@author R. J. Hacker <rjh@acme.com>" \
  262. "@copyright 2007 R. J. Hacker" \
  263. "@version 1.0.0" \
  264. "@title Welcome to the 'frob' application!" \
  265. "@doc 'frob' is a highly advanced frobnicator with low latency," > $(APP)/doc/overview.edoc
  266. $i "Create a docs tarball"
  267. $t $(MAKE) -C $(APP) hex-docs-tarball-create $v
  268. $i "Confirm the tarball contents can be extracted"
  269. $t cd $(APP)/.erlang.mk/ && tar xf $(APP)-docs.tar.gz
  270. $i "Confirm the tarball contains the expected files"
  271. $t printf "%s\n" \
  272. edoc-info \
  273. erlang.png \
  274. index.html \
  275. modules-frame.html \
  276. overview-summary.html \
  277. overview.edoc \
  278. stylesheet.css \
  279. $(APP)_app.html \
  280. $(APP)_sup.html | sort > $(APP)/.erlang.mk/EXPECT
  281. $t cd $(APP)/.erlang.mk/ && tar tf $(APP)-docs.tar.gz | sort | diff EXPECT -
  282. hex-docs-publish: init
  283. $i "Bootstrap a new OTP application named $(APP)"
  284. $t mkdir $(APP)/
  285. $t cp ../erlang.mk $(APP)/
  286. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  287. $i "Generate a doc/overview.edoc file"
  288. $t mkdir $(APP)/doc
  289. $t printf "%s\n" \
  290. "@author R. J. Hacker <rjh@acme.com>" \
  291. "@copyright 2007 R. J. Hacker" \
  292. "@version 1.0.0" \
  293. "@title Welcome to the 'frob' application!" \
  294. "@doc 'frob' is a highly advanced frobnicator with low latency," > $(APP)/doc/overview.edoc
  295. $i "Configure a local Hex provider"
  296. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  297. $i "Add extra Hex metadata"
  298. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  299. $i "Create a Hex user"
  300. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  301. $i "Create a key for that user"
  302. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  303. $i "Publish the release"
  304. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  305. $i "Publish the documentation for the release"
  306. $t $(MAKE) -C $(APP) hex-docs-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  307. # @todo hex-docs-publish when there are no docs
  308. hex-docs-delete: init
  309. $i "Bootstrap a new OTP application named $(APP)"
  310. $t mkdir $(APP)/
  311. $t cp ../erlang.mk $(APP)/
  312. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  313. $i "Generate a doc/overview.edoc file"
  314. $t mkdir $(APP)/doc
  315. $t printf "%s\n" \
  316. "@author R. J. Hacker <rjh@acme.com>" \
  317. "@copyright 2007 R. J. Hacker" \
  318. "@version 1.0.0" \
  319. "@title Welcome to the 'frob' application!" \
  320. "@doc 'frob' is a highly advanced frobnicator with low latency," > $(APP)/doc/overview.edoc
  321. $i "Configure a local Hex provider"
  322. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_CONFIG\n#{api_url => <<\"http://localhost:4000/api\">>}\nendef\n"}' $(APP)/Makefile
  323. $i "Add extra Hex metadata"
  324. $t perl -ni.bak -e 'print;if ($$.==1) {print "define HEX_TARBALL_EXTRA_METADATA\n#{licenses => [<<\"ISC\">>]}\nendef\n"}' $(APP)/Makefile
  325. $i "Create a Hex user"
  326. $t $(MAKE) -C $(APP) hex-user-create HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" HEX_EMAIL=$(APP)@noone.nope $v
  327. $i "Create a key for that user"
  328. $t $(MAKE) -C $(APP) hex-key-add HEX_USERNAME=$(APP) HEX_PASSWORD="1234567" | grep ^Secret: | cut -f2 -d" " > $(APP)/hex.key
  329. $i "Publish the release"
  330. $t $(MAKE) -C $(APP) hex-release-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  331. $i "Publish the documentation for the release"
  332. $t $(MAKE) -C $(APP) hex-docs-publish HEX_SECRET=`cat $(APP)/hex.key` $v
  333. $i "Delete the documentation for the release"
  334. $t $(MAKE) -C $(APP) hex-docs-delete HEX_SECRET=`cat $(APP)/hex.key` $v
  335. endif