Sunday, July 19, 2009

announcing Inquiry - FAQs for your apps

Inquiry is a web based application that hosts and manages Frequently Asked Questions for your projects.

As developers, we have multiple applications that usually require some kind of light-weight help system. We have found that FAQs are often a good fit. A static list of FAQs was adequate at first, however, as our applications matured we often needed to manage and fine tune those FAQs which meant committing and redeploying an entire application for a simple FAQ update. At this point, we looked into building FAQ management systems into our applications but we soon realized that was not very DRY. This is where Inquiry came in. Having all of our FAQs in one centralized application proved to be a real time saver and enhanced the overall experience for our end-users.

Inquiry is being developed with the following features in mind:
  • Manage FAQs across multiple projects
  • Create and sort FAQ categories
  • Customizable layouts for each project
  • Support for custom domains with CNAMES and proxies
  • "Was this helpful?" ratings for each FAQ
  • Embed media in FAQ answers
  • API access
Inquiry has just entered open beta so some features may be buggy or incomplete. We welcome all problems, comments, and suggestions.

Head over to http://inquiryapp.com and sign up for a free account!

Thursday, June 4, 2009

multiple hosts/domains and proxied requests in rails

Imagine you have an invoicing application where each client has its own subdomain like http://huberry.ordersapp.com. You'd like to allow clients to use their own domains/uris to access your application like:

http://huberryorders.com
http://orders.huberry.com
http://huberry.com/orders

The proxy gem/plugin solves this problem.

gem install shuber-proxy --source http://gems.github.com
OR
script/plugin install git://github.com/shuber/proxy.git

The proxy gem/plugin detects forwarded host/uri headers and sets the session domain, default host, and relative url root. Now, any calls to url_for, named route helpers, and view url helpers will use the forwarded host/uri while still allowing you to specifically set the :host and :only_path options to override this behavior. The original session domain, default host, and relative url root are restored after each request.

The proxy gem/plugin also provides functionality to support clients that want to add CNAME or A records to their DNS instead of proxying their domain to your application. You can do something like:

# config/initializers/proxy.rb

Proxy.replace_host_with do |request|
unless request.host =~ /(\.|^)ordersapp.com$/i
"#{Account.find_by_domain(request.host).try(:subdomain)}.ordersapp.com"
end
end

This snippet of code will detect any hosts that aren't using your application's domain (which is the case for CNAME and A records) and replaces it with the account's subdomain combined with your application's host. This allows you to specify route conditions or any other logic using your application's real host and also overrides all the url generating helpers so that it still looks like the application is living on the client's domain.

Check out http://github.com/shuber/proxy for more examples.

Thursday, March 5, 2009

git style ignores with svn

Ignoring files with svn sucks. I love git's simple solution that allows you to have one file called .gitignore with newline separated patterns that are parsed as ignore rules. Here's a sample .gitignore file that I use with rails applications:

config/application_settings.yml
config/database.yml
db/*.sqlite3
log/*.log
tmp/*

You can do something similar with svn by running a command like:

svn propset svn:ignore -f some_file.txt .

but you can't specify rules on any nested directories like tmp/*. In order to do that, you'd have to run another command:

svn propset svn:ignore '*' tmp/

I got tired of all that nonsense and decided to make a script that can parse .gitignore style files and properly set the correct subversion ignore rules for them. You can get the script and read more about it here: http://github.com/shuber/svnignore