spectacles 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.rdoc +2 -2
- data/lib/spectacles/schema_statements.rb +1 -1
- data/lib/spectacles/schema_statements/vertica_adapter.rb +25 -0
- data/lib/spectacles/version.rb +1 -1
- data/spectacles.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c4f603eca294959744110e6f109164d6beb7b1
|
4
|
+
data.tar.gz: 6d10abba5e67986bbe723234440e080851058045
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f3af5c5ef71d28aab5738ed071c8c97f2098ccad0e40e9ff6652734381cd19956adc335a8443c486316c7e8f8fce8985c0a0600e8da18be78a43c27356735f9
|
7
|
+
data.tar.gz: adfb83a2ac5413909ce3dce00cddeba1945e4d95617cfb91ba23a72eb471f4a66a899a13322cc15151fc76597eae39cea435a1b205be84cf3cc4f3daa3a3efde
|
data/Readme.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= Spectacles
|
2
2
|
|
3
|
-
Spectacles adds database view functionality to ActiveRecord. It is heavily inspired by Rails SQL Views (http://github.com/aeden/rails_sql_views/) and built from the ground-up to work with Rails 3+.
|
3
|
+
Spectacles adds database view functionality to ActiveRecord. It is heavily inspired by Rails SQL Views (http://github.com/aeden/rails_sql_views/) and built from the ground-up to work with Rails 3.2+.
|
4
4
|
|
5
5
|
Spectacles provides the ability to create views in migrations using a similar format to creating tables. It also provides an abstract view class that inherits from ActiveRecord::Base that can be used to create view-backed models.
|
6
6
|
|
7
|
-
It currently only works with the SQLite and
|
7
|
+
It currently only works with the SQLite, PostgreSQL, and Vertica drivers. MySQL & MySQL2 have a couple of issues that are still being worked out.
|
8
8
|
|
9
9
|
= Using Spectacles
|
10
10
|
Install it
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spectacles/schema_statements/abstract_adapter'
|
2
2
|
|
3
3
|
module Spectacles
|
4
|
-
SUPPORTED_ADAPTERS = %w( Mysql Mysql2 PostgreSQL SQLServer SQLite SQLite3 )
|
4
|
+
SUPPORTED_ADAPTERS = %w( Mysql Mysql2 PostgreSQL SQLServer SQLite SQLite3 Vertica )
|
5
5
|
|
6
6
|
def self.load_adapters
|
7
7
|
SUPPORTED_ADAPTERS.each do |db|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spectacles/schema_statements/abstract_adapter'
|
2
|
+
|
3
|
+
module Spectacles
|
4
|
+
module SchemaStatements
|
5
|
+
module VerticaAdapter
|
6
|
+
include Spectacles::SchemaStatements::AbstractAdapter
|
7
|
+
|
8
|
+
def views(name = nil)
|
9
|
+
q = <<-SQL
|
10
|
+
SELECT table_name FROM v_catalog.views
|
11
|
+
SQL
|
12
|
+
|
13
|
+
execute(q, name).map { |row| row['table_name'] }
|
14
|
+
end
|
15
|
+
|
16
|
+
def view_build_query(view, name = nil)
|
17
|
+
q = <<-SQL
|
18
|
+
SELECT view_definition FROM v_catalog.views WHERE table_name = '#{view}'
|
19
|
+
SQL
|
20
|
+
|
21
|
+
select_value(q, name) or raise "No view called #{view} found"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/spectacles/version.rb
CHANGED
data/spectacles.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["liveh2o@gmail.com, brandonsdewitt@gmail.com"]
|
11
11
|
gem.homepage = "http://github.com/liveh2o/spectacles"
|
12
12
|
gem.summary = %q{Spectacles (derived from RailsSQLViews) adds database view functionality to ActiveRecord.}
|
13
|
-
gem.description = %q{
|
13
|
+
gem.description = %q{Spectacles adds database view functionality to ActiveRecord. Current supported adapters include Postgres, SQLite and Vertica (MySQL is close).}
|
14
14
|
gem.license = 'MIT'
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($\)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectacles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hutchison, Brandon Dewitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
70
|
-
|
69
|
+
description: Spectacles adds database view functionality to ActiveRecord. Current
|
70
|
+
supported adapters include Postgres, SQLite and Vertica (MySQL is close).
|
71
71
|
email:
|
72
72
|
- liveh2o@gmail.com, brandonsdewitt@gmail.com
|
73
73
|
executables: []
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/spectacles/schema_statements/sqlite3_adapter.rb
|
92
92
|
- lib/spectacles/schema_statements/sqlite_adapter.rb
|
93
93
|
- lib/spectacles/schema_statements/sqlserver_adapter.rb
|
94
|
+
- lib/spectacles/schema_statements/vertica_adapter.rb
|
94
95
|
- lib/spectacles/version.rb
|
95
96
|
- lib/spectacles/view.rb
|
96
97
|
- specs/adapters/mysql2_adapter_spec.rb
|
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
127
|
version: '0'
|
127
128
|
requirements: []
|
128
129
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.1.
|
130
|
+
rubygems_version: 2.1.11
|
130
131
|
signing_key:
|
131
132
|
specification_version: 4
|
132
133
|
summary: Spectacles (derived from RailsSQLViews) adds database view functionality
|