clevic 0.12.0 → 0.13.0.b1

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.
Files changed (119) hide show
  1. data/History.txt +10 -0
  2. data/Manifest.txt +209 -30
  3. data/README.txt +16 -20
  4. data/Rakefile +8 -8
  5. data/TODO +6 -7
  6. data/bin/clevic +12 -73
  7. data/lib/clevic/action_builder.rb +168 -0
  8. data/lib/clevic/ar_methods.rb +120 -0
  9. data/lib/clevic/attribute_list.rb +56 -0
  10. data/lib/clevic/cache_table.rb +60 -37
  11. data/lib/clevic/default_view.rb +3 -16
  12. data/lib/clevic/delegate.rb +46 -0
  13. data/lib/clevic/emitter.rb +38 -0
  14. data/lib/clevic/extensions.rb +61 -114
  15. data/lib/clevic/field.rb +159 -228
  16. data/lib/clevic/field_valuer.rb +165 -0
  17. data/lib/clevic/filter_command.rb +2 -6
  18. data/lib/clevic/generic_format.rb +52 -0
  19. data/lib/clevic/{ui → icons}/icon.png +0 -0
  20. data/lib/clevic/many_field.rb +7 -0
  21. data/lib/clevic/model_builder.rb +234 -146
  22. data/lib/clevic/model_column.rb +61 -13
  23. data/lib/clevic/order_attribute.rb +10 -0
  24. data/lib/clevic/qt.rb +35 -0
  25. data/lib/clevic/qt/action_builder.rb +47 -0
  26. data/lib/clevic/qt/boolean_delegate.rb +8 -0
  27. data/lib/clevic/{browser.rb → qt/browser.rb} +35 -14
  28. data/lib/clevic/qt/clipboard.rb +35 -0
  29. data/lib/clevic/qt/combo_delegate.rb +198 -0
  30. data/lib/clevic/qt/delegates.rb +1 -0
  31. data/lib/clevic/qt/distinct_delegate.rb +35 -0
  32. data/lib/clevic/qt/extensions.rb +52 -0
  33. data/lib/clevic/qt/field.rb +18 -0
  34. data/lib/clevic/{item_delegate.rb → qt/item_delegate.rb} +8 -4
  35. data/lib/clevic/qt/relational_delegate.rb +87 -0
  36. data/lib/clevic/{search_dialog.rb → qt/search_dialog.rb} +1 -11
  37. data/lib/clevic/qt/set_delegate.rb +44 -0
  38. data/lib/clevic/qt/table_model.rb +331 -0
  39. data/lib/clevic/qt/table_view.rb +344 -0
  40. data/lib/clevic/qt/text_area_delegate.rb +8 -0
  41. data/lib/clevic/{text_delegate.rb → qt/text_delegate.rb} +6 -4
  42. data/lib/clevic/{ui → qt/ui}/.gitignore +0 -0
  43. data/lib/clevic/{ui → qt/ui}/browser.ui +0 -0
  44. data/lib/clevic/{ui → qt/ui}/search_dialog.ui +0 -0
  45. data/lib/clevic/rails_models_loaders.rb +56 -0
  46. data/lib/clevic/record.rb +2 -17
  47. data/lib/clevic/sampler.rb +81 -0
  48. data/lib/clevic/sequel_ar_adapter.rb +215 -0
  49. data/lib/clevic/sequel_length_validation.rb +23 -0
  50. data/lib/clevic/sequel_meta.rb +65 -0
  51. data/lib/clevic/sequel_naked.rb +30 -0
  52. data/lib/clevic/swing.rb +38 -0
  53. data/lib/clevic/swing/action.rb +125 -0
  54. data/lib/clevic/swing/action_builder.rb +47 -0
  55. data/lib/clevic/swing/boolean_delegate.rb +26 -0
  56. data/lib/clevic/swing/browser.rb +282 -0
  57. data/lib/clevic/swing/cell_editor.rb +95 -0
  58. data/lib/clevic/swing/cell_renderer.rb +44 -0
  59. data/lib/clevic/swing/clipboard.rb +135 -0
  60. data/lib/clevic/swing/combo_delegate.rb +336 -0
  61. data/lib/clevic/swing/confirm_dialog.rb +57 -0
  62. data/lib/clevic/swing/delegate.rb +40 -0
  63. data/lib/clevic/swing/distinct_delegate.rb +30 -0
  64. data/lib/clevic/swing/extensions.rb +274 -0
  65. data/lib/clevic/swing/field.rb +35 -0
  66. data/lib/clevic/swing/relational_delegate.rb +48 -0
  67. data/lib/clevic/swing/row_header.rb +210 -0
  68. data/lib/clevic/swing/search_dialog.rb +230 -0
  69. data/lib/clevic/swing/selection_model.rb +90 -0
  70. data/lib/clevic/swing/set_delegate.rb +41 -0
  71. data/lib/clevic/swing/swing_table_index.rb +43 -0
  72. data/lib/clevic/swing/table_model.rb +200 -0
  73. data/lib/clevic/swing/table_view.rb +385 -0
  74. data/lib/clevic/swing/table_view_focus.rb +47 -0
  75. data/lib/clevic/swing/tag_delegate.rb +127 -0
  76. data/lib/clevic/swing/tag_editor.rb +101 -0
  77. data/lib/clevic/swing/text_area_delegate.rb +46 -0
  78. data/lib/clevic/swing/text_delegate.rb +31 -0
  79. data/lib/clevic/swing/ui/build.xml +74 -0
  80. data/lib/clevic/swing/ui/dist/README.TXT +33 -0
  81. data/lib/clevic/swing/ui/dist/lib/swing-layout-1.0.3.jar +0 -0
  82. data/lib/clevic/swing/ui/manifest.mf +3 -0
  83. data/lib/clevic/swing/ui/nbproject/build-impl.xml +731 -0
  84. data/lib/clevic/swing/ui/nbproject/genfiles.properties +8 -0
  85. data/lib/clevic/swing/ui/nbproject/private/config.properties +0 -0
  86. data/lib/clevic/swing/ui/nbproject/private/private.properties +6 -0
  87. data/lib/clevic/swing/ui/nbproject/private/private.xml +4 -0
  88. data/lib/clevic/swing/ui/nbproject/project.properties +70 -0
  89. data/lib/clevic/swing/ui/nbproject/project.xml +14 -0
  90. data/lib/clevic/swing/ui/src/SearchDialog.form +158 -0
  91. data/lib/clevic/swing/ui/src/SearchDialog.java +163 -0
  92. data/lib/clevic/swing/ui/src/TagEditor.form +106 -0
  93. data/lib/clevic/swing/ui/src/TagEditor.java +108 -0
  94. data/lib/clevic/swing/ui/src/resources/SearchDialog.properties +0 -0
  95. data/lib/clevic/table_index.rb +100 -0
  96. data/lib/clevic/table_model.rb +54 -425
  97. data/lib/clevic/table_searcher.rb +113 -116
  98. data/lib/clevic/table_view.rb +171 -399
  99. data/lib/clevic/table_view_paste.rb +199 -0
  100. data/lib/clevic/version.rb +3 -2
  101. data/lib/clevic/view.rb +94 -43
  102. data/models/accounts_models.rb +13 -13
  103. data/models/minimal_models.rb +5 -9
  104. data/models/times_models.rb +19 -14
  105. data/models/times_psql_models.rb +10 -0
  106. data/models/times_sqlite_models.rb +1 -8
  107. data/models/values_models.rb +2 -8
  108. data/tasks/clevic.rake +1 -1
  109. data/tasks/rdoc.rake +1 -5
  110. data/tasks/website.rake +1 -1
  111. data/test/test_cache_table.rb +15 -29
  112. data/test/test_helper.rb +14 -83
  113. data/test/test_order_attribute.rb +1 -1
  114. data/test/test_table_model.rb +0 -21
  115. data/test/test_table_searcher.rb +67 -61
  116. metadata +262 -78
  117. data/lib/clevic.rb +0 -4
  118. data/lib/clevic/db_options.rb +0 -112
  119. data/lib/clevic/delegates.rb +0 -386
