Agile Web Development with Rails, Edition 4

26.2 HAML 26.1.2 Asset Packager

26.1.4 JQuery

edit Gemfile
gem 'activemerchant', '~> 1.10.0'
gem 'haml', '~> 4.0'
gem 'jquery-rails', '~> 0.2.2'
bundle install --local
Resolving dependencies...
Using rake (10.1.1)
Using abstract (1.0.0)
Using activesupport (3.0.20) from source at /home/rubys/git/rails
Using builder (2.1.2)
Using i18n (0.5.3)
Using activemodel (3.0.20) from source at /home/rubys/git/rails
Using erubis (2.6.6)
Using rack (1.2.8)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.38)
Using actionpack (3.0.20) from source at /home/rubys/git/rails
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.2.20)
Using actionmailer (3.0.20) from source at /home/rubys/git/rails
Using braintree (2.28.0)
Using activemerchant (1.10.0)
Using arel (2.0.10)
Using activerecord (3.0.20) from source at /home/rubys/git/rails
Using activeresource (3.0.20) from source at /home/rubys/git/rails
Using bundler (1.5.2)
Using highline (1.6.20)
Using net-ssh (2.8.0)
Using net-scp (1.1.2)
Using net-sftp (2.1.2)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.15.5)
Using tilt (2.0.0)
Using haml (4.0.5)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.14.6)
Using railties (3.0.20) from source at /home/rubys/git/rails
Using rails (3.0.20) from source at /home/rubys/git/rails
Using jquery-rails (0.2.7)
Using mysql (2.9.1)
Using rvm-capistrano (1.5.1)
Using sqlite3 (1.3.8)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
rails generate jquery:install --ui --force
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
      remove  public/javascripts/controls.js
      remove  public/javascripts/dragdrop.js
      remove  public/javascripts/effects.js
      remove  public/javascripts/prototype.js
    fetching  jQuery (1.5)
      create  public/javascripts/jquery.js
      create  public/javascripts/jquery.min.js
    fetching  jQuery UI (latest 1.x release)
      create  public/javascripts/jquery-ui.js
      create  public/javascripts/jquery-ui.min.js
    fetching  jQuery UJS adapter (github HEAD)
       force  public/javascripts/rails.js
edit app/views/line_items/create.js.rjs
page.select("#notice").each { |notice| notice.hide }
 
page.replace_html('cart', render(@cart))
 
page[:cart].visual_effect :blind_down if @cart.total_items == 1
 
page[:current_item].visual_effect :highlight,
                                  :startcolor => "#88ff88",
                                  :endcolor => "#114411"
rm app/views/line_items/create.js.rjs
edit app/views/line_items/create.js.erb
$("#notice").hide();
 
if ($('#cart tr').length == 1) { $('#cart').show('blind', 1000); }
 
$('#cart').html("<%= escape_javascript(render(@cart)) %>");
 
$('#current_item').css({'background-color':'#88ff88'}).
  animate({'background-color':'#114411'}, 1000);
edit app/views/layouts/application.html.erb
<!-- ... -->
  <div id="banner">
    <%= form_tag store_path, :class => 'locale' do %>
      <%= select_tag 'set_locale', 
        options_for_select(LANGUAGES, I18n.locale.to_s),
        :onchange => 'this.form.submit()' %>
      <%= submit_tag 'submit' %>
      <%= javascript_tag "$('.locale input').hide()" %>
    <% end %>
    <%= image_tag("logo.png") %>
    <%= @page_title || t('.title') %>
  </div>
<!-- ... -->
rake test
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/rake-10.1.1/lib/rake/rake_test_loader
Started
.............
Finished in 0.335767 seconds.
 
13 tests, 49 assertions, 0 failures, 0 errors
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/rake-10.1.1/lib/rake/rake_test_loader
Started
.........F...........E.E...............EE.......
Finished in 0.980991 seconds.
 
  1) Failure:
test_should_create_line_item_via_ajax(LineItemsControllerTest) [test/functional/line_items_controller_test.rb:61]:
No RJS statement that replaces or inserts HTML content.
 
  2) Error:
test_should_get_edit(OrdersControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/orders/_form.html.erb:31:in `_app_views_orders__form_html_erb__125323628_70188017863780_1011070'
    app/views/orders/_form.html.erb:2:in `_app_views_orders__form_html_erb__125323628_70188017863780_1011070'
    app/views/orders/edit.html.erb:3:in `_app_views_orders_edit_html_erb__1073232948_70188017872640_0'
    test/functional/orders_controller_test.rb:55:in `test_should_get_edit'
 
  3) Error:
test_should_get_new(OrdersControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/orders/_form.html.erb:31:in `_app_views_orders__form_html_erb__125323628_70188017863780_1011070'
    app/views/orders/_form.html.erb:2:in `_app_views_orders__form_html_erb__125323628_70188017863780_1011070'
    app/views/orders/new.html.erb:6:in `_app_views_orders_new_html_erb__1660539503_70188021149000_0'
    app/controllers/orders_controller.rb:41:in `new'
    test/functional/orders_controller_test.rb:32:in `test_should_get_new'
 
  4) Error:
test_markup_needed_for_store.js.coffee_is_in_place(StoreControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1694401472_70188019698180_0'
    test/functional/store_controller_test.rb:15:in `test_markup_needed_for_store.js.coffee_is_in_place'
 
  5) Error:
