database_logic 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +45 -0
- data/CHANGELOG.md +3 -1
- data/README.md +22 -3
- data/database_logic.gemspec +6 -1
- data/lib/database_logic/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f7d950f5136e488d9a942ec97a936520c36f23f5a68eadc4a6d1c6a70264fe3
|
4
|
+
data.tar.gz: 625847efdadcba073955282d69977007b673ade7bbc051a788696b89935c4ac7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7f44b156a686d24722370ec3db2a1daa3e7adabc421cc496febf7c32b266fbb8f415843bef7764735a11cd3247d84e9bd35e21df0d80a6f1e64d5ba991af1dc
|
7
|
+
data.tar.gz: 763e1328827c9b6bfcd3718bc6b6f9b1ff8f809fe0c8ab32c64caa9c51816bf0c889756025f7df8543f99ebd9fd084f8faad0be15ad967cb52c82b09e92870ce
|
@@ -0,0 +1,45 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: Build + Publish
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
permissions:
|
14
|
+
contents: read
|
15
|
+
packages: write
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby 2.6
|
20
|
+
uses: actions/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: 2.6.x
|
23
|
+
|
24
|
+
- name: Publish to GPR
|
25
|
+
run: |
|
26
|
+
mkdir -p $HOME/.gem
|
27
|
+
touch $HOME/.gem/credentials
|
28
|
+
chmod 0600 $HOME/.gem/credentials
|
29
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
30
|
+
gem build *.gemspec
|
31
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
32
|
+
env:
|
33
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
34
|
+
OWNER: ${{ github.repository_owner }}
|
35
|
+
|
36
|
+
- name: Publish to RubyGems
|
37
|
+
run: |
|
38
|
+
mkdir -p $HOME/.gem
|
39
|
+
touch $HOME/.gem/credentials
|
40
|
+
chmod 0600 $HOME/.gem/credentials
|
41
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
42
|
+
gem build *.gemspec
|
43
|
+
gem push *.gem
|
44
|
+
env:
|
45
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# DatabaseLogic
|
2
2
|
|
3
|
-
|
3
|
+
Right, database layer logic is a big no-no in the Rails community.
|
4
|
+
|
5
|
+
But if you're building something serious, sooner or later you will need to break the rules - none of these frameworks are silver bullets despite the almost-fanatism behind their doctrines.
|
6
|
+
|
7
|
+
There are several gems out there that come up with different solutions, yet they are very opinionated and sometimes get in the way. This simple gem tries to solve these issues with a few simple tasks and generators.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -18,7 +22,23 @@ Or install it yourself as:
|
|
18
22
|
|
19
23
|
$ gem install database_logic
|
20
24
|
|
21
|
-
|
25
|
+
|
26
|
+
## Quick howto
|
27
|
+
|
28
|
+
`rails g database_logic:view users_full`
|
29
|
+
|
30
|
+
`rails g database_logic:trigger MyAwesomeTrigger after insert users`
|
31
|
+
|
32
|
+
`rails g database_logic:function SuperFunc`
|
33
|
+
|
34
|
+
`rails g database_logic:procedure MegaProcedure`
|
35
|
+
|
36
|
+
`rails g database_logic:event Daily 24 hour`
|
37
|
+
|
38
|
+
`rails g database_logic:event hourly_task 60 minute`
|
39
|
+
|
40
|
+
|
41
|
+
## Usage / walkthrough
|
22
42
|
|
23
43
|
First, let's try creating a view. For this, we will need an User model, as follows:
|
24
44
|
|
@@ -143,7 +163,6 @@ Let's try it out, in a rails console (`rails c`)
|
|
143
163
|
2.5.5 :008 > Transaction.create(user_id: 1, amount_in_cents: 123, kind: "Transfer")
|
144
164
|
=> #<Transaction id: 81, user_id: 1, amount_in_cents: 123, kind: "Transfer", created_at: "2021-06-19 18:05:32", updated_at: "2021-06-19 18:05:32">
|
145
165
|
2.5.5 :009 > User.first.balance_in_cents;
|
146
|
-
User Load (1.6ms) SELECT `users`.* FROM `users` ORDER BY `users`.`id` ASC LIMIT 1
|
147
166
|
=> 123
|
148
167
|
```
|
149
168
|
|
data/database_logic.gemspec
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require_relative "lib/database_logic/version"
|
4
4
|
|
5
|
+
# TODO write this shit
|
6
|
+
|
5
7
|
Gem::Specification.new do |spec|
|
6
8
|
spec.name = "database_logic"
|
7
9
|
spec.version = DatabaseLogic::VERSION
|
@@ -18,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
18
20
|
|
19
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
22
|
spec.metadata["source_code_uri"] = "https://github.com/freecrap/database_logic"
|
21
|
-
spec.metadata["changelog_uri"] = "https://www.github.com/
|
23
|
+
spec.metadata["changelog_uri"] = "https://www.github.com/changelog.md"
|
22
24
|
|
23
25
|
# Specify which files should be added to the gem when it is released.
|
24
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -29,6 +31,9 @@ Gem::Specification.new do |spec|
|
|
29
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
32
|
spec.require_paths = ["lib"]
|
31
33
|
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
+
|
32
37
|
# For more information and examples about making a new gem, checkout our
|
33
38
|
# guide at: https://bundler.io/guides/creating_gem.html
|
34
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick
|
@@ -18,6 +18,7 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
+
- ".github/workflows/gem-push.yml"
|
21
22
|
- ".gitignore"
|
22
23
|
- ".rspec"
|
23
24
|
- CHANGELOG.md
|
@@ -55,7 +56,7 @@ licenses:
|
|
55
56
|
metadata:
|
56
57
|
homepage_uri: https://github.com/freecrap/database_logic
|
57
58
|
source_code_uri: https://github.com/freecrap/database_logic
|
58
|
-
changelog_uri: https://www.github.com/
|
59
|
+
changelog_uri: https://www.github.com/changelog.md
|
59
60
|
post_install_message:
|
60
61
|
rdoc_options: []
|
61
62
|
require_paths:
|
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
72
|
- !ruby/object:Gem::Version
|
72
73
|
version: '0'
|
73
74
|
requirements: []
|
74
|
-
rubygems_version: 3.0.
|
75
|
+
rubygems_version: 3.0.3.1
|
75
76
|
signing_key:
|
76
77
|
specification_version: 4
|
77
78
|
summary: Helps working with database logic.
|