Skip to content

Commit

Permalink
Enforce explicitly requiring tidus_views.rake
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Schoknecht committed Dec 18, 2023
1 parent 8e3b58a commit a5dead2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
tidus (1.3.2)
tidus (1.3.3)
activerecord (>= 5.2)

GEM
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions lib/tidus.rb
Expand Up @@ -9,5 +9,6 @@
require 'tidus/strategies/base_selector'
Dir["#{File.dirname(__FILE__)}/tidus/strategies/**/*.rb"].each { |f| require f }

load 'active_record/railties/databases.rake' if defined?(Rails)
load 'tasks/views.rake'
if !defined?(Rails)
load 'tasks/tidus_views.rake'
end
2 changes: 1 addition & 1 deletion lib/tidus/version.rb
@@ -1,3 +1,3 @@
module Tidus
VERSION = "1.3.2"
VERSION = "1.3.3"
end
3 changes: 2 additions & 1 deletion readme.md
Expand Up @@ -12,7 +12,8 @@ Tidus is a Ruby Gem which works in conjunction with ActiveRecord to automaticall

2. Require the Gem at any point after ActiveRecord but before loading the models. Rails requires all Gems in the Gemfile by default.
3. Add your anonymization rules
4. Execute `rake db:migrate`. The `db:clear_views` and `db:generate_views` tasks are hooked to automatically run every time before and after execution of `db:migrate` or `db:rollback`.
4. Add `load 'tasks/tidus_views.rake'` after `Rails.application.load_tasks` in the Rakefile if it is a Rails application. Otherwise it will be required automatically.
5. Execute `rake db:migrate`. The `db:clear_views` and `db:generate_views` tasks are hooked to automatically run every time before and after execution of `db:migrate` or `db:rollback`.

## Anonymization rules
The rules to ensure anonymization can be defined as follows
Expand Down
Expand Up @@ -4,7 +4,7 @@
before(:each) do
Rake.application = @rake = Rake::Application.new
load 'active_record/railties/databases.rake'
load "lib/tasks/views.rake"
load "lib/tasks/tidus_views.rake"
$stdout.stub(:write) # suppress output from rake task
end

Expand Down

0 comments on commit a5dead2

Please sign in to comment.