cucumba 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/History.md +33 -0
  2. data/Manifest.txt +79 -0
  3. data/PostInstall.txt +7 -0
  4. data/README.rdoc +59 -0
  5. data/Rakefile +33 -0
  6. data/config/website.yml.sample +2 -0
  7. data/cucumba.gemspec +52 -0
  8. data/generators/cucumba/USAGE +9 -0
  9. data/generators/cucumba/cucumba_generator.rb +23 -0
  10. data/generators/cucumba/templates/config.yml +15 -0
  11. data/generators/cucumba/templates/cucumba +18 -0
  12. data/lib/cucumba.rb +49 -0
  13. data/lib/cucumba/drb.rb +52 -0
  14. data/lib/cucumba/rails.rb +60 -0
  15. data/lib/cucumba/rails/model.rb +26 -0
  16. data/lib/cucumba/rails/runner.rb +73 -0
  17. data/lib/cucumba/server.rb +14 -0
  18. data/script/console +10 -0
  19. data/script/destroy +14 -0
  20. data/script/generate +14 -0
  21. data/script/txt2html +71 -0
  22. data/spec/cucumba_configuration_spec.rb +97 -0
  23. data/spec/cucumba_spec_rails.rb +59 -0
  24. data/spec/spec.opts +1 -0
  25. data/spec/spec_helper.rb +23 -0
  26. data/spec/support/sample_app/README +1 -0
  27. data/spec/support/sample_app/Rakefile +10 -0
  28. data/spec/support/sample_app/app/controllers/application_controller.rb +4 -0
  29. data/spec/support/sample_app/app/controllers/users_controller.rb +83 -0
  30. data/spec/support/sample_app/app/helpers/application_helper.rb +2 -0
  31. data/spec/support/sample_app/app/helpers/users_helper.rb +2 -0
  32. data/spec/support/sample_app/app/models/user.rb +9 -0
  33. data/spec/support/sample_app/app/views/layouts/users.html.erb +17 -0
  34. data/spec/support/sample_app/app/views/users/edit.html.erb +20 -0
  35. data/spec/support/sample_app/app/views/users/index.html.erb +22 -0
  36. data/spec/support/sample_app/app/views/users/new.html.erb +19 -0
  37. data/spec/support/sample_app/app/views/users/show.html.erb +13 -0
  38. data/spec/support/sample_app/config/boot.rb +110 -0
  39. data/spec/support/sample_app/config/database.yml +22 -0
  40. data/spec/support/sample_app/config/environment.rb +12 -0
  41. data/spec/support/sample_app/config/environments/development.rb +17 -0
  42. data/spec/support/sample_app/config/environments/production.rb +28 -0
  43. data/spec/support/sample_app/config/environments/test.rb +29 -0
  44. data/spec/support/sample_app/config/initializers/cookie_verification_secret.rb +7 -0
  45. data/spec/support/sample_app/config/initializers/new_rails_defaults.rb +21 -0
  46. data/spec/support/sample_app/config/initializers/session_store.rb +15 -0
  47. data/spec/support/sample_app/config/routes.rb +6 -0
  48. data/spec/support/sample_app/db/schema.rb +21 -0
  49. data/spec/support/sample_app/public/404.html +30 -0
  50. data/spec/support/sample_app/public/422.html +30 -0
  51. data/spec/support/sample_app/public/500.html +30 -0
  52. data/spec/support/sample_app/public/favicon.ico +0 -0
  53. data/spec/support/sample_app/public/images/rails.png +0 -0
  54. data/spec/support/sample_app/public/index.html +275 -0
  55. data/spec/support/sample_app/public/javascripts/application.js +2 -0
  56. data/spec/support/sample_app/public/javascripts/controls.js +963 -0
  57. data/spec/support/sample_app/public/javascripts/dragdrop.js +973 -0
  58. data/spec/support/sample_app/public/javascripts/effects.js +1128 -0
  59. data/spec/support/sample_app/public/javascripts/prototype.js +4320 -0
  60. data/spec/support/sample_app/public/robots.txt +5 -0
  61. data/spec/support/sample_app/public/stylesheets/scaffold.css +54 -0
  62. data/spec/support/sample_app/script/about +4 -0
  63. data/spec/support/sample_app/script/console +3 -0
  64. data/spec/support/sample_app/script/dbconsole +3 -0
  65. data/spec/support/sample_app/script/destroy +3 -0
  66. data/spec/support/sample_app/script/generate +3 -0
  67. data/spec/support/sample_app/script/performance/benchmarker +3 -0
  68. data/spec/support/sample_app/script/performance/profiler +3 -0
  69. data/spec/support/sample_app/script/plugin +3 -0
  70. data/spec/support/sample_app/script/runner +3 -0
  71. data/spec/support/sample_app/script/server +3 -0
  72. data/spec/support/sample_app_run.sh +11 -0
  73. data/tasks/rspec.rake +26 -0
  74. data/tasks/yard.rake +14 -0
  75. data/website/index.html +11 -0
  76. data/website/index.txt +81 -0
  77. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  78. data/website/stylesheets/screen.css +159 -0
  79. data/website/template.html.erb +50 -0
  80. metadata +248 -0
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,23 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ require 'net/http'
10
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
11
+ require 'cucumba'
12
+
13
+ begin
14
+ Net::HTTP.start('127.0.0.1', 5001) { |http| http.get('/') }
15
+ rescue Errno::ECONNREFUSED
16
+ puts <<EOF
17
+ ##########################################
18
+ # YOU FORGOT TO RUN SAMPLE RAILS SERVER! #
19
+ ##########################################
20
+ ./spec/support/sample_app_run.sh
21
+ EOF
22
+ exit 1
23
+ end
@@ -0,0 +1 @@
1
+ Test application for Cucumba gem
@@ -0,0 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ require 'tasks/rails'
@@ -0,0 +1,4 @@
1
+ class ApplicationController < ActionController::Base
2
+ helper :all # include all helpers, all the time
3
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
4
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.xml
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.xml { render :xml => @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.xml
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.xml { render :xml => @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.xml
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.xml { render :xml => @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.xml
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to(@user, :notice => 'User was successfully created.') }
48
+ format.xml { render :xml => @user, :status => :created, :location => @user }
49
+ else
50
+ format.html { render :action => "new" }
51
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.xml
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
64
+ format.xml { head :ok }
65
+ else
66
+ format.html { render :action => "edit" }
67
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.xml
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to(users_url) }
80
+ format.xml { head :ok }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,9 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ validates_presence_of :name
4
+
5
+ def self.method_with_args(name,args={})
6
+ logger.info name
7
+ logger.info args.inspect
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
+ <title>Users: <%= controller.action_name %></title>
8
+ <%= stylesheet_link_tag 'scaffold' %>
9
+ </head>
10
+ <body>
11
+
12
+ <p style="color: green"><%= notice %></p>
13
+
14
+ <%= yield %>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,20 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <% form_for(@user) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p>
7
+ <%= f.label :name %><br />
8
+ <%= f.text_field :name %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :password %><br />
12
+ <%= f.text_field :password %>
13
+ </p>
14
+ <p>
15
+ <%= f.submit 'Update' %>
16
+ </p>
17
+ <% end %>
18
+
19
+ <%= link_to 'Show', @user %> |
20
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,22 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Password</th>
7
+ </tr>
8
+
9
+ <% @users.each do |user| %>
10
+ <tr>
11
+ <td><%=h user.name %></td>
12
+ <td><%=h user.password %></td>
13
+ <td><%= link_to 'Show', user %></td>
14
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
15
+ <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
16
+ </tr>
17
+ <% end %>
18
+ </table>
19
+
20
+ <br />
21
+
22
+ <%= link_to 'New user', new_user_path %>
@@ -0,0 +1,19 @@
1
+ <h1>New user</h1>
2
+
3
+ <% form_for(@user) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p>
7
+ <%= f.label :name %><br />
8
+ <%= f.text_field :name %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :password %><br />
12
+ <%= f.text_field :password %>
13
+ </p>
14
+ <p>
15
+ <%= f.submit 'Create' %>
16
+ </p>
17
+ <% end %>
18
+
19
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,13 @@
1
+ <p>
2
+ <b>Name:</b>
3
+ <%=h @user.name %>
4
+ </p>
5
+
6
+ <p>
7
+ <b>Password:</b>
8
+ <%=h @user.password %>
9
+ </p>
10
+
11
+
12
+ <%= link_to 'Edit', edit_user_path(@user) %> |
13
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $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.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,22 @@
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
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Specifies gem version of Rails to use when vendor/rails is not present
4
+ RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
5
+
6
+ # Bootstrap the Rails environment, frameworks, and default configuration
7
+ require File.join(File.dirname(__FILE__), 'boot')
8
+
9
+ Rails::Initializer.run do |config|
10
+ config.gem "cucumba"
11
+ config.time_zone = 'UTC'
12
+ end
@@ -0,0 +1,17 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.action_controller.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+ config.action_view.cache_template_loading = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Enable serving of images, stylesheets, and javascripts from an asset server
22
+ # config.action_controller.asset_host = "http://assets.example.com"
23
+
24
+ # Disable delivery errors, bad email addresses will be ignored
25
+ # config.action_mailer.raise_delivery_errors = false
26
+
27
+ # Enable threaded mode
28
+ # config.threadsafe!