test_should_get_index(StoreControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1694401472_70188019698180_0'
    test/functional/store_controller_test.rb:5:in `test_should_get_index'
 
48 tests, 70 assertions, 1 failures, 4 errors
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/rake-10.1.1/lib/rake/rake_test_loader
Started
EEE
Finished in 0.351288 seconds.
 
  1) Error:
test_buying_a_product(DslUserStoriesTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1782830525_70299991919020_0'
    test/integration/dsl_user_stories_test.rb:39:in `test_buying_a_product'
 
  2) Error:
test_two_people_buying(DslUserStoriesTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/orders/_form.html.erb:31:in `_app_views_orders__form_html_erb___67520506_70299994791480_1017150'
    app/views/orders/_form.html.erb:2:in `_app_views_orders__form_html_erb___67520506_70299994791480_1017150'
    app/views/orders/new.html.erb:6:in `_app_views_orders_new_html_erb__818358929_70299994839120_0'
    app/controllers/orders_controller.rb:41:in `new'
    test/integration/dsl_user_stories_test.rb:86:in `checks_out'
    test/integration/dsl_user_stories_test.rb:56:in `test_two_people_buying'
 
  3) Error:
test_buying_a_product(UserStoriesTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1782830525_70299991919020_0'
    test/integration/user_stories_test.rb:19:in `test_buying_a_product'
 
3 tests, 4 assertions, 0 failures, 3 errors
Errors running test:functionals, test:integration!
edit test/functional/line_items_controller_test.rb
  test "should create line_item via ajax" do
    assert_difference('LineItem.count') do
      xhr :post, :create, :product_id => products(:ruby).id
    end 
 
    assert_response :success
    assert_select_jquery :html, '#cart' do
      assert_select 'tr#current_item td', /Programming Ruby 1.9/
    end
  end
rake test
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/rake-10.1.1/lib/rake/rake_test_loader
Started
.............
Finished in 0.327189 seconds.
 
13 tests, 49 assertions, 0 failures, 0 errors
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/rake-10.1.1/lib/rake/rake_test_loader
Started
.....................E.E...............EE.......
Finished in 1.071379 seconds.
 
  1) Error:
test_should_get_edit(OrdersControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/orders/_form.html.erb:31:in `_app_views_orders__form_html_erb___202863866_69974123549220_1011070'
    app/views/orders/_form.html.erb:2:in `_app_views_orders__form_html_erb___202863866_69974123549220_1011070'
    app/views/orders/edit.html.erb:3:in `_app_views_orders_edit_html_erb__1471780264_69974123639560_0'
    test/functional/orders_controller_test.rb:55:in `test_should_get_edit'
 
  2) Error:
test_should_get_new(OrdersControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/orders/_form.html.erb:31:in `_app_views_orders__form_html_erb___202863866_69974123549220_1011070'
    app/views/orders/_form.html.erb:2:in `_app_views_orders__form_html_erb___202863866_69974123549220_1011070'
    app/views/orders/new.html.erb:6:in `_app_views_orders_new_html_erb___1405192752_69974120451840_0'
    app/controllers/orders_controller.rb:41:in `new'
    test/functional/orders_controller_test.rb:32:in `test_should_get_new'
 
  3) Error:
test_markup_needed_for_store.js.coffee_is_in_place(StoreControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml__100713647_69974119170940_0'
    test/functional/store_controller_test.rb:15:in `test_markup_needed_for_store.js.coffee_is_in_place'
 
  4) Error:
test_should_get_index(StoreControllerTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml__100713647_69974119170940_0'
    test/functional/store_controller_test.rb:5:in `test_should_get_index'
 
48 tests, 70 assertions, 0 failures, 4 errors
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Loaded suite /home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/rake-10.1.1/lib/rake/rake_test_loader
Started
EEE
Finished in 0.334399 seconds.
 
  1) Error:
test_buying_a_product(DslUserStoriesTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1025461597_70137725820360_0'
    test/integration/dsl_user_stories_test.rb:39:in `test_buying_a_product'
 
  2) Error:
test_two_people_buying(DslUserStoriesTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/orders/_form.html.erb:31:in `_app_views_orders__form_html_erb__1078723046_70137728658460_1017150'
    app/views/orders/_form.html.erb:2:in `_app_views_orders__form_html_erb__1078723046_70137728658460_1017150'
    app/views/orders/new.html.erb:6:in `_app_views_orders_new_html_erb___1578531536_70137728688380_0'
    app/controllers/orders_controller.rb:41:in `new'
    test/integration/dsl_user_stories_test.rb:86:in `checks_out'
    test/integration/dsl_user_stories_test.rb:56:in `test_two_people_buying'
 
  3) Error:
test_buying_a_product(UserStoriesTest):
ActionView::Template::Error: uninitialized constant I18n::RESERVED_KEYS
    app/views/store/index.html.haml:4:in `_app_views_store_index_html_haml___1025461597_70137725820360_0'
    test/integration/user_stories_test.rb:19:in `test_buying_a_product'
 
3 tests, 4 assertions, 0 failures, 3 errors
Errors running test:functionals, test:integration!
edit config/asset_packages.yml
--- 
stylesheets: 
- base: 
  - depot
  - scaffold
javascripts: 
- base:
  - jquery
  - rails
  - jquery-ui
  - application
rake asset:packager:build_all
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
Created /home/rubys/git/awdwr/edition4/work-187-30/depot/public/stylesheets/base_packaged.css
Created /home/rubys/git/awdwr/edition4/work-187-30/depot/public/javascripts/base_packaged.js
rake db:seed
/home/rubys/.rvm/gems/ruby-1.8.7-p374/gems/haml-4.0.5/lib/haml/parser.rb:86: warning: regexp has invalid interval
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

26.2 HAML 26.1.2 Asset Packager