veewee 0.2.3 → 0.3.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (389) hide show
  1. data/.gitignore +3 -0
  2. data/Gemfile +1 -2
  3. data/Gemfile.lock +53 -30
  4. data/License +21 -0
  5. data/README-LIB.md +2 -0
  6. data/README.md +35 -62
  7. data/Rakefile +54 -88
  8. data/bin/veewee +13 -70
  9. data/bin/veewee-kvm-old +34 -0
  10. data/bin/veewee-vagrant +55 -0
  11. data/bin/veewee-vmfusion +34 -0
  12. data/lib/fission.rb +41 -0
  13. data/lib/fission/cli.rb +76 -0
  14. data/lib/fission/command.rb +15 -0
  15. data/lib/fission/command/clone.rb +68 -0
  16. data/lib/fission/command/delete.rb +71 -0
  17. data/lib/fission/command/snapshot_create.rb +52 -0
  18. data/lib/fission/command/snapshot_list.rb +45 -0
  19. data/lib/fission/command/snapshot_revert.rb +54 -0
  20. data/lib/fission/command/start.rb +69 -0
  21. data/lib/fission/command/status.rb +31 -0
  22. data/lib/fission/command/stop.rb +49 -0
  23. data/lib/fission/command/suspend.rb +67 -0
  24. data/lib/fission/config.rb +29 -0
  25. data/lib/fission/core_ext/class.rb +5 -0
  26. data/lib/fission/core_ext/file.rb +7 -0
  27. data/lib/fission/core_ext/object.rb +112 -0
  28. data/lib/fission/error.rb +9 -0
  29. data/lib/fission/fusion.rb +17 -0
  30. data/lib/fission/leasesfile.rb +74 -0
  31. data/lib/fission/metadata.rb +39 -0
  32. data/lib/fission/response.rb +16 -0
  33. data/lib/fission/ui.rb +22 -0
  34. data/lib/fission/version.rb +3 -0
  35. data/lib/fission/vm.rb +361 -0
  36. data/lib/net/vnc/vnc.rb +341 -0
  37. data/lib/vagrant_init.rb +5 -2
  38. data/lib/veewee.rb +20 -3
  39. data/lib/veewee/builder/core/box.rb +32 -0
  40. data/lib/veewee/builder/core/box/vnc.rb +122 -0
  41. data/lib/veewee/builder/core/builder.rb +90 -0
  42. data/lib/veewee/builder/core/builder/build.rb +250 -0
  43. data/lib/veewee/builder/core/builder/iso.rb +120 -0
  44. data/lib/veewee/builder/core/builder/transaction.rb +25 -0
  45. data/lib/veewee/builder/core/builder/tunnel.rb +46 -0
  46. data/lib/veewee/builder/kvm/box.rb +130 -0
  47. data/lib/veewee/builder/kvm/builder.rb +38 -0
  48. data/lib/veewee/builder/virtualbox/box.rb +121 -0
  49. data/lib/veewee/builder/virtualbox/builder.rb +48 -0
  50. data/lib/veewee/builder/virtualbox/helper/_snapshots.rb +105 -0
  51. data/lib/veewee/builder/virtualbox/helper/_transaction.rb +135 -0
  52. data/lib/veewee/builder/virtualbox/helper/console_type.rb +62 -0
  53. data/lib/veewee/builder/virtualbox/helper/create.rb +210 -0
  54. data/lib/veewee/builder/virtualbox/helper/destroy.rb +79 -0
  55. data/lib/veewee/builder/virtualbox/helper/export_vagrant.rb +87 -0
  56. data/lib/veewee/builder/virtualbox/helper/validate_vagrant.rb +35 -0
  57. data/lib/veewee/builder/vmfusion/box.rb +137 -0
  58. data/lib/veewee/builder/vmfusion/builder.rb +78 -0
  59. data/lib/veewee/builder/vmfusion/helper/create.rb +68 -0
  60. data/lib/veewee/builder/vmfusion/helper/export_ova.rb +26 -0
  61. data/lib/veewee/builder/vmfusion/helper/template.rb +39 -0
  62. data/lib/veewee/builder/vmfusion/helper/template.vmx.erb +81 -0
  63. data/lib/veewee/builder/vmfusion/helper/validate_vmfusion.rb +37 -0
  64. data/lib/veewee/builder/vmfusion/info/export_ovf.info +103 -0
  65. data/lib/veewee/cli.rb +55 -0
  66. data/lib/veewee/command.rb +10 -20
  67. data/lib/veewee/command/base.rb +106 -0
  68. data/lib/veewee/command/group_base.rb +107 -0
  69. data/lib/veewee/command/helpers.rb +13 -0
  70. data/lib/veewee/command/kvm.rb +85 -0
  71. data/lib/veewee/command/named_base.rb +14 -0
  72. data/lib/veewee/command/vagrant.rb +108 -0
  73. data/lib/veewee/command/version.rb +13 -0
  74. data/lib/veewee/command/virtualbox.rb +86 -0
  75. data/lib/veewee/command/vmfusion.rb +113 -0
  76. data/lib/veewee/config.rb +89 -3
  77. data/lib/veewee/config/builders.rb +36 -0
  78. data/lib/veewee/config/collection.rb +82 -0
  79. data/lib/veewee/config/component.rb +19 -0
  80. data/lib/veewee/config/definition.rb +44 -0
  81. data/lib/veewee/config/ostypes.yml +165 -0
  82. data/lib/veewee/config/veewee.rb +21 -0
  83. data/lib/veewee/definition.rb +130 -0
  84. data/lib/veewee/environment.rb +367 -0
  85. data/lib/veewee/error.rb +20 -0
  86. data/lib/veewee/templates/locales/en.yml +30 -0
  87. data/lib/veewee/ui.rb +83 -0
  88. data/lib/veewee/util/scancode.rb +112 -0
  89. data/lib/veewee/util/shell.rb +42 -0
  90. data/lib/veewee/util/ssh.rb +158 -0
  91. data/lib/veewee/util/tcp.rb +88 -0
  92. data/lib/veewee/util/web.rb +63 -0
  93. data/lib/veewee/vagrant/config.rb +7 -0
  94. data/lib/veewee/version.rb +6 -1
  95. data/templates/CentOS-4.8-i386/definition.rb +3 -3
  96. data/templates/CentOS-4.8-i386/postinstall.sh +2 -2
  97. data/templates/CentOS-5.5-x86_64-netboot/definition.rb +1 -1
  98. data/templates/CentOS-5.5-x86_64-netboot/postinstall.sh +1 -1
  99. data/templates/CentOS-5.6-i386-netboot/definition.rb +3 -3
  100. data/templates/CentOS-5.6-i386-netboot/ks.cfg +2 -2
  101. data/templates/CentOS-5.6-i386-netboot/postinstall.sh +2 -2
  102. data/templates/CentOS-5.6-i386/definition.rb +2 -2
  103. data/templates/CentOS-5.6-i386/postinstall.sh +2 -2
  104. data/templates/CentOS-5.6-x86_64-netboot/definition.rb +3 -3
  105. data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +1 -1
  106. data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +1 -1
  107. data/templates/CentOS-5.7-i386-netboot/postinstall.sh +3 -3
  108. data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +1 -1
  109. data/templates/CentOS-6.0-i386-netboot/definition.rb +2 -2
  110. data/templates/CentOS-6.0-i386-netboot/postinstall.sh +2 -2
  111. data/templates/CentOS-6.0-i386/definition.rb +2 -2
  112. data/templates/CentOS-6.0-i386/postinstall.sh +2 -2
  113. data/templates/CentOS-6.0-x86_64-minimal/definition.rb +2 -2
  114. data/templates/CentOS-6.0-x86_64-minimal/postinstall.sh +4 -17
  115. data/templates/CentOS-6.0-x86_64-netboot/definition.rb +2 -2
  116. data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +2 -2
  117. data/templates/CentOS-6.0-x86_64/definition.rb +2 -2
  118. data/templates/CentOS-6.0-x86_64/postinstall.sh +2 -2
  119. data/templates/Debian-5.0.8-amd64-netboot/definition.rb +1 -1
  120. data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +1 -1
  121. data/templates/Debian-5.0.8-i386-netboot/definition.rb +1 -1
  122. data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +1 -1
  123. data/templates/{Debian-6.0.3-amd64-netboot → Debian-6.0.2-amd64-netboot}/definition.rb +4 -4
  124. data/templates/{ubuntu-11.10-server-amd64-ishaya → Debian-6.0.2-amd64-netboot}/postinstall.sh +23 -42
  125. data/templates/{Debian-6.0.3-amd64-netboot → Debian-6.0.2-amd64-netboot}/preseed.cfg +0 -0
  126. data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/definition.rb +4 -4
  127. data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/postinstall.sh +1 -1
  128. data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/preseed.cfg +0 -0
  129. data/templates/Fedora-14-amd64-netboot/definition.rb +2 -2
  130. data/templates/Fedora-14-amd64-netboot/postinstall.sh +2 -2
  131. data/templates/Fedora-14-amd64/definition.rb +2 -2
  132. data/templates/Fedora-14-amd64/postinstall.sh +2 -2
  133. data/templates/Fedora-14-i386-netboot/definition.rb +2 -2
  134. data/templates/Fedora-14-i386-netboot/postinstall.sh +2 -2
  135. data/templates/Fedora-14-i386/definition.rb +2 -2
  136. data/templates/Fedora-14-i386/postinstall.sh +2 -2
  137. data/templates/Fedora-15-i386-netboot/definition.rb +2 -2
  138. data/templates/Fedora-15-i386/definition.rb +3 -3
  139. data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +1 -1
  140. data/templates/archlinux-i386-netboot/aif.cfg +14 -8
  141. data/templates/archlinux-i386-netboot/definition.rb +7 -4
  142. data/templates/archlinux-i386-netboot/postinstall.sh +17 -5
  143. data/templates/archlinux-i386-netboot/postinstall2.sh +1 -3
  144. data/templates/archlinux-i386/definition.rb +4 -4
  145. data/templates/archlinux-i386/postinstall.sh +1 -1
  146. data/templates/archlinux-x86_64-netboot/aif.cfg +14 -8
  147. data/templates/archlinux-x86_64-netboot/definition.rb +7 -4
  148. data/templates/archlinux-x86_64-netboot/postinstall.sh +16 -1
  149. data/templates/archlinux-x86_64-netboot/postinstall2.sh +1 -3
  150. data/templates/archlinux-x86_64/definition.rb +2 -2
  151. data/templates/archlinux-x86_64/postinstall.sh +1 -1
  152. data/templates/freebsd-8.2-experimental/definition.rb +1 -1
  153. data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +2 -5
  154. data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +1 -1
  155. data/templates/freebsd-8.2-pcbsd-i386/definition.rb +3 -4
  156. data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +1 -1
  157. data/templates/gentoo-latest-i386-experimental/definition.rb +7 -7
  158. data/templates/gentoo-latest-i386-experimental/postinstall.sh +1 -1
  159. data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +1 -1
  160. data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +1 -1
  161. data/templates/openSUSE-11.4-NET-i586/postinstall.sh +1 -1
  162. data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +1 -1
  163. data/templates/openindiana-148-ai-x86/definition.rb +3 -3
  164. data/templates/openindiana-148-ai-x86/postinstall.sh +1 -1
  165. data/templates/opensuse-11.4-i386-experimental/definition.rb +1 -1
  166. data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -1
  167. data/templates/solaris-11-express-i386/definition.rb +3 -3
  168. data/templates/solaris-11-express-i386/postinstall.sh +1 -1
  169. data/templates/ubuntu-10.04.2-amd64-netboot/definition.rb +1 -1
  170. data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +1 -1
  171. data/templates/ubuntu-10.04.2-server-i386-netboot/definition.rb +1 -1
  172. data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +1 -1
  173. data/templates/ubuntu-10.04.3-server-amd64-alt/definition.rb +6 -6
  174. data/templates/ubuntu-10.04.3-server-amd64-alt/postinstall.sh +1 -1
  175. data/templates/ubuntu-10.04.3-server-amd64/base.sh +11 -0
  176. data/templates/ubuntu-10.04.3-server-amd64/chef.sh +2 -0
  177. data/templates/ubuntu-10.04.3-server-amd64/cleanup.sh +19 -0
  178. data/templates/ubuntu-10.04.3-server-amd64/definition.rb +19 -11
  179. data/templates/ubuntu-10.04.3-server-amd64/preseed.cfg +4 -4
  180. data/templates/ubuntu-10.04.3-server-amd64/puppet.sh +1 -0
  181. data/templates/ubuntu-10.04.3-server-amd64/ruby.sh +24 -0
  182. data/templates/ubuntu-10.04.3-server-amd64/vagrant.sh +27 -0
  183. data/templates/ubuntu-10.04.3-server-amd64/virtualbox.sh +12 -0
  184. data/templates/ubuntu-10.04.3-server-i386/postinstall.sh +1 -1
  185. data/templates/ubuntu-10.10-server-amd64-netboot/definition.rb +1 -1
  186. data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +1 -1
  187. data/templates/ubuntu-10.10-server-amd64/base.sh +11 -0
  188. data/templates/ubuntu-10.10-server-amd64/chef.sh +2 -0
  189. data/templates/ubuntu-10.10-server-amd64/cleanup.sh +19 -0
  190. data/templates/ubuntu-10.10-server-amd64/definition.rb +20 -8
  191. data/templates/ubuntu-10.10-server-amd64/postinstall.sh +1 -1
  192. data/templates/ubuntu-10.10-server-amd64/preseed.cfg +5 -5
  193. data/templates/ubuntu-10.10-server-amd64/puppet.sh +1 -0
  194. data/templates/ubuntu-10.10-server-amd64/ruby.sh +24 -0
  195. data/templates/ubuntu-10.10-server-amd64/vagrant.sh +27 -0
  196. data/templates/ubuntu-10.10-server-amd64/virtualbox.sh +12 -0
  197. data/templates/ubuntu-10.10-server-i386-netboot/definition.rb +1 -1
  198. data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +1 -1
  199. data/templates/ubuntu-10.10-server-i386/definition.rb +1 -1
  200. data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
  201. data/templates/ubuntu-11.04-server-amd64/apt-upgrade.sh +4 -0
  202. data/templates/ubuntu-11.04-server-amd64/chef.sh +1 -0
  203. data/templates/ubuntu-11.04-server-amd64/definition.rb +32 -9
  204. data/templates/ubuntu-11.04-server-amd64/network-cleanup.sh +14 -0
  205. data/templates/ubuntu-11.04-server-amd64/nfs-client.sh +3 -0
  206. data/templates/ubuntu-11.04-server-amd64/puppet.sh +1 -0
  207. data/templates/ubuntu-11.04-server-amd64/remove-build-essentials.sh +3 -0
  208. data/templates/ubuntu-11.04-server-amd64/ruby.sh +29 -0
  209. data/templates/ubuntu-11.04-server-amd64/ssh-keys.sh +7 -0
  210. data/templates/ubuntu-11.04-server-amd64/sudo.sh +4 -0
  211. data/templates/ubuntu-11.04-server-amd64/timestamp.sh +1 -0
  212. data/templates/ubuntu-11.04-server-amd64/vbox_additions.sh +11 -0
  213. data/templates/ubuntu-11.04-server-amd64/zero-disk.sh +3 -0
  214. data/templates/ubuntu-11.04-server-i386/definition.rb +2 -2
  215. data/templates/ubuntu-11.04-server-i386/postinstall.sh +1 -1
  216. data/templates/ubuntu-8.04.4-server-amd64/definition.rb +1 -2
  217. data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +7 -8
  218. data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +1 -0
  219. data/templates/ubuntu-8.04.4-server-i386/definition.rb +2 -2
  220. data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +3 -25
  221. data/templates/windows-2008R2-amd64/cygwin-setup.exe +0 -0
  222. data/templates/windows-2008R2-amd64/definition.rb +1 -1
  223. data/templates/windows-2008R2-amd64/install-winrm.bat +0 -2
  224. data/templates/windows-2008R2-amd64/postinstall.sh +1 -1
  225. data/templates/windows-2008R2-amd64/win7/Autounattend.xml +180 -0
  226. data/test/build_test.rb +50 -0
  227. data/test/definition_test.rb +11 -0
  228. data/test/definitions/test_definition/_test_me.sh +1 -0
  229. data/test/definitions/test_definition/autorun0 +3 -0
  230. data/test/definitions/test_definition/definition.rb +27 -0
  231. data/test/environment_test.rb +67 -0
  232. data/validation/features/steps/ssh_steps.rb +52 -52
  233. data/validation/vagrant.feature +64 -48
  234. data/veewee.gemspec +14 -9
  235. metadata +243 -213
  236. data/lib/veewee/command/basebox.rb +0 -63
  237. data/lib/veewee/command/basebox_build.rb +0 -32
  238. data/lib/veewee/command/basebox_define.rb +0 -28
  239. data/lib/veewee/command/basebox_destroy.rb +0 -22
  240. data/lib/veewee/command/basebox_export.rb +0 -22
  241. data/lib/veewee/command/basebox_list.rb +0 -23
  242. data/lib/veewee/command/basebox_ostypes.rb +0 -23
  243. data/lib/veewee/command/basebox_templates.rb +0 -23
  244. data/lib/veewee/command/basebox_undefine.rb +0 -22
  245. data/lib/veewee/command/basebox_validate.rb +0 -26
  246. data/lib/veewee/export.rb +0 -81
  247. data/lib/veewee/scancode.rb +0 -151
  248. data/lib/veewee/session.rb +0 -907
  249. data/lib/veewee/shell.rb +0 -54
  250. data/lib/veewee/ssh.rb +0 -193
  251. data/lib/veewee/transaction.rb +0 -122
  252. data/lib/veewee/utils.rb +0 -26
  253. data/lib/veewee/web.rb +0 -48
  254. data/templates/CentOS-6.1-x86_64-minimal/definition.rb +0 -15
  255. data/templates/CentOS-6.1-x86_64-minimal/ks.cfg +0 -37
  256. data/templates/CentOS-6.1-x86_64-minimal/postinstall.sh +0 -50
  257. data/templates/CentOS-6.2-x86_64-minimal/definition.rb +0 -15
  258. data/templates/CentOS-6.2-x86_64-minimal/ks.cfg +0 -37
  259. data/templates/CentOS-6.2-x86_64-minimal/postinstall.sh +0 -50
  260. data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +0 -80
  261. data/templates/Fedora-15-x86_64-netboot/definition.rb +0 -29
  262. data/templates/Fedora-15-x86_64-netboot/ks.cfg +0 -64
  263. data/templates/Fedora-15-x86_64-netboot/postinstall.sh +0 -33
  264. data/templates/Fedora-16-i386/definition.rb +0 -17
  265. data/templates/Fedora-16-i386/ks.cfg +0 -72
  266. data/templates/Fedora-16-i386/postinstall.sh +0 -35
  267. data/templates/Fedora-16-x86_64/definition.rb +0 -17
  268. data/templates/Fedora-16-x86_64/ks.cfg +0 -72
  269. data/templates/Fedora-16-x86_64/postinstall.sh +0 -35
  270. data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_de.xml +0 -1127
  271. data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_en.xml +0 -1127
  272. data/templates/SLES-11-SP1-DVD-i586-GM/definition.rb +0 -37
  273. data/templates/SLES-11-SP1-DVD-i586-GM/postinstall.sh +0 -43
  274. data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_de.xml +0 -1171
  275. data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_en.xml +0 -1171
  276. data/templates/SLES-11-SP1-DVD-x86_64-GM/definition.rb +0 -37
  277. data/templates/SLES-11-SP1-DVD-x86_64-GM/postinstall.sh +0 -43
  278. data/templates/funtoo-latest-generic_64-stable/definition.rb +0 -34
  279. data/templates/funtoo-latest-generic_64-stable/postinstall.sh +0 -177
  280. data/templates/funtoo-latest-generic_64-stable/postinstall2.sh +0 -83
  281. data/templates/gentoo-latest-x86_64-experimental/definition.rb +0 -34
  282. data/templates/gentoo-latest-x86_64-experimental/postinstall.sh +0 -214
  283. data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_de.xml +0 -1483
  284. data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_en.xml +0 -1483
  285. data/templates/openSUSE-12.1-DVD+NET-i586/definition.rb +0 -44
  286. data/templates/openSUSE-12.1-DVD+NET-i586/postinstall.sh +0 -43
  287. data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_de.xml +0 -1727
  288. data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_en.xml +0 -1727
  289. data/templates/openSUSE-12.1-DVD+NET-x86_64/definition.rb +0 -44
  290. data/templates/openSUSE-12.1-DVD+NET-x86_64/postinstall.sh +0 -43
  291. data/templates/openbsd50_amd64/README +0 -28
  292. data/templates/openbsd50_amd64/definition.rb +0 -84
  293. data/templates/openbsd50_amd64/postinstall.sh +0 -81
  294. data/templates/openbsd50_i386/.definition.rb.swp +0 -0
  295. data/templates/openbsd50_i386/README +0 -28
  296. data/templates/openbsd50_i386/definition.rb +0 -84
  297. data/templates/openbsd50_i386/postinstall.sh +0 -80
  298. data/templates/scientificlinux-6.1-i386-netboot/definition.rb +0 -16
  299. data/templates/scientificlinux-6.1-i386-netboot/ks.cfg +0 -53
  300. data/templates/scientificlinux-6.1-i386-netboot/postinstall.sh +0 -30
  301. data/templates/scientificlinux-6.1-x86_64-netboot/definition.rb +0 -16
  302. data/templates/scientificlinux-6.1-x86_64-netboot/ks.cfg +0 -53
  303. data/templates/scientificlinux-6.1-x86_64-netboot/postinstall.sh +0 -30
  304. data/templates/ubuntu-10.04.3-server-amd64/postinstall.sh +0 -90
  305. data/templates/ubuntu-11.04-server-amd64/postinstall.sh +0 -96
  306. data/templates/ubuntu-11.10-server-amd64-ishaya/definition.rb +0 -24
  307. data/templates/ubuntu-11.10-server-amd64-ishaya/preseed.cfg +0 -87
  308. data/templates/ubuntu-11.10-server-amd64-ruby192/definition.rb +0 -24
  309. data/templates/ubuntu-11.10-server-amd64-ruby192/postinstall.sh +0 -90
  310. data/templates/ubuntu-11.10-server-amd64-ruby192/preseed.cfg +0 -87
  311. data/templates/ubuntu-11.10-server-amd64/definition.rb +0 -35
  312. data/templates/ubuntu-11.10-server-amd64/postinstall.sh +0 -88
  313. data/templates/ubuntu-11.10-server-amd64/preseed.cfg +0 -87
  314. data/templates/ubuntu-11.10-server-i386/definition.rb +0 -35
  315. data/templates/ubuntu-11.10-server-i386/postinstall.sh +0 -88
  316. data/templates/ubuntu-11.10-server-i386/preseed.cfg +0 -87
  317. data/templates/windows-2008R1-serverstandard-amd64/Autounattend.xml +0 -146
  318. data/templates/windows-2008R1-serverstandard-amd64/README.md +0 -134
  319. data/templates/windows-2008R1-serverstandard-amd64/cygwin-setup.exe +0 -0
  320. data/templates/windows-2008R1-serverstandard-amd64/definition.rb +0 -114
  321. data/templates/windows-2008R1-serverstandard-amd64/install-cygwin-sshd.bat +0 -40
  322. data/templates/windows-2008R1-serverstandard-amd64/install-guest-additions.bat +0 -5
  323. data/templates/windows-2008R1-serverstandard-amd64/install-winrm.bat +0 -14
  324. data/templates/windows-2008R1-serverstandard-amd64/oracle-cert.cer +0 -0
  325. data/templates/windows-2008R1-serverstandard-amd64/postinstall.sh +0 -74
  326. data/templates/windows-2008R1-serverstandard-amd64/sudo +0 -2
  327. data/templates/windows-2008R1-serverstandard-amd64/winrm.rb +0 -8
  328. data/templates/windows-2008R2-serverstandard-amd64/Autounattend.xml +0 -147
  329. data/templates/windows-2008R2-serverstandard-amd64/README.md +0 -142
  330. data/templates/windows-2008R2-serverstandard-amd64/definition.rb +0 -44
  331. data/templates/windows-2008R2-serverstandard-amd64/install-cygwin-sshd.bat +0 -41
  332. data/templates/windows-2008R2-serverstandard-amd64/install-winrm.bat +0 -11
  333. data/templates/windows-2008R2-serverstandard-amd64/oracle-cert.cer +0 -0
  334. data/templates/windows-2008R2-serverstandard-amd64/postinstall.sh +0 -74
  335. data/templates/windows-7-enterprise-amd64/Autounattend.xml +0 -149
  336. data/templates/windows-7-enterprise-amd64/README.md +0 -52
  337. data/templates/windows-7-enterprise-amd64/definition.rb +0 -39
  338. data/templates/windows-7-enterprise-amd64/install-cygwin-sshd.bat +0 -40
  339. data/templates/windows-7-enterprise-amd64/install-winrm.bat +0 -14
  340. data/templates/windows-7-enterprise-amd64/oracle-cert.cer +0 -0
  341. data/templates/windows-7-enterprise-amd64/postinstall.sh +0 -74
  342. data/templates/windows-7-enterprise-i386/Autounattend.xml +0 -151
  343. data/templates/windows-7-enterprise-i386/README.md +0 -169
  344. data/templates/windows-7-enterprise-i386/definition.rb +0 -40
  345. data/templates/windows-7-enterprise-i386/install-cygwin-sshd.bat +0 -40
  346. data/templates/windows-7-enterprise-i386/install-winrm.bat +0 -14
  347. data/templates/windows-7-enterprise-i386/oracle-cert.cer +0 -0
  348. data/templates/windows-7-enterprise-i386/postinstall.sh +0 -74
  349. data/templates/windows-7-premium-amd64/Autounattend.xml +0 -152
  350. data/templates/windows-7-premium-amd64/README.md +0 -171
  351. data/templates/windows-7-premium-amd64/definition.rb +0 -38
  352. data/templates/windows-7-premium-amd64/install-chefclient.bat +0 -44
  353. data/templates/windows-7-premium-amd64/install-winrm.bat +0 -11
  354. data/templates/windows-7-premium-amd64/oracle-cert.cer +0 -0
  355. data/templates/windows-7-premium-amd64/postinstall.sh +0 -124
  356. data/templates/windows-7-premium-amd64/winrm.rb +0 -8
  357. data/templates/windows-7-professional-amd64/Autounattend.xml +0 -152
  358. data/templates/windows-7-professional-amd64/README.md +0 -171
  359. data/templates/windows-7-professional-amd64/definition.rb +0 -41
  360. data/templates/windows-7-professional-amd64/install-cygwin-sshd.bat +0 -40
  361. data/templates/windows-7-professional-amd64/install-winrm.bat +0 -14
  362. data/templates/windows-7-professional-amd64/oracle-cert.cer +0 -0
  363. data/templates/windows-7-professional-amd64/postinstall.sh +0 -74
  364. data/templates/windows-7-ultimate-amd64/Autounattend.xml +0 -152
  365. data/templates/windows-7-ultimate-amd64/README.md +0 -89
  366. data/templates/windows-7-ultimate-amd64/definition.rb +0 -41
  367. data/templates/windows-7-ultimate-amd64/install-cygwin-sshd.bat +0 -40
  368. data/templates/windows-7-ultimate-amd64/install-winrm.bat +0 -14
  369. data/templates/windows-7-ultimate-amd64/oracle-cert.cer +0 -0
  370. data/templates/windows-7-ultimate-amd64/postinstall.sh +0 -74
  371. data/templates/windows-7sp1-ultimate-amd64/Autounattend.xml +0 -152
  372. data/templates/windows-7sp1-ultimate-amd64/README.md +0 -89
  373. data/templates/windows-7sp1-ultimate-amd64/definition.rb +0 -42
  374. data/templates/windows-7sp1-ultimate-amd64/install-cygwin-sshd.bat +0 -40
  375. data/templates/windows-7sp1-ultimate-amd64/install-winrm.bat +0 -14
  376. data/templates/windows-7sp1-ultimate-amd64/oracle-cert.cer +0 -0
  377. data/templates/windows-7sp1-ultimate-amd64/postinstall.sh +0 -74
  378. data/templates/windows-8-preview-dev-amd64/Autounattend.xml +0 -140
  379. data/templates/windows-8-preview-dev-amd64/README.md +0 -134
  380. data/templates/windows-8-preview-dev-amd64/cygwin-setup.exe +0 -0
  381. data/templates/windows-8-preview-dev-amd64/definition.rb +0 -114
  382. data/templates/windows-8-preview-dev-amd64/install-cygwin-sshd.bat +0 -38
  383. data/templates/windows-8-preview-dev-amd64/install-winrm.bat +0 -11
  384. data/templates/windows-8-preview-dev-amd64/oracle-cert.cer +0 -0
  385. data/templates/windows-8-preview-dev-amd64/postinstall.sh +0 -122
  386. data/templates/windows-8-preview-dev-amd64/winrm.rb +0 -8
  387. data/trials/docu-vbox.txt +0 -83
  388. data/trials/f.rb +0 -29
  389. data/trials/t.rb +0 -15
