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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b70771d2e2deb3240110e225980c5957665efe1d59b2dc4128c43bd092daa6e
4
- data.tar.gz: c8030a9df0c89523d319b38528b0bcdbf238b50e95645a209198895e4d014732
3
+ metadata.gz: '01259cd9abb8c08dd46ee9ebc39697fbd8eb17128bd09d8e2ffd20aca88b3c68'
4
+ data.tar.gz: 93eb6c57fae4d705cee6d92e9a5e5a3c5cfd56e3cc60306e906d5654521ae586
5
5
  SHA512:
6
- metadata.gz: 7838fd578d77d5f2b5d3d9df078ed4118f3baca165bf47dbba94636897ec4704f1eb22804930c459c29ddf803e271c24a27786b99e48ffd8e16e5598f6fbb807
7
- data.tar.gz: a7e85cae485400d87f6d10b496a4887c0d01f8435bf2e770c0103a26dab2713a22526be3c1b945b52fb624abc0f1770a81cf5136ddd9f47ce6369bb5bfa48fc1
6
+ metadata.gz: 564faa96c2eea1cc8bcbb3c05dbe9b7c86dd0a62618cff2d3ed56611a3c4a1431e1a2e1bfdaa30e7ccbd1a2a4723648aeb269ed6ef656c44daa01d21488516a3
7
+ data.tar.gz: 18d9556c138412dfa107e9958a3f4bfd8e992b9a26c85bd3516d3bc7afc3bee700c72b7d915fde69787087334be8692bf6afbb77d3dab1bc233c4be7b27ee6d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.3 (19.05.2023)
2
+
3
+ - Add Rails generator
4
+
1
5
  # 0.1.2 (25.01.2023)
2
6
 
3
7
  - Consider empty string as nil (this is necessary to make Rails assignments work)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- anchormodel (0.1.1)
4
+ anchormodel (0.1.2)
5
5
  rails (~> 7.0)
6
6
 
7
7
  GEM
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.2 ruby lib
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.2"
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-01-25"
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.3.26".freeze
19
+ s.rubygems_version = "3.4.13".freeze
20
20
  s.summary = "Bringing object-oriented programming to Rails enums".freeze
21
21
 
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 4
24
- end
22
+ s.specification_version = 4
25
23
 
26
- if s.respond_to? :add_runtime_dependency then
27
- s.add_runtime_dependency(%q<rails>.freeze, ["~> 7.0"])
28
- s.add_development_dependency(%q<rake>.freeze, ["~> 13.0.6"])
29
- s.add_development_dependency(%q<pry>.freeze, ["~> 0.14.1"])
30
- s.add_development_dependency(%q<rubocop>.freeze, ["~> 1.43.0"])
31
- s.add_development_dependency(%q<rubocop-rails>.freeze, ["~> 2.17.4"])
32
- s.add_development_dependency(%q<yard>.freeze, ["~> 0.9.28"])
33
- s.add_development_dependency(%q<yard-activesupport-concern>.freeze, ["~> 0.0.1"])
34
- s.add_development_dependency(%q<minitest>.freeze, ["~> 5.17.0"])
35
- s.add_development_dependency(%q<minitest-reporters>.freeze, ["~> 1.5.0"])
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
@@ -2,7 +2,7 @@ class Anchormodel
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  EDGE = false
8
8
 
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Generate a single Anchormodel
3
+
4
+ Example:
5
+ bin/rails generate anchormodel Color
6
+
7
+ This will create:
8
+ app/anchormodels/color.rb
@@ -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
@@ -0,0 +1,3 @@
1
+ class <%= @klass %> < Anchormodel
2
+ new :foo
3
+ 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.2
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-01-25 00:00:00.000000000 Z
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.3.26
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