views 0.0.1 → 4.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -19
  3. data/lib/generators/view/templates/migration.rb +5 -0
  4. data/lib/generators/{views → view}/templates/view.sql +0 -0
  5. data/lib/generators/view/view_generator.rb +24 -0
  6. data/lib/views.rb +7 -50
  7. data/lib/views/extensions/active_record/abstract_adapter.rb +17 -0
  8. data/lib/views/extensions/active_record/command_recorder.rb +26 -0
  9. data/lib/views/extensions/active_record/postgresql_adapter.rb +39 -0
  10. data/lib/views/extensions/active_record/schema_dumper.rb +28 -0
  11. data/lib/views/railtie.rb +17 -0
  12. data/lib/views/version.rb +3 -1
  13. data/test/dummy/bin/bundle +1 -0
  14. data/test/dummy/bin/rails +1 -0
  15. data/test/dummy/bin/rake +1 -0
  16. data/test/dummy/bin/setup +2 -1
  17. data/test/dummy/config/database.yml +2 -5
  18. data/test/dummy/config/database.yml.travis +2 -11
  19. data/test/dummy/config/environments/development.rb +1 -1
  20. data/test/dummy/config/environments/production.rb +1 -1
  21. data/test/dummy/config/environments/test.rb +2 -2
  22. data/test/dummy/config/initializers/mime_types.rb +1 -1
  23. data/test/dummy/config/secrets.yml +2 -2
  24. data/test/dummy/db/migrate/20161125151623_create_guitars_view.rb +5 -0
  25. data/test/dummy/db/schema.rb +3 -1
  26. data/test/dummy/db/views/guitars.sql +2 -2
  27. data/test/dummy/log/development.log +2897 -24
  28. data/test/dummy/log/test.log +1545 -915
  29. data/test/dummy/public/404.html +57 -63
  30. data/test/dummy/public/422.html +57 -63
  31. data/test/dummy/public/500.html +56 -62
  32. data/test/{generators_test.rb → generator_test.rb} +4 -4
  33. data/test/migration_test.rb +20 -0
  34. data/test/task_test.rb +25 -0
  35. metadata +19 -10
  36. data/lib/generators/views/view_generator.rb +0 -15
  37. data/lib/tasks/views.rake +0 -7
  38. data/test/tasks_test.rb +0 -28
@@ -1,15 +0,0 @@
1
- require 'rails/generators/named_base'
2
-
3
- module Views
4
- module Generators
5
- class ViewGenerator < Rails::Generators::NamedBase
6
-
7
- source_root File.expand_path('../templates', __FILE__)
8
-
9
- def create_fixture_file
10
- template 'view.sql', "db/views/#{table_name}.sql"
11
- end
12
-
13
- end
14
- end
15
- end
data/lib/tasks/views.rake DELETED
@@ -1,7 +0,0 @@
1
- namespace :db do
2
- namespace :views do
3
- task sync: :environment do
4
- Views.sync
5
- end
6
- end
7
- end
data/test/tasks_test.rb DELETED
@@ -1,28 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TasksTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- load File.expand_path('../../lib/tasks/views.rake', __FILE__)
7
- Rake::Task.define_task :environment
8
- FileUtils.rm_rf Rails.root.join('tmp/digests/db/views')
9
- end
10
-
11
- test 'sync' do
12
- Product.create(name: 'Les Paul', category: 'Guitar')
13
- Product.create(name: 'Laney', category: 'Amps')
14
-
15
- Rake::Task['db:views:sync'].invoke
16
- assert_equal 1, connection.execute('SELECT * FROM guitars').to_a.size
17
-
18
- connection.expects(:execute).never
19
- Rake::Task['db:views:sync'].invoke
20
- end
21
-
22
- private
23
-
24
- def connection
25
- ActiveRecord::Base.connection
26
- end
27
-
28
- end