data/History.txt CHANGED
@@ -1,3 +1,13 @@
1
+ == 0.13.0
2
+ * Now has Java Swing support with JRuby
3
+ * new code works with qt4-qtruby-2.0.3
4
+ * All models must now use Sequel. There is some code to ease porting
5
+ from ActiveRecord
6
+ * preliminary and not yet working support for one_to_many fields in the UI
7
+
8
+ == 0.12.3
9
+ * fix closeEditor not moving to the cursor to the correct place
10
+
1
11
  == 0.12.0
2
12
  * fix some breakage from Qt-4.5.x
3
13
  * paste single value to multiple cells
data/Manifest.txt CHANGED
@@ -4,38 +4,10 @@ README.txt
4
4
  Rakefile
5
5
  TODO
6
6
  bin/clevic
7
- lib/clevic/dirty.rb
8
- lib/clevic.rb
9
- lib/clevic/browser.rb
10
- lib/clevic/cache_table.rb
11
- lib/clevic/db_options.rb
12
- lib/clevic/default_view.rb
13
- lib/clevic/delegates.rb
14
- lib/clevic/extensions.rb
15
- lib/clevic/field.rb
16
- lib/clevic/filter_command.rb
17
- lib/clevic/item_delegate.rb
18
- lib/clevic/model_builder.rb
19
- lib/clevic/model_column.rb
20
- lib/clevic/order_attribute.rb
21
- lib/clevic/record.rb
22
- lib/clevic/search_dialog.rb
23
- lib/clevic/sql_dialects.rb
24
- lib/clevic/table_model.rb
25
- lib/clevic/table_searcher.rb
26
- lib/clevic/table_view.rb
27
- lib/clevic/text_delegate.rb
28
- lib/clevic/view.rb
29
- lib/clevic/ui/.gitignore
30
- lib/clevic/ui/browser.ui
31
- lib/clevic/ui/browser_ui.rb
32
- lib/clevic/ui/icon.png
33
- lib/clevic/ui/search_dialog.ui
34
- lib/clevic/ui/search_dialog_ui.rb
35
- lib/clevic/version.rb
36
7
  models/accounts_models.rb