@@ -0,0 +1,81 @@
1
+ .encoding = "UTF-8"
2
+ config.version = "8"
3
+ virtualHW.version = "7"
4
+ numvcpus = "<%= cpu_count %>"
5
+ scsi0.present = "TRUE"
6
+ scsi0.virtualDev = "<%= controller_type %>"
7
+ memsize = "<%= memory_size %>"
8
+ scsi0:0.present = "TRUE"
9
+ scsi0:0.fileName = "<%= box_name %>.vmdk"
10
+ ide1:0.present = "TRUE"
11
+ ide1:0.fileName = "<%= iso_file %>"
12
+ ide1:0.deviceType = "cdrom-image"
13
+ usb.present = "TRUE"
14
+ ehci.present = "TRUE"
15
+ pciBridge0.present = "TRUE"
16
+ pciBridge4.present = "TRUE"
17
+ pciBridge4.virtualDev = "pcieRootPort"
18
+ pciBridge4.functions = "8"
19
+ pciBridge5.present = "TRUE"
20
+ pciBridge5.virtualDev = "pcieRootPort"
21
+ pciBridge5.functions = "8"
22
+ pciBridge6.present = "TRUE"
23
+ pciBridge6.virtualDev = "pcieRootPort"
24
+ pciBridge6.functions = "8"
25
+ pciBridge7.present = "TRUE"
26
+ pciBridge7.virtualDev = "pcieRootPort"
27
+ pciBridge7.functions = "8"
28
+ vmci0.present = "TRUE"
29
+ roamingVM.exitBehavior = "go"
30
+ tools.syncTime = "TRUE"
31
+ displayName = "<%= box_name %>"
32
+ guestOS = "<%= fusion_os_type %>"
33
+ nvram = "<%= box_name %>.nvram"
34
+ virtualHW.productCompatibility = "hosted"
35
+ proxyApps.publishToHost = "FALSE"
36
+ tools.upgrade.policy = "upgradeAtPowerCycle"
37
+ powerType.powerOff = "soft"
38
+ powerType.powerOn = "soft"
39
+ powerType.suspend = "soft"
40
+ powerType.reset = "soft"
41
+ floppy0.present = "FALSE"
42
+ extendedConfigFile = "<%= box_name %>.vmxf"
43
+ checkpoint.vmState = ""
44
+ #uuid.location = "56 4d 7a 3a bb 23 52 50-d4 b3 d3 46 6e f3 aa 63"
45
+ #uuid.bios = "56 4d 7a 3a bb 23 52 50-d4 b3 d3 46 6e f3 aa 63"
46
+ cleanShutdown = "FALSE"
47
+ replay.supported = "FALSE"
48
+ debugStub.linuxOffsets = "0x0,0xffffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0"
49
+ replay.filename = ""
50
+ scsi0:0.redo = ""
51
+ pciBridge0.pciSlotNumber = "17"
52
+ pciBridge4.pciSlotNumber = "21"
53
+ pciBridge5.pciSlotNumber = "22"
54
+ pciBridge6.pciSlotNumber = "23"
55
+ pciBridge7.pciSlotNumber = "24"
56
+ scsi0.pciSlotNumber = "16"
57
+ usb.pciSlotNumber = "32"
58
+ ehci.pciSlotNumber = "34"
59
+ vmci0.pciSlotNumber = "35"
60
+ vmotion.checkpointFBSize = "65536000"
61
+ vmci0.id = "1861462627"
62
+ gui.fullScreenAtPowerOn = "FALSE"
63
+ gui.viewModeAtPowerOn = "windowed"
64
+ hgfs.mapRootShare = "TRUE"
65
+ hgfs.linkRootShare = "TRUE"
66
+ isolation.tools.hgfs.disable = "FALSE"
67
+ ethernet0.pciSlotNumber = "33"
68
+ ethernet0.present = "TRUE"
69
+ ethernet0.connectionType = "nat"
70
+ ethernet0.virtualDev = "e1000"
71
+ ethernet0.wakeOnPcktRcv = "FALSE"
72
+ ethernet0.addressType = "generated"
73
+ ethernet0.linkStatePropagation.enable = "FALSE"
74
+ #ethernet0.generatedAddress = "<%= mac_address %>S"
75
+ #ethernet0.generatedAddressOffset = "0"
76
+ ethernet0.vnet = "vmnet2"
77
+ ethernet0.bsdName = "en0"
78
+ ethernet0.displayName = "Ethernet"
79
+ sound.startConnected = "FALSE"
80
+ RemoteDisplay.vnc.enabled = "TRUE"
81
+ RemoteDisplay.vnc.port = "<%= vnc_port %>"
@@ -0,0 +1,37 @@
1
+ module Veewee
2
+ module Builder
3
+ module Vmfusion
4
+ module BuilderHelper
5
+
6
+ def validate_vmfusion(box_name,options)
7
+ require 'cucumber'
8
+
9
+ require 'cucumber/rspec/disable_option_parser'
10
+ require 'cucumber/cli/main'
11
+
12
+ ENV['veewee_user']=options[:user]
13
+ feature_path=File.join(File.dirname(__FILE__),"..","..","..","..","..","validation","vagrant.feature")
14
+
15
+ features=Array.new
16
+ features[0]=feature_path
17
+ features << "-t"
18
+ features << "@vmfusion"
19
+
20
+ begin
21
+ # The dup is to keep ARGV intact, so that tools like ruby-debug can respawn.
22
+ failure = Cucumber::Cli::Main.execute(features.dup)
23
+ Kernel.exit(failure ? 1 : 0)
24
+ rescue SystemExit => e
25
+ Kernel.exit(e.status)
26
+ rescue Exception => e
27
+ env.ui.error("#{e.message} (#{e.class})")
28
+ env.ui.error(e.backtrace.join("\n"))
29
+ Kernel.exit(1)
30
+ end
31
+
32
+ end
33
+ end #Module
34
+
35
+ end #Module
36
+ end #Module
37
+ end #Module
@@ -0,0 +1,103 @@
1
+ # /Library/Application\ Support/VMware\ Fusion/ovftool/ovftool.bin --help
2
+
3
+ falcon-pdb:Downloads patrick$ /Library/Application\ Support/VMware\ Fusion/ovftool/ovftool.bin --help
4
+ Usage: ovftool [options] <source> [<target>]
5
+ where
6
+ <source>: Source URL locator to an OVF package, VMX file, or virtual machine in
7
+ vCenter or on ESX Server.
8
+ <target>: Destination URL locator which specifies either a file location, or a
9
+ location in the vCenter inventory or on an ESX Server.
10
+
11
+ If <target> is not specified, information about the source is displayed to the
12
+ console.
13
+
14
+ Options:
15
+ --acceptAllEulas : Accept all end-user licenses agreements without
16
+ being prompted.
17
+ --authdPortSource : Use this to override default vmware authd port
18
+ (902) when using a host as source.
19
+ --authdPortTarget : Use this to override default vmware authd port
20
+ (902) when using a host as target.
21
+ --chunkSize : Specifies the chunk size to use for files in a
22
+ generated OVF package. The default is not to
23
+ chunk. The chunk size without unit is assumed
24
+ to be in megabytesAccepted units are b, kb, mb,
25
+ gb; e.g., 2gb or 100kb.
26
+ --compress : Compress the disks in an OVF package. Value
27
+ must be between 1 and 9. 1 is the fastest, but
28
+ gives the worst compression, whereas 9 is the
29
+ slowest, but gives the best compression.
30
+ -ds/--datastore : Target datastore name for a VI locator.
31
+ --deploymentOption : Selects what deployment option to use (if the
32
+ source OVF package supports multiple options.)
33
+ --disableVerification : Skip validation of signature and certificate.
34
+ -dm/--diskMode : Select target disk format. Supported formats
35
+ are: monolithicSparse, monolithicFlat,
36
+ twoGbMaxExtentSparse, twoGbMaxExtentFlat,
37
+ streamOptimized, thin (VI target) and thick (VI
38
+ target)
39
+ --eula : EULA to be inserted in the first virtual system
40
+ or virtual system collection in the OVF. If the
41
+ EULA is in a file, use the option
42
+ --eula@=filename instead.
43
+ -h /--help : Prints this message.
44
+ --hideEula : In OVF probe mode, hides the EULA.
45
+ --ipAllocationPolicy : IP allocation policy for a deployed OVF
46
+ package. Supported values are fixed, transient
47
+ and dhcp.
48
+ --ipProtocol : Select what IP protocol to use (IPv4, IPv6).
49
+ --lax : Relax OVF specification conformance and virtual
50
+ hardware compliance checks. Use only if you
51
+ know what you are doing.
52
+ --locale : Selects locale for target.
53
+ --machineOutput : Output OVF Tool messages in a machine friendly
54
+ manner.
55
+ --makeDeltaDisks : Build delta disk hierarchy from the given
56
+ source locator.
57
+ -n /--name : Specifies target name (defaults to source
58
+ name).
59
+ --net : Set a network assignment in the deployed OVF
60
+ package. A network assignment is set using the
61
+ syntax --net:<OVF name>=<target name>.
62
+ -nw/--network : Target network for a VI deployment.
63
+ --noDisks : Disable disk conversion.
64
+ --noImageFiles : Do not include image files in destination.
65
+ -o /--overwrite : Force overwrites of existing files.
66
+ --powerOffSource : Ensures a VM/vApp is powered off before
67
+ importing from a VI source.
68
+ --powerOffTarget : Ensures a VM/vApp is powered off before
69
+ overwriting a VI target.
70
+ --powerOn : Powers on a VM/vApp deployed on a VI target.
71
+ --privateKey : Sign OVF package with the given private key
72
+ (.pem file). The file must contain a private
73
+ key and a certificate.
74
+ --privateKeyPassword : Password for the private key. Should be used in
75
+ conjunction with privateKey if the private key
76
+ requires password authentication. If required
77
+ and not specified, the tool will prompt for the
78
+ password.
79
+ --prop : Set a property in the deployed OVF package. A
80
+ property is set using the syntax
81
+ --prop:<key>=<value>.
82
+ --proxy : Proxy used for HTTP[S] access.
83
+ -q /--quiet : No output to screen except errors.
84
+ --schemaValidate : Validate OVF descriptor against OVF schema.
85
+ --skipManifestCheck : Skip validation of OVF package manifest.
86
+ --skipManifestGeneration : Skip generation of OVF package manifest.
87
+ -st/--sourceType : Explicitly express that source is OVF, OVA,
88
+ VMX, VI, vApprun
89
+ -tt/--targetType : Explicitly express that target is OVF, OVA,
90
+ VMX, VI, vApprun
91
+ --verifyOnly : Do not upload the source but only verify it
92
+ against the target host. Applies to VI 4
93
+ targets only.
94
+ -v /--version : Prints the version of this tool.
95
+ -vf/--vmFolder : Target VM folder in VI inventory (relative to
96
+ datacenter).
97
+
98
+ For more help, type: --help <topic>, where topics are:
99
+ locators : For detailed source and destination locator syntax
100
+ examples : For examples of use
101
+ config : For syntax of configuration files
102
+ integration : For a list of options primarily used when ovftool is exec'ed
103
+ from another tool or shellscript.
@@ -0,0 +1,55 @@
1
+ require 'thor'
2
+
3
+ module Veewee
4
+ # Entrypoint for the Veewee CLI. This class should never be
5
+ # initialized directly (like a typical Thor class). Instead,
6
+ # use {Environment#cli} to invoke the CLI.
7
+ #
8
+ # # Defining Custom CLI Commands
9
+ #
10
+ # If you're looking to define custom CLI commands, then look at
11
+ # one of the two following classes:
12
+ #
13
+ # * {Command::Base} - Implementing a single command such as `mccloud up`, e.g.
14
+ # one without subcommands. Also take a look at {Command::NamedBase}.
15
+ # * {Command::GroupBase} - Implementing a command with subcommands, such as
16
+ # `mccloud box`, which has the `list`, `add`, etc. subcommands.
17
+ #
18
+ # The above linked classes contain the main documentation for each
19
+ # type of command.
20
+ class CLI < Thor
21
+ # Registers the given class with the CLI so it can be accessed.
22
+ # The class must be a subclass of either {Command::Base} or {Command::GroupBase}.
23
+ # Don't call this method directly, instead call the {Command::Base.register}
24
+ # or {Command::GroupBase.register} methods.
25
+ #
26
+ # @param [Class] klass Command class
27
+ # @param [String] name Command name, accessed at `mccloud NAME`
28
+ # @param [String] usage Command usage, such as "mccloud NAME [--option]"
29
+ # @param [String] description Description of the command shown during the
30
+ # command listing.
31
+ # @param [Hash] opts Other options (not gone into detail here, look at
32
+ # the source instead).
33
+ def self.register(klass, name, usage, description, opts=nil)
34
+ opts ||= {}
35
+
36
+ if klass <= Command::GroupBase
37
+ # A subclass of GroupBase is a subcommand, since it contains
38
+ # many smaller commands within it.
39
+ desc usage, description, opts
40
+ subcommand name, klass
41
+ elsif klass <= Command::Base
42
+ # A subclass of Base is a single command, since it
43
+ # is invoked as a whole (as Thor::Group)
44
+ desc usage, description, opts
45
+ define_method(name) { |*args| invoke klass, args }
46
+ end
47
+
48
+ if opts[:alias]
49
+ # Alises are defined for this command, so properly alias the
50
+ # newly defined method/subcommand:
51
+ map opts[:alias] => name
52
+ end
53
+ end
54
+ end
55
+ end #Veewee
@@ -1,24 +1,14 @@
1
- require 'veewee/session'
2
-
3
- #Load Veewee::Session libraries
4
- lib_dir= File.expand_path(File.join(File.dirname(__FILE__),"..","..", "lib"))
5
- Dir.glob(File.join(lib_dir, '**','*.rb')).each {|f| require f }
6
-
7
- #Setup some base variables to use
8
- template_dir=File.expand_path(File.join(lib_dir,"..", "templates"))
9
-
10
- veewee_dir="."
11
- definition_dir= File.expand_path(File.join(veewee_dir, "definitions"))
12
- tmp_dir=File.expand_path(File.join(veewee_dir, "tmp"))
13
- iso_dir=File.expand_path(File.join(veewee_dir, "iso"))
14
- box_dir=File.expand_path(File.join(veewee_dir, "boxes"))
15
- validation_dir=File.expand_path(File.join(lib_dir, "..","validation"))
16
-
17
- #Initialize
18
- Veewee::Session.setenv({:veewee_dir => veewee_dir, :definition_dir => definition_dir,
19
- :template_dir => template_dir, :iso_dir => iso_dir, :box_dir => box_dir, :tmp_dir => tmp_dir, :validation_dir => validation_dir})
20
-
21
1
  module Veewee
