Permalink
Browse files

Add ensure_run_once convenience method

  • Loading branch information...
1 parent 6c04007 commit 6973ee5212c87678376c967a6884a6f9432932ca @cespare cespare committed Mar 27, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/terraform/terraform_dsl.rb
@@ -108,6 +108,18 @@ def ensure_file(source_path, dest_path, &on_change)
end
end
+ # A task which must be run once to be 'met'. For instance, this might be the DB migration script.
+ def ensure_run_once(name, &block)
+ dep "run task once: #{name}" do
+ has_run_once = false
+ met? { has_run_once }
+ meet do
+ yield
+ has_run_once = true
+ end
+ end
+ end
+
def ensure_rbenv
ensure_package "git-core"
dep "rbenv" do

0 comments on commit 6973ee5

Please sign in to comment.