anchormodel 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/anchormodel.gemspec +16 -31
- data/lib/anchormodel/version.rb +1 -1
- data/lib/generators/anchormodel/USAGE +8 -0
- data/lib/generators/anchormodel/anchormodel_generator.rb +11 -0
- data/lib/generators/anchormodel/templates/anchormodel.rb.erb +3 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '01259cd9abb8c08dd46ee9ebc39697fbd8eb17128bd09d8e2ffd20aca88b3c68'
|
4
|
+
data.tar.gz: 93eb6c57fae4d705cee6d92e9a5e5a3c5cfd56e3cc60306e906d5654521ae586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564faa96c2eea1cc8bcbb3c05dbe9b7c86dd0a62618cff2d3ed56611a3c4a1431e1a2e1bfdaa30e7ccbd1a2a4723648aeb269ed6ef656c44daa01d21488516a3
|
7
|
+
data.tar.gz: 18d9556c138412dfa107e9958a3f4bfd8e992b9a26c85bd3516d3bc7afc3bee700c72b7d915fde69787087334be8692bf6afbb77d3dab1bc233c4be7b27ee6d2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -50,6 +50,14 @@ entries of an Anchormodel.
|
|
50
50
|
1. Add gem to Gemfile: `gem 'anchormodel'`
|
51
51
|
2. In `application_record.rb`, add in the class body: `include Anchormodel::ModelMixin`
|
52
52
|
|
53
|
+
# Generator
|
54
|
+
|
55
|
+
For convenience, Anchormodel provides a Rails generator:
|
56
|
+
|
57
|
+
`rails generate anchormodel Role`
|
58
|
+
|
59
|
+
This will create `app/anchormodels/role.rb`.
|
60
|
+
|
53
61
|
# Basic example
|
54
62
|
|
55
63
|
`app/anchormodels/role.rb`:
|
data/anchormodel.gemspec
CHANGED
@@ -2,48 +2,33 @@
|
|
2
2
|
# This file is auto-generated via: 'rake gemspec'.
|
3
3
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: anchormodel 0.1.
|
5
|
+
# stub: anchormodel 0.1.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "anchormodel".freeze
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Sandro Kalbermatter".freeze]
|
14
|
-
s.date = "2023-
|
15
|
-
s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "anchormodel.gemspec".freeze, "bin/rails".freeze, "doc/Anchormodel.html".freeze, "doc/Anchormodel/ActiveModelTypeValue.html".freeze, "doc/Anchormodel/Attribute.html".freeze, "doc/Anchormodel/ModelMixin.html".freeze, "doc/Anchormodel/Version.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/anchormodel.rb".freeze, "lib/anchormodel/active_model_type_value.rb".freeze, "lib/anchormodel/attribute.rb".freeze, "lib/anchormodel/model_mixin.rb".freeze, "lib/anchormodel/version.rb".freeze, "logo.svg".freeze, "test/active_record_model/user_test.rb".freeze, "test/dummy/.gitignore".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/anchormodels/locale.rb".freeze, "test/dummy/app/anchormodels/role.rb".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/credentials.yml.enc".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/initializers/content_security_policy.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/permissions_policy.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/db/migrate/20230107173151_create_users.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/db/seeds.rb".freeze, "test/dummy/lib/tasks/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/tmp/.keep".freeze, "test/dummy/tmp/pids/.keep".freeze, "test/test_helper.rb".freeze]
|
14
|
+
s.date = "2023-05-19"
|
15
|
+
s.files = [".gitignore".freeze, ".ruby-version".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "anchormodel.gemspec".freeze, "bin/rails".freeze, "doc/Anchormodel.html".freeze, "doc/Anchormodel/ActiveModelTypeValue.html".freeze, "doc/Anchormodel/Attribute.html".freeze, "doc/Anchormodel/ModelMixin.html".freeze, "doc/Anchormodel/Version.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "lib/anchormodel.rb".freeze, "lib/anchormodel/active_model_type_value.rb".freeze, "lib/anchormodel/attribute.rb".freeze, "lib/anchormodel/model_mixin.rb".freeze, "lib/anchormodel/version.rb".freeze, "lib/generators/anchormodel/USAGE".freeze, "lib/generators/anchormodel/anchormodel_generator.rb".freeze, "lib/generators/anchormodel/templates/anchormodel.rb.erb".freeze, "logo.svg".freeze, "test/active_record_model/user_test.rb".freeze, "test/dummy/.gitignore".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/anchormodels/locale.rb".freeze, "test/dummy/app/anchormodels/role.rb".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/credentials.yml.enc".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/initializers/content_security_policy.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/permissions_policy.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/db/migrate/20230107173151_create_users.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/db/seeds.rb".freeze, "test/dummy/lib/tasks/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/tmp/.keep".freeze, "test/dummy/tmp/pids/.keep".freeze, "test/test_helper.rb".freeze]
|
16
16
|
s.homepage = "https://github.com/kalsan/anchormodel".freeze
|
17
17
|
s.licenses = ["LGPL-3.0-or-later".freeze]
|
18
18
|
s.required_ruby_version = Gem::Requirement.new(">= 3.0.0".freeze)
|
19
|
-
s.rubygems_version = "3.
|
19
|
+
s.rubygems_version = "3.4.13".freeze
|
20
20
|
s.summary = "Bringing object-oriented programming to Rails enums".freeze
|
21
21
|
|
22
|
-
|
23
|
-
s.specification_version = 4
|
24
|
-
end
|
22
|
+
s.specification_version = 4
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
s.add_development_dependency(%q<sqlite3>.freeze, ["~> 1.6.0"])
|
37
|
-
else
|
38
|
-
s.add_dependency(%q<rails>.freeze, ["~> 7.0"])
|
39
|
-
s.add_dependency(%q<rake>.freeze, ["~> 13.0.6"])
|
40
|
-
s.add_dependency(%q<pry>.freeze, ["~> 0.14.1"])
|
41
|
-
s.add_dependency(%q<rubocop>.freeze, ["~> 1.43.0"])
|
42
|
-
s.add_dependency(%q<rubocop-rails>.freeze, ["~> 2.17.4"])
|
43
|
-
s.add_dependency(%q<yard>.freeze, ["~> 0.9.28"])
|
44
|
-
s.add_dependency(%q<yard-activesupport-concern>.freeze, ["~> 0.0.1"])
|
45
|
-
s.add_dependency(%q<minitest>.freeze, ["~> 5.17.0"])
|
46
|
-
s.add_dependency(%q<minitest-reporters>.freeze, ["~> 1.5.0"])
|
47
|
-
s.add_dependency(%q<sqlite3>.freeze, ["~> 1.6.0"])
|
48
|
-
end
|
24
|
+
s.add_runtime_dependency(%q<rails>.freeze, ["~> 7.0"])
|
25
|
+
s.add_development_dependency(%q<rake>.freeze, ["~> 13.0.6"])
|
26
|
+
s.add_development_dependency(%q<pry>.freeze, ["~> 0.14.1"])
|
27
|
+
s.add_development_dependency(%q<rubocop>.freeze, ["~> 1.43.0"])
|
28
|
+
s.add_development_dependency(%q<rubocop-rails>.freeze, ["~> 2.17.4"])
|
29
|
+
s.add_development_dependency(%q<yard>.freeze, ["~> 0.9.28"])
|
30
|
+
s.add_development_dependency(%q<yard-activesupport-concern>.freeze, ["~> 0.0.1"])
|
31
|
+
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.17.0"])
|
32
|
+
s.add_development_dependency(%q<minitest-reporters>.freeze, ["~> 1.5.0"])
|
33
|
+
s.add_development_dependency(%q<sqlite3>.freeze, ["~> 1.6.0"])
|
49
34
|
end
|
data/lib/anchormodel/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
class AnchormodelGenerator < Rails::Generators::NamedBase
|
2
|
+
source_root File.expand_path('templates', __dir__)
|
3
|
+
|
4
|
+
def add_anchormodel
|
5
|
+
fail('NAME must be present.') if name.blank?
|
6
|
+
@klass = @name.camelize
|
7
|
+
@filename = @name.underscore
|
8
|
+
|
9
|
+
template 'anchormodel.rb.erb', "app/anchormodels/#{@filename}.rb"
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anchormodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Kalbermatter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -191,6 +191,9 @@ files:
|
|
191
191
|
- lib/anchormodel/attribute.rb
|
192
192
|
- lib/anchormodel/model_mixin.rb
|
193
193
|
- lib/anchormodel/version.rb
|
194
|
+
- lib/generators/anchormodel/USAGE
|
195
|
+
- lib/generators/anchormodel/anchormodel_generator.rb
|
196
|
+
- lib/generators/anchormodel/templates/anchormodel.rb.erb
|
194
197
|
- logo.svg
|
195
198
|
- test/active_record_model/user_test.rb
|
196
199
|
- test/dummy/.gitignore
|
@@ -245,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
248
|
- !ruby/object:Gem::Version
|
246
249
|
version: '0'
|
247
250
|
requirements: []
|
248
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.4.13
|
249
252
|
signing_key:
|
250
253
|
specification_version: 4
|
251
254
|
summary: Bringing object-oriented programming to Rails enums
|