Skip to content

Instantly share code, notes, and snippets.

@slavikdev
Created September 15, 2011 16:58
Show Gist options
  • Save slavikdev/1219794 to your computer and use it in GitHub Desktop.
Save slavikdev/1219794 to your computer and use it in GitHub Desktop.
Zoo files
# NOTE!
# Helicon Zoo module runs this script every time IIS application pool recycles.
# This has several reasons:
# 1. you may not have ability to run required commands yourself (on a shared hosting, for example);
# 2. specific URL for deployment may cause security issues;
# 3. application pool doesn't recycle often.
#
# If you're sure you don't need this file, it can be removed.
APP_ROOT = File.dirname( __FILE__ )
Dir.chdir( APP_ROOT )
# Since we always install Ruby into the same location, we can rely on this path.
RUBY_BIN = 'C:\\Ruby19\\bin\\'.freeze
RACK_ENV = ( ENV[ 'RACK_ENV' ] || 'production' ).freeze
def run( task )
args = task.split
cmd = args.shift
ARGV.clear
ARGV.unshift( *args )
# We use 'load' because it doesn't spawn child ruby process,
# which might be problematic in hosting environment.
load( RUBY_BIN + cmd, true )
rescue Object => e
puts "Task '#{task}' has ended with error (#{e.class}): #{e}"
exit( -1 )
end
case RACK_ENV
when 'development'
run 'bundle install --path vendor/gems'
run 'rake db:create'
# run 'rake generate_session_store'
run 'rake db:migrate'
# TODO: add more development tasks here
when 'production'
run 'bundle install --local --path vendor/gems'
run 'rake RAILS_ENV=production db:create'
# run 'rake RAILS_ENV=production generate_session_store'
run 'rake RAILS_ENV=production db:migrate'
# TODO: add more production tasks here
end
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<application name="rails.project.x86" >
<environmentVariables>
<add name="DEPLOY_FILE" value="deploy.rb" />
<add name="DEPLOY_LOG" value="log\zoo-deploy.log" />
<!-- By default we run Rails in production mode -->
<!-- <add name="RACK_ENV" value="development" /> -->
</environmentVariables>
</application>
<application name="rails.project.x64" >
<environmentVariables>
<add name="DEPLOY_FILE" value="deploy.rb" />
<add name="DEPLOY_LOG" value="log\zoo-deploy.log" />
<!-- By default we run Rails in production mode -->
<!-- <add name="RACK_ENV" value="development" /> -->
</environmentVariables>
</application>
</heliconZoo>
<handlers>
<add name="rails.project.x86" scriptProcessor="ruby.1.9.pipe" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="rails.project.x64" scriptProcessor="ruby.1.9.pipe" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<!-- Send static files through IIS -->
<rewrite>
<rules>
<rule name="Avoid Static Files" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" pattern="^(.+?)\\([^\\]+)$" ignoreCase="true" />
<add input="{C:1}\\public\\{C:2}" matchType="IsFile" ignoreCase="true" />
</conditions>
<action type="Rewrite" url="public/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
@shayumii06
Copy link

the zoo files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment