chef 11.10.0.rc.0 → 11.10.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (401) hide show
  1. data/Rakefile +0 -75
  2. data/distro/common/html/_sources/ctl_chef_client.txt +36 -0
  3. data/distro/common/html/_sources/ctl_chef_server.txt +26 -0
  4. data/distro/common/html/_sources/ctl_chef_shell.txt +15 -0
  5. data/distro/common/html/_sources/ctl_chef_solo.txt +25 -0
  6. data/distro/common/html/_sources/index.txt +126 -0
  7. data/distro/common/html/_sources/knife.txt +74 -0
  8. data/distro/common/html/_sources/knife_bootstrap.txt +56 -0
  9. data/distro/common/html/_sources/knife_client.txt +151 -0
  10. data/distro/common/html/_sources/knife_common_options.txt +6 -0
  11. data/distro/common/html/_sources/knife_configure.txt +29 -0
  12. data/distro/common/html/_sources/knife_cookbook.txt +236 -0
  13. data/distro/common/html/_sources/knife_cookbook_site.txt +157 -0
  14. data/distro/common/html/_sources/knife_data_bag.txt +160 -0
  15. data/distro/common/html/_sources/knife_delete.txt +26 -0
  16. data/distro/common/html/_sources/knife_deps.txt +61 -0
  17. data/distro/common/html/_sources/knife_diff.txt +34 -0
  18. data/distro/common/html/_sources/knife_download.txt +44 -0
  19. data/distro/common/html/_sources/knife_edit.txt +26 -0
  20. data/distro/common/html/_sources/knife_environment.txt +158 -0
  21. data/distro/common/html/_sources/knife_exec.txt +47 -0
  22. data/distro/common/html/_sources/knife_index_rebuild.txt +21 -0
  23. data/distro/common/html/_sources/knife_list.txt +33 -0
  24. data/distro/common/html/_sources/knife_node.txt +250 -0
  25. data/distro/common/html/_sources/knife_raw.txt +35 -0
  26. data/distro/common/html/_sources/knife_recipe_list.txt +23 -0
  27. data/distro/common/html/_sources/knife_role.txt +157 -0
  28. data/distro/common/html/_sources/knife_search.txt +53 -0
  29. data/distro/common/html/_sources/knife_show.txt +27 -0
  30. data/distro/common/html/_sources/knife_ssh.txt +43 -0
  31. data/distro/common/html/_sources/knife_status.txt +37 -0
  32. data/distro/common/html/_sources/knife_tag.txt +69 -0
  33. data/distro/common/html/_sources/knife_upload.txt +49 -0
  34. data/distro/common/html/_sources/knife_user.txt +127 -0
  35. data/distro/common/html/_sources/knife_using.txt +43 -0
  36. data/distro/common/html/_sources/knife_xargs.txt +30 -0
  37. data/distro/common/html/_static/ajax-loader.gif +0 -0
  38. data/distro/common/html/_static/basic.css +540 -0
  39. data/distro/common/html/_static/chef.css +507 -0
  40. data/distro/common/html/_static/chef.ico +0 -0
  41. data/distro/common/html/_static/chef_html_logo.png +0 -0
  42. data/distro/common/html/_static/chef_logo.png +0 -0
  43. data/distro/common/html/_static/comment-bright.png +0 -0
  44. data/distro/common/html/_static/comment-close.png +0 -0
  45. data/distro/common/html/_static/comment.png +0 -0
  46. data/distro/common/html/_static/contents.png +0 -0
  47. data/distro/common/html/_static/doctools.js +247 -0
  48. data/distro/common/html/_static/down-pressed.png +0 -0
  49. data/distro/common/html/_static/down.png +0 -0
  50. data/distro/common/html/_static/file.png +0 -0
  51. data/distro/common/html/_static/guide.css +505 -0
  52. data/distro/common/html/_static/jquery.js +154 -0
  53. data/distro/common/html/_static/minus.png +0 -0
  54. data/distro/common/html/_static/navigation.png +0 -0
  55. data/distro/common/html/_static/plus.png +0 -0
  56. data/distro/common/html/_static/pygments.css +62 -0
  57. data/distro/common/html/_static/searchtools.js +560 -0
  58. data/distro/common/html/_static/underscore.js +23 -0
  59. data/distro/common/html/_static/up-pressed.png +0 -0
  60. data/distro/common/html/_static/up.png +0 -0
  61. data/distro/common/html/_static/websupport.js +808 -0
  62. data/distro/common/html/ctl_chef_client.html +219 -0
  63. data/distro/common/html/ctl_chef_server.html +111 -0
  64. data/distro/common/html/ctl_chef_shell.html +120 -0
  65. data/distro/common/html/ctl_chef_solo.html +144 -0
  66. data/distro/common/html/index.html +185 -0
  67. data/distro/common/html/knife.html +172 -0
  68. data/distro/common/html/knife_bootstrap.html +250 -0
  69. data/distro/common/html/knife_client.html +283 -0
  70. data/distro/common/html/knife_common_options.html +98 -0
  71. data/distro/common/html/knife_configure.html +107 -0
  72. data/distro/common/html/knife_cookbook.html +481 -0
  73. data/distro/common/html/knife_cookbook_site.html +372 -0
  74. data/distro/common/html/knife_data_bag.html +359 -0
  75. data/distro/common/html/knife_delete.html +95 -0
  76. data/distro/common/html/knife_deps.html +145 -0
  77. data/distro/common/html/knife_diff.html +125 -0
  78. data/distro/common/html/knife_download.html +147 -0
  79. data/distro/common/html/knife_edit.html +91 -0
  80. data/distro/common/html/knife_environment.html +328 -0
  81. data/distro/common/html/knife_exec.html +222 -0
  82. data/distro/common/html/knife_index_rebuild.html +85 -0
  83. data/distro/common/html/knife_list.html +116 -0
  84. data/distro/common/html/knife_node.html +450 -0
  85. data/distro/common/html/knife_raw.html +112 -0
  86. data/distro/common/html/knife_recipe_list.html +93 -0
  87. data/distro/common/html/knife_role.html +295 -0
  88. data/distro/common/html/knife_search.html +204 -0
  89. data/distro/common/html/knife_show.html +106 -0
  90. data/distro/common/html/knife_ssh.html +179 -0
  91. data/distro/common/html/knife_status.html +142 -0
  92. data/distro/common/html/knife_tag.html +140 -0
  93. data/distro/common/html/knife_upload.html +155 -0
  94. data/distro/common/html/knife_user.html +244 -0
  95. data/distro/common/html/knife_using.html +211 -0
  96. data/distro/common/html/knife_xargs.html +115 -0
  97. data/distro/common/html/objects.inv +0 -0
  98. data/distro/common/html/search.html +84 -0
  99. data/distro/common/html/searchindex.js +1 -0
  100. data/distro/common/man/man1/chef-shell.1 +5 -5
  101. data/distro/common/man/man1/knife-bootstrap.1 +6 -9
  102. data/distro/common/man/man1/knife-client.1 +1 -9
  103. data/distro/common/man/man1/knife-configure.1 +10 -6
  104. data/distro/common/man/man1/knife-cookbook-site.1 +1 -9
  105. data/distro/common/man/man1/knife-cookbook.1 +11 -21
  106. data/distro/common/man/man1/knife-data-bag.1 +8 -22
  107. data/distro/common/man/man1/knife-delete.1 +1 -1
  108. data/distro/common/man/man1/knife-deps.1 +4 -12
  109. data/distro/common/man/man1/knife-diff.1 +1 -1
  110. data/distro/common/man/man1/knife-download.1 +2 -2
  111. data/distro/common/man/man1/knife-edit.1 +1 -1
  112. data/distro/common/man/man1/knife-environment.1 +108 -9
  113. data/distro/common/man/man1/knife-exec.1 +1 -15
  114. data/distro/common/man/man1/knife-index-rebuild.1 +1 -1
  115. data/distro/common/man/man1/knife-list.1 +1 -1
  116. data/distro/common/man/man1/knife-node.1 +3 -13
  117. data/distro/common/man/man1/knife-raw.1 +1 -1
  118. data/distro/common/man/man1/knife-recipe-list.1 +1 -1
  119. data/distro/common/man/man1/knife-role.1 +2 -12
  120. data/distro/common/man/man1/knife-search.1 +5 -5
  121. data/distro/common/man/man1/knife-show.1 +1 -3
  122. data/distro/common/man/man1/knife-ssh.1 +1 -5
  123. data/distro/common/man/man1/knife-status.1 +1 -1
  124. data/distro/common/man/man1/knife-tag.1 +1 -9
  125. data/distro/common/man/man1/knife-upload.1 +7 -9
  126. data/distro/common/man/man1/knife-user.1 +3 -17
  127. data/distro/common/man/man1/knife-xargs.1 +1 -3
  128. data/distro/common/man/man8/chef-client.8 +18 -18
  129. data/distro/common/man/man8/chef-solo.8 +12 -6
  130. data/lib/chef/client.rb +9 -5
  131. data/lib/chef/cookbook_uploader.rb +1 -1
  132. data/lib/chef/dsl/recipe.rb +119 -38
  133. data/lib/chef/exceptions.rb +4 -0
  134. data/lib/chef/policy_builder/expand_node_object.rb +11 -4
  135. data/lib/chef/policy_builder/policyfile.rb +7 -1
  136. data/lib/chef/provider/file.rb +1 -0
  137. data/lib/chef/resource_platform_map.rb +1 -1
  138. data/lib/chef/resource_reporter.rb +2 -2
  139. data/lib/chef/version.rb +1 -1
  140. data/spec/functional/knife/cookbook_delete_spec.rb +9 -9
  141. data/spec/functional/knife/ssh_spec.rb +1 -1
  142. data/spec/functional/resource/link_spec.rb +6 -6
  143. data/spec/functional/resource/registry_spec.rb +7 -7
  144. data/spec/functional/run_lock_spec.rb +1 -1
  145. data/spec/integration/knife/download_spec.rb +1 -1
  146. data/spec/integration/solo/solo_spec.rb +1 -1
  147. data/spec/spec_helper.rb +0 -1
  148. data/spec/stress/win32/file_spec.rb +6 -0
  149. data/spec/support/lib/chef/resource/zen_master.rb +1 -1
  150. data/spec/support/mock/platform.rb +1 -1
  151. data/spec/support/shared/functional/file_resource.rb +0 -2
  152. data/spec/support/shared/functional/securable_resource.rb +2 -2
  153. data/spec/support/shared/unit/api_error_inspector.rb +7 -7
  154. data/spec/support/shared/unit/provider/file.rb +47 -8
  155. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +23 -23
  156. data/spec/unit/api_client/registration_spec.rb +5 -5
  157. data/spec/unit/api_client_spec.rb +2 -2
  158. data/spec/unit/application/apply.rb +6 -6
  159. data/spec/unit/application/client_spec.rb +6 -6
  160. data/spec/unit/application/knife_spec.rb +5 -5
  161. data/spec/unit/application/solo_spec.rb +13 -13
  162. data/spec/unit/application_spec.rb +19 -19
  163. data/spec/unit/checksum/storage/filesystem_spec.rb +2 -2
  164. data/spec/unit/client_spec.rb +23 -23
  165. data/spec/unit/config_spec.rb +4 -4
  166. data/spec/unit/cookbook/metadata_spec.rb +22 -22
  167. data/spec/unit/cookbook/synchronizer_spec.rb +17 -17
  168. data/spec/unit/daemon_spec.rb +21 -22
  169. data/spec/unit/data_bag_item_spec.rb +8 -8
  170. data/spec/unit/data_bag_spec.rb +6 -6
  171. data/spec/unit/deprecation_spec.rb +1 -1
  172. data/spec/unit/dsl/data_query_spec.rb +1 -1
  173. data/spec/unit/environment_spec.rb +5 -5
  174. data/spec/unit/file_access_control_spec.rb +5 -5
  175. data/spec/unit/file_cache_spec.rb +1 -1
  176. data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +1 -1
  177. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +12 -12
  178. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +4 -4
  179. data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +4 -4
  180. data/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +1 -1
  181. data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +6 -6
  182. data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +4 -4
  183. data/spec/unit/handler/json_file_spec.rb +1 -1
  184. data/spec/unit/handler_spec.rb +3 -3
  185. data/spec/unit/knife/bootstrap_spec.rb +17 -17
  186. data/spec/unit/knife/client_bulk_delete_spec.rb +4 -4
  187. data/spec/unit/knife/client_create_spec.rb +7 -7
  188. data/spec/unit/knife/client_reregister_spec.rb +2 -2
  189. data/spec/unit/knife/client_show_spec.rb +1 -1
  190. data/spec/unit/knife/config_file_selection_spec.rb +4 -4
  191. data/spec/unit/knife/configure_client_spec.rb +4 -4
  192. data/spec/unit/knife/configure_spec.rb +16 -16
  193. data/spec/unit/knife/cookbook_bulk_delete_spec.rb +10 -10
  194. data/spec/unit/knife/cookbook_create_spec.rb +5 -5
  195. data/spec/unit/knife/cookbook_delete_spec.rb +6 -6
  196. data/spec/unit/knife/cookbook_download_spec.rb +10 -10
  197. data/spec/unit/knife/cookbook_list_spec.rb +3 -3
  198. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +2 -2
  199. data/spec/unit/knife/cookbook_metadata_spec.rb +8 -8
  200. data/spec/unit/knife/cookbook_show_spec.rb +4 -4
  201. data/spec/unit/knife/cookbook_site_download_spec.rb +3 -3
  202. data/spec/unit/knife/cookbook_site_install_spec.rb +8 -8
  203. data/spec/unit/knife/cookbook_site_share_spec.rb +22 -22
  204. data/spec/unit/knife/cookbook_site_unshare_spec.rb +8 -8
  205. data/spec/unit/knife/cookbook_test_spec.rb +7 -7
  206. data/spec/unit/knife/cookbook_upload_spec.rb +20 -20
  207. data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +6 -6
  208. data/spec/unit/knife/core/object_loader_spec.rb +1 -1
  209. data/spec/unit/knife/core/ui_spec.rb +19 -21
  210. data/spec/unit/knife/data_bag_create_spec.rb +4 -4
  211. data/spec/unit/knife/data_bag_edit_spec.rb +7 -7
  212. data/spec/unit/knife/data_bag_from_file_spec.rb +15 -15
  213. data/spec/unit/knife/data_bag_show_spec.rb +5 -5
  214. data/spec/unit/knife/environment_create_spec.rb +6 -6
  215. data/spec/unit/knife/environment_delete_spec.rb +6 -6
  216. data/spec/unit/knife/environment_edit_spec.rb +5 -5
  217. data/spec/unit/knife/environment_from_file_spec.rb +7 -7
  218. data/spec/unit/knife/environment_list_spec.rb +4 -4
  219. data/spec/unit/knife/environment_show_spec.rb +4 -4
  220. data/spec/unit/knife/index_rebuild_spec.rb +2 -2
  221. data/spec/unit/knife/knife_help.rb +11 -11
  222. data/spec/unit/knife/node_bulk_delete_spec.rb +4 -4
  223. data/spec/unit/knife/node_delete_spec.rb +5 -5
  224. data/spec/unit/knife/node_edit_spec.rb +2 -2
  225. data/spec/unit/knife/node_from_file_spec.rb +5 -5
  226. data/spec/unit/knife/node_list_spec.rb +3 -3
  227. data/spec/unit/knife/node_run_list_add_spec.rb +3 -3
  228. data/spec/unit/knife/node_run_list_remove_spec.rb +4 -4
  229. data/spec/unit/knife/node_run_list_set_spec.rb +5 -5
  230. data/spec/unit/knife/node_show_spec.rb +2 -2
  231. data/spec/unit/knife/role_bulk_delete_spec.rb +4 -4
  232. data/spec/unit/knife/role_create_spec.rb +5 -5
  233. data/spec/unit/knife/role_delete_spec.rb +5 -5
  234. data/spec/unit/knife/role_edit_spec.rb +5 -5
  235. data/spec/unit/knife/role_from_file_spec.rb +5 -5
  236. data/spec/unit/knife/role_list_spec.rb +2 -2
  237. data/spec/unit/knife/ssh_spec.rb +6 -6
  238. data/spec/unit/knife/status_spec.rb +4 -4
  239. data/spec/unit/knife/tag_create_spec.rb +3 -3
  240. data/spec/unit/knife/tag_delete_spec.rb +3 -3
  241. data/spec/unit/knife/tag_list_spec.rb +2 -2
  242. data/spec/unit/knife/user_create_spec.rb +7 -7
  243. data/spec/unit/knife/user_reregister_spec.rb +3 -3
  244. data/spec/unit/knife/user_show_spec.rb +1 -1
  245. data/spec/unit/knife_spec.rb +29 -29
  246. data/spec/unit/lwrp_spec.rb +2 -2
  247. data/spec/unit/mixin/checksum_spec.rb +2 -2
  248. data/spec/unit/mixin/command_spec.rb +1 -1
  249. data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +4 -4
  250. data/spec/unit/mixin/params_validate_spec.rb +17 -17
  251. data/spec/unit/mixin/path_sanity_spec.rb +8 -8
  252. data/spec/unit/mixin/securable_spec.rb +87 -87
  253. data/spec/unit/mixin/shell_out_spec.rb +1 -1
  254. data/spec/unit/mixin/template_spec.rb +2 -2
  255. data/spec/unit/node/attribute_spec.rb +3 -3
  256. data/spec/unit/node_spec.rb +12 -12
  257. data/spec/unit/platform_spec.rb +1 -1
  258. data/spec/unit/policy_builder/expand_node_object_spec.rb +16 -0
  259. data/spec/unit/policy_builder/policyfile_spec.rb +4 -0
  260. data/spec/unit/provider/breakpoint_spec.rb +8 -8
  261. data/spec/unit/provider/cookbook_file/content_spec.rb +4 -4
  262. data/spec/unit/provider/cookbook_file_spec.rb +1 -1
  263. data/spec/unit/provider/cron/unix_spec.rb +11 -11
  264. data/spec/unit/provider/cron_spec.rb +40 -40
  265. data/spec/unit/provider/deploy/revision_spec.rb +11 -12
  266. data/spec/unit/provider/deploy/timestamped_spec.rb +3 -3
  267. data/spec/unit/provider/deploy_spec.rb +50 -50
  268. data/spec/unit/provider/directory_spec.rb +18 -18
  269. data/spec/unit/provider/env_spec.rb +15 -15
  270. data/spec/unit/provider/erl_call_spec.rb +1 -1
  271. data/spec/unit/provider/execute_spec.rb +5 -5
  272. data/spec/unit/provider/file/content_spec.rb +5 -5
  273. data/spec/unit/provider/file_spec.rb +1 -1
  274. data/spec/unit/provider/git_spec.rb +47 -47
  275. data/spec/unit/provider/group/dscl_spec.rb +16 -15
  276. data/spec/unit/provider/group/gpasswd_spec.rb +6 -5
  277. data/spec/unit/provider/group/groupadd_spec.rb +10 -10
  278. data/spec/unit/provider/group/groupmod_spec.rb +3 -3
  279. data/spec/unit/provider/group/pw_spec.rb +9 -8
  280. data/spec/unit/provider/group/usermod_spec.rb +13 -12
  281. data/spec/unit/provider/group/windows_spec.rb +9 -9
  282. data/spec/unit/provider/group_spec.rb +31 -31
  283. data/spec/unit/provider/http_request_spec.rb +3 -3
  284. data/spec/unit/provider/ifconfig/aix_spec.rb +7 -7
  285. data/spec/unit/provider/ifconfig/debian_spec.rb +3 -3
  286. data/spec/unit/provider/ifconfig/redhat_spec.rb +5 -5
  287. data/spec/unit/provider/ifconfig_spec.rb +13 -13
  288. data/spec/unit/provider/link_spec.rb +33 -33
  289. data/spec/unit/provider/mdadm_spec.rb +4 -4
  290. data/spec/unit/provider/mount/aix_spec.rb +5 -5
  291. data/spec/unit/provider/mount/mount_spec.rb +49 -50
  292. data/spec/unit/provider/mount/windows_spec.rb +18 -18
  293. data/spec/unit/provider/mount_spec.rb +12 -12
  294. data/spec/unit/provider/ohai_spec.rb +6 -6
  295. data/spec/unit/provider/package/aix_spec.rb +14 -14
  296. data/spec/unit/provider/package/apt_spec.rb +10 -10
  297. data/spec/unit/provider/package/dpkg_spec.rb +13 -13
  298. data/spec/unit/provider/package/easy_install_spec.rb +6 -6
  299. data/spec/unit/provider/package/freebsd_spec.rb +29 -29
  300. data/spec/unit/provider/package/ips_spec.rb +4 -4
  301. data/spec/unit/provider/package/macports_spec.rb +6 -6
  302. data/spec/unit/provider/package/pacman_spec.rb +17 -17
  303. data/spec/unit/provider/package/portage_spec.rb +18 -18
  304. data/spec/unit/provider/package/rpm_spec.rb +7 -7
  305. data/spec/unit/provider/package/rubygems_spec.rb +31 -31
  306. data/spec/unit/provider/package/smartos_spec.rb +4 -4
  307. data/spec/unit/provider/package/solaris_spec.rb +15 -15
  308. data/spec/unit/provider/package/yum_spec.rb +100 -100
  309. data/spec/unit/provider/package/zypper_spec.rb +10 -10
  310. data/spec/unit/provider/package_spec.rb +21 -21
  311. data/spec/unit/provider/registry_key_spec.rb +2 -2
  312. data/spec/unit/provider/remote_file/content_spec.rb +31 -31
  313. data/spec/unit/provider/remote_file/fetcher_spec.rb +8 -8
  314. data/spec/unit/provider/remote_file/ftp_spec.rb +10 -10
  315. data/spec/unit/provider/remote_file/http_spec.rb +4 -4
  316. data/spec/unit/provider/remote_file/local_file_spec.rb +2 -2
  317. data/spec/unit/provider/remote_file_spec.rb +1 -1
  318. data/spec/unit/provider/route_spec.rb +23 -23
  319. data/spec/unit/provider/script_spec.rb +5 -5
  320. data/spec/unit/provider/service/arch_service_spec.rb +41 -41
  321. data/spec/unit/provider/service/debian_service_spec.rb +23 -23
  322. data/spec/unit/provider/service/freebsd_service_spec.rb +33 -33
  323. data/spec/unit/provider/service/gentoo_service_spec.rb +16 -16
  324. data/spec/unit/provider/service/init_service_spec.rb +13 -13
  325. data/spec/unit/provider/service/insserv_service_spec.rb +4 -4
  326. data/spec/unit/provider/service/invokercd_service_spec.rb +12 -12
  327. data/spec/unit/provider/service/macosx_spec.rb +20 -20
  328. data/spec/unit/provider/service/redhat_spec.rb +15 -15
  329. data/spec/unit/provider/service/simple_service_spec.rb +9 -9
  330. data/spec/unit/provider/service/solaris_smf_service_spec.rb +13 -13
  331. data/spec/unit/provider/service/systemd_service_spec.rb +28 -28
  332. data/spec/unit/provider/service/upstart_service_spec.rb +41 -41
  333. data/spec/unit/provider/service/windows_spec.rb +37 -37
  334. data/spec/unit/provider/service_spec.rb +9 -9
  335. data/spec/unit/provider/subversion_spec.rb +36 -36
  336. data/spec/unit/provider/template/content_spec.rb +8 -8
  337. data/spec/unit/provider/template_spec.rb +1 -1
  338. data/spec/unit/provider/user/dscl_spec.rb +9 -9
  339. data/spec/unit/provider/user/pw_spec.rb +20 -20
  340. data/spec/unit/provider/user/solaris_spec.rb +5 -5
  341. data/spec/unit/provider/user/windows_spec.rb +8 -8
  342. data/spec/unit/provider/user_spec.rb +34 -34
  343. data/spec/unit/provider_spec.rb +3 -3
  344. data/spec/unit/recipe_spec.rb +79 -4
  345. data/spec/unit/registry_helper_spec.rb +2 -2
  346. data/spec/unit/resource/cron_spec.rb +2 -2
  347. data/spec/unit/resource/directory_spec.rb +5 -5
  348. data/spec/unit/resource/env_spec.rb +2 -2
  349. data/spec/unit/resource/erl_call_spec.rb +1 -1
  350. data/spec/unit/resource/file_spec.rb +8 -8
  351. data/spec/unit/resource/group_spec.rb +3 -3
  352. data/spec/unit/resource/link_spec.rb +8 -8
  353. data/spec/unit/resource/mdadm_spec.rb +3 -3
  354. data/spec/unit/resource/mount_spec.rb +3 -3
  355. data/spec/unit/resource/route_spec.rb +2 -2
  356. data/spec/unit/resource/user_spec.rb +2 -2
  357. data/spec/unit/resource/yum_package_spec.rb +2 -2
  358. data/spec/unit/resource_collection_spec.rb +1 -1
  359. data/spec/unit/resource_definition_spec.rb +2 -2
  360. data/spec/unit/resource_reporter_spec.rb +71 -16
  361. data/spec/unit/resource_spec.rb +3 -3
  362. data/spec/unit/rest/auth_credentials_spec.rb +2 -2
  363. data/spec/unit/rest_spec.rb +3 -40
  364. data/spec/unit/run_list/run_list_expansion_spec.rb +3 -3
  365. data/spec/unit/run_list_spec.rb +9 -9
  366. data/spec/unit/run_status_spec.rb +1 -1
  367. data/spec/unit/runner_spec.rb +8 -8
  368. data/spec/unit/scan_access_control_spec.rb +3 -3
  369. data/spec/unit/search/query_spec.rb +7 -7
  370. data/spec/unit/shell/model_wrapper_spec.rb +2 -2
  371. data/spec/unit/shell/shell_ext_spec.rb +15 -15
  372. data/spec/unit/shell/shell_session_spec.rb +9 -9
  373. data/spec/unit/shell_spec.rb +1 -2
  374. data/spec/unit/user_spec.rb +4 -4
  375. data/spec/unit/util/backup_spec.rb +1 -1
  376. data/spec/unit/util/selinux_spec.rb +7 -7
  377. metadata +106 -51
  378. data/distro/common/html/chef-client.8.html +0 -145
  379. data/distro/common/html/chef-expander.8.html +0 -164
  380. data/distro/common/html/chef-expanderctl.8.html +0 -146
  381. data/distro/common/html/chef-server-webui.8.html +0 -185
  382. data/distro/common/html/chef-server.8.html +0 -182
  383. data/distro/common/html/chef-shell.1.html +0 -286
  384. data/distro/common/html/chef-solo.8.html +0 -185
  385. data/distro/common/html/chef-solr.8.html +0 -165
  386. data/distro/common/html/knife-bootstrap.1.html +0 -241
  387. data/distro/common/html/knife-client.1.html +0 -219
  388. data/distro/common/html/knife-configure.1.html +0 -170
  389. data/distro/common/html/knife-cookbook-site.1.html +0 -241
  390. data/distro/common/html/knife-cookbook.1.html +0 -381
  391. data/distro/common/html/knife-data-bag.1.html +0 -235
  392. data/distro/common/html/knife-environment.1.html +0 -265
  393. data/distro/common/html/knife-exec.1.html +0 -134
  394. data/distro/common/html/knife-index.1.html +0 -125
  395. data/distro/common/html/knife-node.1.html +0 -250
  396. data/distro/common/html/knife-role.1.html +0 -200
  397. data/distro/common/html/knife-search.1.html +0 -288
  398. data/distro/common/html/knife-ssh.1.html +0 -156
  399. data/distro/common/html/knife-status.1.html +0 -128
  400. data/distro/common/html/knife-tag.1.html +0 -137
  401. data/distro/common/html/knife.1.html +0 -315
