rails_readonly_injector 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c048af88f0b2c66068ceac474300b94da63bf30a
4
- data.tar.gz: 9c2dd969f857a47fa866887c6e1e9bbe467b5dfd
3
+ metadata.gz: dee81bdb9e36457740b1f0bf42b0a426b71c529b
4
+ data.tar.gz: e1be2bdd0040986a650f2937173ef155ab03e1cb
5
5
  SHA512:
6
- metadata.gz: 751bf2c91e9798e777811577792ae4c92d6bea387ea265b13c00e15a4ed9c5598fd5b27da99cc89f6c112a0d3e35398912e6e03f963ef002962cc0b37bc4314d
7
- data.tar.gz: 3b90a488f476ccb57ab84bf6a4b255687e0e0688c4dae617222c4d8d35e0ebb867df9ccf7cddffd7a5f8531a5941b3d7a615c9b43980476aa0efc675df7d771a
6
+ metadata.gz: ba266967fd09dcbda610866e85757a92181232ab4c396c635fa0e3c697cb012c6a3219f00cd4f607d9a4e5b5967ae985306c7974fa1a68d400ab60127e938fdc
7
+ data.tar.gz: 8e764d1c867cb779f52e61434e2ecf7f392d9967efaf5abf6d048c11b94448f913240eaf303d2659bc876558a3728bd512dc8b170f1350078cb0edf3dca2234b
@@ -13,6 +13,8 @@ branches:
13
13
  only:
14
14
  - master
15
15
 
16
+ before_install:
17
+ - /bin/bash -c '[[ $BUNDLE_GEMFILE = *"rails_5_2"* ]] && { echo "Installing Cucumber-rails v1.6.0.pre..."; gem install cucumber-rails-1.6.0.pre.gem; }' || echo "Desired rails version is < 5.2. Skipping Cucumber 1.6.0.pre installation...";
16
18
 
17
19
  before_script:
18
20
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
@@ -29,6 +31,7 @@ gemfile:
29
31
  - gemfiles/rails_4_2.gemfile
30
32
  - gemfiles/rails_5_0.gemfile
31
33
  - gemfiles/rails_5_1.gemfile
34
+ - gemfiles/rails_5_2.gemfile
32
35
 
33
36
  matrix:
34
37
  fast_finish: true
@@ -41,6 +44,8 @@ matrix:
41
44
  gemfile: gemfiles/rails_5_0.gemfile
42
45
  - rvm: 2.1.3
43
46
  gemfile: gemfiles/rails_5_1.gemfile
47
+ - rvm: 2.1.3
48
+ gemfile: gemfiles/rails_5_2.gemfile
44
49
  - rvm: 2.2.7
45
50
  gemfile: gemfiles/rails_3.gemfile
46
51
  - rvm: 2.3.6
data/Appraisals CHANGED
@@ -43,4 +43,11 @@ appraise 'rails_5_1' do
43
43
  gem 'cucumber-rails', '~> 1.5.0', group: :test, require: false
44
44
  gem 'rspec-rails', '~> 3.7.2', group: :test
45
45
  gem 'database_cleaner', '~> 1.0.1'
46
+ end
47
+
48
+ appraise 'rails_5_2' do
49
+ gem 'rails', '~> 5.2.0'
50
+ gem 'cucumber-rails', '~> 1.6.0.pre', group: :test, require: false
51
+ gem 'rspec-rails', '~> 3.7.2', group: :test
52
+ gem 'database_cleaner', '~> 1.0.1'
46
53
  end
@@ -1,3 +1,5 @@
1
+ ## 1.0.1
2
+ - Added support for Rails 5.2
1
3
  ## 1.0.0
2
4
  - Removed the ability to read the current read-only status using `RailsReadonlyInjector.config.read_only`, and replaced it with `RailsReadonlyInjector.in_read_only_mode?`.
3
5
  ## 0.3.0
