database_logic 1.0.0 → 1.2.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 +6 -1
- data/README.md +24 -3
- data/database_logic.gemspec +12 -2
- data/lib/database_logic/version.rb +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e7d4d04fc61c6ed08b7921f51de7e57746f1d91bdf5df8780f9166a45365ec4
|
4
|
+
data.tar.gz: 75d41913f39c7dc80429b6a2a819a4f27780ab62f985fa21ae483d2101071f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01b9698bd683240224696217acb78d3724367dabbc3ce34dfb9c910d41c53bdd5133440814e1c9d723978e3c2c2d97b34be4b64dce3c5a329813afa51c6dcc69
|
7
|
+
data.tar.gz: b8d005c6d694811f5e48ddb96e35a8e59c6c27cd3cb40e0b8f5124eb76cfc92055dcab232a1e320f187c94b4371a7e68adcc10cec0fa242319c97366616d065e
|
@@ -0,0 +1,45 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
release:
|
6
|
+
types: [published]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
permissions:
|
13
|
+
contents: read
|
14
|
+
packages: write
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby 2.7
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: '2.7'
|
22
|
+
bundler-cache: true
|
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,25 @@ 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 CreateInitialSnapsho after insert users`
|
31
|
+
|
32
|
+
`rails g database_logic:trigger DeleteUserData before delete users`
|
33
|
+
|
34
|
+
`rails g database_logic:function SuperFunc`
|
35
|
+
|
36
|
+
`rails g database_logic:procedure CleanupLogTables`
|
37
|
+
|
38
|
+
`rails g database_logic:event Daily 24 hour`
|
39
|
+
|
40
|
+
`rails g database_logic:event hourly_task 60 minute`
|
41
|
+
|
42
|
+
|
43
|
+
## Usage / walkthrough
|
22
44
|
|
23
45
|
First, let's try creating a view. For this, we will need an User model, as follows:
|
24
46
|
|
@@ -143,7 +165,6 @@ Let's try it out, in a rails console (`rails c`)
|
|
143
165
|
2.5.5 :008 > Transaction.create(user_id: 1, amount_in_cents: 123, kind: "Transfer")
|
144
166
|
=> #<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
167
|
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
168
|
=> 123
|
148
169
|
```
|
149
170
|
|
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
|
@@ -12,13 +14,18 @@ Gem::Specification.new do |spec|
|
|
12
14
|
spec.description = "This gem lets you write SQL functions, procedures, scheduled events, views and triggers/notifications.."
|
13
15
|
spec.homepage = "https://github.com/freecrap/database_logic"
|
14
16
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
17
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
18
|
|
17
19
|
#spec.metadata["allowed_push_host"] = "to do Set to 'http://mygemserver.com'"
|
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"
|
24
|
+
# additional links
|
25
|
+
spec.metadata["bug_tracker_uri"] = "https://www.turnkey-sportsbook-software.com"
|
26
|
+
spec.metadata["mailing_list_uri"] = "https://www.sportsbooksoftware.com"
|
27
|
+
spec.metadata["wiki_uri"] = "https://www.whitelabelsportsbook.com"
|
28
|
+
spec.metadata["funding_uri"] = "https://www.whitelabelsportsbook.net"
|
22
29
|
|
23
30
|
# Specify which files should be added to the gem when it is released.
|
24
31
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -29,6 +36,9 @@ Gem::Specification.new do |spec|
|
|
29
36
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
37
|
spec.require_paths = ["lib"]
|
31
38
|
|
39
|
+
# Uncomment to register a new dependency of your gem
|
40
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
41
|
+
|
32
42
|
# For more information and examples about making a new gem, checkout our
|
33
43
|
# guide at: https://bundler.io/guides/creating_gem.html
|
34
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem lets you write SQL functions, procedures, scheduled events,
|
14
14
|
views and triggers/notifications..
|
@@ -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,11 @@ 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
|
60
|
+
bug_tracker_uri: https://www.turnkey-sportsbook-software.com
|
61
|
+
mailing_list_uri: https://www.sportsbooksoftware.com
|
62
|
+
wiki_uri: https://www.whitelabelsportsbook.com
|
63
|
+
funding_uri: https://www.whitelabelsportsbook.net
|
59
64
|
post_install_message:
|
60
65
|
rdoc_options: []
|
61
66
|
require_paths:
|
@@ -64,14 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
69
|
requirements:
|
65
70
|
- - ">="
|
66
71
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.
|
72
|
+
version: 2.7.0
|
68
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
74
|
requirements:
|
70
75
|
- - ">="
|
71
76
|
- !ruby/object:Gem::Version
|
72
77
|
version: '0'
|
73
78
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.1.6
|
75
80
|
signing_key:
|
76
81
|
specification_version: 4
|
77
82
|
summary: Helps working with database logic.
|