Module: Blimpy::Cucumber::API
- Defined in:
- lib/blimpy/cucumber/api.rb
Instance Method Summary collapse
- #destroy_vms ⇒ Object
- #manifest_path ⇒ Object
- #modules_path ⇒ Object
- #nodes ⇒ Object
- #resources ⇒ Object
- #setup_work_dir ⇒ Object
- #start_vms ⇒ Object
- #vm(type = 'Linux') ⇒ Object
- #vm_flavor ⇒ Object
- #vm_name ⇒ Object
- #vm_ports ⇒ Object
- #work_dir ⇒ Object
Instance Method Details
#destroy_vms ⇒ Object
15 16 17 |
# File 'lib/blimpy/cucumber/api.rb', line 15 def destroy_vms @fleet.destroy unless @fleet.nil? end |
#manifest_path ⇒ Object
81 82 83 |
# File 'lib/blimpy/cucumber/api.rb', line 81 def manifest_path File.join(work_dir, 'manifests') end |
#modules_path ⇒ Object
85 86 87 |
# File 'lib/blimpy/cucumber/api.rb', line 85 def modules_path File.join(work_dir, 'modules') end |
#nodes ⇒ Object
71 72 73 74 75 |
# File 'lib/blimpy/cucumber/api.rb', line 71 def nodes # Nodes should be an Array of strings that will be joined together to # be tacked into the site.pp when the host is provisioned @nodes ||= [] end |
#resources ⇒ Object
65 66 67 68 69 |
# File 'lib/blimpy/cucumber/api.rb', line 65 def resources # Resources should be an Array of strings that will be joined together to # make the full Puppet node manifest that will be provisioned on the host @resources ||= [] end |
#setup_work_dir ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/blimpy/cucumber/api.rb', line 89 def setup_work_dir # We can't set this up unless we've already "remembered" our original # directory expect(@original_dir).to_not be_nil FileUtils.mkdir_p(manifest_path) # If we have an ignore file, we'll probably want it in the new tree as # well original_ignore = File.join(@original_dir, '.blimpignore') if File.exists? original_ignore FileUtils.ln_s(original_ignore, '.blimpignore') end end |
#start_vms ⇒ Object
9 10 11 12 13 |
# File 'lib/blimpy/cucumber/api.rb', line 9 def start_vms # Make sure we set up our vms at some point properly expect(vm).to_not be_nil @fleet.start end |
#vm(type = 'Linux') ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/blimpy/cucumber/api.rb', line 35 def vm(type='Linux') unless @fleet.nil? return @fleet.ships.first end # Default to Ubuntu 12.04 LTS in us-west-2 image_id = 'ami-4038b470' region = 'us-west-2' username = 'ubuntu' if type == 'FreeBSD' # FreeBSD 9.0-RELEASE/amd64 in us-west-2 image_id = 'ami-cab73afa' username = 'root' end @fleet = Blimpy.fleet do |fleet| fleet.add(:aws) do |ship| ship.name = vm_name ship.flavor = vm_flavor ship.image_id = image_id ship.username = username ship.ports = vm_ports ship.region = region ship.livery = Blimpy::Livery::Puppet end end @fleet.ships.first end |
#vm_flavor ⇒ Object
25 26 27 28 |
# File 'lib/blimpy/cucumber/api.rb', line 25 def vm_flavor return @vmflavor unless @vmflavor.nil? 'm1.small' end |
#vm_name ⇒ Object
19 20 21 22 23 |
# File 'lib/blimpy/cucumber/api.rb', line 19 def vm_name # If @vmname exists, we'll use that return @vmname unless @vmname.nil? 'blimpy-cucumber-test' end |
#vm_ports ⇒ Object
30 31 32 33 |
# File 'lib/blimpy/cucumber/api.rb', line 30 def vm_ports return @vmports unless @vmports.nil? [22, 80, 8080] end |
#work_dir ⇒ Object
77 78 79 |
# File 'lib/blimpy/cucumber/api.rb', line 77 def work_dir @work_dir ||= File.join(Dir.pwd, 'tmp', 'cucumber') end |