platformer 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d08454048761151bd69db6c4bac1ae1bc9f585457ae60932727b9303ce77f29c
4
+ data.tar.gz: b51d1482188431343d0f0c205aaad7b8441bb9ae72adc390c8bec36085f8b4b1
5
+ SHA512:
6
+ metadata.gz: 67202605ef5f1a84093aa54a1bb53045442f1463ec45796206a27759ee3bebe008e7eedec7585e98ddacafe19178f5c4a647f759e188c6ea58f37a4828d62bb1
7
+ data.tar.gz: b21a32e98c5219df3b2503c8dd209d8571e47d710cc7390fc82b61121e5455ff9c200192dde3e5565acbadaf6f71d02f46ed533d7c9e915dd8d492b671cea0dd
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 (2023-06-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * most basic proof of concept ([c746441](https://github.com/craigulliott/platformer/commit/c746441f2042c290f2b582c0b29f086154df08a9))
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at craigulliott@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Craig Ulliott
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,63 @@
1
+ # Platformer
2
+
3
+ Compose a SaaS platform through configuration.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/platformer.svg)](https://badge.fury.io/rb/platformer)
6
+ [![Specs](https://github.com/craigulliott/platformer/actions/workflows/specs.yml/badge.svg)](https://github.com/craigulliott/platformer/actions/workflows/specs.yml)
7
+ [![Types](https://github.com/craigulliott/platformer/actions/workflows/types.yml/badge.svg)](https://github.com/craigulliott/platformer/actions/workflows/types.yml)
8
+ [![Coding Style](https://github.com/craigulliott/platformer/actions/workflows/linter.yml/badge.svg)](https://github.com/craigulliott/platformer/actions/workflows/linter.yml)
9
+
10
+ ## Key Features
11
+
12
+ * Build and deploy a platform through configuration rather than code
13
+ * Ability to express all real world business logic for most businesses
14
+ * Automatically generates all database migrations
15
+ * Automatically generate documentation for your platform
16
+ * Opinionated - GraphQL, oAuth2, Application and Database Level Data Validations
17
+ * Performant and reliable, even at large scale
18
+ * Includes Cloudformation Scripts to launch appropriate scalable infrastructure
19
+
20
+ ## Installation
21
+
22
+ Install the gem by executing:
23
+
24
+ $ gem install platformer
25
+
26
+ Create your new platform:
27
+
28
+ $ platformer create my_platform_name
29
+
30
+ ## Getting Started
31
+
32
+ Todo
33
+
34
+
35
+ ## Development
36
+
37
+ 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.
38
+
39
+ We use [Conventional Commit Messages](https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13).
40
+
41
+ Code should be linted and formatted according to [Ruby Standard](https://github.com/standardrb/standard).
42
+
43
+ Publishing is automated via github actions and Googles [Release Please](https://github.com/google-github-actions/release-please-action) github action
44
+
45
+ We prefer using squash-merges when merging pull requests because it helps keep a linear git history and allows more fine grained control of commit messages which get sent to release-please and ultimately show up in the changelog.
46
+
47
+ Type checking is enabled for this project. You can find the corresponding `rbs` files in the sig folder.
48
+
49
+ Install types for the packages used in development (such as `rspec`) by running
50
+
51
+ $ rbs collection install
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/craigulliott/platformer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/craigulliott/platformer/blob/master/CODE_OF_CONDUCT.md).
56
+
57
+ ## License
58
+
59
+ This software is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
60
+
61
+ ## Code of Conduct
62
+
63
+ Everyone interacting in the Platformer project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/craigulliott/platformer/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Platformer
4
+ class Composer
5
+ class ClassDoesNotUseDSLComposeError < StandardError
6
+ end
7
+
8
+ # when provided with a class which has DSLCompose added to it, such
9
+ # as ApplicationModel, this method will execute the provided block
10
+ # once for every child class of the provided class. A common use of this
11
+ # method would be to find all classes of a particular type (such as
12
+ # models or callback definitions) and dynamically create something
13
+ # for each of them
14
+ def self.for_each_child_class klass, &block
15
+ unless klass.respond_to? :dsls
16
+ raise ClassDoesNotUseDSLCompose
17
+ end
18
+ if block
19
+ klass.dsls.executions_by_class.each do |k, dsl|
20
+ yield k
21
+ end
22
+ else
23
+ warn "no block provided"
24
+ end
25
+ end
26
+
27
+ def self.for_each klass, dsl_name, &block
28
+ # todo
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Platformer
4
+ module Composers
5
+ class CreateActiveModels < Composer
6
+ # Dynamically create ActiveRecord classes to represent each
7
+ # of our model definitions.
8
+ #
9
+ # For example, if we have have created a UserModel and an
10
+ # OrganizationModel, then this composer will generate a `User`
11
+ # and an `Organization` class, these new classes will extend
12
+ # ActiveRecord::Base
13
+ for_each_child_class ApplicationModel do |klass|
14
+ # for a model class with an optional namespace, such as
15
+ # Users::UserModel, returns an array ['Users', 'User']
16
+ class_address = klass.name.gsub(/Model\Z/, "").split("::")
17
+ # the last item in the address is the new class name
18
+ class_name = class_address.pop
19
+ # where is this new class being created
20
+ namespace = if class_address.any?
21
+ # any remaining items describe the namespace
22
+ class_address.join("::").constantize
23
+ else
24
+ # Object is the top most namespace
25
+ Object
26
+ end
27
+
28
+ new_class = Class.new(ActiveRecord::Base)
29
+ namespace.const_set class_name, new_class
30
+ end
31
+
32
+ for_each ApplicationModel, :string_field do |klass, name|
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,58 @@
1
+ module Platformer
2
+ module DSLs
3
+ module Models
4
+ module Fields
5
+ module StringField
6
+ def self.included klass
7
+ klass.define_dsl :string_field do
8
+ description "Add a string field to this model."
9
+
10
+ # the name of the field
11
+ requires :name, :symbol do
12
+ description "The name of your field"
13
+ validate_format(/\A[a-z]+(_[a-z]+)*\Z/)
14
+ validate_length minimum: 1, maximum: 63
15
+
16
+ # can not be called "type" because it is reserved by STI models
17
+ validate_not_in [
18
+ # stage is used by state machines
19
+ :stage,
20
+ # timestamped booleans
21
+ :undeleted,
22
+ :deleted_at,
23
+ # timestamped booleans
24
+ # :un*,
25
+ # :*_at,
26
+ :stage,
27
+ # Reserved for the primary key
28
+ :id,
29
+ # Reserved for foreign keys
30
+ # *_id,
31
+ # Specifies that the model uses Single Table Inheritance.
32
+ :type,
33
+ # Automatically gets set to the current date and time when the record is first created.
34
+ :created_at,
35
+ # Automatically gets set to the current date and time whenever the record is created or updated.
36
+ :updated_at
37
+ # Adds optimistic locking to a model.
38
+ # lock_version,
39
+ # # Stores the type for polymorphic associations.
40
+ # *_type,
41
+ # # Used to cache the number of belonging objects on associations. For example, a comments_count column in an Article class that has many instances of Comment will cache the number of existent comments for each article.
42
+ # (table_name)_count,
43
+ ]
44
+ end
45
+
46
+ add_method :case_insensitive
47
+ add_method :required
48
+ add_method :unique
49
+ add_method :description do
50
+ requires :description, :string
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Platformer
4
+ VERSION = "1.0.0"
5
+ end
data/lib/platformer.rb ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dsl_compose"
4
+ require "active_record"
5
+
6
+ require "platformer/version"
7
+
8
+ Dir[File.expand_path "lib/platformer/dsls/**/*.rb"].each do |f|
9
+ require_relative f
10
+ end
11
+
12
+ Dir[File.expand_path "app/**/*.rb"].each do |f|
13
+ require_relative f
14
+ end
15
+
16
+ require "platformer/composer"
17
+
18
+ Dir[File.expand_path "lib/platformer/composers/**/*.rb"].each do |f|
19
+ require_relative f
20
+ end
21
+
22
+ module Platformer
23
+ class Error < StandardError
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: platformer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Craig Ulliott
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dsl_compose
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.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.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '7.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '7.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activemodel
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '7.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '7.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activerecord
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '7.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '7.0'
69
+ description: Easily create highly scalable and performant SaaS platforms through configuration
70
+ email:
71
+ - craigulliott@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - CHANGELOG.md
77
+ - CODE_OF_CONDUCT.md
78
+ - LICENSE.txt
79
+ - README.md
80
+ - lib/platformer.rb
81
+ - lib/platformer/composer.rb
82
+ - lib/platformer/composers/create_active_models.rb
83
+ - lib/platformer/dsls/models/fields/string_field.rb
84
+ - lib/platformer/version.rb
85
+ homepage:
86
+ licenses:
87
+ - MIT
88
+ metadata:
89
+ source_code_uri: https://github.com/craigulliott/platformer/
90
+ changelog_uri: https://github.com/craigulliott/platformer/blob/main/CHANGELOG.md
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 3.0.0
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.2.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Create SaaS Platforms through configuration
110
+ test_files: []