Created
April 10, 2013 10:01
-
-
Save tjormola/5353352 to your computer and use it in GitHub Desktop.
Sample output of the test-relative-url-root-with-static-content.sh script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(12:57:55)(tj@ganga)(~)$ ./test-relative-url-root-with-static-content.sh | |
# Display system info | |
lsb_release -a | |
+ lsb_release -a | |
No LSB modules are available. | |
Distributor ID: Ubuntu | |
Description: Ubuntu 12.04.2 LTS | |
Release: 12.04 | |
Codename: precise | |
uname -a | |
+ uname -a | |
Linux ganga 3.2.0-38-generic #61-Ubuntu SMP Tue Feb 19 12:18:21 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux | |
ruby -v | |
+ ruby -v | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] | |
gem -v | |
+ gem -v | |
1.8.11 | |
# Reset and setup Rails | |
rm -rf $RAILS_BASE | |
+ rm -rf /tmp/rails | |
mkdir -p $RAILS_BASE/gem | |
+ mkdir -p /tmp/rails/gem | |
export GEM_HOME=$RAILS_BASE/gem | |
+ export GEM_HOME=/tmp/rails/gem | |
+ GEM_HOME=/tmp/rails/gem | |
export PATH=$GEM_HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin | |
+ export PATH=/tmp/rails/gem/bin:/bin:/sbin:/usr/bin:/usr/sbin | |
+ PATH=/tmp/rails/gem/bin:/bin:/sbin:/usr/bin:/usr/sbin | |
gem install rails --no-ri --no-rdoc | |
+ gem install rails --no-ri --no-rdoc | |
Fetching: i18n-0.6.1.gem (100%) | |
Fetching: multi_json-1.7.2.gem (100%) | |
Fetching: activesupport-3.2.13.gem (100%) | |
Fetching: builder-3.0.4.gem (100%) | |
Fetching: activemodel-3.2.13.gem (100%) | |
Fetching: rack-1.4.5.gem (100%) | |
Fetching: rack-cache-1.2.gem (100%) | |
Fetching: rack-test-0.6.2.gem (100%) | |
Fetching: journey-1.0.4.gem (100%) | |
Fetching: hike-1.2.2.gem (100%) | |
Fetching: tilt-1.3.7.gem (100%) | |
Fetching: sprockets-2.2.2.gem (100%) | |
Fetching: erubis-2.7.0.gem (100%) | |
Fetching: actionpack-3.2.13.gem (100%) | |
Fetching: arel-3.0.2.gem (100%) | |
Fetching: tzinfo-0.3.37.gem (100%) | |
Fetching: activerecord-3.2.13.gem (100%) | |
Fetching: activeresource-3.2.13.gem (100%) | |
Fetching: mime-types-1.22.gem (100%) | |
Fetching: polyglot-0.3.3.gem (100%) | |
Fetching: treetop-1.4.12.gem (100%) | |
Fetching: mail-2.5.3.gem (100%) | |
Fetching: actionmailer-3.2.13.gem (100%) | |
Fetching: rake-10.0.4.gem (100%) | |
Fetching: rack-ssl-1.3.3.gem (100%) | |
Fetching: thor-0.18.1.gem (100%) | |
Fetching: json-1.7.7.gem (100%) | |
Building native extensions. This could take a while... | |
Fetching: rdoc-3.12.2.gem (100%) | |
Depending on your version of ruby, you may need to install ruby rdoc/ri data: | |
<= 1.8.6 : unsupported | |
= 1.8.7 : gem install rdoc-data; rdoc-data --install | |
= 1.9.1 : gem install rdoc-data; rdoc-data --install | |
>= 1.9.2 : nothing to do! Yay! | |
Fetching: railties-3.2.13.gem (100%) | |
Fetching: bundler-1.3.5.gem (100%) | |
Fetching: rails-3.2.13.gem (100%) | |
Successfully installed i18n-0.6.1 | |
Successfully installed multi_json-1.7.2 | |
Successfully installed activesupport-3.2.13 | |
Successfully installed builder-3.0.4 | |
Successfully installed activemodel-3.2.13 | |
Successfully installed rack-1.4.5 | |
Successfully installed rack-cache-1.2 | |
Successfully installed rack-test-0.6.2 | |
Successfully installed journey-1.0.4 | |
Successfully installed hike-1.2.2 | |
Successfully installed tilt-1.3.7 | |
Successfully installed sprockets-2.2.2 | |
Successfully installed erubis-2.7.0 | |
Successfully installed actionpack-3.2.13 | |
Successfully installed arel-3.0.2 | |
Successfully installed tzinfo-0.3.37 | |
Successfully installed activerecord-3.2.13 | |
Successfully installed activeresource-3.2.13 | |
Successfully installed mime-types-1.22 | |
Successfully installed polyglot-0.3.3 | |
Successfully installed treetop-1.4.12 | |
Successfully installed mail-2.5.3 | |
Successfully installed actionmailer-3.2.13 | |
Successfully installed rake-10.0.4 | |
Successfully installed rack-ssl-1.3.3 | |
Successfully installed thor-0.18.1 | |
Successfully installed json-1.7.7 | |
Successfully installed rdoc-3.12.2 | |
Successfully installed railties-3.2.13 | |
Successfully installed bundler-1.3.5 | |
Successfully installed rails-3.2.13 | |
31 gems installed | |
cd $RAILS_BASE | |
+ cd /tmp/rails | |
rails new $APP_NAME | |
+ rails new foo | |
create | |
create README.rdoc | |
create Rakefile | |
create config.ru | |
create .gitignore | |
create Gemfile | |
create app | |
create app/assets/images/rails.png | |
create app/assets/javascripts/application.js | |
create app/assets/stylesheets/application.css | |
create app/controllers/application_controller.rb | |
create app/helpers/application_helper.rb | |
create app/views/layouts/application.html.erb | |
create app/mailers/.gitkeep | |
create app/models/.gitkeep | |
create config | |
create config/routes.rb | |
create config/application.rb | |
create config/environment.rb | |
create config/environments | |
create config/environments/development.rb | |
create config/environments/production.rb | |
create config/environments/test.rb | |
create config/initializers | |
create config/initializers/backtrace_silencers.rb | |
create config/initializers/inflections.rb | |
create config/initializers/mime_types.rb | |
create config/initializers/secret_token.rb | |
create config/initializers/session_store.rb | |
create config/initializers/wrap_parameters.rb | |
create config/locales | |
create config/locales/en.yml | |
create config/boot.rb | |
create config/database.yml | |
create db | |
create db/seeds.rb | |
create doc | |
create doc/README_FOR_APP | |
create lib | |
create lib/tasks | |
create lib/tasks/.gitkeep | |
create lib/assets | |
create lib/assets/.gitkeep | |
create log | |
create log/.gitkeep | |
create public | |
create public/404.html | |
create public/422.html | |
create public/500.html | |
create public/favicon.ico | |
create public/index.html | |
create public/robots.txt | |
create script | |
create script/rails | |
create test/fixtures | |
create test/fixtures/.gitkeep | |
create test/functional | |
create test/functional/.gitkeep | |
create test/integration | |
create test/integration/.gitkeep | |
create test/unit | |
create test/unit/.gitkeep | |
create test/performance/browsing_test.rb | |
create test/test_helper.rb | |
create tmp/cache | |
create tmp/cache/assets | |
create vendor/assets/javascripts | |
create vendor/assets/javascripts/.gitkeep | |
create vendor/assets/stylesheets | |
create vendor/assets/stylesheets/.gitkeep | |
create vendor/plugins | |
create vendor/plugins/.gitkeep | |
run bundle install | |
Fetching gem metadata from https://rubygems.org/........... | |
Fetching gem metadata from https://rubygems.org/.. | |
Resolving dependencies... | |
Using rake (10.0.4) | |
Using i18n (0.6.1) | |
Using multi_json (1.7.2) | |
Using activesupport (3.2.13) | |
Using builder (3.0.4) | |
Using activemodel (3.2.13) | |
Using erubis (2.7.0) | |
Using journey (1.0.4) | |
Using rack (1.4.5) | |
Using rack-cache (1.2) | |
Using rack-test (0.6.2) | |
Using hike (1.2.2) | |
Using tilt (1.3.7) | |
Using sprockets (2.2.2) | |
Using actionpack (3.2.13) | |
Using mime-types (1.22) | |
Using polyglot (0.3.3) | |
Using treetop (1.4.12) | |
Using mail (2.5.3) | |
Using actionmailer (3.2.13) | |
Using arel (3.0.2) | |
Using tzinfo (0.3.37) | |
Using activerecord (3.2.13) | |
Using activeresource (3.2.13) | |
Using bundler (1.3.5) | |
Installing coffee-script-source (1.6.2) | |
Installing execjs (1.4.0) | |
Installing coffee-script (2.2.0) | |
Using rack-ssl (1.3.3) | |
Using json (1.7.7) | |
Using rdoc (3.12.2) | |
Using thor (0.18.1) | |
Using railties (3.2.13) | |
Installing coffee-rails (3.2.2) | |
Installing jquery-rails (2.2.1) | |
Using rails (3.2.13) | |
Installing sass (3.2.7) | |
Installing sass-rails (3.2.6) | |
Installing sqlite3 (1.3.7) | |
Installing uglifier (2.0.1) | |
Your bundle is complete! | |
Use `bundle show [gemname]` to see where a bundled gem is installed. | |
cd $APP_NAME | |
+ cd foo | |
# Configure relative URL root support in Rails routing | |
head -n1 config/routes.rb > config/routes.rb.new | |
+ head -n1 config/routes.rb | |
echo "scope (Rails.application.config.relative_url_root || '/') do" >> config/routes.rb.new | |
+ echo 'scope (Rails.application.config.relative_url_root || '\''/'\'') do' | |
tail -n+2 config/routes.rb >> config/routes.rb.new | |
+ tail -n+2 config/routes.rb | |
echo "end" >> config/routes.rb.new | |
+ echo end | |
mv config/routes.rb.new config/routes.rb | |
+ mv config/routes.rb.new config/routes.rb | |
# Development mode, no root URL -> works ok | |
RAILS_ENV=development rails server -d | |
+ RAILS_ENV=development | |
+ rails server -d | |
=> Booting WEBrick | |
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000 | |
sleep $WAIT_TIME | |
+ sleep 2 | |
wget http://127.0.0.1:3000 -O /dev/stdout | grep '<title>' | |
+ wget http://127.0.0.1:3000 -O /dev/stdout | |
+ grep '<title>' | |
--2013-04-10 12:59:02-- http://127.0.0.1:3000/ | |
Connecting to 127.0.0.1:3000... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 5906 (5,8K) [text/html] | |
Saving to: `/dev/stdout' | |
<title>Ruby on Rails: Welcome aboard</title> ] 0 --.-K/s | |
100%[================================================>] 5 906 --.-K/s in 0s | |
2013-04-10 12:59:02 (446 MB/s) - `/dev/stdout' saved [5906/5906] | |
kill -9 `cat tmp/pids/server.pid` | |
cat tmp/pids/server.pid | |
++ cat tmp/pids/server.pid | |
+ kill -9 6245 | |
# Production mode, no root URL -> returns 404 because static files not served in production mode | |
RAILS_ENV=production rails server -d | |
+ RAILS_ENV=production | |
+ rails server -d | |
=> Booting WEBrick | |
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000 | |
sleep $WAIT_TIME | |
+ sleep 2 | |
wget http://127.0.0.1:3000 -O /dev/stdout | grep '<title>' || true | |
+ wget http://127.0.0.1:3000 -O /dev/stdout | |
+ grep '<title>' | |
--2013-04-10 12:59:05-- http://127.0.0.1:3000/ | |
Connecting to 127.0.0.1:3000... connected. | |
HTTP request sent, awaiting response... 404 Not Found | |
2013-04-10 12:59:06 ERROR 404: Not Found. | |
+ true | |
kill -9 `cat tmp/pids/server.pid` | |
cat tmp/pids/server.pid | |
++ cat tmp/pids/server.pid | |
+ kill -9 6280 | |
# Development mode, root URL set -> doesn't work, returns 404 even though should return the content of public/index.html | |
RAILS_ENV=development RAILS_RELATIVE_URL_ROOT=/$APP_NAME rails server -d | |
+ RAILS_ENV=development | |
+ RAILS_RELATIVE_URL_ROOT=/foo | |
+ rails server -d | |
=> Booting WEBrick | |
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000 | |
sleep $WAIT_TIME | |
+ sleep 2 | |
wget http://127.0.0.1:3000/$APP_NAME/ -O /dev/stdout | grep '<title>' || true | |
+ wget http://127.0.0.1:3000/foo/ -O /dev/stdout | |
+ grep '<title>' | |
--2013-04-10 12:59:09-- http://127.0.0.1:3000/foo/ | |
Connecting to 127.0.0.1:3000... connected. | |
HTTP request sent, awaiting response... 404 Not Found | |
2013-04-10 12:59:10 ERROR 404: Not Found. | |
+ true | |
kill -9 `cat tmp/pids/server.pid` | |
cat tmp/pids/server.pid | |
++ cat tmp/pids/server.pid | |
+ kill -9 6314 | |
# Production mode, root URL set -> returns 404 because static files not served in production mode | |
RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/$APP_NAME rails server -d | |
+ RAILS_ENV=production | |
+ RAILS_RELATIVE_URL_ROOT=/foo | |
+ rails server -d | |
=> Booting WEBrick | |
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000 | |
sleep $WAIT_TIME | |
+ sleep 2 | |
wget http://127.0.0.1:3000/$APP_NAME/ -O /dev/stdout | grep '<title>' || true | |
+ wget http://127.0.0.1:3000/foo/ -O /dev/stdout | |
+ grep '<title>' | |
--2013-04-10 12:59:13-- http://127.0.0.1:3000/foo/ | |
Connecting to 127.0.0.1:3000... connected. | |
HTTP request sent, awaiting response... 404 Not Found | |
2013-04-10 12:59:14 ERROR 404: Not Found. | |
+ true | |
kill -9 `cat tmp/pids/server.pid` | |
cat tmp/pids/server.pid | |
++ cat tmp/pids/server.pid | |
+ kill -9 6348 | |
(12:59:14)(tj@ganga)(~)$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment