consolle 0.3.9 → 0.4.1
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/.version +1 -1
- data/Gemfile.lock +1 -1
- data/lib/consolle/cli.rb +424 -118
- data/lib/consolle/history.rb +210 -0
- data/lib/consolle/session_registry.rb +327 -0
- data/rule.ko.md +74 -5
- data/rule.md +74 -5
- metadata +3 -1
data/rule.md
CHANGED
|
@@ -8,6 +8,15 @@ Similar to Rails console, results executed within the session are maintained and
|
|
|
8
8
|
|
|
9
9
|
Before use, check the status with `status`, and after finishing work, you should `stop` it.
|
|
10
10
|
|
|
11
|
+
## Installation Note
|
|
12
|
+
|
|
13
|
+
For projects with a Gemfile, it's recommended to use `bundle exec`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle exec cone start
|
|
17
|
+
$ bundle exec cone exec 'User.count'
|
|
18
|
+
```
|
|
19
|
+
|
|
11
20
|
## Purpose of Cone
|
|
12
21
|
|
|
13
22
|
Cone is used for debugging, data exploration, and as a development assistant tool.
|
|
@@ -27,9 +36,21 @@ $ cone start # Start server (uses RAILS_ENV or defaults to development)
|
|
|
27
36
|
$ RAILS_ENV=test cone start # Start console in test environment
|
|
28
37
|
```
|
|
29
38
|
|
|
39
|
+
When started, cone displays session information including a unique Session ID:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
$ cone start
|
|
43
|
+
✓ Rails console started
|
|
44
|
+
Session ID: a1b2c3d4 (a1b2)
|
|
45
|
+
Target: cone
|
|
46
|
+
Environment: development
|
|
47
|
+
PID: 12345
|
|
48
|
+
Socket: /path/to/cone.socket
|
|
49
|
+
```
|
|
50
|
+
|
|
30
51
|
It also provides stop and restart commands.
|
|
31
52
|
|
|
32
|
-
Cone provides only one session at a time, and to change the execution environment, you must stop and restart.
|
|
53
|
+
Cone provides only one session at a time per target, and to change the execution environment, you must stop and restart.
|
|
33
54
|
|
|
34
55
|
```bash
|
|
35
56
|
$ cone stop # Stop server
|
|
@@ -37,6 +58,51 @@ $ cone stop # Stop server
|
|
|
37
58
|
|
|
38
59
|
Always terminate when you finish your work.
|
|
39
60
|
|
|
61
|
+
## Session Management
|
|
62
|
+
|
|
63
|
+
### Listing Sessions
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
$ cone ls # Show active sessions only
|
|
67
|
+
$ cone ls -a # Show all sessions including stopped ones
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Example output:
|
|
71
|
+
```
|
|
72
|
+
ACTIVE SESSIONS:
|
|
73
|
+
|
|
74
|
+
ID TARGET ENV STATUS UPTIME COMMANDS
|
|
75
|
+
a1b2 cone development running 2h 15m 42
|
|
76
|
+
e5f6 api production running 1h 30m 15
|
|
77
|
+
|
|
78
|
+
Usage: cone exec -t TARGET CODE
|
|
79
|
+
cone exec --session ID CODE
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Session History
|
|
83
|
+
|
|
84
|
+
View command history for sessions:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
$ cone history # Current session history
|
|
88
|
+
$ cone history -t api # History for 'api' target
|
|
89
|
+
$ cone history --session a1b2 # History for specific session ID
|
|
90
|
+
$ cone history -n 10 # Last 10 commands
|
|
91
|
+
$ cone history --today # Today's commands only
|
|
92
|
+
$ cone history --failed # Failed commands only
|
|
93
|
+
$ cone history --grep User # Filter by pattern
|
|
94
|
+
$ cone history --json # Output as JSON
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Removing Sessions
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
$ cone rm a1b2 # Remove stopped session by ID
|
|
101
|
+
$ cone rm -f a1b2 # Force remove (stops if running)
|
|
102
|
+
$ cone prune # Remove all stopped sessions
|
|
103
|
+
$ cone prune --yes # Remove without confirmation
|
|
104
|
+
```
|
|
105
|
+
|
|
40
106
|
## Execution Modes
|
|
41
107
|
|
|
42
108
|
Cone supports three execution modes. You can specify the mode with the `--mode` option.
|
|
@@ -82,10 +148,13 @@ mode: embed-rails
|
|
|
82
148
|
```bash
|
|
83
149
|
$ cone status
|
|
84
150
|
✓ Rails console is running
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
151
|
+
Session ID: a1b2c3d4 (a1b2)
|
|
152
|
+
Target: cone
|
|
153
|
+
Environment: development
|
|
154
|
+
PID: 12345
|
|
155
|
+
Uptime: 2h 15m
|
|
156
|
+
Commands: 42
|
|
157
|
+
Socket: /path/to/cone.socket
|
|
89
158
|
```
|
|
90
159
|
|
|
91
160
|
## Executing Code
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: consolle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nacyot
|
|
@@ -82,12 +82,14 @@ files:
|
|
|
82
82
|
- lib/consolle/config.rb
|
|
83
83
|
- lib/consolle/constants.rb
|
|
84
84
|
- lib/consolle/errors.rb
|
|
85
|
+
- lib/consolle/history.rb
|
|
85
86
|
- lib/consolle/server/base_supervisor.rb
|
|
86
87
|
- lib/consolle/server/console_socket_server.rb
|
|
87
88
|
- lib/consolle/server/console_supervisor.rb
|
|
88
89
|
- lib/consolle/server/embedded_supervisor.rb
|
|
89
90
|
- lib/consolle/server/request_broker.rb
|
|
90
91
|
- lib/consolle/server/supervisor_factory.rb
|
|
92
|
+
- lib/consolle/session_registry.rb
|
|
91
93
|
- lib/consolle/version.rb
|
|
92
94
|
- mise/release.sh
|
|
93
95
|
- rule.ko.md
|