37
8
  models/minimal_models.rb
38
9
  models/times_models.rb
10
+ models/times_psql_models.rb
39
11
  models/times_sqlite_models.rb
40
12
  models/values_models.rb
41
13
  script/console
@@ -45,12 +17,219 @@ script/txt2html
45
17
  sql/accounts.sql
46
18
  sql/times.sql
47
19
  sql/times_sqlite.sql
48
- tasks/website.rake
49
20
  tasks/clevic.rake
50
21
  tasks/rdoc.rake
22
+ tasks/website.rake
51
23
  test/test_cache_table.rb
52
24
  test/test_helper.rb
53
25
  test/test_model_index_extensions.rb
54
26
  test/test_order_attribute.rb
55
27
  test/test_sql_dialects.rb
28
+ test/test_table_model.rb
56
29
  test/test_table_searcher.rb
30
+ lib/clevic/qt/ui/browser.ui
31
+ lib/clevic/qt/ui/search_dialog_ui.rb
32
+ lib/clevic/qt/ui/search_dialog.ui
33
+ lib/clevic/qt/ui/browser_ui.rb
34
+ lib/clevic/qt/table_model.rb
35
+ lib/clevic/qt/text_area_delegate.rb
36
+ lib/clevic/qt/browser.rb
37
+ lib/clevic/qt/action_builder.rb
38
+ lib/clevic/qt/field.rb
39
+ lib/clevic/qt/set_delegate.rb
40
+ lib/clevic/qt/item_delegate.rb
41
+ lib/clevic/qt/clipboard.rb
42
+ lib/clevic/qt/text_delegate.rb
43
+ lib/clevic/qt/distinct_delegate.rb
44
+ lib/clevic/qt/boolean_delegate.rb
45
+ lib/clevic/qt/table_view.rb
46
+ lib/clevic/qt/search_dialog.rb
47
+ lib/clevic/qt/combo_delegate.rb
48
+ lib/clevic/qt/extensions.rb
49
+ lib/clevic/qt/delegates.rb
50
+ lib/clevic/qt/relational_delegate.rb
51
+ lib/clevic/table_view_paste.rb
52
+ lib/clevic/sequel_ar_adapter.rb
53
+ lib/clevic/model_builder.rb
54
+ lib/clevic/rails_models_loaders.rb
55
+ lib/clevic/sequel_length_validation.rb
56
+ lib/clevic/cache_table.rb
57
+ lib/clevic/table_model.rb
58
+ lib/clevic/icons
59
+ lib/clevic/icons/icon.png
60
+ lib/clevic/qt.rb
61
+ lib/clevic/swing
62
+ lib/clevic/swing/ui
63
+ lib/clevic/swing/ui/src
64
+ lib/clevic/swing/ui/src/SearchDialog.form
65
+ lib/clevic/swing/ui/src/SearchDialog.java
66
+ lib/clevic/swing/ui/src/resources
67
+ lib/clevic/swing/ui/src/resources/SearchDialog.properties
68
+ lib/clevic/swing/ui/src/TagEditor.form
69
+ lib/clevic/swing/ui/src/TagEditor.java
70
+ lib/clevic/swing/ui/dist
71
+ lib/clevic/swing/ui/dist/lib
72
+ lib/clevic/swing/ui/dist/lib/swing-layout-1.0.3.jar
73
+ lib/clevic/swing/ui/dist/README.TXT
74
+ lib/clevic/swing/ui/nbproject
75
+ lib/clevic/swing/ui/nbproject/genfiles.properties
76
+ lib/clevic/swing/ui/nbproject/build-impl.xml
77
+ lib/clevic/swing/ui/nbproject/project.xml
78
+ lib/clevic/swing/ui/nbproject/project.properties
79
+ lib/clevic/swing/ui/nbproject/private
80
+ lib/clevic/swing/ui/nbproject/private/private.properties
81
+ lib/clevic/swing/ui/nbproject/private/config.properties
82
+ lib/clevic/swing/ui/nbproject/private/private.xml
83
+ lib/clevic/swing/ui/build.xml
84
+ lib/clevic/swing/ui/manifest.mf
85
+ lib/clevic/swing/table_model.rb
86
+ lib/clevic/swing/text_area_delegate.rb
87
+ lib/clevic/swing/browser.rb
88
+ lib/clevic/swing/cell_renderer.rb
89
+ lib/clevic/swing/tag_editor.rb
90
+ lib/clevic/swing/action_builder.rb
91
+ lib/clevic/swing/field.rb
92
+ lib/clevic/swing/set_delegate.rb
93
+ lib/clevic/swing/clipboard.rb
94
+ lib/clevic/swing/text_delegate.rb
95
+ lib/clevic/swing/tag_delegate.rb
96
+ lib/clevic/swing/selection_model.rb
97
+ lib/clevic/swing/distinct_delegate.rb
98
+ lib/clevic/swing/boolean_delegate.rb
99
+ lib/clevic/swing/confirm_dialog.rb
100
+ lib/clevic/swing/table_view.rb
101
+ lib/clevic/swing/search_dialog.rb
102
+ lib/clevic/swing/combo_delegate.rb
103
+ lib/clevic/swing/swing_table_index.rb
104
+ lib/clevic/swing/table_view_focus.rb
105
+ lib/clevic/swing/cell_editor.rb
106
+ lib/clevic/swing/extensions.rb
107
+ lib/clevic/swing/delegate.rb
108
+ lib/clevic/swing/action.rb
109
+ lib/clevic/swing/relational_delegate.rb
110
+ lib/clevic/swing/row_header.rb
111
+ lib/clevic/ar_methods.rb
112
+ lib/clevic/swing.rb
113
+ lib/clevic/action_builder.rb
114
+ lib/clevic/order_attribute.rb
115
+ lib/clevic/dirty.rb
116
+ lib/clevic/field.rb
117
+ lib/clevic/attribute_list.rb
118
+ lib/clevic/record.rb
119
+ lib/clevic/sampler.rb
120
+ lib/clevic/model_column.rb
121
+ lib/clevic/table_searcher.rb
122
+ lib/clevic/table_view.rb
123
+ lib/clevic/field_valuer.rb
124
+ lib/clevic/sequel_naked.rb
125
+ lib/clevic/table_index.rb
126
+ lib/clevic/view.rb
127
+ lib/clevic/sequel_meta.rb
128
+ lib/clevic/extensions.rb
129
+ lib/clevic/delegate.rb
130
+ lib/clevic/sql_dialects.rb
131
+ lib/clevic/default_view.rb
132
+ lib/clevic/many_field.rb
133
+ lib/clevic/filter_command.rb
134
+ lib/clevic/version.rb
135
+ lib/clevic/generic_format.rb
136
+ lib/clevic/emitter.rb
137
+ lib/clevic/qt/ui/browser.ui
138
+ lib/clevic/qt/ui/.gitignore
139
+ lib/clevic/qt/ui/search_dialog_ui.rb
140
+ lib/clevic/qt/ui/search_dialog.ui
141
+ lib/clevic/qt/ui/browser_ui.rb
142
+ lib/clevic/qt/table_model.rb
143
+ lib/clevic/qt/text_area_delegate.rb
144
+ lib/clevic/qt/browser.rb
145
+ lib/clevic/qt/action_builder.rb
146
+ lib/clevic/qt/field.rb
147
+ lib/clevic/qt/set_delegate.rb
148
+ lib/clevic/qt/item_delegate.rb
149
+ lib/clevic/qt/clipboard.rb
150
+ lib/clevic/qt/text_delegate.rb
151
+ lib/clevic/qt/distinct_delegate.rb
152
+ lib/clevic/qt/boolean_delegate.rb
153
+ lib/clevic/qt/table_view.rb
154
+ lib/clevic/qt/search_dialog.rb
155
+ lib/clevic/qt/combo_delegate.rb
156
+ lib/clevic/qt/extensions.rb
157
+ lib/clevic/qt/delegates.rb
158
+ lib/clevic/qt/relational_delegate.rb
159
+ lib/clevic/table_view_paste.rb
160
+ lib/clevic/sequel_ar_adapter.rb
161
+ lib/clevic/model_builder.rb
162
+ lib/clevic/rails_models_loaders.rb
163
+ lib/clevic/sequel_length_validation.rb
164
+ lib/clevic/cache_table.rb
165
+ lib/clevic/table_model.rb
166
+ lib/clevic/icons/icon.png
167
+ lib/clevic/qt.rb
168
+ lib/clevic/swing/ui/src/SearchDialog.form
169
+ lib/clevic/swing/ui/src/SearchDialog.java
170
+ lib/clevic/swing/ui/src/resources/SearchDialog.properties
171
+ lib/clevic/swing/ui/src/TagEditor.form
172
+ lib/clevic/swing/ui/src/TagEditor.java
173
+ lib/clevic/swing/ui/dist/lib/swing-layout-1.0.3.jar
174
+ lib/clevic/swing/ui/dist/README.TXT
175
+ lib/clevic/swing/ui/nbproject/genfiles.properties
176
+ lib/clevic/swing/ui/nbproject/build-impl.xml
177
+ lib/clevic/swing/ui/nbproject/project.xml
178
+ lib/clevic/swing/ui/nbproject/project.properties
179
+ lib/clevic/swing/ui/nbproject/private/private.properties
180
+ lib/clevic/swing/ui/nbproject/private/config.properties
181
+ lib/clevic/swing/ui/nbproject/private/private.xml
182
+ lib/clevic/swing/ui/build.xml
183
+ lib/clevic/swing/ui/manifest.mf
184
+ lib/clevic/swing/table_model.rb
185
+ lib/clevic/swing/text_area_delegate.rb
186
+ lib/clevic/swing/browser.rb
187
+ lib/clevic/swing/cell_renderer.rb
188
+ lib/clevic/swing/tag_editor.rb
189
+ lib/clevic/swing/action_builder.rb
190
+ lib/clevic/swing/field.rb
191
+ lib/clevic/swing/set_delegate.rb
192
+ lib/clevic/swing/clipboard.rb
193
+ lib/clevic/swing/text_delegate.rb
194
+ lib/clevic/swing/tag_delegate.rb
195
+ lib/clevic/swing/selection_model.rb
196
+ lib/clevic/swing/distinct_delegate.rb
197
+ lib/clevic/swing/boolean_delegate.rb
198
+ lib/clevic/swing/confirm_dialog.rb
199
+ lib/clevic/swing/table_view.rb
200
+ lib/clevic/swing/search_dialog.rb
201
+ lib/clevic/swing/combo_delegate.rb
202
+ lib/clevic/swing/swing_table_index.rb
203
+ lib/clevic/swing/table_view_focus.rb
204
+ lib/clevic/swing/cell_editor.rb
205
+ lib/clevic/swing/extensions.rb
206
+ lib/clevic/swing/delegate.rb
207
+ lib/clevic/swing/action.rb
208
+ lib/clevic/swing/relational_delegate.rb
209
+ lib/clevic/swing/row_header.rb
210
+ lib/clevic/ar_methods.rb
211
+ lib/clevic/swing.rb
212
+ lib/clevic/action_builder.rb
213
+ lib/clevic/order_attribute.rb
214
+ lib/clevic/dirty.rb
215
+ lib/clevic/field.rb
216
+ lib/clevic/attribute_list.rb
217
+ lib/clevic/record.rb
218
+ lib/clevic/sampler.rb
219
+ lib/clevic/model_column.rb
220
+ lib/clevic/table_searcher.rb
221
+ lib/clevic/table_view.rb
222
+ lib/clevic/field_valuer.rb
223
+ lib/clevic/sequel_naked.rb
224
+ lib/clevic/table_index.rb
225
+ lib/clevic/view.rb
226
+ lib/clevic/sequel_meta.rb
227
+ lib/clevic/extensions.rb
228
+ lib/clevic/delegate.rb
229
+ lib/clevic/sql_dialects.rb
230
+ lib/clevic/default_view.rb
231
+ lib/clevic/many_field.rb
232
+ lib/clevic/filter_command.rb
233
+ lib/clevic/version.rb
234
+ lib/clevic/generic_format.rb
235
+ lib/clevic/emitter.rb
data/README.txt CHANGED
@@ -4,13 +4,14 @@ http://clevic.rubyforge.org
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- Database framework and Qt Model/View GUI for data capture and
8
- editing of tables in a pre-existing relational DBMS.
7
+ Database framework and Model/View GUI for data capture and
8
+ editing of tables in a pre-existing relational DBMS. Works with Qt
9
+ and Java Swing.
9
10
 
