transactionata 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.gitignore +10 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +62 -0
  5. data/Rakefile +33 -0
  6. data/lib/transactionata/version.rb +3 -0
  7. data/lib/transactionata.rb +38 -0
  8. data/test/helper.rb +9 -0
  9. data/test/rails2/Gemfile +14 -0
  10. data/test/rails2/Rakefile +10 -0
  11. data/test/rails2/app/controllers/application_controller.rb +3 -0
  12. data/test/rails2/app/controllers/posts_controller.rb +83 -0
  13. data/test/rails2/app/controllers/users_controller.rb +83 -0
  14. data/test/rails2/app/helpers/application_helper.rb +3 -0
  15. data/test/rails2/app/helpers/posts_helper.rb +2 -0
  16. data/test/rails2/app/helpers/users_helper.rb +2 -0
  17. data/test/rails2/app/models/post.rb +6 -0
  18. data/test/rails2/app/models/user.rb +9 -0
  19. data/test/rails2/app/views/layouts/application.html.erb +14 -0
  20. data/test/rails2/app/views/layouts/posts.html.erb +17 -0
  21. data/test/rails2/app/views/layouts/users.html.erb +17 -0
  22. data/test/rails2/app/views/posts/edit.html.erb +24 -0
  23. data/test/rails2/app/views/posts/index.html.erb +24 -0
  24. data/test/rails2/app/views/posts/new.html.erb +23 -0
  25. data/test/rails2/app/views/posts/show.html.erb +18 -0
  26. data/test/rails2/app/views/users/edit.html.erb +28 -0
  27. data/test/rails2/app/views/users/index.html.erb +26 -0
  28. data/test/rails2/app/views/users/new.html.erb +27 -0
  29. data/test/rails2/app/views/users/show.html.erb +23 -0
  30. data/test/rails2/config/boot.rb +128 -0
  31. data/test/rails2/config/database.yml +22 -0
  32. data/test/rails2/config/environment.rb +38 -0
  33. data/test/rails2/config/environments/development.rb +17 -0
  34. data/test/rails2/config/environments/production.rb +28 -0
  35. data/test/rails2/config/environments/test.rb +28 -0
  36. data/test/rails2/config/initializers/cookie_verification_secret.rb +7 -0
  37. data/test/rails2/config/initializers/new_rails_defaults.rb +21 -0
  38. data/test/rails2/config/initializers/session_store.rb +15 -0
  39. data/test/rails2/config/locales/en.yml +5 -0
  40. data/test/rails2/config/preinitializer.rb +20 -0
  41. data/test/rails2/config/routes.rb +49 -0
  42. data/test/rails2/db/migrate/20110214150055_create_posts.rb +15 -0
  43. data/test/rails2/db/migrate/20110214150128_create_users.rb +16 -0
  44. data/test/rails2/script/about +4 -0
  45. data/test/rails2/script/console +3 -0
  46. data/test/rails2/script/dbconsole +3 -0
  47. data/test/rails2/script/destroy +3 -0
  48. data/test/rails2/script/generate +3 -0
  49. data/test/rails2/script/performance/benchmarker +3 -0
  50. data/test/rails2/script/performance/profiler +3 -0
  51. data/test/rails2/script/plugin +3 -0
  52. data/test/rails2/script/runner +3 -0
  53. data/test/rails2/script/server +3 -0
  54. data/test/rails2/test/factories/posts_factory.rb +4 -0
  55. data/test/rails2/test/factories/users_factory.rb +7 -0
  56. data/test/rails2/test/fixtures/posts.yml +9 -0
  57. data/test/rails2/test/fixtures/users.yml +1 -0
  58. data/test/rails2/test/functional/posts_controller_test.rb +57 -0
  59. data/test/rails2/test/functional/users_controller_test.rb +57 -0
  60. data/test/rails2/test/integration/ui_test.rb +26 -0
  61. data/test/rails2/test/test_helper.rb +38 -0
  62. data/test/rails2/test/unit/helpers/posts_helper_test.rb +4 -0
  63. data/test/rails2/test/unit/helpers/users_helper_test.rb +4 -0
  64. data/test/rails2/test/unit/post_test.rb +42 -0
  65. data/test/rails2/test/unit/user_test.rb +32 -0
  66. data/test/rails3/Gemfile +37 -0
  67. data/test/rails3/Rakefile +7 -0
  68. data/test/rails3/app/controllers/application_controller.rb +3 -0
  69. data/test/rails3/app/controllers/posts_controller.rb +83 -0
  70. data/test/rails3/app/controllers/users_controller.rb +83 -0
  71. data/test/rails3/app/helpers/application_helper.rb +2 -0
  72. data/test/rails3/app/helpers/posts_helper.rb +2 -0
  73. data/test/rails3/app/helpers/users_helper.rb +2 -0
  74. data/test/rails3/app/models/post.rb +6 -0
  75. data/test/rails3/app/models/user.rb +9 -0
  76. data/test/rails3/app/views/layouts/application.html.erb +14 -0
  77. data/test/rails3/app/views/posts/_form.html.erb +25 -0
  78. data/test/rails3/app/views/posts/edit.html.erb +6 -0
  79. data/test/rails3/app/views/posts/index.html.erb +25 -0
  80. data/test/rails3/app/views/posts/new.html.erb +5 -0
  81. data/test/rails3/app/views/posts/show.html.erb +15 -0
  82. data/test/rails3/app/views/users/_form.html.erb +33 -0
  83. data/test/rails3/app/views/users/edit.html.erb +6 -0
  84. data/test/rails3/app/views/users/index.html.erb +29 -0
  85. data/test/rails3/app/views/users/new.html.erb +5 -0
  86. data/test/rails3/app/views/users/show.html.erb +25 -0
  87. data/test/rails3/config/application.rb +42 -0
  88. data/test/rails3/config/boot.rb +6 -0
  89. data/test/rails3/config/database.yml +22 -0
  90. data/test/rails3/config/environment.rb +5 -0
  91. data/test/rails3/config/environments/development.rb +26 -0
  92. data/test/rails3/config/environments/test.rb +35 -0
  93. data/test/rails3/config/initializers/secret_token.rb +7 -0
  94. data/test/rails3/config/initializers/session_store.rb +8 -0
  95. data/test/rails3/config/locales/en.yml +5 -0
  96. data/test/rails3/config/routes.rb +62 -0
  97. data/test/rails3/config.ru +4 -0
  98. data/test/rails3/db/.gitkeep +0 -0
  99. data/test/rails3/db/migrate/20110212112626_create_posts.rb +14 -0
  100. data/test/rails3/db/migrate/20110212120554_create_users.rb +16 -0
  101. data/test/rails3/db/migrate/20110213220543_add_user_reference_to_post.rb +9 -0
  102. data/test/rails3/script/rails +6 -0
  103. data/test/rails3/test/factories/posts_factory.rb +4 -0
  104. data/test/rails3/test/factories/users_factory.rb +7 -0
  105. data/test/rails3/test/fixtures/posts.yml +9 -0
  106. data/test/rails3/test/fixtures/users.yml +1 -0
  107. data/test/rails3/test/functional/posts_controller_test.rb +57 -0
  108. data/test/rails3/test/functional/users_controller_test.rb +57 -0
  109. data/test/rails3/test/integration/ui_test.rb +26 -0
  110. data/test/rails3/test/performance/browsing_test.rb +9 -0
  111. data/test/rails3/test/test_helper.rb +13 -0
  112. data/test/rails3/test/unit/helpers/posts_helper_test.rb +4 -0
  113. data/test/rails3/test/unit/helpers/users_helper_test.rb +4 -0
  114. data/test/rails3/test/unit/post_test.rb +42 -0
  115. data/test/rails3/test/unit/user_test.rb +32 -0
  116. data/test/test_rails2_integration.rb +26 -0
  117. data/test/test_rails3_integration.rb +26 -0
  118. data/transactionata.gemspec +24 -0
  119. metadata +316 -0
