anonymous_active_record 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 +13 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +7 -0
- data/README.md +126 -0
- data/Rakefile +6 -0
- data/anonymous_active_record.gemspec +32 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/anonymous_active_record/factory.rb +32 -0
- data/lib/anonymous_active_record/generator.rb +39 -0
- data/lib/anonymous_active_record/version.rb +3 -0
- data/lib/anonymous_active_record.rb +80 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67c1cf60e54b550f21a8bf4b0a8993ec57394dd7
|
4
|
+
data.tar.gz: b09d1d7a820a1a6b4299e42ff66586faface6e38
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3d9be726ea4534a683a358db0f12fa6b9c1a292fe39536b73fab9d069b128445ae48757f7cfc55e34f4063053067247c00fe5cea402423b4c4570e54972dae21
|
7
|
+
data.tar.gz: 7408bced825d4b3ea3971d9bc9493d166fdb86cf1f52cc652450f6db0b786f14ed756d2c80c7d95b9a9d6912238643874504bdd90c4077e5d521d4e67c1f51b2
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
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 peter.boling@gmail.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
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright 2017 Peter Boling & Bolt Threads
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# AnonymousActiveRecord
|
2
|
+
|
3
|
+
This library was 🎩 inspired by 🎩, the [Wolverine project](https://github.com/mcary/wolverine), which [implemented a clever workaround](https://github.com/mcary/wolverine/commit/fa27fa2cc485b2fa83d71b2045ba5a0a069dba75) to the official non-support of [anonymous classes by ActiveRecord](https://github.com/rails/rails/issues/8934).
|
4
|
+
|
5
|
+
Warning: Use of this gem is a **security risk**, due to the use of Ruby's `eval`. It is intended for use in a test suite, or other non-critical environment.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'anonymous_active_record'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install anonymous_active_record
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Require the library in your `spec_helper` or other test suite boot file.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'anonymous_active_record'
|
29
|
+
```
|
30
|
+
|
31
|
+
Let's say you want to write specs for a module, `HasBalloon`, which provides a method `has_balloon?`, and will be mixed into ActiveRecord classes.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
module HasBalloon
|
35
|
+
def has_balloon?
|
36
|
+
name == 'Spot' ? true : false # only Spot has a balloon
|
37
|
+
end
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
This won't work [(really!)](https://github.com/rails/rails/issues/8934):
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
let(:ar_with_balloon) do
|
45
|
+
Class.new(ActiveRecord::Base) do
|
46
|
+
attr_accessor :name
|
47
|
+
include HasBalloon
|
48
|
+
def flowery_name
|
49
|
+
"#{b_f}#{name}#{b_f}"
|
50
|
+
end
|
51
|
+
def b_f
|
52
|
+
has_balloon? ? '🎈' : '🌸'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
So do this instead:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
let(:ar_with_balloon) do
|
62
|
+
AnonymousActiveRecord.generate(columns: ['name']) do
|
63
|
+
include HasBalloon
|
64
|
+
def flowery_name
|
65
|
+
"#{b_f}#{name}#{b_f}"
|
66
|
+
end
|
67
|
+
def b_f
|
68
|
+
has_balloon? ? '🎈' : '🌸'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
it 'can test the module' do
|
73
|
+
expect(ar_with_balloon.new(name: 'Spot').flowery_name).to eq('🎈Spot🎈')
|
74
|
+
expect(ar_with_balloon.new(name: 'Not Spot').flowery_name).to eq('🌸Not Spot🌸')
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
### Generate Options
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
AnonymousActiveRecord.generate(
|
82
|
+
table_name: 'a_table_name',
|
83
|
+
# if table_name is not set klass_basename will be used to derive a unique random table_name
|
84
|
+
# default is a unique random table name
|
85
|
+
klass_basename: 'anons', # is default
|
86
|
+
columns: ['name'],
|
87
|
+
# default is [],
|
88
|
+
# meaning class will have ['id', 'created_at', 'updated_at'], as the AR defaults
|
89
|
+
timestamps: true, # is default
|
90
|
+
connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' } # is default
|
91
|
+
) do
|
92
|
+
# code which becomes part of the class definition
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
The block is optional.
|
97
|
+
|
98
|
+
### Factory Options
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
AnonymousActiveRecord.factory(
|
102
|
+
source_data: [{name: 'Phil'}, {name: 'Vickie'}],
|
103
|
+
# Array of hashes, where each hash represents a record that will be created
|
104
|
+
# ... The rest of the options are the same as for generate, see above.
|
105
|
+
) do
|
106
|
+
# same as for generate, see above.
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
110
|
+
The block is optional.
|
111
|
+
|
112
|
+
There is also a `factory!` method that will raise if the create fails, accomplished by calling `create!` instead of `create`.
|
113
|
+
|
114
|
+
## Development
|
115
|
+
|
116
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
117
|
+
|
118
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
119
|
+
|
120
|
+
## Contributing
|
121
|
+
|
122
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/anonymous_active_record. 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.
|
123
|
+
|
124
|
+
## Code of Conduct
|
125
|
+
|
126
|
+
Everyone interacting in the AnonymousActiveRecord project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/anonymous_active_record/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'anonymous_active_record/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'anonymous_active_record'
|
8
|
+
spec.version = AnonymousActiveRecord::VERSION
|
9
|
+
spec.authors = ['Peter Boling']
|
10
|
+
spec.email = ['peter.boling@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Almost Anonymous ActiveRecord classes'
|
13
|
+
spec.description = 'Replacement for broken Class.new(ActiveRecord::Base)'
|
14
|
+
spec.homepage = 'https://github.com/pboling/anonymous_active_record'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
spec.license = 'MIT'
|
23
|
+
|
24
|
+
spec.required_ruby_version = '>= 2.4' # Requirement for Ruby String#capitalize
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
spec.add_development_dependency 'byebug', '~> 9.1'
|
30
|
+
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
31
|
+
spec.add_dependency 'activerecord', '~> 5.0'
|
32
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'anonymous_active_record'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Usage:
|
2
|
+
#
|
3
|
+
# records = AnonymousActiveRecord.factory(source_data: [{name: 'Bob McGurdy'}], columns: ['name']) do
|
4
|
+
# def flowery_name
|
5
|
+
# "🌸#{name}🌸"
|
6
|
+
# end
|
7
|
+
# end
|
8
|
+
# records.first.flowery_name # => "🌸Bob McGurdy🌸"
|
9
|
+
#
|
10
|
+
module AnonymousActiveRecord
|
11
|
+
# Factory initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
|
12
|
+
class Factory
|
13
|
+
attr_reader :klass
|
14
|
+
|
15
|
+
def initialize(source_data, klass)
|
16
|
+
@source_data = source_data # an array of hashes
|
17
|
+
@klass = klass
|
18
|
+
end
|
19
|
+
|
20
|
+
def run
|
21
|
+
@source_data.map do |hash|
|
22
|
+
klass.create(hash)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def run!
|
27
|
+
@source_data.map do |hash|
|
28
|
+
klass.create!(hash)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Usage:
|
2
|
+
#
|
3
|
+
# klass = AnonymousActiveRecord.generate(columns: ['name']) do
|
4
|
+
# def flowery_name
|
5
|
+
# "🌸#{name}🌸"
|
6
|
+
# end
|
7
|
+
# end
|
8
|
+
# instance = klass.new(name: 'Darla Charla')
|
9
|
+
# instance.save!
|
10
|
+
# instance.flowery_name # => "🌸Darla Charla🌸"
|
11
|
+
#
|
12
|
+
module AnonymousActiveRecord
|
13
|
+
# Generator defines a pseudo anonymous class in a particular namespace of your choosing.
|
14
|
+
class Generator
|
15
|
+
DEFAULT_NAME = 'anons'.freeze
|
16
|
+
|
17
|
+
attr_reader :klass_namespaces, :table_name, :klass_name
|
18
|
+
|
19
|
+
def initialize(table_name, klass_namespaces = [], klass_basename = nil)
|
20
|
+
@klass_namespaces = Array(klass_namespaces).map(&:to_s).map {|x| x.gsub(/[^a-z0-9]+/i, '_') }
|
21
|
+
klass_context = [(klass_basename || DEFAULT_NAME).gsub(/[^a-z0-9]+/i, '_').capitalize, SecureRandom.uuid.gsub(/[^a-z0-9]+/i, '_')].join('_')
|
22
|
+
@table_name = (table_name || klass_context).downcase.to_s
|
23
|
+
# String#capitalize is Ruby >= 2.4, https://stackoverflow.com/a/3725154/213191
|
24
|
+
@klass_name = (klass_namespaces << klass_context).join('::')
|
25
|
+
end
|
26
|
+
|
27
|
+
def generate(&block)
|
28
|
+
# Many moons ago, ActiveRecord allowed anonymous classes to be created like:
|
29
|
+
# Class.new(ActiveRecord::Base)
|
30
|
+
# which was useful for specs, and other use cases. But it is now explicitly not supported, see
|
31
|
+
# https://github.com/rails/rails/issues/8934
|
32
|
+
eval "class ::#{klass_name} < ActiveRecord::Base; end"
|
33
|
+
klass = Kernel.const_get(klass_name, true)
|
34
|
+
klass.class_eval(&block) if block_given?
|
35
|
+
klass.table_name = table_name
|
36
|
+
klass
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
require 'anonymous_active_record/version'
|
4
|
+
require 'anonymous_active_record/generator'
|
5
|
+
require 'anonymous_active_record/factory'
|
6
|
+
|
7
|
+
# Public API for AnonymousActiveRecord is:
|
8
|
+
#
|
9
|
+
# AnonymousActiveRecord.generate -
|
10
|
+
# defines a class, creates the table;
|
11
|
+
# returns the class
|
12
|
+
#
|
13
|
+
# Usage:
|
14
|
+
#
|
15
|
+
# klass = AnonymousActiveRecord.generate(columns: ['name']) do
|
16
|
+
# def flowery_name
|
17
|
+
# "🌸#{name}🌸"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# instance = klass.new(name: 'Darla Charla')
|
21
|
+
# instance.save!
|
22
|
+
# instance.flowery_name # => "🌸Darla Charla🌸"
|
23
|
+
#
|
24
|
+
# AnonymousActiveRecord.factory -
|
25
|
+
# defines a class, creates the table, creates data;
|
26
|
+
# returns inserted records
|
27
|
+
#
|
28
|
+
# Usage:
|
29
|
+
#
|
30
|
+
# records = AnonymousActiveRecord.factory(source_data: [{name: 'Bob McGurdy'}], columns: ['name']) do
|
31
|
+
# def flowery_name
|
32
|
+
# "🌸#{name}🌸"
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
# records.first.flowery_name # => "🌸Bob McGurdy🌸"
|
36
|
+
#
|
37
|
+
module AnonymousActiveRecord
|
38
|
+
DEFAULT_CONNECTION_PARAMS = {
|
39
|
+
adapter: 'sqlite3',
|
40
|
+
encoding: 'utf8',
|
41
|
+
database: ':memory:'
|
42
|
+
}.freeze
|
43
|
+
|
44
|
+
# Defines a pseudo anonymous class in a particular namespace of your choosing.
|
45
|
+
def generate(table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
|
46
|
+
gen = AnonymousActiveRecord::Generator.new(table_name, klass_namespaces, klass_basename)
|
47
|
+
klass = gen.generate(&block)
|
48
|
+
connection_params = YAML.load_file(connection_params) if connection_params.is_a?(String)
|
49
|
+
klass.establish_connection(connection_params.dup)
|
50
|
+
klass.connection.create_table gen.table_name do |t|
|
51
|
+
t.column :text, :text
|
52
|
+
columns.each do |col|
|
53
|
+
t.column col, :string
|
54
|
+
end
|
55
|
+
t.timestamps if timestamps
|
56
|
+
end
|
57
|
+
klass
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
|
61
|
+
def factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
|
62
|
+
factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, connection_params: connection_params, &block)
|
63
|
+
factory.run
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
|
67
|
+
def factory!(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
|
68
|
+
factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, connection_params: connection_params, &block)
|
69
|
+
factory.run!
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def _factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)
|
75
|
+
klass = generate(table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, connection_params: connection_params, &block)
|
76
|
+
AnonymousActiveRecord::Factory.new(source_data, klass)
|
77
|
+
end
|
78
|
+
|
79
|
+
module_function :generate, :factory, :factory!, :_factory
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: anonymous_active_record
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Peter Boling
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '9.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '9.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activerecord
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '5.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '5.0'
|
97
|
+
description: Replacement for broken Class.new(ActiveRecord::Base)
|
98
|
+
email:
|
99
|
+
- peter.boling@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- anonymous_active_record.gemspec
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/anonymous_active_record.rb
|
116
|
+
- lib/anonymous_active_record/factory.rb
|
117
|
+
- lib/anonymous_active_record/generator.rb
|
118
|
+
- lib/anonymous_active_record/version.rb
|
119
|
+
homepage: https://github.com/pboling/anonymous_active_record
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.4'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.6.14
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Almost Anonymous ActiveRecord classes
|
143
|
+
test_files: []
|