open_porch 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +41 -0
- data/Gemfile.lock +130 -0
- data/README.md +170 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/app/controllers/admin/areas/base_controller.rb +11 -0
- data/app/controllers/admin/areas/issues_controller.rb +67 -0
- data/app/controllers/admin/areas/memberships_controller.rb +7 -0
- data/app/controllers/admin/areas/posts_controller.rb +44 -0
- data/app/controllers/admin/areas_controller.rb +89 -0
- data/app/controllers/admin/base_controller.rb +16 -0
- data/app/controllers/admin/user_activity_controller.rb +29 -0
- data/app/controllers/admin/users_controller.rb +57 -0
- data/app/controllers/application_controller.rb +15 -0
- data/app/controllers/areas/base_controller.rb +25 -0
- data/app/controllers/areas/issues_controller.rb +35 -0
- data/app/controllers/areas/posts_controller.rb +28 -0
- data/app/controllers/areas_controller.rb +30 -0
- data/app/controllers/passwords_controller.rb +42 -0
- data/app/controllers/registrations_controller.rb +42 -0
- data/app/controllers/sessions_controller.rb +33 -0
- data/app/controllers/users_controller.rb +77 -0
- data/app/helpers/open_porch_helper.rb +24 -0
- data/app/mailers/user_mailer.rb +35 -0
- data/app/models/address.rb +57 -0
- data/app/models/area.rb +171 -0
- data/app/models/area_activity.rb +24 -0
- data/app/models/email_message.rb +104 -0
- data/app/models/issue.rb +66 -0
- data/app/models/issue_number.rb +22 -0
- data/app/models/membership.rb +27 -0
- data/app/models/post.rb +64 -0
- data/app/models/session_user.rb +69 -0
- data/app/models/user.rb +140 -0
- data/app/models/user_activity.rb +31 -0
- data/app/models/user_authority_check.rb +14 -0
- data/app/views/admin/areas/_form.html.haml +8 -0
- data/app/views/admin/areas/_nav.html.haml +12 -0
- data/app/views/admin/areas/edit.html.haml +22 -0
- data/app/views/admin/areas/edit_borders.html.haml +44 -0
- data/app/views/admin/areas/index.html.haml +61 -0
- data/app/views/admin/areas/issues/_post.html.haml +15 -0
- data/app/views/admin/areas/issues/add_posts.js.rjs +3 -0
- data/app/views/admin/areas/issues/edit.html.haml +37 -0
- data/app/views/admin/areas/issues/index.html.haml +31 -0
- data/app/views/admin/areas/issues/remove_posts.js.rjs +3 -0
- data/app/views/admin/areas/issues/show.html.haml +13 -0
- data/app/views/admin/areas/memberships/index.html.haml +17 -0
- data/app/views/admin/areas/new.html.haml +6 -0
- data/app/views/admin/areas/new.js.haml +4 -0
- data/app/views/admin/areas/posts/_edit.html.haml +6 -0
- data/app/views/admin/areas/posts/_post_status.html.haml +1 -0
- data/app/views/admin/areas/posts/destroy.js.rjs +1 -0
- data/app/views/admin/areas/posts/edit.js.rjs +1 -0
- data/app/views/admin/areas/posts/show.js.rjs +1 -0
- data/app/views/admin/areas/posts/toggle_reviewed_by.js.rjs +1 -0
- data/app/views/admin/areas/posts/update.js.rjs +5 -0
- data/app/views/admin/areas/show.html.haml +5 -0
- data/app/views/admin/user_activity/show.html.haml +5 -0
- data/app/views/admin/users/_form.html.haml +21 -0
- data/app/views/admin/users/edit.html.haml +5 -0
- data/app/views/admin/users/index.html.haml +31 -0
- data/app/views/admin/users/new.html.haml +5 -0
- data/app/views/areas/issues/index.html.haml +31 -0
- data/app/views/areas/issues/show.html.haml +22 -0
- data/app/views/areas/posts/_post.html.haml +8 -0
- data/app/views/areas/posts/_posts_search_form.html.haml +8 -0
- data/app/views/areas/posts/index.html.haml +27 -0
- data/app/views/areas/posts/new.html.haml +10 -0
- data/app/views/areas/show.html.haml +47 -0
- data/app/views/layouts/_account_nav.html.haml +18 -0
- data/app/views/layouts/_flash_message.html.haml +4 -0
- data/app/views/layouts/_footer.html.haml +9 -0
- data/app/views/layouts/_head.html.haml +16 -0
- data/app/views/layouts/admin/_nav.html.haml +13 -0
- data/app/views/layouts/admin.html.haml +15 -0
- data/app/views/layouts/application.html.haml +14 -0
- data/app/views/layouts/area_editor.html.haml +11 -0
- data/app/views/passwords/edit.html.haml +9 -0
- data/app/views/passwords/new.html.haml +13 -0
- data/app/views/registrations/_address_form.html.haml +7 -0
- data/app/views/registrations/create.html.haml +49 -0
- data/app/views/registrations/index.html.haml +30 -0
- data/app/views/registrations/new.html.haml +17 -0
- data/app/views/sessions/new.html.haml +18 -0
- data/app/views/stylesheets/common.sass +239 -0
- data/app/views/stylesheets/content.sass +193 -0
- data/app/views/stylesheets/reset.sass +46 -0
- data/app/views/stylesheets/structure.sass +11 -0
- data/app/views/stylesheets/typography.sass +57 -0
- data/app/views/user_mailer/email_verification.html.erb +5 -0
- data/app/views/user_mailer/email_verification.text.erb +7 -0
- data/app/views/user_mailer/new_issue.html.erb +32 -0
- data/app/views/user_mailer/new_issue.text.erb +26 -0
- data/app/views/user_mailer/password_reset.html.erb +7 -0
- data/app/views/user_mailer/password_reset.text.erb +6 -0
- data/app/views/users/_form.html.haml +5 -0
- data/app/views/users/edit.html.haml +11 -0
- data/app/views/users/new.html.haml +41 -0
- data/app/views/users/show.html.haml +30 -0
- data/bin/open_porch_engine +135 -0
- data/config/application.rb +43 -0
- data/config/boot.rb +13 -0
- data/config/database_example.yml +59 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +26 -0
- data/config/environments/production.rb +49 -0
- data/config/environments/test.rb +35 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/email_regex.rb +38 -0
- data/config/initializers/geokit_config.rb +61 -0
- data/config/initializers/inflections.rb +20 -0
- data/config/initializers/meta_search.rb +7 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/open_porch.rb +41 -0
- data/config/initializers/sass.rb +1 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/states_provinces.rb +2 -0
- data/config/initializers/will_paginate.rb +2 -0
- data/config/locales/en.yml +5 -0
- data/config/open_porch_example.yml +23 -0
- data/config/routes.rb +54 -0
- data/config/schedule.rb +9 -0
- data/config.ru +4 -0
- data/db/migrate/01_create_areas.rb +21 -0
- data/db/migrate/02_create_users.rb +28 -0
- data/db/migrate/03_create_memberships.rb +14 -0
- data/db/migrate/04_create_posts.rb +20 -0
- data/db/migrate/05_create_issue_numbers.rb +13 -0
- data/db/migrate/06_create_issues.rb +21 -0
- data/db/migrate/20110204173301_add_published_to_areas.rb +10 -0
- data/db/migrate/20110204194840_create_user_activities.rb +13 -0
- data/db/migrate/20110208163604_add_zip_to_areas.rb +11 -0
- data/db/migrate/20110209175723_add_counters_to_areas.rb +11 -0
- data/db/migrate/20110209182244_remove_subject_from_issues.rb +9 -0
- data/db/migrate/20110209190146_add_reviewer_info_to_posts.rb +9 -0
- data/db/migrate/20110215173144_add_email_validation_key_to_users.rb +13 -0
- data/db/migrate/20110215182716_remove_published_from_areas.rb +10 -0
- data/db/migrate/20110215211012_create_area_activities.rb +19 -0
- data/db/migrate/20110215213802_create_email_messages.rb +19 -0
- data/db/migrate/20110217165018_change_send_mode_to_string.rb +17 -0
- data/db/migrate/20110223160609_denormalize_user_info_in_posts.rb +19 -0
- data/db/seeds.rb +7 -0
- data/doc/README_FOR_APP +2 -0
- data/lib/generators/open_porch_generator.rb +37 -0
- data/lib/open_porch/engine.rb +20 -0
- data/lib/open_porch.rb +3 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/open_porch.rake +10 -0
- data/lib/tasks/postageapp_tasks.rake +78 -0
- data/open_porch.gemspec +335 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/images/icons/ajax-loader.gif +0 -0
- data/public/images/icons/calendar.png +0 -0
- data/public/images/icons/post_new.png +0 -0
- data/public/images/icons/post_reviewed.png +0 -0
- data/public/javascripts/application.js +3 -0
- data/public/javascripts/google_maps.js +153 -0
- data/public/javascripts/highcharts.js +162 -0
- data/public/javascripts/highcharts_init.js +30 -0
- data/public/javascripts/issue_edit.js +57 -0
- data/public/javascripts/jquery-ui.min.js +191 -0
- data/public/javascripts/jquery.js +154 -0
- data/public/javascripts/rails.js +137 -0
- data/public/javascripts/region_editor.js +616 -0
- data/public/javascripts/user_activity.js +29 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/stylesheets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/stylesheets/images/ui-icons_222222_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_454545_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_888888_256x240.png +0 -0
- data/public/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/stylesheets/jquery-ui.css +362 -0
- data/script/rails +6 -0
- data/test/dummy/area.rb +5 -0
- data/test/dummy/area_activity.rb +7 -0
- data/test/dummy/issue.rb +4 -0
- data/test/dummy/membership.rb +4 -0
- data/test/dummy/post.rb +12 -0
- data/test/dummy/user.rb +29 -0
- data/test/dummy/user_activity.rb +11 -0
- data/test/functional/admin/areas/issues_controller_test.rb +48 -0
- data/test/functional/admin/areas/memberships_controller_test.rb +45 -0
- data/test/functional/admin/areas/posts_controller_test.rb +54 -0
- data/test/functional/admin/areas_controller_test.rb +134 -0
- data/test/functional/admin/base_controller_test.rb +8 -0
- data/test/functional/admin/user_activity_controller_test.rb +28 -0
- data/test/functional/admin/users_controller_test.rb +144 -0
- data/test/functional/areas/issues_controller_test.rb +33 -0
- data/test/functional/areas/posts_controller_test.rb +50 -0
- data/test/functional/areas_controller_test.rb +12 -0
- data/test/functional/passwords_controller_test.rb +64 -0
- data/test/functional/registrations_controller_test.rb +64 -0
- data/test/functional/sessions_controller_test.rb +120 -0
- data/test/functional/users_controller_test.rb +144 -0
- data/test/performance/browsing_test.rb +9 -0
- data/test/test_helper.rb +92 -0
- data/test/unit/address_test.rb +25 -0
- data/test/unit/area_activity_test.rb +57 -0
- data/test/unit/area_test.rb +92 -0
- data/test/unit/email_message_test.rb +8 -0
- data/test/unit/issue_number_test.rb +25 -0
- data/test/unit/issue_test.rb +154 -0
- data/test/unit/membership_test.rb +20 -0
- data/test/unit/post_test.rb +69 -0
- data/test/unit/session_user_test.rb +65 -0
- data/test/unit/user_activity_test.rb +31 -0
- data/test/unit/user_mailer_test.rb +20 -0
- data/test/unit/user_test.rb +61 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +456 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
%ul.tabs
|
2
|
+
%li 1. Confirm neighborhood
|
3
|
+
%li.active 2. Account details
|
4
|
+
%li 3. Sign up complete
|
5
|
+
|
6
|
+
.columns
|
7
|
+
.left_column
|
8
|
+
%h2
|
9
|
+
Enter your
|
10
|
+
%br/
|
11
|
+
account details
|
12
|
+
%h3
|
13
|
+
Your account will be created in the
|
14
|
+
%br/
|
15
|
+
%strong= @area.name
|
16
|
+
neighbourhood forum
|
17
|
+
= content_for :head do
|
18
|
+
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
|
19
|
+
= javascript_include_tag 'google_maps'
|
20
|
+
|
21
|
+
|
22
|
+
= content_for :doc_ready do
|
23
|
+
initialize_gmap(document.getElementById("map_canvas"), #{@user.lat}, #{@user.lng}, {}, #{@area.bounds.to_json});
|
24
|
+
add_region(#{@area.id}, [#{@area.border_coordinates}], 'selected')
|
25
|
+
add_marker(#{@user.lat}, #{@user.lng}, '#{@user.full_address}');
|
26
|
+
|
27
|
+
#map_canvas{:style => 'width:500px; height:300px'}
|
28
|
+
|
29
|
+
.right_column
|
30
|
+
%label Address
|
31
|
+
%p= @user.full_address
|
32
|
+
= formatted_form_for @user, :url => user_path do |f|
|
33
|
+
= f.hidden_field :address
|
34
|
+
= f.hidden_field :city
|
35
|
+
= f.hidden_field :state
|
36
|
+
= f.hidden_field :lat
|
37
|
+
= f.hidden_field :lng
|
38
|
+
= f.fields_for :memberships do |membership|
|
39
|
+
= membership.hidden_field :area_id
|
40
|
+
= render :partial => "form", :locals => {:f => f}
|
41
|
+
= f.submit 'Create your Account'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
= render :partial => 'layouts/account_nav'
|
2
|
+
|
3
|
+
.columns
|
4
|
+
.left_column
|
5
|
+
%h2 Your Profile
|
6
|
+
.list_header
|
7
|
+
%h3 Account details
|
8
|
+
%h5= link_to 'Edit Details', edit_user_path
|
9
|
+
|
10
|
+
%ul.list
|
11
|
+
%li
|
12
|
+
.label
|
13
|
+
%label Address
|
14
|
+
.value
|
15
|
+
= current_user.full_address
|
16
|
+
%li
|
17
|
+
.label
|
18
|
+
%label First Name
|
19
|
+
.value
|
20
|
+
= current_user.first_name
|
21
|
+
%li
|
22
|
+
.label
|
23
|
+
%label Last Name
|
24
|
+
.value
|
25
|
+
= current_user.last_name
|
26
|
+
%li
|
27
|
+
.label
|
28
|
+
%label Email Address
|
29
|
+
.value
|
30
|
+
= current_user.email
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "rubygems"
|
3
|
+
|
4
|
+
# Look for a Gemfile to load
|
5
|
+
path = File.expand_path('.')
|
6
|
+
while (File.exists?(path) and (path != '/'))
|
7
|
+
gemfile = "#{path}/Gemfile"
|
8
|
+
if (File.exists?(gemfile))
|
9
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
10
|
+
require "bundler/setup"
|
11
|
+
break
|
12
|
+
else
|
13
|
+
path = File.expand_path("..", path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
require 'active_record'
|
19
|
+
require 'action_mailer'
|
20
|
+
require 'mail'
|
21
|
+
require 'postageapp'
|
22
|
+
require 'postageapp/mailer'
|
23
|
+
require 'net/pop'
|
24
|
+
require 'yaml'
|
25
|
+
require 'logger'
|
26
|
+
require 'iconv'
|
27
|
+
|
28
|
+
# ======= Initialize =============================================================
|
29
|
+
|
30
|
+
# Set default environment
|
31
|
+
RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
|
32
|
+
puts "Running in #{RAILS_ENV}"
|
33
|
+
|
34
|
+
|
35
|
+
# Establish a database connection
|
36
|
+
db_config = nil
|
37
|
+
path = File.expand_path('.')
|
38
|
+
while (File.exists?(path) and (path != '/') and !db_config)
|
39
|
+
if (File.exists?("#{path}/config/database.yml"))
|
40
|
+
File.open("#{path}/config/database.yml") do |f|
|
41
|
+
db_config = YAML.load(f)[RAILS_ENV]
|
42
|
+
ActiveRecord::Base.establish_connection(db_config)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
path = "../#{path}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
unless (db_config)
|
50
|
+
puts "Could not find database.yml"
|
51
|
+
exit(-1)
|
52
|
+
end
|
53
|
+
|
54
|
+
ROOT_PATH = path
|
55
|
+
OPEN_PORCH_CONFIG_FILE = "#{ROOT_PATH}/config/open_porch.yml"
|
56
|
+
|
57
|
+
# ==== Request lock =====================================================
|
58
|
+
|
59
|
+
# Request a lock on a file to make sure only one instance of this scrip is running
|
60
|
+
LOCK_FILE = File.expand_path("#{ROOT_PATH}/tmp/pids/open_porch.lock", File.dirname(__FILE__))
|
61
|
+
fh = File.open(LOCK_FILE, File::RDWR|File::CREAT)
|
62
|
+
unless fh.flock(File::LOCK_EX|File::LOCK_NB)
|
63
|
+
puts 'Already running. Bye!'
|
64
|
+
fh.close
|
65
|
+
exit(0)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# ==== Load required files =====================================================
|
70
|
+
|
71
|
+
requirements = {}
|
72
|
+
|
73
|
+
base_path = File.expand_path('..', File.dirname(__FILE__))
|
74
|
+
|
75
|
+
# initializers
|
76
|
+
requirements['/config/initializers/open_porch.rb'] = base_path
|
77
|
+
requirements['/config/initializers/email_regex.rb'] = base_path
|
78
|
+
|
79
|
+
# models
|
80
|
+
Dir.glob("#{base_path}/app/models/*.rb").each do |file|
|
81
|
+
next if %w{address.rb user_authority_check.rb}.include?(File.basename(file))
|
82
|
+
requirements["/app/models/#{File.basename(file)}"] = base_path
|
83
|
+
end
|
84
|
+
|
85
|
+
# mailer
|
86
|
+
requirements['/app/mailers/user_mailer.rb'] = base_path
|
87
|
+
|
88
|
+
# Check if any required files are being overriten on the main app
|
89
|
+
if ROOT_PATH != base_path
|
90
|
+
puts "overriding ..."
|
91
|
+
requirements.each do |file, path|
|
92
|
+
if File.exists?(ROOT_PATH + file)
|
93
|
+
requirements[file] = ROOT_PATH
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
requirements.each do |file, path|
|
99
|
+
require path + file
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
# Setup logging
|
105
|
+
log_file = File.expand_path("#{ROOT_PATH}/log/pop3_#{RAILS_ENV}.log", File.dirname(__FILE__))
|
106
|
+
ActiveRecord::Base.logger = Logger.new(log_file)
|
107
|
+
|
108
|
+
# Set the timezone
|
109
|
+
ActiveRecord::Base.default_timezone = :utc
|
110
|
+
|
111
|
+
|
112
|
+
# Setup mailer views
|
113
|
+
ActionMailer::Base.view_paths = File.expand_path("../app/views", File.dirname(__FILE__))
|
114
|
+
|
115
|
+
|
116
|
+
# ======= Main =============================================================
|
117
|
+
|
118
|
+
|
119
|
+
# Send all scheduled issues
|
120
|
+
unsent_issues = Issue.scheduled_before(Time.now).all
|
121
|
+
puts "Found #{unsent_issues.length} unsent issues."
|
122
|
+
unsent_issues.each do |issue|
|
123
|
+
issue.send!
|
124
|
+
end
|
125
|
+
|
126
|
+
# Parse all new messages from POP3 server
|
127
|
+
EmailMessage.create_from_pop3
|
128
|
+
|
129
|
+
|
130
|
+
# ======= Cleanup =============================================================
|
131
|
+
|
132
|
+
# Release lock
|
133
|
+
fh.flock(File::LOCK_UN)
|
134
|
+
fh.close
|
135
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module OpenPorch
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
+
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
+
|
22
|
+
# Activate observers that should always be running.
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
+
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
+
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
+
# config.i18n.default_locale = :de
|
32
|
+
|
33
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
|
+
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
+
config.encoding = "utf-8"
|
38
|
+
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
+
config.filter_parameters += [:password]
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/config/boot.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
begin
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
rescue Bundler::GemNotFound => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
12
|
+
exit!
|
13
|
+
end if File.exist?(gemfile)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# PostgreSQL. Versions 7.4 and 8.x are supported.
|
2
|
+
#
|
3
|
+
# Install the pg driver:
|
4
|
+
# gem install pg
|
5
|
+
# On Mac OS X with macports:
|
6
|
+
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
7
|
+
# On Windows:
|
8
|
+
# gem install pg
|
9
|
+
# Choose the win32 build.
|
10
|
+
# Install PostgreSQL and put its /bin directory on your path.
|
11
|
+
development:
|
12
|
+
adapter: postgresql
|
13
|
+
encoding: utf8
|
14
|
+
schema_search_path: public
|
15
|
+
template: template_postgis
|
16
|
+
database: open_porch_development
|
17
|
+
pool: 5
|
18
|
+
username: open_porch
|
19
|
+
password:
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
24
|
+
# domain socket that doesn't need configuration. Windows does not have
|
25
|
+
# domain sockets, so uncomment these lines.
|
26
|
+
#host: localhost
|
27
|
+
#port: 5432
|
28
|
+
|
29
|
+
# Schema search path. The server defaults to $user,public
|
30
|
+
#schema_search_path: myapp,sharedapp,public
|
31
|
+
|
32
|
+
# Minimum log levels, in increasing order:
|
33
|
+
# debug5, debug4, debug3, debug2, debug1,
|
34
|
+
# log, notice, warning, error, fatal, and panic
|
35
|
+
# The server defaults to notice.
|
36
|
+
#min_messages: warning
|
37
|
+
|
38
|
+
# Warning: The database defined as "test" will be erased and
|
39
|
+
# re-generated from your development database when you run "rake".
|
40
|
+
# Do not set this db to the same as development or production.
|
41
|
+
test:
|
42
|
+
adapter: postgresql
|
43
|
+
encoding: utf8
|
44
|
+
schema_search_path: public
|
45
|
+
template: template_postgis
|
46
|
+
database: open_porch_test
|
47
|
+
pool: 5
|
48
|
+
username: open_porch
|
49
|
+
password:
|
50
|
+
|
51
|
+
production:
|
52
|
+
adapter: postgresql
|
53
|
+
encoding: utf8
|
54
|
+
schema_search_path: public
|
55
|
+
template: template_postgis
|
56
|
+
database: open_porch_production
|
57
|
+
pool: 5
|
58
|
+
username: open_porch
|
59
|
+
password:
|
@@ -0,0 +1,26 @@
|
|
1
|
+
OpenPorch::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
OpenPorch::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
OpenPorch::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: BINARY
|
2
|
+
|
3
|
+
module EmailSupport
|
4
|
+
module RFC822
|
5
|
+
#
|
6
|
+
# RFC822 Email Address Regex
|
7
|
+
# --------------------------
|
8
|
+
#
|
9
|
+
# Originally written by Cal Henderson
|
10
|
+
# c.f. http://iamcal.com/publish/articles/php/parsing_email/
|
11
|
+
#
|
12
|
+
# Translated to Ruby by Tim Fletcher, with changes suggested by Dan Kubb.
|
13
|
+
#
|
14
|
+
# Licensed under a Creative Commons Attribution-ShareAlike 2.5 License
|
15
|
+
# http://creativecommons.org/licenses/by-sa/2.5/
|
16
|
+
#
|
17
|
+
|
18
|
+
EmailAddress =
|
19
|
+
begin
|
20
|
+
qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'
|
21
|
+
dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'
|
22
|
+
atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-' +
|
23
|
+
'\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'
|
24
|
+
quoted_pair = '\\x5c[\\x00-\\x7f]'
|
25
|
+
domain_literal = "\\x5b(?:#{dtext}|#{quoted_pair})*\\x5d"
|
26
|
+
quoted_string = "\\x22(?:#{qtext}|#{quoted_pair})*\\x22"
|
27
|
+
domain_ref = atom
|
28
|
+
sub_domain = "(?:#{domain_ref}|#{domain_literal})"
|
29
|
+
word = "(?:#{atom}|#{quoted_string})"
|
30
|
+
domain = "#{sub_domain}(?:\\x2e#{sub_domain})*"
|
31
|
+
local_part = "#{word}(?:\\x2e#{word})*"
|
32
|
+
addr_spec = "#{local_part}\\x40#{domain}"
|
33
|
+
pattern = /\A#{addr_spec}\z/
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
extend self
|
38
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
if defined? Geokit
|
2
|
+
|
3
|
+
# These defaults are used in Geokit::Mappable.distance_to and in acts_as_mappable
|
4
|
+
Geokit::default_units = :miles
|
5
|
+
Geokit::default_formula = :sphere
|
6
|
+
|
7
|
+
# This is the timeout value in seconds to be used for calls to the geocoder web
|
8
|
+
# services. For no timeout at all, comment out the setting. The timeout unit
|
9
|
+
# is in seconds.
|
10
|
+
Geokit::Geocoders::request_timeout = 3
|
11
|
+
|
12
|
+
# These settings are used if web service calls must be routed through a proxy.
|
13
|
+
# These setting can be nil if not needed, otherwise, addr and port must be
|
14
|
+
# filled in at a minimum. If the proxy requires authentication, the username
|
15
|
+
# and password can be provided as well.
|
16
|
+
Geokit::Geocoders::proxy_addr = nil
|
17
|
+
Geokit::Geocoders::proxy_port = nil
|
18
|
+
Geokit::Geocoders::proxy_user = nil
|
19
|
+
Geokit::Geocoders::proxy_pass = nil
|
20
|
+
|
21
|
+
# This is your yahoo application key for the Yahoo Geocoder.
|
22
|
+
# See http://developer.yahoo.com/faq/index.html#appid
|
23
|
+
# and http://developer.yahoo.com/maps/rest/V1/geocode.html
|
24
|
+
Geokit::Geocoders::yahoo = 'REPLACE_WITH_YOUR_YAHOO_KEY'
|
25
|
+
|
26
|
+
# This is your Google Maps geocoder key.
|
27
|
+
# See http://www.google.com/apis/maps/signup.html
|
28
|
+
# and http://www.google.com/apis/maps/documentation/#Geocoding_Examples
|
29
|
+
Geokit::Geocoders::google = 'REPLACE_WITH_YOUR_GOOGLE_KEY'
|
30
|
+
|
31
|
+
# This is your username and password for geocoder.us.
|
32
|
+
# To use the free service, the value can be set to nil or false. For
|
33
|
+
# usage tied to an account, the value should be set to username:password.
|
34
|
+
# See http://geocoder.us
|
35
|
+
# and http://geocoder.us/user/signup
|
36
|
+
Geokit::Geocoders::geocoder_us = false
|
37
|
+
|
38
|
+
# This is your authorization key for geocoder.ca.
|
39
|
+
# To use the free service, the value can be set to nil or false. For
|
40
|
+
# usage tied to an account, set the value to the key obtained from
|
41
|
+
# Geocoder.ca.
|
42
|
+
# See http://geocoder.ca
|
43
|
+
# and http://geocoder.ca/?register=1
|
44
|
+
Geokit::Geocoders::geocoder_ca = false
|
45
|
+
|
46
|
+
# Uncomment to use a username with the Geonames geocoder
|
47
|
+
#Geokit::Geocoders::geonames="REPLACE_WITH_YOUR_GEONAMES_USERNAME"
|
48
|
+
|
49
|
+
# This is the order in which the geocoders are called in a failover scenario
|
50
|
+
# If you only want to use a single geocoder, put a single symbol in the array.
|
51
|
+
# Valid symbols are :google, :yahoo, :us, and :ca.
|
52
|
+
# Be aware that there are Terms of Use restrictions on how you can use the
|
53
|
+
# various geocoders. Make sure you read up on relevant Terms of Use for each
|
54
|
+
# geocoder you are going to use.
|
55
|
+
Geokit::Geocoders::provider_order = [:google,:us]
|
56
|
+
|
57
|
+
# The IP provider order. Valid symbols are :ip,:geo_plugin.
|
58
|
+
# As before, make sure you read up on relevant Terms of Use for each
|
59
|
+
# Geokit::Geocoders::ip_provider_order = [:geo_plugin,:ip]
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
11
|
+
|
12
|
+
class String
|
13
|
+
def idify
|
14
|
+
self.strip.gsub(/\W/, '_').gsub(/\s|^_*|_*$/, '').squeeze('_')
|
15
|
+
end
|
16
|
+
|
17
|
+
def slugify
|
18
|
+
self.downcase.gsub(/\W|_/, ' ').strip.squeeze(' ').gsub(/\s/, '-')
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
MetaSearch::Where.add :between, :btw,
|
2
|
+
:predicate => :in,
|
3
|
+
:types => [:integer, :float, :decimal, :date, :datetime, :timestamp, :time],
|
4
|
+
:formatter => Proc.new {|param| Range.new(param.first, param.last)},
|
5
|
+
:validator => Proc.new {|param|
|
6
|
+
param.is_a?(Array) && !(param[0].blank? || param[1].blank?)
|
7
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
OPEN_PORCH_VERSION = '0.5.0'
|
2
|
+
|
3
|
+
open_porch_file = ''
|
4
|
+
if defined?(OPEN_PORCH_CONFIG_FILE)
|
5
|
+
open_porch_file = OPEN_PORCH_CONFIG_FILE
|
6
|
+
else
|
7
|
+
# Look for a configuration file to load
|
8
|
+
path = File.expand_path('./config')
|
9
|
+
while (File.exists?(path) and (path != '/'))
|
10
|
+
open_porch_file = "#{path}/open_porch.yml"
|
11
|
+
if (File.exists?(open_porch_file))
|
12
|
+
break
|
13
|
+
else
|
14
|
+
path = File.expand_path("..", path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
if File.exists?(open_porch_file)
|
21
|
+
open_porch_config = YAML::load(File.open(open_porch_file))
|
22
|
+
env = defined?(Rails) ? Rails.env : RAILS_ENV
|
23
|
+
|
24
|
+
if open_porch_config['openx_zones'] && open_porch_config['openx_zones'][env]
|
25
|
+
OPEN_PORCH_ZONES = open_porch_config['openx_zones'][env]
|
26
|
+
end
|
27
|
+
|
28
|
+
if open_porch_config['pop3_server'] && open_porch_config['pop3_server'][env]
|
29
|
+
OPEN_PORCH_POP3 = open_porch_config['pop3_server'][env]
|
30
|
+
end
|
31
|
+
|
32
|
+
if open_porch_config['postageapp'] && open_porch_config['postageapp'][env]
|
33
|
+
PostageApp.configure do |config|
|
34
|
+
open_porch_config['postageapp'][env].each do |key, value|
|
35
|
+
config.send("#{key}=", value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else
|
40
|
+
puts "open_porch.yml not found. Looking at: #{open_porch_file}"
|
41
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Sass::Plugin.options[:template_location] = Rails.root.to_s + '/app/views/stylesheets'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Rails.application.config.secret_token = '7f9f426a932ab40ce17e625e6a4addb803db03d44ed522b941106b9d09ad1345bdcd03a53bb841063d2d8f19c002f16ee641f0948bb0e86c7451a2212e649260'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Rails.application.config.session_store :cookie_store, :key => '_open_porch_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# OpenPorch::Application.config.session_store :active_record_store
|
@@ -0,0 +1,2 @@
|
|
1
|
+
US_STATES=["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "Washington D.C.", "West Virginia", "Wisconsin", "Wyoming"]
|
2
|
+
CANADA_PROVINCES=["Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland", "Northwest Territories", "Nova Scotia", "Nunavut", "Ontario", "Prince Edward Island", "Quebec", "Saskatchewan", "Yukon"]
|