engineyard-local 0.2.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +73 -1
  3. data/README.md +40 -38
  4. data/config/dna.json +92 -66
  5. data/config/locales/en.yml +94 -9
  6. data/config/patches/chef-ey-1.1.336.patch +55 -0
  7. data/config/settings.yml +6 -1
  8. data/engineyard-local.gemspec +5 -4
  9. data/install/osx/README.md +42 -4
  10. data/install/osx/engineyard-local/engineyard-local.pkgproj +35 -6
  11. data/install/osx/images/dmg_background.png +0 -0
  12. data/install/osx/images/dmg_icon.icns +0 -0
  13. data/lib/engineyard-local.rb +64 -0
  14. data/lib/engineyard-local/command.rb +23 -0
  15. data/lib/engineyard-local/command/base.rb +78 -1
  16. data/lib/engineyard-local/command/group.rb +70 -6
  17. data/lib/engineyard-local/command/help.rb +36 -0
  18. data/lib/engineyard-local/command/helpers.rb +12 -0
  19. data/lib/engineyard-local/command/start.rb +26 -0
  20. data/lib/engineyard-local/command/status.rb +33 -0
  21. data/lib/engineyard-local/command/stop.rb +26 -0
  22. data/lib/engineyard-local/command/terminate.rb +26 -0
  23. data/lib/engineyard-local/command/up.rb +24 -15
  24. data/lib/engineyard-local/command/update.rb +42 -0
  25. data/lib/engineyard-local/middleware.rb +1 -0
  26. data/lib/engineyard-local/middleware/bundle.rb +1 -0
  27. data/lib/engineyard-local/middleware/chef.rb +52 -2
  28. data/lib/engineyard-local/middleware/cookbooks.rb +111 -0
  29. data/lib/engineyard-local/middleware/dna.rb +6 -4
  30. data/lib/engineyard-local/middleware/exec.rb +2 -1
  31. data/lib/engineyard-local/middleware/helpers/executable.rb +14 -2
  32. data/lib/engineyard-local/middleware/network.rb +3 -3
  33. data/lib/engineyard-local/middleware/rails.rb +1 -0
  34. data/lib/engineyard-local/middleware/rails/assets.rb +35 -0
  35. data/lib/engineyard-local/middleware/rails/command.rb +1 -1
  36. data/lib/engineyard-local/middleware/rails/db.rb +0 -1
  37. data/lib/engineyard-local/middleware/rails/new.rb +1 -1
  38. data/lib/engineyard-local/version.rb +1 -1
  39. data/test/engineyard-local/command/up_test.rb +1 -0
  40. data/test/integration/commands_test.rb +30 -0
  41. data/test/test_helper.rb +8 -2
  42. metadata +81 -70
  43. data/install/osx/images/eylocal_installer.png +0 -0
  44. data/test/integration/up_test.rb +0 -28
@@ -1,6 +1,22 @@
1
1
  # i18n
2
2
  en:
3
3
  eylocal:
4
+ terminate:
5
+ destroying: "Your ey-local instance is being destroyed ... "
6
+ not_created: "ey-local can not find a VM to terminate. If you wish to start a new VM, run 'ey-local up'."
7
+ stop:
8
+ saved: "The VM is already suspended. To resume it, issue an 'ey-local start'."
9
+ not_stopable: "The VM state is '%{state}'. 'ey-local stop' only works on running VMs. To start it, try 'ey-local up'."
10
+ not_created: "The VM has not been created. Use 'ey-local up' to start a new VM."
11
+ start:
12
+ running: "The VM is already running."
13
+ not_startable: "The VM state is '%{state}'. 'ey-local start' only works on VMs that have been suspended with 'ey-local stop'. To start it, try 'ey-local up'."
14
+ not_created: "The VM has not been created. Use 'ey-local up' to start a new VM."
15
+ update:
16
+ updating: "Updating the instance's cookbooks."
17
+ nothing: "The instance is current. There are no updates to apply."
18
+ fail: "The cookbook update failed."
19
+ success: "The instance's cookbooks have been updated."
4
20
  up:
5
21
  box_exists: A box named %{name} already exists.
6
22
  root_path: Using %{root_path} as the application directory.
@@ -9,6 +25,7 @@ en:
9
25
  bundling: Creating bundle if Gemfile|Gemfile.lock is present ...
10
26
  rails:
11
27
  db: Creating and migrating the db, rake tasks permitting ...
