fb-localizer 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
 - data/Gemfile.lock +1 -1
 - data/lib/fb-localizer/version.rb +1 -1
 - data/lib/fb-localizer.rb +19 -2
 - data/spec/helpers/fb-localizer_spec.rb +32 -2
 - data/testapp/Gemfile +1 -25
 - data/testapp/Gemfile.lock +10 -3
 - data/testapp/app/controllers/static_controller.rb +15 -0
 - data/testapp/app/views/static/index.html.haml +6 -0
 - data/testapp/config/initializers/fb-localizer.rb +3 -0
 - data/testapp/config/routes.rb +1 -56
 - metadata +8 -5
 - data/testapp/public/index.html +0 -239
 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/fb-localizer/version.rb
    CHANGED
    
    
    
        data/lib/fb-localizer.rb
    CHANGED
    
    | 
         @@ -2,17 +2,34 @@ require 'fb-localizer/railtie' if defined? Rails 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'i18n'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            module FbLocalizer
         
     | 
| 
      
 5 
     | 
    
         
            +
              DEFAULT_PRIORITIES = { :en => "en_US", :es => "es_ES", :pt => "pt_PT", :zh => "zh_CN" }
         
     | 
| 
      
 6 
     | 
    
         
            +
              mattr_accessor :priorized
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       5 
8 
     | 
    
         
             
              module FbLocalizerHelpers
         
     | 
| 
       6 
9 
     | 
    
         
             
                def get_fb_locale(ruby_locale = nil)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  ruby_locale = ruby_locale.to_sym if ruby_locale.is_a? String
         
     | 
| 
       7 
11 
     | 
    
         
             
                  ruby_locale ||= I18n.locale
         
     | 
| 
       8 