@@ -1,26 +1,134 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_readonly_injector (0.1.0)
4
+ rails_readonly_injector (1.0.0)
5
+ rails (>= 3.0, <= 5.2)
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ actioncable (5.2.0)
11
+ actionpack (= 5.2.0)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.0)
15
+ actionpack (= 5.2.0)
16
+ actionview (= 5.2.0)
17
+ activejob (= 5.2.0)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.2.0)
21
+ actionview (= 5.2.0)
22
+ activesupport (= 5.2.0)
23
+ rack (~> 2.0)
24
+ rack-test (>= 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.2.0)
28
+ activesupport (= 5.2.0)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.2.0)
34
+ activesupport (= 5.2.0)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.2.0)
37
+ activesupport (= 5.2.0)
38
+ activerecord (5.2.0)
39
+ activemodel (= 5.2.0)
40
+ activesupport (= 5.2.0)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.0)
43
+ actionpack (= 5.2.0)
44
+ activerecord (= 5.2.0)
45
+ marcel (~> 0.3.1)
46
+ activesupport (5.2.0)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
48
+ i18n (>= 0.7, < 2)
49
+ minitest (~> 5.1)
50
+ tzinfo (~> 1.1)
9
51
  appraisal (2.2.0)
10
52
  bundler
11
53
  rake
12
54
  thor (>= 0.14.0)
55
+ arel (9.0.0)
56
+ builder (3.2.3)
57
+ concurrent-ruby (1.0.5)
58
+ crass (1.0.4)
59
+ erubi (1.7.1)
60
+ globalid (0.4.1)
61
+ activesupport (>= 4.2.0)
62
+ i18n (1.0.1)
63
+ concurrent-ruby (~> 1.0)
64
+ loofah (2.2.2)
65
+ crass (~> 1.0.2)
66
+ nokogiri (>= 1.5.9)
67
+ mail (2.7.0)
68
+ mini_mime (>= 0.1.1)
69
+ marcel (0.3.2)
70
+ mimemagic (~> 0.3.2)
71
+ method_source (0.9.0)
72
+ mimemagic (0.3.2)
73
+ mini_mime (1.0.0)
74
+ mini_portile2 (2.3.0)
75
+ minitest (5.11.3)
76
+ nio4r (2.3.0)
77
+ nokogiri (1.8.2)
78
+ mini_portile2 (~> 2.3.0)
79
+ rack (2.0.4)
80
+ rack-test (1.0.0)
81
+ rack (>= 1.0, < 3)
82
+ rails (5.2.0)
83
+ actioncable (= 5.2.0)
84
+ actionmailer (= 5.2.0)
85
+ actionpack (= 5.2.0)
86
+ actionview (= 5.2.0)
87
+ activejob (= 5.2.0)
88
+ activemodel (= 5.2.0)
89
+ activerecord (= 5.2.0)
90
+ activestorage (= 5.2.0)
91
+ activesupport (= 5.2.0)
92
+ bundler (>= 1.3.0)
93
+ railties (= 5.2.0)
94
+ sprockets-rails (>= 2.0.0)
95
+ rails-dom-testing (2.0.3)
96
+ activesupport (>= 4.2.0)
97
+ nokogiri (>= 1.6)
98
+ rails-html-sanitizer (1.0.4)
99
+ loofah (~> 2.2, >= 2.2.2)
100
+ railties (5.2.0)
101
+ actionpack (= 5.2.0)
102
+ activesupport (= 5.2.0)
103
+ method_source
104
+ rake (>= 0.8.7)
105
+ thor (>= 0.18.1, < 2.0)
13
106
  rake (10.5.0)
107
+ sprockets (3.7.1)
108
+ concurrent-ruby (~> 1.0)
109
+ rack (> 1, < 3)
110
+ sprockets-rails (3.2.1)
111
+ actionpack (>= 4.0)
112
+ activesupport (>= 4.0)
113
+ sprockets (>= 3.0.0)
14
114
  thor (0.20.0)
115
+ thread_safe (0.3.6)
116
+ tzinfo (1.2.5)
117
+ thread_safe (~> 0.1)
118
+ websocket-driver (0.7.0)
119
+ websocket-extensions (>= 0.1.0)
120
+ websocket-extensions (0.1.3)
121
+ yard (0.9.12)
15
122
 
16
123
  PLATFORMS
17
124
  ruby
18
125
 
19
126
  DEPENDENCIES
20
- appraisal (~> 2.2.0)
127
+ appraisal (~> 2.2)
21
128
  bundler (~> 1.16)
22
129
  rails_readonly_injector!
23
130
  rake (~> 10.0)
131
+ yard (~> 0.9.12)
24
132
 
25
133
  BUNDLED WITH
26
134
  1.16.1
data/README.md CHANGED
@@ -25,14 +25,16 @@ Or install it yourself as:
25
25
 
26
26
  ## Usage
27
27
 
28
- In order to switch a complete site into read-only mode, you will first need to set the action to occur when an attempt to commit changes to the database is made, from within a controller. Usually, this won't need to change once the application has booted, so I recommend defining it within an initializer, as follows:
28
+ In order to switch a complete site into read-only mode, you will first need to set the action to occur when an attempt to commit changes to the database is made, from within a controller. This action will be executed from within the context of the referring controller.
29
+
30
+ Usually, this won't need to change once the application has booted, so I recommend defining it within an initializer, as follows:
29
31
 
30
32
  ```
31
33
  # config/initializers/rails_readonly_injector.rb
32
34
  RailsReadonlyInjector.config do |config|
33
35
  config.controller_rescue_action = lambda do |context|
34
36
  # Define actions to be performed if changes to a read-only model are attempted to be committed to the database.
35
- # This lambda expression is evaluated from within the instance of the referring controller.
37
+ # This lambda expression is evaluated from within the context of the referring controller.
36
38
 
37
39
  # You may want to set a redirect, or flash an error message, or something, here.
38
40
  # e.g.
@@ -42,13 +44,19 @@ RailsReadonlyInjector.config do |config|
42
44
  end
43
45
  ```
44
46
 
45
- When you want to switch a site into read-only mode, you can then simply set `RailsReadonlyInjector.read_only` to true and then call `RailsReadonlyInjector.reload!` to (re-)load the configuration. Alternatively, you can also set `read_only` from within the configuration block inside the initializer.
47
+ When you want to switch a site into read-only mode, you can then simply
48
+ * set `RailsReadOnlyInjector.config.read_only` to true, and then
49
+ * call `RailsReadonlyInjector.reload!` to (re-)load the configuration.
50
+
51
+ Alternatively, you can also set `read_only` from within the configuration block inside the initializer.
46
52
 
47
53
  If you want to reset the configuration to the defaults, you can simply call `RailsReadonlyInjector.reset_configuration!` from anywhere in your application.
48
54
 
49
55
  If you want to check whether read-only mode is currently enabled, you can use `RailsReadonlyInjector.in_read_only_mode?`.
50
56
 
51
57
  ## Configuration Options
58
+ The following configuration options can be set through `RailsReadonlyInjector.config`:
59
+
52
60
  - `read_only` => Whether the site should be in read-only mode. (Default: false)
53
61
  - `classes_to_exclude` => An array of classes that should be _exempt_ from read-only mode. (Default: `[]`)
54
62
  - `classes_to_include` => An array of classes that should be set to read-only mode. (Defaults to `ActiveRecord::Base.descendants` on Rails 3-4, and `ApplicationRecord.descendants` on Rails 5.0+)