28
+ assets: Precompiling assets ...
12
29
  dna: Creating instance DNA ...
13
30
  chef: Initiating Chef run ...
14
31
  tag: Tagging vm as managed by ey-local ...
@@ -23,35 +40,103 @@ en:
23
40
  moving it to a new subnet in the Vagrantfile with:
24
41
 
25
42
  config.vm.network :hostonly, "33.33.<new subnet>.10"
43
+ vagrant:
44
+ commands:
45
+ status:
46
+ cookbooks_outdated: |-
47
+ --------------------------------------------------------------------
48
+ ALERT - The instance's cookbook version, %{version}, is out of date.
49
+ To fetch and deploy current version, run 'ey-local update'.
50
+
51
+ The current version, %{new_version}, includes the following changes:
52
+
53
+ %{changelog}
54
+
55
+ --------------------------------------------------------------------
56
+
57
+ cookbooks_current: |-
58
+ The instance's cookbook version, %{version}, is current.
59
+ output: |-
60
+ Current VM states:
61
+
62
+ %{states}
63
+
64
+ %{message}
65
+
66
+ %{alerts}
67
+ running: |-
68
+ The instance is running normally.
69
+ saved: |-
70
+ To resume this VM, simply run `ey-local start`.
71
+ errors:
72
+ ssh_connection_refused: |-
73
+ SSH connection was refused! This may happen if the VM failed to boot properly.
74
+ To fix this, try running 'ey-local down' followed up 'ey-local up' to see if
75
+ your system restarts properly.
26
76
 
27
77
  :commands:
28
78
  :eylocal:
29
79
  - eylocal
30
80
  - Commands to handle Engine Yard Local VM management
31
81
  :up:
32
- - up [NAME] [URI] [--no-bundle] [--no-db-setup]
33
- - Download an Eyx base box, provision a virtual machine, and handle project setup
82
+ - up [NAME] [URI] [--no-dna] [--no-chef] [--no-bundle] [--no-db-setup]
83
+ - |-
84
+ Download an EY Local base box, provision a virtual machine, and handle
85
+ project setup. For an existing, halted VM, it will restart without
86
+ downloading a new box image. If the VM is currently running, this will
87
+ rerun the provisioning steps for the instance.
88
+
89
+ Provisioning starts with configuring the instance's DNA. This step
90
+ can be skipped with the --no-dna flag.
91
+
92
+ After the DNA is configured, chef will be ran on the instance to
93
+ complete package setup and configuration. This step can be skipped
94
+ with the --no-chef flag.
95
+
96
+ Following the chef run, bundler will be ran on the application. This
97
+ step can be skipped with the --no-bundle flag.
98
+
99
+ Once that is complete, provisioning finishes with database setup.
100
+ Skip that step with the --no-db-setup flag.
101
+ :down:
102
+ - down
103
+ - This shuts the VM down, and powers it off. Restart it with 'ey-local up'.
104
+ :destroy:
105
+ - destroy
106
+ - Shuts down the VM, and removes the box image. Restarting with 'ey-local up' will do a full rebuild/reprovision of the VM.
107
+ :reload:
108
+ - reload
109
+ - Reboots the VM, allowing configuration changes that were made in the Vagrantfile to take effect.
34
110
  :rails:
35
111
  - rails COMMAND [--version ~> 3.1.0]
36
112
  - Make sure the rails gem is installed and run rails commands in the project directory share on the guest
37
113
  :exec:
38
114
  - exec COMMAND
39
- - execute an arbitrary command from the project directory in the vm
115
+ - Execute an arbitrary command from the project directory in the vm
40
116
  :vagrant:
41
117
  - COMMAND
42
- - any commands not listed will be passed through to Vagrant for execution
118
+ - Any commands not listed will be passed through to Vagrant for execution
43
119
  :log:
44
120
  - log [--environment=development] [--lines=100]
45
- - dump the log files under PROJECT_DIR/log/
121
+ - Dump the log files under PROJECT_DIR/log/
46
122
  :help:
47
123
  - help
48
- - ""
124
+ - Provide usage information. 'ey-local help COMMAND' for detailed information.
49
125
  :list:
50
126
  - list [--format=(full|short)]
51
- - lists all vms under ey-local management. Formatting can be either full or short
127
+ - Lists all vms under ey-local management. This command provides data in a short form, and in a full form. The short form provides the ID of the VM, and the path to it's root. The full form also provides the VirtualBox name of the instance.
52
128
  :start:
53
129
  - start
54
- - starts a stopped (suspended) vm
130
+ - Restart a stopped VM, resuming operation at the point where the 'stop' occured.
55
131
  :stop:
56
132
  - stop
57
- - stops (suspends) a running vm
133
+ - Suspend a running VM, leaving the the disk image so that it can be started again quickly. Resume a stopped vm using 'ey-local start'.
134
+ :status:
135
+ - status
136
+ - Report the operational status of an instance, including whether it requires any stack updates.
137
+ :update:
138
+ - update
139
+ - Apply infrastructure and cookbook updates to the instance.
140
+ :terminate:
141
+ - terminate
142
+ - Power the VM off, and then tear it down, removing all the disk image and unregistering the VM from VirtualBox. The Vagrantfile is left in the project directory as it may be needed again.
@@ -0,0 +1,55 @@
1
+ diff -r -u recipes.orig/cookbooks/ey-backup/recipes/postgres.rb recipes/cookbooks/ey-backup/recipes/postgres.rb
2
+ --- recipes.orig/cookbooks/ey-backup/recipes/postgres.rb 2012-11-13 11:02:08.000000000 +0000
3
+ +++ recipes/cookbooks/ey-backup/recipes/postgres.rb 2012-11-13 11:10:55.000000000 +0000
4
+ @@ -32,7 +32,7 @@
5
+ else
6
+ if ['db_slave'].include?(node[:instance_role]) && node['backup_window'] != 0
7
+ db_slave1_fqdn=node['db_slaves'].first
8
+ - if node[:ec2][:local_hostname] == db_slave1_fqdn
9
+ + if (node[:ec2] ? node[:ec2][:local_hostname] : `hostname`.split(".").first) == db_slave1_fqdn
10
+ backup_cron "postgresql" do
11
+ command 'eybackup -e postgresql >> /var/log/eybackup.log'
12
+ month '*'
13
+ diff -r -u recipes.orig/cookbooks/ey-base/recipes/bootstrap.rb recipes/cookbooks/ey-base/recipes/bootstrap.rb
14
+ --- recipes.orig/cookbooks/ey-base/recipes/bootstrap.rb 2012-11-13 11:02:08.000000000 +0000
15
+ +++ recipes/cookbooks/ey-base/recipes/bootstrap.rb 2012-11-13 11:29:33.000000000 +0000
16
+ @@ -19,7 +19,7 @@
17
+
18
+ link "/dev/xvda3" do
19
+ to "/dev/sda3"
20
+ - only_if { File.exists?("/dev/sda3") and node[:ec2][:instance_type] == "m1.small" and node[:kernel][:release].include?("2.6.18")}
21
+ + only_if { File.exists?("/dev/sda3") and (node[:instance_role] == 'eylocal' || node[:ec2][:instance_type] == "m1.small") and node[:kernel][:release].include?("2.6.18")}
22
+ end
23
+
24
+ bash "make-swap-sdc" do
25
+ @@ -56,7 +56,7 @@
26
+ swapon /dev/xvda3
27
+ echo "/dev/xvda3 swap swap sw 0 0" >> /etc/fstab
28
+ EOH
29
+ - only_if { node[:kernel][:machine] == 'x86_64' and node[:memory][:swap][:total] == '0kB' and File.exists?("/dev/xvda3") and node[:ec2][:instance_type] == "m1.small"}
30
+ + only_if { node[:kernel][:machine] == 'x86_64' and node[:memory][:swap][:total] == '0kB' and File.exists?("/dev/xvda3") and (node[:instance_role] == 'eylocal' || node[:ec2][:instance_type] == "m1.small") }
31
+ end
32
+
33
+ bash "make-swap-64-medium" do
34
+ @@ -67,7 +67,7 @@
35
+ swapon /mnt/engineyard/swapfile
36
+ echo "/mnt/engineyard/swapfile swap swap sw 0 0 " >> /etc/fstab
37
+ EOH
38
+ - only_if { node[:kernel][:machine] == 'x86_64' and node[:memory][:swap][:total] == '0kB' and node[:ec2][:instance_type].include?("medium") }
39
+ + only_if { node[:kernel][:machine] == 'x86_64' and node[:memory][:swap][:total] == '0kB' and (node[:instance_role] == 'eylocal' || node[:ec2][:instance_type].include?("medium")) }
40
+ end
41
+
42
+ directory "/data" do
43
+ diff -r -u recipes.orig/cookbooks/nginxtcp/libraries/get_nginx_nodejs_process_count.rb recipes/cookbooks/nginxtcp/libraries/get_nginx_nodejs_process_count.rb
44
+ --- recipes.orig/cookbooks/nginxtcp/libraries/get_nginx_nodejs_process_count.rb 2012-11-13 11:02:08.000000000 +0000
45
+ +++ recipes/cookbooks/nginxtcp/libraries/get_nginx_nodejs_process_count.rb 2012-11-13 11:12:14.000000000 +0000
46
+ @@ -5,7 +5,8 @@
47
+ # and is not bound by any other constraints (memory, etc)
48
+ # For Amazon AWS, see http://aws.amazon.com/ec2/instance-types/
49
+ def get_nginx_nodejs_per_cpu_process_count
50
+ - case node[:ec2][:instance_type]
51
+ + instance_type = node[:instance_role] == 'eylocal' ? 'm1.small' : node[:ec2][:instance_type]
52
+ + case instance_type
53
+ when "m1.small"
54
+ 1
55
+ when "m1.large"
@@ -1,9 +1,12 @@
1
1
  :box_defaults:
2
2
  # TODO replace with cdn backed url
3
3
  :uri: https://s3.amazonaws.com/ey-local-images/ey-local-gentoo12.box
4
- :cookbook_uri: http://s3.amazonaws.com/ey-local-cookbooks/chef2012032901.tar.bz2
4
+ :cookbook_uri: http://ey-cloud.s3.amazonaws.com/chef-ey-1.1.336.tgz
5
+ :cookbook_version: 1.1.336
5
6
  :name: ey-gentoo-rack
6
7
  :network_tag_default: no-networks-defined
8
+ :patches:
9
+ - chef-ey-1.1.336.patch
7
10
 
8
11
  :rvm:
9
12
  :ruby_env_const: RVM_RUBY
@@ -16,3 +19,5 @@
16
19
 
17
20
  :managed_vm_key: "EY-LOCAL/project-root"
18
21
  :network_ip_key: "EY-LOCAL/network-ip"
22
+
23
+ :la_brea_bridge: labrea-bridge.engineyard.com
@@ -6,16 +6,17 @@ Gem::Specification.new do |s|
6
6
  s.name = "engineyard-local"
7
7
  s.version = Engineyard::Local::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["John Bender"]
10
- s.email = ["john.m.bender@gmail.com"]
9
+ s.authors = ["Kirk Haines"]
10
+ s.email = ["khaines@engineyard.com"]
11
11
  s.homepage = ""
12
- s.summary = %q{A plugin to streamline ruby web application development with Vagrant}
12
+ s.summary = %q{Engine Yard Local allows you to develop and test locally on your own computer using a virtual machine with an Engine Yard environment.}
13
13
  s.description = s.summary
14
14
 
15
15
  s.rubyforge_project = "engineyard-local"
16
16
 
17
- s.add_dependency "vagrant", "= 1.0.1"
17
+ s.add_dependency "vagrant", "= 1.0.5"
18
18
  s.add_dependency "thor", "~> 0.14.6"
19
+ s.add_dependency "nokogiri", ">= 1.5.2"
19
20
 
20
21
  s.files = `git ls-files | grep -v "^boxes"`.split("\n")
21
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -2,15 +2,53 @@
2
2
 
