tk_inspect_rails 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b370ad918a1f20c7cdbaa14a257a90db2a429b3de60a682a8fb24aabed298a55
4
- data.tar.gz: ff9dc6c5c506d80f6beb2c52fb0527058fd6f40b306e752e7e93174488e65bed
3
+ metadata.gz: f67ef7bf473524ed91e7d501b0952ab265ceb7f1e53386b5664a04b5d1bf642b
4
+ data.tar.gz: 6b3e6778f9504f61a99d46704a40ade5b598701f1c80f75ea66420cf02ef89f8
5
5
  SHA512:
6
- metadata.gz: 606429d946c50c07ca6daba374c6a3c8318df495b7bcf972a2662ecdac2e84a2d9f69976158fbcc8edd06d31eed1f02f96244e39a63373c64868ad61b7a57692
7
- data.tar.gz: b76067a5c7888349107af642f78cbaf17a18c61a452aea04a51f7332a8c4fb37f6a29797ac693d0ce13cf7a9ba915c838d6c529dd23379dc426cbaa696e12d1b
6
+ metadata.gz: b18ecafb23f9a799fe4991ad7b4e3a28e20ba67461289a8978cc0737952517f7784c94c398d9b00df9a4b334d665ee7340fd87e5ce9b25e5374ae8f0a9a7092a
7
+ data.tar.gz: 3d723e2c88915476e98c71022bdd85f207d4dad732f35c30c97767c8091448a482a89d786be766af1b0d82d28cea98d602d9a4cc16f37f11d1be28e6e44f896e
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # Gem projects shouldn't commit its Gemfile.lock
14
+ Gemfile.lock
@@ -3,50 +3,48 @@ module TkInspect
3
3
  class ArRelationInspectorComponent < ::TkComponent::Base
4
4
  attr_accessor :inspector
5
5
 
6
- def generate(parent_component, options = {})
6
+ def render(p, parent_component)
7
7
  @relation = eval(inspector.expression, inspector.inspected_binding)
8
8
  @count = @relation.size if @relation.loaded?
9
- parse_component(parent_component, options) do |p|
10
- p.vframe(sticky: 'nsew', x_flex: 1, y_flex: 1) do |f|
11
- f.hframe(sticky: 'wne', padding: '8', x_flex: 1) do |hf|
12
- hf.label(text: "Relation Class")
13
- hf.entry(value: @relation.class.to_s, state: 'disabled', x_flex: 1)
14
- hf.button(text: "Browse...", on_click: ->(e) { inspector.browse_class(@relation.class.to_s) })
15
- hf.label(text: "Model Class")
16
- hf.entry(value: @relation.klass.to_s, state: 'disabled', x_flex: 1)
17
- hf.button(text: "Browse...", on_click: ->(e) { inspector.browse_class(@relation.klass.to_s) })
18
- hf.label(text: "Table")
19
- hf.entry(value: @relation.table.name, state: 'disabled', x_flex: 1)
20
- end
21
- f.vframe(sticky: 'wne', padding: '8', x_flex: 1) do |vf|
22
- vf.label(text: "SQL expression", sticky: 'w')
23
- vf.text(value: @relation.to_sql, width: 20, height: 3, x_flex: 1, sticky: 'new')
9
+ p.vframe(sticky: 'nsew', x_flex: 1, y_flex: 1) do |f|
10
+ f.hframe(sticky: 'wne', padding: '8', x_flex: 1) do |hf|
11
+ hf.label(text: "Relation Class")
12
+ hf.entry(value: @relation.class.to_s, state: 'disabled', x_flex: 1)
13
+ hf.button(text: "Browse...", on_click: ->(e) { inspector.browse_class(@relation.class.to_s) })
14
+ hf.label(text: "Model Class")
15
+ hf.entry(value: @relation.klass.to_s, state: 'disabled', x_flex: 1)
16
+ hf.button(text: "Browse...", on_click: ->(e) { inspector.browse_class(@relation.klass.to_s) })
17
+ hf.label(text: "Table")
18
+ hf.entry(value: @relation.table.name, state: 'disabled', x_flex: 1)
19
+ end
20
+ f.vframe(sticky: 'wne', padding: '8', x_flex: 1) do |vf|
21
+ vf.label(text: "SQL expression", sticky: 'w')
22
+ vf.text(value: @relation.to_sql, width: 20, height: 3, x_flex: 1, sticky: 'new')
23
+ end
24
+ if @count.present?
25
+ f.hframe(sticky: 'w', padding: '8', x_flex: 1) do |hf|
26
+ hf.label(text: "Object count")
27
+ hf.entry(value: @count, state: 'disabled')
24
28
  end
25
- if @count.present?
26
- f.hframe(sticky: 'w', padding: '8', x_flex: 1) do |hf|
27
- hf.label(text: "Object count")
28
- hf.entry(value: @count, state: 'disabled')
29
+ end
30
+ f.hframe(sticky: 'sw', padding: '8', x_flex: 1) do |hf|
31
+ if @relation.loaded?
32
+ @table = f.insert_component(
33
+ TkComponent::TableViewComponent,
34
+ self,
35
+ data_source: self,
36
+ columns: @relation.first.attributes.map do |k, v|
37
+ { key: k, text: k }
38
+ end,
39
+ sticky: 'nsew', x_flex: 1, y_flex: 1)
40
+ else
41
+ hf.label(text: "Contents not loaded")
42
+ hf.button(text: "Load contents") do |b|
43
+ b.on_click ->(e) { @relation.load; regenerate }
29
44
  end
30
- end
31
- f.hframe(sticky: 'sw', padding: '8', x_flex: 1) do |hf|
32
- if @relation.loaded?
33
- @table = f.insert_component(
34
- TkComponent::TableViewComponent,
35
- self,
36
- data_source: self,
37
- columns: @relation.first.attributes.map do |k, v|
38
- { key: k, text: k }
39
- end,
40
- sticky: 'nsew', x_flex: 1, y_flex: 1)
41
- else
42
- hf.label(text: "Contents not loaded")
43
- hf.button(text: "Load contents") do |b|
44
- b.on_click ->(e) { @relation.load; regenerate }
45
- end
46
- if @count.blank?
47
- hf.button(text: "Get object count") do |b|
48
- b.on_click ->(e) { @count = @relation.count; regenerate }
49
- end
45
+ if @count.blank?
46
+ hf.button(text: "Get object count") do |b|
47
+ b.on_click ->(e) { @count = @relation.count; regenerate }
50
48
  end
51
49
  end
52
50
  end
@@ -5,23 +5,21 @@ module TkInspectRails
5
5
  attr_accessor :expression
6
6
  attr_accessor :results
7
7
 
8
- def generate(parent_component, options = {})
9
- parse_component(parent_component, options) do |p|
10
- p.vpaned(sticky: 'wens', x_flex: 1, y_flex: 1) do |f|
11
- f.vframe(sticky: 'wens', x_flex: 1) do |vf|
12
- vf.hframe(sticky: 'wen', padding: 8, x_flex: 1) do |hf|
13
- hf.label(text: "SQL Expression", sticky: 'w', x_flex: 1)
14
- hf.button(text: "Execute", sticky: 'e', on_click: :execute_sql)
15
- end
16
- @text = vf.text(value: @expression.to_s, width: 20, height: 5, scrollers: 'y',
17
- x_flex: 1, y_flex: 1, sticky: 'news')
8
+ def render(p, parent_component)
9
+ p.vpaned(sticky: 'wens', x_flex: 1, y_flex: 1) do |f|
10
+ f.vframe(sticky: 'wens', x_flex: 1) do |vf|
11
+ vf.hframe(sticky: 'wen', padding: 8, x_flex: 1) do |hf|
12
+ hf.label(text: "SQL Expression", sticky: 'w', x_flex: 1)
13
+ hf.button(text: "Execute", sticky: 'e', on_click: :execute_sql)
18
14
  end