12 
     | 
    
         
             
                  fb_candidate_locales = FbLocalizer::FbLocalizerHelpers::FB_LOCALES.select{ |l| l.match(/^#{ruby_locale}/)}
         
     | 
| 
       9 
13 
     | 
    
         
             
                  if fb_candidate_locales.any?
         
     | 
| 
       10 
     | 
    
         
            -
                     
     | 
| 
      
 14 
     | 
    
         
            +
                    priorized = FbLocalizer.priorized[ruby_locale] # get priorized locale for that one
         
     | 
| 
      
 15 
     | 
    
         
            +
                    if priorized && fb_candidate_locales.include?(priorized) # if available, get that one
         
     | 
| 
      
 16 
     | 
    
         
            +
                      priorized
         
     | 
| 
      
 17 
     | 
    
         
            +
                    else # if not, just get the first available
         
     | 
| 
      
 18 
     | 
    
         
            +
                      fb_candidate_locales[0]
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
       11 
20 
     | 
    
         
             
                  else
         
     | 
| 
       12 
     | 
    
         
            -
                    "en_US"
         
     | 
| 
      
 21 
     | 
    
         
            +
                    "en_US" # US english by default
         
     | 
| 
       13 
22 
     | 
    
         
             
                  end
         
     | 
| 
       14 
23 
     | 
    
         
             
                end
         
     | 
| 
       15 
24 
     | 
    
         
             
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def self.configure
         
     | 
| 
      
 27 
     | 
    
         
            +
                yield self
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              def self.priorized
         
     | 
| 
      
 31 
     | 
    
         
            +
                DEFAULT_PRIORITIES.merge(@@priorized)
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
       16 
33 
     | 
    
         
             
            end
         
     | 
| 
       17 
34 
     | 
    
         | 
| 
       18 
35 
     | 
    
         
             
            ActionView::Base.send(:include, FbLocalizer::FbLocalizerHelpers)
         
     | 
| 
         @@ -10,11 +10,16 @@ describe FbLocalizer::FbLocalizerHelpers do 
     | 
|
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
              context "when we check for english" do
         
     | 
| 
       13 
     | 
    
         
            -
                it "should return  
     | 
| 
       14 
     | 
    
         
            -
                  helper.get_fb_locale("en").should == " 
     | 
| 
      
 13 
     | 
    
         
            +
                it "should return en_GB" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  helper.get_fb_locale("en").should == "en_GB"
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
              context "when we check for chinese" do
         
     | 
| 
      
 19 
     | 
    
         
            +
                it "should return zh_CN" do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  helper.get_fb_locale("zh").should == "zh_CN" # simplified Chinese
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
24 
     | 
    
         
             
              # Invalid checks
         
     | 
| 
       20 
25 
     | 
    
         
             
              context "when we check for spanish" do
         
     | 
| 
         @@ -28,4 +33,29 @@ describe FbLocalizer::FbLocalizerHelpers do 
     | 
|
| 
       28 
33 
     | 
    
         
             
                  helper.get_fb_locale("cy").should_not == "ca_ES"
         
     | 
| 
       29 
34 
     | 
    
         
             
                end
         
     | 
| 
       30 
35 
     | 
    
         
             
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              # Set some priorizations
         
     | 
| 
      
 38 
     | 
    
         
            +
              context "when we check for english" do
         
     | 
| 
      
 39 
     | 
    
         
            +
                it "should not return en_GB" do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  FbLocalizer.priorized = { :en => "en_US" }
         
     | 
| 
      
 41 
     | 
    
         
            +
                  helper.get_fb_locale("en").should_not == "en_GB"
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                it "should return en_US" do
         
     | 
| 
      
 45 
     | 
    
         
            +
                  FbLocalizer.priorized = { :en => "en_US" }
         
     | 
| 
      
 46 
     | 
    
         
            +
                  helper.get_fb_locale("en").should == "en_US"
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              context "when we check for chinese" do
         
     | 
| 
      
 51 
     | 
    
         
            +
                it "should not return zh_CN" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  FbLocalizer.priorized = { :zh => "zh_HK" } # switch Hong Kong's chinese
         
     | 
| 
      
 53 
     | 
    
         
            +
                  helper.get_fb_locale("zh").should_not == "zh_CN"
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                it "should return zh_HK" do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  FbLocalizer.priorized = { :zh => "zh_HK" } # switch Hong Kong's chinese
         
     | 
| 
      
 58 
     | 
    
         
            +
                  helper.get_fb_locale("zh").should == "zh_HK"
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
       31 
61 
     | 
    
         
             
            end
         
     | 
    
        data/testapp/Gemfile
    CHANGED
    
    | 
         @@ -3,30 +3,6 @@ source 'http://rubygems.org' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            gem 'rails', '3.0.5'
         
     | 
| 
       4 
4 
     | 
    
         
             
            gem 'fb-localizer', :path => ".."
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            # gem 'rails', :git => 'git://github.com/rails/rails.git'
         
     | 
| 
      
 6 
     | 
    
         
            +
            gem 'haml-rails'
         
     | 
| 
       8 
7 
     | 
    
         | 
| 
       9 
8 
     | 
    
         
             
            gem 'sqlite3'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            # Use unicorn as the web server
         
     | 
| 
       12 
     | 
    
         
            -
            # gem 'unicorn'
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            # Deploy with Capistrano
         
     | 
| 
       15 
     | 
    
         
            -
            # gem 'capistrano'
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
         
     | 
| 
       18 
     | 
    
         
            -
            # gem 'ruby-debug'
         
     | 
| 
       19 
     | 
    
         
            -
            # gem 'ruby-debug19', :require => 'ruby-debug'
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            # Bundle the extra gems:
         
     | 
| 
       22 
     | 
    
         
            -
            # gem 'bj'
         
     | 
| 
       23 
     | 
    
         
            -
            # gem 'nokogiri'
         
     | 
| 
       24 
     | 
    
         
            -
            # gem 'sqlite3-ruby', :require => 'sqlite3'
         
     | 
| 
       25 
     | 
    
         
            -
            # gem 'aws-s3', :require => 'aws/s3'
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            # Bundle gems for the local environment. Make sure to
         
     | 
| 
       28 
     | 
    
         
            -
            # put test-only gems in this group so their generators
         
     | 
| 
       29 
     | 
    
         
            -
            # and rake tasks are available in development mode:
         
     | 
| 
       30 
     | 
    
         
            -
            # group :development, :test do
         
     | 
| 
       31 
     | 
    
         
            -
            #   gem 'webrat'
         
     | 
| 
       32 
     | 
    
         
            -
            # end
         
     | 
    
        data/testapp/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: ..
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                fb-localizer (0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
                fb-localizer (0.1.2)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  i18n
         
     | 
| 
       6 
     | 
    
         
            -
                  libxml-ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
                  libxml-ruby (= 1.1.3)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  rails
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            GEM
         
     | 
| 
         @@ -40,8 +40,14 @@ GEM 
     | 
|
| 
       40 
40 
     | 
    
         
             
                builder (2.1.2)
         
     | 
| 
       41 
41 
     | 
    
         
             
                erubis (2.6.6)
         
     | 
| 
       42 
42 
     | 
    
         
             
                  abstract (>= 1.0.0)
         
     | 
| 
      
 43 
     | 
    
         
            +
                haml (3.1.1)
         
     | 
| 
      
 44 
     | 
    
         
            +
                haml-rails (0.3.4)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  actionpack (~> 3.0)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  activesupport (~> 3.0)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  haml (~> 3.0)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  railties (~> 3.0)
         
     | 
| 
       43 
49 
     | 
    
         
             
                i18n (0.5.0)
         
     | 
| 
       44 
     | 
    
         
            -
                libxml-ruby (1.1. 
     | 
| 
      
 50 
     | 
    
         
            +
                libxml-ruby (1.1.3)
         
     | 
| 
       45 
51 
     | 
    
         
             
                mail (2.2.15)
         
     | 
| 
       46 
52 
     | 
    
         
             
                  activesupport (>= 2.3.6)
         
     | 
| 
       47 
53 
     | 
    
         
             
                  i18n (>= 0.4.0)
         
     | 
| 
         @@ -79,5 +85,6 @@ PLATFORMS 
     | 
|
| 
       79 
85 
     | 
    
         | 
| 
       80 
86 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
       81 
87 
     | 
    
         
             
              fb-localizer!
         
     | 
| 
      
 88 
     | 
    
         
            +
              haml-rails
         
     | 
| 
       82 
89 
     | 
    
         
             
              rails (= 3.0.5)
         
     | 
| 
       83 
90 
     | 
    
         
             
              sqlite3
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class StaticController < ApplicationController
         
     | 
| 
      
 2 
     | 
    
         
            +
              NAMES = {
         
     | 
| 
      
 3 
     | 
    
         
            +
                :en => "UK English", # default is US, but we priorize en_GB in app/initializers/fb-localizer.rb
         
     | 
| 
      
 4 
     | 
    
         
            +
                :es => "Spain's Spanish",
         
     | 
| 
      
 5 
     | 
    
         
            +
                :it => "Italian",
         
     | 
| 
      
 6 
     | 
    
         
            +
                :ca => "Catalan",
         
     | 
| 
      
 7 
     | 
    
         
            +
                :pt => "Portugal's Portuguese",
         
     | 
| 
      
 8 
     | 
    
         
            +
                :tl => "Klingon"
         
     | 
| 
      
 9 
     | 
    
         
            +
              }
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def index
         
     | 
| 
      
 12 
     | 
    
         
            +
                @locale = params[:locale] ? params[:locale].to_sym : I18n.locale
         
     | 
| 
      
 13 
     | 
    
         
            +
                @names = NAMES
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
    
        data/testapp/config/routes.rb
    CHANGED
    
    | 
         @@ -1,58 +1,3 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Testapp::Application.routes.draw do
         
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
       3 
     | 
    
         
            -
              # first created -> highest priority.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              # Sample of regular route:
         
     | 
| 
       6 
     | 
    
         
            -
              #   match 'products/:id' => 'catalog#view'
         
     | 
| 
       7 
     | 
    
         
            -
              # Keep in mind you can assign values other than :controller and :action
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              # Sample of named route:
         
     | 
| 
       10 
     | 
    
         
            -
              #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
         
     | 
| 
       11 
     | 
    
         
            -
              # This route can be invoked with purchase_url(:id => product.id)
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              # Sample resource route (maps HTTP verbs to controller actions automatically):
         
     | 
| 
       14 
     | 
    
         
            -
              #   resources :products
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              # Sample resource route with options:
         
     | 
| 
       17 
     | 
    
         
            -
              #   resources :products do
         
     | 
| 
       18 
     | 
    
         
            -
              #     member do
         
     | 
| 
       19 
     | 
    
         
            -
              #       get 'short'
         
     | 
| 
       20 
     | 
    
         
            -
              #       post 'toggle'
         
     | 
| 
       21 
     | 
    
         
            -
              #     end
         
     | 
| 
       22 
     | 
    
         
            -
              #
         
     | 
| 
       23 
     | 
    
         
            -
              #     collection do
         
     | 
| 
       24 
     | 
    
         
            -
              #       get 'sold'
         
     | 
| 
       25 
     | 
    
         
            -
              #     end
         
     | 
| 
       26 
     | 
    
         
            -
              #   end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              # Sample resource route with sub-resources:
         
     | 
| 
       29 
     | 
    
         
            -
              #   resources :products do
         
     | 
| 
       30 
     | 
    
         
            -
              #     resources :comments, :sales
         
     | 
| 
       31 
     | 
    
         
            -
              #     resource :seller
         
     | 
| 
       32 
     | 
    
         
            -
              #   end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
              # Sample resource route with more complex sub-resources
         
     | 
| 
       35 
     | 
    
         
            -
              #   resources :products do
         
     | 
| 
       36 
     | 
    
         
            -
              #     resources :comments
         
     | 
| 
       37 
     | 
    
         
            -
              #     resources :sales do
         
     | 
| 
       38 
     | 
    
         
            -
              #       get 'recent', :on => :collection
         
     | 
| 
       39 
     | 
    
         
            -
              #     end
         
     | 
| 
       40 
     | 
    
         
            -
              #   end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
              # Sample resource route within a namespace:
         
     | 
| 
       43 
     | 
    
         
            -
              #   namespace :admin do
         
     | 
| 
       44 
     | 
    
         
            -
              #     # Directs /admin/products/* to Admin::ProductsController
         
     | 
| 
       45 
     | 
    
         
            -
              #     # (app/controllers/admin/products_controller.rb)
         
     | 
| 
       46 
     | 
    
         
            -
              #     resources :products
         
     | 
| 
       47 
     | 
    
         
            -
              #   end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
              # You can have the root of your site routed with "root"
         
     | 
| 
       50 
     | 
    
         
            -
              # just remember to delete public/index.html.
         
     | 
| 
       51 
     | 
    
         
            -
              # root :to => "welcome#index"
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              # See how all your routes lay out with "rake routes"
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
              # This is a legacy wild controller route that's not recommended for RESTful applications.
         
     | 
| 
       56 
     | 
    
         
            -
              # Note: This route will make all actions in every controller accessible via GET requests.
         
     | 
| 
       57 
     | 
    
         
            -
              # match ':controller(/:action(/:id(.:format)))'
         
     | 
| 
      
 2 
     | 
    
         
            +
              root :to => "static#index"
         
     | 
| 
       58 
3 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fb-localizer
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 29
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.1.3
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Albert Bellonch
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2011- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2011-05-13 00:00:00 +02:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -89,6 +89,7 @@ extensions: [] 
     | 
|
| 
       89 
89 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
       91 
91 
     | 
    
         
             
            files: 
         
     | 
| 
      
 92 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
       92 
93 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       93 
94 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       94 
95 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -107,8 +108,10 @@ files: 
     | 
|
| 
       107 
108 
     | 
    
         
             
            - testapp/README
         
     | 
| 
       108 
109 
     | 
    
         
             
            - testapp/Rakefile
         
     | 
| 
       109 
110 
     | 
    
         
             
            - testapp/app/controllers/application_controller.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - testapp/app/controllers/static_controller.rb
         
     | 
| 
       110 
112 
     | 
    
         
             
            - testapp/app/helpers/application_helper.rb
         
     | 
| 
       111 
113 
     | 
    
         
             
            - testapp/app/views/layouts/application.html.erb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - testapp/app/views/static/index.html.haml
         
     | 
| 
       112 
115 
     | 
    
         
             
            - testapp/config.ru
         
     | 
| 
       113 
116 
     | 
    
         
             
            - testapp/config/application.rb
         
     | 
| 
       114 
117 
     | 
    
         
             
            - testapp/config/boot.rb
         
     | 
| 
         @@ -118,6 +121,7 @@ files: 
     | 
|
| 
       118 
121 
     | 
    
         
             
            - testapp/config/environments/production.rb
         
     | 
| 
       119 
122 
     | 
    
         
             
            - testapp/config/environments/test.rb
         
     | 
| 
       120 
123 
     | 
    
         
             
            - testapp/config/initializers/backtrace_silencers.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - testapp/config/initializers/fb-localizer.rb
         
     | 
| 
       121 
125 
     | 
    
         
             
            - testapp/config/initializers/inflections.rb
         
     | 
| 
       122 
126 
     | 
    
         
             
            - testapp/config/initializers/mime_types.rb
         
     | 
| 
       123 
127 
     | 
    
         
             
            - testapp/config/initializers/secret_token.rb
         
     | 
| 
         @@ -132,7 +136,6 @@ files: 
     | 
|
| 
       132 
136 
     | 
    
         
             
            - testapp/public/500.html
         
     | 
| 
       133 
137 
     | 
    
         
             
            - testapp/public/favicon.ico
         
     | 
| 
       134 
138 
     | 
    
         
             
            - testapp/public/images/rails.png
         
     | 
| 
       135 
     | 
    
         
            -
            - testapp/public/index.html
         
     | 
| 
       136 
139 
     | 
    
         
             
            - testapp/public/javascripts/application.js
         
     | 
| 
       137 
140 
     | 
    
         
             
            - testapp/public/javascripts/controls.js
         
     | 
| 
       138 
141 
     | 
    
         
             
            - testapp/public/javascripts/dragdrop.js
         
     | 
    
        data/testapp/public/index.html
    DELETED
    
    | 
         @@ -1,239 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <!DOCTYPE html>
         
     | 
| 
       2 
     | 
    
         
            -
            <html>
         
     | 
| 
       3 
     | 
    
         
            -
              <head>
         
     | 
| 
       4 
     | 
    
         
            -
                <title>Ruby on Rails: Welcome aboard</title>
         
     | 
| 
       5 
     | 
    
         
            -
                <style type="text/css" media="screen">
         
     | 
| 
       6 
     | 
    
         
            -
                  body {
         
     | 
| 
       7 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       8 
     | 
    
         
            -
                    margin-bottom: 25px;
         
     | 
| 
       9 
     | 
    
         
            -
                    padding: 0;
         
     | 
| 
       10 
     | 
    
         
            -
                    background-color: #f0f0f0;
         
     | 
| 
       11 
     | 
    
         
            -
                    font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
         
     | 
| 
       12 
     | 
    
         
            -
                    font-size: 13px;
         
     | 
| 
       13 
     | 
    
         
            -
                    color: #333;
         
     | 
| 
       14 
     | 
    
         
            -
                  }
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                  h1 {
         
     | 
| 
       17 
     | 
    
         
            -
                    font-size: 28px;
         
     | 
| 
       18 
     | 
    
         
            -
                    color: #000;
         
     | 
| 
       19 
     | 
    
         
            -
                  }
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                  a  {color: #03c}
         
     | 
| 
       22 
     | 
    
         
            -
                  a:hover {
         
     | 
| 
       23 
     | 
    
         
            -
                    background-color: #03c;
         
     | 
| 
       24 
     | 
    
         
            -
                    color: white;
         
     | 
| 
       25 
     | 
    
         
            -
                    text-decoration: none;
         
     | 
| 
       26 
     | 
    
         
            -
                  }
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                  #page {
         
     | 
| 
       30 
     | 
    
         
            -
                    background-color: #f0f0f0;
         
     | 
| 
       31 
     | 
    
         
            -
                    width: 750px;
         
     | 
| 
       32 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       33 
     | 
    
         
            -
                    margin-left: auto;
         
     | 
| 
       34 
     | 
    
         
            -
                    margin-right: auto;
         
     | 
| 
       35 
     | 
    
         
            -
                  }
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                  #content {
         
     | 
| 
       38 
     | 
    
         
            -
                    float: left;
         
     | 
| 
       39 
     | 
    
         
            -
                    background-color: white;
         
     | 
| 
       40 
     | 
    
         
            -
                    border: 3px solid #aaa;
         
     | 
| 
       41 
     | 
    
         
            -
                    border-top: none;
         
     | 
| 
       42 
     | 
    
         
            -
                    padding: 25px;
         
     | 
| 
       43 
     | 
    
         
            -
                    width: 500px;
         
     | 
| 
       44 
     | 
    
         
            -
                  }
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  #sidebar {
         
     | 
| 
       47 
     | 
    
         
            -
                    float: right;
         
     | 
| 
       48 
     | 
    
         
            -
                    width: 175px;
         
     | 
| 
       49 
     | 
    
         
            -
                  }
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                  #footer {
         
     | 
| 
       52 
     | 
    
         
            -
                    clear: both;
         
     | 
| 
       53 
     | 
    
         
            -
                  }
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                  #header, #about, #getting-started {
         
     | 
| 
       57 
     | 
    
         
            -
                    padding-left: 75px;
         
     | 
| 
       58 
     | 
    
         
            -
                    padding-right: 30px;
         
     | 
| 
       59 
     | 
    
         
            -
                  }
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                  #header {
         
     | 