3
3
  Originally the project was using PackageMaker to build its installers. After some trouble moving over to the [Packages utility](http://s.sudre.free.fr/Software/Packages/about.html) proved to be a huge time saver. The Packages projects are described below.
4
4
 
5
- # Rake tasks
5
+ ## Rake tasks
6
6
 
7
7
  The only task that is currently automated is the install of cached gems into the directory that the Packages project expects them for inclusion in the package. It will bundle install to a vendor directory in `install/osx/` and then copy the cached gems into `tmp/engineyard-local-installer` which Packages will use to install to `/tmp/engineyard-local-installer/` for the end user.
8
8
 
9
- # vagrant installer
9
+ ## Post rake steps
10
10
 
11
- *TODO requires rework*
11
+ Once the rake task has created the tmp directory used by the package, you can take the following steps to build the mpkg.
12
12
 
13
- # engineyard-local installer
13
+ 1. Open `$PROJECT_DIR/install/osx/engineyard-local/engineyard-local.pkproj` with the Packages utility (See link above)
14
+ 2. Build the project from the menu `Build > Build` or `Command-B`
15
+ 3. Mount the current `.dmg`
16
+ 4. Remove the existing Engineyard Local `.mpkg`
17
+ 5. Empty your waste bin to make sure it's removed, there is limited space in the `.dmg`.
18
+ 6. Take the output of the build, `$PROJECT_DIR/install/osx/engineyard-local.mpkg` and add it to the mounted `.dmg`.
19
+ 7. Unmount the Engineyard Local `.dmg`
20
+
21
+
22
+ ## DMG Background
23
+
24
+ Both the icons and dmg background are stored in the `$PROJECT_DIR/install/osx/images/` directory. In use, background image is stored in the `.dmg` itself to be used as a relative reference when setting the background in the OSX view options for the mounted `.dmg` folder. To set the dmg background properly do the following:
25
+
26
+ 1. Show hidden files in the finder `defaults write com.apple.finder AppleShowAllFiles YES`
27
+ 2. Relaunch the finder using Option-Right Click on the icon in the OSX dock.
28
+ 3. Copy the background into the mounted `.dmg` using the finder or `cp $PROJECT_DIR/install/osx/images/dmg_background.png $DMG_MOUNT_DIR/.dmg_background.png`
29
+ 4. Right click the background on the mounted `.dmg` folder window and select `Show View Options`.
30
+ 5. At the bottom select the `Picture` radio option
31
+ 6. Drag the dmg background file in the the "Drag image here" area.
32
+ 7. Reposition VirtualBox and Engineyard Local `.dmg` files.
33
+ 8. Resize accordingly
34
+ 9. Unmount the Engineyard Local `.dmg`
35
+
36
+
37
+ ## DMG Icon
38
+
39
+ Using the icon with the mounted `.dmg` drive is simple once you know the steps:
40
+
41
+ 1. Mount the `.dmg` you wish to modify the icon for
42
+ 2. Right click on the mounted folder for the `.dmg`, generally a small white disk drive icon.
43
+ 3. Click the existing icon in the top left of the Get Info dialog.
44
+ 4. Open the `dmg_icons.icns` file in `$PROJECT_DIR/install/osx/images/` with Preview
45
+ 5. Click the largest version of the icon (generally toward the top)
46
+ 6. Use Command-C to copy it
47
+ 7. Focus the Get Info window that was open previously, the existing white drive icon should be surounded by a faint blue focus highlight
48
+ 8. Hit Command-V to change the icon image
49
+ 9. Unmount the Engineyard Local `.dmg`
50
+
51
+ ## How it works
14
52
 
15
53
  The engineyard local installer creates a directory in `/tmp/engineyard-local-installer` (`/tmp` is symlink to `/privat/tmp` in osx) where the gem packages for engineyard local and all its dependencies are installed. From there the `scripts/postinstall` handles installing them into the right places in the following order:
16
54
 
@@ -497,7 +497,7 @@
497
497
  <key>OVERWRITE_PERMISSIONS</key>
498
498
  <false/>
499
499
  <key>VERSION</key>
500
- <string>0.1</string>
500
+ <string>0.2.1</string>
501
501
  </dict>
502
502
  <key>UUID</key>
503
503
  <string>EC51373A-7505-433D-AA05-580997D6373B</string>
@@ -517,9 +517,9 @@
517
517
  ZW50LVN0eWxlLVR5cGUiIGNvbnRlbnQ9InRleHQvY3NzIj4KPHRp
518
518
  dGxlPjwvdGl0bGU+CjxtZXRhIG5hbWU9IkdlbmVyYXRvciIgY29u
519
519
  dGVudD0iQ29jb2EgSFRNTCBXcml0ZXIiPgo8bWV0YSBuYW1lPSJD
520
- b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjExMzgiPgo8c3R5bGUgdHlw
521
- ZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5Pgo8
522
- L2JvZHk+CjwvaHRtbD4K
520
+ b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjExMzguMzIiPgo8c3R5bGUg
521
+ dHlwZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5
522
+ Pgo8L2JvZHk+CjwvaHRtbD4K
523
523
  </data>
524
524
  </dict>
525
525
  <key>PROJECT_PRESENTATION</key>
@@ -625,7 +625,36 @@
625
625
  <key>PROJECT_REQUIREMENTS</key>
626
626
  <dict>
627
627
  <key>LIST</key>
628
- <array/>
628
+ <array>
629
+ <dict>
630
+ <key>BEHAVIOR</key>
631
+ <integer>3</integer>
632
+ <key>DICTIONARY</key>
633
+ <dict>
634
+ <key>IC_REQUIREMENT_DISKSPACE_MINIMUM_SIZE_UNIT</key>
635
+ <integer>0</integer>
636
+ <key>IC_REQUIREMENT_DISKSPACE_MINIMUM_SIZE_VALUE</key>
637
+ <integer>1600</integer>
638
+ </dict>
639
+ <key>IC_REQUIREMENT_CHECK_TYPE</key>
640
+ <integer>1</integer>
641
+ <key>IDENTIFIER</key>
642
+ <string>fr.whitebox.Packages.requirement.diskspace</string>
643
+ <key>MESSAGE</key>
644
+ <array>
645
+ <dict>
646
+ <key>LANGUAGE</key>
647
+ <string>English</string>
648
+ <key>VALUE</key>
649
+ <string>This volume does not have enough disk space to support the installation. The EngineYard virtual machine requires enough space to install to the disk and then duplicated on import.</string>
650
+ </dict>
651
+ </array>
652
+ <key>NAME</key>
653
+ <string>Available Disk Space</string>
654
+ <key>STATE</key>
655
+ <true/>
656
+ </dict>
657
+ </array>
629
658
  <key>POSTINSTALL_PATH</key>
630
659
  <dict/>
631
660
  <key>PREINSTALL_PATH</key>
@@ -633,7 +662,7 @@
633
662
  <key>RESOURCES</key>
634
663
  <array/>
635
664
  <key>ROOT_VOLUME_ONLY</key>
636
- <false/>
665
+ <true/>
637
666
  </dict>
638
667
  <key>PROJECT_SETTINGS</key>
639
668
  <dict>
@@ -2,9 +2,55 @@ require "vagrant"
2
2
  require "pathname"
3
3
  require "yaml"
4
4
 
5
+ # Monkey patch CheckBox to fix an error: https://github.com/mitchellh/vagrant/issues/564
6
+
7
+ module Vagrant
8
+ module Action
9
+ module VM
10
+ class CheckBox
11
+
12
+ def call(env)
13
+ box_name = env[:vm].config.vm.box
14
+ raise Errors::BoxNotSpecified if !box_name
15
+
16
+ if !env[:box_collection].find(box_name)
17
+ box_url = env[:vm].config.vm.box_url
18
+ raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url
19
+
20
+ # Add the box then reload the box collection so that it becomes
21
+ # aware of it.
22
+ env[:ui].info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name)
23
+ env[:box_collection].add(box_name, box_url)
24
+
25
+ # Reload the configuration for all our VMs, since this box
26
+ # may be used for other VMs.
27
+ env.env.vms.each do |name, vm|
28
+ vm.env.reload_config!
29
+ end
30
+
31
+ # Reload the environment and set the VM to be the new loaded VM.
32
+ env[:vm].env.reload!
33
+ env[:vm] = env[:vm].env.vms[env[:vm].name]
34
+ end
35
+
36
+ @app.call(env)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+
5
43
  # TODO settings object/management will be needed shortly
