sr (owner)

Fork Of

Revisions

  • b04cb9 sr Thu Jun 25 11:34:07 -0700 2009
  • 5bcf30 sr Thu Jun 25 11:33:28 -0700 2009
  • 9f2f45 sr Thu Jun 25 11:31:29 -0700 2009
  • 7e5589 Thu Jun 25 11:22:16 -0700 2009
gist: 136061 Download_button fork
public
Public Clone URL: git://gist.github.com/136061.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ZPROXY_CONFIG = Hash.new
 
# General config
configure do
  gems = %w(activerecord logger hpricot open-uri resolv restclient net/http yaml rexml/document rack-flash mailfactory json net/smtp)
  zproxy_libs = %w(submission validator webex)
  
  (gems + zproxy_libs).each do |dependency|
    begin
      require dependency
    rescue LoadError => e
      puts
      puts "You're missing some gems. Here's the trace:"
      puts
      puts e
    end
  end
 
  
  # Turn on Sinatra's session support
  # TODO: Ensure that Rack turns on sessions in test mode
  unless test?
    enable :sessions
  end
  
  # WebEx API connection stuff
  WEBEX = Hash.new
  if development?
    #<private connection crap -- setting constants>
  else
    #<private connection crap -- setting constants>
  end
  
  
  # DB STUFF -----------------------------------------------
  
  config = YAML.load_file(File.dirname(__FILE__) + "/database.yml")
  ActiveRecord::Base.establish_connection(config[environment.to_s])
end
# End common config
 
 
configure :development do
  require 'ruby-debug'
  LOGGER = Logger.new(STDOUT)
  LOGGER.level = Logger::DEBUG
  
  REFERER_DOMAIN = "localhost"
  REPOST_URL = "http://localhost/zproxy/zptest.php"
  
  # Where a bad submission gets re-directed
  DEFAULT_REDIRECT = "http://localhost/zproxy/redirected.php"
 
  ZPROXY_CONFIG['env'] = "development"
end
 
configure :test do
  LOGGER = Logger.new('log/test.log')
  LOGGER.level = Logger::WARN
  
  REFERER_DOMAIN = "venkman.local"
  REPOST_URL = "http://localhost/zproxy/zptest.php"
  
  # Where a bad submission gets re-directed
  DEFAULT_REDIRECT = "http://localhost/zproxy/redirected.php"
 
  ZPROXY_CONFIG['env'] = "test"
end
 
 
configure :production do
  LOGGER = Logger.new('log/production.log')
  LOGGER.level = Logger::INFO
  
  REFERER_DOMAIN = "foo.com"
  REPOST_URL = "http://foo.net/post"
  
  # Where a bad submission gets re-directed
  DEFAULT_REDIRECT = "http://www.foo.com"
 
  ZPROXY_CONFIG['env'] = "production"
end