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.
- data/.gitignore +3 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +53 -30
- data/License +21 -0
- data/README-LIB.md +2 -0
- data/README.md +35 -62
- data/Rakefile +54 -88
- data/bin/veewee +13 -70
- data/bin/veewee-kvm-old +34 -0
- data/bin/veewee-vagrant +55 -0
- data/bin/veewee-vmfusion +34 -0
- data/lib/fission.rb +41 -0
- data/lib/fission/cli.rb +76 -0
- data/lib/fission/command.rb +15 -0
- data/lib/fission/command/clone.rb +68 -0
- data/lib/fission/command/delete.rb +71 -0
- data/lib/fission/command/snapshot_create.rb +52 -0
- data/lib/fission/command/snapshot_list.rb +45 -0
- data/lib/fission/command/snapshot_revert.rb +54 -0
- data/lib/fission/command/start.rb +69 -0
- data/lib/fission/command/status.rb +31 -0
- data/lib/fission/command/stop.rb +49 -0
- data/lib/fission/command/suspend.rb +67 -0
- data/lib/fission/config.rb +29 -0
- data/lib/fission/core_ext/class.rb +5 -0
- data/lib/fission/core_ext/file.rb +7 -0
- data/lib/fission/core_ext/object.rb +112 -0
- data/lib/fission/error.rb +9 -0
- data/lib/fission/fusion.rb +17 -0
- data/lib/fission/leasesfile.rb +74 -0
- data/lib/fission/metadata.rb +39 -0
- data/lib/fission/response.rb +16 -0
- data/lib/fission/ui.rb +22 -0
- data/lib/fission/version.rb +3 -0
- data/lib/fission/vm.rb +361 -0
- data/lib/net/vnc/vnc.rb +341 -0
- data/lib/vagrant_init.rb +5 -2
- data/lib/veewee.rb +20 -3
- data/lib/veewee/builder/core/box.rb +32 -0
- data/lib/veewee/builder/core/box/vnc.rb +122 -0
- data/lib/veewee/builder/core/builder.rb +90 -0
- data/lib/veewee/builder/core/builder/build.rb +250 -0
- data/lib/veewee/builder/core/builder/iso.rb +120 -0
- data/lib/veewee/builder/core/builder/transaction.rb +25 -0
- data/lib/veewee/builder/core/builder/tunnel.rb +46 -0
- data/lib/veewee/builder/kvm/box.rb +130 -0
- data/lib/veewee/builder/kvm/builder.rb +38 -0
- data/lib/veewee/builder/virtualbox/box.rb +121 -0
- data/lib/veewee/builder/virtualbox/builder.rb +48 -0
- data/lib/veewee/builder/virtualbox/helper/_snapshots.rb +105 -0
- data/lib/veewee/builder/virtualbox/helper/_transaction.rb +135 -0
- data/lib/veewee/builder/virtualbox/helper/console_type.rb +62 -0
- data/lib/veewee/builder/virtualbox/helper/create.rb +210 -0
- data/lib/veewee/builder/virtualbox/helper/destroy.rb +79 -0
- data/lib/veewee/builder/virtualbox/helper/export_vagrant.rb +87 -0
- data/lib/veewee/builder/virtualbox/helper/validate_vagrant.rb +35 -0
- data/lib/veewee/builder/vmfusion/box.rb +137 -0
- data/lib/veewee/builder/vmfusion/builder.rb +78 -0
- data/lib/veewee/builder/vmfusion/helper/create.rb +68 -0
- data/lib/veewee/builder/vmfusion/helper/export_ova.rb +26 -0
- data/lib/veewee/builder/vmfusion/helper/template.rb +39 -0
- data/lib/veewee/builder/vmfusion/helper/template.vmx.erb +81 -0
- data/lib/veewee/builder/vmfusion/helper/validate_vmfusion.rb +37 -0
- data/lib/veewee/builder/vmfusion/info/export_ovf.info +103 -0
- data/lib/veewee/cli.rb +55 -0
- data/lib/veewee/command.rb +10 -20
- data/lib/veewee/command/base.rb +106 -0
- data/lib/veewee/command/group_base.rb +107 -0
- data/lib/veewee/command/helpers.rb +13 -0
- data/lib/veewee/command/kvm.rb +85 -0
- data/lib/veewee/command/named_base.rb +14 -0
- data/lib/veewee/command/vagrant.rb +108 -0
- data/lib/veewee/command/version.rb +13 -0
- data/lib/veewee/command/virtualbox.rb +86 -0
- data/lib/veewee/command/vmfusion.rb +113 -0
- data/lib/veewee/config.rb +89 -3
- data/lib/veewee/config/builders.rb +36 -0
- data/lib/veewee/config/collection.rb +82 -0
- data/lib/veewee/config/component.rb +19 -0
- data/lib/veewee/config/definition.rb +44 -0
- data/lib/veewee/config/ostypes.yml +165 -0
- data/lib/veewee/config/veewee.rb +21 -0
- data/lib/veewee/definition.rb +130 -0
- data/lib/veewee/environment.rb +367 -0
- data/lib/veewee/error.rb +20 -0
- data/lib/veewee/templates/locales/en.yml +30 -0
- data/lib/veewee/ui.rb +83 -0
- data/lib/veewee/util/scancode.rb +112 -0
- data/lib/veewee/util/shell.rb +42 -0
- data/lib/veewee/util/ssh.rb +158 -0
- data/lib/veewee/util/tcp.rb +88 -0
- data/lib/veewee/util/web.rb +63 -0
- data/lib/veewee/vagrant/config.rb +7 -0
- data/lib/veewee/version.rb +6 -1
- data/templates/CentOS-4.8-i386/definition.rb +3 -3
- data/templates/CentOS-4.8-i386/postinstall.sh +2 -2
- data/templates/CentOS-5.5-x86_64-netboot/definition.rb +1 -1
- data/templates/CentOS-5.5-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-5.6-i386-netboot/definition.rb +3 -3
- data/templates/CentOS-5.6-i386-netboot/ks.cfg +2 -2
- data/templates/CentOS-5.6-i386-netboot/postinstall.sh +2 -2
- data/templates/CentOS-5.6-i386/definition.rb +2 -2
- data/templates/CentOS-5.6-i386/postinstall.sh +2 -2
- data/templates/CentOS-5.6-x86_64-netboot/definition.rb +3 -3
- data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +1 -1
- data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-5.7-i386-netboot/postinstall.sh +3 -3
- data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-6.0-i386-netboot/definition.rb +2 -2
- data/templates/CentOS-6.0-i386-netboot/postinstall.sh +2 -2
- data/templates/CentOS-6.0-i386/definition.rb +2 -2
- data/templates/CentOS-6.0-i386/postinstall.sh +2 -2
- data/templates/CentOS-6.0-x86_64-minimal/definition.rb +2 -2
- data/templates/CentOS-6.0-x86_64-minimal/postinstall.sh +4 -17
- data/templates/CentOS-6.0-x86_64-netboot/definition.rb +2 -2
- data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +2 -2
- data/templates/CentOS-6.0-x86_64/definition.rb +2 -2
- data/templates/CentOS-6.0-x86_64/postinstall.sh +2 -2
- data/templates/Debian-5.0.8-amd64-netboot/definition.rb +1 -1
- data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +1 -1
- data/templates/Debian-5.0.8-i386-netboot/definition.rb +1 -1
- data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +1 -1
- data/templates/{Debian-6.0.3-amd64-netboot → Debian-6.0.2-amd64-netboot}/definition.rb +4 -4
- data/templates/{ubuntu-11.10-server-amd64-ishaya → Debian-6.0.2-amd64-netboot}/postinstall.sh +23 -42
- data/templates/{Debian-6.0.3-amd64-netboot → Debian-6.0.2-amd64-netboot}/preseed.cfg +0 -0
- data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/definition.rb +4 -4
- data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/postinstall.sh +1 -1
- data/templates/{Debian-6.0.3-i386-netboot → Debian-6.0.2-i386-netboot}/preseed.cfg +0 -0
- data/templates/Fedora-14-amd64-netboot/definition.rb +2 -2
- data/templates/Fedora-14-amd64-netboot/postinstall.sh +2 -2
- data/templates/Fedora-14-amd64/definition.rb +2 -2
- data/templates/Fedora-14-amd64/postinstall.sh +2 -2
- data/templates/Fedora-14-i386-netboot/definition.rb +2 -2
- data/templates/Fedora-14-i386-netboot/postinstall.sh +2 -2
- data/templates/Fedora-14-i386/definition.rb +2 -2
- data/templates/Fedora-14-i386/postinstall.sh +2 -2
- data/templates/Fedora-15-i386-netboot/definition.rb +2 -2
- data/templates/Fedora-15-i386/definition.rb +3 -3
- data/templates/Sysrescuecd-2.0.0-experimental/definition.rb +1 -1
- data/templates/archlinux-i386-netboot/aif.cfg +14 -8
- data/templates/archlinux-i386-netboot/definition.rb +7 -4
- data/templates/archlinux-i386-netboot/postinstall.sh +17 -5
- data/templates/archlinux-i386-netboot/postinstall2.sh +1 -3
- data/templates/archlinux-i386/definition.rb +4 -4
- data/templates/archlinux-i386/postinstall.sh +1 -1
- data/templates/archlinux-x86_64-netboot/aif.cfg +14 -8
- data/templates/archlinux-x86_64-netboot/definition.rb +7 -4
- data/templates/archlinux-x86_64-netboot/postinstall.sh +16 -1
- data/templates/archlinux-x86_64-netboot/postinstall2.sh +1 -3
- data/templates/archlinux-x86_64/definition.rb +2 -2
- data/templates/archlinux-x86_64/postinstall.sh +1 -1
- data/templates/freebsd-8.2-experimental/definition.rb +1 -1
- data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +2 -5
- data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +1 -1
- data/templates/freebsd-8.2-pcbsd-i386/definition.rb +3 -4
- data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +1 -1
- data/templates/gentoo-latest-i386-experimental/definition.rb +7 -7
- data/templates/gentoo-latest-i386-experimental/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-NET-i586/postinstall.sh +1 -1
- data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +1 -1
- data/templates/openindiana-148-ai-x86/definition.rb +3 -3
- data/templates/openindiana-148-ai-x86/postinstall.sh +1 -1
- data/templates/opensuse-11.4-i386-experimental/definition.rb +1 -1
- data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -1
- data/templates/solaris-11-express-i386/definition.rb +3 -3
- data/templates/solaris-11-express-i386/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.2-amd64-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.2-server-i386-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.3-server-amd64-alt/definition.rb +6 -6
- data/templates/ubuntu-10.04.3-server-amd64-alt/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.3-server-amd64/base.sh +11 -0
- data/templates/ubuntu-10.04.3-server-amd64/chef.sh +2 -0
- data/templates/ubuntu-10.04.3-server-amd64/cleanup.sh +19 -0
- data/templates/ubuntu-10.04.3-server-amd64/definition.rb +19 -11
- data/templates/ubuntu-10.04.3-server-amd64/preseed.cfg +4 -4
- data/templates/ubuntu-10.04.3-server-amd64/puppet.sh +1 -0
- data/templates/ubuntu-10.04.3-server-amd64/ruby.sh +24 -0
- data/templates/ubuntu-10.04.3-server-amd64/vagrant.sh +27 -0
- data/templates/ubuntu-10.04.3-server-amd64/virtualbox.sh +12 -0
- data/templates/ubuntu-10.04.3-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64/base.sh +11 -0
- data/templates/ubuntu-10.10-server-amd64/chef.sh +2 -0
- data/templates/ubuntu-10.10-server-amd64/cleanup.sh +19 -0
- data/templates/ubuntu-10.10-server-amd64/definition.rb +20 -8
- data/templates/ubuntu-10.10-server-amd64/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64/preseed.cfg +5 -5
- data/templates/ubuntu-10.10-server-amd64/puppet.sh +1 -0
- data/templates/ubuntu-10.10-server-amd64/ruby.sh +24 -0
- data/templates/ubuntu-10.10-server-amd64/vagrant.sh +27 -0
- data/templates/ubuntu-10.10-server-amd64/virtualbox.sh +12 -0
- data/templates/ubuntu-10.10-server-i386-netboot/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-i386/definition.rb +1 -1
- data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-11.04-server-amd64/apt-upgrade.sh +4 -0
- data/templates/ubuntu-11.04-server-amd64/chef.sh +1 -0
- data/templates/ubuntu-11.04-server-amd64/definition.rb +32 -9
- data/templates/ubuntu-11.04-server-amd64/network-cleanup.sh +14 -0
- data/templates/ubuntu-11.04-server-amd64/nfs-client.sh +3 -0
- data/templates/ubuntu-11.04-server-amd64/puppet.sh +1 -0
- data/templates/ubuntu-11.04-server-amd64/remove-build-essentials.sh +3 -0
- data/templates/ubuntu-11.04-server-amd64/ruby.sh +29 -0
- data/templates/ubuntu-11.04-server-amd64/ssh-keys.sh +7 -0
- data/templates/ubuntu-11.04-server-amd64/sudo.sh +4 -0
- data/templates/ubuntu-11.04-server-amd64/timestamp.sh +1 -0
- data/templates/ubuntu-11.04-server-amd64/vbox_additions.sh +11 -0
- data/templates/ubuntu-11.04-server-amd64/zero-disk.sh +3 -0
- data/templates/ubuntu-11.04-server-i386/definition.rb +2 -2
- data/templates/ubuntu-11.04-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-8.04.4-server-amd64/definition.rb +1 -2
- data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +7 -8
- data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +1 -0
- data/templates/ubuntu-8.04.4-server-i386/definition.rb +2 -2
- data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +3 -25
- data/templates/windows-2008R2-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R2-amd64/definition.rb +1 -1
- data/templates/windows-2008R2-amd64/install-winrm.bat +0 -2
- data/templates/windows-2008R2-amd64/postinstall.sh +1 -1
- data/templates/windows-2008R2-amd64/win7/Autounattend.xml +180 -0
- data/test/build_test.rb +50 -0
- data/test/definition_test.rb +11 -0
- data/test/definitions/test_definition/_test_me.sh +1 -0
- data/test/definitions/test_definition/autorun0 +3 -0
- data/test/definitions/test_definition/definition.rb +27 -0
- data/test/environment_test.rb +67 -0
- data/validation/features/steps/ssh_steps.rb +52 -52
- data/validation/vagrant.feature +64 -48
- data/veewee.gemspec +14 -9
- metadata +243 -213
- data/lib/veewee/command/basebox.rb +0 -63
- data/lib/veewee/command/basebox_build.rb +0 -32
- data/lib/veewee/command/basebox_define.rb +0 -28
- data/lib/veewee/command/basebox_destroy.rb +0 -22
- data/lib/veewee/command/basebox_export.rb +0 -22
- data/lib/veewee/command/basebox_list.rb +0 -23
- data/lib/veewee/command/basebox_ostypes.rb +0 -23
- data/lib/veewee/command/basebox_templates.rb +0 -23
- data/lib/veewee/command/basebox_undefine.rb +0 -22
- data/lib/veewee/command/basebox_validate.rb +0 -26
- data/lib/veewee/export.rb +0 -81
- data/lib/veewee/scancode.rb +0 -151
- data/lib/veewee/session.rb +0 -907
- data/lib/veewee/shell.rb +0 -54
- data/lib/veewee/ssh.rb +0 -193
- data/lib/veewee/transaction.rb +0 -122
- data/lib/veewee/utils.rb +0 -26
- data/lib/veewee/web.rb +0 -48
- data/templates/CentOS-6.1-x86_64-minimal/definition.rb +0 -15
- data/templates/CentOS-6.1-x86_64-minimal/ks.cfg +0 -37
- data/templates/CentOS-6.1-x86_64-minimal/postinstall.sh +0 -50
- data/templates/CentOS-6.2-x86_64-minimal/definition.rb +0 -15
- data/templates/CentOS-6.2-x86_64-minimal/ks.cfg +0 -37
- data/templates/CentOS-6.2-x86_64-minimal/postinstall.sh +0 -50
- data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +0 -80
- data/templates/Fedora-15-x86_64-netboot/definition.rb +0 -29
- data/templates/Fedora-15-x86_64-netboot/ks.cfg +0 -64
- data/templates/Fedora-15-x86_64-netboot/postinstall.sh +0 -33
- data/templates/Fedora-16-i386/definition.rb +0 -17
- data/templates/Fedora-16-i386/ks.cfg +0 -72
- data/templates/Fedora-16-i386/postinstall.sh +0 -35
- data/templates/Fedora-16-x86_64/definition.rb +0 -17
- data/templates/Fedora-16-x86_64/ks.cfg +0 -72
- data/templates/Fedora-16-x86_64/postinstall.sh +0 -35
- data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_de.xml +0 -1127
- data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_en.xml +0 -1127
- data/templates/SLES-11-SP1-DVD-i586-GM/definition.rb +0 -37
- data/templates/SLES-11-SP1-DVD-i586-GM/postinstall.sh +0 -43
- data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_de.xml +0 -1171
- data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_en.xml +0 -1171
- data/templates/SLES-11-SP1-DVD-x86_64-GM/definition.rb +0 -37
- data/templates/SLES-11-SP1-DVD-x86_64-GM/postinstall.sh +0 -43
- data/templates/funtoo-latest-generic_64-stable/definition.rb +0 -34
- data/templates/funtoo-latest-generic_64-stable/postinstall.sh +0 -177
- data/templates/funtoo-latest-generic_64-stable/postinstall2.sh +0 -83
- data/templates/gentoo-latest-x86_64-experimental/definition.rb +0 -34
- data/templates/gentoo-latest-x86_64-experimental/postinstall.sh +0 -214
- data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_de.xml +0 -1483
- data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_en.xml +0 -1483
- data/templates/openSUSE-12.1-DVD+NET-i586/definition.rb +0 -44
- data/templates/openSUSE-12.1-DVD+NET-i586/postinstall.sh +0 -43
- data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_de.xml +0 -1727
- data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_en.xml +0 -1727
- data/templates/openSUSE-12.1-DVD+NET-x86_64/definition.rb +0 -44
- data/templates/openSUSE-12.1-DVD+NET-x86_64/postinstall.sh +0 -43
- data/templates/openbsd50_amd64/README +0 -28
- data/templates/openbsd50_amd64/definition.rb +0 -84
- data/templates/openbsd50_amd64/postinstall.sh +0 -81
- data/templates/openbsd50_i386/.definition.rb.swp +0 -0
- data/templates/openbsd50_i386/README +0 -28
- data/templates/openbsd50_i386/definition.rb +0 -84
- data/templates/openbsd50_i386/postinstall.sh +0 -80
- data/templates/scientificlinux-6.1-i386-netboot/definition.rb +0 -16
- data/templates/scientificlinux-6.1-i386-netboot/ks.cfg +0 -53
- data/templates/scientificlinux-6.1-i386-netboot/postinstall.sh +0 -30
- data/templates/scientificlinux-6.1-x86_64-netboot/definition.rb +0 -16
- data/templates/scientificlinux-6.1-x86_64-netboot/ks.cfg +0 -53
- data/templates/scientificlinux-6.1-x86_64-netboot/postinstall.sh +0 -30
- data/templates/ubuntu-10.04.3-server-amd64/postinstall.sh +0 -90
- data/templates/ubuntu-11.04-server-amd64/postinstall.sh +0 -96
- data/templates/ubuntu-11.10-server-amd64-ishaya/definition.rb +0 -24
- data/templates/ubuntu-11.10-server-amd64-ishaya/preseed.cfg +0 -87
- data/templates/ubuntu-11.10-server-amd64-ruby192/definition.rb +0 -24
- data/templates/ubuntu-11.10-server-amd64-ruby192/postinstall.sh +0 -90
- data/templates/ubuntu-11.10-server-amd64-ruby192/preseed.cfg +0 -87
- data/templates/ubuntu-11.10-server-amd64/definition.rb +0 -35
- data/templates/ubuntu-11.10-server-amd64/postinstall.sh +0 -88
- data/templates/ubuntu-11.10-server-amd64/preseed.cfg +0 -87
- data/templates/ubuntu-11.10-server-i386/definition.rb +0 -35
- data/templates/ubuntu-11.10-server-i386/postinstall.sh +0 -88
- data/templates/ubuntu-11.10-server-i386/preseed.cfg +0 -87
- data/templates/windows-2008R1-serverstandard-amd64/Autounattend.xml +0 -146
- data/templates/windows-2008R1-serverstandard-amd64/README.md +0 -134
- data/templates/windows-2008R1-serverstandard-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R1-serverstandard-amd64/definition.rb +0 -114
- data/templates/windows-2008R1-serverstandard-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-2008R1-serverstandard-amd64/install-guest-additions.bat +0 -5
- data/templates/windows-2008R1-serverstandard-amd64/install-winrm.bat +0 -14
- data/templates/windows-2008R1-serverstandard-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R1-serverstandard-amd64/postinstall.sh +0 -74
- data/templates/windows-2008R1-serverstandard-amd64/sudo +0 -2
- data/templates/windows-2008R1-serverstandard-amd64/winrm.rb +0 -8
- data/templates/windows-2008R2-serverstandard-amd64/Autounattend.xml +0 -147
- data/templates/windows-2008R2-serverstandard-amd64/README.md +0 -142
- data/templates/windows-2008R2-serverstandard-amd64/definition.rb +0 -44
- data/templates/windows-2008R2-serverstandard-amd64/install-cygwin-sshd.bat +0 -41
- data/templates/windows-2008R2-serverstandard-amd64/install-winrm.bat +0 -11
- data/templates/windows-2008R2-serverstandard-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R2-serverstandard-amd64/postinstall.sh +0 -74
- data/templates/windows-7-enterprise-amd64/Autounattend.xml +0 -149
- data/templates/windows-7-enterprise-amd64/README.md +0 -52
- data/templates/windows-7-enterprise-amd64/definition.rb +0 -39
- data/templates/windows-7-enterprise-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-enterprise-amd64/install-winrm.bat +0 -14
- data/templates/windows-7-enterprise-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-enterprise-amd64/postinstall.sh +0 -74
- data/templates/windows-7-enterprise-i386/Autounattend.xml +0 -151
- data/templates/windows-7-enterprise-i386/README.md +0 -169
- data/templates/windows-7-enterprise-i386/definition.rb +0 -40
- data/templates/windows-7-enterprise-i386/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-enterprise-i386/install-winrm.bat +0 -14
- data/templates/windows-7-enterprise-i386/oracle-cert.cer +0 -0
- data/templates/windows-7-enterprise-i386/postinstall.sh +0 -74
- data/templates/windows-7-premium-amd64/Autounattend.xml +0 -152
- data/templates/windows-7-premium-amd64/README.md +0 -171
- data/templates/windows-7-premium-amd64/definition.rb +0 -38
- data/templates/windows-7-premium-amd64/install-chefclient.bat +0 -44
- data/templates/windows-7-premium-amd64/install-winrm.bat +0 -11
- data/templates/windows-7-premium-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-premium-amd64/postinstall.sh +0 -124
- data/templates/windows-7-premium-amd64/winrm.rb +0 -8
- data/templates/windows-7-professional-amd64/Autounattend.xml +0 -152
- data/templates/windows-7-professional-amd64/README.md +0 -171
- data/templates/windows-7-professional-amd64/definition.rb +0 -41
- data/templates/windows-7-professional-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-professional-amd64/install-winrm.bat +0 -14
- data/templates/windows-7-professional-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-professional-amd64/postinstall.sh +0 -74
- data/templates/windows-7-ultimate-amd64/Autounattend.xml +0 -152
- data/templates/windows-7-ultimate-amd64/README.md +0 -89
- data/templates/windows-7-ultimate-amd64/definition.rb +0 -41
- data/templates/windows-7-ultimate-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7-ultimate-amd64/install-winrm.bat +0 -14
- data/templates/windows-7-ultimate-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-ultimate-amd64/postinstall.sh +0 -74
- data/templates/windows-7sp1-ultimate-amd64/Autounattend.xml +0 -152
- data/templates/windows-7sp1-ultimate-amd64/README.md +0 -89
- data/templates/windows-7sp1-ultimate-amd64/definition.rb +0 -42
- data/templates/windows-7sp1-ultimate-amd64/install-cygwin-sshd.bat +0 -40
- data/templates/windows-7sp1-ultimate-amd64/install-winrm.bat +0 -14
- data/templates/windows-7sp1-ultimate-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7sp1-ultimate-amd64/postinstall.sh +0 -74
- data/templates/windows-8-preview-dev-amd64/Autounattend.xml +0 -140
- data/templates/windows-8-preview-dev-amd64/README.md +0 -134
- data/templates/windows-8-preview-dev-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-8-preview-dev-amd64/definition.rb +0 -114
- data/templates/windows-8-preview-dev-amd64/install-cygwin-sshd.bat +0 -38
- data/templates/windows-8-preview-dev-amd64/install-winrm.bat +0 -11
- data/templates/windows-8-preview-dev-amd64/oracle-cert.cer +0 -0
- data/templates/windows-8-preview-dev-amd64/postinstall.sh +0 -122
- data/templates/windows-8-preview-dev-amd64/winrm.rb +0 -8
- data/trials/docu-vbox.txt +0 -83
- data/trials/f.rb +0 -29
- 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.
|
data/lib/veewee/cli.rb
ADDED
@@ -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
|
data/lib/veewee/command.rb
CHANGED
@@ -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
|