22
2
  module Command
3
+ autoload :Base, 'veewee/command/base'
4
+ autoload :GroupBase, 'veewee/command/group_base'
5
+ autoload :Helpers, 'veewee/command/helpers'
6
+ autoload :NamedBase, 'veewee/command/named_base'
23
7
  end
24
8
  end
9
+
10
+ # The built-in commands must always be loaded
11
+ require 'veewee/command/version'
12
+ require 'veewee/command/kvm'
13
+ require 'veewee/command/virtualbox'
14
+ require 'veewee/command/vmfusion'
@@ -0,0 +1,106 @@
1
+ require 'thor/group'
2
+ require 'thor/actions'
3
+
4
+ module Veewee
5
+ module Command
6
+ # A {Base} is the superclass for all commands which are single
7
+ # commands, e.g. `veewee init`, `veewee up`. Not commands like
8
+ # `veewee box add`. For commands which have more subcommands, use
9
+ # a {GroupBase}.
10
+ #
11
+ # A {Base} is a subclass of `Thor::Group`, so view the documentation
12
+ # there on how to add arguments, descriptions etc. The important note
13
+ # about this is that when invoked, _all public methods_ will be called
14
+ # in the order they are defined. If you don't want a method called when
15
+ # the command is invoked, it must be made `protected` or `private`.
16
+ #
17
+ # The best way to get examples of how to create your own command is to
18
+ # view the various Veewee commands, which are relatively simple, and
19
+ # can be found in the Veewee source tree at `lib/veewee/command/`.
20
+ #
21
+ # # Defining a New Command
22
+ #
23
+ # To define a new single command, create a new class which inherits
24
+ # from this class, then call {register} to register the command. That's
25
+ # it! When the command is invoked, _all public methods_ will be called.
26
+ # Below is an example `SayHello` class:
27
+ #
28
+ # class SayHello < Veewee::Command::Base
29
+ # register "hello", "Says hello"
30
+ #
31
+ # def hello
32
+ # env.ui.info "Hello"
33
+ # end
34
+ # end
35
+ #
36
+ # In this case, the above class is invokable via `veewee hello`. To give
37
+ # this a try, just copy and paste the above into a Veeweefile somewhere.
38
+ # The command will be available for that project!
39
+ #
40
+ # Also note that the above example uses `env.ui` to output. It is recommended
41
+ # you use this instead of raw "env.ui.info" since it is configurable and provides
42
+ # additional functionality, such as colors and asking for user input. See
43
+ # the {UI} class for more information.
44
+ #
45
+ # ## Defining Command-line Options
46
+ #
47
+ # Most command line actions won't be as simple as `veewee hello`, and will
48
+ # probably require parameters or switches. Luckily, Thor makes adding these
49
+ # easy:
50
+ #
51
+ # class SayHello < Veewee::Command::Base
52
+ # register "hello", "Says hello"
53
+ # argument :name, :type => :string
54
+ #
55
+ # def hello
56
+ # env.ui.info "Hello, #{name}"
57
+ # end
58
+ # end
59
+ #
60
+ # Then, the above can be invoked with `veewee hello Mitchell` which would
61
+ # output "Hello, Mitchell." If instead you're looking for switches, such as
62
+ # "--name Mitchell", then take a look at `class_option`, an example of which
63
+ # can be found in the {PackageCommand}.
64
+ class Base < Thor::Group
65
+ include Thor::Actions
66
+ include Helpers
67
+
68
+ attr_reader :env
69
+
70
+ # Register the command with the main Veewee CLI under the
71
+ # given name. The name will be used for accessing it from the CLI,
72
+ # so if you name it "lamp", then the command to invoke this
73
+ # will be `veewee lamp`.
74
+ #
75
+ # The description is used when the help is listed, and is meant to be
76
+ # a brief (one sentence) description of what the command does.
77
+ #
78
+ # Some additional options may be passed in as the last parameter:
79
+ #
80
+ # * `:alias` - If given as an array or string, these will be aliases
81
+ # for the same command. For example, `veewee version` is also
82
+ # `veewee --version` and `veewee -v`
83
+ #
84
+ # @param [String] usage
85
+ # @param [String] description
86
+ # @param [Hash] opts
87
+ def self.register(usage, description, opts=nil)
88
+ desc description
89
+ ::Veewee::CLI.register(self, extract_name_from_usage(usage), usage, desc, opts)
90
+ end
91
+
92
+ def initialize(*args)
93
+ super
94
+ initialize_environment(*args)
95
+ end
96
+
97
+ protected
98
+
99
+ # Extracts the name of the command from a usage string. Example:
100
+ # `init [box_name] [box_url]` becomes just `init`.
101
+ def self.extract_name_from_usage(usage)
102
+ /^([-_a-zA-Z0-9]+)(\s+(.+?))?$/.match(usage).to_a[1]
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,107 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+
4
+ module Veewee
5
+ module Command
6
+ # A {GroupBase} is the superclass which should be used if you're
7
+ # creating a CLI command which has subcommands such as `veewee box`,
8
+ # which has subcommands such as `add`, `remove`, `list`. If you're
9
+ # creating a simple command which has no subcommands, such as `veewee up`,
10
+ # then use {Base} instead.
11
+ #
12
+ # Unlike {Base}, where all public methods are executed, in a {GroupBase},
13
+ # each public method defines a separate task which can be invoked. The best
14
+ # way to get examples of how to create a {GroupBase} command is to look
15
+ # at the built-in commands, such as {BoxCommand}.
16
+ #
17
+ # # Defining a New Command
18
+ #
19
+ # To define a new command with subcommands, create a new class which inherits
20
+ # from this class, then call {register} to register the command. That's it! When
21
+ # the command is invoked, the method matching the subcommand is invoked. An
22
+ # example is shown below:
23
+ #
24
+ # class SayCommand < Veewee::Command::GroupBase
25
+ # register "say", "Say hello or goodbye"
26
+ #
27
+ # desc "hello", "say hello"
28
+ # def hello
29
+ # env.ui.info "Hello"
30
+ # end
31
+ #
32
+ # desc "goodbye", "say goodbye"
33
+ # def goodbye
34
+ # env.ui.info "Goodbye"
35
+ # end
36
+ # end
37
+ #
38
+ # In this case, the above class is invokable via `veewee say hello` or
39
+ # `veewee say goodbye`. To give it a try yourself, just copy and paste
40
+ # the above into a Veeweefile somewhere, and run `veewee` from within
41
+ # that directory. You should see the new command!
42
+ #
43
+ # Also notice that in the above, each task follows a `desc` call. This
44
+ # call is used to provide usage and description for each task, and is
45
+ # required.
46
+ #
47
+ # ## Defining Command-line Options
48
+ #
49
+ # ### Arguments
50
+ #
51
+ # To define arguments to your commands, such as `veewee say hello mitchell`,
52
+ # then you simply define them as arguments to the method implementing the
53
+ # task. An example is shown below (only the method, to keep things brief):
54
+ #
55
+ # def hello(name)
56
+ # env.ui.info "Hello, #{name}"
57
+ # end
58
+ #
59
+ # Then, if `veewee say hello mitchell` was called, then the output would
60
+ # be "Hello, mitchell"
61
+ #
62
+ # ### Switches or Other Options
63
+ #
64
+ # TODO
65
+ class GroupBase < Thor
66
+ include Thor::Actions
67
+ include Helpers
68
+
69
+ attr_reader :env
70
+
71
+ # Register the command with the main Veewee CLI under the given
72
+ # usage. The usage will be used for accessing it from the CLI,
73
+ # so if you give it a usage of `lamp [subcommand]`, then the command
74
+ # to invoke this will be `veewee lamp` (with a subcommand).
75
+ #
76
+ # The description is used when a listing of the commands is given
77
+ # and is meant to be a brief (one sentence) description of what this
78
+ # command does.
79
+ #
80
+ # Some additional options may be passed in as the last parameter:
81
+ #
82
+ # * `:alias` - If given as an array or string, these will be aliases
83
+ # for the same command. For example, `veewee version` is also
84
+ # `veewee --version` and `veewee -v`
85
+ #
86
+ # @param [String] usage
87
+ # @param [String] description
88
+ # @param [Hash] opts
89
+ def self.register(usage, description, opts=nil)
90
+ @_name = Base.extract_name_from_usage(usage)
91
+ CLI.register(self, @_name, usage, description, opts)
92
+ end
93
+
94
+ def initialize(*args)
95
+ super
96
+ initialize_environment(*args)
97
+ end
98
+
99
+ protected
100
+
101
+ # Override the basename to include the subcommand name.
102
+ def self.basename
103
+ "#{super} #{@_name}"
104
+ end
105
+ end
106
+ end
107
+ end