virtual_view 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +78 -0
- data/.rspec +2 -0
- data/.travis.yml +29 -0
- data/CHANGELOG.md +0 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/gemfiles/activerecord-4.0.Gemfile +3 -0
- data/gemfiles/activerecord-4.1.Gemfile +3 -0
- data/gemfiles/activerecord-4.2.Gemfile +3 -0
- data/gemfiles/activerecord-5.0.Gemfile +3 -0
- data/gemfiles/activerecord-5.1.Gemfile +3 -0
- data/lib/virtual_view.rb +24 -0
- data/lib/virtual_view/active_record/base.rb +20 -0
- data/lib/virtual_view/active_record/relation.rb +43 -0
- data/lib/virtual_view/railtie.rb +12 -0
- data/lib/virtual_view/version.rb +3 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/rails/app/models/comment.rb +6 -0
- data/spec/support/rails/app/models/deleted_user.rb +5 -0
- data/spec/support/rails/app/models/post.rb +6 -0
- data/spec/support/rails/app/models/user.rb +6 -0
- data/spec/support/rails/config/database.yml +4 -0
- data/spec/support/rails/config/routes.rb +3 -0
- data/spec/support/rails/db/schema.rb +18 -0
- data/spec/support/rails/log/.gitignore +1 -0
- data/spec/support/rails/public/favicon.ico +0 -0
- data/spec/virtual_view/active_record/base_spec.rb +43 -0
- data/virtual_view.gemspec +40 -0
- metadata +192 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bd64d6629b686ffff3bea2d650bc5498f44893ae1aa7adfeb3bba00793f52263
|
4
|
+
data.tar.gz: 1300ce933d32c4e942b5b178d9b326a6d27c0ab4c7816a989b5a24ad115b5060
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d03d22d32c0cf68d0714b6ecc9a802defb284b51ebb898a5d7e92638fcd662afa7702ec938e402201a106d711c1ab4c8003750d64d8b3bbf089060eee73a402d
|
7
|
+
data.tar.gz: 02bfc0c6e754b82a243f3f31c0ba19fb78208258f4d470f63cd594446689b72b0d6c96ace9319d6f42a04b731bf8eec05c46b01e6d5ed19e734b97c07f9fba3c
|
data/.gitignore
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Database config and secrets
|
8
|
+
/config/database.yml
|
9
|
+
/config/secrets.yml
|
10
|
+
|
11
|
+
# Ignore bundler config
|
12
|
+
/.bundle
|
13
|
+
|
14
|
+
# Ignore client credentials
|
15
|
+
/config/client_api_credentials.yml
|
16
|
+
|
17
|
+
# Ignore the default SQLite database.
|
18
|
+
/db/*.sqlite3
|
19
|
+
|
20
|
+
# Ignore all logfiles and tempfiles.
|
21
|
+
/log/*.log
|
22
|
+
/tmp
|
23
|
+
/db/structure.sql
|
24
|
+
/doc/app/*
|
25
|
+
/vendor/cldr/*
|
26
|
+
/public/uploads/*
|
27
|
+
/public/photo/*
|
28
|
+
/public/test/*
|
29
|
+
/test/assets/*
|
30
|
+
/spec/assets/*
|
31
|
+
/public/assets/**
|
32
|
+
.powenv
|
33
|
+
.rvmrc
|
34
|
+
.env
|
35
|
+
.ruby-version
|
36
|
+
|
37
|
+
# Compiled source #
|
38
|
+
###################
|
39
|
+
/pkg
|
40
|
+
*.com
|
41
|
+
*.class
|
42
|
+
*.dll
|
43
|
+
*.exe
|
44
|
+
*.o
|
45
|
+
*.so
|
46
|
+
|
47
|
+
# Packages #
|
48
|
+
############
|
49
|
+
# it's better to unpack these files and commit the raw source
|
50
|
+
# git has its own built in compression methods
|
51
|
+
*.7z
|
52
|
+
*.dmg
|
53
|
+
*.gz
|
54
|
+
*.iso
|
55
|
+
*.jar
|
56
|
+
*.rar
|
57
|
+
*.tar
|
58
|
+
*.zip
|
59
|
+
|
60
|
+
# Logs and databases #
|
61
|
+
######################
|
62
|
+
*.log
|
63
|
+
*.sql
|
64
|
+
*.sqlite
|
65
|
+
|
66
|
+
# OS generated files #
|
67
|
+
######################
|
68
|
+
.DS_Store
|
69
|
+
.DS_Store?
|
70
|
+
._*
|
71
|
+
.Spotlight-V100
|
72
|
+
.Trashes
|
73
|
+
Icon?
|
74
|
+
ehthumbs.db
|
75
|
+
Thumbs.db
|
76
|
+
/Gemfile.lock
|
77
|
+
/coverage
|
78
|
+
/.editorconfig
|
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
sudo: false
|
4
|
+
|
5
|
+
cache: bundler
|
6
|
+
|
7
|
+
before_script:
|
8
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
9
|
+
- chmod +x ./cc-test-reporter
|
10
|
+
- ./cc-test-reporter before-build
|
11
|
+
|
12
|
+
script:
|
13
|
+
- bundle exec rspec
|
14
|
+
|
15
|
+
after_script:
|
16
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
17
|
+
|
18
|
+
addons:
|
19
|
+
postgresql: "9.3"
|
20
|
+
|
21
|
+
rvm:
|
22
|
+
- 2.5
|
23
|
+
- 2.4
|
24
|
+
- 2.3
|
25
|
+
|
26
|
+
gemfile:
|
27
|
+
- gemfiles/activerecord-5.1.Gemfile
|
28
|
+
- gemfiles/activerecord-5.0.Gemfile
|
29
|
+
- gemfiles/activerecord-4.2.Gemfile
|
data/CHANGELOG.md
ADDED
File without changes
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at dale@getnotion.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
# gem 'rails', path: '~/Workspace/RubyGems/rails'
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
|
9
|
+
gem 'pry-doc'
|
10
|
+
|
11
|
+
# Generates coverage stats of specs
|
12
|
+
gem 'simplecov'
|
13
|
+
|
14
|
+
gem 'rspec'
|
15
|
+
|
16
|
+
gem 'database_cleaner'
|
17
|
+
|
18
|
+
gem 'combustion'
|
19
|
+
|
20
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Dale Stevens
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
[![Version ](https://img.shields.io/gem/v/virtual_view.svg?maxAge=2592000)](https://rubygems.org/gems/virtual_view)
|
2
|
+
[![Build Status ](https://travis-ci.org/TwilightCoders/virtual_view.svg)](https://travis-ci.org/TwilightCoders/virtual_view)
|
3
|
+
[![Code Climate ](https://api.codeclimate.com/v1/badges/762cdcd63990efa768b0/maintainability)](https://codeclimate.com/github/TwilightCoders/virtual_view/maintainability)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/TwilightCoders/virtual_view/badges/coverage.svg)](https://codeclimate.com/github/TwilightCoders/virtual_view/coverage)
|
5
|
+
[![Dependencies ](https://gemnasium.com/badges/github.com/TwilightCoders/virtual_view.svg)](https://gemnasium.com/github.com/TwilightCoders/virtual_view)
|
6
|
+
|
7
|
+
# VirtualView
|
8
|
+
|
9
|
+
VirtualView unlocks the ability to back your models with in-code views, best described in [Arel](https://github.com/rails/arel).
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
Ruby 2.3+
|
14
|
+
ActiveRecord 4.2+
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'virtual_view'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install virtual_view
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
Invoking `with_virtual_view` sets the class up to use the `virtual_view` functionality.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
class User < ActiveRecord::Base
|
38
|
+
# the rest of your model code...
|
39
|
+
end
|
40
|
+
|
41
|
+
class Admin < User
|
42
|
+
arel_view do
|
43
|
+
arel_table.where(arel_table[:role].eq(1))
|
44
|
+
end
|
45
|
+
|
46
|
+
# the rest of your model code...
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
After checking out the repo, run `bundle` to install dependencies. Then, run `bundle exec rspec` to run the tests.
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/TwilightCoders/virtual_view. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/virtual_view.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'virtual_view/version'
|
2
|
+
require 'virtual_view/railtie' if defined?(Rails::Railtie)
|
3
|
+
|
4
|
+
module VirtualView
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_writer :logger
|
8
|
+
|
9
|
+
def logger
|
10
|
+
@logger ||= Logger.new($stdout).tap do |log|
|
11
|
+
log.progname = self.name
|
12
|
+
log.level = Logger::INFO
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def activate(klass, &block)
|
17
|
+
klass.prepend(VirtualView::ActiveRecord::Relation)
|
18
|
+
klass.arel_view = block
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'virtual_view/active_record/relation'
|
3
|
+
|
4
|
+
module VirtualView
|
5
|
+
module ActiveRecord
|
6
|
+
module Base
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def arel_view(&block)
|
12
|
+
VirtualView.activate(const_get(:ActiveRecord_Relation), &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'virtual_view'
|
3
|
+
|
4
|
+
module VirtualView
|
5
|
+
module ActiveRecord
|
6
|
+
module Relation
|
7
|
+
|
8
|
+
def self.prepended(subclass)
|
9
|
+
class << subclass
|
10
|
+
class_attribute :arel_view
|
11
|
+
self.arel_view = false
|
12
|
+
end
|
13
|
+
subclass.extend(ClassMethods)
|
14
|
+
end
|
15
|
+
|
16
|
+
def arel_view
|
17
|
+
self.class.arel_view.call.tap do |ar_view|
|
18
|
+
unless ar_view.projections.any?
|
19
|
+
ar_view.project(arel_table[Arel.star])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def table_view
|
25
|
+
arel_table.create_table_alias(arel_view, table_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def from_clause
|
29
|
+
::ActiveRecord::Relation::FromClause.new(table_view, table_name)
|
30
|
+
end
|
31
|
+
|
32
|
+
def from_value
|
33
|
+
table_view.to_sql
|
34
|
+
end
|
35
|
+
|
36
|
+
module ClassMethods
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
require 'virtual_view/active_record/base'
|
3
|
+
|
4
|
+
module VirtualView
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
initializer 'virtual_view.load' do |_app|
|
7
|
+
ActiveSupport.on_load(:active_record) do
|
8
|
+
::ActiveRecord::Base.include(VirtualView::ActiveRecord::Base)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
ENV['RAILS_ENV'] = 'test'
|
2
|
+
|
3
|
+
require 'database_cleaner'
|
4
|
+
require 'combustion'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
require 'simplecov'
|
8
|
+
SimpleCov.start do
|
9
|
+
add_filter 'spec'
|
10
|
+
end
|
11
|
+
|
12
|
+
Combustion.path = 'spec/support/rails'
|
13
|
+
Combustion.initialize! :active_record
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.order = 'random'
|
17
|
+
|
18
|
+
# Configure the DatabaseCleaner
|
19
|
+
config.before(:suite) do
|
20
|
+
DatabaseCleaner.strategy = :transaction
|
21
|
+
DatabaseCleaner.clean_with(:truncation)
|
22
|
+
end
|
23
|
+
|
24
|
+
config.around(:each) do |example|
|
25
|
+
DatabaseCleaner.cleaning do
|
26
|
+
example.run
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
ActiveRecord::Schema.define do
|
2
|
+
self.verbose = false
|
3
|
+
|
4
|
+
create_table :users, schema: :public, force: true do |t|
|
5
|
+
t.string :name
|
6
|
+
t.string :email, index: :btree
|
7
|
+
t.timestamps null: false, virtual_view: true
|
8
|
+
t.timestamp :deleted_at
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :comments, force: true do |t|
|
12
|
+
t.string :title
|
13
|
+
t.integer :user_id
|
14
|
+
t.integer :post_id
|
15
|
+
t.timestamps null: false
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VirtualView::ActiveRecord::Base do
|
4
|
+
|
5
|
+
let!(:dale) {
|
6
|
+
DeletedUser.create(name: 'Dale', email: 'dale@twilightcoders.net', deleted_at: Time.now)
|
7
|
+
}
|
8
|
+
|
9
|
+
let!(:jimmy) {
|
10
|
+
User.create(name: 'Jimmy', email: 'jimmy@twilightcoders.net')
|
11
|
+
}
|
12
|
+
|
13
|
+
it 'can count' do
|
14
|
+
expect(DeletedUser.count).to eq(1)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can filter and count' do
|
18
|
+
expect(DeletedUser.where(name: 'Dale').count).to eq(1)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'can filter' do
|
22
|
+
expect(DeletedUser.where(name: 'Jimmy')).to be_empty
|
23
|
+
expect(DeletedUser.where(name: 'Dale')).to be
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when delegating' do
|
27
|
+
it 'can count' do
|
28
|
+
expect(DeletedUser.all.count).to eq(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'can filter and count' do
|
32
|
+
expect(DeletedUser.all.where(name: 'Dale').count).to eq(1)
|
33
|
+
expect(DeletedUser.all.where(name: 'Jimmy').count).to eq(0)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'can filter' do
|
37
|
+
expect(DeletedUser.all.where(name: 'Jimmy')).to be_empty
|
38
|
+
expect(DeletedUser.all.where(name: 'Dale')).to eq([dale])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'virtual_view/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "virtual_view"
|
8
|
+
spec.version = VirtualView::VERSION
|
9
|
+
spec.authors = ['Dale Stevens']
|
10
|
+
spec.email = ['dale@twilightcoders.net']
|
11
|
+
|
12
|
+
spec.summary = %q{Describe a view in code to back ActiveRecord models}
|
13
|
+
spec.homepage = "https://github.com/TwilightCoders/virtual_view"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
if spec.respond_to?(:metadata)
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
+
else
|
19
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0")
|
23
|
+
spec.bindir = 'bin'
|
24
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
25
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
|
+
spec.require_paths = ['lib', 'spec']
|
27
|
+
|
28
|
+
rails_versions = ['>= 4.2', '< 6']
|
29
|
+
spec.required_ruby_version = '>= 2.3'
|
30
|
+
|
31
|
+
spec.add_runtime_dependency 'pg', '~> 0'
|
32
|
+
spec.add_runtime_dependency 'scenic', '~> 1.3'
|
33
|
+
spec.add_runtime_dependency 'activerecord', rails_versions
|
34
|
+
|
35
|
+
spec.add_development_dependency 'pry-byebug', '~> 3'
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
37
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
38
|
+
spec.add_development_dependency 'combustion', '~> 0.7'
|
39
|
+
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: virtual_view
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dale Stevens
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pg
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: scenic
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activerecord
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.2'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '6'
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '4.2'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '6'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: pry-byebug
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: bundler
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.3'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.3'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rake
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '12.0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '12.0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: combustion
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.7'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.7'
|
117
|
+
description:
|
118
|
+
email:
|
119
|
+
- dale@twilightcoders.net
|
120
|
+
executables: []
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files: []
|
123
|
+
files:
|
124
|
+
- ".gitignore"
|
125
|
+
- ".rspec"
|
126
|
+
- ".travis.yml"
|
127
|
+
- CHANGELOG.md
|
128
|
+
- CODE_OF_CONDUCT.md
|
129
|
+
- Gemfile
|
130
|
+
- LICENSE.txt
|
131
|
+
- README.md
|
132
|
+
- Rakefile
|
133
|
+
- gemfiles/activerecord-4.0.Gemfile
|
134
|
+
- gemfiles/activerecord-4.1.Gemfile
|
135
|
+
- gemfiles/activerecord-4.2.Gemfile
|
136
|
+
- gemfiles/activerecord-5.0.Gemfile
|
137
|
+
- gemfiles/activerecord-5.1.Gemfile
|
138
|
+
- lib/virtual_view.rb
|
139
|
+
- lib/virtual_view/active_record/base.rb
|
140
|
+
- lib/virtual_view/active_record/relation.rb
|
141
|
+
- lib/virtual_view/railtie.rb
|
142
|
+
- lib/virtual_view/version.rb
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
- spec/support/rails/app/models/comment.rb
|
145
|
+
- spec/support/rails/app/models/deleted_user.rb
|
146
|
+
- spec/support/rails/app/models/post.rb
|
147
|
+
- spec/support/rails/app/models/user.rb
|
148
|
+
- spec/support/rails/config/database.yml
|
149
|
+
- spec/support/rails/config/routes.rb
|
150
|
+
- spec/support/rails/db/schema.rb
|
151
|
+
- spec/support/rails/log/.gitignore
|
152
|
+
- spec/support/rails/public/favicon.ico
|
153
|
+
- spec/virtual_view/active_record/base_spec.rb
|
154
|
+
- virtual_view.gemspec
|
155
|
+
homepage: https://github.com/TwilightCoders/virtual_view
|
156
|
+
licenses:
|
157
|
+
- MIT
|
158
|
+
metadata:
|
159
|
+
allowed_push_host: https://rubygems.org
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options: []
|
162
|
+
require_paths:
|
163
|
+
- lib
|
164
|
+
- spec
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '2.3'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.7.5
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: Describe a view in code to back ActiveRecord models
|
181
|
+
test_files:
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
- spec/support/rails/app/models/comment.rb
|
184
|
+
- spec/support/rails/app/models/deleted_user.rb
|
185
|
+
- spec/support/rails/app/models/post.rb
|
186
|
+
- spec/support/rails/app/models/user.rb
|
187
|
+
- spec/support/rails/config/database.yml
|
188
|
+
- spec/support/rails/config/routes.rb
|
189
|
+
- spec/support/rails/db/schema.rb
|
190
|
+
- spec/support/rails/log/.gitignore
|
191
|
+
- spec/support/rails/public/favicon.ico
|
192
|
+
- spec/virtual_view/active_record/base_spec.rb
|