spectacles 1.1.0 → 1.2.0

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: e28478c01f62ccd9e9d3fc441caa9cd3883192b1
4
- data.tar.gz: 329001b8c26885deb34289446cb53d955428ddcc
3
+ metadata.gz: 2c61cd91dee27e0e255cc4e1d98f493e6d94a12f
4
+ data.tar.gz: 1d95c23e8f0235f4468ec337632a79a7caed2fa2
5
5
  SHA512:
6
- metadata.gz: ba3efd56888624a60ad098238ef8c3cedcf78bec42f1405e97ffd2a02ae014a4a84888face0cb7c3ef1a547c8cd995ae5bc16dec31e1b0ea159113b327b43a6d
7
- data.tar.gz: daec41fa930df8b7686b66d6125aca194d6e4c0139b65d3dd2f6761438e5933b2a64f1448cab8775e45fb17fa6cbf33453cf3df12d0a83e83a09da4ddb8b1595
6
+ metadata.gz: 289104b7bf5334b9af7861017d91c3ec7235af1ec01f038708dc9617ba0d3fe581ccb2972882332faf3035c3f56408c3148cdf81b64841b76d7fdfcbe696fbdb
7
+ data.tar.gz: ee5dbd357210a7f218b21b9811325904ece703065ae82968fe187a57532e0e2c2c367d6d8c18ae506ca9838df2a41a12bcf25f62f196b5aa02b64ba7e1320d27
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ - 2.3
5
+ - 2.4
6
+ - jruby
7
+ cache: bundler
8
+ branches:
9
+ only:
10
+ - master
@@ -1,9 +1,10 @@
1
1
  module Spectacles
2
2
  class Configuration
3
- attr_accessor :enable_schema_dump
3
+ attr_accessor :enable_schema_dump, :skip_views
4
4
 
5
5
  def initialize
6
6
  @enable_schema_dump = true
7
+ @skip_views = []
7
8
  end
8
9
  end
9
10
  end
@@ -5,11 +5,14 @@ module Spectacles
5
5
  class Railtie < ::Rails::Railtie
6
6
  config.spectacles = ::ActiveSupport::OrderedOptions.new
7
7
 
8
- initializer "spectacles.configure" do |app|
8
+ initializer 'spectacles.configure' do |app|
9
9
  Spectacles.configure do |config|
10
- if app.config.spectacles.has_key?(:enable_schema_dump)
10
+ if app.config.spectacles.key?(:enable_schema_dump)
11
11
  config.enable_schema_dump = app.config.spectacles[:enable_schema_dump]
12
12
  end
13
+ if app.config.spectacles.key?(:skip_views)
14
+ config.skip_views = app.config.spectacles[:skip_views]
15
+ end
13
16
  end
14
17
  end
15
18
  end
@@ -1,17 +1,19 @@
1
1
  module Spectacles
2
2
  module SchemaDumper
3
3
  def self.dump_views(stream, connection)
4
- unless (Spectacles.config.enable_schema_dump == false)
4
+ unless Spectacles.config.enable_schema_dump == false
5
5
  connection.views.sort.each do |view|
6
+ next if skip_view?(view)
6
7
  dump_view(stream, connection, view)
7
8
  end
8
9
  end
9
10
  end
10
11
 
11
12
  def self.dump_materialized_views(dumper, stream, connection)
12
- unless (Spectacles.config.enable_schema_dump == false)
13
+ unless Spectacles.config.enable_schema_dump == false
13
14
  if connection.supports_materialized_views?
14
15
  connection.materialized_views.sort.each do |view|
16
+ next if skip_view?(view)
15
17
  dump_materialized_view(stream, connection, view)
16
18
  dumper.send(:indexes, view, stream)
17
19
  end
@@ -46,7 +48,7 @@ module Spectacles
46
48
  def self.format_option_hash(hash)
47
49
  hash.map do |key, value|
48
50
  "#{key}: #{format_option_value(value)}"
49
- end.join(", ")
51
+ end.join(', ')
50
52
  end
51
53
 
52
54
  def self.format_option_value(value)
@@ -58,5 +60,9 @@ module Spectacles
58
60
  else raise "can't format #{value.inspect}"
59
61
  end
60
62
  end
63
+
64
+ def self.skip_view?(view)
65
+ Spectacles.config.skip_views.any? { |item| item === view }
66
+ end
61
67
  end
62
68
  end
@@ -1,3 +1,3 @@
1
1
  module Spectacles
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
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: 1.1.0
4
+ version: 1.2.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: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - ".travis.yml"
78
79
  - Gemfile
79
80
  - LICENSE
80
81
  - Rakefile
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  version: '0'
129
130
  requirements: []
130
131
  rubyforge_project:
131
- rubygems_version: 2.5.1
132
+ rubygems_version: 2.6.12
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: Spectacles (derived from RailsSQLViews) adds database view functionality