diff --git a/lib/ferret.rb b/lib/ferret.rb index fab0f34..d451eda 100644 --- a/lib/ferret.rb +++ b/lib/ferret.rb @@ -32,7 +32,6 @@ def rmerge!(h) end def run(opts={}) - puts opts.inspect if opts[:forever] $threads.each(&:join) else @@ -40,11 +39,22 @@ def run(opts={}) end end -def uses_app(path) - ENV["APP_DIR"] = path +def uses_app(opts={}) + ENV["APP_DIR"] = opts[:path] + ENV["STACK"] = "cedar" + if opts[:stack] + ENV["STACK"] = opts[:stac] + end + if opts[:empty] + bash(retry: 2, name: :setup, stdin: <<-"STDIN") + heroku apps:delete $SERVICE_APP_NAME --confirm $SERVICE_APP_NAME + heroku apps:create $SERVICE_APP_NAME -s $STACK + STDIN + return + end bash(retry: 2, name: :setup, stdin: <<-'EOSTDIN') - heroku apps:delete $SERVICE_APP_NAME --confirm $SERVICE_APP_NAME - heroku apps:create $SERVICE_APP_NAME \ + heroku apps:delete $SERVICE_APP_NAME --confirm $SERVICE_APP_NAME + heroku apps:create $SERVICE_APP_NAME -s $STACK \ && heroku plugins:install https://github.com/heroku/manager-cli.git \ && heroku manager:transfer --app $SERVICE_APP_NAME --to $ORG \ && cd $APP_DIR \ diff --git a/tests/git_clone b/tests/git_clone index e3cdbc1..660df84 100755 --- a/tests/git_clone +++ b/tests/git_clone @@ -1,17 +1,7 @@ #!/usr/bin/env ruby - require_relative "../lib/ferret" -bash(retry: 1, name: :setup, stdin: <<'EOF') - cd $FERRET_DIR/app/basic_http - rm /.git - heroku create $SERVICE_APP_NAME - git init - git add * - git commit -m "initial" - git push heroku master - cd $FERRET_DIR -EOF +uses_app empty:true run_every_time do bash(name: :clone, pattern: /cloned an empty repository/, stdin: <<'EOF') diff --git a/tests/git_clone_bamboo b/tests/git_clone_bamboo index d00e55b..8a5a5a3 100755 --- a/tests/git_clone_bamboo +++ b/tests/git_clone_bamboo @@ -1,20 +1,10 @@ #!/usr/bin/env ruby - +ENV["SERVICE_APP_NAME"]="f-git-clone-bamboo" require_relative "../lib/ferret" - -bash(retry: 1, name: :setup, stdin: <<'EOF') - cd $FERRET_DIR/app/basic_http - rm /.git - heroku create $SERVICE_APP_NAME -s bamboo - git init - git add * - git commit -m "initial" - git push heroku master - cd $FERRET_DIR -EOF +uses_app empty:true, stack:"bamboo" run_every_time do -bash(name: :clone, pattern: /cloned an empty repository/, stdin: <<'EOF') + bash(name: :clone, pattern: /cloned an empty repository/, stdin: <<'EOF') rm -rf ./app git clone git@heroku.com:$SERVICE_APP_NAME.git ./app EOF diff --git a/tests/git_clone_elb b/tests/git_clone_elb index e88fb35..431d97e 100755 --- a/tests/git_clone_elb +++ b/tests/git_clone_elb @@ -2,18 +2,7 @@ require_relative "../lib/ferret" -bash(retry: 1, name: :setup, stdin: <<'EOF') - cd $FERRET_DIR/app/basic_http - rm /.git - heroku create $SERVICE_APP_NAME - git init - git add * - git commit -m "initial" - git push heroku master - cd $FERRET_DIR -EOF - - +uses_app empty:true run_every_time do bash(name: :clone, pattern: /cloned an empty repository/, stdin: <<'EOF')