lizarb 0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -2
- data/Gemfile +21 -2
- data/Gemfile.lock +44 -0
- data/README.md +88 -12
- data/app/dev/commands/app_command.rb +5 -0
- data/app/dev/commands/app_command_test.rb +7 -0
- data/app/dev/commands/example_command.rb +57 -0
- data/app/dev/commands/example_command_test.rb +43 -0
- data/app/dev/commands/macro_child_command.rb +32 -0
- data/app/dev/commands/macro_child_command_test.rb +7 -0
- data/app/dev/commands/macro_parent_command.rb +70 -0
- data/app/dev/commands/macro_parent_command_test.rb +7 -0
- data/app/dev/commands/my_command.rb +7 -0
- data/app/dev/commands/my_command_test.rb +7 -0
- data/app/dev/commands/new_command.rb +69 -0
- data/app/dev/commands/new_command_test.rb +7 -0
- data/app/dev_box.rb +13 -0
- data/app/happy/axos/axo.rb +50 -0
- data/app/happy_box.rb +8 -0
- data/app/net/databases/redis_db.rb +5 -0
- data/app/net/databases/redis_db_test.rb +12 -0
- data/app/net/databases/sqlite_db.rb +11 -0
- data/app/net/databases/sqlite_db_test.rb +12 -0
- data/app/net/models/app_model.rb +20 -0
- data/app/net/models/app_model_test.rb +8 -0
- data/app/net/models/post_model.rb +4 -0
- data/app/net/models/post_model_test.rb +8 -0
- data/app/net/models/user_model.rb +4 -0
- data/app/net/models/user_model_test.rb +8 -0
- data/app/net_box.rb +21 -0
- data/app/web/requests/api_request.rb +61 -0
- data/app/web/requests/api_request_test.rb +31 -0
- data/app/web/requests/app_request.rb +5 -0
- data/app/web/requests/app_request_test.rb +7 -0
- data/app/web/requests/assets_request.rb +71 -0
- data/app/web/requests/assets_request_test.rb +33 -0
- data/app/web/requests/root_request.rb +55 -0
- data/app/web/requests/root_request_test.rb +31 -0
- data/app/web_box.rb +8 -0
- data/app.code.env +11 -0
- data/app.env +11 -0
- data/app.rb +17 -0
- data/app_new/.gitignore +4 -0
- data/app_new/Gemfile +31 -0
- data/app_new/Procfile +3 -0
- data/exe/Gemfile +3 -0
- data/exe/Gemfile.lock +13 -0
- data/exe/liza +3 -0
- data/exe/lizarb +11 -0
- data/lib/app.rb +200 -0
- data/lib/dev_system/dev/controllers/command/dev_command.rb +19 -0
- data/lib/dev_system/dev/controllers/command/dev_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/echo_command.rb +11 -0
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/test_command.rb +70 -0
- data/lib/dev_system/dev/controllers/command/test_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/version_command.rb +9 -0
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command.rb +19 -0
- data/lib/dev_system/dev/controllers/command_test.rb +14 -0
- data/lib/dev_system/dev/dev_box.rb +19 -0
- data/lib/dev_system/dev/dev_box_test.rb +19 -0
- data/lib/dev_system/dev/panels/command_panel.rb +10 -0
- data/lib/dev_system/dev/panels/command_panel_test.rb +23 -0
- data/lib/dev_system/dev/panels/log_panel.rb +10 -0
- data/lib/dev_system/dev/panels/log_panel_test.rb +18 -0
- data/lib/dev_system.rb +8 -0
- data/lib/happy_system/dev/happy_command.rb +11 -0
- data/lib/happy_system/happy/controllers/axo.rb +8 -0
- data/lib/happy_system/happy/happy_box.rb +12 -0
- data/lib/happy_system/happy/happy_box_test.rb +18 -0
- data/lib/happy_system/happy/panels/axo_panel.rb +5 -0
- data/lib/{viral.rb → happy_system.rb} +7 -3
- data/lib/liza/base/box.rb +40 -0
- data/lib/liza/base/box_test.rb +12 -0
- data/lib/liza/base/controller.rb +27 -0
- data/lib/liza/base/controller_test.rb +12 -0
- data/lib/liza/base/panel.rb +38 -0
- data/lib/liza/base/panel_test.rb +16 -0
- data/lib/liza/meta/part.rb +19 -0
- data/lib/liza/meta/part_extension.rb +13 -0
- data/lib/liza/meta/part_test.rb +8 -0
- data/lib/liza/meta/system.rb +20 -0
- data/lib/liza/meta/system_test.rb +13 -0
- data/lib/liza/test/test.rb +11 -0
- data/lib/liza/test/test_test.rb +108 -0
- data/lib/liza/test_parts/test_assertions_part.rb +110 -0
- data/lib/liza/test_parts/test_context_part.rb +81 -0
- data/lib/liza/test_parts/test_dsl_part.rb +122 -0
- data/lib/liza/test_parts/test_subject_part.rb +19 -0
- data/lib/liza/unit.rb +149 -0
- data/lib/liza/unit_test.rb +79 -0
- data/lib/liza.rb +34 -0
- data/lib/lizarb/ruby/class.rb +15 -0
- data/lib/lizarb/ruby/string.rb +9 -0
- data/lib/lizarb/ruby/time.rb +9 -0
- data/lib/{viral → lizarb}/version.rb +2 -2
- data/lib/lizarb.rb +68 -0
- data/lib/net_system/dev/net_command.rb +24 -0
- data/lib/net_system/net/controllers/adapter/redis_adapter.rb +28 -0
- data/lib/net_system/net/controllers/adapter/redis_adapter_test.rb +29 -0
- data/lib/net_system/net/controllers/adapter/sqlite_adapter.rb +28 -0
- data/lib/net_system/net/controllers/adapter/sqlite_adapter_test.rb +29 -0
- data/lib/net_system/net/controllers/adapter.rb +5 -0
- data/lib/net_system/net/controllers/adapter_test.rb +14 -0
- data/lib/net_system/net/controllers/database/redis_db.rb +11 -0
- data/lib/net_system/net/controllers/database/redis_db_test.rb +23 -0
- data/lib/net_system/net/controllers/database/sqlite_db.rb +11 -0
- data/lib/net_system/net/controllers/database/sqlite_db_test.rb +23 -0
- data/lib/net_system/net/controllers/database.rb +33 -0
- data/lib/net_system/net/controllers/database_test.rb +14 -0
- data/lib/net_system/net/controllers/model.rb +31 -0
- data/lib/net_system/net/controllers/model_test.rb +14 -0
- data/lib/net_system/net/net_box.rb +20 -0
- data/lib/net_system/net/net_box_test.rb +19 -0
- data/lib/net_system/net/panels/adapter_panel.rb +5 -0
- data/lib/net_system/net/panels/adapter_panel_test.rb +18 -0
- data/lib/net_system/net/panels/database_panel.rb +12 -0
- data/lib/net_system/net/panels/database_panel_test.rb +18 -0
- data/lib/net_system.rb +3 -0
- data/lib/web_system/dev/web_command.rb +42 -0
- data/lib/web_system/web/controllers/request/client_error_request.rb +18 -0
- data/lib/web_system/web/controllers/request/not_found_request.rb +18 -0
- data/lib/web_system/web/controllers/request/server_error_request.rb +20 -0
- data/lib/web_system/web/controllers/request.rb +5 -0
- data/lib/web_system/web/controllers/request_test.rb +18 -0
- data/lib/web_system/web/panels/request_panel.rb +55 -0
- data/lib/web_system/web/panels/request_panel_test.rb +14 -0
- data/lib/web_system/web/web_box.rb +12 -0
- data/lib/web_system/web/web_box_test.rb +18 -0
- data/lib/web_system.rb +5 -0
- data/lizarb.gemspec +44 -0
- data/sig/{viral.rbs → lizarb.rbs} +1 -1
- data/web_files/favicon.ico +0 -0
- data/web_files/favicon.svg +948 -0
- metadata +190 -13
- data/viral.gemspec +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c859781b1927e69f516b2b6d057b19a4e8d6603945636ce0ec7306640fbd1956
|
4
|
+
data.tar.gz: d5849f4bcbf610ee5a94df16dbd92feab78a4f724e2ac77eeae05e93aebfbef5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e4ffd81acfddf2a8aadebc0fcc10911141b3a8fc55e164d050fc3c8156a7ee560a7a84133c12d19e1491ff9c720b8a6afd857b6c22bdf14844ac03550c2dc6e
|
7
|
+
data.tar.gz: bd421065bc059d7ebeac4d3d805e2133a18d0bb31745bc95a4b62d785f2b2368fbd80482cd2a7cac2cec03a239dc58b988844c1a234f4a0aa9a84ef99fc77256
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
|
3
|
+
-
|
4
4
|
|
5
|
-
-
|
5
|
+
## [1.0.0] - 2022-10-11
|
6
|
+
|
7
|
+
- App, Liza and Lizarb
|
8
|
+
- Liza::Unit, Liza::Part
|
9
|
+
- Liza::Test
|
10
|
+
- Liza::Unit has class/instance methods settings/set/set/add/fetch
|
11
|
+
- Liza::Unit has class/instance methods log/log_color/log_level/log?/log_level?
|
12
|
+
- Liza::System, Liza::Box, Liza::Panel, Liza::Controller
|
13
|
+
- DevSystem, Liza::DevBox, Liza::Command, AppCommand, and others
|
14
|
+
- HappySystem, Liza::HappyBox, Liza::Axo, Axo, and others
|
15
|
+
- NetSystem, Liza::NetBox, Liza::Adapter, Liza::Database, Liza::Model, AppModel, and others
|
16
|
+
- WebSystem, Liza::WebBox, Liza::Request, AppRequest, and others
|
data/Gemfile
CHANGED
@@ -2,7 +2,26 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
# Specify your gem's dependencies in
|
5
|
+
# Specify your gem's dependencies in lizarb.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
8
|
+
group :dev do
|
9
|
+
# gems you only want to load if DevSystem is loaded
|
10
|
+
end
|
11
|
+
|
12
|
+
group :happy do
|
13
|
+
# gems you only want to load if HappySystem is loaded
|
14
|
+
end
|
15
|
+
|
16
|
+
group :net do
|
17
|
+
# gems you only want to load if NetSystem is loaded
|
18
|
+
gem "redis", "~> 5.0"
|
19
|
+
gem "sqlite3", "~> 1.5"
|
20
|
+
end
|
21
|
+
|
22
|
+
group :web do
|
23
|
+
# gems you only want to load if WebSystem is loaded
|
24
|
+
gem "rack", "~> 3.0"
|
25
|
+
gem "rackup", "~> 0.2.2"
|
26
|
+
gem "puma", "~> 5.6"
|
27
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lizarb (1.0.0)
|
5
|
+
colorize (~> 0.8)
|
6
|
+
dotenv (~> 2.8)
|
7
|
+
zeitwerk (~> 2.6)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
colorize (0.8.1)
|
13
|
+
connection_pool (2.3.0)
|
14
|
+
dotenv (2.8.1)
|
15
|
+
nio4r (2.5.8)
|
16
|
+
puma (5.6.5)
|
17
|
+
nio4r (~> 2.0)
|
18
|
+
rack (3.0.0)
|
19
|
+
rackup (0.2.2)
|
20
|
+
rack (>= 3.0.0.beta1)
|
21
|
+
webrick
|
22
|
+
rake (13.0.6)
|
23
|
+
redis (5.0.5)
|
24
|
+
redis-client (>= 0.9.0)
|
25
|
+
redis-client (0.10.0)
|
26
|
+
connection_pool
|
27
|
+
sqlite3 (1.5.2-x86_64-linux)
|
28
|
+
webrick (1.7.0)
|
29
|
+
zeitwerk (2.6.1)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
x86_64-linux
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
lizarb!
|
36
|
+
puma (~> 5.6)
|
37
|
+
rack (~> 3.0)
|
38
|
+
rackup (~> 0.2.2)
|
39
|
+
rake (~> 13.0)
|
40
|
+
redis (~> 5.0)
|
41
|
+
sqlite3 (~> 1.5)
|
42
|
+
|
43
|
+
BUNDLED WITH
|
44
|
+
2.3.22
|
data/README.md
CHANGED
@@ -1,18 +1,82 @@
|
|
1
|
-
#
|
1
|
+
# Liza
|
2
2
|
|
3
|
-
|
3
|
+
Liza is a light, experimental framework primarily developed to help study the Ruby language and the Ruby ecosystem.
|
4
4
|
|
5
|
-
|
5
|
+
## Install
|
6
6
|
|
7
|
-
|
7
|
+
Install the gem by executing:
|
8
8
|
|
9
|
-
|
9
|
+
$ gem install lizarb
|
10
10
|
|
11
|
-
|
11
|
+
You will get the following three shims:
|
12
12
|
|
13
|
-
|
13
|
+
$ lizarb version
|
14
|
+
$ liza version
|
14
15
|
|
15
|
-
|
16
|
+
## Try
|
17
|
+
|
18
|
+
Try Liza with an interactive prompt
|
19
|
+
|
20
|
+
$ liza dev
|
21
|
+
|
22
|
+
## Running Tests
|
23
|
+
|
24
|
+
Run your Liza tests
|
25
|
+
|
26
|
+
$ liza test
|
27
|
+
|
28
|
+
## Happy
|
29
|
+
|
30
|
+
Try Liza and build an ASCII game
|
31
|
+
|
32
|
+
$ liza happy axo
|
33
|
+
|
34
|
+
## Networking
|
35
|
+
|
36
|
+
Try Liza to connect with Sqlite and Redis
|
37
|
+
|
38
|
+
$ liza net
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
|
42
|
+
NetBox.adapters.get :sqlite
|
43
|
+
NetBox.adapters.get :redis_url
|
44
|
+
|
45
|
+
NetBox.databases.sql
|
46
|
+
NetBox.databases.sqlite
|
47
|
+
NetBox.databases.redis
|
48
|
+
|
49
|
+
RedisDb.current
|
50
|
+
SqliteDb.current
|
51
|
+
|
52
|
+
RedisDb.current.call "TIME"
|
53
|
+
SqliteDb.current.call "SELECT name, sql FROM sqlite_master WHERE type = 'table';"
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
## Web Server
|
58
|
+
|
59
|
+
Try Liza with the Rack Web Server
|
60
|
+
|
61
|
+
$ liza web
|
62
|
+
|
63
|
+
http://localhost:3000/
|
64
|
+
|
65
|
+
http://localhost:3000/xxxxxxx
|
66
|
+
|
67
|
+
http://localhost:3000/api/xxxxxxx
|
68
|
+
|
69
|
+
http://localhost:3000/api/auth/sign_up
|
70
|
+
|
71
|
+
http://localhost:3000/api/auth/sign_in
|
72
|
+
|
73
|
+
http://localhost:3000/api/auth/account
|
74
|
+
|
75
|
+
http://localhost:3000/api/auth/sign_out
|
76
|
+
|
77
|
+
http://localhost:3000/assets/app.css
|
78
|
+
|
79
|
+
http://localhost:3000/assets/app.js
|
16
80
|
|
17
81
|
## Usage
|
18
82
|
|
@@ -20,13 +84,25 @@ TODO: Write usage instructions here
|
|
20
84
|
|
21
85
|
## Development
|
22
86
|
|
23
|
-
|
87
|
+
To install dependencies, run this bash script:
|
88
|
+
|
89
|
+
$ bin/setup
|
90
|
+
|
91
|
+
For development experiments, use the local executable script
|
92
|
+
|
93
|
+
$ exe/lizarb test
|
94
|
+
|
95
|
+
To build and install lizarb in your local machine
|
96
|
+
|
97
|
+
$ bundle exec rake install
|
98
|
+
|
99
|
+
## Release
|
24
100
|
|
25
|
-
To
|
101
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
102
|
|
27
103
|
## Contributing
|
28
104
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
105
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rubyonrails-brasil/lizarb. 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/rubyonrails-brasil/lizarb/blob/master/CODE_OF_CONDUCT.md).
|
30
106
|
|
31
107
|
## License
|
32
108
|
|
@@ -34,4 +110,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
34
110
|
|
35
111
|
## Code of Conduct
|
36
112
|
|
37
|
-
Everyone interacting in the
|
113
|
+
Everyone interacting in the Lizarb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rubyonrails-brasil/lizarb/blob/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class ExampleCommand < AppCommand
|
2
|
+
|
3
|
+
def self.call(args)
|
4
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
5
|
+
|
6
|
+
class_helper_method_1(args)
|
7
|
+
class_helper_method_2(args)
|
8
|
+
class_helper_method_3(args)
|
9
|
+
|
10
|
+
command = new(args)
|
11
|
+
command.helper_method_1(args)
|
12
|
+
command.helper_method_2(args)
|
13
|
+
command.helper_method_3(args)
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
|
18
|
+
def self.class_helper_method_1(args)
|
19
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
20
|
+
1
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.class_helper_method_2(args)
|
24
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
25
|
+
2
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.class_helper_method_3(args)
|
29
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
30
|
+
3
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
|
35
|
+
def initialize(args)
|
36
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
37
|
+
@init_args = args
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
|
42
|
+
def helper_method_1(args)
|
43
|
+
log :higher, "Called #{self}.#{__method__} (which has @init_args #{@init_args}) with args #{args}"
|
44
|
+
@init_args[0]
|
45
|
+
end
|
46
|
+
|
47
|
+
def helper_method_2(args)
|
48
|
+
log :higher, "Called #{self}.#{__method__} (which has @init_args #{@init_args}) with args #{args}"
|
49
|
+
@init_args[1]
|
50
|
+
end
|
51
|
+
|
52
|
+
def helper_method_3(args)
|
53
|
+
log :higher, "Called #{self}.#{__method__} (which has @init_args #{@init_args}) with args #{args}"
|
54
|
+
@init_args[2]
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class ExampleCommandTest < AppCommandTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == ExampleCommand
|
5
|
+
end
|
6
|
+
|
7
|
+
group "class methods" do
|
8
|
+
|
9
|
+
test :class_helper_method_1 do
|
10
|
+
assert subject_class.class_helper_method_1([]) == 1
|
11
|
+
end
|
12
|
+
|
13
|
+
test :class_helper_method_2 do
|
14
|
+
assert subject_class.class_helper_method_2([]) == 2
|
15
|
+
end
|
16
|
+
|
17
|
+
test :class_helper_method_3 do
|
18
|
+
assert subject_class.class_helper_method_3([]) == 3
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
group "instance methods" do
|
24
|
+
|
25
|
+
before do
|
26
|
+
@subject = subject_class.new([1, 2, 3])
|
27
|
+
end
|
28
|
+
|
29
|
+
test :helper_method_1 do
|
30
|
+
assert @subject.helper_method_1([]) == 1
|
31
|
+
end
|
32
|
+
|
33
|
+
test :helper_method_2 do
|
34
|
+
assert @subject.helper_method_2([]) == 2
|
35
|
+
end
|
36
|
+
|
37
|
+
test :helper_method_3 do
|
38
|
+
assert @subject.helper_method_3([]) == 3
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class MacroChildCommand < MacroParentCommand
|
2
|
+
|
3
|
+
class_macro_method_1 :important_thing
|
4
|
+
class_macro_method_2 :other_thing
|
5
|
+
class_macro_method_3 :other_important_thing
|
6
|
+
class_macro_method_4 :ruby_is_awesome
|
7
|
+
|
8
|
+
#
|
9
|
+
|
10
|
+
def call(args)
|
11
|
+
log :higher, "Called #{self}.#{__method__} (which has @init_args #{@init_args}) with args #{args}"
|
12
|
+
|
13
|
+
if @@class_macro_3
|
14
|
+
@result << :YES_from_instance_call
|
15
|
+
else
|
16
|
+
@result << :NO_from_instance_call
|
17
|
+
end
|
18
|
+
|
19
|
+
@result << helper_method(args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def helper_method(args)
|
23
|
+
log :higher, "Called #{self}.#{__method__} (which has @init_args #{@init_args}) with args #{args}"
|
24
|
+
|
25
|
+
if @@class_macro_4
|
26
|
+
:Yes_from_helper_method
|
27
|
+
else
|
28
|
+
:No_from_helper_method
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class MacroParentCommand < AppCommand
|
2
|
+
|
3
|
+
def self.class_macro_method_1(arg)
|
4
|
+
log :higher, "Called #{self}.#{__method__} with arg #{arg}"
|
5
|
+
@@class_macro_1 = arg
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.class_macro_method_2(arg)
|
9
|
+
log :higher, "Called #{self}.#{__method__} with arg #{arg}"
|
10
|
+
@@class_macro_2 = arg
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.class_macro_method_3(arg)
|
14
|
+
log :higher, "Called #{self}.#{__method__} with arg #{arg}"
|
15
|
+
@@class_macro_3 = arg
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.class_macro_method_4(arg)
|
19
|
+
log :higher, "Called #{self}.#{__method__} with arg #{arg}"
|
20
|
+
@@class_macro_4 = arg
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
|
25
|
+
def self.call(args)
|
26
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
27
|
+
|
28
|
+
if @@class_macro_1
|
29
|
+
args << :yes_from_class_call
|
30
|
+
else
|
31
|
+
args << :no_from_class_call
|
32
|
+
end
|
33
|
+
|
34
|
+
command = new(args)
|
35
|
+
result = command.call(args)
|
36
|
+
|
37
|
+
puts <<-OUTPUT
|
38
|
+
|
39
|
+
self: #{self}
|
40
|
+
args: #{args}
|
41
|
+
command: #{command}
|
42
|
+
result: #{result}
|
43
|
+
|
44
|
+
OUTPUT
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
|
49
|
+
attr_reader :result
|
50
|
+
|
51
|
+
def initialize(args)
|
52
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
53
|
+
@init_args = args
|
54
|
+
|
55
|
+
@result = [args]
|
56
|
+
|
57
|
+
if @@class_macro_2
|
58
|
+
@result << :yes_from_initialize
|
59
|
+
else
|
60
|
+
@result << :no_from_initialize
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
|
66
|
+
def call(args)
|
67
|
+
raise NotImplementedError, "implement this on MacroChildCommand"
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class NewCommand < AppCommand
|
2
|
+
|
3
|
+
def self.call args
|
4
|
+
log :higher, "Called #{self}.#{__method__} with args #{args}"
|
5
|
+
|
6
|
+
# setup
|
7
|
+
|
8
|
+
name = args.shift || "app_1"
|
9
|
+
|
10
|
+
from = "#{Lizarb::APP_DIR}/app_new"
|
11
|
+
to = name
|
12
|
+
|
13
|
+
return log "Directory #{to.light_green} already exists." if Dir.exist? to
|
14
|
+
|
15
|
+
log "Liza Application initializing at `#{to}`"
|
16
|
+
|
17
|
+
# init
|
18
|
+
|
19
|
+
require "fileutils"
|
20
|
+
FileUtils.cp_r from, to, verbose: true
|
21
|
+
|
22
|
+
`cd #{to}; git init .`
|
23
|
+
|
24
|
+
# extra
|
25
|
+
|
26
|
+
puts
|
27
|
+
FileUtils.mkdir_p "#{to}/app", verbose: true
|
28
|
+
|
29
|
+
FileUtils.mkdir_p "#{to}/lib", verbose: true
|
30
|
+
FileUtils.touch "#{to}/lib/.gitkeep", verbose: true
|
31
|
+
FileUtils.mkdir_p "#{to}/tmp", verbose: true
|
32
|
+
FileUtils.touch "#{to}/tmp/.gitkeep", verbose: true
|
33
|
+
|
34
|
+
# systems
|
35
|
+
|
36
|
+
App.systems.keys.each { |system_name| copy name, system_name }
|
37
|
+
|
38
|
+
FileUtils.rm "#{to}/app/dev/commands/new_command.rb"
|
39
|
+
FileUtils.rm "#{to}/app/dev/commands/new_command_test.rb"
|
40
|
+
|
41
|
+
FileUtils.cp_r "#{Lizarb::APP_DIR}/.ruby-version", "#{to}/.ruby-version", verbose: true
|
42
|
+
FileUtils.cp_r "#{Lizarb::APP_DIR}/README.md", "#{to}/README.md", verbose: true
|
43
|
+
FileUtils.cp_r "#{Lizarb::APP_DIR}/app.rb", "#{to}/app.rb", verbose: true
|
44
|
+
FileUtils.cp_r "#{Lizarb::APP_DIR}/app.env", "#{to}/app.env", verbose: true
|
45
|
+
FileUtils.cp_r "#{Lizarb::APP_DIR}/app.code.env", "#{to}/app.code.env", verbose: true
|
46
|
+
puts
|
47
|
+
|
48
|
+
log "Liza Application initialized at `#{to}`"
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.copy name, system_name
|
52
|
+
from = "#{Lizarb::APP_DIR}/app/#{system_name}_box.rb"
|
53
|
+
to = "#{name}/app"
|
54
|
+
if File.exist? from
|
55
|
+
FileUtils.cp_r from, to, verbose: true
|
56
|
+
else
|
57
|
+
puts "file not found #{from}"
|
58
|
+
end
|
59
|
+
|
60
|
+
from = "#{Lizarb::APP_DIR}/app/#{system_name}"
|
61
|
+
to = "#{name}/app"
|
62
|
+
if File.exist? from
|
63
|
+
FileUtils.cp_r from, to, verbose: true
|
64
|
+
else
|
65
|
+
puts "file not found #{from}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/app/dev_box.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class DevBox < Liza::DevBox
|
2
|
+
|
3
|
+
commands do
|
4
|
+
# Set up your command panel per the DSL in http://guides.lizarb.com/panels/command.html
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
logs do
|
9
|
+
# Set up your log panel per the DSL in http://guides.lizarb.com/panels/log.html
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Axo < Liza::Axo
|
2
|
+
|
3
|
+
# Set up your request controllers per the DSL in http://guides.lizarb.org/controllers/axo.html
|
4
|
+
|
5
|
+
def self.call args
|
6
|
+
cycles = args[0] || "3"
|
7
|
+
sleep_time = args[1] || "3"
|
8
|
+
|
9
|
+
cycles = cycles.to_i
|
10
|
+
sleep_time = sleep_time.to_f / 10
|
11
|
+
|
12
|
+
array = <<-HEREDOC.split("\n")
|
13
|
+
>(.___.)<
|
14
|
+
>(.__.)<
|
15
|
+
>(.___.)< code
|
16
|
+
>(.__.)< code to
|
17
|
+
>(.___.)< code to the
|
18
|
+
>(.__.)< code to the right
|
19
|
+
>(.___.)< code to the right
|
20
|
+
>(.__.)<
|
21
|
+
code >(.___.)<
|
22
|
+
code to >(.__.)<
|
23
|
+
code to the >(.___.)<
|
24
|
+
code to the left >(.__.)<
|
25
|
+
code to the left >(.___.)<
|
26
|
+
>(.__.)<
|
27
|
+
HEREDOC
|
28
|
+
|
29
|
+
cycles.times do |i|
|
30
|
+
array.each_with_index do |s, j|
|
31
|
+
system "clear"
|
32
|
+
|
33
|
+
puts "Axo v0"
|
34
|
+
puts "frame: #{j}/#{array.size}"
|
35
|
+
puts "cycle: #{i}/#{cycles} (#{sleep_time}spf)"
|
36
|
+
puts
|
37
|
+
puts
|
38
|
+
puts " " * 3 + s.bold.light_white
|
39
|
+
puts
|
40
|
+
|
41
|
+
sleep sleep_time
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
puts "That was actually quite a nice workout session!".black.on_white
|
46
|
+
puts " We should do this again some time. ".black.on_white
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/app/happy_box.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class RedisDbTest < Liza::RedisDbTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == RedisDb
|
5
|
+
assert RedisDb.current.class == RedisDb
|
6
|
+
assert Liza::RedisDb.current.class == RedisDb
|
7
|
+
assert RedisDb.current == Liza::RedisDb.current
|
8
|
+
assert RedisDb.current.adapter == Liza::RedisDb.current.adapter
|
9
|
+
assert RedisDb.current.adapter.conn == Liza::RedisDb.current.adapter.conn
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class SqliteDb < Liza::SqliteDb
|
2
|
+
|
3
|
+
# Set up your database controllers per the DSL in http://guides.lizarb.org/controllers/database.html
|
4
|
+
|
5
|
+
def table_names
|
6
|
+
result = call "SELECT name FROM sqlite_schema;"
|
7
|
+
result.delete_at 0
|
8
|
+
result.flatten
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|