| 
       63 
     | 
    
         
            -
                    background-image: url("images/rails.png");
         
     | 
| 
       64 
     | 
    
         
            -
                    background-repeat: no-repeat;
         
     | 
| 
       65 
     | 
    
         
            -
                    background-position: top left;
         
     | 
| 
       66 
     | 
    
         
            -
                    height: 64px;
         
     | 
| 
       67 
     | 
    
         
            -
                  }
         
     | 
| 
       68 
     | 
    
         
            -
                  #header h1, #header h2 {margin: 0}
         
     | 
| 
       69 
     | 
    
         
            -
                  #header h2 {
         
     | 
| 
       70 
     | 
    
         
            -
                    color: #888;
         
     | 
| 
       71 
     | 
    
         
            -
                    font-weight: normal;
         
     | 
| 
       72 
     | 
    
         
            -
                    font-size: 16px;
         
     | 
| 
       73 
     | 
    
         
            -
                  }
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                  #about h3 {
         
     | 
| 
       77 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       78 
     | 
    
         
            -
                    margin-bottom: 10px;
         
     | 
| 
       79 
     | 
    
         
            -
                    font-size: 14px;
         
     | 
| 
       80 
     | 
    
         
            -
                  }
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                  #about-content {
         
     | 
| 
       83 
     | 
    
         
            -
                    background-color: #ffd;
         
     | 