10
- Using ActiveRecord means Clevic supports Postgresql, Mysql and so on. It's been tested with Postgres and sqlite.
11
+ Using Sequel means Clevic supports Postgresql, Mysql and so on. It's been tested with Postgres and sqlite.
11
12
 
12
- Using Qt means it runs on Linux, Windows and OSX. Thoroughly tested
13
- in Linux, slightly tested in Windows and OSX.
13
+ Using Qt and Swing means it runs on Linux, Windows and OSX. Qt is thoroughly tested
14
+ in Linux, slightly tested in Windows and OSX. Swing is tested in Linux and OSX.
14
15
 
15
16
  == FEATURES:
16
17
 
@@ -23,7 +24,6 @@ in Linux, slightly tested in Windows and OSX.
23
24
  * Filter by current field.
24
25
  * search by field contents.
25
26
  * cut and paste in CSV format
26
- * point Clevic at a Rails project and see your models in a GUI
27
27
 
28
28
  === Shortcuts:
29
29
 
@@ -37,7 +37,7 @@ in Linux, slightly tested in Windows and OSX.
37
37
 
38
38
  === Model definition:
39
39
 
40
- Models and their UI representation must be defined in Ruby. A descendant of ActiveRecord::Base
40
+ Models and their UI representation must be defined in Ruby. A descendant of Sequel::Model
41
41
  that includes the Clevic::Record module will provide a minimally functional UI.
