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.
- checksums.yaml +4 -4
- data/Rakefile +1 -19
- data/lib/generators/view/templates/migration.rb +5 -0
- data/lib/generators/{views → view}/templates/view.sql +0 -0
- data/lib/generators/view/view_generator.rb +24 -0
- data/lib/views.rb +7 -50
- data/lib/views/extensions/active_record/abstract_adapter.rb +17 -0
- data/lib/views/extensions/active_record/command_recorder.rb +26 -0
- data/lib/views/extensions/active_record/postgresql_adapter.rb +39 -0
- data/lib/views/extensions/active_record/schema_dumper.rb +28 -0
- data/lib/views/railtie.rb +17 -0
- data/lib/views/version.rb +3 -1
- data/test/dummy/bin/bundle +1 -0
- data/test/dummy/bin/rails +1 -0
- data/test/dummy/bin/rake +1 -0
- data/test/dummy/bin/setup +2 -1
- data/test/dummy/config/database.yml +2 -5
- data/test/dummy/config/database.yml.travis +2 -11
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/initializers/mime_types.rb +1 -1
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/db/migrate/20161125151623_create_guitars_view.rb +5 -0
- data/test/dummy/db/schema.rb +3 -1
- data/test/dummy/db/views/guitars.sql +2 -2
- data/test/dummy/log/development.log +2897 -24
- data/test/dummy/log/test.log +1545 -915
- data/test/dummy/public/404.html +57 -63
- data/test/dummy/public/422.html +57 -63
- data/test/dummy/public/500.html +56 -62
- data/test/{generators_test.rb → generator_test.rb} +4 -4
- data/test/migration_test.rb +20 -0
- data/test/task_test.rb +25 -0
- metadata +19 -10
- data/lib/generators/views/view_generator.rb +0 -15
- data/lib/tasks/views.rake +0 -7
- 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
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
|