@@ -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>Posts: <%= 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,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,24 @@
1
+ <h1>Editing post</h1>
2
+
3
+ <% form_for(@post) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p>
7
+ <%= f.label :title %><br />
8
+ <%= f.text_field :title %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :body %><br />
12
+ <%= f.text_field :body %>
13
+ </p>
14
+ <p>
15
+ <%= f.label :user_id %><br />
16
+ <%= f.text_field :user_id %>
17
+ </p>
18
+ <p>
19
+ <%= f.submit 'Update' %>
20
+ </p>
21
+ <% end %>
22
+
23
+ <%= link_to 'Show', @post %> |
24
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,24 @@
1
+ <h1>Listing posts</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Title</th>
6
+ <th>Body</th>
7
+ <th>User</th>
8
+ </tr>
9
+
10
+ <% @posts.each do |post| %>
11
+ <tr>
12
+ <td><%=h post.title %></td>
13
+ <td><%=h post.body %></td>
14
+ <td><%=h post.user_id %></td>
15
+ <td><%= link_to 'Show', post %></td>
16
+ <td><%= link_to 'Edit', edit_post_path(post) %></td>
17
+ <td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
18
+ </tr>
19
+ <% end %>
20
+ </table>
21
+
22
+ <br />
23
+
24
+ <%= link_to 'New post', new_post_path %>
@@ -0,0 +1,23 @@
1
+ <h1>New post</h1>
2
+
3
+ <% form_for(@post) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p>
7
+ <%= f.label :title %><br />
8
+ <%= f.text_field :title %>
9
+ </p>
10
+ <p>
11
+ <%= f.label :body %><br />
12
+ <%= f.text_field :body %>
13
+ </p>
14
+ <p>
15
+ <%= f.label :user_id %><br />
16
+ <%= f.text_field :user_id %>
17
+ </p>
18
+ <p>
19
+ <%= f.submit 'Create' %>
20
+ </p>
21
+ <% end %>
22
+
23
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,18 @@
1
+ <p>
2
+ <b>Title:</b>
3
+ <%=h @post.title %>
4
+ </p>
5
+
6
+ <p>
7
+ <b>Body:</b>
8
+ <%=h @post.body %>
9
+ </p>
10
+
11
+ <p>
12
+ <b>User:</b>
13
+ <%=h @post.user_id %>
14
+ </p>
15
+
16
+
17
+ <%= link_to 'Edit', edit_post_path(@post) %> |
18
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,28 @@
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 :email %><br />
12
+ <%= f.text_field :email %>
13
+ </p>
14
+ <p>
15
+ <%= f.label :login %><br />
16
+ <%= f.text_field :login %>
17
+ </p>
18
+ <p>
19
+ <%= f.label :password %><br />
20
+ <%= f.text_field :password %>
21
+ </p>
22
+ <p>
23
+ <%= f.submit 'Update' %>
24
+ </p>
25
+ <% end %>
26
+
27
+ <%= link_to 'Show', @user %> |
28
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,26 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Email</th>
7
+ <th>Login</th>
8
+ <th>Password</th>
9
+ </tr>
10
+
11
+ <% @users.each do |user| %>
12
+ <tr>
13
+ <td><%=h user.name %></td>
14
+ <td><%=h user.email %></td>
15
+ <td><%=h user.login %></td>
16
+ <td><%=h user.password %></td>
17
+ <td><%= link_to 'Show', user %></td>
18
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
19
+ <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
20
+ </tr>
21
+ <% end %>
22
+ </table>
23
+
24
+ <br />
25
+
26
+ <%= link_to 'New user', new_user_path %>
@@ -0,0 +1,27 @@
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 :email %><br />
12
+ <%= f.text_field :email %>
13
+ </p>
14
+ <p>
15
+ <%= f.label :login %><br />
16
+ <%= f.text_field :login %>
17
+ </p>
18
+ <p>
19
+ <%= f.label :password %><br />
20
+ <%= f.text_field :password %>
21
+ </p>
22
+ <p>
23
+ <%= f.submit 'Create' %>
24
+ </p>
25
+ <% end %>
26
+
27
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,23 @@
1
+ <p>
2
+ <b>Name:</b>
3
+ <%=h @user.name %>
4
+ </p>
5
+
6
+ <p>
7
+ <b>Email:</b>
8
+ <%=h @user.email %>
9
+ </p>
10
+
11
+ <p>
12
+ <b>Login:</b>
13
+ <%=h @user.login %>
14
+ </p>
15
+
16
+ <p>
17
+ <b>Password:</b>
18
+ <%=h @user.password %>
19
+ </p>
20
+
21
+
22
+ <%= link_to 'Edit', edit_user_path(@user) %> |
23
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,128 @@
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
+ if load_error.message =~ /Could not find RubyGem rails/
66
+ 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.)
67
+ exit 1
68
+ else
69
+ raise
70
+ end
71
+ end
72
+
73
+ class << self
74
+ def rubygems_version
75
+ Gem::RubyGemsVersion rescue nil
76
+ end
77
+
78
+ def gem_version
79
+ if defined? RAILS_GEM_VERSION
80
+ RAILS_GEM_VERSION
81
+ elsif ENV.include?('RAILS_GEM_VERSION')
82
+ ENV['RAILS_GEM_VERSION']
83
+ else
84
+ parse_gem_version(read_environment_rb)
85
+ end
86
+ end
87
+
88
+ def load_rubygems
89
+ min_version = '1.3.2'
90
+ require 'rubygems'
91
+ unless rubygems_version >= min_version
92
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
93
+ exit 1
94
+ end
95
+
96
+ rescue LoadError
97
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
98
+ exit 1
99
+ end
100
+
101
+ def parse_gem_version(text)
102
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
103
+ end
104
+
105
+ private
106
+ def read_environment_rb
107
+ File.read("#{RAILS_ROOT}/config/environment.rb")
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ class Rails::Boot
114
+ def run
115
+ load_initializer
116
+
117
+ Rails::Initializer.class_eval do
118
+ def load_gems
119
+ @bundler_loaded ||= Bundler.require :default, Rails.env
120
+ end
121
+ end
122
+
123
+ Rails::Initializer.run(:set_load_path)
124
+ end
125
+ end
126
+
127
+ # All that for this:
128
+ 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,38 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Bootstrap the Rails environment, frameworks, and default configuration
4
+ require File.join(File.dirname(__FILE__), 'boot')
5
+
6
+ Rails::Initializer.run do |config|
7
+ # Settings in config/environments/* take precedence over those specified here.
8
+ # Application configuration should go into files in config/initializers
9
+ # -- all .rb files in that directory are automatically loaded.
10
+
11
+ # Add additional load paths for your own custom dirs
12
+ # config.autoload_paths += %W( #{RAILS_ROOT}/extras )
13
+
14
+ # Specify gems that this application depends on and have them installed with rake gems:install
15
+ # config.gem "bj"
16
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
17
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
18
+ # config.gem "aws-s3", :lib => "aws/s3"
19
+
20
+ # Only load the plugins named here, in the order given (default is alphabetical).
21
+ # :all can be used as a placeholder for all plugins not explicitly named
22
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
23
+
24
+ # Skip frameworks you're not going to use. To use Rails without a database,
25
+ # you must remove the Active Record framework.
26
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
27
+
28
+ # Activate observers that should always be running
29
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
30
+
31
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
32
+ # Run "rake -D time" for a list of tasks for finding time zone names.
33
+ config.time_zone = 'UTC'
34
+
35
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
36
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
37
+ # config.i18n.default_locale = :de
38
+ 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