42
42
 
43
43
  Beyond that, the framework provides a DSL for defining more complex and useful behaviour
@@ -54,7 +54,7 @@ For implementation and more extensive comments, see Clevic::ModelBuilder.
54
54
  * use blocks to format values for particular fields.
55
55
  * sensible caching to handle large data sets without unnecessary memory and cpu usage
56
56
  * extensions to various Qt classes to make db programming easier.
57
- * uses ActiveRecord for data access. Does *not* use the Qt SQL models.
57
+ * uses Sequel for data access.
58
58
  * leverages SQL whenever possible to handle large datasets, sorting, filtering
59
59
  etc. So it's probably not suitable for talking to a remote db across a slow link.
60
60
 
@@ -64,25 +64,21 @@ See TODO file.
64
64
 
65
65
  == SYNOPSIS:
66
66
 
67
- clevic model_definition_file.rb
67
+ clevic [ --qt | --swing ] model_definition_file.rb
68
68
 
69
- OR
70
-
71
- clevic path_to_rails_project [model_tweaks.rb]
72
-
73
69
  == REQUIREMENTS:
74
70
 
75
71
  === Gems
72
+ * Sequel
76
73
  * fastercsv
77
- * ruby-qt4
78
74
  * qtext
79
- * ActiveRecord
80
-
81
- === Other
75
+ * hashery
76
+ * gather
82
77
 