| 
       84 
     | 
    
         
            -
                    border: 1px solid #fc0;
         
     | 
| 
       85 
     | 
    
         
            -
                    margin-left: -55px;
         
     | 
| 
       86 
     | 
    
         
            -
                    margin-right: -10px;
         
     | 
| 
       87 
     | 
    
         
            -
                  }
         
     | 
| 
       88 
     | 
    
         
            -
                  #about-content table {
         
     | 
| 
       89 
     | 
    
         
            -
                    margin-top: 10px;
         
     | 
| 
       90 
     | 
    
         
            -
                    margin-bottom: 10px;
         
     | 
| 
       91 
     | 
    
         
            -
                    font-size: 11px;
         
     | 
| 
       92 
     | 
    
         
            -
                    border-collapse: collapse;
         
     | 
| 
       93 
     | 
    
         
            -
                  }
         
     | 
| 
       94 
     | 
    
         
            -
                  #about-content td {
         
     | 
| 
       95 
     | 
    
         
            -
                    padding: 10px;
         
     | 
| 
       96 
     | 
    
         
            -
                    padding-top: 3px;
         
     | 
| 
       97 
     | 
    
         
            -
                    padding-bottom: 3px;
         
     | 
| 
       98 
     | 
    
         
            -
                  }
         
     | 
