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.
Files changed (75) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +3 -15
  5. data/.travis.yml +5 -5
  6. data/CHANGELOG.md +21 -0
  7. data/README.md +33 -27
  8. data/cant_wait.gemspec +7 -7
  9. data/cert/README.md +70 -0
  10. data/cert/public_cert.pem +21 -0
  11. data/lib/cant_wait.rb +2 -0
  12. data/lib/cant_wait/cant_wait_railtie.rb +2 -0
  13. data/lib/cant_wait/version.rb +3 -1
  14. data/tasks/testing.rake +2 -2
  15. data/test/README.md +44 -25
  16. data/test/cant_wait_test.rb +8 -12
  17. data/test/test_apps/Test_3_0_03/Gemfile +0 -2
  18. data/test/test_apps/Test_3_0_20/Gemfile +0 -2
  19. data/test/test_apps/Test_3_1_12/Gemfile +0 -2
  20. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/Gemfile +1 -3
  21. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/README.rdoc +0 -0
  22. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/Rakefile +1 -1
  23. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/assets/images/rails.png +0 -0
  24. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/assets/javascripts/application.js +0 -0
  25. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/assets/stylesheets/application.css +0 -0
  26. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/controllers/application_controller.rb +0 -0
  27. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/helpers/application_helper.rb +0 -0
  28. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/mailers/.gitkeep +0 -0
  29. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/models/.gitkeep +0 -0
  30. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/app/views/layouts/application.html.erb +1 -1
  31. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config.ru +1 -1
  32. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/application.rb +1 -1
  33. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/boot.rb +0 -0
  34. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environment.rb +1 -1
  35. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environments/development.rb +1 -1
  36. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environments/production.rb +1 -1
  37. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/environments/test.rb +1 -1
  38. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/backtrace_silencers.rb +0 -0
  39. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/inflections.rb +0 -0
  40. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/mime_types.rb +0 -0
  41. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/secret_token.rb +1 -1
  42. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/session_store.rb +2 -2
  43. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/initializers/wrap_parameters.rb +0 -0
  44. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/locales/en.yml +0 -0
  45. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/config/routes.rb +1 -1
  46. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/db/seeds.rb +0 -0
  47. data/test/test_apps/Test_3_2_14/doc/README_FOR_APP +2 -0
  48. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/lib/assets/.gitkeep +0 -0
  49. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/lib/tasks/.gitkeep +0 -0
  50. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/log/.gitkeep +0 -0
  51. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/404.html +0 -0
  52. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/422.html +0 -0
  53. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/500.html +0 -0
  54. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/favicon.ico +0 -0
  55. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/index.html +0 -0
  56. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/public/robots.txt +0 -0
  57. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/script/rails +0 -0
  58. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/fixtures/.gitkeep +0 -0
  59. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/functional/.gitkeep +0 -0
  60. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/integration/.gitkeep +0 -0
  61. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/performance/browsing_test.rb +0 -0
  62. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/test_helper.rb +0 -0
  63. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/test/unit/.gitkeep +0 -0
  64. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/vendor/assets/javascripts/.gitkeep +0 -0
  65. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/vendor/assets/stylesheets/.gitkeep +0 -0
  66. data/test/test_apps/{Test_3_2_13 → Test_3_2_14}/vendor/plugins/.gitkeep +0 -0
  67. data/test/test_apps/Test_4_0_0/Gemfile +0 -2
  68. metadata +127 -144
  69. metadata.gz.sig +0 -0
  70. data/test/test_apps/Test_3_0_03/.gitignore +0 -12
  71. data/test/test_apps/Test_3_0_20/.gitignore +0 -12
  72. data/test/test_apps/Test_3_1_12/.gitignore +0 -12
  73. data/test/test_apps/Test_3_2_13/.gitignore +0 -12
  74. data/test/test_apps/Test_4_0_0/.gitignore +0 -16
  75. 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
- OTVmY2I3NmViN2ZiZDJhNjZlNzExNzNlNmIxYTdkYmI2MTQ5NmY5MA==
4
+ YWJhMmUzZDZjYjBhMmVjN2FiZjk4YTdjNjcwMTY2ZTYyY2EyYzBjMQ==
5
5
  data.tar.gz: !binary |-
6
- ODE0OWFkYmFiMTg3ZGYzMmEzZTIwY2JiNDRhMjk4NjY0Yzc2MWE1NA==
6
+ MmZmYzczMjRiZTRiN2I5NGRmMDhkNTZlODI5YTdmNDA1ZmRlNDYxMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDM5NTE4N2ZkODQ3OWJlOTVhM2E4YTNmZjk1YTU4Njk5NjMzZTg3YjhmOGJl
10
- MGQ0ZWQ1MzhkMjZkZTAzZWQ1MDVhMzg4ZGY5YzUzZjY2OGFhMzE5YjdiNzVm
11
- NmRhOTVlYmNmYWQ0NDg5MDljYTg2YjJkNWM4ZmY1NzI2MDg3Y2M=
9
+ ZTIzNzc0MzA4Yzg4YTI5MGExNjJmNzE2OGYyOTg5OWJhZjJkMTQwNGY1YTM5
10
+ ODM5MWFjZjEyN2Y1NDUyZjRiMjRiM2E1MzcyMzEzNDk0YzE3NzUwNjYyNmM2
11
+ MTBjNmJjMjU4MzI3OTBlMzA3NmFhYjVlMGNmODYyZDg3NGYyNTA=
12
12
  data.tar.gz: !binary |-
