webamm 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1a81a8cc8c018322fb2bcf049222a341b0cecd1ddd064338f514272129034530
4
+ data.tar.gz: 189fab49524efcbcfa11774cf010fd4675d6b886a52436b832e836311ea74a67
5
+ SHA512:
6
+ metadata.gz: 3520ae29d246369963ce4b5e4b9df076654af0796a0092b8ec558161f7d5b410c7ce56cf457ea91e54eb612a0de594ae03abfd872bd400530a4c69f0b4569a21
7
+ data.tar.gz: cf819a792a6744c51b0e34cafeffd688e8f0fe623fb8ed81139b49945f23fd67e4bb260f4ddf756eee757efaedf2885711ae1bb2011e2e35c1b5f7397b33331f
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # Web Application Metadata Markup (WEBAMM)
@@ -0,0 +1,6 @@
1
+ module Webamm
2
+ class Authentication < Dry::Struct
3
+ attribute :table, Types::String
4
+ attribute :features, Types::Array.of(Types::String).default([].freeze)
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ module Webamm
2
+ module Database
3
+ class Crud < Dry::Struct
4
+ attribute :table, Types::String
5
+ attribute :actions, Types::Array.default([].freeze) do
6
+ attribute :name, Types::String
7
+ attribute :options do
8
+ attribute :authentication, Types::Array.default([].freeze)
9
+ attribute :model_attributes, Types::Array.default([].freeze)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Webamm
2
+ module Database
3
+ class Relationship < Dry::Struct
4
+ attribute :type, Types::String
5
+ attribute :source, Types::String
6
+ attribute? :destination, Types::String.optional
7
+ attribute :required, Types::Bool.optional
8
+ attribute? :options do
9
+ attribute? :habtm, Types::Bool.optional
10
+ attribute? :habtm_table, Types::String.optional
11
+ attribute? :habtm_tables, Types::Array.optional
12
+ attribute? :class_name, Types::String.optional
13
+ attribute? :foreign_key, Types::String.optional
14
+ attribute? :dependent, Types::String.optional
15
+ attribute? :through, Types::String.optional
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ module Webamm
2
+ module Database
3
+ module Schema
4
+ class Column < Dry::Struct
5
+ attribute :name, Types::String
6
+ attribute :type, Types::String
7
+ attribute :null, Types::Bool.optional
8
+ attribute :default, Types::StrongString.optional
9
+ attribute :values, Types::Array.default([].freeze)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module Webamm
2
+ module Database
3
+ module Schema
4
+ class Index < Dry::Struct
5
+ attribute :name, Types::String
6
+ attribute :columns, Types::Array
7
+ attribute :unique, Types::Bool.default(false)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Webamm
4
+ VERSION = '0.0.1'
5
+ end
data/lib/webamm.rb ADDED
@@ -0,0 +1,33 @@
1
+ require 'dry-struct'
2
+
3
+ module Types
4
+ include Dry.Types()
5
+ StrongString = String.constructor(->(val){ val.to_s })
6
+ end
7
+
8
+ require_relative 'webamm/database/schema/column'
9
+ require_relative 'webamm/database/schema/index'
10
+ require_relative 'webamm/authentication'
11
+ require_relative 'webamm/database/crud'
12
+ require_relative 'webamm/database/relationship'
13
+
14
+ module Webamm
15
+ class Definition < Dry::Struct
16
+ attribute :authentication, Types::Array.of(Webamm::Authentication).default([].freeze)
17
+ attribute :database do
18
+ attribute :engine, Types::String
19
+ attribute :crud, Types::Array.of(Webamm::Database::Crud).default([].freeze)
20
+ attribute :schema, Types::Array.default([].freeze) do
21
+ attribute :table, Types::String
22
+ attribute :columns, Types::Array.of(Webamm::Database::Schema::Column).default([].freeze)
23
+ attribute :indices, Types::Array.of(Webamm::Database::Schema::Index).default([].freeze)
24
+ attribute? :options do
25
+ attribute? :habtm, Types::Bool.optional
26
+ attribute? :habtm_tables, Types::Array.optional
27
+ attribute? :use_uuid, Types::Bool.optional
28
+ end
29
+ end
30
+ attribute :relationships, Types::Array.of(Webamm::Database::Relationship).default([].freeze)
31
+ end
32
+ end
33
+ end
data/webamm.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'webamm/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'webamm'
9
+ spec.authors = ['Paweł Dąbrowski']
10
+ spec.email = ['contact@paweldabrowski.com']
11
+ spec.license = 'MIT'
12
+ spec.version = Webamm::VERSION.dup
13
+ spec.summary = 'Web Application Metadata Markup'
14
+ spec.description = spec.summary
15
+ spec.files = Dir['README.md', 'webamm.gemspec', 'lib/**/*']
16
+ spec.require_paths = ['lib']
17
+ spec.add_runtime_dependency 'dry-struct', '1.6.0'
18
+ spec.required_ruby_version = '>= 3.2.2'
19
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: webamm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Paweł Dąbrowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-struct
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.6.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.6.0
27
+ description: Web Application Metadata Markup
28
+ email:
29
+ - contact@paweldabrowski.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - lib/webamm.rb
36
+ - lib/webamm/authentication.rb
37
+ - lib/webamm/database/crud.rb
38
+ - lib/webamm/database/relationship.rb
39
+ - lib/webamm/database/schema/column.rb
40
+ - lib/webamm/database/schema/index.rb
41
+ - lib/webamm/version.rb
42
+ - webamm.gemspec
43
+ homepage:
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.2.2
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.4.10
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Web Application Metadata Markup
66
+ test_files: []