6
44
  module Engineyard
7
45
  module Local
46
+ def self.cookbook_version_verified?
47
+ @cookbook_version_verification || false
48
+ end
49
+
50
+ def self.cookbook_version_verified
51
+ @cookbook_version_verification = true
52
+ end
53
+
8
54
  def self.project_root
9
55
  @project_root ||= Pathname.new(File.expand_path('../../', __FILE__))
10
56
  end
@@ -17,6 +63,24 @@ module Engineyard
17
63
  @config ||= load_config_yaml("settings.yml")
18
64
  end
19
65
 
66
+ def self.tmp_dir
67
+ unless @tmp_dir
68
+ @tmp_dir = "/tmp"
69
+ # Give priority to /tmp.
70
+ unless File.exists?("/tmp")
71
+ tmpvars = ENV.each_key.select {|k|
72
+ ['TMPDIR','TEMP','TEMPDIR','TMP'].include?(k.upcase)
73
+ }
74
+ @tmp_dir = ENV[tmpvars.at(0)] if tmpvars.length > 0
75
+ # Put the proper slash at the end so File.join works properly
76
+ unless @tmp_dir.end_with?("\\")
77
+ @tmp_dir += "\\" if @tmp_dir.include?("\\")
78
+ end
79
+ end
80
+ end
81
+ @tmp_dir
82
+ end
83
+
20
84
  # default to en until something more inteligent is required
21
85
  # NOTE all locale information is contained in a single yaml
22
86
  # file in anticipation of relatively minimal use