| 
       99 
     | 
    
         
            -
                  #about-content td.name  {color: #555}
         
     | 
| 
       100 
     | 
    
         
            -
                  #about-content td.value {color: #000}
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                  #about-content ul {
         
     | 
| 
       103 
     | 
    
         
            -
                    padding: 0;
         
     | 
| 
       104 
     | 
    
         
            -
                    list-style-type: none;
         
     | 
| 
       105 
     | 
    
         
            -
                  }
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
                  #about-content.failure {
         
     | 
| 
       108 
     | 
    
         
            -
                    background-color: #fcc;
         
     | 
| 
       109 
     | 
    
         
            -
                    border: 1px solid #f00;
         
     | 
| 
       110 
     | 
    
         
            -
                  }
         
     | 
| 
       111 
     | 
    
         
            -
                  #about-content.failure p {
         
     | 
| 
       112 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       113 
     | 
    
         
            -
                    padding: 10px;
         
     | 
| 
       114 
     | 
    
         
            -
                  }
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
                  #getting-started {
         
     | 
| 
       118 
     | 
    
         
            -
                    border-top: 1px solid #ccc;
         
     | 
| 
       119 
     | 
    
         
            -
                    margin-top: 25px;
         
     | 
| 
       120 
     | 
    
         
            -
                    padding-top: 15px;
         
     | 
