Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

project code

  • Loading branch information...
commit d84aeab244bb52185871e9b8b19c6c4a21219694 0 parents
@coderoshi authored
Showing with 11,817 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +37 −0 Gemfile
  3. +117 −0 Gemfile.lock
  4. +256 −0 README
  5. +7 −0 Rakefile
  6. +3 −0  app/controllers/application_controller.rb
  7. +83 −0 app/controllers/cities_controller.rb
  8. +83 −0 app/controllers/countries_controller.rb
  9. +83 −0 app/controllers/events_controller.rb
  10. +13 −0 app/controllers/images_controller.rb
  11. +14 −0 app/controllers/shorts_controller.rb
  12. +79 −0 app/controllers/wikis_controller.rb
  13. +2 −0  app/helpers/application_helper.rb
  14. +2 −0  app/helpers/cities_helper.rb
  15. +2 −0  app/helpers/countries_helper.rb
  16. +2 −0  app/helpers/events_helper.rb
  17. +2 −0  app/helpers/images_helper.rb
  18. +2 −0  app/helpers/shorts_helper.rb
  19. +2 −0  app/helpers/wikis_helper.rb
  20. +8 −0 app/models/city.rb
  21. +2 −0  app/models/country.rb
  22. +5 −0 app/models/event.rb
  23. +5 −0 app/models/location.rb
  24. +58 −0 app/models/wiki.rb
  25. +29 −0 app/views/cities/_form.html.erb
  26. +6 −0 app/views/cities/edit.html.erb
  27. +27 −0 app/views/cities/index.html.erb
  28. +5 −0 app/views/cities/new.html.erb
  29. +20 −0 app/views/cities/show.html.erb
  30. +25 −0 app/views/countries/_form.html.erb
  31. +6 −0 app/views/countries/edit.html.erb
  32. +25 −0 app/views/countries/index.html.erb
  33. +5 −0 app/views/countries/new.html.erb
  34. +15 −0 app/views/countries/show.html.erb
  35. +29 −0 app/views/events/_form.html.erb
  36. +6 −0 app/views/events/edit.html.erb
  37. +27 −0 app/views/events/index.html.erb
  38. +5 −0 app/views/events/new.html.erb
  39. +20 −0 app/views/events/show.html.erb
  40. +4 −0 app/views/images/index.html.erb
  41. +14 −0 app/views/layouts/application.html.erb
  42. +1 −0  app/views/shorts/create.html.erb
  43. +4 −0 app/views/shorts/new.html.erb
  44. +17 −0 app/views/wikis/_form.html.erb
  45. +11 −0 app/views/wikis/edit.html.erb
  46. +17 −0 app/views/wikis/index.html.erb
  47. +9 −0 app/views/wikis/new.html.erb
  48. +13 −0 app/views/wikis/show.html.erb
  49. +4 −0 config.ru
  50. +42 −0 config/application.rb
  51. +6 −0 config/boot.rb
  52. +9 −0 config/database.yml
  53. +5 −0 config/environment.rb
  54. +28 −0 config/environments/development.rb
  55. +49 −0 config/environments/production.rb
  56. +35 −0 config/environments/test.rb
  57. +7 −0 config/initializers/backtrace_silencers.rb
  58. +10 −0 config/initializers/inflections.rb
  59. +16 −0 config/initializers/launch_hbase.rb
  60. +5 −0 config/initializers/mime_types.rb
  61. +7 −0 config/initializers/secret_token.rb
  62. +8 −0 config/initializers/session_store.rb
  63. +5 −0 config/locales/en.yml
  64. +6 −0 config/mongoid.yml
  65. +70 −0 config/routes.rb
  66. +13 −0 db/migrate/20110424214540_create_countries.rb
  67. +16 −0 db/migrate/20110424215155_create_events.rb
  68. +12 −0 db/migrate/20110425071723_create_wikis.rb
  69. +23 −0 db/schema.rb
  70. +232 −0 db/seeds.rb
  71. +2 −0  doc/README_FOR_APP
  72. 0  lib/tasks/.gitkeep
  73. +26 −0 public/404.html
  74. +26 −0 public/422.html
  75. +26 −0 public/500.html
  76. 0  public/favicon.ico
  77. BIN  public/images/rails.png
  78. +239 −0 public/index.html
  79. +2 −0  public/javascripts/application.js
  80. +965 −0 public/javascripts/controls.js
  81. +974 −0 public/javascripts/dragdrop.js
  82. +1,123 −0 public/javascripts/effects.js
  83. +6,001 −0 public/javascripts/prototype.js
  84. +191 −0 public/javascripts/rails.js
  85. +5 −0 public/robots.txt
  86. 0  public/stylesheets/.gitkeep
  87. +56 −0 public/stylesheets/scaffold.css
  88. +6 −0 script/rails
  89. +11 −0 test/fixtures/cities.yml
  90. +9 −0 test/fixtures/countries.yml
  91. +11 −0 test/fixtures/events.yml
  92. +9 −0 test/fixtures/locations.yml
  93. +11 −0 test/fixtures/wikis.yml
  94. +49 −0 test/functional/cities_controller_test.rb
  95. +49 −0 test/functional/countries_controller_test.rb
  96. +49 −0 test/functional/events_controller_test.rb
  97. +9 −0 test/functional/images_controller_test.rb
  98. +14 −0 test/functional/shorts_controller_test.rb
  99. +49 −0 test/functional/wikis_controller_test.rb
  100. +9 −0 test/performance/browsing_test.rb
  101. +13 −0 test/test_helper.rb
  102. +8 −0 test/unit/city_test.rb
  103. +8 −0 test/unit/country_test.rb
  104. +8 −0 test/unit/event_test.rb
  105. +4 −0 test/unit/helpers/cities_helper_test.rb
  106. +4 −0 test/unit/helpers/countries_helper_test.rb
  107. +4 −0 test/unit/helpers/events_helper_test.rb
  108. +4 −0 test/unit/helpers/images_helper_test.rb
  109. +4 −0 test/unit/helpers/shorts_helper_test.rb
  110. +4 −0 test/unit/helpers/wikis_helper_test.rb
  111. +8 −0 test/unit/location_test.rb
  112. +8 −0 test/unit/wiki_test.rb
  113. 0  vendor/plugins/.gitkeep