@@ -0,0 +1,23 @@
1
+ // Underscore.js 0.5.5
2
+ // (c) 2009 Jeremy Ashkenas, DocumentCloud Inc.
3
+ // Underscore is freely distributable under the terms of the MIT license.
4
+ // Portions of Underscore are inspired by or borrowed from Prototype.js,
5
+ // Oliver Steele's Functional, and John Resig's Micro-Templating.
6
+ // For all details and documentation:
7
+ // http://documentcloud.github.com/underscore/
8
+ (function(){var j=this,n=j._,i=function(a){this._wrapped=a},m=typeof StopIteration!=="undefined"?StopIteration:"__break__",b=j._=function(a){return new i(a)};if(typeof exports!=="undefined")exports._=b;var k=Array.prototype.slice,o=Array.prototype.unshift,p=Object.prototype.toString,q=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;b.VERSION="0.5.5";b.each=function(a,c,d){try{if(a.forEach)a.forEach(c,d);else if(b.isArray(a)||b.isArguments(a))for(var e=0,f=a.length;e<f;e++)c.call(d,
9
+ a[e],e,a);else{var g=b.keys(a);f=g.length;for(e=0;e<f;e++)c.call(d,a[g[e]],g[e],a)}}catch(h){if(h!=m)throw h;}return a};b.map=function(a,c,d){if(a&&b.isFunction(a.map))return a.map(c,d);var e=[];b.each(a,function(f,g,h){e.push(c.call(d,f,g,h))});return e};b.reduce=function(a,c,d,e){if(a&&b.isFunction(a.reduce))return a.reduce(b.bind(d,e),c);b.each(a,function(f,g,h){c=d.call(e,c,f,g,h)});return c};b.reduceRight=function(a,c,d,e){if(a&&b.isFunction(a.reduceRight))return a.reduceRight(b.bind(d,e),c);
10
+ var f=b.clone(b.toArray(a)).reverse();b.each(f,function(g,h){c=d.call(e,c,g,h,a)});return c};b.detect=function(a,c,d){var e;b.each(a,function(f,g,h){if(c.call(d,f,g,h)){e=f;b.breakLoop()}});return e};b.select=function(a,c,d){if(a&&b.isFunction(a.filter))return a.filter(c,d);var e=[];b.each(a,function(f,g,h){c.call(d,f,g,h)&&e.push(f)});return e};b.reject=function(a,c,d){var e=[];b.each(a,function(f,g,h){!c.call(d,f,g,h)&&e.push(f)});return e};b.all=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.every))return a.every(c,
11
+ d);var e=true;b.each(a,function(f,g,h){(e=e&&c.call(d,f,g,h))||b.breakLoop()});return e};b.any=function(a,c,d){c=c||b.identity;if(a&&b.isFunction(a.some))return a.some(c,d);var e=false;b.each(a,function(f,g,h){if(e=c.call(d,f,g,h))b.breakLoop()});return e};b.include=function(a,c){if(b.isArray(a))return b.indexOf(a,c)!=-1;var d=false;b.each(a,function(e){if(d=e===c)b.breakLoop()});return d};b.invoke=function(a,c){var d=b.rest(arguments,2);return b.map(a,function(e){return(c?e[c]:e).apply(e,d)})};b.pluck=
12
+ function(a,c){return b.map(a,function(d){return d[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g>=e.computed&&(e={value:f,computed:g})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};b.each(a,function(f,g,h){g=c?c.call(d,f,g,h):f;g<e.computed&&(e={value:f,computed:g})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,
13
+ function(e,f,g){return{value:e,criteria:c.call(d,e,f,g)}}).sort(function(e,f){e=e.criteria;f=f.criteria;return e<f?-1:e>f?1:0}),"value")};b.sortedIndex=function(a,c,d){d=d||b.identity;for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?(e=g+1):(f=g)}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return a;if(b.isArguments(a))return k.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=function(a,c,d){return c&&!d?k.call(a,
14
+ 0,c):a[0]};b.rest=function(a,c,d){return k.call(a,b.isUndefined(c)||d?1:c)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.select(a,function(c){return!!c})};b.flatten=function(a){return b.reduce(a,[],function(c,d){if(b.isArray(d))return c.concat(b.flatten(d));c.push(d);return c})};b.without=function(a){var c=b.rest(arguments);return b.select(a,function(d){return!b.include(c,d)})};b.uniq=function(a,c){return b.reduce(a,[],function(d,e,f){if(0==f||(c===true?b.last(d)!=e:!b.include(d,
15
+ e)))d.push(e);return d})};b.intersect=function(a){var c=b.rest(arguments);return b.select(b.uniq(a),function(d){return b.all(c,function(e){return b.indexOf(e,d)>=0})})};b.zip=function(){for(var a=b.toArray(arguments),c=b.max(b.pluck(a,"length")),d=new Array(c),e=0;e<c;e++)d[e]=b.pluck(a,String(e));return d};b.indexOf=function(a,c){if(a.indexOf)return a.indexOf(c);for(var d=0,e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,c){if(a.lastIndexOf)return a.lastIndexOf(c);for(var d=
16
+ a.length;d--;)if(a[d]===c)return d;return-1};b.range=function(a,c,d){var e=b.toArray(arguments),f=e.length<=1;a=f?0:e[0];c=f?e[0]:e[1];d=e[2]||1;e=Math.ceil((c-a)/d);if(e<=0)return[];e=new Array(e);f=a;for(var g=0;1;f+=d){if((d>0?f-c:c-f)>=0)return e;e[g++]=f}};b.bind=function(a,c){var d=b.rest(arguments,2);return function(){return a.apply(c||j,d.concat(b.toArray(arguments)))}};b.bindAll=function(a){var c=b.rest(arguments);if(c.length==0)c=b.functions(a);b.each(c,function(d){a[d]=b.bind(a[d],a)});
17
+ return a};b.delay=function(a,c){var d=b.rest(arguments,2);return setTimeout(function(){return a.apply(a,d)},c)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(b.rest(arguments)))};b.wrap=function(a,c){return function(){var d=[a].concat(b.toArray(arguments));return c.apply(c,d)}};b.compose=function(){var a=b.toArray(arguments);return function(){for(var c=b.toArray(arguments),d=a.length-1;d>=0;d--)c=[a[d].apply(this,c)];return c[0]}};b.keys=function(a){if(b.isArray(a))return b.range(0,a.length);
18
+ var c=[];for(var d in a)q.call(a,d)&&c.push(d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=function(a){return b.select(b.keys(a),function(c){return b.isFunction(a[c])}).sort()};b.extend=function(a,c){for(var d in c)a[d]=c[d];return a};b.clone=function(a){if(b.isArray(a))return a.slice(0);return b.extend({},a)};b.tap=function(a,c){c(a);return a};b.isEqual=function(a,c){if(a===c)return true;var d=typeof a;if(d!=typeof c)return false;if(a==c)return true;if(!a&&c||a&&!c)return false;
19
+ if(a.isEqual)return a.isEqual(c);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return true;if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return false;if(a.length&&a.length!==c.length)return false;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return false;for(var f in a)if(!b.isEqual(a[f],c[f]))return false;return true};b.isEmpty=function(a){return b.keys(a).length==
20
+ 0};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=function(a){return!!(a&&a.concat&&a.unshift)};b.isArguments=function(a){return a&&b.isNumber(a.length)&&!b.isArray(a)&&!r.call(a,"length")};b.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return p.call(a)==="[object Number]"};b.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)};b.isRegExp=function(a){return!!(a&&
21
+ a.test&&a.exec&&(a.ignoreCase||a.ignoreCase===false))};b.isNaN=function(a){return b.isNumber(a)&&isNaN(a)};b.isNull=function(a){return a===null};b.isUndefined=function(a){return typeof a=="undefined"};b.noConflict=function(){j._=n;return this};b.identity=function(a){return a};b.breakLoop=function(){throw m;};var s=0;b.uniqueId=function(a){var c=s++;return a?a+c:c};b.template=function(a,c){a=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g,
22
+ " ").replace(/'(?=[^%]*%>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g,"',$1,'").split("<%").join("');").split("%>").join("p.push('")+"');}return p.join('');");return c?a(c):a};b.forEach=b.each;b.foldl=b.inject=b.reduce;b.foldr=b.reduceRight;b.filter=b.select;b.every=b.all;b.some=b.any;b.head=b.first;b.tail=b.rest;b.methods=b.functions;var l=function(a,c){return c?b(a).chain():a};b.each(b.functions(b),function(a){var c=b[a];i.prototype[a]=function(){var d=b.toArray(arguments);
23
+ o.call(d,this._wrapped);return l(c.apply(b,d),this._chain)}});b.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){c.apply(this._wrapped,arguments);return l(this._wrapped,this._chain)}});b.each(["concat","join","slice"],function(a){var c=Array.prototype[a];i.prototype[a]=function(){return l(c.apply(this._wrapped,arguments),this._chain)}});i.prototype.chain=function(){this._chain=true;return this};i.prototype.value=function(){return this._wrapped}})();
@@ -0,0 +1,808 @@
1
+ /*
2
+ * websupport.js
3
+ * ~~~~~~~~~~~~~
4
+ *
5
+ * sphinx.websupport utilties for all documentation.
6
+ *
7
+ * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
8
+ * :license: BSD, see LICENSE for details.
9
+ *
10
+ */
11
+
12
+ (function($) {
13
+ $.fn.autogrow = function() {
14
+ return this.each(function() {
15
+ var textarea = this;
16
+
17
+ $.fn.autogrow.resize(textarea);
18
+
19
+ $(textarea)
20
+ .focus(function() {
21
+ textarea.interval = setInterval(function() {
22
+ $.fn.autogrow.resize(textarea);
23
+ }, 500);
24
+ })
25
+ .blur(function() {
26
+ clearInterval(textarea.interval);
27
+ });
28
+ });
29
+ };
30
+
31
+ $.fn.autogrow.resize = function(textarea) {
32
+ var lineHeight = parseInt($(textarea).css('line-height'), 10);
33
+ var lines = textarea.value.split('\n');
34
+ var columns = textarea.cols;
35
+ var lineCount = 0;
36
+ $.each(lines, function() {
37
+ lineCount += Math.ceil(this.length / columns) || 1;
38
+ });
39
+ var height = lineHeight * (lineCount + 1);
40
+ $(textarea).css('height', height);
41
+ };
42
+ })(jQuery);
43
+
44
+ (function($) {
45
+ var comp, by;
46
+
47
+ function init() {
48
+ initEvents();
49
+ initComparator();
50
+ }
51
+
52
+ function initEvents() {
53
+ $('a.comment-close').live("click", function(event) {
54
+ event.preventDefault();
55
+ hide($(this).attr('id').substring(2));
56
+ });
57
+ $('a.vote').live("click", function(event) {
58
+ event.preventDefault();
59
+ handleVote($(this));
60
+ });
61
+ $('a.reply').live("click", function(event) {
62
+ event.preventDefault();
63
+ openReply($(this).attr('id').substring(2));
64
+ });
65
+ $('a.close-reply').live("click", function(event) {
66
+ event.preventDefault();
67
+ closeReply($(this).attr('id').substring(2));
68
+ });
69
+ $('a.sort-option').live("click", function(event) {
70
+ event.preventDefault();
71
+ handleReSort($(this));
72
+ });
73
+ $('a.show-proposal').live("click", function(event) {
74
+ event.preventDefault();
75
+ showProposal($(this).attr('id').substring(2));
76
+ });
77
+ $('a.hide-proposal').live("click", function(event) {
78
+ event.preventDefault();
79
+ hideProposal($(this).attr('id').substring(2));
80
+ });
81
+ $('a.show-propose-change').live("click", function(event) {
82
+ event.preventDefault();
83
+ showProposeChange($(this).attr('id').substring(2));
84
+ });
85
+ $('a.hide-propose-change').live("click", function(event) {
86
+ event.preventDefault();
87
+ hideProposeChange($(this).attr('id').substring(2));
88
+ });
89
+ $('a.accept-comment').live("click", function(event) {
90
+ event.preventDefault();
91
+ acceptComment($(this).attr('id').substring(2));
92
+ });
93
+ $('a.delete-comment').live("click", function(event) {
94
+ event.preventDefault();
95
+ deleteComment($(this).attr('id').substring(2));
96
+ });
97
+ $('a.comment-markup').live("click", function(event) {
98
+ event.preventDefault();
99
+ toggleCommentMarkupBox($(this).attr('id').substring(2));
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Set comp, which is a comparator function used for sorting and
105
+ * inserting comments into the list.
106
+ */
107
+ function setComparator() {
108
+ // If the first three letters are "asc", sort in ascending order
109
+ // and remove the prefix.
110
+ if (by.substring(0,3) == 'asc') {
111
+ var i = by.substring(3);
112
+ comp = function(a, b) { return a[i] - b[i]; };
113
+ } else {
114
+ // Otherwise sort in descending order.
115
+ comp = function(a, b) { return b[by] - a[by]; };
116
+ }
117
+
118
+ // Reset link styles and format the selected sort option.
119
+ $('a.sel').attr('href', '#').removeClass('sel');
120
+ $('a.by' + by).removeAttr('href').addClass('sel');
121
+ }
122
+
123
+ /**
124
+ * Create a comp function. If the user has preferences stored in
125
+ * the sortBy cookie, use those, otherwise use the default.
126
+ */
127
+ function initComparator() {
128
+ by = 'rating'; // Default to sort by rating.
129
+ // If the sortBy cookie is set, use that instead.
130
+ if (document.cookie.length > 0) {
131
+ var start = document.cookie.indexOf('sortBy=');
132
+ if (start != -1) {
133
+ start = start + 7;
134
+ var end = document.cookie.indexOf(";", start);
135
+ if (end == -1) {
136
+ end = document.cookie.length;
137
+ by = unescape(document.cookie.substring(start, end));
138
+ }
139
+ }
140
+ }
141
+ setComparator();
142
+ }
143
+
144
+ /**
145
+ * Show a comment div.
146
+ */
147
+ function show(id) {
148
+ $('#ao' + id).hide();
149
+ $('#ah' + id).show();
150
+ var context = $.extend({id: id}, opts);
151
+ var popup = $(renderTemplate(popupTemplate, context)).hide();
152
+ popup.find('textarea[name="proposal"]').hide();
153
+ popup.find('a.by' + by).addClass('sel');
154
+ var form = popup.find('#cf' + id);
155
+ form.submit(function(event) {
156
+ event.preventDefault();
157
+ addComment(form);
158
+ });
159
+ $('#s' + id).after(popup);
160
+ popup.slideDown('fast', function() {
161
+ getComments(id);
162
+ });
163
+ }
164
+
165
+ /**
166
+ * Hide a comment div.
167
+ */
168
+ function hide(id) {
169
+ $('#ah' + id).hide();
170
+ $('#ao' + id).show();
171
+ var div = $('#sc' + id);
172
+ div.slideUp('fast', function() {
173
+ div.remove();
174
+ });
175
+ }
176
+
177
+ /**
178
+ * Perform an ajax request to get comments for a node
179
+ * and insert the comments into the comments tree.
180
+ */
181
+ function getComments(id) {
182
+ $.ajax({
183
+ type: 'GET',
184
+ url: opts.getCommentsURL,
185
+ data: {node: id},
186
+ success: function(data, textStatus, request) {
187
+ var ul = $('#cl' + id);
188
+ var speed = 100;
189
+ $('#cf' + id)
190
+ .find('textarea[name="proposal"]')
191
+ .data('source', data.source);
192
+
193
+ if (data.comments.length === 0) {
194
+ ul.html('<li>No comments yet.</li>');
195
+ ul.data('empty', true);
196
+ } else {
197
+ // If there are comments, sort them and put them in the list.
198
+ var comments = sortComments(data.comments);
199
+ speed = data.comments.length * 100;
200
+ appendComments(comments, ul);
201
+ ul.data('empty', false);
202
+ }
203
+ $('#cn' + id).slideUp(speed + 200);
204
+ ul.slideDown(speed);
205
+ },
206
+ error: function(request, textStatus, error) {
207
+ showError('Oops, there was a problem retrieving the comments.');
208
+ },
209
+ dataType: 'json'
210
+ });
211
+ }
212
+
213
+ /**
214
+ * Add a comment via ajax and insert the comment into the comment tree.
215
+ */
216
+ function addComment(form) {
217
+ var node_id = form.find('input[name="node"]').val();
218
+ var parent_id = form.find('input[name="parent"]').val();
219
+ var text = form.find('textarea[name="comment"]').val();
220
+ var proposal = form.find('textarea[name="proposal"]').val();
221
+
222
+ if (text == '') {
223
+ showError('Please enter a comment.');
224
+ return;
225
+ }
226
+
227
+ // Disable the form that is being submitted.
228
+ form.find('textarea,input').attr('disabled', 'disabled');
229
+
230
+ // Send the comment to the server.
231
+ $.ajax({
232
+ type: "POST",
233
+ url: opts.addCommentURL,
234
+ dataType: 'json',
235
+ data: {
236
+ node: node_id,
237
+ parent: parent_id,
238
+ text: text,
239
+ proposal: proposal
240
+ },
241
+ success: function(data, textStatus, error) {
242
+ // Reset the form.
243
+ if (node_id) {
244
+ hideProposeChange(node_id);
245
+ }
246
+ form.find('textarea')
247
+ .val('')
248
+ .add(form.find('input'))
249
+ .removeAttr('disabled');
250
+ var ul = $('#cl' + (node_id || parent_id));
251
+ if (ul.data('empty')) {
252
+ $(ul).empty();
253
+ ul.data('empty', false);
254
+ }
255
+ insertComment(data.comment);
256
+ var ao = $('#ao' + node_id);
257
+ ao.find('img').attr({'src': opts.commentBrightImage});
258
+ if (node_id) {
259
+ // if this was a "root" comment, remove the commenting box
260
+ // (the user can get it back by reopening the comment popup)
261
+ $('#ca' + node_id).slideUp();
262
+ }
263
+ },
264
+ error: function(request, textStatus, error) {
265
+ form.find('textarea,input').removeAttr('disabled');
266
+ showError('Oops, there was a problem adding the comment.');
267
+ }
268
+ });
269
+ }
270
+
271
+ /**
272
+ * Recursively append comments to the main comment list and children
273
+ * lists, creating the comment tree.
274
+ */
275
+ function appendComments(comments, ul) {
276
+ $.each(comments, function() {
277
+ var div = createCommentDiv(this);
278
+ ul.append($(document.createElement('li')).html(div));
279
+ appendComments(this.children, div.find('ul.comment-children'));
280
+ // To avoid stagnating data, don't store the comments children in data.
281
+ this.children = null;
282
+ div.data('comment', this);
283
+ });
284
+ }
285
+
286
+ /**
287
+ * After adding a new comment, it must be inserted in the correct
288
+ * location in the comment tree.
289
+ */
290
+ function insertComment(comment) {
291
+ var div = createCommentDiv(comment);
292
+
293
+ // To avoid stagnating data, don't store the comments children in data.
294
+ comment.children = null;
295
+ div.data('comment', comment);
296
+
297
+ var ul = $('#cl' + (comment.node || comment.parent));
298
+ var siblings = getChildren(ul);
299
+
300
+ var li = $(document.createElement('li'));
301
+ li.hide();
302
+
303
+ // Determine where in the parents children list to insert this comment.
304
+ for(i=0; i < siblings.length; i++) {
305
+ if (comp(comment, siblings[i]) <= 0) {
306
+ $('#cd' + siblings[i].id)
307
+ .parent()
308
+ .before(li.html(div));
309
+ li.slideDown('fast');
310
+ return;
311
+ }
312
+ }
313
+
314
+ // If we get here, this comment rates lower than all the others,
315
+ // or it is the only comment in the list.
316
+ ul.append(li.html(div));
317
+ li.slideDown('fast');
318
+ }
319
+
320
+ function acceptComment(id) {
321
+ $.ajax({
322
+ type: 'POST',
323
+ url: opts.acceptCommentURL,
324
+ data: {id: id},
325
+ success: function(data, textStatus, request) {
326
+ $('#cm' + id).fadeOut('fast');
327
+ $('#cd' + id).removeClass('moderate');
328
+ },
329
+ error: function(request, textStatus, error) {
330
+ showError('Oops, there was a problem accepting the comment.');
331
+ }
332
+ });
333
+ }
334
+
335
+ function deleteComment(id) {
336
+ $.ajax({
337
+ type: 'POST',
338
+ url: opts.deleteCommentURL,
339
+ data: {id: id},
340
+ success: function(data, textStatus, request) {
341
+ var div = $('#cd' + id);
342
+ if (data == 'delete') {
343
+ // Moderator mode: remove the comment and all children immediately
344
+ div.slideUp('fast', function() {
345
+ div.remove();
346
+ });
347
+ return;
348
+ }
349
+ // User mode: only mark the comment as deleted
350
+ div
351
+ .find('span.user-id:first')
352
+ .text('[deleted]').end()
353
+ .find('div.comment-text:first')
354
+ .text('[deleted]').end()
355
+ .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id +
356
+ ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id)
357
+ .remove();
358
+ var comment = div.data('comment');
359
+ comment.username = '[deleted]';
360
+ comment.text = '[deleted]';
361
+ div.data('comment', comment);
362
+ },
363
+ error: function(request, textStatus, error) {
364
+ showError('Oops, there was a problem deleting the comment.');
365
+ }
366
+ });
367
+ }
368
+
369
+ function showProposal(id) {
370
+ $('#sp' + id).hide();
371
+ $('#hp' + id).show();
372
+ $('#pr' + id).slideDown('fast');
373
+ }
374
+
375
+ function hideProposal(id) {
376
+ $('#hp' + id).hide();
377
+ $('#sp' + id).show();
378
+ $('#pr' + id).slideUp('fast');
379
+ }
380
+
381
+ function showProposeChange(id) {
382
+ $('#pc' + id).hide();
383
+ $('#hc' + id).show();
384
+ var textarea = $('#pt' + id);
385
+ textarea.val(textarea.data('source'));
386
+ $.fn.autogrow.resize(textarea[0]);
387
+ textarea.slideDown('fast');
388
+ }
389
+
390
+ function hideProposeChange(id) {
391
+ $('#hc' + id).hide();
392
+ $('#pc' + id).show();
393
+ var textarea = $('#pt' + id);
394
+ textarea.val('').removeAttr('disabled');
395
+ textarea.slideUp('fast');
396
+ }
397
+
398
+ function toggleCommentMarkupBox(id) {
399
+ $('#mb' + id).toggle();
400
+ }
401
+
402
+ /** Handle when the user clicks on a sort by link. */
403
+ function handleReSort(link) {
404
+ var classes = link.attr('class').split(/\s+/);
405
+ for (var i=0; i<classes.length; i++) {
406
+ if (classes[i] != 'sort-option') {
407
+ by = classes[i].substring(2);
408
+ }
409
+ }
410
+ setComparator();
411
+ // Save/update the sortBy cookie.
412
+ var expiration = new Date();
413
+ expiration.setDate(expiration.getDate() + 365);
414
+ document.cookie= 'sortBy=' + escape(by) +
415
+ ';expires=' + expiration.toUTCString();
416
+ $('ul.comment-ul').each(function(index, ul) {
417
+ var comments = getChildren($(ul), true);
418
+ comments = sortComments(comments);
419
+ appendComments(comments, $(ul).empty());
420
+ });
421
+ }
422
+
423
+ /**
424
+ * Function to process a vote when a user clicks an arrow.
425
+ */
426
+ function handleVote(link) {
427
+ if (!opts.voting) {
428
+ showError("You'll need to login to vote.");
429
+ return;
430
+ }
431
+
432
+ var id = link.attr('id');
433
+ if (!id) {
434
+ // Didn't click on one of the voting arrows.
435
+ return;
436
+ }
437
+ // If it is an unvote, the new vote value is 0,
438
+ // Otherwise it's 1 for an upvote, or -1 for a downvote.
439
+ var value = 0;
440
+ if (id.charAt(1) != 'u') {
441
+ value = id.charAt(0) == 'u' ? 1 : -1;
442
+ }
443
+ // The data to be sent to the server.
444
+ var d = {
445
+ comment_id: id.substring(2),
446
+ value: value
447
+ };
448
+
449
+ // Swap the vote and unvote links.
450
+ link.hide();
451
+ $('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id)
452
+ .show();
453
+
454
+ // The div the comment is displayed in.
455
+ var div = $('div#cd' + d.comment_id);
456
+ var data = div.data('comment');
457
+
458
+ // If this is not an unvote, and the other vote arrow has
459
+ // already been pressed, unpress it.
460
+ if ((d.value !== 0) && (data.vote === d.value * -1)) {
461
+ $('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide();
462
+ $('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show();
463
+ }
464
+
465
+ // Update the comments rating in the local data.
466
+ data.rating += (data.vote === 0) ? d.value : (d.value - data.vote);
467
+ data.vote = d.value;
468
+ div.data('comment', data);
469
+
470
+ // Change the rating text.
471
+ div.find('.rating:first')
472
+ .text(data.rating + ' point' + (data.rating == 1 ? '' : 's'));
473
+
474
+ // Send the vote information to the server.
475
+ $.ajax({
476
+ type: "POST",
477
+ url: opts.processVoteURL,
478
+ data: d,
479
+ error: function(request, textStatus, error) {
480
+ showError('Oops, there was a problem casting that vote.');
481
+ }
482
+ });
483
+ }
484
+
485
+ /**
486
+ * Open a reply form used to reply to an existing comment.
487
+ */
488
+ function openReply(id) {
489
+ // Swap out the reply link for the hide link
490
+ $('#rl' + id).hide();
491
+ $('#cr' + id).show();
492
+
493
+ // Add the reply li to the children ul.
494
+ var div = $(renderTemplate(replyTemplate, {id: id})).hide();
495
+ $('#cl' + id)
496
+ .prepend(div)
497
+ // Setup the submit handler for the reply form.
498
+ .find('#rf' + id)
499
+ .submit(function(event) {
500
+ event.preventDefault();
501
+ addComment($('#rf' + id));
502
+ closeReply(id);
503
+ })
504
+ .find('input[type=button]')
505
+ .click(function() {
506
+ closeReply(id);
507
+ });
508
+ div.slideDown('fast', function() {
509
+ $('#rf' + id).find('textarea').focus();
510
+ });
511
+ }
512
+
513
+ /**
514
+ * Close the reply form opened with openReply.
515
+ */
516
+ function closeReply(id) {
517
+ // Remove the reply div from the DOM.
518
+ $('#rd' + id).slideUp('fast', function() {
519
+ $(this).remove();
520
+ });
521
+
522
+ // Swap out the hide link for the reply link
523
+ $('#cr' + id).hide();
524
+ $('#rl' + id).show();
525
+ }
526
+
527
+ /**
528
+ * Recursively sort a tree of comments using the comp comparator.
529
+ */
530
+ function sortComments(comments) {
531
+ comments.sort(comp);
532
+ $.each(comments, function() {
533
+ this.children = sortComments(this.children);
534
+ });
535
+ return comments;
536
+ }
537
+
538
+ /**
539
+ * Get the children comments from a ul. If recursive is true,
540
+ * recursively include childrens' children.
541
+ */
542
+ function getChildren(ul, recursive) {
543
+ var children = [];
544
+ ul.children().children("[id^='cd']")
545
+ .each(function() {
546
+ var comment = $(this).data('comment');
547
+ if (recursive)
548
+ comment.children = getChildren($(this).find('#cl' + comment.id), true);
549
+ children.push(comment);
550
+ });
551
+ return children;
552
+ }
553
+
554
+ /** Create a div to display a comment in. */
555
+ function createCommentDiv(comment) {
556
+ if (!comment.displayed && !opts.moderator) {
557
+ return $('<div class="moderate">Thank you! Your comment will show up '
558
+ + 'once it is has been approved by a moderator.</div>');
559
+ }
560
+ // Prettify the comment rating.
561
+ comment.pretty_rating = comment.rating + ' point' +
562
+ (comment.rating == 1 ? '' : 's');
563
+ // Make a class (for displaying not yet moderated comments differently)
564
+ comment.css_class = comment.displayed ? '' : ' moderate';
565
+ // Create a div for this comment.
566
+ var context = $.extend({}, opts, comment);
567
+ var div = $(renderTemplate(commentTemplate, context));
568
+
569
+ // If the user has voted on this comment, highlight the correct arrow.
570
+ if (comment.vote) {
571
+ var direction = (comment.vote == 1) ? 'u' : 'd';
572
+ div.find('#' + direction + 'v' + comment.id).hide();
573
+ div.find('#' + direction + 'u' + comment.id).show();
574
+ }
575
+
576
+ if (opts.moderator || comment.text != '[deleted]') {
577
+ div.find('a.reply').show();
578
+ if (comment.proposal_diff)
579
+ div.find('#sp' + comment.id).show();
580
+ if (opts.moderator && !comment.displayed)
581
+ div.find('#cm' + comment.id).show();
582
+ if (opts.moderator || (opts.username == comment.username))
583
+ div.find('#dc' + comment.id).show();
584
+ }
585
+ return div;
586
+ }
587
+
588
+ /**
589
+ * A simple template renderer. Placeholders such as <%id%> are replaced
590
+ * by context['id'] with items being escaped. Placeholders such as <#id#>
591
+ * are not escaped.
592
+ */
593
+ function renderTemplate(template, context) {
594
+ var esc = $(document.createElement('div'));
595
+
596
+ function handle(ph, escape) {
597
+ var cur = context;
598
+ $.each(ph.split('.'), function() {
599
+ cur = cur[this];
600
+ });
601
+ return escape ? esc.text(cur || "").html() : cur;
602
+ }
603
+
604
+ return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
605
+ return handle(arguments[2], arguments[1] == '%' ? true : false);
606
+ });
607
+ }
608
+
609
+ /** Flash an error message briefly. */
610
+ function showError(message) {
611
+ $(document.createElement('div')).attr({'class': 'popup-error'})
612
+ .append($(document.createElement('div'))
613
+ .attr({'class': 'error-message'}).text(message))
614
+ .appendTo('body')
615
+ .fadeIn("slow")
616
+ .delay(2000)
617
+ .fadeOut("slow");
618
+ }
619
+
620
+ /** Add a link the user uses to open the comments popup. */
621
+ $.fn.comment = function() {
622
+ return this.each(function() {
623
+ var id = $(this).attr('id').substring(1);
624
+ var count = COMMENT_METADATA[id];
625
+ var title = count + ' comment' + (count == 1 ? '' : 's');
626
+ var image = count > 0 ? opts.commentBrightImage : opts.commentImage;
627
+ var addcls = count == 0 ? ' nocomment' : '';
628
+ $(this)
629
+ .append(
630
+ $(document.createElement('a')).attr({
631
+ href: '#',
632
+ 'class': 'sphinx-comment-open' + addcls,
633
+ id: 'ao' + id
634
+ })
635
+ .append($(document.createElement('img')).attr({
636
+ src: image,
637
+ alt: 'comment',
638
+ title: title
639
+ }))
640
+ .click(function(event) {
641
+ event.preventDefault();
642
+ show($(this).attr('id').substring(2));
643
+ })
644
+ )
645
+ .append(
646
+ $(document.createElement('a')).attr({
647
+ href: '#',
648
+ 'class': 'sphinx-comment-close hidden',
649
+ id: 'ah' + id
650
+ })
651
+ .append($(document.createElement('img')).attr({
652
+ src: opts.closeCommentImage,
653
+ alt: 'close',
654
+ title: 'close'
655
+ }))
656
+ .click(function(event) {
657
+ event.preventDefault();
658
+ hide($(this).attr('id').substring(2));
659
+ })
660
+ );
661
+ });
662
+ };
663
+
664
+ var opts = {
665
+ processVoteURL: '/_process_vote',
666
+ addCommentURL: '/_add_comment',
667
+ getCommentsURL: '/_get_comments',
668
+ acceptCommentURL: '/_accept_comment',
669
+ deleteCommentURL: '/_delete_comment',
670
+ commentImage: '/static/_static/comment.png',
671
+ closeCommentImage: '/static/_static/comment-close.png',
672
+ loadingImage: '/static/_static/ajax-loader.gif',
673
+ commentBrightImage: '/static/_static/comment-bright.png',
674
+ upArrow: '/static/_static/up.png',
675
+ downArrow: '/static/_static/down.png',
676
+ upArrowPressed: '/static/_static/up-pressed.png',
677
+ downArrowPressed: '/static/_static/down-pressed.png',
678
+ voting: false,
679
+ moderator: false
680
+ };
681
+
682
+ if (typeof COMMENT_OPTIONS != "undefined") {
683
+ opts = jQuery.extend(opts, COMMENT_OPTIONS);
684
+ }
685
+
686
+ var popupTemplate = '\
687
+ <div class="sphinx-comments" id="sc<%id%>">\
688
+ <p class="sort-options">\
689
+ Sort by:\
690
+ <a href="#" class="sort-option byrating">best rated</a>\
691
+ <a href="#" class="sort-option byascage">newest</a>\
692
+ <a href="#" class="sort-option byage">oldest</a>\
693
+ </p>\
694
+ <div class="comment-header">Comments</div>\
695
+ <div class="comment-loading" id="cn<%id%>">\
696
+ loading comments... <img src="<%loadingImage%>" alt="" /></div>\
697
+ <ul id="cl<%id%>" class="comment-ul"></ul>\
698
+ <div id="ca<%id%>">\
699
+ <p class="add-a-comment">Add a comment\
700
+ (<a href="#" class="comment-markup" id="ab<%id%>">markup</a>):</p>\
701
+ <div class="comment-markup-box" id="mb<%id%>">\
702
+ reStructured text markup: <i>*emph*</i>, <b>**strong**</b>, \
703
+ <tt>``code``</tt>, \
704
+ code blocks: <tt>::</tt> and an indented block after blank line</div>\
705
+ <form method="post" id="cf<%id%>" class="comment-form" action="">\
706
+ <textarea name="comment" cols="80"></textarea>\
707
+ <p class="propose-button">\
708
+ <a href="#" id="pc<%id%>" class="show-propose-change">\
709
+ Propose a change &#9657;\
710
+ </a>\
711
+ <a href="#" id="hc<%id%>" class="hide-propose-change">\
712
+ Propose a change &#9663;\
713
+ </a>\
714
+ </p>\
715
+ <textarea name="proposal" id="pt<%id%>" cols="80"\
716
+ spellcheck="false"></textarea>\
717
+ <input type="submit" value="Add comment" />\
718
+ <input type="hidden" name="node" value="<%id%>" />\
719
+ <input type="hidden" name="parent" value="" />\
720
+ </form>\
721
+ </div>\
722
+ </div>';
723
+
724
+ var commentTemplate = '\
725
+ <div id="cd<%id%>" class="sphinx-comment<%css_class%>">\
726
+ <div class="vote">\
727
+ <div class="arrow">\
728
+ <a href="#" id="uv<%id%>" class="vote" title="vote up">\
729
+ <img src="<%upArrow%>" />\
730
+ </a>\
731
+ <a href="#" id="uu<%id%>" class="un vote" title="vote up">\
732
+ <img src="<%upArrowPressed%>" />\
733
+ </a>\
734
+ </div>\
735
+ <div class="arrow">\
736
+ <a href="#" id="dv<%id%>" class="vote" title="vote down">\
737
+ <img src="<%downArrow%>" id="da<%id%>" />\
738
+ </a>\
739
+ <a href="#" id="du<%id%>" class="un vote" title="vote down">\
740
+ <img src="<%downArrowPressed%>" />\
741
+ </a>\
742
+ </div>\
743
+ </div>\
744
+ <div class="comment-content">\
745
+ <p class="tagline comment">\
746
+ <span class="user-id"><%username%></span>\
747
+ <span class="rating"><%pretty_rating%></span>\
748
+ <span class="delta"><%time.delta%></span>\
749
+ </p>\
750
+ <div class="comment-text comment"><#text#></div>\
751
+ <p class="comment-opts comment">\
752
+ <a href="#" class="reply hidden" id="rl<%id%>">reply &#9657;</a>\
753
+ <a href="#" class="close-reply" id="cr<%id%>">reply &#9663;</a>\
754
+ <a href="#" id="sp<%id%>" class="show-proposal">proposal &#9657;</a>\
755
+ <a href="#" id="hp<%id%>" class="hide-proposal">proposal &#9663;</a>\
756
+ <a href="#" id="dc<%id%>" class="delete-comment hidden">delete</a>\
757
+ <span id="cm<%id%>" class="moderation hidden">\
758
+ <a href="#" id="ac<%id%>" class="accept-comment">accept</a>\
759
+ </span>\
760
+ </p>\
761
+ <pre class="proposal" id="pr<%id%>">\
762
+ <#proposal_diff#>\
763
+ </pre>\
764
+ <ul class="comment-children" id="cl<%id%>"></ul>\
765
+ </div>\
766
+ <div class="clearleft"></div>\
767
+ </div>\
768
+ </div>';
769
+
770
+ var replyTemplate = '\
771
+ <li>\
772
+ <div class="reply-div" id="rd<%id%>">\
773
+ <form id="rf<%id%>">\
774
+ <textarea name="comment" cols="80"></textarea>\
775
+ <input type="submit" value="Add reply" />\
776
+ <input type="button" value="Cancel" />\
777
+ <input type="hidden" name="parent" value="<%id%>" />\
778
+ <input type="hidden" name="node" value="" />\
779
+ </form>\
780
+ </div>\
781
+ </li>';
782
+
783
+ $(document).ready(function() {
784
+ init();
785
+ });
786
+ })(jQuery);
787
+
788
+ $(document).ready(function() {
789
+ // add comment anchors for all paragraphs that are commentable
790
+ $('.sphinx-has-comment').comment();
791
+
792
+ // highlight search words in search results
793
+ $("div.context").each(function() {
794
+ var params = $.getQueryParameters();
795
+ var terms = (params.q) ? params.q[0].split(/\s+/) : [];
796
+ var result = $(this);
797
+ $.each(terms, function() {
798
+ result.highlightText(this.toLowerCase(), 'highlighted');
799
+ });
800
+ });
801
+
802
+ // directly open comment window if requested
803
+ var anchor = document.location.hash;
804
+ if (anchor.substring(0, 9) == '#comment-') {
805
+ $('#ao' + anchor.substring(9)).click();
806
+ document.location.hash = '#s' + anchor.substring(9);
807
+ }
808
+ });