cant_wait 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +3 -15
- data/.travis.yml +5 -5
- data/CHANGELOG.md +21 -0
- data/README.md +33 -27
- data/cant_wait.gemspec +7 -7
- data/cert/README.md +70 -0
- data/cert/public_cert.pem +21 -0
- data/lib/cant_wait.rb +2 -0
- data/lib/cant_wait/cant_wait_railtie.rb +2 -0
- data/lib/cant_wait/version.rb +3 -1
- data/tasks/testing.rake +2 -2
- data/test/README.md +44 -25
- data/test/cant_wait_test.rb +8 -12
- data/test/test_apps/Test_3_0_03/Gemfile +0 -2
- data/test/test_apps/Test_3_0_20/Gemfile +0 -2
- data/test/test_apps/Test_3_1_12/Gemfile +0 -2
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/Gemfile +1 -3
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/README.rdoc +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/Rakefile +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/assets/images/rails.png +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/assets/javascripts/application.js +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/assets/stylesheets/application.css +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/controllers/application_controller.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/helpers/application_helper.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/mailers/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/models/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/views/layouts/application.html.erb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config.ru +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/application.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/boot.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environment.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environments/development.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environments/production.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environments/test.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/backtrace_silencers.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/inflections.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/mime_types.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/secret_token.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/session_store.rb +2 -2
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/wrap_parameters.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/locales/en.yml +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/routes.rb +1 -1
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/db/seeds.rb +0 -0
- data/test/test_apps/Test_3_2_14/doc/README_FOR_APP +2 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/lib/assets/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/lib/tasks/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/log/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/404.html +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/422.html +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/500.html +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/favicon.ico +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/index.html +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/robots.txt +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/script/rails +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/fixtures/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/functional/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/integration/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/performance/browsing_test.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/test_helper.rb +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/unit/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/vendor/assets/javascripts/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/vendor/plugins/.gitkeep +0 -0
- data/test/test_apps/Test_4_0_0/Gemfile +0 -2
- metadata +127 -144
- metadata.gz.sig +0 -0
- data/test/test_apps/Test_3_0_03/.gitignore +0 -12
- data/test/test_apps/Test_3_0_20/.gitignore +0 -12
- data/test/test_apps/Test_3_1_12/.gitignore +0 -12
- data/test/test_apps/Test_3_2_13/.gitignore +0 -12
- data/test/test_apps/Test_4_0_0/.gitignore +0 -16
- data/test/test_apps/Test_4_0_0/config/database.yml +0 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWJhMmUzZDZjYjBhMmVjN2FiZjk4YTdjNjcwMTY2ZTYyY2EyYzBjMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmZmYzczMjRiZTRiN2I5NGRmMDhkNTZlODI5YTdmNDA1ZmRlNDYxMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTIzNzc0MzA4Yzg4YTI5MGExNjJmNzE2OGYyOTg5OWJhZjJkMTQwNGY1YTM5
|
10
|
+
ODM5MWFjZjEyN2Y1NDUyZjRiMjRiM2E1MzcyMzEzNDk0YzE3NzUwNjYyNmM2
|
11
|
+
MTBjNmJjMjU4MzI3OTBlMzA3NmFhYjVlMGNmODYyZDg3NGYyNTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTI2ZjIwNjRkNGY4YjU4YmNjODQ4ZmZhZjA4MWVkZjEwN2M4MzdkOTdlNjA2
|
14
|
+
YzdjMGY2Mjg4NjU5M2NhNTQ1MGUyNjM4N2FmYjUxNjY1ZjNkZGJjZDBkNGE0
|
15
|
+
NTExZmUxMDI1ODZhYzg0YzIzZGEyNWM2ODE0MDU1MTc0ZGM1YmE=
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
@@ -1,18 +1,6 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
1
|
.DS_Store
|
6
|
-
|
2
|
+
*.gem
|
7
3
|
Gemfile.lock
|
8
|
-
InstalledFiles
|
9
|
-
_yardoc
|
10
|
-
coverage
|
11
|
-
doc/
|
12
|
-
lib/bundler/man
|
13
4
|
pkg
|
14
|
-
|
15
|
-
|
16
|
-
test/tmp
|
17
|
-
test/version_tmp
|
18
|
-
tmp
|
5
|
+
test/test_apps/Test_*/log/*.log
|
6
|
+
test/test_apps/Test_*/config/database.yml
|
data/.travis.yml
CHANGED
@@ -3,13 +3,13 @@ rvm:
|
|
3
3
|
- 1.9.2
|
4
4
|
- 1.9.3
|
5
5
|
- 2.0.0
|
6
|
-
- jruby-19mode # JRuby in 1.9 mode
|
7
|
-
- rbx-19mode # Rubinius in 1.9 mode
|
6
|
+
- jruby-19mode # JRuby in 1.9 mode
|
7
|
+
- rbx-19mode # Rubinius in 1.9 mode
|
8
8
|
before_script:
|
9
|
-
# Before, Travis does a bundle install (cant_wait's Gemfile),
|
9
|
+
# Before, Travis does a bundle install (cant_wait's Gemfile), which installs the last version of Rails
|
10
10
|
- psql -c "CREATE ROLE tester WITH LOGIN PASSWORD 'secret';" -U postgres
|
11
11
|
- psql -c 'CREATE DATABASE test WITH OWNER=tester;' -U postgres
|
12
|
-
#
|
13
|
-
- gem uninstall rails
|
12
|
+
# We remove Rails to allow the installation of previous versions:
|
13
|
+
- gem uninstall rails
|
14
14
|
- rake test:bundle
|
15
15
|
script: rake test:run
|
data/CHANGELOG.md
CHANGED
@@ -23,3 +23,24 @@ Development:
|
|
23
23
|
|
24
24
|
- Travis scripts stability fixes
|
25
25
|
- Tests for Rails 4.0.0
|
26
|
+
|
27
|
+
0.0.4 (August 15, 2013)
|
28
|
+
=======================
|
29
|
+
|
30
|
+
Features:
|
31
|
+
|
32
|
+
- Encoding UTF-8 (ruby 1.9)
|
33
|
+
|
34
|
+
Documentation:
|
35
|
+
|
36
|
+
- Changes in the documentation
|
37
|
+
- Minimum ruby is MRI 1.9.1 or compatible
|
38
|
+
- Added a 'runtime dependencies' security advisory service. A dynamic badge on the README files
|
39
|
+
- Added the code signing certificate, for gem signature verification
|
40
|
+
|
41
|
+
Development:
|
42
|
+
|
43
|
+
- Streamlining PostgreSQL JDBC dependencies for JRuby
|
44
|
+
- Minor tweaks in the tests
|
45
|
+
- Tested with new patches of MRI for C Ruby 1.9.3 and 2.0.0
|
46
|
+
- Tests for Rails 3.2.14
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# cant_wait
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/cant_wait.png)](https://badge.fury.io/rb/cant_wait)
|
3
|
+
[![Dependency Status](https://gemnasium.com/CarlosCD/cant_wait.png)](https://gemnasium.com/CarlosCD/cant_wait)
|
3
4
|
[![Build Status](https://travis-ci.org/CarlosCD/cant_wait.png?branch=master)](https://travis-ci.org/CarlosCD/cant_wait)
|
4
5
|
|
5
6
|
|
6
|
-
This Ruby gem
|
7
|
+
This Ruby gem adds statement timeouts for PostgreSQL databases within a Ruby on Rails web application.
|
7
8
|
|
8
9
|
From the PostgreSQL documentation:
|
9
10
|
|
@@ -22,11 +23,20 @@ From the PostgreSQL documentation:
|
|
22
23
|
(Visit <http://www.postgresql.org/docs/devel/static/runtime-config-client.html> for more information)
|
23
24
|
|
24
25
|
|
25
|
-
If any SQL statement takes more time than the timeout value (measured in milliseconds), its execution will be cancelled, and Active Record would raise
|
26
|
+
If any SQL statement takes more time than the timeout value (measured in milliseconds), its execution will be cancelled, and Active Record would raise an exception.
|
26
27
|
|
27
28
|
ActiveRecord::StatementInvalid: PGError: ERROR: canceling statement due to statement timeout
|
28
29
|
|
29
|
-
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
|
33
|
+
Add this line to your application's Gemfile:
|
34
|
+
|
35
|
+
gem 'cant_wait', '~> 0.0.4'
|
36
|
+
|
37
|
+
And then execute:
|
38
|
+
|
39
|
+
bundle
|
30
40
|
|
31
41
|
|
32
42
|
## Usage
|
@@ -41,22 +51,14 @@ In the file <tt>config/database.yml</tt> of the Rails application, indicate a ti
|
|
41
51
|
Then restart the application to establish the new database settings.
|
42
52
|
|
43
53
|
|
44
|
-
##
|
45
|
-
|
46
|
-
Add this line to your application's Gemfile:
|
47
|
-
|
48
|
-
gem 'cant_wait', '~> 0.0.3'
|
49
|
-
|
50
|
-
And then execute:
|
51
|
-
|
52
|
-
$ bundle
|
54
|
+
## Dependencies
|
53
55
|
|
56
|
+
The minimum requirement is Rails 3.0.3 and ruby. The gem has been tested with Rails 3.0.3 and above (including version 4.0.0). Previous versions of Rails are not compatible with the present version of bundler.
|
54
57
|
|
55
|
-
|
58
|
+
The minimum version of ruby is MRI 1.9.1 or compatible, as the gem uses 1.9 syntax.
|
56
59
|
|
57
|
-
|
60
|
+
It has also been tested with PostgreSQL versions 8 and 9, but it may work also in other versions supported by Active Record (see PostgreSQL documentation).
|
58
61
|
|
59
|
-
The gem has been tested with Rails 3.0.3 and above (including version 4.0.0). It has also been tested with PostgreSQL versions 8 and 9, but it may work also in other versions supported by Active Record (see PostgreSQL documentation).
|
60
62
|
|
61
63
|
### Supported Rubies
|
62
64
|
|
@@ -68,23 +70,27 @@ The gem has been tested with Rails 3.0.3 and above (including version 4.0.0). I
|
|
68
70
|
- jruby
|
69
71
|
- Rubinius
|
70
72
|
|
71
|
-
The gem may work
|
73
|
+
The gem may work fine with other Ruby flavors/versions not listed above.
|
74
|
+
|
75
|
+
See the development documentation below for more details.
|
76
|
+
|
77
|
+
|
78
|
+
## Signature
|
79
|
+
|
80
|
+
All the versions of **cant_wait** released from rubygems.org have been digitally signed.
|
72
81
|
|
73
|
-
|
82
|
+
To verify that the gem has not been tampered with, I am providing the certificate used in its repository, at [Github](https://github.com/CarlosCD/cant_wait).
|
74
83
|
|
75
84
|
|
76
|
-
## Development
|
85
|
+
## Development
|
77
86
|
|
78
|
-
|
79
|
-
* Details on the test setup are in the file README.md within the test folder. It includes details on testing in several Ruby and Rails versions.
|
87
|
+
If you find any problem, please feel free to open an issue at the gem's repository ([GitHub](https://github.com/CarlosCD/cant_wait)).
|
80
88
|
|
81
|
-
|
89
|
+
These files could be of particular interest:
|
82
90
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
87
|
-
5. Create new Pull Request
|
91
|
+
+ [The Change Log](https://github.com/CarlosCD/cant_wait/blob/master/CHANGELOG.md)
|
92
|
+
+ [Test setup details](https://github.com/CarlosCD/cant_wait/blob/master/test/README.md)
|
93
|
+
+ [Gem signature verification](https://github.com/CarlosCD/cant_wait/blob/master/cert/README.md)
|
88
94
|
|
89
95
|
|
90
96
|
## License
|
@@ -92,4 +98,4 @@ Contributing:
|
|
92
98
|
**cant_wait** is released under the [MIT License](http://opensource.org/licenses/MIT).
|
93
99
|
|
94
100
|
|
95
|
-
|
101
|
+
August 2013
|
data/cant_wait.gemspec
CHANGED
@@ -4,9 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'cant_wait/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.platform
|
7
|
+
spec.name = 'cant_wait'
|
8
|
+
spec.version = CantWait::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.required_ruby_version = '>= 1.9.1'
|
11
|
+
|
10
12
|
spec.summary = 'Complements the Ruby on Rails web application framework by providing statement timeouts for PostgreSQL databases.'
|
11
13
|
spec.description = 'Provides statement timeouts for PostgreSQL databases in a Ruby on Rails web application. Stops any SQL statement ' <<
|
12
14
|
'that takes more than a specified number of milliseconds.'
|
@@ -22,16 +24,14 @@ Gem::Specification.new do |spec|
|
|
22
24
|
|
23
25
|
spec.add_dependency 'rails', '>= 3.0.3'
|
24
26
|
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
+
spec.cert_chain = ['cert/public_cert.pem']
|
28
|
+
spec.signing_key = '/users/CarlosCD/.ssh/keys.pem' if $0 =~ /gem\z/
|
27
29
|
|
28
30
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
29
31
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
30
32
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
33
|
if RUBY_ENGINE == 'jruby' && RUBY_PLATFORM == 'java'
|
32
|
-
spec.add_development_dependency 'activerecord-jdbc-adapter', '~> 1.2'
|
33
34
|
spec.add_development_dependency 'activerecord-jdbcpostgresql-adapter', '~> 1.2'
|
34
|
-
spec.add_development_dependency 'jdbc-postgres', '~> 9'
|
35
35
|
else
|
36
36
|
spec.add_development_dependency 'pg', '~> 0'
|
37
37
|
end
|
data/cert/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# cant_wait ~ Gem Signature verification
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/cant_wait.png)](https://badge.fury.io/rb/cant_wait)
|
3
|
+
[![Dependency Status](https://gemnasium.com/CarlosCD/cant_wait.png)](https://gemnasium.com/CarlosCD/cant_wait)
|
4
|
+
|
5
|
+
|
6
|
+
All the versions of **cant_wait** released from rubygems.org have been digitally signed.
|
7
|
+
|
8
|
+
To verify that the gem has not been tampered with, I am providing here the self-signed certificate used, which includes the public key.
|
9
|
+
|
10
|
+
Therefore, you have now two pieces of information from two different sources:
|
11
|
+
|
12
|
+
- The signed gem from [RubyGems.org](http://rubygems.org/gems/cant_wait)
|
13
|
+
- The certificate from [Github.com's](https://github.com/CarlosCD/cant_wait) repository
|
14
|
+
|
15
|
+
This mechanism is far from perfect, but I believe it is better than no security at all, until the Ruby community and RuybyGems.org agrees in something better (and free).
|
16
|
+
|
17
|
+
|
18
|
+
## Cryptographic signature verification
|
19
|
+
|
20
|
+
To verify the gem's signature:
|
21
|
+
|
22
|
+
1. First install the certificate public_cert.pem downloaded from the cert folder of Github's repository (master branch):
|
23
|
+
|
24
|
+
gem cert -a public_cert.pem
|
25
|
+
|
26
|
+
2. Then Download the last version of the gem (or a version you intend to use) from rubygems.org. The file would look something like:
|
27
|
+
|
28
|
+
cant_wait-X.Y.Z.gem
|
29
|
+
|
30
|
+
Where <tt>X.Y.Z</tt> is the gem's version.
|
31
|
+
|
32
|
+
3. Next the gem can be installed with the high security option, which checks that the gem is signed and the signature matches an installed certificate:
|
33
|
+
|
34
|
+
gem install cant_wait-X.Y.Z.gem -P HighSecurity
|
35
|
+
|
36
|
+
If the certificate or the gem has been tampered with, the gem command (RubyGems) should refuse to install it.
|
37
|
+
|
38
|
+
|
39
|
+
## On certificate renewal and expiration
|
40
|
+
|
41
|
+
The certificate used to sign **cant_wait** versions 0.0.1 to 0.0.3 had a short validity time, so the one provided in the cert folder in Github is a renewal of the original, with a longer expiration date. I've used this certificate from versions 0.0.4 and on. However, the verification process explained above won't complain, as both certificates use the same cryptographic keys and same identity data.
|
42
|
+
|
43
|
+
The reason for this notice is that other verification systems may say that the certificate doesn't match for early version of the gem, even if the public key is the same.
|
44
|
+
|
45
|
+
|
46
|
+
## Use of Bundler to install signed and trusted gems, or not
|
47
|
+
|
48
|
+
The usual way to install gem dependencies using bundler, as it is commonly done in Rails, is by executing the command:
|
49
|
+
|
50
|
+
bundler
|
51
|
+
|
52
|
+
or
|
53
|
+
|
54
|
+
bundler install
|
55
|
+
|
56
|
+
If used this way, unless additional parameters are added by your particular setup (maybe using bundle's config), bundler doesn't verify gem signatures. If this is a concern to you, then you should:
|
57
|
+
|
58
|
+
1. Install the certificates of the gems you know and trust, as explained above (<tt>gem cert -a certificate</tt>).
|
59
|
+
2. Bundle install with the <tt>High security</tt> option:
|
60
|
+
|
61
|
+
bundle --trust-policy HighSecurity
|
62
|
+
|
63
|
+
or
|
64
|
+
|
65
|
+
bundle install --trust-policy HighSecurity
|
66
|
+
|
67
|
+
Please be aware that the practice of signing gems is not followed as a standard by the whole development community, so you may find that many of the most popular ruby gems are not signed (bundler and rails are not signed at this moment). Therefore you may need to think about it, compromise, or carefully audit the code of the gems you try to install.
|
68
|
+
|
69
|
+
|
70
|
+
August 2013
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDezCCAmOgAwIBAgIJAPqnpDrIxB5EMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
|
3
|
+
BAYTAlVTMQswCQYDVQQIDAJNRDERMA8GA1UEAwwIQ2FybG9zQ0QxJDAiBgkqhkiG
|
4
|
+
9w0BCQEWFWNjYXJyb2R1cGxhQGdtYWlsLmNvbTAgFw0xMzA3MTgxOTMwNDJaGA8y
|
5
|
+
MDUzMDcwODE5MzA0MlowUzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk1EMREwDwYD
|
6
|
+
VQQDDAhDYXJsb3NDRDEkMCIGCSqGSIb3DQEJARYVY2NhcnJvZHVwbGFAZ21haWwu
|
7
|
+
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx3/EdvkPDke6ifYd
|
8
|
+
9GYENKzUG8tZTpWz2896PjggqDkegizOHENcF2ESUEyopxRP34/LrId/u3ZOhiM5
|
9
|
+
yqjd8OvWVFcozpbY60d3HxnVwEfHlFf0ghXqCs2rY5XzY5viPyQ+vFX0v9U04vkZ
|
10
|
+
P2cayJTMfuhdeH/3DwKqkHLzH+hM6rUOjY4RN0r0OWPhs2vNMujhjHWKI/j5gjYD
|
11
|
+
q7l8og7yKmZlMYKYUrGguMZlTww61T8G0yoKbLLzXMJADUq3xwzbUM98mvePGsix
|
12
|
+
FOgz2CNN7gBCkhqZyrcJVinn76IrHXHA2xHuNjK2Xfm1dFAqes2DeH9+0m4CiYNV
|
13
|
+
aOaENQIDAQABo1AwTjAdBgNVHQ4EFgQUkYnGK6rP0uytzVtmxO6OrKST2AcwHwYD
|
14
|
+
VR0jBBgwFoAUkYnGK6rP0uytzVtmxO6OrKST2AcwDAYDVR0TBAUwAwEB/zANBgkq
|
15
|
+
hkiG9w0BAQUFAAOCAQEAMbe3ei8af8r2wvb6FQ/f/GlnFJfaPJIaDEj8emg2sSIg
|
16
|
+
m7Qg3e601m1UF0hqTEGcjUmrrPrknOYv+JgwdBslBJnLasCADZshX2MIzjlzHG3W
|
17
|
+
2tFGKGm3xaJbKbFJ3K1HWof399E9ecS02ZBErvoJvYjKBOV+DvYW18zryX/oMQGr
|
18
|
+
3btYo3NlDuNXVpX5ChPC/QcvK3DLMP102YguZMjawympptozRHgvQYLNjmsZpi7+
|
19
|
+
4Lx7TwZB/AT4xQfhKewXYTfvjRQRUKhnnhPh+CYwpl0xV9jun/8HHCVLWFyDLKa0
|
20
|
+
j8swKkWECMke3qZmvKW8NTWQc4ffpbGtugif0Iw9bA==
|
21
|
+
-----END CERTIFICATE-----
|
data/lib/cant_wait.rb
CHANGED
data/lib/cant_wait/version.rb
CHANGED
data/tasks/testing.rake
CHANGED
@@ -9,7 +9,7 @@ namespace :test do
|
|
9
9
|
TEST_RAILS_APP = [{ version: '3.0.3', rails_root: 'test/test_apps/Test_3_0_03'},
|
10
10
|
{ version: '3.0.20', rails_root: 'test/test_apps/Test_3_0_20'},
|
11
11
|
{ version: '3.1.12', rails_root: 'test/test_apps/Test_3_1_12'},
|
12
|
-
{ version: '3.2.
|
12
|
+
{ version: '3.2.14', rails_root: 'test/test_apps/Test_3_2_14'},
|
13
13
|
{ version: '4.0.0', rails_root: 'test/test_apps/Test_4_0_0' }]
|
14
14
|
|
15
15
|
|
@@ -107,7 +107,7 @@ namespace :test do
|
|
107
107
|
puts '============================================================'
|
108
108
|
print ' rvm setting (if rvm is being used): '
|
109
109
|
system 'rvm current'
|
110
|
-
puts " Gem's ENV['BUNDLE_GEMFILE']='#{ENV['BUNDLE_GEMFILE']}'"
|
110
|
+
puts " Gem's ENV['BUNDLE_GEMFILE']='#{ENV['BUNDLE_GEMFILE']}'"
|
111
111
|
end
|
112
112
|
can_wait_bundle_gemfile = ENV['BUNDLE_GEMFILE']
|
113
113
|
initial_directory = FileUtils.pwd
|
data/test/README.md
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
# cant_wait ~ development and test
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/cant_wait.png)](https://badge.fury.io/rb/cant_wait)
|
3
|
+
[![Dependency Status](https://gemnasium.com/CarlosCD/cant_wait.png)](https://gemnasium.com/CarlosCD/cant_wait)
|
3
4
|
|
4
5
|
|
5
6
|
## Test setup and choices
|
6
7
|
|
7
8
|
- Minitest, to keep things simple.
|
8
9
|
- PostgreSQL database server (localhost or not).
|
9
|
-
- I used
|
10
|
+
- I used RVM. This is not a requirement, other ruby version managers should work as well.
|
10
11
|
|
11
12
|
|
12
13
|
## Test strategy: different Rails apps with random timeouts
|
13
14
|
|
14
15
|
### The problem
|
15
16
|
|
16
|
-
The approach of using minimal Rails components (ActiveRecord, Railties) is problematic due to the amount of code
|
17
|
+
The approach of using minimal Rails components (ActiveRecord, Railties) is problematic due to the amount of code Rails loads and of how it changes Ruby's standard behavior. I wanted to test it as close as possible to how an end user would use the gem.
|
17
18
|
|
18
|
-
To test
|
19
|
+
To test different versions of Rails, and different timeout scenarios, requires to run several Rails apps either simultaneously or sequentially. Even using different threads, being a Rails Application a singleton, it will end up in:
|
19
20
|
|
20
21
|
RuntimeError: You cannot have more than one Rails::Application
|
21
22
|
|
22
|
-
This path also
|
23
|
+
This path would also make the test cases too distant to the real conditions of an isolated Rails app. Even if the singleton restriction is removed in the future (see this interesting discussion regarding Rails 4.1: <https://github.com/rails/rails/pull/9655>), it will still apply to older versions of Rails.
|
23
24
|
|
24
25
|
### A solution
|
25
26
|
|
@@ -30,9 +31,7 @@ I created 5 simple Rails apps, of different versions, in the folder test/test_ap
|
|
30
31
|
Then I modified their Gemfile by adding gems for PostgreSQL, Minitest and Growl:
|
31
32
|
|
32
33
|
if RUBY_ENGINE == 'jruby' && RUBY_PLATFORM == 'java'
|
33
|
-
gem 'activerecord-jdbc-adapter', '~> 1.2'
|
34
34
|
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.2'
|
35
|
-
gem 'jdbc-postgres', '~> 9'
|
36
35
|
else
|
37
36
|
gem 'pg', '~> 0'
|
38
37
|
end
|
@@ -46,19 +45,19 @@ Then I modified their Gemfile by adding gems for PostgreSQL, Minitest and Growl:
|
|
46
45
|
|
47
46
|
gem 'cant_wait', path: File.expand_path('../../../..', __FILE__)
|
48
47
|
|
49
|
-
The rails apps require bundle install,
|
48
|
+
The rails apps require also to run <tt>bundle install</tt> for each app, especially when changing the version of Ruby used. To make it easier, I added a rake task (<tt>rake test:bundle</tt>).
|
50
49
|
|
51
|
-
The test is run through the <tt>rake test:run command
|
50
|
+
The actual test is run through the <tt>rake test:run</tt> command. It goes over each Rails app in sequence and:
|
52
51
|
|
53
|
-
1. It sets
|
52
|
+
1. It sets Bundler to use the test app's Gemfile
|
54
53
|
2. It creates the app's <tt>config/database.yml</tt> with a random timeout
|
55
54
|
3. It starts Rails
|
56
55
|
4. It checks the version of Rails and ActiveRecord running.
|
57
56
|
5. It checks that the PostgreSQL connection's statement_timeout is the expected.
|
58
57
|
|
59
|
-
Due to the complex setup
|
58
|
+
Due to the complex setup, and to signal the developer to stop and consider these choices, I chose not to use the rake default to run the tests, as it is most common.
|
60
59
|
|
61
|
-
|
60
|
+
An additional task <tt>rake test:all</tt> will do both the <tt>bundle install</tt> and run the tests. Travis-ci also runs each of these tasks in sequence.
|
62
61
|
|
63
62
|
|
64
63
|
## The Testing process in detail
|
@@ -78,19 +77,20 @@ After cloning the gem, you can start testing it by following these steps:
|
|
78
77
|
|
79
78
|
4. Set up your PostgreSQL test database and edit accordingly the file <tt>test/database.yml</tt>
|
80
79
|
|
81
|
-
5. Get the
|
80
|
+
5. Get the gems used by the test Rails apps:
|
82
81
|
|
83
82
|
rake test:bundle
|
84
83
|
|
85
|
-
6.
|
84
|
+
6. Your setup is complete. To run the tests:
|
86
85
|
|
87
86
|
rake test:run
|
88
87
|
|
89
|
-
If
|
88
|
+
If desired, run the tests several times. The tests use different random timeout scenarios, so each run may be a bit different.
|
89
|
+
|
90
90
|
|
91
91
|
## Travis
|
92
92
|
|
93
|
-
I added travis-ci.org to check every build
|
93
|
+
I added travis-ci.org to check every build pushed to Github, and a clickable badge to check the status of the last test.
|
94
94
|
|
95
95
|
Check the .travis.yml file for details.
|
96
96
|
|
@@ -99,24 +99,43 @@ Check the .travis.yml file for details.
|
|
99
99
|
|
100
100
|
* Versions of Ruby:
|
101
101
|
|
102
|
-
1.9.2-p320
|
103
|
-
1.9.3-p327
|
104
|
-
1.9.3-p429
|
105
|
-
|
106
|
-
2.0.0-
|
107
|
-
|
108
|
-
|
109
|
-
|
102
|
+
1.9.2-p320 (MRI's last patchlevel of 1.9.2) Linux and MacOS X
|
103
|
+
1.9.3-p327 (MRI) Linux
|
104
|
+
1.9.3-p429 (MRI) Linux and MacOS X
|
105
|
+
1.9.3-p448 (MRI last patchlevel of 1.9.3) Linux and Mac OS X
|
106
|
+
2.0.0-p0 (MRI) Linux
|
107
|
+
2.0.0-p195 (MRI) Linux and MacOS X
|
108
|
+
2.0.0-p247 (MRI last patchlevel of 2.0.0) Linux and Mac OS X
|
109
|
+
jruby 1.7.3 (Java 1.7.0_15) Linux
|
110
|
+
jruby 1.7.4 (Java 1.6.0_45) MacOS X
|
111
|
+
jruby 1.7.4 (Java 1.7.0_21) Linux
|
112
|
+
Rubinius 2.0.0.w30 (1.9.3) Linux
|
113
|
+
|
114
|
+
It requires at least MRI 1.9.1 or compatible.
|
110
115
|
|
111
116
|
* Versions of Rails:
|
112
117
|
|
113
118
|
Rails 3.0.3 First version using Bundler 1.3.5 (incompatible with Bundler 1.0.X)
|
114
119
|
Rails 3.0.20 Last patchlevel of Rails 3.0 (at this moment)
|
115
120
|
Rails 3.1.12 Last patchlevel of Rails 3.1
|
116
|
-
Rails 3.2.13
|
121
|
+
Rails 3.2.13
|
122
|
+
Rails 3.2.14 Last patchlevel of Rails 3.2 (many security fixes, last stable version)
|
117
123
|
Rails 4.0.0 Last Release of Rails 4.0
|
118
124
|
|
119
125
|
* PostgreSQL versions 8.3.6 and 9.2.4.
|
120
126
|
|
121
127
|
|
122
|
-
|
128
|
+
## Development / Contributing
|
129
|
+
|
130
|
+
If you find any problem, please feel free to open an 'issue' at [GitHub](https://github.com/CarlosCD/cant_wait).
|
131
|
+
|
132
|
+
Contributing:
|
133
|
+
|
134
|
+
1. Fork it
|
135
|
+
2. Create your feature branch (<tt>git checkout -b my-new-feature</tt>)
|
136
|
+
3. Commit your changes (<tt>git commit -am "Add some feature"</tt>)
|
137
|
+
4. Push to the branch (<tt>git push origin my-new-feature</tt>)
|
138
|
+
5. Create new Pull Request
|
139
|
+
|
140
|
+
|
141
|
+
August 2013
|