From 13b4d8c606be20d3975487bf5442eaee698ee479 Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Thu, 24 May 2012 23:13:25 +0800 Subject: [PATCH 1/5] Do not pass the host option to URL helpers for sitemaps. Fixes #415. --- app/views/locomotive/public/sitemaps/show.xml.builder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/locomotive/public/sitemaps/show.xml.builder b/app/views/locomotive/public/sitemaps/show.xml.builder index 03eaecc1..73727da7 100644 --- a/app/views/locomotive/public/sitemaps/show.xml.builder +++ b/app/views/locomotive/public/sitemaps/show.xml.builder @@ -11,14 +11,14 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do if page.templatized? page.content_type.entries.visible.each do |c| xml.url do - xml.loc page_url(page, { :content => c, :host => true }) + xml.loc page_url(page, { :content => c }) xml.lastmod c.updated_at.to_date.to_s('%Y-%m-%d') xml.priority 0.9 end end else xml.url do - xml.loc page_url(page, { :host => true }) + xml.loc page_url(page) xml.lastmod page.updated_at.to_date.to_s('%Y-%m-%d') xml.priority 0.9 end From 4c5d6c92d09c79d5c915273eff6f60141a80e47f Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Fri, 25 May 2012 00:06:07 +0800 Subject: [PATCH 2/5] Added poltergeist and a small JS fix. --- Gemfile | 3 ++- Gemfile.lock | 11 +++++++++++ .../views/current_site/edit_view.js.coffee | 19 ++++++++++--------- features/support/env.rb | 3 ++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index bd8a8896..36ceb703 100755 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,7 @@ group :test do # gem 'growl-glue' gem 'cucumber-rails', :require => false + gem 'poltergeist' gem 'rspec-rails', '~> 2.8.0' gem 'shoulda-matchers' @@ -50,4 +51,4 @@ group :test do gem 'json_spec' gem 'database_cleaner' -end \ No newline at end of file +end diff --git a/Gemfile.lock b/Gemfile.lock index 5087d71e..92747e4d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -147,6 +147,7 @@ GEM rack ejs (1.0.0) erubis (2.7.0) + eventmachine (0.12.10) excon (0.13.4) execjs (1.4.0) multi_json (~> 1.0) @@ -155,6 +156,8 @@ GEM factory_girl_rails (1.6.0) factory_girl (~> 2.5.0) railties (>= 3.0.0) + faye-websocket (0.4.5) + eventmachine (>= 0.12.0) ffi (1.0.11) flash_cookie_session (1.1.3) rails (~> 3.0) @@ -177,6 +180,7 @@ GEM haml (3.1.6) highline (1.6.12) hike (1.2.1) + http_parser.rb (0.5.3) httparty (0.8.3) multi_json (~> 1.0) multi_xml @@ -230,6 +234,12 @@ GEM pickle (0.4.10) cucumber (>= 0.8) rake + poltergeist (0.6.0) + capybara (~> 1.0) + childprocess (~> 0.3) + faye-websocket (~> 0.4, >= 0.4.4) + http_parser.rb (~> 0.5.3) + multi_json (~> 1.0) polyglot (0.3.3) rack (1.4.1) rack-cache (1.2) @@ -336,6 +346,7 @@ DEPENDENCIES locomotive_cms! mocha (= 0.9.12) pickle + poltergeist rspec-cells rspec-rails (~> 2.8.0) sass-rails (~> 3.2.4) diff --git a/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee b/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee index a7b42ee4..a54cc7a6 100644 --- a/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +++ b/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee @@ -57,15 +57,16 @@ class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.Form @$('#site_memberships_input').append(@memberships_view.render().el) enable_liquid_editing: -> - input = @$('#site_robots_txt') - @editor = CodeMirror.fromTextArea input.get()[0], - mode: 'liquid' - autoMatchParens: false - lineNumbers: false - passDelay: 50 - tabMode: 'shift' - theme: 'default' - onChange: (editor) => @model.set(robots_txt: editor.getValue()) + if($('#site_robots_txt').length) + input = @$('#site_robots_txt') + @editor = CodeMirror.fromTextArea input.get()[0], + mode: 'liquid' + autoMatchParens: false + lineNumbers: false + passDelay: 50 + tabMode: 'shift' + theme: 'default' + onChange: (editor) => @model.set(robots_txt: editor.getValue()) save: (event) -> if @model.includes_domain(window.location.host) diff --git a/features/support/env.rb b/features/support/env.rb index 6439baa0..1aaefea0 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -18,6 +18,7 @@ require 'capybara' require 'capybara/rails' require 'capybara/cucumber' require 'capybara/session' +require 'capybara/poltergeist' require 'json_spec/cucumber' @@ -44,7 +45,7 @@ end Capybara.default_wait_time = 5 -# Capybara.javascript_driver = :rack_test +Capybara.javascript_driver = :poltergeist # Stop endless errors like # ~/.rvm/gems/ruby-1.9.2-p0@global/gems/rack-1.2.1/lib/rack/utils.rb:16: From 3a27845fe50dcaa9526f4994212d89f9d5311e7b Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Fri, 25 May 2012 00:13:55 +0800 Subject: [PATCH 3/5] Small fix for poltergeist. --- features/step_definitions/page_steps.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/page_steps.rb b/features/step_definitions/page_steps.rb index f6c8c606..fb9d1773 100644 --- a/features/step_definitions/page_steps.rb +++ b/features/step_definitions/page_steps.rb @@ -43,8 +43,8 @@ end # try to render a page by slug When /^I view the rendered page at "([^"]*)"$/ do |path| - # If we're running selenium then we need to use a different port - if Capybara.current_driver == :selenium + # If we're running poltergeist then we need to use a different port + if Capybara.current_driver == :poltergeist visit "http://#{@site.domains.first}:#{Capybara.server_port}#{path}" else visit "http://#{@site.domains.first}#{path}" From 38098e93dab45141eb9560f077346cea6e8a9adb Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Fri, 25 May 2012 00:16:25 +0800 Subject: [PATCH 4/5] Updated the doco to instruct users to install PhantomJS for testing. --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index f65cc18d..57878bb0 100644 --- a/README.textile +++ b/README.textile @@ -55,7 +55,7 @@ Locomotive CMS is an open source project, we encourage contributions. If you hav * Install ruby and mongoDB * Clone the project git clone git@github.com:locomotivecms/engine.git * Setup a virtual host entry for test.example.com to point to localhost -* Run the tests rake +* Run the tests rake (you'll need to install PhantomJS for javascript testing see https://github.com/jonleighton/poltergeist) * Write your failing tests * Make the tests pass * "Create a GitHub pull request":http://help.github.com/send-pull-requests From 8be23f1cc21e28f9a636d9946938f434bc680cfc Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Fri, 25 May 2012 00:23:13 +0800 Subject: [PATCH 5/5] Updated the readme a tad with PhantomJS info. --- README.textile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 57878bb0..2f40cb7b 100644 --- a/README.textile +++ b/README.textile @@ -55,7 +55,8 @@ Locomotive CMS is an open source project, we encourage contributions. If you hav * Install ruby and mongoDB * Clone the project git clone git@github.com:locomotivecms/engine.git * Setup a virtual host entry for test.example.com to point to localhost -* Run the tests rake (you'll need to install PhantomJS for javascript testing see https://github.com/jonleighton/poltergeist) +* Install PhantomJS (Required for the cucumber suite See: https://github.com/jonleighton/poltergeist) +* Run the tests rake * Write your failing tests * Make the tests pass * "Create a GitHub pull request":http://help.github.com/send-pull-requests