win_gui 0.1.0

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.
Files changed (164) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +43 -0
  5. data/Rakefile +58 -0
  6. data/VERSION +1 -0
  7. data/book_code/early_success/bundle.rb +34 -0
  8. data/book_code/early_success/english.txt +1 -0
  9. data/book_code/early_success/jruby_basics.rb +47 -0
  10. data/book_code/early_success/windows_basics.rb +97 -0
  11. data/book_code/guessing/locknote.rb +379 -0
  12. data/book_code/guessing/monkeyshines.rb +14 -0
  13. data/book_code/guessing/note.rb +120 -0
  14. data/book_code/guessing/note_spec.rb +175 -0
  15. data/book_code/guessing/replay.rb +21 -0
  16. data/book_code/guessing/seed.rb +9 -0
  17. data/book_code/guessing/spec_helper.rb +69 -0
  18. data/book_code/guessing/windows_gui.rb +247 -0
  19. data/book_code/home_stretch/junquenote.rb +151 -0
  20. data/book_code/home_stretch/locknote.rb +180 -0
  21. data/book_code/home_stretch/note.rb +144 -0
  22. data/book_code/home_stretch/note_spec.rb +191 -0
  23. data/book_code/home_stretch/spec_helper.rb +55 -0
  24. data/book_code/home_stretch/swing_gui.rb +50 -0
  25. data/book_code/home_stretch/windows_gui.rb +232 -0
  26. data/book_code/junquenote/exports.sh +10 -0
  27. data/book_code/junquenote/jruby_mac.sh +10 -0
  28. data/book_code/junquenote/junquenote_app.rb +262 -0
  29. data/book_code/novite/Rakefile +10 -0
  30. data/book_code/novite/app/controllers/application.rb +18 -0
  31. data/book_code/novite/app/controllers/guests_controller.rb +28 -0
  32. data/book_code/novite/app/controllers/parties_controller.rb +77 -0
  33. data/book_code/novite/app/helpers/application_helper.rb +11 -0
  34. data/book_code/novite/app/helpers/guests_helper.rb +10 -0
  35. data/book_code/novite/app/helpers/parties_helper.rb +10 -0
  36. data/book_code/novite/app/models/guest.rb +11 -0
  37. data/book_code/novite/app/models/party.rb +32 -0
  38. data/book_code/novite/app/models/party_mailer.rb +19 -0
  39. data/book_code/novite/app/views/layouts/application.rhtml +44 -0
  40. data/book_code/novite/app/views/parties/new.html.erb +42 -0
  41. data/book_code/novite/app/views/parties/show.html.erb +43 -0
  42. data/book_code/novite/app/views/party_mailer/invite.erb +17 -0
  43. data/book_code/novite/config/boot.rb +117 -0
  44. data/book_code/novite/config/database.yml +19 -0
  45. data/book_code/novite/config/environment.rb +67 -0
  46. data/book_code/novite/config/environments/development.rb +29 -0
  47. data/book_code/novite/config/environments/production.rb +27 -0
  48. data/book_code/novite/config/environments/test.rb +30 -0
  49. data/book_code/novite/config/initializers/inflections.rb +18 -0
  50. data/book_code/novite/config/initializers/mime_types.rb +13 -0
  51. data/book_code/novite/config/routes.rb +47 -0
  52. data/book_code/novite/db/migrate/001_create_parties.rb +26 -0
  53. data/book_code/novite/db/migrate/002_create_guests.rb +23 -0
  54. data/book_code/novite/db/schema.rb +41 -0
  55. data/book_code/novite/log/empty.txt +0 -0
  56. data/book_code/novite/public/.htaccess +40 -0
  57. data/book_code/novite/public/404.html +38 -0
  58. data/book_code/novite/public/422.html +38 -0
  59. data/book_code/novite/public/500.html +38 -0
  60. data/book_code/novite/public/dispatch.cgi +10 -0
  61. data/book_code/novite/public/dispatch.fcgi +24 -0
  62. data/book_code/novite/public/dispatch.rb +18 -0
  63. data/book_code/novite/public/favicon.ico +0 -0
  64. data/book_code/novite/public/images/rails.png +0 -0
  65. data/book_code/novite/public/index.html +285 -0
  66. data/book_code/novite/public/javascripts/application.js +10 -0
  67. data/book_code/novite/public/javascripts/controls.js +971 -0
  68. data/book_code/novite/public/javascripts/dragdrop.js +980 -0
  69. data/book_code/novite/public/javascripts/effects.js +1128 -0
  70. data/book_code/novite/public/javascripts/prototype.js +4233 -0
  71. data/book_code/novite/public/robots.txt +5 -0
  72. data/book_code/novite/script/about +3 -0
  73. data/book_code/novite/script/console +3 -0
  74. data/book_code/novite/script/destroy +3 -0
  75. data/book_code/novite/script/generate +3 -0
  76. data/book_code/novite/script/performance/benchmarker +3 -0
  77. data/book_code/novite/script/performance/profiler +3 -0
  78. data/book_code/novite/script/performance/request +3 -0
  79. data/book_code/novite/script/plugin +3 -0
  80. data/book_code/novite/script/process/inspector +3 -0
  81. data/book_code/novite/script/process/reaper +3 -0
  82. data/book_code/novite/script/process/spawner +3 -0
  83. data/book_code/novite/script/runner +3 -0
  84. data/book_code/novite/script/server +3 -0
  85. data/book_code/novite/test/test_helper.rb +46 -0
  86. data/book_code/one_more_thing/applescript.rb +68 -0
  87. data/book_code/one_more_thing/note_spec.rb +50 -0
  88. data/book_code/one_more_thing/spec_helper.rb +17 -0
  89. data/book_code/one_more_thing/textedit-pure.rb +28 -0
  90. data/book_code/one_more_thing/textedit.applescript +26 -0
  91. data/book_code/one_more_thing/textedit.rb +32 -0
  92. data/book_code/one_more_thing/textnote.rb +87 -0
  93. data/book_code/simplify/junquenote.rb +48 -0
  94. data/book_code/simplify/locknote.rb +46 -0
  95. data/book_code/simplify/note.rb +35 -0
  96. data/book_code/simplify/note_spec.rb +28 -0
  97. data/book_code/simplify/swing_gui.rb +45 -0
  98. data/book_code/simplify/windows_gui.rb +232 -0
  99. data/book_code/simplify/windows_gui_spec.rb +35 -0
  100. data/book_code/story/invite.story +19 -0
  101. data/book_code/story/journal.txt +29 -0
  102. data/book_code/story/novite_stories.rb +156 -0
  103. data/book_code/story/party.rb +149 -0
  104. data/book_code/story/password.rb +61 -0
  105. data/book_code/story/password.story +26 -0
  106. data/book_code/story/rsvp.story +29 -0
  107. data/book_code/tables/TestTime.html +93 -0
  108. data/book_code/tables/TestTimeSample.html +63 -0
  109. data/book_code/tables/calculate_time.rb +39 -0
  110. data/book_code/tables/calculator.rb +108 -0
  111. data/book_code/tables/calculator_actions.rb +27 -0
  112. data/book_code/tables/calculator_spec.rb +47 -0
  113. data/book_code/tables/fit.rb +32 -0
  114. data/book_code/tables/matrix.rb +109 -0
  115. data/book_code/tables/pseudocode.rb +17 -0
  116. data/book_code/tubes/book_selenium.rb +67 -0
  117. data/book_code/tubes/book_watir.rb +60 -0
  118. data/book_code/tubes/dragdrop.html +81 -0
  119. data/book_code/tubes/html_capture.rb +33 -0
  120. data/book_code/tubes/joke_list.rb +67 -0
  121. data/book_code/tubes/list_spec.rb +41 -0
  122. data/book_code/tubes/search_spec.rb +32 -0
  123. data/book_code/tubes/selenium_example.rb +66 -0
  124. data/book_code/tubes/selenium_link.rb +23 -0
  125. data/book_code/tubes/web_server.rb +14 -0
  126. data/book_code/windows/wgui.rb +29 -0
  127. data/book_code/windows/wobj.rb +25 -0
  128. data/book_code/windows/wsh.rb +25 -0
  129. data/book_code/with_rspec/empty_spec.rb +13 -0
  130. data/book_code/with_rspec/junquenote.rb +60 -0
  131. data/book_code/with_rspec/locknote.rb +129 -0
  132. data/book_code/with_rspec/note_spec.rb +32 -0
  133. data/book_code/with_rspec/should_examples.rb +18 -0
  134. data/exp/exp.rb +6 -0
  135. data/exp/exp_encodings.rb +40 -0
  136. data/exp/exp_enum_windows.rb +60 -0
  137. data/exp/exp_quik.rb +38 -0
  138. data/exp/exp_wsh.rb +115 -0
  139. data/exp/old/windows_basics.rb +80 -0
  140. data/exp/old/wnote.rb +80 -0
  141. data/exp/old/wnote_spec.rb +20 -0
  142. data/features/step_definitions/win_gui_steps.rb +0 -0
  143. data/features/support/env.rb +4 -0
  144. data/features/win_gui.feature +9 -0
  145. data/lib/note/java/jemmy.jar +0 -0
  146. data/lib/note/java/jnote.rb +48 -0
  147. data/lib/note/java/jruby_basics.rb +37 -0
  148. data/lib/note/java/junquenote_app.rb +262 -0
  149. data/lib/note/java/note_spec.rb +20 -0
  150. data/lib/note/win/locknote.rb +19 -0
  151. data/lib/note.rb +15 -0
  152. data/lib/win_gui/constants.rb +66 -0
  153. data/lib/win_gui/string_extensions.rb +24 -0
  154. data/lib/win_gui/win_gui.rb +274 -0
  155. data/lib/win_gui/window.rb +70 -0
  156. data/lib/win_gui.rb +3 -0
  157. data/spec/note/win/locknote_spec.rb +7 -0
  158. data/spec/spec.opts +2 -0
  159. data/spec/spec_helper.rb +100 -0
  160. data/spec/test_apps/locknote/LockNote.exe +0 -0
  161. data/spec/win_gui/string_extensions_spec.rb +61 -0
  162. data/spec/win_gui/win_gui_spec.rb +733 -0
  163. data/spec/win_gui/window_spec.rb +124 -0
  164. metadata +251 -0
