activerecord_views 0.0.18 → 0.0.19

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: 3311e70b5371fad5e3e179b012cd73157503ba33
4
- data.tar.gz: 570acd248425e41f312240c6ffd3f6ec76c4e99a
3
+ metadata.gz: 4abfbb8e0d3997f414810c95fec10c72d205b496
4
+ data.tar.gz: 0a441b8cbf5102e31a6dcabe631aca2ba0573448
5
5
  SHA512:
6
- metadata.gz: 32f32cc5728ec20db1b1342baaad6763c75116ce411fd59939449a71def61571405017654ffb8b47744b2ae0dbb394e0873b770bf1574a48ac626f716edf9355
7
- data.tar.gz: c4f8fb9024b8bdcd0c540e520e4a5280d406b55879ff1ff438ff44b405fd59c10a6cbde8d217906bdcd8e76c3210a073b9be9a8c10edb2e7087f18c84a1134bd
6
+ metadata.gz: 32ea38c39c48f983b5bf77343b70e2744ec15352dfabd157dbc944299a41eda074863430fb73af3840e63ea22f0c08b2b16b0ad1ca5c67a20bb675c016d6ce1a
7
+ data.tar.gz: 99df12b314ab50305db7e276ac18421c82fc01a548ccc266f71e53d3ad4c13d37e60f21d2399068691fe9be88384b19ba7fd177a97fe054102d95298d616584b
@@ -4,10 +4,10 @@ module ActiveRecordViews
4
4
  ActiveSupport.on_load :active_record do
5
5
  ActiveRecordViews.sql_load_path << Rails.root + 'app/models'
6
6
  ActiveRecordViews.init!
7
+ ActiveRecordViews::Extension.create_enabled = !Rails.env.production?
7
8
  end
8
9
 
9
10
  ActiveSupport.on_load :action_controller do
10
- ActiveRecordViews::Extension.create_enabled = !app.config.cache_classes
11
11
  unless app.config.cache_classes
12
12
  ActionDispatch::Callbacks.before do
13
13
  ActiveRecordViews.reload_stale_views!
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordViews
2
- VERSION = '0.0.18'
2
+ VERSION = '0.0.19'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  Rake::Task['db:migrate'].enhance do
2
- if Rails.application.config.cache_classes
2
+ unless ActiveRecordViews::Extension.create_enabled
3
3
  Rails.application.eager_load!
4
4
  ActiveRecordViews::Extension.process_create_queue!
5
5
  ActiveRecordViews.drop_unregistered_views!
@@ -8,7 +8,8 @@ Combustion::Database.instance_eval do
8
8
  end
9
9
 
10
10
  Combustion.initialize! :active_record, :action_controller do
11
- config.cache_classes = ENV['CACHE_CLASSES'] == 'true'
11
+ config.cache_classes = false
12
+ config.log_level = :debug
12
13
  end
13
14
 
14
15
  load 'active_record/railties/databases.rake'
@@ -1,4 +1,8 @@
1
- test:
1
+ test: &test
2
2
  adapter: postgresql
3
3
  database: activerecord_views_test
4
4
  min_messages: warning
5
+ development:
6
+ <<: *test
7
+ production:
8
+ <<: *test
data/spec/tasks_spec.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'rake tasks' do
4
- def rake(task_name, cache_classes: false)
4
+ def rake(task_name, production: false)
5
5
  system(*%W[
6
6
  rake
7
7
  -f spec/internal/Rakefile
8
8
  #{task_name}
9
- CACHE_CLASSES=#{cache_classes}
9
+ RAILS_ENV=#{production ? 'production' : 'development'}
10
10
  ])
11
11
  raise unless $?.success?
12
12
  end
@@ -26,9 +26,9 @@ describe 'rake tasks' do
26
26
  expect(view_names).to be_empty
27
27
  end
28
28
 
29
- it 'creates database views when classes are cached (production mode)' do
29
+ it 'creates database views in production mode' do
30
30
  expect(view_names).to be_empty
31
- rake 'db:migrate', cache_classes: true
31
+ rake 'db:migrate', production: true
32
32
  expect(view_names).to_not be_empty
33
33
  end
34
34
 
@@ -43,9 +43,9 @@ describe 'rake tasks' do
43
43
  expect(view_names).to include 'old_view'
44
44
  end
45
45
 
46
- it 'drops unregistered views when classes are cached (production mode)' do
46
+ it 'drops unregistered views in production mode' do
47
47
  expect(view_names).to include 'old_view'
48
- rake 'db:migrate', cache_classes: true
48
+ rake 'db:migrate', production: true
49
49
  expect(view_names).to_not include 'old_view'
50
50
  end
51
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_views
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Weathered