| 
       121 
     | 
    
         
            -
                  }
         
     | 
| 
       122 
     | 
    
         
            -
                  #getting-started h1 {
         
     | 
| 
       123 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       124 
     | 
    
         
            -
                    font-size: 20px;
         
     | 
| 
       125 
     | 
    
         
            -
                  }
         
     | 
| 
       126 
     | 
    
         
            -
                  #getting-started h2 {
         
     | 
| 
       127 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       128 
     | 
    
         
            -
                    font-size: 14px;
         
     | 
| 
       129 
     | 
    
         
            -
                    font-weight: normal;
         
     | 
| 
       130 
     | 
    
         
            -
                    color: #333;
         
     | 
| 
       131 
     | 
    
         
            -
                    margin-bottom: 25px;
         
     | 
| 
       132 
     | 
    
         
            -
                  }
         
     | 
| 
       133 
     | 
    
         
            -
                  #getting-started ol {
         
     | 
| 
       134 
     | 
    
         
            -
                    margin-left: 0;
         
     | 
| 
       135 
     | 
    
         
            -
                    padding-left: 0;
         
     | 
| 
       136 
     | 
    
         
            -
                  }
         
     | 
| 
       137 
     | 
    
         
            -
                  #getting-started li {
         
     | 
| 
       138 
     | 
    
         
            -
                    font-size: 18px;
         
     | 
