openbox 0.3.1 → 0.4.0
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/Gemfile.lock +1 -1
- data/README.md +20 -1
- data/exe/openbox +10 -0
- data/lib/openbox/version.rb +1 -1
- 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: c3b2286d2b3b83ce60a50ead93f7f3b293612cd7a9386f21309b2078467acf3e
|
4
|
+
data.tar.gz: e1b3b12fe3c36503c9cfe1c72ac38163b1c7850eeda7e4395adf79c665abc19e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 741418382ee5a71631d3ff8303ea421091527338f72b6a42cfc441c94acdad51b7ede680b44515724bacd3c715e8878e339ed84b80b16186f14750c2c4f3edb9
|
7
|
+
data.tar.gz: ba0bfebc3ed03a62a4321e389202992f7bf988cf00a3a99d6651569fedd46d1496839a35d037f7815e5b336c5ca2af54ae5e60cdd46544b2fdb87d28a128d381
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -51,10 +51,29 @@ The commands are pre-defined for the Rack and Rails applications.
|
|
51
51
|
| `AUTO_MIGRATION` | When present, the `migrate` will run before `server` started |
|
52
52
|
| `DATABASE_URL` | When `pg` or `mysql2` gem present, Openbox will use it to ensure database connection |
|
53
53
|
|
54
|
+
### Customize Commands
|
55
|
+
|
56
|
+
When `openbox` execute, the `lib/openbox/commands/*/**.rb` will be scanned and require before started.
|
57
|
+
We can register new command by adding files to `lib/openbox/commands` directory.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
# lib/openbox/commands/daemon.rb
|
61
|
+
|
62
|
+
class Daemon < Openbox::Command
|
63
|
+
def execute
|
64
|
+
exec('bundle exec my-daemon')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
Openbox::Entrypoint.register Daemon, :daemon, :daemon, 'Run a daemon'
|
69
|
+
```
|
70
|
+
|
71
|
+
> The Rails are not loaded to speed up bootstrap, if you need Rails please load by yourself.
|
72
|
+
|
54
73
|
## Roadmap
|
55
74
|
|
56
75
|
* [ ] `config/openbox.rb` config
|
57
|
-
* [
|
76
|
+
* [x] Customize command
|
58
77
|
* [x] Database connection check
|
59
78
|
* [x] PostgreSQL support
|
60
79
|
* [x] MySQL support
|
data/exe/openbox
CHANGED
@@ -4,4 +4,14 @@
|
|
4
4
|
|
5
5
|
require 'openbox'
|
6
6
|
|
7
|
+
CUSTOMIZE_COMMAND_ROOT = if defined?(Bundler)
|
8
|
+
Bundler.root.join('lib/openbox/commands')
|
9
|
+
else
|
10
|
+
Pathname.new(Dir.pwd).join('lib/openbox/commands')
|
11
|
+
end
|
12
|
+
|
13
|
+
CUSTOMIZE_COMMAND_ROOT.glob('**/*.rb') do |command|
|
14
|
+
require command
|
15
|
+
end
|
16
|
+
|
7
17
|
Openbox::Entrypoint.start(ARGV)
|
data/lib/openbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|