consolle 0.3.8 → 0.3.9
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 +54 -0
- data/rule.ko.md +19 -0
- data/rule.md +19 -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: 4a0ab18a0025d5dbc4f6141658e8108563ed955e4c4c25cde511ef3993fa45a4
|
|
4
|
+
data.tar.gz: 50c1de9ff776a35f8bc3f84acd4d183680cb859abcb8e3540af4637eafa29a95
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b0673f5b4530a4987c065ddd255e5fe273f6019ce3615f260a4f2fa2b27128f6655294ca8661df0a001ef64a059a13e58eca340926aa36e7d152eb91d4606ea
|
|
7
|
+
data.tar.gz: 51cc56fab4520a2ced10192ab90714715343b6689c962fc587fd943a388c22b6ecbdea41d42b79446ae9d3ef5c1b86a1b8c30e7e15add83883c8a5ba0274230d
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.9
|
data/Gemfile.lock
CHANGED
data/lib/consolle/cli.rb
CHANGED
|
@@ -11,6 +11,55 @@ require_relative 'constants'
|
|
|
11
11
|
require_relative 'adapters/rails_console'
|
|
12
12
|
|
|
13
13
|
module Consolle
|
|
14
|
+
# Rails convenience commands subcommand
|
|
15
|
+
class RailsCommands < Thor
|
|
16
|
+
namespace :rails
|
|
17
|
+
|
|
18
|
+
class_option :verbose, type: :boolean, aliases: '-v', desc: 'Verbose output'
|
|
19
|
+
class_option :target, type: :string, aliases: '-t', desc: 'Target session name', default: 'cone'
|
|
20
|
+
|
|
21
|
+
desc 'reload', 'Reload Rails application code (reload!)'
|
|
22
|
+
def reload
|
|
23
|
+
execute_rails_code('reload!')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc 'env', 'Show current Rails environment'
|
|
27
|
+
def env
|
|
28
|
+
execute_rails_code('Rails.env')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc 'db', 'Show database connection information'
|
|
32
|
+
def db
|
|
33
|
+
code = <<~RUBY
|
|
34
|
+
config = ActiveRecord::Base.connection_db_config
|
|
35
|
+
puts "Adapter: \#{config.adapter}"
|
|
36
|
+
puts "Database: \#{config.database}"
|
|
37
|
+
puts "Host: \#{config.host || 'localhost'}" if config.respond_to?(:host)
|
|
38
|
+
puts "Pool: \#{config.pool}" if config.respond_to?(:pool)
|
|
39
|
+
puts "Connected: \#{ActiveRecord::Base.connected?}"
|
|
40
|
+
nil
|
|
41
|
+
RUBY
|
|
42
|
+
execute_rails_code(code)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def execute_rails_code(code)
|
|
48
|
+
# Delegate to main CLI's exec command
|
|
49
|
+
cli = Consolle::CLI.new
|
|
50
|
+
cli.options = {
|
|
51
|
+
target: options[:target] || 'cone',
|
|
52
|
+
verbose: options[:verbose] || false,
|
|
53
|
+
timeout: 60,
|
|
54
|
+
raw: false
|
|
55
|
+
}
|
|
56
|
+
cli.exec(code)
|
|
57
|
+
rescue SystemExit
|
|
58
|
+
# Allow exit from exec
|
|
59
|
+
raise
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
14
63
|
class CLI < Thor
|
|
15
64
|
package_name 'Consolle'
|
|
16
65
|
|
|
@@ -38,6 +87,7 @@ module Consolle
|
|
|
38
87
|
shell.say ' cone restart # Restart Rails console'
|
|
39
88
|
shell.say ' cone status # Show Rails console status'
|
|
40
89
|
shell.say ' cone exec CODE # Execute Ruby code in Rails console'
|
|
90
|
+
shell.say ' cone rails SUBCOMMAND # Rails convenience commands'
|
|
41
91
|
shell.say ' cone ls # List active Rails console sessions'
|
|
42
92
|
shell.say ' cone stop_all # Stop all Rails console sessions'
|
|
43
93
|
shell.say ' cone rule FILE # Write cone command guide to FILE'
|
|
@@ -66,6 +116,10 @@ module Consolle
|
|
|
66
116
|
class_option :verbose, type: :boolean, aliases: '-v', desc: 'Verbose output'
|
|
67
117
|
class_option :target, type: :string, aliases: '-t', desc: 'Target session name', default: 'cone'
|
|
68
118
|
|
|
119
|
+
# Register rails subcommand
|
|
120
|
+
desc 'rails SUBCOMMAND', 'Rails convenience commands (reload, env, db)'
|
|
121
|
+
subcommand 'rails', RailsCommands
|
|
122
|
+
|
|
69
123
|
def self.exit_on_failure?
|
|
70
124
|
true
|
|
71
125
|
end
|
data/rule.ko.md
CHANGED
|
@@ -123,6 +123,25 @@ hello, world
|
|
|
123
123
|
Execution time: 0.001s
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
## Rails 편의 명령어
|
|
127
|
+
|
|
128
|
+
자주 사용하는 Rails 작업을 위한 편의 명령어를 제공합니다:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
$ cone rails env # 현재 Rails 환경 확인
|
|
132
|
+
=> "development"
|
|
133
|
+
|
|
134
|
+
$ cone rails reload # 애플리케이션 코드 리로드 (reload!)
|
|
135
|
+
Reloading...
|
|
136
|
+
=> true
|
|
137
|
+
|
|
138
|
+
$ cone rails db # 데이터베이스 연결 정보 확인
|
|
139
|
+
Adapter: postgresql
|
|
140
|
+
Database: myapp_development
|
|
141
|
+
Host: localhost
|
|
142
|
+
Connected: true
|
|
143
|
+
```
|
|
144
|
+
|
|
126
145
|
## 코드 입력 모범 사례
|
|
127
146
|
|
|
128
147
|
### 홑따옴표 사용 (강력 권장)
|
data/rule.md
CHANGED
|
@@ -123,6 +123,25 @@ hello, world
|
|
|
123
123
|
Execution time: 0.001s
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
## Rails Convenience Commands
|
|
127
|
+
|
|
128
|
+
Cone provides convenience commands for common Rails operations:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
$ cone rails env # Show current Rails environment
|
|
132
|
+
=> "development"
|
|
133
|
+
|
|
134
|
+
$ cone rails reload # Reload application code (reload!)
|
|
135
|
+
Reloading...
|
|
136
|
+
=> true
|
|
137
|
+
|
|
138
|
+
$ cone rails db # Show database connection information
|
|
139
|
+
Adapter: postgresql
|
|
140
|
+
Database: myapp_development
|
|
141
|
+
Host: localhost
|
|
142
|
+
Connected: true
|
|
143
|
+
```
|
|
144
|
+
|
|
126
145
|
## Best Practices for Code Input
|
|
127
146
|
|
|
128
147
|
### Using Single Quotes (Strongly Recommended)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: consolle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nacyot
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-12-
|
|
10
|
+
date: 2025-12-03 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: logger
|