@@ -58,16 +66,15 @@ If you want to check whether read-only mode is currently enabled, you can use `R
58
66
 
59
67
  After checking out the repo, run `bundle install` to install the dependencies.
60
68
 
61
- RSpec specs and Cucumber features are stored in `rspec_specs` and `cucumber_features`, respectively. When `bundle exec rake` is run against an appraisal, the contents of these folders are copied to the necessary folders under the temporary rails application that is generated (by `bundle exec rake`) into `tmp/rails_app`.
62
-
63
- To run tests for a specific version of Rails, simply run `bundle exec appraisal {APPRAISAL} bundle exec rake`, where `{APPRAISAL}` is one of the appraisals found under `Appraisals`.
69
+ RSpec specs and Cucumber features are stored in `rspec_specs` and `cucumber_features`, respectively. When `bundle exec rake` is run against an appraisal, the contents of these folders are copied to the necessary folders under the temporary rails application that `bundle exec rake` generates into `tmp/rails_app`.
64
70
 
65
- If you don't want to re-build the application each time you run tests, you can execute one of the following rake tasks against an appraisal:
71
+ To run tests for a specific version of Rails, simply run `bundle exec appraisal {APPRAISAL} bundle exec rake`, where `{APPRAISAL}` is one of the appraisals found under `Appraisals`. e.g. `bundle exec appraisal rails_4_1 bundle exec rake`
66
72
 
67
- * `dev:run_features` => Synchronises features from `cucumber_features` into the temporary rails application, and runs them against the application.
68
- * `dev:run_specs` => Synchronises specs from `rspec_specs` into the temporary rails application, and runs them against the application.
69
- * `dev:run_tests` => Runs both `dev:run_features` and `dev:run_specs`.
73
+ If you don't want to re-build the temporary application each time you run tests, you can execute the following rake tasks against an appraisal:
70
74
 
75
+ * `dev:run_features` => Synchronises features from `cucumber_features` into the temporary rails application, and runs cucumber against the temporary application.
76
+ * `dev:run_specs` => Synchronises specs from `rspec_specs` into the temporary rails application, and runs rspec against the temporary application.
77
+ * `dev:run_tests` => Runs both `dev:run_features` and `dev:run_specs`, and ret on failure.
71
78
 
72
79
  ## Contributing
73
80
 
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5.2.0"
6
+ gem "cucumber-rails", "~> 1.6.0.pre", group: :test, require: false
7
+ gem "rspec-rails", "~> 3.7.2", group: :test
8
+ gem "database_cleaner", "~> 1.0.1"
9
+
10
+ gemspec path: "../"
@@ -1,3 +1,3 @@
1
1
  module RailsReadonlyInjector
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.required_ruby_version = ">= 2.1.3"
24
24
 
25
- spec.add_runtime_dependency "rails", [">= 3.0", "< 5.2"]
25
+ spec.add_runtime_dependency "rails", [">= 3.0", "<= 5.2"]
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_readonly_injector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Walter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,7 +17,7 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
- - - "<"
20
+ - - "<="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.2'
23
23
  type: :runtime
@@ -27,7 +27,7 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.0'
30
- - - "<"
30
+ - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.2'
33
33
  - !ruby/object:Gem::Dependency
@@ -107,6 +107,7 @@ files:
107
107
  - Rakefile
108
108
  - bin/console
109
109
  - bin/setup
110
+ - cucumber-rails-1.6.0.pre.gem
110
111
  - cucumber_features/configuration.feature
111
112
  - cucumber_features/step_definitions/.gitkeep
112
113
  - cucumber_features/step_definitions/generic_steps.rb
@@ -124,6 +125,7 @@ files:
124
125
  - gemfiles/rails_4_2.gemfile
125
126
  - gemfiles/rails_5_0.gemfile
126
127
  - gemfiles/rails_5_1.gemfile
128
+ - gemfiles/rails_5_2.gemfile
127
129
  - lib/rails_readonly_injector.rb
128
130
  - lib/rails_readonly_injector/configuration.rb
129
131
  - lib/rails_readonly_injector/version.rb