| 
       139 
     | 
    
         
            -
                    color: #888;
         
     | 
| 
       140 
     | 
    
         
            -
                    margin-bottom: 25px;
         
     | 
| 
       141 
     | 
    
         
            -
                  }
         
     | 
| 
       142 
     | 
    
         
            -
                  #getting-started li h2 {
         
     | 
| 
       143 
     | 
    
         
            -
                    margin: 0;
         
     | 
| 
       144 
     | 
    
         
            -
                    font-weight: normal;
         
     | 
| 
       145 
     | 
    
         
            -
                    font-size: 18px;
         
     | 
| 
       146 
     | 
    
         
            -
                    color: #333;
         
     | 
| 
       147 
     | 
    
         
            -
                  }
         
     | 
| 
       148 
     | 
    
         
            -
                  #getting-started li p {
         
     | 
| 
       149 
     | 
    
         
            -
                    color: #555;
         
     | 
| 
       150 
     | 
    
         
            -
                    font-size: 13px;
         
     | 
| 
       151 
     | 
    
         
            -
                  }
         
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
                  #sidebar ul {
         
     | 
| 
       155 
     | 
    
         
            -
                    margin-left: 0;
         
     | 
| 
       156 
     | 
    
         
            -
                    padding-left: 0;
         
     | 
| 
       157 
     | 
    
         
            -
                  }
         
     | 
| 
       158 
     | 
    
         
            -
                  #sidebar ul h3 {
         
     | 
| 
       159 
     | 
    
         
            -
                    margin-top: 25px;
         
     | 
| 
       160 
     | 
    
         
            -
                    font-size: 16px;
         
     | 
| 
       161 
     | 
    
         
            -
                    padding-bottom: 10px;
         
     | 
| 
       162 
     | 
    
         
            -
                    border-bottom: 1px solid #ccc;
         
     | 
| 
       163 
     | 
    
         
            -
                  }
         
     | 
| 
       164 
     | 
    
         
            -
                  #sidebar li {
         
     | 
| 
       165 
     | 
    
         
            -
                    list-style-type: none;
         
     | 
| 
       166 
     | 
    
         
            -
                  }
         
     | 
| 
       167 
     | 
    
         
            -
                  #sidebar ul.links li {
         
     | 
| 
       168 
     | 
    
         
            -
                    margin-bottom: 5px;
         
     | 
| 
       169 
     | 
    
         
            -
                  }
         
     | 
| 
       170 
     | 
    
         
            -
             
     | 
| 
       171 
     | 
    
         
            -
                </style>
         
     | 
| 
       172 
     | 
    
         
            -
                <script type="text/javascript">
         
     | 
