ru.Bee 1.3.0 → 1.3.2
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 +4 -4
- data/lib/app/views/welcome_show.erb +9 -14
- data/lib/rubee/models/sequel_object.rb +10 -2
- data/lib/rubee.rb +1 -1
- data/lib/tests/test.db +0 -0
- data/readme.md +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5810b6eb69d752cea118184cc0fd70559a7b6c76024f3fa2cccca1eaedc7305e
|
4
|
+
data.tar.gz: 648ef60b8a9d94ec49c5cd8e31882873637660935097cadcca5124aad19198ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30c9cdc416a9875128b2ca186cf0a60ae9f85463f49492c625972d8a908a1acab524f024c926a2fcc05f519af3b5112f96bcc32a0953b756f57effdb7eaefe49
|
7
|
+
data.tar.gz: 21de68b11a410bd67aeea32707409ecc173b3af5dceab016675c41904cc6e452dcc889668c05ec1918e5a683049f02ebfce778fc3c0f2008e071ea49c8ffe5b1
|
@@ -1,14 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
<
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<p>rubee homepage: <a href="https://github.com/nucleom42/rubee"><br/>https://github.com/nucleom42/rubee</a></p>
|
11
|
-
<br/>
|
12
|
-
<p>Version: <%= Rubee::VERSION %></p>
|
13
|
-
</div>
|
14
|
-
|
1
|
+
<div class="container">
|
2
|
+
<%= render_template :welcome_header %>
|
3
|
+
<br/>
|
4
|
+
<img src="images/rubee.svg" alt="ruBee">
|
5
|
+
<br/>
|
6
|
+
<p>rubee homepage: <a href="https://github.com/nucleom42/rubee"><br/>https://github.com/nucleom42/rubee</a></p>
|
7
|
+
<br/>
|
8
|
+
<p>Version: <%= Rubee::VERSION %></p>
|
9
|
+
</div>
|
@@ -21,11 +21,19 @@ module Rubee
|
|
21
21
|
def save
|
22
22
|
args = to_h.dup&.transform_keys(&:to_sym)
|
23
23
|
if args[:id]
|
24
|
-
|
24
|
+
begin
|
25
|
+
udpate(args)
|
26
|
+
rescue => _
|
27
|
+
return false
|
28
|
+
end
|
25
29
|
|
26
30
|
true
|
27
31
|
else
|
28
|
-
|
32
|
+
begin
|
33
|
+
created_object = self.class.create(args)
|
34
|
+
rescue => _
|
35
|
+
return false
|
36
|
+
end
|
29
37
|
self.id = created_object.id
|
30
38
|
|
31
39
|
true
|
data/lib/rubee.rb
CHANGED
@@ -8,7 +8,7 @@ module Rubee
|
|
8
8
|
APP_ROOT = File.expand_path(Dir.pwd) unless defined?(APP_ROOT)
|
9
9
|
IMAGE_DIR = File.join(APP_ROOT, 'images') unless defined?(IMAGE_DIR)
|
10
10
|
PROJECT_NAME = File.basename(APP_ROOT) unless defined?(PROJECT_NAME)
|
11
|
-
VERSION = '1.
|
11
|
+
VERSION = '1.3.1'
|
12
12
|
|
13
13
|
class Application
|
14
14
|
include Singleton
|
data/lib/tests/test.db
CHANGED
Binary file
|
data/readme.md
CHANGED
@@ -280,6 +280,37 @@ So it may safe some resources.
|
|
280
280
|
## Views
|
281
281
|
View in ruBee is just a plain html/erb file that can be rendered from the controller.
|
282
282
|
|
283
|
+
## Templates over erb
|
284
|
+
|
285
|
+
You can use erb as a template engine in the views.
|
286
|
+
|
287
|
+
layout.erb is the parent template that is rendered first and then the child templates are rendered inside it.
|
288
|
+
Feel free to include you custom css and js files in the this file.
|
289
|
+
|
290
|
+
```ruby
|
291
|
+
# app/controllers/welcome_controller.rb
|
292
|
+
|
293
|
+
class WelcomeController < Rubee::BaseController
|
294
|
+
def show
|
295
|
+
response_with object: { message: 'Hello, world!' }
|
296
|
+
end
|
297
|
+
end
|
298
|
+
```
|
299
|
+
|
300
|
+
```erb
|
301
|
+
# app/views/welcome_header.erb
|
302
|
+
|
303
|
+
<h1>All set up and running!</h1>
|
304
|
+
```
|
305
|
+
|
306
|
+
```erb
|
307
|
+
# app/views/welcome_show.erb
|
308
|
+
|
309
|
+
<div class="container">
|
310
|
+
<%= render_template :welcome_header %> # you can easily attach erb temlate using render_template method
|
311
|
+
<p><%= locals[:object][:message] %></p> # displaying, passed in the controller object
|
312
|
+
</div>
|
313
|
+
```
|
283
314
|
## Object hooks
|
284
315
|
|
285
316
|
In ruBee by extending Hookable module any Ruby object can be charged with hooks (logic),
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ru.Bee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Saltykov
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-08 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|