Skip to content

Commit

Permalink
clean up uses_app
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Zoschke committed Dec 18, 2012
1 parent 560256a commit b1078cf
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions lib/ferret.rb
Expand Up @@ -41,30 +41,25 @@ def run(opts={})

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')
ENV["STACK"] = opts[:stack] || "cedar"

log fn: :uses_app, name: ENV["SERVICE_APP_NAME"], at: :enter

bash(retry: 2, name: :create, stdin: <<-'EOSTDIN')
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 \
&& bundle install \
&& heroku build -r $SERVICE_APP_NAME \
&& heroku scale web=1 --app $SERVICE_APP_NAME \
heroku apps:create $SERVICE_APP_NAME -s $STACK \
&& heroku manager:transfer --app $SERVICE_APP_NAME --to $ORG
EOSTDIN

return if opts[:empty]

bash(retry: 2, name: :release, stdin: <<-'EOSTDIN')
cd $APP_DIR \
&& bundle install \
&& heroku build -r $SERVICE_APP_NAME \
&& heroku scale web=1 --app $SERVICE_APP_NAME \
&& cd $FERRET_DIR
EOSTDIN
#if setup has been defined use that
#otherwise run basic deploy
end

def run_interval(interval, &block)
Expand All @@ -90,6 +85,7 @@ def run_every_time(&block)
}
end
end

def bash(opts={})
opts[:bash] = opts[:stdin]
test(opts)
Expand Down

0 comments on commit b1078cf

Please sign in to comment.