| 
       173 
     | 
    
         
            -
                  function about() {
         
     | 
| 
       174 
     | 
    
         
            -
                    info = document.getElementById('about-content');
         
     | 
| 
       175 
     | 
    
         
            -
                    if (window.XMLHttpRequest)
         
     | 
| 
       176 
     | 
    
         
            -
                      { xhr = new XMLHttpRequest(); }
         
     | 
| 
       177 
     | 
    
         
            -
                    else
         
     | 
| 
       178 
     | 
    
         
            -
                      { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
         
     | 
| 
       179 
     | 
    
         
            -
                    xhr.open("GET","rails/info/properties",false);
         
     | 
| 
       180 
     | 
    
         
            -
                    xhr.send("");
         
     | 
| 
       181 
     | 
    
         
            -
                    info.innerHTML = xhr.responseText;
         
     | 
| 
       182 
     | 
    
         
            -
                    info.style.display = 'block'
         
     | 
| 
       183 
     | 
    
         
            -
                  }
         
     | 
| 
       184 
     | 
    
         
            -
                </script>
         
     | 
| 
       185 
     | 
    
         
            -
              </head>
         
     | 
| 
       186 
     | 
    
         
            -
              <body>
         
     | 
| 
       187 
     | 
    
         
            -
                <div id="page">
         
     | 
| 
       188 
     | 
    
         
            -
                  <div id="sidebar">
         
     | 
| 
       189 
     | 
    
         
            -
                    <ul id="sidebar-items">
         
     | 
| 
       190 
     | 
    
         
            -
                      <li>
         
     | 
| 
       191 
     | 
    
         
            -
                        <h3>Browse the documentation</h3>
         
     | 
| 
       192 
     | 
    
         
            -
                        <ul class="links">
         
     | 
| 
       193 
     | 
    
         
            -
                          <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
         
     | 
| 
       194 
     | 
    
         
            -
                          <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
         
     | 
| 
       195 
     | 
    
         
            -
                          <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
         
     | 
| 
       196 
     | 
    
         
            -
                          <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
         
     | 
| 
       197 
     | 
    
         
            -
                        </ul>
         
     | 
| 
       198 
     | 
    
         
            -
                      </li>
         
     | 
| 
       199 
     | 
    
         
            -
                    </ul>
         
     | 
| 
       200 
     | 
    
         
            -
                  </div>
         
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
                  <div id="content">
         
     | 
| 
       203 
     | 
    
         
            -
                    <div id="header">
         
     | 
| 
       204 
     | 
    
         
            -
                      <h1>Welcome aboard</h1>
         
     | 
| 
       205 
     | 
    
         
            -
                      <h2>You’re riding Ruby on Rails!</h2>
         
     | 
| 
       206 
     | 
    
         
            -
                    </div>
         
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
                    <div id="about">
         
     | 
| 
       209 
     | 
    
         
            -
                      <h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3>
         
     | 
| 
       210 
     | 
    
         
            -
                      <div id="about-content" style="display: none"></div>
         
     | 
| 
       211 
     | 
    
         
            -
                    </div>
         
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
                    <div id="getting-started">
         
     | 
| 
       214 
     | 
    
         
            -
                      <h1>Getting started</h1>
         
     | 
| 
       215 
     | 
    
         
            -
                      <h2>Here’s how to get rolling:</h2>
         
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
                      <ol>
         
     | 
| 
       218 
     | 
    
         
            -
                        <li>
         
     | 
| 
       219 
     | 
    
         
            -
                          <h2>Use <code>rails generate</code> to create your models and controllers</h2>
         
     | 
| 
       220 
     | 
    
         
            -
                          <p>To see all available options, run it without parameters.</p>
         
     | 
| 
       221 
     | 
    
         
            -
                        </li>
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
                        <li>
         
     | 
| 
       224 
     | 
    
         
            -
                          <h2>Set up a default route and remove or rename this file</h2>
         
     | 
| 
       225 
     | 
    
         
            -
                          <p>Routes are set up in config/routes.rb.</p>
         
     | 
| 
       226 
     | 
    
         
            -
                        </li>
         
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
                        <li>
         
     | 
| 
       229 
     | 
    
         
            -
                          <h2>Create your database</h2>
         
     | 
| 
       230 
     | 
    
         
            -
                          <p>Run <code>rake db:migrate</code> to create your database. If you're not using SQLite (the default), edit <code>config/database.yml</code> with your username and password.</p>
         
     | 
| 
       231 
     | 
    
         
            -
                        </li>
         
     | 
| 
       232 
     | 
    
         
            -
                      </ol>
         
     | 
| 
       233 
     | 
    
         
            -
                    </div>
         
     | 
| 
       234 
     | 
    
         
            -
                  </div>
         
     | 
| 
       235 
     | 
    
         
            -
             
     | 
| 
       236 
     | 
    
         
            -
                  <div id="footer"> </div>
         
     | 
| 
       237 
     | 
    
         
            -
                </div>
         
     | 
| 
       238 
     | 
    
         
            -
              </body>
         
     | 
| 
       239 
     | 
    
         
            -
            </html>
         
     |