Class: Heroku::Bartender::Sandbox
- Inherits:
-
Object
- Object
- Heroku::Bartender::Sandbox
- Defined in:
- lib/heroku/bartender/sandbox.rb
Instance Attribute Summary collapse
-
#current_dir ⇒ Object
Returns the value of attribute current_dir.
-
#name ⇒ Object
Returns the value of attribute name.
-
#sandbox_dir ⇒ Object
Returns the value of attribute sandbox_dir.
-
#sha ⇒ Object
Returns the value of attribute sha.
Instance Method Summary collapse
-
#initialize(sha) ⇒ Sandbox
constructor
A new instance of Sandbox.
- #predeploy(command) ⇒ Object
Constructor Details
#initialize(sha) ⇒ Sandbox
Returns a new instance of Sandbox.
9 10 11 12 13 14 |
# File 'lib/heroku/bartender/sandbox.rb', line 9 def initialize(sha) @sha = sha @name = gen_sandbox_name @sandbox_dir = "#{Dir.tmpdir}/#{@name}/" @current_dir = "#{Dir.pwd}/" end |
Instance Attribute Details
#current_dir ⇒ Object
Returns the value of attribute current_dir.
7 8 9 |
# File 'lib/heroku/bartender/sandbox.rb', line 7 def current_dir @current_dir end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/heroku/bartender/sandbox.rb', line 7 def name @name end |
#sandbox_dir ⇒ Object
Returns the value of attribute sandbox_dir.
7 8 9 |
# File 'lib/heroku/bartender/sandbox.rb', line 7 def sandbox_dir @sandbox_dir end |
#sha ⇒ Object
Returns the value of attribute sha.
7 8 9 |
# File 'lib/heroku/bartender/sandbox.rb', line 7 def sha @sha end |
Instance Method Details
#predeploy(command) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/heroku/bartender/sandbox.rb', line 16 def predeploy(command) copy_current_repo_to_me Dir.chdir(@sandbox_dir) do `git checkout #{@sha}` rc = system(command) if rc.nil? || ! rc raise "Error executing pre-deploy command '#{command}': #{$?}" end end end |