13
- YzkxZmExZTk1ZjJhNjJlNjkzMzVlZGEyODhhMGM0ODI2ZTBlM2E0YTg5YjRj
14
- NzQzYjEzZTMwNTc1ODU3Njg2MTVlNjEzNWE4YTUzNjRkZGEzYWMwYzA4YWQ4
15
- ZDlhNTlhOTYxZDVlNDlhNzgzNmNlN2JlYmNjYTVhOGU2NDU1MGE=
13
+ MTI2ZjIwNjRkNGY4YjU4YmNjODQ4ZmZhZjA4MWVkZjEwN2M4MzdkOTdlNjA2
14
+ YzdjMGY2Mjg4NjU5M2NhNTQ1MGUyNjM4N2FmYjUxNjY1ZjNkZGJjZDBkNGE0
15
+ NTExZmUxMDI1ODZhYzg0YzIzZGEyNWM2ODE0MDU1MTc0ZGM1YmE=
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
- .yardoc
2
+ *.gem
7
3
  Gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
4
  pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
5
+ test/test_apps/Test_*/log/*.log
6
+ test/test_apps/Test_*/config/database.yml
@@ -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 (last was 1.7.3)
7
- - rbx-19mode # Rubinius in 1.9 mode (last was 2.0.0, weekly build)
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), installing the last version of Rails
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
- # And here we remove Rails to allow its coexistence with others
13
- - gem uninstall rails # It used to be a singleton...
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
@@ -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 allows to add a statement timeout for PostgreSQL databases within a Ruby on Rails application.
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 a PGError exception.
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
- If you find any problems, please feel free to open an issue in the gem repository ([GitHub](https://github.com/CarlosCD/cant_wait)).
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
- ## Installation
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
- ## Dependencies
58
+ The minimum version of ruby is MRI 1.9.1 or compatible, as the gem uses 1.9 syntax.
56
59
 
57
- Previous versions of Rails are not compatible with the last version of bundler, so the minimum requirement is Rails 3.0.3.
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 just fine with a Ruby flavors/versions not listed above.
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
- See the development documentation for more details.
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 / Contributing
85
+ ## Development
77
86
 
78
- * Source hosted on [GitHub](https://github.com/CarlosCD/cant_wait)
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
- Contributing:
89
+ These files could be of particular interest:
82
90
 
83
- 1. Fork it
84
- 2. Create your feature branch (`git checkout -b my-new-feature`)
85
- 3. Commit your changes (`git commit -am 'Add some feature'`)
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
- June 2013
101
+ August 2013
@@ -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 = 'cant_wait'
8
- spec.version = CantWait::VERSION
9
- spec.platform = Gem::Platform::RUBY
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.signing_key = '/users/CarlosCD/.ssh/private_key.pem'
26
- spec.cert_chain = ['/users/CarlosCD/.ssh/public_cert.pem']
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
@@ -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-----
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  begin
2
4
  require 'cant_wait/version'
3
5
  require 'cant_wait/cant_wait_railtie' if defined? Rails
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  module CantWait
2
4
 
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  module CantWait
2
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
3
5
  end
@@ -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.13', rails_root: 'test/test_apps/Test_3_2_13'},
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']}'" if verbose
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
@@ -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 rvm (not a need if other ruby version manager is preferred).
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 that Rails loads and of how it changes in the default Ruby behavior. I opted here to test the same way an end user would use the gem.
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 in different Rails versions requires running several Rails Apps either simultaneously or sequentially. Even if it is done in different threads, being a Rails App a singleton, it will result in:
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 would make the test cases too distant to the real conditions you may encounter in isolated Rails applications, and even if the singleton restriction is removed, it will still apply to old versions of Rails.
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, specially when changing the version of Ruby to be used. To make it easier, I added a rake task (<tt>rake test:bundle</tt>).
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</tt>. The test goes over each rails app in sequence and:
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 Bundle to use the test app's Gemfile
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 needed, I choose not to use the rake default to run the test, just to signal the tester to stop to consider these choices.
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
- And additional <tt>rake test:all</tt> will do both the bundle install and run the tests. This is the way travis-ci is set to run.
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 Rails gems used by the test rails apps included:
80
+ 5. Get the gems used by the test Rails apps:
82
81
 
83
82
  rake test:bundle
84
83
 
85
- 6. You are now done setting all up. To run the tests:
84
+ 6. Your setup is complete. To run the tests:
86
85
 
87
86
  rake test:run
88
87
 
89
- If so wanted, run the tests several times. The tests use different random timeout scenarios, so each run may be a bit different.
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, as well as a badge to check the status last commit.
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 (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 last patchlevel of 1.9.3) MacOS X
105
- 2.0.0-p0 (MRI) Linux
106
- 2.0.0-p195 (MRI last patchlevel of 2.0.0) MacOS X
107
- jruby 1.7.3 (java 1.7.0_15) Linux
108
- jruby 1.7.4 (java 1.6.0_45) MacOS X
109
- Rubinius 2.0.0 (1.9.3, 2013-06-12 JI) Linux
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 Last patchlevel of Rails 3.2 (many security fixes, last stable version)
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
- June 2013
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