@@ -0,0 +1,117 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Don't change this file!
10
+ # Configure your app in config/environment.rb and config/environments/*.rb
11
+
12
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
13
+
14
+ module Rails
15
+ class << self
16
+ def boot!
17
+ unless booted?
18
+ preinitialize
19
+ pick_boot.run
20
+ end
21
+ end
22
+
23
+ def booted?
24
+ defined? Rails::Initializer
25
+ end
26
+
27
+ def pick_boot
28
+ (vendor_rails? ? VendorBoot : GemBoot).new
29
+ end
30
+
31
+ def vendor_rails?
32
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
33
+ end
34
+
35
+ # FIXME : Ruby 1.9
36
+ def preinitialize
37
+ load(preinitializer_path) if File.exists?(preinitializer_path)
38
+ end
39
+
40
+ def preinitializer_path
41
+ "#{RAILS_ROOT}/config/preinitializer.rb"
42
+ end
43
+ end
44
+
45
+ class Boot
46
+ def run
47
+ load_initializer
48
+ Rails::Initializer.run(:set_load_path)
49
+ end
50
+ end
51
+
52
+ class VendorBoot < Boot
53
+ def load_initializer
54
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
55
+ end
56
+ end
57
+
58
+ class GemBoot < Boot
59
+ def load_initializer
60
+ self.class.load_rubygems
61
+ load_rails_gem
62
+ require 'initializer'
63
+ end
64
+
65
+ def load_rails_gem
66
+ if version = self.class.gem_version
67
+ gem 'rails', version
68
+ else
69
+ gem 'rails'
70
+ end
71
+ rescue Gem::LoadError => load_error
72
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
73
+ exit 1
74
+ end
75
+
76
+ class << self
77
+ def rubygems_version
78
+ Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
79
+ end
80
+
81
+ def gem_version
82
+ if defined? RAILS_GEM_VERSION
83
+ RAILS_GEM_VERSION
84
+ elsif ENV.include?('RAILS_GEM_VERSION')
85
+ ENV['RAILS_GEM_VERSION']
86
+ else
87
+ parse_gem_version(read_environment_rb)
88
+ end
89
+ end
90
+
91
+ def load_rubygems
92
+ require 'rubygems'
93
+
94
+ unless rubygems_version >= '0.9.4'
95
+ $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
96
+ exit 1
97
+ end
98
+
99
+ rescue LoadError
100
+ $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
101
+ exit 1
102
+ end
103
+
104
+ def parse_gem_version(text)
105
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
106
+ end
107
+
108
+ private
109
+ def read_environment_rb
110
+ File.read("#{RAILS_ROOT}/config/environment.rb")
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ # All that for this:
117
+ Rails.boot!
@@ -0,0 +1,19 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ timeout: 5000
7
+
8
+ # Warning: The database defined as 'test' will be erased and
9
+ # re-generated from your development database when you run 'rake'.
10
+ # Do not set this db to the same as development or production.
11
+ test:
12
+ adapter: sqlite3
13
+ database: db/test.sqlite3
14
+ timeout: 5000
15
+
16
+ production:
17
+ adapter: sqlite3
18
+ database: db/production.sqlite3
19
+ timeout: 5000
@@ -0,0 +1,67 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Be sure to restart your server when you modify this file
10
+
11
+ # Uncomment below to force Rails into production mode when
12
+ # you don't control web/app server and can't set it the proper way
13
+ # ENV['RAILS_ENV'] ||= 'production'
14
+
15
+ # Specifies gem version of Rails to use when vendor/rails is not present
16
+ RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION
17
+
18
+ # Bootstrap the Rails environment, frameworks, and default configuration
19
+ require File.join(File.dirname(__FILE__), 'boot')
20
+
21
+ Rails::Initializer.run do |config|
22
+ # Settings in config/environments/* take precedence over those specified here.
23
+ # Application configuration should go into files in config/initializers
24
+ # -- all .rb files in that directory are automatically loaded.
25
+ # See Rails::Configuration for more options.
26
+
27
+ # Skip frameworks you're not going to use (only works if using vendor/rails).
28
+ # To use Rails without a database, you must remove the Active Record framework
29
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
30
+
31
+ # Only load the plugins named here, in the order given. By default, all plugins
32
+ # in vendor/plugins are loaded in alphabetical order.
33
+ # :all can be used as a placeholder for all plugins not explicitly named
34
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
35
+
36
+ # Add additional load paths for your own custom dirs
37
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
38
+
39
+ # Force all environments to use the same logger level
40
+ # (by default production uses :info, the others :debug)
41
+ # config.log_level = :debug
42
+
43
+ # Your secret key for verifying cookie session data integrity.
44
+ # If you change this key, all old sessions will become invalid!
45
+ # Make sure the secret is at least 30 characters and all random,
46
+ # no regular words or you'll be exposed to dictionary attacks.
47
+ config.action_controller.session = {
48
+ :session_key => '_novite_session',
49
+ :secret => 'f8bbdc086b1ec51e8fe5f508481132ac14b2c17d46be77b7744957dc356fab9a454a8f3d874dd022ae5c4b50486549768bd80b97f398e0f07c342f114c2eba09'
50
+ }
51
+
52
+ # Use the database for sessions instead of the cookie-based default,
53
+ # which shouldn't be used to store highly confidential information
54
+ # (create the session table with 'rake db:sessions:create')
55
+ # config.action_controller.session_store = :active_record_store
56
+
57
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
58
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
59
+ # like if you have constraints or database-specific column types
60
+ # config.active_record.schema_format = :sql
61
+
62
+ # Activate observers that should always be running
63
+ # config.active_record.observers = :cacher, :garbage_collector
64
+
65
+ # Make Active Record use UTC-base instead of local time
66
+ # config.active_record.default_timezone = :utc
67
+ end
@@ -0,0 +1,29 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Settings specified here will take precedence over those in config/environment.rb
10
+
11
+ # In the development environment your application's code is reloaded on
12
+ # every request. This slows down response time but is perfect for development
13
+ # since you don't have to restart the webserver when you make code changes.
14
+ config.cache_classes = false
15
+
16
+ # Log error messages when you accidentally call methods on nil.
17
+ config.whiny_nils = true
18
+
19
+ # Show full error reports and disable caching
20
+ config.action_controller.consider_all_requests_local = true
21
+ config.action_view.debug_rjs = true
22
+ config.action_controller.perform_caching = false
23
+ config.action_view.cache_template_extensions = false
24
+
25
+ # Don't care if the mailer can't send
26
+ config.action_mailer.raise_delivery_errors = false
27
+
28
+ # Just pretend to send mail
29
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,27 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Settings specified here will take precedence over those in config/environment.rb
10
+
11
+ # The production environment is meant for finished, "live" apps.
12
+ # Code is not reloaded between requests
13
+ config.cache_classes = true
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Full error reports are disabled and caching is turned on
19
+ config.action_controller.consider_all_requests_local = false
20
+ config.action_controller.perform_caching = true
21
+ config.action_view.cache_template_loading = true
22
+
23
+ # Enable serving of images, stylesheets, and javascripts from an asset server
24
+ # config.action_controller.asset_host = "http://assets.example.com"
25
+
26
+ # Disable delivery errors, bad email addresses will be ignored
27
+ # config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,30 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Settings specified here will take precedence over those in config/environment.rb
10
+
11
+ # The test environment is used exclusively to run your application's
12
+ # test suite. You never need to work with it otherwise. Remember that
13
+ # your test database is "scratch space" for the test suite and is wiped
14
+ # and recreated between test runs. Don't rely on the data there!
15
+ config.cache_classes = true
16
+
17
+ # Log error messages when you accidentally call methods on nil.
18
+ config.whiny_nils = true
19
+
20
+ # Show full error reports and disable caching
21
+ config.action_controller.consider_all_requests_local = true
22
+ config.action_controller.perform_caching = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell ActionMailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,18 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Be sure to restart your server when you modify this file.
10
+
11
+ # Add new inflection rules using the following format
12
+ # (all these examples are active by default):
13
+ # Inflector.inflections do |inflect|
14
+ # inflect.plural /^(ox)$/i, '\1en'
15
+ # inflect.singular /^(ox)en/i, '\1'
16
+ # inflect.irregular 'person', 'people'
17
+ # inflect.uncountable %w( fish sheep )
18
+ # end
@@ -0,0 +1,13 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # Be sure to restart your server when you modify this file.
10
+
11
+ # Add new mime types for use in respond_to blocks:
12
+ # Mime::Type.register "text/richtext", :rtf
13
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,47 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ ActionController::Routing::Routes.draw do |map|
10
+ map.resources :guests
11
+
12
+ map.resources :parties
13
+
14
+ # The priority is based upon order of creation: first created -> highest priority.
15
+
16
+ # Sample of regular route:
17
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
18
+ # Keep in mind you can assign values other than :controller and :action
19
+
20
+ # Sample of named route:
21
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
22
+ # This route can be invoked with purchase_url(:id => product.id)
23
+
24
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
25
+ # map.resources :products
26
+
27
+ # Sample resource route with options:
28
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
29
+
30
+ # Sample resource route with sub-resources:
31
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
32
+
33
+ # Sample resource route within a namespace:
34
+ # map.namespace :admin do |admin|
35
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
36
+ # admin.resources :products
37
+ # end
38
+
39
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
40
+ # map.root :controller => "welcome"
41
+
42
+ # See how all your routes lay out with "rake routes"
43
+
44
+ # Install the default routes as the lowest priority.
45
+ map.connect ':controller/:action/:id'
46
+ map.connect ':controller/:action/:id.:format'
47
+ end
@@ -0,0 +1,26 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ class CreateParties < ActiveRecord::Migration
10
+ def self.up
11
+ create_table :parties do |t|
12
+ t.string :name
13
+ t.text :description
14
+ t.text :location
15
+ t.datetime :begins_at
16
+ t.datetime :ends_at
17
+ t.string :permalink
18
+
19
+ t.timestamps
20
+ end
21
+ end
22
+
23
+ def self.down
24
+ drop_table :parties
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ class CreateGuests < ActiveRecord::Migration
10
+ def self.up
11
+ create_table :guests do |t|
12
+ t.integer :party_id
13
+ t.string :name
14
+ t.boolean :attending
15
+
16
+ t.timestamps
17
+ end
18
+ end
19
+
20
+ def self.down
21
+ drop_table :guests
22
+ end
23
+ end
@@ -0,0 +1,41 @@
1
+ #---
2
+ # Excerpted from "Scripted GUI Testing With Ruby",
3
+ # published by The Pragmatic Bookshelf.
4
+ # Copyrights apply to this code. It may not be used to create training material,
5
+ # courses, books, articles, and the like. Contact us if you are in doubt.
6
+ # We make no guarantees that this code is fit for any purpose.
7
+ # Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
8
+ #---
9
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
10
+ # please use the migrations feature of ActiveRecord to incrementally modify your database, and
11
+ # then regenerate this schema definition.
12
+ #
13
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
14
+ # to create the application database on another system, you should be using db:schema:load, not running
15
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
16
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
17
+ #
18
+ # It's strongly recommended to check this file into your version control system.
19
+
20
+ ActiveRecord::Schema.define(:version => 2) do
21
+
22
+ create_table "guests", :force => true do |t|
23
+ t.integer "party_id"
24
+ t.string "name"
25
+ t.boolean "attending"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ create_table "parties", :force => true do |t|
31
+ t.string "name"
32
+ t.text "description"
33
+ t.text "location"
34
+ t.datetime "begins_at"
35
+ t.datetime "ends_at"
36
+ t.string "permalink"
37
+ t.datetime "created_at"
38
+ t.datetime "updated_at"
39
+ end
40
+
41
+ end
File without changes
@@ -0,0 +1,40 @@
1
+ # General Apache options
2
+ AddHandler fastcgi-script .fcgi
3
+ AddHandler cgi-script .cgi
4
+ Options +FollowSymLinks +ExecCGI
5
+
6
+ # If you don't want Rails to look in certain directories,
7
+ # use the following rewrite rules so that Apache won't rewrite certain requests
8
+ #
9
+ # Example:
10
+ # RewriteCond %{REQUEST_URI} ^/notrails.*
11
+ # RewriteRule .* - [L]
12
+
13
+ # Redirect all requests not available on the filesystem to Rails
14
+ # By default the cgi dispatcher is used which is very slow
15
+ #
16
+ # For better performance replace the dispatcher with the fastcgi one
17
+ #
18
+ # Example:
19
+ # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
20
+ RewriteEngine On
21
+
22
+ # If your Rails application is accessed via an Alias directive,
23
+ # then you MUST also set the RewriteBase in this htaccess file.
24
+ #
25
+ # Example:
26
+ # Alias /myrailsapp /path/to/myrailsapp/public
27
+ # RewriteBase /myrailsapp
28
+
29
+ RewriteRule ^$ index.html [QSA]
30
+ RewriteRule ^([^.]+)$ $1.html [QSA]
31
+ RewriteCond %{REQUEST_FILENAME} !-f
32
+ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
33
+
34
+ # In case Rails experiences terminal errors
35
+ # Instead of displaying this message you can supply a file here which will be rendered instead
36
+ #
37
+ # Example:
38
+ # ErrorDocument 500 /500.html
39
+
40
+ ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <!--
4
+ ! Excerpted from "Scripted GUI Testing With Ruby",
5
+ ! published by The Pragmatic Bookshelf.
6
+ ! Copyrights apply to this code. It may not be used to create training material,
7
+ ! courses, books, articles, and the like. Contact us if you are in doubt.
8
+ ! We make no guarantees that this code is fit for any purpose.
9
+ ! Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
10
+ -->
11
+
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+
14
+ <head>
15
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
16
+ <title>The page you were looking for doesn't exist (404)</title>
17
+ <style type="text/css">
18
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
19
+ div.dialog {
20
+ width: 25em;
21
+ padding: 0 4em;
22
+ margin: 4em auto 0 auto;
23
+ border: 1px solid #ccc;
24
+ border-right-color: #999;
25
+ border-bottom-color: #999;
26
+ }
27
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
28
+ </style>
29
+ </head>
30
+
31
+ <body>
32
+ <!-- This file lives in public/404.html -->
33
+ <div class="dialog">
34
+ <h1>The page you were looking for doesn't exist.</h1>
35
+ <p>You may have mistyped the address or the page may have moved.</p>
36
+ </div>
37
+ </body>
38
+ </html>
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <!--
4
+ ! Excerpted from "Scripted GUI Testing With Ruby",
5
+ ! published by The Pragmatic Bookshelf.
6
+ ! Copyrights apply to this code. It may not be used to create training material,
7
+ ! courses, books, articles, and the like. Contact us if you are in doubt.
8
+ ! We make no guarantees that this code is fit for any purpose.
9
+ ! Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
10
+ -->
11
+
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+
14
+ <head>
15
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
16
+ <title>The change you wanted was rejected (422)</title>
17
+ <style type="text/css">
18
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
19
+ div.dialog {
20
+ width: 25em;
21
+ padding: 0 4em;
22
+ margin: 4em auto 0 auto;
23
+ border: 1px solid #ccc;
24
+ border-right-color: #999;
25
+ border-bottom-color: #999;
26
+ }
27
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
28
+ </style>
29
+ </head>
30
+
31
+ <body>
32
+ <!-- This file lives in public/422.html -->
33
+ <div class="dialog">
34
+ <h1>The change you wanted was rejected.</h1>
35
+ <p>Maybe you tried to change something you didn't have access to.</p>
36
+ </div>
37
+ </body>
38
+ </html>
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <!--
4
+ ! Excerpted from "Scripted GUI Testing With Ruby",
5
+ ! published by The Pragmatic Bookshelf.
6
+ ! Copyrights apply to this code. It may not be used to create training material,
7
+ ! courses, books, articles, and the like. Contact us if you are in doubt.
8
+ ! We make no guarantees that this code is fit for any purpose.
9
+ ! Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
10
+ -->
11
+
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+
14
+ <head>
15
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
16
+ <title>We're sorry, but something went wrong (500)</title>
17
+ <style type="text/css">
18
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
19
+ div.dialog {
20
+ width: 25em;
21
+ padding: 0 4em;
22
+ margin: 4em auto 0 auto;
23
+ border: 1px solid #ccc;
24
+ border-right-color: #999;
25
+ border-bottom-color: #999;
26
+ }
27
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
28
+ </style>
29
+ </head>
30
+
31
+ <body>
32
+ <!-- This file lives in public/500.html -->
33
+ <div class="dialog">
34
+ <h1>We're sorry, but something went wrong.</h1>
35
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
36
+ </div>
37
+ </body>
38
+ </html>
@@ -0,0 +1,10 @@
1
+ #!/opt/local/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
4
+
5
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
6
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
7
+ require "dispatcher"
8
+
9
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
10
+ Dispatcher.dispatch
@@ -0,0 +1,24 @@
1
+ #!/opt/local/bin/ruby
2
+ #
3
+ # You may specify the path to the FastCGI crash log (a log of unhandled
4
+ # exceptions which forced the FastCGI instance to exit, great for debugging)
5
+ # and the number of requests to process before running garbage collection.
6
+ #
7
+ # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
8
+ # and the GC period is nil (turned off). A reasonable number of requests
9
+ # could range from 10-100 depending on the memory footprint of your app.
10
+ #
11
+ # Example:
12
+ # # Default log path, normal GC behavior.
13
+ # RailsFCGIHandler.process!
14
+ #
15
+ # # Default log path, 50 requests between GC.
16
+ # RailsFCGIHandler.process! nil, 50
17
+ #
18
+ # # Custom log path, normal GC behavior.
19
+ # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
20
+ #
21
+ require File.dirname(__FILE__) + "/../config/environment"
22
+ require 'fcgi_handler'
23
+
24
+ RailsFCGIHandler.process!