Skip to content

Commit

Permalink
Added options to uses_app
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Fode authored and Eric Fode committed Dec 17, 2012
1 parent e5d5739 commit 81d73cb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 41 deletions.
20 changes: 15 additions & 5 deletions lib/ferret.rb
Expand Up @@ -32,19 +32,29 @@ def rmerge!(h)
end

def run(opts={})
puts opts.inspect
if opts[:forever]
$threads.each(&:join)
else
sleep opts[:time]
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 \
Expand Down
12 changes: 1 addition & 11 deletions 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')
Expand Down
16 changes: 3 additions & 13 deletions 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
Expand Down
13 changes: 1 addition & 12 deletions tests/git_clone_elb
Expand Up @@ -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')
Expand Down

0 comments on commit 81d73cb

Please sign in to comment.