4 .gitignore
@@ -0,0 +1,4 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
37 Gemfile
@@ -0,0 +1,37 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.5'
+gem 'awesome_print'
+gem 'mysql2'
+gem 'pg'
+gem 'pg_search'
+gem 'thrift'
+gem 'cassandra'
+gem 'mongoid'
+gem 'bson_ext'
+gem 'ripple'
+gem 'hiredis'
+gem 'redis', :require => ['redis/connection/hiredis', 'redis']
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
+# gem 'ruby-debug'
+# gem 'ruby-debug19', :require => 'ruby-debug'
+
+# Bundle the extra gems:
+# gem 'bj'
+# gem 'nokogiri'
+# gem 'sqlite3-ruby', :require => 'sqlite3'
+# gem 'aws-s3', :require => 'aws/s3'
+
+# Bundle gems for the local environment. Make sure to
+# put test-only gems in this group so their generators
+# and rake tasks are available in development mode:
+# group :development, :test do
+# gem 'webrat'
+# end
117 Gemfile.lock
@@ -0,0 +1,117 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.5)
+ actionpack (= 3.0.5)
+ mail (~> 2.2.15)
+ actionpack (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ activesupport (3.0.5)
+ arel (2.0.9)
+ awesome_print (0.3.2)
+ beefcake (0.3.1)
+ bson (1.3.0)
+ bson_ext (1.3.0)
+ builder (2.1.2)
+ cassandra (0.9.1)
+ json
+ rake
+ simple_uuid (>= 0.1.0)
+ thrift_client (>= 0.6.0)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ hiredis (0.3.1)
+ i18n (0.5.0)
+ json (1.5.1)
+ mail (2.2.16)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ mongo (1.3.0)
+ bson (>= 1.3.0)
+ mongoid (2.0.1)
+ activemodel (~> 3.0)
+ mongo (~> 1.3)
+ tzinfo (~> 0.3.22)
+ will_paginate (~> 3.0.pre)
+ mysql2 (0.2.7)
+ pg (0.10.1)
+ pg_search (0.1.1)
+ polyglot (0.3.1)
+ rack (1.2.2)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.5)
+ actionmailer (= 3.0.5)
+ actionpack (= 3.0.5)
+ activerecord (= 3.0.5)
+ activeresource (= 3.0.5)
+ activesupport (= 3.0.5)
+ bundler (~> 1.0)
+ railties (= 3.0.5)
+ railties (3.0.5)
+ actionpack (= 3.0.5)
+ activesupport (= 3.0.5)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ redis (2.2.0)
+ riak-client (0.9.3)
+ beefcake (~> 0.3.0)
+ builder (~> 2.1.2)
+ i18n (>= 0.4.0)
+ ripple (0.9.3)
+ activemodel (~> 3.0.0)
+ activesupport (~> 3.0.0)
+ riak-client (~> 0.9.3)
+ simple_uuid (0.1.2)
+ thor (0.14.6)
+ thrift (0.5.0)
+ thrift_client (0.6.0)
+ thrift (~> 0.5.0)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.26)
+ will_paginate (3.0.pre2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ awesome_print
+ bson_ext
+ cassandra
+ hiredis
+ mongoid
+ mysql2
+ pg
+ pg_search
+ rails (= 3.0.5)
+ redis
+ ripple
+ thrift
256 README
@@ -0,0 +1,256 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb"
+templates that are primarily responsible for inserting pre-built data in between
+HTML tags. The model contains the "smart" domain objects (such as Account,
+Product, Person, Post) that holds all the business logic and knows how to
+persist themselves to a database. The controller handles the incoming requests
+(such as Save New Account, Update Product, Show Post) by manipulating the model
+and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, create a new Rails application:
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
+
+2. Change directory to <tt>myapp</tt> and start the web server:
+ <tt>cd myapp; rails server</tt> (run with --help for options)
+
+3. Go to http://localhost:3000/ and you'll see:
+ "Welcome aboard: You're riding Ruby on Rails!"
+
+4. Follow the guidelines to start developing your application. You can find
+the following resources handy:
+
+* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
+* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands
+running on the server.log and development.log. Rails will automatically display
+debugging and runtime information to these files. Debugging info will also be
+shown in the browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code
+using the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
+several books available online as well:
+
+* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two books will bring you up to speed on the Ruby language and also on
+programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your
+Mongrel or WEBrick server with --debugger. This means that you can break out of
+execution at any point in the code, investigate and change the model, and then,
+resume execution! You need to install ruby-debug to run the server in debugging
+mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find(:all)
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
+ #<Post:0x14a6620
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better, you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you can enter "cont".
+
+
+== Console
+
+The console is a Ruby shell, which allows you to interact with your
+application's domain model. Here you'll have all parts of the application
+configured, just like it is when the application is running. You can inspect
+domain models, change values, and save to the database. Starting the script
+without arguments will launch it in the development environment.
+
+To start the console, run <tt>rails console</tt> from the application
+directory.
+
+Options:
+
+* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
+ made to the database.
+* Passing an environment name as an argument will load the corresponding
+ environment. Example: <tt>rails console production</tt>.
+
+To reload your controllers and models after launching the console run
+<tt>reload!</tt>
+
+More information about irb can be found at:
+link:http://www.rubycentral.com/pickaxe/irb.html
+
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>rails
+dbconsole</tt>. You would be connected to the database with the credentials
+defined in database.yml. Starting the script without arguments will connect you
+to the development database. Passing an argument will connect you to a different
+database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
+PostgreSQL and SQLite 3.
+
+== Description of Contents
+
+The default directory structure of a generated Ruby on Rails application:
+
+ |-- app
+ | |-- controllers
+ | |-- helpers
+ | |-- mailers
+ | |-- models
+ | `-- views
+ | `-- layouts
+ |-- config
+ | |-- environments
+ | |-- initializers
+ | `-- locales
+ |-- db
+ |-- doc
+ |-- lib
+ | `-- tasks
+ |-- log
+ |-- public
+ | |-- images
+ | |-- javascripts
+ | `-- stylesheets
+ |-- script
+ |-- test
+ | |-- fixtures
+ | |-- functional
+ | |-- integration
+ | |-- performance
+ | `-- unit
+ |-- tmp
+ | |-- cache
+ | |-- pids
+ | |-- sessions
+ | `-- sockets
+ `-- vendor
+ `-- plugins
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from
+ ApplicationController which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb. Models descend from
+ ActiveRecord::Base by default.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
+ eRuby syntax by default.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the
+ common header/footer method of wrapping views. In your views, define a layout
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
+ Inside default.html.erb, call <% yield %> to render the view using this
+ layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are
+ generated for you automatically when using generators for controllers.
+ Helpers can be used to wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database,
+ and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all the
+ sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when
+ generated using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that
+ doesn't belong under controllers, models, or helpers. This directory is in
+ the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for
+ images, stylesheets, and javascripts. Also contains the dispatchers and the
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
+ server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the rails generate
+ command, template test files will be generated for you and placed in this
+ directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins
+ subdirectory. If the app has frozen rails, those gems also go here, under
+ vendor/rails/. This directory is in the load path.
7 Rakefile
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Rc2011::Application.load_tasks
3  app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
83 app/controllers/cities_controller.rb
@@ -0,0 +1,83 @@
+class CitiesController < ApplicationController
+ # GET /cities
+ # GET /cities.xml
+ def index
+ @cities = City.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @cities }
+ end
+ end
+
+ # GET /cities/1
+ # GET /cities/1.xml
+ def show
+ @city = City.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @city }
+ end
+ end
+
+ # GET /cities/new
+ # GET /cities/new.xml
+ def new
+ @city = City.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @city }
+ end
+ end
+
+ # GET /cities/1/edit
+ def edit
+ @city = City.find(params[:id])
+ end
+
+ # POST /cities
+ # POST /cities.xml
+ def create
+ @city = City.new(params[:city])
+
+ respond_to do |format|
+ if @city.save
+ format.html { redirect_to(@city, :notice => 'City was successfully created.') }
+ format.xml { render :xml => @city, :status => :created, :location => @city }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @city.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /cities/1
+ # PUT /cities/1.xml
+ def update
+ @city = City.find(params[:id])
+
+ respond_to do |format|
+ if @city.update_attributes(params[:city])
+ format.html { redirect_to(@city, :notice => 'City was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @city.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /cities/1
+ # DELETE /cities/1.xml
+ def destroy
+ @city = City.find(params[:id])
+ @city.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(cities_url) }
+ format.xml { head :ok }
+ end
+ end
+end
83 app/controllers/countries_controller.rb
@@ -0,0 +1,83 @@
+class CountriesController < ApplicationController
+ # GET /countries
+ # GET /countries.xml
+ def index
+ @countries = Country.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @countries }
+ end
+ end
+
+ # GET /countries/1
+ # GET /countries/1.xml
+ def show
+ @country = Country.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @country }
+ end
+ end
+
+ # GET /countries/new
+ # GET /countries/new.xml
+ def new
+ @country = Country.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @country }
+ end
+ end
+
+ # GET /countries/1/edit
+ def edit
+ @country = Country.find(params[:id])
+ end
+
+ # POST /countries
+ # POST /countries.xml
+ def create
+ @country = Country.new(params[:country])
+
+ respond_to do |format|
+ if @country.save
+ format.html { redirect_to(@country, :notice => 'Country was successfully created.') }
+ format.xml { render :xml => @country, :status => :created, :location => @country }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @country.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /countries/1
+ # PUT /countries/1.xml
+ def update
+ @country = Country.find(params[:id])
+
+ respond_to do |format|
+ if @country.update_attributes(params[:country])
+ format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @country.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /countries/1
+ # DELETE /countries/1.xml
+ def destroy
+ @country = Country.find(params[:id])
+ @country.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(countries_url) }
+ format.xml { head :ok }
+ end
+ end
+end
83 app/controllers/events_controller.rb
@@ -0,0 +1,83 @@
+class EventsController < ApplicationController
+ # GET /events
+ # GET /events.xml
+ def index
+ @events = Event.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @events }
+ end
+ end
+
+ # GET /events/1
+ # GET /events/1.xml
+ def show
+ @event = Event.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @event }
+ end
+ end
+
+ # GET /events/new
+ # GET /events/new.xml
+ def new
+ @event = Event.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @event }
+ end
+ end
+
+ # GET /events/1/edit
+ def edit
+ @event = Event.find(params[:id])
+ end
+
+ # POST /events
+ # POST /events.xml
+ def create
+ @event = Event.new(params[:event])
+
+ respond_to do |format|
+ if @event.save
+ format.html { redirect_to(@event, :notice => 'Event was successfully created.') }
+ format.xml { render :xml => @event, :status => :created, :location => @event }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /events/1
+ # PUT /events/1.xml
+ def update
+ @event = Event.find(params[:id])
+
+ respond_to do |format|
+ if @event.update_attributes(params[:event])
+ format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /events/1
+ # DELETE /events/1.xml
+ def destroy
+ @event = Event.find(params[:id])
+ @event.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(events_url) }
+ format.xml { head :ok }
+ end
+ end
+end
13 app/controllers/images_controller.rb
@@ -0,0 +1,13 @@
+class ImagesController < ApplicationController
+ def create
+ file = params[:file]
+
+ client = Riak::Client.new(:http_port => 8091)
+ ro = Riak::RObject.new(client.bucket('images'), file.original_filename)
+ ro.content_type = file.content_type
+ ro.data = file.tempfile.read
+ ro.store
+
+ redirect_to "http://127.0.0.1:8091/riak/images/#{file.original_filename}"
+ end
+end
14 app/controllers/shorts_controller.rb
@@ -0,0 +1,14 @@
+class ShortsController < ApplicationController
+ @@redis = Redis.new
+
+ def show
+ redirect_to @@redis.get(params[:id])
+ end
+
+ def create
+ @key = @@redis.incr('short_id').to_i.to_s(16)
+ @@redis.set(@key, params[:url])
+ @short_url = "http://localhost:3000/shorts/#{@key}"
+ end
+
+end
79 app/controllers/wikis_controller.rb
@@ -0,0 +1,79 @@
+class WikisController < ApplicationController
+ # GET /wikis
+ # GET /wikis.xml
+ def index
+ @wikis = Wiki.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @wikis }
+ end
+ end
+
+ # GET /wikis/1
+ # GET /wikis/1.xml
+ def show
+ @wiki = Wiki.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @wiki }
+ end
+ end
+
+ # GET /wikis/new
+ # GET /wikis/new.xml
+ def new
+ @wiki = Wiki.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @wiki }
+ end
+ end
+
+ # GET /wikis/1/edit
+ def edit
+ @wiki = Wiki.find(params[:id])
+ end
+
+ # POST /wikis
+ # POST /wikis.xml
+ def create
+ thrift do |hbase|
+ hbase.mutateRow('wiki', params[:title], [
+ Mutation.new(:column => 'text:', :value => params[:text]),
+ Mutation.new(:column => 'title:', :value => params[:title])
+ ])
+ end
+ redirect_to wikis_url
+ end
+
+ # PUT /wikis/1
+ # PUT /wikis/1.xml
+ def update
+ @wiki = Wiki.find(params[:id])
+
+ respond_to do |format|
+ if @wiki.update_attributes(params[:wiki])
+ format.html { redirect_to(@wiki, :notice => 'Wiki was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @wiki.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /wikis/1
+ # DELETE /wikis/1.xml
+ def destroy
+ @wiki = Wiki.find(params[:id])
+ @wiki.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(wikis_url) }
+ format.xml { head :ok }
+ end
+ end
+end
2  app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
2  app/helpers/cities_helper.rb
@@ -0,0 +1,2 @@
+module CitiesHelper
+end
2  app/helpers/countries_helper.rb
@@ -0,0 +1,2 @@
+module CountriesHelper
+end
2  app/helpers/events_helper.rb
@@ -0,0 +1,2 @@
+module EventsHelper
+end
2  app/helpers/images_helper.rb
@@ -0,0 +1,2 @@
+module ImagesHelper
+end
2  app/helpers/shorts_helper.rb
@@ -0,0 +1,2 @@
+module ShortsHelper
+end
2  app/helpers/wikis_helper.rb
@@ -0,0 +1,2 @@
+module WikisHelper
+end
8 app/models/city.rb
@@ -0,0 +1,8 @@
+class City
+ include Mongoid::Document
+ field :name, :type => String
+ field :country, :type => String
+ field :population, :type => Integer
+ embeds_one :location
+ index [[:location, Mongo::GEO2D]], :min => -180, :max => 180
+end
2  app/models/country.rb
@@ -0,0 +1,2 @@
+class Country < ActiveRecord::Base
+end
5 app/models/event.rb
@@ -0,0 +1,5 @@
+class Event < ActiveRecord::Base
+ establish_connection "postgresql_#{Rails.env}"
+ include PgSearch
+ pg_search_scope :sounds_like_title, :against => :title, :using => :dmetaphone
+end
5 app/models/location.rb
@@ -0,0 +1,5 @@
+class Location
+ include Mongoid::Document
+ field :latitude, :type => Float
+ field :longitude, :type => Float
+end
58 app/models/wiki.rb
@@ -0,0 +1,58 @@
+class Wiki < ActiveRecord::Base
+ attr_accessor :title, :text
+
+ def initialize(attrs={})
+ @title, @text = attrs[:title], attrs[:text]
+ end
+
+ def self.all(start='')
+ wikis = []
+ thrift do |hbase|
+ scanner = hbase.scannerOpen('wiki', start, ['title:', 'text:'])
+ begin
+ while (row = hbase.scannerGet(scanner)).present?
+ row.sort.each do |v|
+ wikis << Wiki.new(:title => v.columns['title:'].value, :text => v.columns['text:'].value)
+ end
+ end
+ rescue => nf
+ $stderr.puts nf
+ hbase.scannerClose(scanner)
+ end
+ end
+ wikis
+ end
+
+ def self.find(title)
+ wiki = nil
+ thrift do |hbase|
+ row = hbase.getRow('wiki', title)
+ row.sort.each do |v|
+ wiki = Wiki.new(:title => v.columns['title:'].value, :text => v.columns['text:'].value)
+ end
+ end
+ wiki
+ end
+
+ def update_attributes(attrs={})
+ @title, @text = attrs[:title], attrs[:text]
+ thrift do |hbase|
+ hbase.mutateRow('wiki', @title, [
+ Mutation.new(:column=>'title:', :value=>title),
+ Mutation.new(:column=>'text:', :value=>text)
+ ])
+ end
+ true
+ end
+
+ def history
+ historical_text = []
+ thrift do |hbase|
+ versions = hbase.getVer('wiki', title, 'text:', 10)
+ versions.each do |v|
+ historical_text << v.value.dup
+ end
+ end
+ historical_text
+ end
+end
29 app/views/cities/_form.html.erb
@@ -0,0 +1,29 @@
+<%= form_for(@city) do |f| %>
+ <% if @city.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@city.errors.count, "error") %> prohibited this city from being saved:</h2>
+
+ <ul>
+ <% @city.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="field">
+ <%= f.label :country %><br />
+ <%= f.text_field :country %>
+ </div>
+ <div class="field">
+ <%= f.label :population %><br />
+ <%= f.text_field :population %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
6 app/views/cities/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing city</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @city %> |
+<%= link_to 'Back', cities_path %>
27 app/views/cities/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing cities</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th>Country</th>
+ <th>Population</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @cities.each do |city| %>
+ <tr>
+ <td><%= city.name %></td>
+ <td><%= city.country %></td>
+ <td><%= city.population %></td>
+ <td><%= link_to 'Show', city %></td>
+ <td><%= link_to 'Edit', edit_city_path(city) %></td>
+ <td><%= link_to 'Destroy', city, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New City', new_city_path %>
5 app/views/cities/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New city</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', cities_path %>
20 app/views/cities/show.html.erb
@@ -0,0 +1,20 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Name:</b>
+ <%= @city.name %>
+</p>
+
+<p>
+ <b>Country:</b>
+ <%= @city.country %>
+</p>
+
+<p>
+ <b>Population:</b>
+ <%= @city.population %>
+</p>
+
+
+<%= link_to 'Edit', edit_city_path(@city) %> |
+<%= link_to 'Back', cities_path %>
25 app/views/countries/_form.html.erb
@@ -0,0 +1,25 @@
+<%= form_for(@country) do |f| %>
+ <% if @country.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@country.errors.count, "error") %> prohibited this country from being saved:</h2>
+
+ <ul>
+ <% @country.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :iso %><br />
+ <%= f.text_field :iso %>
+ </div>
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
6 app/views/countries/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing country</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @country %> |
+<%= link_to 'Back', countries_path %>
25 app/views/countries/index.html.erb
@@ -0,0 +1,25 @@
+<h1>Listing countries</h1>
+
+<table>
+ <tr>
+ <th>Iso</th>
+ <th>Name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @countries.each do |country| %>
+ <tr>
+ <td><%= country.iso %></td>
+ <td><%= country.name %></td>
+ <td><%= link_to 'Show', country %></td>
+ <td><%= link_to 'Edit', edit_country_path(country) %></td>
+ <td><%= link_to 'Destroy', country, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Country', new_country_path %>
5 app/views/countries/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New country</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', countries_path %>
15 app/views/countries/show.html.erb
@@ -0,0 +1,15 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Iso:</b>
+ <%= @country.iso %>
+</p>
+
+<p>
+ <b>Name:</b>
+ <%= @country.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_country_path(@country) %> |
+<%= link_to 'Back', countries_path %>
29 app/views/events/_form.html.erb
@@ -0,0 +1,29 @@
+<%= form_for(@event) do |f| %>
+ <% if @event.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@event.errors.count, "error") %> prohibited this event from being saved:</h2>
+
+ <ul>
+ <% @event.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :title %><br />
+ <%= f.text_field :title %>
+ </div>
+ <div class="field">
+ <%= f.label :starts %><br />
+ <%= f.datetime_select :starts %>
+ </div>
+ <div class="field">
+ <%= f.label :iso %><br />
+ <%= f.text_field :iso %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
6 app/views/events/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing event</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @event %> |
+<%= link_to 'Back', events_path %>
27 app/views/events/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing events</h1>
+
+<table>
+ <tr>
+ <th>Title</th>
+ <th>Starts</th>
+ <th>Iso</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @events.each do |event| %>
+ <tr>
+ <td><%= event.title %></td>
+ <td><%= event.starts %></td>
+ <td><%= Country.find_by_iso(event.iso).name %></td>
+ <td><%= link_to 'Show', event %></td>
+ <td><%= link_to 'Edit', edit_event_path(event) %></td>
+ <td><%= link_to 'Destroy', event, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Event', new_event_path %>
5 app/views/events/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New event</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', events_path %>
20 app/views/events/show.html.erb
@@ -0,0 +1,20 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Title:</b>
+ <%= @event.title %>
+</p>
+
+<p>
+ <b>Starts:</b>
+ <%= @event.starts %>
+</p>
+
+<p>
+ <b>Iso:</b>
+ <%= @event.iso %>
+</p>
+
+
+<%= link_to 'Edit', edit_event_path(@event) %> |
+<%= link_to 'Back', events_path %>
4 app/views/images/index.html.erb
@@ -0,0 +1,4 @@
+<form action="/images" method="POST" enctype="multipart/form-data">
+ <input type="file" name="file"/>
+ <input type="submit"/>
+</form>
14 app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Rc2011</title>
+ <%= stylesheet_link_tag :all %>
+ <%= javascript_include_tag :defaults %>
+ <%= csrf_meta_tag %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
1  app/views/shorts/create.html.erb
@@ -0,0 +1 @@
+<%= link_to @short_url, @short_url %>
4 app/views/shorts/new.html.erb
@@ -0,0 +1,4 @@
+<form action="/shorts" method="POST">
+ <input name="url" autocomplete="off" />
+ <input type="submit"/>
+</form>
17 app/views/wikis/_form.html.erb
@@ -0,0 +1,17 @@
+<%= form_for(@wiki) do |f| %>
+ <% if @wiki.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@wiki.errors.count, "error") %> prohibited this wiki from being saved:</h2>
+
+ <ul>
+ <% @wiki.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
11 app/views/wikis/edit.html.erb
@@ -0,0 +1,11 @@
+<h1>Editing wiki</h1>
+
+<form action="/wikis/<%= @wiki.title %>" method="POST">
+ <input name="_method" type="hidden" value="put" />
+ <p><input name="wiki[title]" value="<%= @wiki.title %>" /></p>
+ <p><textarea name="wiki[text]"><%= @wiki.text %></textarea></p>
+ <p><input type="submit" /></p>
+</form>
+
+<%= link_to 'Show', @wiki.title %> |
+<%= link_to 'Back', wikis_path %>
17 app/views/wikis/index.html.erb
@@ -0,0 +1,17 @@
+<h1>Listing wikis</h1>
+
+<table>
+ <tr>
+ <th></th>
+ </tr>
+
+<% @wikis.each do |wiki| %>
+ <tr>
+ <td><%= link_to wiki.title, "/wikis/#{wiki.title}" %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Wiki', new_wiki_path %>
9 app/views/wikis/new.html.erb
@@ -0,0 +1,9 @@
+<h1>New wiki</h1>
+
+<form action="/wikis" method="POST">
+ <p><input name="title" /></p>
+ <p><textarea name="text"></textarea></p>
+ <p><input type="submit" /></p>
+</form>
+
+<%= link_to 'Back', wikis_path %>
13 app/views/wikis/show.html.erb
@@ -0,0 +1,13 @@
+<p id="notice"><%= notice %></p>
+
+<h1><%= @wiki.title %></h1>
+<p><%= @wiki.text %></p>
+
+<ul>
+ <% for history in @wiki.history %>
+ <li><%= history %></li>
+ <% end %>
+</ul>
+
+<%= link_to 'Edit', edit_wiki_path(@wiki.title) %> |
+<%= link_to 'Back', wikis_path %>
4 config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Rc2011::Application
42 config/application.rb
@@ -0,0 +1,42 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Rc2011
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+ end
+end
6 config/boot.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
9 config/database.yml
@@ -0,0 +1,9 @@
+development:
+ adapter: mysql2
+ database: rc2011
+ username: root
+
+postgresql_development:
+ adapter: postgresql
+ database: rc2011
+ username: root
5 config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Rc2011::Application.initialize!
28 config/environments/development.rb
@@ -0,0 +1,28 @@
+Rc2011::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+
+ config.autoload_paths += ['/Users/eredmond/Code/booktools/hbase-0.90.2/gen-rb']
+end
+
49 config/environments/production.rb
@@ -0,0 +1,49 @@
+Rc2011::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The production environment is meant for finished, "live" apps.
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Specifies the header that your server uses for sending files
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
+
+ # For nginx:
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+
+ # If you have no front-end server that supports something like X-Sendfile,
+ # just comment this out and Rails will serve the files
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Disable Rails's static asset server
+ # In production, Apache or nginx will already do this
+ config.serve_static_assets = false
+
+ # Enable serving of images, stylesheets, and javascripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
35 config/environments/test.rb
@@ -0,0 +1,35 @@
+Rc2011::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
7 config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
10 config/initializers/inflections.rb
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
16 config/initializers/launch_hbase.rb
@@ -0,0 +1,16 @@
+require 'hbase'
+class Object
+ include Apache::Hadoop::Hbase::Thrift
+ def thrift
+ unless defined?(@@client)
+ @@thrift_socket = Thrift::Socket.new('127.0.0.1', 9090)
+ @@thrift_transport = Thrift::BufferedTransport.new(@@thrift_socket)
+ @@thrift_protocol = Thrift::BinaryProtocol.new(@@thrift_transport)
+ @@client = Hbase::Client.new(@@thrift_protocol)
+ end
+ @@thrift_transport.open
+ yield @@client
+ ensure
+ @@thrift_transport.close
+ end
+end
5 config/initializers/mime_types.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
7 config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Rc2011::Application.config.secret_token = '54ee014ae844d43367a28a05047ec942082347e2fec156928e96a8cc2f6fda600e1e5f4dee53d73cd1bdbaaf2aa00877821bfdd30baca05984608a05772c283a'
8 config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Rc2011::Application.config.session_store :cookie_store, :key => '_rc2011_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# Rc2011::Application.config.session_store :active_record_store
5 config/locales/en.yml
@@ -0,0 +1,5 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
6 config/mongoid.yml
@@ -0,0 +1,6 @@
+development:
+ use_utc: true
+ reconnect_time: 3
+ use_object_ids: true
+ host: localhost
+ database: rc2011
70 config/routes.rb
@@ -0,0 +1,70 @@
+Rc2011::Application.routes.draw do
+ resources :shorts
+
+ resources :images
+
+ resources :cities
+
+ resources :wikis
+
+ resources :events
+
+ resources :countries
+
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
+
+ # Sample of regular route:
+ # match 'products/:id' => 'catalog#view'
+ # Keep in mind you can assign values other than :controller and :action
+
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
+
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
+
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => "welcome#index"
+
+ # See how all your routes lay out with "rake routes"
+
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id(.:format)))'
+end
13 db/migrate/20110424214540_create_countries.rb
@@ -0,0 +1,13 @@
+class CreateCountries < ActiveRecord::Migration
+ def self.up
+ return if Rails.env =~ /postgresql/
+ create_table :countries, :options => 'ENGINE=MEMORY' do |t|
+ t.string :iso, :size => 2
+ t.string :name
+ end
+ end
+
+ def self.down
+ drop_table :countries
+ end
+end
16 db/migrate/20110424215155_create_events.rb
@@ -0,0 +1,16 @@
+class CreateEvents < ActiveRecord::Migration
+ def self.up
+ return unless Rails.env =~ /postgresql/
+ create_table :events do |t|
+ t.string :title
+ t.timestamp :starts
+ t.string :iso
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :events
+ end
+end
12 db/migrate/20110425071723_create_wikis.rb
@@ -0,0 +1,12 @@
+class CreateWikis < ActiveRecord::Migration
+ def self.up
+ create_table :wikis do |t|
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :wikis
+ end
+end
23 db/schema.rb
@@ -0,0 +1,23 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20110424215155) do
+
+ create_table "events", :force => true do |t|
+ t.string "title"
+ t.datetime "starts"
+ t.string "iso"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
232 db/seeds.rb
@@ -0,0 +1,232 @@
+
+# Populate countries if blank
+if Country.count == 0
+ puts "Populate countries"
+ Country.reset_column_information
+ Country.create(:iso => 'AF', :name => 'AFGHANISTAN')
+ Country.create(:iso => 'AL', :name => 'ALBANIA')
+ Country.create(:iso => 'DZ', :name => 'ALGERIA')
+ Country.create(:iso => 'AS', :name => 'AMERICAN SAMOA')
+ Country.create(:iso => 'AD', :name => 'ANDORRA')
+ Country.create(:iso => 'AO', :name => 'ANGOLA')
+ Country.create(:iso => 'AI', :name => 'ANGUILLA')
+ Country.create(:iso => 'AG', :name => 'ANTIGUA AND BARBUDA')
+ Country.create(:iso => 'AR', :name => 'ARGENTINA')
+ Country.create(:iso => 'AM', :name => 'ARMENIA')
+ Country.create(:iso => 'AW', :name => 'ARUBA')
+ Country.create(:iso => 'AU', :name => 'AUSTRALIA')
+ Country.create(:iso => 'AT', :name => 'AUSTRIA')
+ Country.create(:iso => 'AZ', :name => 'AZERBAIJAN')
+ Country.create(:iso => 'BS', :name => 'BAHAMAS')
+ Country.create(:iso => 'BH', :name => 'BAHRAIN')
+ Country.create(:iso => 'BD', :name => 'BANGLADESH')
+ Country.create(:iso => 'BB', :name => 'BARBADOS')
+ Country.create(:iso => 'BY', :name => 'BELARUS')
+ Country.create(:iso => 'BE', :name => 'BELGIUM')
+ Country.create(:iso => 'BZ', :name => 'BELIZE')
+ Country.create(:iso => 'BJ', :name => 'BENIN')
+ Country.create(:iso => 'BM', :name => 'BERMUDA')
+ Country.create(:iso => 'BT', :name => 'BHUTAN')
+ Country.create(:iso => 'BO', :name => 'BOLIVIA')
+ Country.create(:iso => 'BA', :name => 'BOSNIA AND HERZEGOVINA')
+ Country.create(:iso => 'BW', :name => 'BOTSWANA')
+ Country.create(:iso => 'BR', :name => 'BRAZIL')
+ Country.create(:iso => 'BN', :name => 'BRUNEI DARUSSALAM')
+ Country.create(:iso => 'BG', :name => 'BULGARIA')
+ Country.create(:iso => 'BF', :name => 'BURKINA FASO')
+ Country.create(:iso => 'BI', :name => 'BURUNDI')
+ Country.create(:iso => 'KH', :name => 'CAMBODIA')
+ Country.create(:iso => 'CM', :name => 'CAMEROON')
+ Country.create(:iso => 'CA', :name => 'CANADA')
+ Country.create(:iso => 'CV', :name => 'CAPE VERDE')
+ Country.create(:iso => 'KY', :name => 'CAYMAN ISLANDS')
+ Country.create(:iso => 'CF', :name => 'CENTRAL AFRICAN REPUBLIC')
+ Country.create(:iso => 'TD', :name => 'CHAD')
+ Country.create(:iso => 'CL', :name => 'CHILE')
+ Country.create(:iso => 'CN', :name => 'CHINA')
+ Country.create(:iso => 'CO', :name => 'COLOMBIA')
+ Country.create(:iso => 'KM', :name => 'COMOROS')
+ Country.create(:iso => 'CG', :name => 'CONGO')
+ Country.create(:iso => 'CD', :name => 'CONGO, THE DEMOCRATIC REPUBLIC OF THE')
+ Country.create(:iso => 'CK', :name => 'COOK ISLANDS')
+ Country.create(:iso => 'CR', :name => 'COSTA RICA')
+ Country.create(:iso => 'CI', :name => 'COTE D\'IVOIRE')
+ Country.create(:iso => 'HR', :name => 'CROATIA')
+ Country.create(:iso => 'CU', :name => 'CUBA')
+ Country.create(:iso => 'CY', :name => 'CYPRUS')
+ Country.create(:iso => 'CZ', :name => 'CZECH REPUBLIC')
+ Country.create(:iso => 'DK', :name => 'DENMARK')
+ Country.create(:iso => 'DJ', :name => 'DJIBOUTI')
+ Country.create(:iso => 'DM', :name => 'DOMINICA')
+ Country.create(:iso => 'DO', :name => 'DOMINICAN REPUBLIC')
+ Country.create(:iso => 'EC', :name => 'ECUADOR')
+ Country.create(:iso => 'EG', :name => 'EGYPT')
+ Country.create(:iso => 'SV', :name => 'EL SALVADOR')
+ Country.create(:iso => 'GQ', :name => 'EQUATORIAL GUINEA')
+ Country.create(:iso => 'ER', :name => 'ERITREA')
+ Country.create(:iso => 'EE', :name => 'ESTONIA')
+ Country.create(:iso => 'ET', :name => 'ETHIOPIA')
+ Country.create(:iso => 'FK', :name => 'FALKLAND ISLANDS (MALVINAS)')
+ Country.create(:iso => 'FO', :name => 'FAROE ISLANDS')
+ Country.create(:iso => 'FJ', :name => 'FIJI')
+ Country.create(:iso => 'FI', :name => 'FINLAND')
+ Country.create(:iso => 'FR', :name => 'FRANCE')
+ Country.create(:iso => 'GF', :name => 'FRENCH GUIANA')
+ Country.create(:iso => 'PF', :name => 'FRENCH POLYNESIA')
+ Country.create(:iso => 'GA', :name => 'GABON')
+ Country.create(:iso => 'GM', :name => 'GAMBIA')
+ Country.create(:iso => 'GE', :name => 'GEORGIA')
+ Country.create(:iso => 'DE', :name => 'GERMANY')
+ Country.create(:iso => 'GH', :name => 'GHANA')
+ Country.create(:iso => 'GI', :name => 'GIBRALTAR')
+ Country.create(:iso => 'GR', :name => 'GREECE')
+ Country.create(:iso => 'GL', :name => 'GREENLAND')
+ Country.create(:iso => 'GD', :name => 'GRENADA')
+ Country.create(:iso => 'GP', :name => 'GUADELOUPE')
+ Country.create(:iso => 'GU', :name => 'GUAM')
+ Country.create(:iso => 'GT', :name => 'GUATEMALA')
+ Country.create(:iso => 'GN', :name => 'GUINEA')
+ Country.create(:iso => 'GW', :name => 'GUINEA-BISSAU')
+ Country.create(:iso => 'GY', :name => 'GUYANA')
+ Country.create(:iso => 'HT', :name => 'HAITI')
+ Country.create(:iso => 'VA', :name => 'HOLY SEE (VATICAN CITY STATE)')
+ Country.create(:iso => 'HN', :name => 'HONDURAS')
+ Country.create(:iso => 'HK', :name => 'HONG KONG')
+ Country.create(:iso => 'HU', :name => 'HUNGARY')
+ Country.create(:iso => 'IS', :name => 'ICELAND')
+ Country.create(:iso => 'IN', :name => 'INDIA')
+ Country.create(:iso => 'ID', :name => 'INDONESIA')
+ Country.create(:iso => 'IR', :name => 'IRAN, ISLAMIC REPUBLIC OF')
+ Country.create(:iso => 'IQ', :name => 'IRAQ')
+ Country.create(:iso => 'IE', :name => 'IRELAND')
+ Country.create(:iso => 'IL', :name => 'ISRAEL')
+ Country.create(:iso => 'IT', :name => 'ITALY')
+ Country.create(:iso => 'JM', :name => 'JAMAICA')
+ Country.create(:iso => 'JP', :name => 'JAPAN')
+ Country.create(:iso => 'JO', :name => 'JORDAN')
+ Country.create(:iso => 'KZ', :name => 'KAZAKHSTAN')
+ Country.create(:iso => 'KE', :name => 'KENYA')
+ Country.create(:iso => 'KI', :name => 'KIRIBATI')
+ Country.create(:iso => 'KP', :name => 'KOREA, DEMOCRATIC PEOPLE\'S REPUBLIC OF')
+ Country.create(:iso => 'KR', :name => 'KOREA, REPUBLIC OF')
+ Country.create(:iso => 'KW', :name => 'KUWAIT')
+ Country.create(:iso => 'KG', :name => 'KYRGYZSTAN')
+ Country.create(:iso => 'LA', :name => 'LAO PEOPLE\'S DEMOCRATIC REPUBLIC')
+ Country.create(:iso => 'LV', :name => 'LATVIA')
+ Country.create(:iso => 'LB', :name => 'LEBANON')
+ Country.create(:iso => 'LS', :name => 'LESOTHO')
+ Country.create(:iso => 'LR', :name => 'LIBERIA')
+ Country.create(:iso => 'LY', :name => 'LIBYAN ARAB JAMAHIRIYA')
+ Country.create(:iso => 'LI', :name => 'LIECHTENSTEIN')
+ Country.create(:iso => 'LT', :name => 'LITHUANIA')
+ Country.create(:iso => 'LU', :name => 'LUXEMBOURG')
+ Country.create(:iso => 'MO', :name => 'MACAO')
+ Country.create(:iso => 'MK', :name => 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF')
+ Country.create(:iso => 'MG', :name => 'MADAGASCAR')
+ Country.create(:iso => 'MW', :name => 'MALAWI')
+ Country.create(:iso => 'MY', :name => 'MALAYSIA')
+ Country.create(:iso => 'MV', :name => 'MALDIVES')
+ Country.create(:iso => 'ML', :name => 'MALI')
+ Country.create(:iso => 'MT', :name => 'MALTA')
+ Country.create(:iso => 'MH', :name => 'MARSHALL ISLANDS')
+ Country.create(:iso => 'MQ', :name => 'MARTINIQUE')
+ Country.create(:iso => 'MR', :name => 'MAURITANIA')
+ Country.create(:iso => 'MU', :name => 'MAURITIUS')
+ Country.create(:iso => 'MX', :name => 'MEXICO')
+ Country.create(:iso => 'FM', :name => 'MICRONESIA, FEDERATED STATES OF')
+ Country.create(:iso => 'MD', :name => 'MOLDOVA, REPUBLIC OF')
+ Country.create(:iso => 'MC', :name => 'MONACO')
+ Country.create(:iso => 'MN', :name => 'MONGOLIA')
+ Country.create(:iso => 'MS', :name => 'MONTSERRAT')
+ Country.create(:iso => 'MA', :name => 'MOROCCO')
+ Country.create(:iso => 'MZ', :name => 'MOZAMBIQUE')
+ Country.create(:iso => 'MM', :name => 'MYANMAR')
+ Country.create(:iso => 'NA', :name => 'NAMIBIA')
+ Country.create(:iso => 'NR', :name => 'NAURU')
+ Country.create(:iso => 'NP', :name => 'NEPAL')
+ Country.create(:iso => 'NL', :name => 'NETHERLANDS')
+ Country.create(:iso => 'AN', :name => 'NETHERLANDS ANTILLES')
+ Country.create(:iso => 'NC', :name => 'NEW CALEDONIA')
+ Country.create(:iso => 'NZ', :name => 'NEW ZEALAND')
+ Country.create(:iso => 'NI', :name => 'NICARAGUA')
+ Country.create(:iso => 'NE', :name => 'NIGER')
+ Country.create(:iso => 'NG', :name => 'NIGERIA')
+ Country.create(:iso => 'NU', :name => 'NIUE')
+ Country.create(:iso => 'NF', :name => 'NORFOLK ISLAND')
+ Country.create(:iso => 'MP', :name => 'NORTHERN MARIANA ISLANDS')
+ Country.create(:iso => 'NO', :name => 'NORWAY')
+ Country.create(:iso => 'OM', :name => 'OMAN')
+ Country.create(:iso => 'PK', :name => 'PAKISTAN')
+ Country.create(:iso => 'PW', :name => 'PALAU')
+ Country.create(:iso => 'PA', :name => 'PANAMA')
+ Country.create(:iso => 'PG', :name => 'PAPUA NEW GUINEA')
+ Country.create(:iso => 'PY', :name => 'PARAGUAY')
+ Country.create(:iso => 'PE', :name => 'PERU')
+ Country.create(:iso => 'PH', :name => 'PHILIPPINES')
+ Country.create(:iso => 'PN', :name => 'PITCAIRN')
+ Country.create(:iso => 'PL', :name => 'POLAND')
+ Country.create(:iso => 'PT', :name => 'PORTUGAL')
+ Country.create(:iso => 'PR', :name => 'PUERTO RICO')
+ Country.create(:iso => 'QA', :name => 'QATAR')
+ Country.create(:iso => 'RE', :name => 'REUNION')
+ Country.create(:iso => 'RO', :name => 'ROMANIA')
+ Country.create(:iso => 'RU', :name => 'RUSSIAN FEDERATION')
+ Country.create(:iso => 'RW', :name => 'RWANDA')
+ Country.create(:iso => 'SH', :name => 'SAINT HELENA')
+ Country.create(:iso => 'KN', :name => 'SAINT KITTS AND NEVIS')
+ Country.create(:iso => 'LC', :name => 'SAINT LUCIA')
+ Country.create(:iso => 'PM', :name => 'SAINT PIERRE AND MIQUELON')
+ Country.create(:iso => 'VC', :name => 'SAINT VINCENT AND THE GRENADINES')
+ Country.create(:iso => 'WS', :name => 'SAMOA')
+ Country.create(:iso => 'SM', :name => 'SAN MARINO')
+ Country.create(:iso => 'ST', :name => 'SAO TOME AND PRINCIPE')
+ Country.create(:iso => 'SA', :name => 'SAUDI ARABIA')
+ Country.create(:iso => 'SN', :name => 'SENEGAL')
+ Country.create(:iso => 'SC', :name => 'SEYCHELLES')
+ Country.create(:iso => 'SL', :name => 'SIERRA LEONE')
+ Country.create(:iso => 'SG', :name => 'SINGAPORE')
+ Country.create(:iso => 'SK', :name => 'SLOVAKIA')
+ Country.create(:iso => 'SI', :name => 'SLOVENIA')
+ Country.create(:iso => 'SB', :name => 'SOLOMON ISLANDS')
+ Country.create(:iso => 'SO', :name => 'SOMALIA')
+ Country.create(:iso => 'ZA', :name => 'SOUTH AFRICA')
+ Country.create(:iso => 'ES', :name => 'SPAIN')
+ Country.create(:iso => 'LK', :name => 'SRI LANKA')
+ Country.create(:iso => 'SD', :name => 'SUDAN')
+ Country.create(:iso => 'SR', :name => 'SURINAME')
+ Country.create(:iso => 'SJ', :name => 'SVALBARD AND JAN MAYEN')
+ Country.create(:iso => 'SZ', :name => 'SWAZILAND')
+ Country.create(:iso => 'SE', :name => 'SWEDEN')
+ Country.create(:iso => 'CH', :name => 'SWITZERLAND')
+ Country.create(:iso => 'SY', :name => 'SYRIAN ARAB REPUBLIC')
+ Country.create(:iso => 'TW', :name => 'TAIWAN, PROVINCE OF CHINA')
+ Country.create(:iso => 'TJ', :name => 'TAJIKISTAN')
+ Country.create(:iso => 'TZ', :name => 'TANZANIA, UNITED REPUBLIC OF')
+ Country.create(:iso => 'TH', :name => 'THAILAND')
+ Country.create(:iso => 'TG', :name => 'TOGO')
+ Country.create(:iso => 'TK', :name => 'TOKELAU')
+ Country.create(:iso => 'TO', :name => 'TONGA')
+ Country.create(:iso => 'TT', :name => 'TRINIDAD AND TOBAGO')
+ Country.create(:iso => 'TN', :name => 'TUNISIA')
+ Country.create(:iso => 'TR', :name => 'TURKEY')
+ Country.create(:iso => 'TM', :name => 'TURKMENISTAN')
+ Country.create(:iso => 'TC', :name => 'TURKS AND CAICOS ISLANDS')
+ Country.create(:iso => 'TV', :name => 'TUVALU')
+ Country.create(:iso => 'UG', :name => 'UGANDA')
+ Country.create(:iso => 'UA', :name => 'UKRAINE')
+ Country.create(:iso => 'AE', :name => 'UNITED ARAB EMIRATES')
+ Country.create(:iso => 'GB', :name => 'UNITED KINGDOM')
+ Country.create(:iso => 'US', :name => 'UNITED STATES')
+ Country.create(:iso => 'UY', :name => 'URUGUAY')
+ Country.create(:iso => 'UZ', :name => 'UZBEKISTAN')
+ Country.create(:iso => 'VU', :name => 'VANUATU')
+ Country.create(:iso => 'VE', :name => 'VENEZUELA')
+ Country.create(:iso => 'VN', :name => 'VIET NAM')
+ Country.create(:iso => 'VG', :name => 'VIRGIN ISLANDS, BRITISH')
+ Country.create(:iso => 'VI', :name => 'VIRGIN ISLANDS, U.S.')
+ Country.create(:iso => 'WF', :name => 'WALLIS AND FUTUNA')
+ Country.create(:iso => 'EH', :name => 'WESTERN SAHARA')
+ Country.create(:iso => 'YE', :name => 'YEMEN')
+ Country.create(:iso => 'ZM', :name => 'ZAMBIA')
+ Country.create(:iso => 'ZW', :name => 'ZIMBABWE')
+end
2  doc/README_FOR_APP
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
0  lib/tasks/.gitkeep
No changes.
26 public/404.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html>
26 public/422.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The change you wanted was rejected (422)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <h1>The change you wanted was rejected.</h1>
+ <p>Maybe you tried to change something you didn't have access to.</p>
+ </div>
+</body>
+</html>
26 public/500.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>We're sorry, but something went wrong (500)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/500.html -->
+ <div class="dialog">
+ <h1>We're sorry, but something went wrong.</h1>
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
+ </div>
+</body>
+</html>
0  public/favicon.ico
No changes.
BIN  public/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
239 public/index.html
@@ -0,0 +1,239 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Ruby on Rails: Welcome aboard</title>
+ <style type="text/css" media="screen">
+ body {
+ margin: 0;
+ margin-bottom: 25px;
+ padding: 0;
+ background-color: #f0f0f0;
+ font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
+ font-size: 13px;
+ color: #333;
+ }
+
+ h1 {
+ font-size: 28px;
+ color: #000;
+ }
+
+ a {color: #03c}
+ a:hover {
+ background-color: #03c;
+ color: white;
+ text-decoration: none;
+ }
+
+
+ #page {
+ background-color: #f0f0f0;
+ width: 750px;
+ margin: 0;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ #content {
+ float: left;
+ background-color: white;
+ border: 3px solid #aaa;
+ border-top: none;
+ padding: 25px;
+ width: 500px;
+ }
+
+ #sidebar {
+ float: right;
+ width: 175px;
+ }
+
+ #footer {
+ clear: both;
+ }
+
+
+ #header, #about, #getting-started {
+ padding-left: 75px;
+ padding-right: 30px;
+ }
+
+
+ #header {
+ background-image: url("images/rails.png");
+ background-repeat: no-repeat;