19
- f.insert_component(TkComponent::TableViewComponent, self,
20
- data_source: self,
21
- columns: @results&.first&.keys&.map { |k| { key: k, text: k } } || [],
22
- scrollers: 'xy',
23
- sticky: 'nsew', x_flex: 1, y_flex: 1)
15
+ @text = vf.text(value: @expression.to_s, width: 20, height: 5, scrollers: 'y',
16
+ x_flex: 1, y_flex: 1, sticky: 'news')
24
17
  end
18
+ f.insert_component(TkComponent::TableViewComponent, self,
19
+ data_source: self,
20
+ columns: @results&.first&.keys&.map { |k| { key: k, text: k } } || [],
21
+ scrollers: 'xy',
22
+ sticky: 'nsew', x_flex: 1, y_flex: 1)
25
23
  end
26
24
  end
27
25
 
@@ -1,3 +1,3 @@
1
1
  module TkInspectRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tk_inspect_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Egea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2021-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tk_inspect
@@ -95,7 +95,6 @@ files:
95
95
  - ".travis.yml"
96
96
  - CODE_OF_CONDUCT.md
97
97
  - Gemfile
98
- - Gemfile.lock
99
98
  - LICENSE.txt
100
99
  - README.md
101
100
  - Rakefile
@@ -1,169 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- tk_inspect_rails (0.1.0)
5
- rails
6
- tk_inspect (~> 0.1.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (6.0.3.4)
12
- actionpack (= 6.0.3.4)
13
- nio4r (~> 2.0)
14
- websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.3.4)
16
- actionpack (= 6.0.3.4)
17
- activejob (= 6.0.3.4)
18
- activerecord (= 6.0.3.4)
19
- activestorage (= 6.0.3.4)
20
- activesupport (= 6.0.3.4)
21
- mail (>= 2.7.1)
22
- actionmailer (6.0.3.4)
23
- actionpack (= 6.0.3.4)
24
- actionview (= 6.0.3.4)
25
- activejob (= 6.0.3.4)
26
- mail (~> 2.5, >= 2.5.4)
27
- rails-dom-testing (~> 2.0)
28
- actionpack (6.0.3.4)
29
- actionview (= 6.0.3.4)
30
- activesupport (= 6.0.3.4)
31
- rack (~> 2.0, >= 2.0.8)
32
- rack-test (>= 0.6.3)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.3.4)
36
- actionpack (= 6.0.3.4)
37
- activerecord (= 6.0.3.4)
38
- activestorage (= 6.0.3.4)
39
- activesupport (= 6.0.3.4)
40
- nokogiri (>= 1.8.5)
41
- actionview (6.0.3.4)
42
- activesupport (= 6.0.3.4)
43
- builder (~> 3.1)
44
- erubi (~> 1.4)
45
- rails-dom-testing (~> 2.0)
46
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.3.4)
48
- activesupport (= 6.0.3.4)
49
- globalid (>= 0.3.6)
50
- activemodel (6.0.3.4)
51
- activesupport (= 6.0.3.4)
52
- activerecord (6.0.3.4)
53
- activemodel (= 6.0.3.4)
54
- activesupport (= 6.0.3.4)
55
- activestorage (6.0.3.4)
56
- actionpack (= 6.0.3.4)
57
- activejob (= 6.0.3.4)
58
- activerecord (= 6.0.3.4)
59
- marcel (~> 0.3.1)
60
- activesupport (6.0.3.4)
61
- concurrent-ruby (~> 1.0, >= 1.0.2)
62
- i18n (>= 0.7, < 2)
63
- minitest (~> 5.1)
64
- tzinfo (~> 1.1)
65
- zeitwerk (~> 2.2, >= 2.2.2)
66
- builder (3.2.4)
67
- concurrent-ruby (1.1.8)
68
- crass (1.0.6)
69
- diff-lcs (1.4.4)
70
- erubi (1.10.0)
71
- globalid (0.4.2)
72
- activesupport (>= 4.2.0)
73
- i18n (1.8.7)
74
- concurrent-ruby (~> 1.0)
75
- loofah (2.9.0)
76
- crass (~> 1.0.2)
77
- nokogiri (>= 1.5.9)
78
- mail (2.7.1)
79
- mini_mime (>= 0.1.1)
80
- marcel (0.3.3)
81
- mimemagic (~> 0.3.2)
82
- method_source (1.0.0)
83
- mimemagic (0.3.5)
84
- mini_mime (1.0.2)
85
- mini_portile2 (2.5.0)
86
- minitest (5.14.3)
87
- nio4r (2.5.4)
88
- nokogiri (1.11.1)
89
- mini_portile2 (~> 2.5.0)
90
- racc (~> 1.4)
91
- racc (1.5.2)
92
- rack (2.2.3)
93
- rack-test (1.1.0)
94
- rack (>= 1.0, < 3)
95
- rails (6.0.3.4)
96
- actioncable (= 6.0.3.4)
97
- actionmailbox (= 6.0.3.4)
98
- actionmailer (= 6.0.3.4)
99
- actionpack (= 6.0.3.4)
100
- actiontext (= 6.0.3.4)
101
- actionview (= 6.0.3.4)
102
- activejob (= 6.0.3.4)
103
- activemodel (= 6.0.3.4)
104
- activerecord (= 6.0.3.4)
105
- activestorage (= 6.0.3.4)
106
- activesupport (= 6.0.3.4)
107
- bundler (>= 1.3.0)
108
- railties (= 6.0.3.4)
109
- sprockets-rails (>= 2.0.0)
110
- rails-dom-testing (2.0.3)
111
- activesupport (>= 4.2.0)
112
- nokogiri (>= 1.6)
113
- rails-html-sanitizer (1.3.0)
114
- loofah (~> 2.3)
115
- railties (6.0.3.4)
116
- actionpack (= 6.0.3.4)
117
- activesupport (= 6.0.3.4)
118
- method_source
119
- rake (>= 0.8.7)
120
- thor (>= 0.20.3, < 2.0)
121
- rake (10.5.0)
122
- rouge (3.26.0)
123
- rspec (3.10.0)
124
- rspec-core (~> 3.10.0)
125
- rspec-expectations (~> 3.10.0)
126
- rspec-mocks (~> 3.10.0)
127
- rspec-core (3.10.1)
128
- rspec-support (~> 3.10.0)
129
- rspec-expectations (3.10.1)
130
- diff-lcs (>= 1.2.0, < 2.0)
131
- rspec-support (~> 3.10.0)
132
- rspec-mocks (3.10.1)
133
- diff-lcs (>= 1.2.0, < 2.0)
134
- rspec-support (~> 3.10.0)
135
- rspec-support (3.10.1)
136
- sprockets (4.0.2)
137
- concurrent-ruby (~> 1.0)
138
- rack (> 1, < 3)
139
- sprockets-rails (3.2.2)
140
- actionpack (>= 4.0)
141
- activesupport (>= 4.0)
142
- sprockets (>= 3.0.0)
143
- thor (1.1.0)
144
- thread_safe (0.3.6)
145
- tk (0.3.0)
146
- tk_component (0.1.2)
147
- activesupport (~> 6.0.3)
148
- tk (~> 0.3.0)
149
- tk_inspect (0.1.0)
150
- rouge (~> 3.26)
151
- tk_component (~> 0.1.2)
152
- tzinfo (1.2.9)
153
- thread_safe (~> 0.1)
154
- websocket-driver (0.7.3)
155
- websocket-extensions (>= 0.1.0)
156
- websocket-extensions (0.1.5)
157
- zeitwerk (2.4.2)
158
-
159
- PLATFORMS
160
- ruby
161
-
162
- DEPENDENCIES
163
- bundler (~> 1.16)
164
- rake (~> 10.0)
165
- rspec (~> 3.0)
166
- tk_inspect_rails!
167
-
168
- BUNDLED WITH
169
- 1.16.6