attr_masker 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84f6dabd5fc0ea9d919da16d60ca4b06c46b2c97
4
- data.tar.gz: 72d8b8eeb8eb59a24c7613c752fb8c2175be566f
3
+ metadata.gz: d3d3045f0f336eb0d130431423de2ff87b179df1
4
+ data.tar.gz: 26153a076aeaccb2ea5a6bd31303fee820d02878
5
5
  SHA512:
6
- metadata.gz: 0274cb6920ce73043fff153a27c8140cfb3fa9ec095a020c1fe5f4180e1339d0ad75bb41cccf5a68573d351b3fb4b98ced45829ff836729e2c7966a8b9b3316e
7
- data.tar.gz: 3e13de85e38714f92b9a10cbdcae9178ea6bf81ebca353b63e764ed33d797e759cb489803ee22f006883548b9d2ca1daad2ee2ceb17658da16d92f9097651015
6
+ metadata.gz: 29d8df9cd78a25f87e1071abee8e90d7205a6b8adb300c195ae807af9fabdf1683f3f79d59e6ac6d3882aa3dc5f20431efcb267e64b0f51827248946a38e9cbc
7
+ data.tar.gz: 3206a778cb2fdad5b91ab0cf035678ed4454b1b1c743e6198145f65fb23528a0b3be0bf7f2038619e65412872e8f6b6251d55b8372ecdce209970cd9fd9af2e1
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.rspec_status
2
2
  /.ruby-version
3
3
  /.ruby-gemset
4
+ /pkg
4
5
  /Gemfile.lock
5
- /spec/dummy/log/*.log
6
+ /spec/dummy/log/*.log
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,10 @@
1
1
  == Not released yet
2
2
 
3
+ == 0.2.1
4
+
5
+ * Bugfix: preload application to find all models
6
+ * Bugfix: require all dependencies correctly
7
+
3
8
  == 0.2.0
4
9
 
5
10
  * `AttrMasker::Maskers::Simple` is now a class
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rack/cleanser"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/rake ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # rubocop:disable all
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require "rubygems"
16
+ require "bundler/setup"
17
+
18
+ load Gem.bin_path("rake", "rake")
data/bin/rspec ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # rubocop:disable all
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require "rubygems"
16
+ require "bundler/setup"
17
+
18
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/rubocop ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # rubocop:disable all
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require "rubygems"
16
+ require "bundler/setup"
17
+
18
+ load Gem.bin_path("rubocop", "rubocop")
data/bin/setup ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ # rubocop:disable all
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+ set -vx
6
+
7
+ bundle install
8
+
9
+ # Do any other automated setup that you need to do here
data/lib/attr_masker.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # (c) 2017 Ribose Inc.
2
2
  #
3
3
 
4
+ require "ruby-progressbar"
5
+
4
6
  # Adds attr_accessors that mask an object's attributes
5
7
  module AttrMasker
6
8
  autoload :Version, "attr_masker/version"
@@ -6,7 +6,7 @@ module AttrMasker
6
6
  module Version
7
7
  MAJOR = 0
8
8
  MINOR = 2
9
- PATCH = 0
9
+ PATCH = 1
10
10
 
11
11
  # Returns a version string by joining <tt>MAJOR</tt>, <tt>MINOR</tt>, and
12
12
  # <tt>PATCH</tt> with <tt>'.'</tt>
data/lib/tasks/db.rake CHANGED
@@ -16,6 +16,8 @@ namespace :db do
16
16
  # http://stackoverflow.com/questions/14163938/activerecordconnectionnotestablished-within-a-rake-task
17
17
  #
18
18
  task :mask => :environment do
19
+ Rails.application.eager_load!
20
+
19
21
  performers = AttrMasker::Performer::Base.descendants.map(&:new)
20
22
  performers.select!(&:dependencies_available?)
21
23
 
@@ -0,0 +1,2 @@
1
+ class NonPersistedModel
2
+ end
@@ -0,0 +1,14 @@
1
+ # (c) 2017 Ribose Inc.
2
+ #
3
+
4
+ require "spec_helper"
5
+
6
+ RSpec.describe "db:mask", :suppress_progressbar do
7
+ subject { Rake::Task["db:mask"] }
8
+
9
+ it "loads all application's models eagerly" do
10
+ expect(Rails.application).to receive(:eager_load!)
11
+ subject.execute
12
+ expect(defined? NonPersistedModel).to be_truthy
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_masker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-03 00:00:00.000000000 Z
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -160,7 +160,12 @@ description: It is desired to mask certain attributes of certain models by modif
160
160
  the database.
161
161
  email:
162
162
  - open.source@ribose.com
163
- executables: []
163
+ executables:
164
+ - console
165
+ - rake
166
+ - rspec
167
+ - rubocop
168
+ - setup
164
169
  extensions: []
165
170
  extra_rdoc_files: []
166
171
  files:
@@ -176,6 +181,11 @@ files:
176
181
  - README.adoc
177
182
  - Rakefile
178
183
  - attr_masker.gemspec
184
+ - bin/console
185
+ - bin/rake
186
+ - bin/rspec
187
+ - bin/rubocop
188
+ - bin/setup
179
189
  - config.ru
180
190
  - gemfiles/Rails-4.0.gemfile
181
191
  - gemfiles/Rails-4.1.gemfile
@@ -194,6 +204,7 @@ files:
194
204
  - lib/attr_masker/railtie.rb
195
205
  - lib/attr_masker/version.rb
196
206
  - lib/tasks/db.rake
207
+ - spec/dummy/app/models/non_persisted_model.rb
197
208
  - spec/dummy/config/database.yml
198
209
  - spec/dummy/config/mongoid.yml
199
210
  - spec/dummy/config/routes.rb
@@ -213,6 +224,7 @@ files:
213
224
  - spec/unit/maskers/replacing_spec.rb
214
225
  - spec/unit/maskers/simple_spec.rb
215
226
  - spec/unit/model_spec.rb
227
+ - spec/unit/rake_task_spec.rb
216
228
  homepage: https://github.com/riboseinc/attr_masker
217
229
  licenses:
218
230
  - MIT
@@ -238,6 +250,7 @@ signing_key:
238
250
  specification_version: 4
239
251
  summary: Masking attributes
240
252
  test_files:
253
+ - spec/dummy/app/models/non_persisted_model.rb
241
254
  - spec/dummy/config/database.yml
242
255
  - spec/dummy/config/mongoid.yml
243
256
  - spec/dummy/config/routes.rb
@@ -257,3 +270,4 @@ test_files:
257
270
  - spec/unit/maskers/replacing_spec.rb
258
271
  - spec/unit/maskers/simple_spec.rb
259
272
  - spec/unit/model_spec.rb
273
+ - spec/unit/rake_task_spec.rb