78
+ === Libraries
79
+ * qtruby4 >= 2.0.3
83
80
  * bsearch (http://0xcc.net/ruby-bsearch)
84
- * active_record/dirty (included, for active_record < 2.1.x)
85
- * db driver (ie postgres-pr)
81
+ * db driver (ie pg)
86
82
  * rdbms (ie postgres)
87
83
 
88
84
  == INSTALL:
@@ -97,7 +93,7 @@ See TODO file.
97
93
 
98
94
  (The GPL-2 License)
99
95
 
100
- Copyright (C) 2008 John Anderson
96
+ Copyright (C) 2008-2011 John Anderson
101
97
 
102
98
  This program is free software; you can redistribute it and/or
103
99
  modify it under the terms of the GNU Library General Public License
data/Rakefile CHANGED
@@ -7,14 +7,17 @@ $hoe = Hoe.new('clevic', Clevic::VERSION::STRING) do |p|
7
7
  p.developer('John Anderson', 'panic@semiosix.com')
8
8
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
9
  p.rubyforge_name = p.name # TODO this is default value
10
- p.description = "SQL table GUI with Qt"
10
+ p.description = "SQL table GUI with Qt, Swing, Sequel"
11
11
  p.extra_deps = [
12
12
  ['activesupport','>= 2.0.2'],
13
- ['qtext', '>=0.6.5'],
14
- ['activerecord', '>=2.0.2'],
15
13
  ['fastercsv', '>=1.2.3'],
16
- ['gather', '>=0.0.4'],
17
- ['facets', '>=2.4.1']
14
+ ['gather', '>=0.0.6'],
15
+ ['qtext', '>=0.6.6'],
16
+ ['hashery', '>=1.3.0'],
17
+ ['andand', '>= 1.3.0'],
18
+ ['sequel', '>= 3.8.0'],
19
+ ['hpricot', '>= 0.8.1'],
20
+ ['io-like', '>= 0.3.0']
18
21
  # This isn't always installed from gems
19
22
  #~ ['qtruby4', '>=1.4.9']
20
23
  # bsearch can't be installed from gems
@@ -31,6 +34,3 @@ end
31
34
 
32
35
  require 'newgem/tasks' # load /tasks/*.rake
33
36
  Dir['tasks/**/*.rake'].each { |t| load t }
34
-
35
- # TODO - want other tests/tasks run by default? Add them to the list
36
- # task :default => [:spec, :features]
data/TODO CHANGED
@@ -1,6 +1,8 @@
1
- relational_delegate not used?
1
+ use Sequel::Dataset for filtering instead of find options
2
+
3
+ export to CSV
4
+ Accounts not landing after Ditto with auto-fill-in
2
5
  cut'n'paste in text/plain, text/csv, text/yml and application/clevic
3
- HasFinder gem for complex reusable sql
4
6
  provide for easier directories for a setup.
5
7
  ModelBuilder#modify_field to override default_ui definitions. Or a better way to reuse field definitions.
6
8
  use rubigen for creating model definition files?
@@ -14,11 +16,8 @@ Add additional :filter record sets that can be selected from menus?
14
16
 
15
17
  filter and search by virtual fields
16
18
 
17
- tests. Use ZenTest to generate tests
18
- Check out ar-extensions. Like operators look nice.
19
- make sure ActiveRecord doesn't keep updating column definitions. ie production mode.
20
- caching of repeated related entity lookups. Possibly ActiveRecord::QueryCache
21
- Ramen http://ramen.rubyforge.org/ for metadata. MySQL and MSSQL only right now.
19
+ tests. Use ZenTest to generate tests?
20
+ caching of repeated related entity lookups.
22
21
 
23
22
  metadata for virtual fields. Add a member to Field for class_name.constantize
24
23
  consolidate metadata across TableModel, and Field. Would like to have it all in Field.
data/bin/clevic CHANGED
@@ -2,10 +2,7 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- require 'clevic.rb'
6
- require 'clevic/browser.rb'
7
5
  require 'optparse'
8
- require 'active_support'
9
6
 
10
7
  $options = {}
11
8
  oparser = OptionParser.new
@@ -24,6 +21,10 @@ oparser.on( '-p', '--pass PASSWORD', String ) { |o| $options[:password] = o }
24
21
  oparser.on( '-P', '--profile PROFILE', String ) { |o| $options[:profile] = o }
25
22
  oparser.on( '-t', '--table TABLE', 'Table to display', String ) { |o| $options[:table] = o }
26
23
  oparser.on( '-d', '--database DATABASE', 'Database name', String ) { |o| $options[:database] = o }
24
+
25
+ oparser.on( '-s', '--swing', 'Use JRuby Swing' ) { |o| require 'clevic/swing.rb' }
26
+ oparser.on( '-q', '--qt', 'Use Qt-Ruby' ) { |o| require 'clevic/qt.rb' }
27
+
27
28
  oparser.on( '-D', '--debug' ) { |o| $options[:debug] = true }
28
29
  oparser.on( '-v', '--verbose' ) { |o| $options[:verbose] = true }
29
30
  oparser.on( '-V', '--version' ) do
@@ -64,7 +65,7 @@ def subclasses( base )
64
65
  ObjectSpace.each_object( Class ) do |x|
65
66
  if x.ancestors.include?( base )
66
67
  case
67
- when x == ActiveRecord::Base; # don't include this
68
+ when x == Clevic.base_entity_class; # don't include this
68
69
  else; classes << x
69
70
  end
70
71
  end
@@ -72,50 +73,13 @@ def subclasses( base )
72
73
  classes.sort{|a,b| a.name <=> b.name}
73
74
  end
74
75
 
75
- def load_rails_models( root, config, models )
76
- # initialize Rails
77
- load config / 'environment.rb'
78
- require 'initializer.rb'
79
- Rails::Initializer.run do |config|
80
- config.frameworks -= [ :action_mailer, :action_pack, :active_resource ]
81
- end
82
-
83
- # load lib/ files for the rails project
84
- $: << ( root / 'lib' ).realpath.to_s
85
- ( root / 'lib' ).children.each do |filename|
86
- load filename if filename.file?
87
- end
88
-
89
- # include Dirty if it isn't already
90
- begin
91
- ActiveRecord::Dirty
92
- rescue NameError
93
- ActiveRecord::Base.send(:include, ActiveRecord::Dirty)
94
- end
95
-
96
- # load models
97
- models.find do |dir_entry|
98
- # don't load directory entries
99
- next unless dir_entry.file?
100
- # only load .rb files
101
- next unless dir_entry.basename.to_s =~ /\.rb$/
102
- begin
103
- load dir_entry
104
- rescue Exception => e
105
- puts "Error loading #{dir_entry.basename.to_s}: #{e.message}"
106
- puts e.backtrace
107
- end
108
- end
109
-
110
- # include the Clevic::Record module in each descendant of
111
- # ActiveRecord::Base so that the default views will be created.
112
- subclasses( ActiveRecord::Base ).each do |model|
113
- if model.table_exists?
114
- model.send :include, Clevic::Record unless model.abstract_class?
115
- end
116
- end
76
+ # do nothing ...
77
+ def maybe_load_rails_models
117
78
  end
118
79
 
80
+ # ... unless this is included
81
+ # require 'clevic/rails_models_loader.rb'
82
+
119
83
  def load_single_model_file( pathname )
120
84
  ( pathname + '.rb' ).require_if_exists
121
85
  pathname.require_if_exists
@@ -125,14 +89,7 @@ end
125
89
 
126
90
  def load_models( pathname )
127
91
  if pathname.directory?
128
- config = pathname / 'config'
129
- app = pathname / 'app'
130
- models = app / 'models'
131
- # check if this is a Rails directory
132
- if config.exist? && app.exist? && models.exist?
133
- # this is probably a Rails project"
134
- load_rails_models( pathname, config, models )
135
- end
92
+ maybe_load_rails_models
136
93
  else
137
94
  # assume we have a single file, and try some variations
138
95
  load_single_model_file( pathname )
@@ -140,25 +97,7 @@ def load_models( pathname )
140
97
  end
141
98
 
142
99
  begin
143
- # load model files
144
- raise "no model definition file specified" if args.empty?
145
- args.each { |arg| load_models( Pathname.new( arg ) ) }
146
-
147
- app = Qt::Application.new( args )
148
-
149
- # show UI
150
- main_window = Qt::MainWindow.new
151
- browser = Clevic::Browser.new( main_window )
152
- # this must come after Clevic::Browser.new
153
- main_window.show
154
- # make sure any partially edited records are saved when the window is closed
155
- app.connect( SIGNAL('lastWindowClosed()') ) { browser.save_all }
156
- begin
157
- app.exec
158
- rescue
159
- puts $!.message
160
- puts $!.backtrace
161
- end
100
+ Clevic::Browser.run( args )
162
101
  rescue Exception => e
163
102
  puts e.message
164
103
  puts e.backtrace