coupler 0.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. data/.document +5 -0
  2. data/.gitmodules +3 -0
  3. data/.rvmrc +1 -0
  4. data/.vimrc +40 -0
  5. data/Gemfile +27 -0
  6. data/Gemfile.lock +71 -0
  7. data/LICENSE +20 -0
  8. data/NOTES +6 -0
  9. data/README.rdoc +18 -0
  10. data/Rakefile +42 -0
  11. data/TODO +11 -0
  12. data/VERSION +1 -0
  13. data/bin/coupler +7 -0
  14. data/db/.gitignore +6 -0
  15. data/db/migrate/001_initial_schema.rb +166 -0
  16. data/db/migrate/002_stub.rb +4 -0
  17. data/db/migrate/003_stub.rb +4 -0
  18. data/db/migrate/004_create_comparisons.rb +28 -0
  19. data/db/migrate/005_move_database_name.rb +19 -0
  20. data/db/migrate/006_upgrade_comparisons.rb +34 -0
  21. data/db/migrate/007_add_which_to_comparisons.rb +23 -0
  22. data/db/migrate/008_add_result_field_to_transformations.rb +33 -0
  23. data/db/migrate/009_add_generated_flag_to_fields.rb +13 -0
  24. data/db/migrate/010_create_imports.rb +24 -0
  25. data/db/migrate/011_add_primary_key_type.rb +13 -0
  26. data/db/migrate/012_add_transformed_with_to_resources.rb +13 -0
  27. data/db/migrate/013_add_run_count_to_scenarios.rb +13 -0
  28. data/db/migrate/014_add_last_accessed_at_to_some_tables.rb +13 -0
  29. data/db/migrate/015_add_run_number_to_results.rb +15 -0
  30. data/db/migrate/016_fix_scenario_run_count.rb +27 -0
  31. data/db/migrate/017_rename_comparison_columns.rb +14 -0
  32. data/db/migrate/018_fix_scenario_linkage_type.rb +8 -0
  33. data/db/migrate/019_add_columns_to_imports.rb +24 -0
  34. data/db/migrate/020_rename_import_columns.rb +12 -0
  35. data/db/migrate/021_add_fields_to_connections.rb +15 -0
  36. data/db/migrate/022_remove_database_name_from_resources.rb +11 -0
  37. data/features/connections.feature +28 -0
  38. data/features/matchers.feature +35 -0
  39. data/features/projects.feature +11 -0
  40. data/features/resources.feature +62 -0
  41. data/features/scenarios.feature +45 -0
  42. data/features/step_definitions/coupler_steps.rb +145 -0
  43. data/features/step_definitions/matchers_steps.rb +26 -0
  44. data/features/step_definitions/resources_steps.rb +12 -0
  45. data/features/step_definitions/scenarios_steps.rb +7 -0
  46. data/features/step_definitions/transformations_steps.rb +3 -0
  47. data/features/support/env.rb +128 -0
  48. data/features/transformations.feature +22 -0
  49. data/features/wizard.feature +10 -0
  50. data/gfx/coupler-header.svg +213 -0
  51. data/gfx/coupler-sidebar.svg +656 -0
  52. data/gfx/coupler.svg +184 -0
  53. data/gfx/icon.svg +75 -0
  54. data/lib/coupler/base.rb +63 -0
  55. data/lib/coupler/config.rb +128 -0
  56. data/lib/coupler/data_uploader.rb +20 -0
  57. data/lib/coupler/database.rb +31 -0
  58. data/lib/coupler/extensions/connections.rb +57 -0
  59. data/lib/coupler/extensions/exceptions.rb +58 -0
  60. data/lib/coupler/extensions/imports.rb +43 -0
  61. data/lib/coupler/extensions/jobs.rb +21 -0
  62. data/lib/coupler/extensions/matchers.rb +64 -0
  63. data/lib/coupler/extensions/projects.rb +62 -0
  64. data/lib/coupler/extensions/resources.rb +89 -0
  65. data/lib/coupler/extensions/results.rb +100 -0
  66. data/lib/coupler/extensions/scenarios.rb +50 -0
  67. data/lib/coupler/extensions/transformations.rb +70 -0
  68. data/lib/coupler/extensions/transformers.rb +58 -0
  69. data/lib/coupler/extensions.rb +16 -0
  70. data/lib/coupler/helpers.rb +121 -0
  71. data/lib/coupler/import_buffer.rb +48 -0
  72. data/lib/coupler/logger.rb +16 -0
  73. data/lib/coupler/models/common_model.rb +104 -0
  74. data/lib/coupler/models/comparison.rb +166 -0
  75. data/lib/coupler/models/connection.rb +59 -0
  76. data/lib/coupler/models/field.rb +55 -0
  77. data/lib/coupler/models/import.rb +238 -0
  78. data/lib/coupler/models/job.rb +42 -0
  79. data/lib/coupler/models/jobify.rb +17 -0
  80. data/lib/coupler/models/matcher.rb +36 -0
  81. data/lib/coupler/models/project.rb +40 -0
  82. data/lib/coupler/models/resource.rb +287 -0
  83. data/lib/coupler/models/result.rb +92 -0
  84. data/lib/coupler/models/scenario/runner.rb +357 -0
  85. data/lib/coupler/models/scenario.rb +115 -0
  86. data/lib/coupler/models/transformation.rb +117 -0
  87. data/lib/coupler/models/transformer/runner.rb +28 -0
  88. data/lib/coupler/models/transformer.rb +110 -0
  89. data/lib/coupler/models.rb +30 -0
  90. data/lib/coupler/runner.rb +76 -0
  91. data/lib/coupler/scheduler.rb +56 -0
  92. data/lib/coupler.rb +34 -0
  93. data/log/.gitignore +1 -0
  94. data/misc/README +5 -0
  95. data/misc/jruby-json.license +57 -0
  96. data/misc/rack-flash.license +22 -0
  97. data/script/dbconsole.rb +5 -0
  98. data/src/edu/vanderbilt/coupler/Main.java +116 -0
  99. data/src/edu/vanderbilt/coupler/jruby.properties +1 -0
  100. data/tasks/annotations.rake +84 -0
  101. data/tasks/db.rake +120 -0
  102. data/tasks/environment.rake +12 -0
  103. data/tasks/jeweler.rake +43 -0
  104. data/tasks/package.rake +58 -0
  105. data/tasks/rdoc.rake +13 -0
  106. data/tasks/test.rake +63 -0
  107. data/tasks/vendor.rake +43 -0
  108. data/test/README.txt +6 -0
  109. data/test/config.yml +9 -0
  110. data/test/coupler/models/test_import.rb +221 -0
  111. data/test/factories.rb +91 -0
  112. data/test/fixtures/duplicate-keys.csv +5 -0
  113. data/test/fixtures/no-headers.csv +50 -0
  114. data/test/fixtures/people.csv +51 -0
  115. data/test/fixtures/varying-row-size.csv +4 -0
  116. data/test/helper.rb +156 -0
  117. data/test/integration/extensions/test_connections.rb +80 -0
  118. data/test/integration/extensions/test_imports.rb +94 -0
  119. data/test/integration/extensions/test_jobs.rb +52 -0
  120. data/test/integration/extensions/test_matchers.rb +134 -0
  121. data/test/integration/extensions/test_projects.rb +82 -0
  122. data/test/integration/extensions/test_resources.rb +150 -0
  123. data/test/integration/extensions/test_results.rb +89 -0
  124. data/test/integration/extensions/test_scenarios.rb +88 -0
  125. data/test/integration/extensions/test_transformations.rb +113 -0
  126. data/test/integration/extensions/test_transformers.rb +80 -0
  127. data/test/integration/test_field.rb +45 -0
  128. data/test/integration/test_import.rb +78 -0
  129. data/test/integration/test_running_scenarios.rb +379 -0
  130. data/test/integration/test_transformation.rb +56 -0
  131. data/test/integration/test_transforming.rb +154 -0
  132. data/test/table_sets.rb +76 -0
  133. data/test/unit/models/test_common_model.rb +130 -0
  134. data/test/unit/models/test_comparison.rb +619 -0
  135. data/test/unit/models/test_connection.rb +115 -0
  136. data/test/unit/models/test_field.rb +99 -0
  137. data/test/unit/models/test_import.rb +130 -0
  138. data/test/unit/models/test_job.rb +115 -0
  139. data/test/unit/models/test_matcher.rb +82 -0
  140. data/test/unit/models/test_project.rb +102 -0
  141. data/test/unit/models/test_resource.rb +564 -0
  142. data/test/unit/models/test_result.rb +90 -0
  143. data/test/unit/models/test_scenario.rb +199 -0
  144. data/test/unit/models/test_transformation.rb +193 -0
  145. data/test/unit/models/test_transformer.rb +188 -0
  146. data/test/unit/test_base.rb +60 -0
  147. data/test/unit/test_data_uploader.rb +27 -0
  148. data/test/unit/test_database.rb +23 -0
  149. data/test/unit/test_helpers.rb +58 -0
  150. data/test/unit/test_logger.rb +10 -0
  151. data/test/unit/test_models.rb +12 -0
  152. data/test/unit/test_runner.rb +76 -0
  153. data/test/unit/test_scheduler.rb +66 -0
  154. data/uploads/.gitignore +2 -0
  155. data/vendor/java/.gitignore +5 -0
  156. data/webroot/public/css/960.css +1 -0
  157. data/webroot/public/css/dataTables.css +1057 -0
  158. data/webroot/public/css/jquery-ui.css +572 -0
  159. data/webroot/public/css/jquery.treeview.css +68 -0
  160. data/webroot/public/css/reset.css +1 -0
  161. data/webroot/public/css/style.css +504 -0
  162. data/webroot/public/css/text.css +1 -0
  163. data/webroot/public/favicon.ico +0 -0
  164. data/webroot/public/images/12_col.gif +0 -0
  165. data/webroot/public/images/16_col.gif +0 -0
  166. data/webroot/public/images/add.png +0 -0
  167. data/webroot/public/images/ajax-loader.gif +0 -0
  168. data/webroot/public/images/cog.png +0 -0
  169. data/webroot/public/images/coupler.png +0 -0
  170. data/webroot/public/images/foo.png +0 -0
  171. data/webroot/public/images/hammer.png +0 -0
  172. data/webroot/public/images/header.png +0 -0
  173. data/webroot/public/images/home.gif +0 -0
  174. data/webroot/public/images/jobs.gif +0 -0
  175. data/webroot/public/images/sidebar-bottom.png +0 -0
  176. data/webroot/public/images/sidebar.png +0 -0
  177. data/webroot/public/images/treeview-default-line.gif +0 -0
  178. data/webroot/public/images/treeview-default.gif +0 -0
  179. data/webroot/public/images/ui-anim_basic_16x16.gif +0 -0
  180. data/webroot/public/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  181. data/webroot/public/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  182. data/webroot/public/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  183. data/webroot/public/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  184. data/webroot/public/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  185. data/webroot/public/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  186. data/webroot/public/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  187. data/webroot/public/images/ui-bg_highlight-hard_30_565356_1x100.png +0 -0
  188. data/webroot/public/images/ui-bg_highlight-hard_75_888588_1x100.png +0 -0
  189. data/webroot/public/images/ui-bg_highlight-soft_30_6e3b3a_1x100.png +0 -0
  190. data/webroot/public/images/ui-bg_highlight-soft_35_8e8b8e_1x100.png +0 -0
  191. data/webroot/public/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  192. data/webroot/public/images/ui-icons_222222_256x240.png +0 -0
  193. data/webroot/public/images/ui-icons_2e83ff_256x240.png +0 -0
  194. data/webroot/public/images/ui-icons_454545_256x240.png +0 -0
  195. data/webroot/public/images/ui-icons_888888_256x240.png +0 -0
  196. data/webroot/public/images/ui-icons_cd0a0a_256x240.png +0 -0
  197. data/webroot/public/images/ui-icons_ffffff_256x240.png +0 -0
  198. data/webroot/public/js/ajaxupload.js +673 -0
  199. data/webroot/public/js/application.js +40 -0
  200. data/webroot/public/js/jquery-ui.combobox.js +98 -0
  201. data/webroot/public/js/jquery-ui.js +9867 -0
  202. data/webroot/public/js/jquery-ui.min.js +559 -0
  203. data/webroot/public/js/jquery.dataTables.min.js +587 -0
  204. data/webroot/public/js/jquery.min.js +154 -0
  205. data/webroot/public/js/jquery.timeago.js +140 -0
  206. data/webroot/public/js/jquery.tooltip.min.js +19 -0
  207. data/webroot/public/js/jquery.treeview.min.js +15 -0
  208. data/webroot/public/js/resource.js +11 -0
  209. data/webroot/public/js/results.js +56 -0
  210. data/webroot/public/js/transformations.js +95 -0
  211. data/webroot/views/connections/index.erb +5 -0
  212. data/webroot/views/connections/list.erb +34 -0
  213. data/webroot/views/connections/new.erb +55 -0
  214. data/webroot/views/connections/show.erb +36 -0
  215. data/webroot/views/imports/edit.erb +60 -0
  216. data/webroot/views/imports/form.erb +81 -0
  217. data/webroot/views/imports/new.erb +89 -0
  218. data/webroot/views/index.erb +12 -0
  219. data/webroot/views/jobs/index.erb +7 -0
  220. data/webroot/views/jobs/list.erb +24 -0
  221. data/webroot/views/layout.erb +38 -0
  222. data/webroot/views/matchers/form.erb +250 -0
  223. data/webroot/views/matchers/list.erb +32 -0
  224. data/webroot/views/projects/form.erb +14 -0
  225. data/webroot/views/projects/index.erb +96 -0
  226. data/webroot/views/projects/show.erb +24 -0
  227. data/webroot/views/resources/edit.erb +88 -0
  228. data/webroot/views/resources/index.erb +5 -0
  229. data/webroot/views/resources/list.erb +27 -0
  230. data/webroot/views/resources/new.erb +121 -0
  231. data/webroot/views/resources/show.erb +86 -0
  232. data/webroot/views/resources/transform.erb +2 -0
  233. data/webroot/views/results/csv.erb +12 -0
  234. data/webroot/views/results/details.erb +15 -0
  235. data/webroot/views/results/index.erb +2 -0
  236. data/webroot/views/results/list.erb +22 -0
  237. data/webroot/views/results/record.erb +24 -0
  238. data/webroot/views/results/show.erb +68 -0
  239. data/webroot/views/scenarios/index.erb +5 -0
  240. data/webroot/views/scenarios/list.erb +20 -0
  241. data/webroot/views/scenarios/new.erb +99 -0
  242. data/webroot/views/scenarios/run.erb +2 -0
  243. data/webroot/views/scenarios/show.erb +50 -0
  244. data/webroot/views/sidebar.erb +106 -0
  245. data/webroot/views/transformations/create.erb +115 -0
  246. data/webroot/views/transformations/for.erb +16 -0
  247. data/webroot/views/transformations/index.erb +2 -0
  248. data/webroot/views/transformations/list.erb +29 -0
  249. data/webroot/views/transformations/new.erb +126 -0
  250. data/webroot/views/transformations/preview.erb +46 -0
  251. data/webroot/views/transformers/edit.erb +6 -0
  252. data/webroot/views/transformers/form.erb +58 -0
  253. data/webroot/views/transformers/index.erb +2 -0
  254. data/webroot/views/transformers/list.erb +25 -0
  255. data/webroot/views/transformers/new.erb +5 -0
  256. data/webroot/views/transformers/preview.erb +23 -0
  257. data/webroot/views/transformers/show.erb +0 -0
  258. metadata +558 -0
data/gfx/coupler.svg ADDED
@@ -0,0 +1,184 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="250"
13
+ height="999.99994"
14
+ id="svg3880"
15
+ version="1.1"
16
+ inkscape:version="0.47pre4 r22446"
17
+ sodipodi:docname="coupler.svg">
18
+ <defs
19
+ id="defs3882">
20
+ <inkscape:perspective
21
+ sodipodi:type="inkscape:persp3d"
22
+ inkscape:vp_x="0 : 526.18109 : 1"
23
+ inkscape:vp_y="0 : 1000 : 0"
24
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
25
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
26
+ id="perspective3888" />
27
+ <inkscape:perspective
28
+ id="perspective3875"
29
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
30
+ inkscape:vp_z="1 : 0.5 : 1"
31
+ inkscape:vp_y="0 : 1000 : 0"
32
+ inkscape:vp_x="0 : 0.5 : 1"
33
+ sodipodi:type="inkscape:persp3d" />
34
+ <inkscape:perspective
35
+ id="perspective3907"
36
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
37
+ inkscape:vp_z="1 : 0.5 : 1"
38
+ inkscape:vp_y="0 : 1000 : 0"
39
+ inkscape:vp_x="0 : 0.5 : 1"
40
+ sodipodi:type="inkscape:persp3d" />
41
+ <inkscape:perspective
42
+ id="perspective3929"
43
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
44
+ inkscape:vp_z="1 : 0.5 : 1"
45
+ inkscape:vp_y="0 : 1000 : 0"
46
+ inkscape:vp_x="0 : 0.5 : 1"
47
+ sodipodi:type="inkscape:persp3d" />
48
+ <inkscape:perspective
49
+ id="perspective3974"
50
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
51
+ inkscape:vp_z="1 : 0.5 : 1"
52
+ inkscape:vp_y="0 : 1000 : 0"
53
+ inkscape:vp_x="0 : 0.5 : 1"
54
+ sodipodi:type="inkscape:persp3d" />
55
+ <inkscape:perspective
56
+ id="perspective2840"
57
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
58
+ inkscape:vp_z="1 : 0.5 : 1"
59
+ inkscape:vp_y="0 : 1000 : 0"
60
+ inkscape:vp_x="0 : 0.5 : 1"
61
+ sodipodi:type="inkscape:persp3d" />
62
+ <inkscape:perspective
63
+ id="perspective2840-8"
64
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
65
+ inkscape:vp_z="1 : 0.5 : 1"
66
+ inkscape:vp_y="0 : 1000 : 0"
67
+ inkscape:vp_x="0 : 0.5 : 1"
68
+ sodipodi:type="inkscape:persp3d" />
69
+ <inkscape:perspective
70
+ id="perspective3781"
71
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
72
+ inkscape:vp_z="1 : 0.5 : 1"
73
+ inkscape:vp_y="0 : 1000 : 0"
74
+ inkscape:vp_x="0 : 0.5 : 1"
75
+ sodipodi:type="inkscape:persp3d" />
76
+ <inkscape:perspective
77
+ id="perspective3803"
78
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
79
+ inkscape:vp_z="1 : 0.5 : 1"
80
+ inkscape:vp_y="0 : 1000 : 0"
81
+ inkscape:vp_x="0 : 0.5 : 1"
82
+ sodipodi:type="inkscape:persp3d" />
83
+ <inkscape:perspective
84
+ id="perspective3831"
85
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
86
+ inkscape:vp_z="1 : 0.5 : 1"
87
+ inkscape:vp_y="0 : 1000 : 0"
88
+ inkscape:vp_x="0 : 0.5 : 1"
89
+ sodipodi:type="inkscape:persp3d" />
90
+ <inkscape:perspective
91
+ id="perspective3881"
92
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
93
+ inkscape:vp_z="1 : 0.5 : 1"
94
+ inkscape:vp_y="0 : 1000 : 0"
95
+ inkscape:vp_x="0 : 0.5 : 1"
96
+ sodipodi:type="inkscape:persp3d" />
97
+ </defs>
98
+ <sodipodi:namedview
99
+ id="base"
100
+ pagecolor="#ffffff"
101
+ bordercolor="#666666"
102
+ borderopacity="1.0"
103
+ inkscape:pageopacity="0.0"
104
+ inkscape:pageshadow="2"
105
+ inkscape:zoom="1"
106
+ inkscape:cx="72.24529"
107
+ inkscape:cy="334.21398"
108
+ inkscape:document-units="px"
109
+ inkscape:current-layer="layer1"
110
+ showgrid="false"
111
+ inkscape:window-width="1280"
112
+ inkscape:window-height="962"
113
+ inkscape:window-x="-4"
114
+ inkscape:window-y="-3"
115
+ inkscape:window-maximized="1"
116
+ inkscape:snap-page="false" />
117
+ <metadata
118
+ id="metadata3885">
119
+ <rdf:RDF>
120
+ <cc:Work
121
+ rdf:about="">
122
+ <dc:format>image/svg+xml</dc:format>
123
+ <dc:type
124
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
125
+ <dc:title />
126
+ </cc:Work>
127
+ </rdf:RDF>
128
+ </metadata>
129
+ <g
130
+ inkscape:label="Layer 1"
131
+ inkscape:groupmode="layer"
132
+ id="layer1"
133
+ transform="translate(25.000008,-52.362174)">
134
+ <g
135
+ id="g3867">
136
+ <g
137
+ transform="matrix(0,-1.1067126,1.1046061,0,-559.02214,1042.204)"
138
+ id="g2828-8">
139
+ <path
140
+ style="fill:#323232;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
141
+ d="m 440.36478,537.1508 c -8.58877,5.44812 -15.1293,13.62359 -22.18332,20.95092 -1.81717,1.88758 -3.72425,3.73445 -5.17611,5.91555 -2.58581,3.88461 -5.01335,8.04759 -6.16203,12.57055 -1.45739,5.73851 -2.41984,12.06944 -0.73944,17.74665 0.88641,2.99475 2.94415,5.7405 5.42259,7.64092 3.75449,2.87888 8.59575,4.52948 13.30999,4.92963 2.66537,0.22624 5.55176,-0.17499 7.8874,-1.47889 2.13294,-1.19074 4.07961,-3.13244 4.92962,-5.42259 1.05817,-2.85101 -0.20539,-6.07904 -0.24647,-9.11981 -0.0233,-1.72521 -0.54562,-3.53927 -1e-5,-5.1761 0.77944,-2.33833 2.75786,-4.11087 4.43667,-5.91556 1.70564,-1.83353 3.44029,-3.78788 5.66907,-4.92962 2.55411,-1.3084 5.51165,-1.8951 8.38036,-1.97185 3.2543,-0.0871 6.56143,0.59076 9.61277,1.72537 4.38478,1.63043 9.09523,3.54377 12.07759,7.14795 3.39654,4.10472 4.11494,9.87055 5.42259,15.03536 1.08088,4.26913 1.34435,8.70462 1.97185,13.06352 0.86259,5.99195 1.4493,12.02519 2.46481,17.99313 0.75953,4.46362 1.95313,8.84614 2.7113,13.30999 0.61094,3.597 -0.10241,7.55714 1.47888,10.84518 1.03266,2.14724 2.58004,5.57166 4.92963,5.17611 13.62973,-2.29453 9.94016,6.01626 16.02129,5.91555 2.44247,-0.0404 4.02505,-2.92608 5.42259,-4.92962 3.75329,-5.38079 4.94377,-12.15403 7.39444,-18.23962 3.63607,-9.02922 6.93239,-18.20015 10.84517,-27.11295 1.75787,-4.0042 5.37455,-7.46796 5.66907,-11.8311 0.18024,-2.67013 -1.60644,-5.1061 -2.46481,-7.64092 -0.86682,-2.55978 -1.79761,-5.09749 -2.71129,-7.64092 -0.65024,-1.81008 -1.26981,-3.63197 -1.97185,-5.42259 -0.61825,-1.57692 -0.88199,-3.38657 -1.97185,-4.68315 -6.15903,-7.32726 -16.24861,-10.13308 -24.15517,-15.52832 -7.87358,-5.37274 -15.23032,-11.48503 -23.16925,-16.76073 -1.8425,-1.22441 -3.82138,-2.23418 -5.66907,-3.45074 -3.19883,-2.10618 -5.8369,-5.16776 -9.36629,-6.655 -2.53949,-1.0701 -5.38371,-1.30364 -8.13388,-1.47888 -3.12009,-0.19882 -6.31063,-0.16842 -9.36629,0.49296 -4.399,0.95213 -8.76985,2.51872 -12.57055,4.92962 z"
142
+ id="path3964-9"
143
+ sodipodi:nodetypes="caaaaaaaaaaaaaaaaaaaassaaaaaaaaaaaaaaa" />
144
+ <path
145
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
146
+ d="m 668.00494,560.1344 c 0,0 -32.90601,1.17172 -49.29627,0 -13.82647,-0.98844 -27.73729,-2.46371 -41.16238,-5.91555 -18.26823,-4.6971 -24.78904,-21.44605 -29.0848,-28.09888 -9.80815,-15.18982 -39.44363,-7.92345 -45.84553,-6.65499 -6.40189,1.26845 -34.79631,7.8721 -51.76107,13.30999 -3.69054,1.18297 -7.58198,2.09948 -10.84518,4.19018 -3.37566,2.16275 -6.34669,5.08288 -8.62685,8.38037 -6.093,8.81147 -4.54593,26.12944 4.19018,30.81017 5.73326,3.07183 11.13314,8.87363 25.38758,3.69722 5.1344,-1.86453 16.18653,-2.13123 22.67628,-0.24649 6.48975,1.88474 18.83412,12.60001 18.4861,17.74666 -1.02548,15.16505 0.25557,33.07573 0,45.59904 -0.11199,5.48763 -3.56809,10.79529 -6.90148,15.28184 -5.07041,6.82448 -11.8448,12.54086 -19.22554,16.76073 -4.51103,2.57914 -14.90695,4.66431 -14.78888,4.92962 0,0 -9.81981,6.00092 0.24648,10.84518 12.83949,6.17882 52.63238,9.30995 66.30348,0.24648 11.5107,-7.63119 35.22126,-32.0803 55.70478,-43.87367 9.26862,-5.3364 19.4296,-9.31396 29.82424,-11.83111 7.3815,-1.78749 15.08144,-2.21833 22.67628,-2.21833 l 32.04258,0 0,-72.95846 z"
147
+ id="path3093-2"
148
+ sodipodi:nodetypes="cssszaassszssassssssscc" />
149
+ </g>
150
+ <rect
151
+ y="53.177486"
152
+ x="-24.184694"
153
+ height="248.36937"
154
+ width="248.36937"
155
+ id="rect2995"
156
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.63062477;stroke-opacity:1" />
157
+ </g>
158
+ <g
159
+ transform="matrix(-1,0,0,-1,199.99998,1104.7243)"
160
+ id="g3867-6">
161
+ <g
162
+ transform="matrix(0,-1.1067126,1.1046061,0,-559.02214,1042.204)"
163
+ id="g2828-8-9">
164
+ <path
165
+ style="fill:#323232;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
166
+ d="m 440.36478,537.1508 c -8.58877,5.44812 -15.1293,13.62359 -22.18332,20.95092 -1.81717,1.88758 -3.72425,3.73445 -5.17611,5.91555 -2.58581,3.88461 -5.01335,8.04759 -6.16203,12.57055 -1.45739,5.73851 -2.41984,12.06944 -0.73944,17.74665 0.88641,2.99475 2.94415,5.7405 5.42259,7.64092 3.75449,2.87888 8.59575,4.52948 13.30999,4.92963 2.66537,0.22624 5.55176,-0.17499 7.8874,-1.47889 2.13294,-1.19074 4.07961,-3.13244 4.92962,-5.42259 1.05817,-2.85101 -0.20539,-6.07904 -0.24647,-9.11981 -0.0233,-1.72521 -0.54562,-3.53927 -1e-5,-5.1761 0.77944,-2.33833 2.75786,-4.11087 4.43667,-5.91556 1.70564,-1.83353 3.44029,-3.78788 5.66907,-4.92962 2.55411,-1.3084 5.51165,-1.8951 8.38036,-1.97185 3.2543,-0.0871 6.56143,0.59076 9.61277,1.72537 4.38478,1.63043 9.09523,3.54377 12.07759,7.14795 3.39654,4.10472 4.11494,9.87055 5.42259,15.03536 1.08088,4.26913 1.34435,8.70462 1.97185,13.06352 0.86259,5.99195 1.4493,12.02519 2.46481,17.99313 0.75953,4.46362 1.95313,8.84614 2.7113,13.30999 0.61094,3.597 -0.10241,7.55714 1.47888,10.84518 1.03266,2.14724 2.58004,5.57166 4.92963,5.17611 13.62973,-2.29453 9.94016,6.01626 16.02129,5.91555 2.44247,-0.0404 4.02505,-2.92608 5.42259,-4.92962 3.75329,-5.38079 4.94377,-12.15403 7.39444,-18.23962 3.63607,-9.02922 6.93239,-18.20015 10.84517,-27.11295 1.75787,-4.0042 5.37455,-7.46796 5.66907,-11.8311 0.18024,-2.67013 -1.60644,-5.1061 -2.46481,-7.64092 -0.86682,-2.55978 -1.79761,-5.09749 -2.71129,-7.64092 -0.65024,-1.81008 -1.26981,-3.63197 -1.97185,-5.42259 -0.61825,-1.57692 -0.88199,-3.38657 -1.97185,-4.68315 -6.15903,-7.32726 -16.24861,-10.13308 -24.15517,-15.52832 -7.87358,-5.37274 -15.23032,-11.48503 -23.16925,-16.76073 -1.8425,-1.22441 -3.82138,-2.23418 -5.66907,-3.45074 -3.19883,-2.10618 -5.8369,-5.16776 -9.36629,-6.655 -2.53949,-1.0701 -5.38371,-1.30364 -8.13388,-1.47888 -3.12009,-0.19882 -6.31063,-0.16842 -9.36629,0.49296 -4.399,0.95213 -8.76985,2.51872 -12.57055,4.92962 z"
167
+ id="path3964-9-7"
168
+ sodipodi:nodetypes="caaaaaaaaaaaaaaaaaaaassaaaaaaaaaaaaaaa" />
169
+ <path
170
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
171
+ d="m 668.00494,560.1344 c 0,0 -32.90601,1.17172 -49.29627,0 -13.82647,-0.98844 -27.73729,-2.46371 -41.16238,-5.91555 -18.26823,-4.6971 -24.78904,-21.44605 -29.0848,-28.09888 -9.80815,-15.18982 -39.44363,-7.92345 -45.84553,-6.65499 -6.40189,1.26845 -34.79631,7.8721 -51.76107,13.30999 -3.69054,1.18297 -7.58198,2.09948 -10.84518,4.19018 -3.37566,2.16275 -6.34669,5.08288 -8.62685,8.38037 -6.093,8.81147 -4.54593,26.12944 4.19018,30.81017 5.73326,3.07183 11.13314,8.87363 25.38758,3.69722 5.1344,-1.86453 16.18653,-2.13123 22.67628,-0.24649 6.48975,1.88474 18.83412,12.60001 18.4861,17.74666 -1.02548,15.16505 0.25557,33.07573 0,45.59904 -0.11199,5.48763 -3.56809,10.79529 -6.90148,15.28184 -5.07041,6.82448 -11.8448,12.54086 -19.22554,16.76073 -4.51103,2.57914 -14.90695,4.66431 -14.78888,4.92962 0,0 -9.81981,6.00092 0.24648,10.84518 12.83949,6.17882 52.63238,9.30995 66.30348,0.24648 11.5107,-7.63119 35.22126,-32.0803 55.70478,-43.87367 9.26862,-5.3364 19.4296,-9.31396 29.82424,-11.83111 7.3815,-1.78749 15.08144,-2.21833 22.67628,-2.21833 l 32.04258,0 0,-72.95846 z"
172
+ id="path3093-2-4"
173
+ sodipodi:nodetypes="cssszaassszssassssssscc" />
174
+ </g>
175
+ <rect
176
+ y="53.177486"
177
+ x="-24.184694"
178
+ height="248.36937"
179
+ width="248.36937"
180
+ id="rect2995-8"
181
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.63062477;stroke-opacity:1" />
182
+ </g>
183
+ </g>
184
+ </svg>
data/gfx/icon.svg ADDED
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="140.13"
13
+ height="140.13046"
14
+ id="svg3101"
15
+ version="1.1"
16
+ inkscape:version="0.48.1 r9760"
17
+ sodipodi:docname="icon.svg"
18
+ inkscape:export-filename="/home/stephej1/Projects/coupler-launcher/src/main/resources/tray_icon-16x16.png"
19
+ inkscape:export-xdpi="10.28"
20
+ inkscape:export-ydpi="10.28">
21
+ <defs
22
+ id="defs3103" />
23
+ <sodipodi:namedview
24
+ id="base"
25
+ pagecolor="#ffffff"
26
+ bordercolor="#666666"
27
+ borderopacity="1.0"
28
+ inkscape:pageopacity="0.0"
29
+ inkscape:pageshadow="2"
30
+ inkscape:zoom="1.979899"
31
+ inkscape:cx="125.9974"
32
+ inkscape:cy="115.98147"
33
+ inkscape:document-units="px"
34
+ inkscape:current-layer="layer1"
35
+ showgrid="false"
36
+ fit-margin-top="0"
37
+ fit-margin-left="0"
38
+ fit-margin-right="0"
39
+ fit-margin-bottom="0"
40
+ inkscape:window-width="1115"
41
+ inkscape:window-height="794"
42
+ inkscape:window-x="315"
43
+ inkscape:window-y="118"
44
+ inkscape:window-maximized="0" />
45
+ <metadata
46
+ id="metadata3106">
47
+ <rdf:RDF>
48
+ <cc:Work
49
+ rdf:about="">
50
+ <dc:format>image/svg+xml</dc:format>
51
+ <dc:type
52
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
53
+ <dc:title />
54
+ </cc:Work>
55
+ </rdf:RDF>
56
+ </metadata>
57
+ <g
58
+ inkscape:label="Layer 1"
59
+ inkscape:groupmode="layer"
60
+ id="layer1"
61
+ transform="translate(-1.3009096e-7,-912.23172)">
62
+ <path
63
+ inkscape:connector-curvature="0"
64
+ style="fill:#646464;fill-opacity:1;stroke:#000000;stroke-width:0.53071617999999998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
65
+ d="m 103.92298,931.16935 c -2.88866,-4.56254 -7.22338,-8.03701 -11.10841,-11.78426 -1.000815,-0.96532 -1.980046,-1.97841 -3.136489,-2.74967 -2.059662,-1.37364 -4.26692,-2.6632 -6.665042,-3.2734 -3.042621,-0.7742 -6.399349,-1.28548 -9.409467,-0.39281 -1.587849,0.47088 -3.043676,1.564 -4.051299,2.8806 -1.526414,1.99447 -2.40158,4.56625 -2.613744,7.07056 -0.119955,1.4159 0.09278,2.94922 0.784124,4.18996 0.631343,1.13306 1.660854,2.16718 2.875116,2.61872 1.511637,0.56212 3.223173,-0.10911 4.835423,-0.13093 0.914725,-0.0124 1.876559,-0.28984 2.744424,0 1.239808,0.41405 2.179628,1.46503 3.136495,2.35685 0.972157,0.90608 2.008375,1.82756 2.613738,3.01154 0.693728,1.3568 1.004802,2.92791 1.045496,4.45183 0.04618,1.72875 -0.313227,3.48557 -0.91481,5.10651 -0.864472,2.3293 -1.878945,4.83159 -3.789921,6.41589 -2.176367,1.80431 -5.233473,2.18594 -7.971911,2.88059 -2.26354,0.57419 -4.615285,0.71415 -6.926421,1.04749 -3.176997,0.45823 -6.375887,0.7699 -9.540153,1.30937 -2.36666,0.40348 -4.69032,1.03754 -7.057102,1.4403 -1.907169,0.32454 -4.006878,-0.0544 -5.750233,0.78561 -1.13849,0.54857 -2.954154,1.37058 -2.74443,2.61873 1.216585,7.24041 -3.189886,5.28043 -3.136489,8.51086 0.02142,1.2975 1.55144,2.1382 2.613739,2.8806 2.852953,1.99383 6.444199,2.62624 9.670845,3.92809 4.787391,1.93156 9.649918,3.68264 14.375581,5.76119 2.123071,0.93382 3.959594,2.85508 6.272978,3.01154 1.415732,0.0958 2.70731,-0.85338 4.051299,-1.30936 1.357223,-0.46048 2.702745,-0.95493 4.051299,-1.4403 0.959724,-0.34542 1.92571,-0.67455 2.875116,-1.04749 0.836101,-0.32843 1.795597,-0.46853 2.483058,-1.04749 3.884993,-3.27181 5.372669,-8.63162 8.233284,-12.83176 2.848685,-4.18262 6.089488,-8.09068 8.886726,-12.30801 0.64919,-0.97878 1.18458,-2.03001 1.82962,-3.01154 1.11672,-1.69929 2.74,-3.10069 3.52855,-4.97558 0.56738,-1.34903 0.6912,-2.85994 0.78412,-4.32089 0.10541,-1.65746 0.0893,-3.35235 -0.26138,-4.97558 -0.50483,-2.33685 -1.33545,-4.65874 -2.61373,-6.67776 z"
66
+ id="path3964-9-7"
67
+ sodipodi:nodetypes="caaaaaaaaaaaaaaaaaaaassaaaaaaaaaaaaaaa" />
68
+ <path
69
+ inkscape:connector-curvature="0"
70
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.53071618px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
71
+ d="m 91.736821,1052.0968 c 0,0 -0.62128,-17.4803 0,-26.1872 0.524077,-7.3448 -0.09836,-15.2516 3.136489,-21.8664 3.143069,-6.4271 11.37093,-13.16849 14.89833,-15.45049 8.05381,-5.21031 4.2011,-20.95333 3.52855,-24.35416 -0.67255,-3.40082 -4.17387,-18.48457 -7.0571,-27.49662 -0.62722,-1.9605 -1.11317,-4.02771 -2.22168,-5.7612 -1.14671,-1.79322 -2.695,-3.3715 -4.443364,-4.58277 -4.671937,-3.23674 -13.854113,-2.4149 -16.335887,2.22592 -1.628718,3.04563 -4.704895,5.91416 -1.960306,13.48644 0.988594,2.7275 1.130001,8.59864 0.130691,12.04614 -0.999309,3.44749 -6.680662,10.0051 -9.409472,9.82022 -8.040675,-0.54476 -17.537112,0.13576 -24.177108,0 -2.909601,-0.0595 -5.72378,-1.89545 -8.102598,-3.66622 -3.618413,-2.69351 -6.6493,-6.29222 -8.886721,-10.21303 -1.367488,-2.39636 -2.473068,-7.9189 -2.613739,-7.85618 0,0 -3.181753,-5.2165 -5.750232,0.13094 -3.276078,6.82062 -4.936237,27.95948 -0.130686,35.22187 4.04614,6.11473 17.009324,18.7103 23.262297,29.59164 2.829418,4.9237 4.938363,10.3214 6.272984,15.8433 0.947746,3.9212 1.176182,8.0115 1.176182,12.0461 l 0,17.0217 z"
72
+ id="path3093-2-6"
73
+ sodipodi:nodetypes="caaszaassszssassssssscc" />
74
+ </g>
75
+ </svg>
@@ -0,0 +1,63 @@
1
+ module Coupler
2
+ class Base < Sinatra::Base
3
+
4
+ inst_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
5
+ set :environment, ENV['COUPLER_ENV'] || :production
6
+ set :root, File.join(inst_dir, "webroot")
7
+ set :static, true
8
+ set :erb, :trim => '-'
9
+ set :raise_errors, Proc.new { test? }
10
+ set :show_exceptions, false
11
+ set :dump_errors, true
12
+ set :logging, Proc.new { !test? }
13
+ set :methodoverride, true
14
+ set :host, '127.0.0.1'
15
+ set :db_path, lambda { |dbname| File.join(data_path, 'db', environment.to_s, dbname) }
16
+ set :connection_string, lambda { |dbname| "jdbc:h2:#{db_path(dbname)};IGNORECASE=TRUE" }
17
+ set :upload_path, lambda { File.join(data_path, 'uploads', environment.to_s) }
18
+ set :log_path, lambda { File.join(data_path, 'log') }
19
+ enable :sessions
20
+
21
+ data_path = inst_dir
22
+ if ENV['APPDATA']
23
+ # Windows
24
+ data_path = File.join(ENV['APPDATA'], "coupler")
25
+ elsif !File.writable?(data_path)
26
+ if ENV['HOME']
27
+ dir = File.join(ENV['HOME'], ".coupler")
28
+ else
29
+ raise "don't know where to put data!"
30
+ end
31
+ end
32
+ Dir.mkdir(data_path) if !File.exist?(data_path)
33
+ set :data_path, data_path
34
+
35
+ use Rack::Flash
36
+ register Extensions::Connections
37
+ register Extensions::Projects
38
+ register Extensions::Resources
39
+ register Extensions::Transformations
40
+ register Extensions::Scenarios
41
+ register Extensions::Matchers
42
+ register Extensions::Results
43
+ register Extensions::Jobs
44
+ register Extensions::Transformers
45
+ register Extensions::Imports
46
+ register Extensions::Exceptions
47
+
48
+ helpers do
49
+ include Coupler::Helpers
50
+ include Rack::Utils
51
+ alias_method :h, :escape_html
52
+ end
53
+
54
+ get "/" do
55
+ if Models::Project.count > 0
56
+ redirect "/projects"
57
+ else
58
+ session[:first_use] = true
59
+ erb :index
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,128 @@
1
+ module Coupler
2
+ module Config
3
+ DEFAULT_CONFIG = {
4
+ :database => {
5
+ :port => 12345,
6
+ :user => 'coupler',
7
+ :password => 'cupla',
8
+ :max_connections => '100',
9
+ :max_allowed_packet => '1M',
10
+ :connection_string => 'jdbc:mysql://localhost:%d/%s?user=%s&password=%s',
11
+ }
12
+ }
13
+
14
+ VENDOR_LIBS = {
15
+ 'jruby' => {
16
+ :type => 'java',
17
+ :filetype => 'jar',
18
+ :version => '1.6.0',
19
+ :url => "http://jruby.org.s3.amazonaws.com/downloads/%1$s/jruby-complete-%1$s.jar",
20
+ :uncompress => false,
21
+ :filename => "jruby-complete-%s.jar",
22
+ :symlink => "jruby-complete.jar"
23
+ },
24
+ 'mysql-connector-mxj' => {
25
+ :type => 'java',
26
+ :filetype => "tarball",
27
+ :version => '5-0-11',
28
+ :dir => "mysql-connector-mxj-gpl-%s",
29
+ :url => "http://mysql.mirrors.hoobly.com/Downloads/Connector-MXJ/mysql-connector-mxj-gpl-%s.tar.gz",
30
+ :libs => [
31
+ "mysql-connector-mxj-gpl-%s.jar",
32
+ "mysql-connector-mxj-gpl-%s-db-files.jar"
33
+ ]
34
+ },
35
+ 'mysql-connector-java' => {
36
+ :type => 'java',
37
+ :filetype => "tarball",
38
+ :version => '5.1.13',
39
+ :dir => "mysql-connector-java-%s",
40
+ :url => "http://mysql.mirrors.hoobly.com/Downloads/Connector-J/mysql-connector-java-%s.tar.gz",
41
+ :libs => [
42
+ "mysql-connector-java-%s-bin.jar",
43
+ ]
44
+ }
45
+ }
46
+
47
+ def self.each_vendor_lib
48
+ VENDOR_LIBS.each_key do |name|
49
+ yield(name, vendor_lib_info(name))
50
+ end
51
+ end
52
+
53
+ def self.vendor_lib_info(name)
54
+ info = VENDOR_LIBS[name]
55
+ info = info.merge({:url => info[:url] % info[:version]})
56
+ info[:dir] %= info[:version] if info[:dir]
57
+ info[:filename] %= info[:version] if info[:filename]
58
+ info
59
+ end
60
+
61
+ def self.vendor_lib_paths(name)
62
+ info = VENDOR_LIBS[name]
63
+ version = info[:version]
64
+ path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'vendor', info[:type], info[:dir] % version))
65
+ info[:libs].collect { |lib| File.join(path, lib % version) }
66
+ end
67
+
68
+ def self.require_vendor_libs(name)
69
+ vendor_lib_paths(name).each { |path| require(path) }
70
+ end
71
+
72
+ @@config = nil
73
+ def self.get(*keys)
74
+ if @@config.nil?
75
+ @@config = DEFAULT_CONFIG
76
+ end
77
+
78
+ if keys == [:data_path]
79
+ if !@@config.has_key?(keys[0])
80
+ # FIXME: this is a little naive
81
+ dir = File.join(File.dirname(__FILE__), "..", "..")
82
+ if ENV['APPDATA']
83
+ # Windows
84
+ dir = File.join(ENV['APPDATA'], "coupler")
85
+ elsif !File.writable?(dir)
86
+ if ENV['HOME']
87
+ dir = File.join(ENV['HOME'], ".coupler")
88
+ else
89
+ raise "don't know where to put data!"
90
+ end
91
+ end
92
+ @@config[:data_path] = File.expand_path(dir)
93
+ end
94
+ Dir.mkdir(@@config[:data_path]) if !File.exist?(@@config[:data_path])
95
+ elsif keys == [:upload_path]
96
+ if !@@config.has_key?(keys[0])
97
+ @@config[:upload_path] = path = File.join(get(:data_path), "uploads")
98
+ end
99
+ Dir.mkdir(@@config[:upload_path]) if !File.exist?(@@config[:upload_path])
100
+ end
101
+
102
+ keys.inject(@@config) { |hash, key| hash[key] }
103
+ end
104
+
105
+ def self.set(*args)
106
+ if @@config.nil?
107
+ @@config = DEFAULT_CONFIG
108
+ end
109
+
110
+ value = args.pop
111
+ keys = args
112
+
113
+ hash = keys[0..-2].inject(@@config) { |h, k| h[k] }
114
+ hash[keys[-1]] = value
115
+ end
116
+
117
+ def self.connection_string(database, options = {})
118
+ retval = self.get(:database, :connection_string) % [self.get(:database, :port), database, self.get(:database, :user), self.get(:database, :password)]
119
+ retval += "&createDatabaseIfNotExist=true" if options[:create_database]
120
+ case options[:zero_date_time_behavior]
121
+ when :convert_to_null
122
+ retval += "&zeroDateTimeBehavior=convertToNull"
123
+ end
124
+ retval += "&autoReconnect=true" if options[:auto_reconnect]
125
+ retval
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,20 @@
1
+ module Coupler
2
+ class DataUploader < CarrierWave::Uploader::Base
3
+ def store_dir
4
+ Base.settings.upload_path
5
+ end
6
+
7
+ def cache_dir
8
+ File.join(store_dir, 'tmp')
9
+ end
10
+
11
+ def filename
12
+ if @filename
13
+ @stored_filename ||= @filename.sub(/\..+?$/, "") + '-' + Digest::SHA1.hexdigest([@filename,
14
+ Time.now.utc, rand].join) + File.extname(@filename)
15
+ else
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ module Coupler
2
+ class Database < Delegator
3
+ include Singleton
4
+
5
+ def initialize
6
+ @env = ENV['COUPLER_ENV']
7
+ connection_string = Base.connection_string('coupler')
8
+ @database = Sequel.connect(connection_string, :loggers => [Coupler::Logger.instance], :max_connections => 20)
9
+ super(@database)
10
+ end
11
+
12
+ def __getobj__
13
+ @database
14
+ end
15
+
16
+ def rollback!
17
+ version = @database[:schema_info].first[:version]
18
+ migrate!(version - 1)
19
+ end
20
+
21
+ def migrate!(to = nil, from = nil)
22
+ dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'db', 'migrate'))
23
+ args = [@database, dir]
24
+ if to
25
+ args << to
26
+ args << from if from
27
+ end
28
+ Sequel::Migrator.apply(*args)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,57 @@
1
+ module Coupler
2
+ module Extensions
3
+ module Connections
4
+ include Models
5
+
6
+ def self.registered(app)
7
+ app.get "/connections" do
8
+ @connections = Connection.all
9
+ erb :'connections/index'
10
+ end
11
+
12
+ app.get "/connections/new" do
13
+ @connection = Connection.new
14
+ erb :'connections/new'
15
+ end
16
+
17
+ app.get "/connections/:id" do
18
+ @connection = Connection[:id => params[:id]]
19
+ @resources = @connection.resources
20
+ erb :'connections/show'
21
+ end
22
+
23
+ app.post "/connections" do
24
+ @connection = Connection.new(params[:connection])
25
+
26
+ if @connection.save
27
+ if session[:first_use]
28
+ flash[:notice] = "Connection was successfully created. The next step is creating a project."
29
+ redirect "/projects/new"
30
+ session[:first_use] = nil
31
+ elsif session[:return_to]
32
+ flash[:notice] = "Connection was successfully created. You can now create a resource for that connection."
33
+ redirect session[:return_to]
34
+ session[:return_to] = nil
35
+ else
36
+ flash[:notice] = "Connection was successfully created."
37
+ redirect "/connections"
38
+ end
39
+ else
40
+ erb 'connections/new'.to_sym
41
+ end
42
+ end
43
+
44
+ app.delete "/connections/:id" do
45
+ @connection = Connection[params[:id]]
46
+ if @connection.destroy
47
+ flash[:notice] = "Connection was successfully deleted."
48
+ else
49
+ flash[:notice] = "Connection could not be deleted."
50
+ flash[:notice_class] = "error"
51
+ end
52
+ redirect "/connections"
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,58 @@
1
+ module Coupler
2
+ module Extensions
3
+ class ProjectNotFound < Exception; end
4
+ class ResourceNotFound < Exception; end
5
+ class FieldNotFound < Exception; end
6
+ class TransformationNotFound < Exception; end
7
+ class ScenarioNotFound < Exception; end
8
+ class MatcherNotFound < Exception; end
9
+ class ResultNotFound < Exception; end
10
+ class ImportNotFound < Exception; end
11
+
12
+ module Exceptions
13
+ def self.registered(app)
14
+ app.error ProjectNotFound do
15
+ flash[:notice] = "The project you were looking for doesn't exist."
16
+ flash[:notice_class] = 'error'
17
+ redirect(Models::Project.count > 0 ? '/projects' : '/')
18
+ end
19
+
20
+ app.error ResourceNotFound do
21
+ flash[:notice] = "The resource you were looking for doesn't exist."
22
+ flash[:notice_class] = 'error'
23
+ redirect "/projects/#{@project.id}/resources"
24
+ end
25
+
26
+ app.error TransformationNotFound do
27
+ flash[:notice] = "The transformation you were looking for doesn't exist."
28
+ flash[:notice_class] = 'error'
29
+ redirect "/projects/#{@project.id}/resources/#{@resource.id}/transformations"
30
+ end
31
+
32
+ app.error ScenarioNotFound do
33
+ flash[:notice] = "The scenario you were looking for doesn't exist."
34
+ flash[:notice_class] = 'error'
35
+ redirect "/projects/#{@project.id}/scenarios"
36
+ end
37
+
38
+ app.error MatcherNotFound do
39
+ flash[:notice] = "The matcher you were looking for doesn't exist."
40
+ flash[:notice_class] = 'error'
41
+ redirect "/projects/#{@project.id}/scenarios/#{@scenario.id}"
42
+ end
43
+
44
+ app.error ResultNotFound do
45
+ flash[:notice] = "The result you were looking for doesn't exist."
46
+ flash[:notice_class] = 'error'
47
+ redirect "/projects/#{@project.id}/scenarios/#{@scenario.id}/results"
48
+ end
49
+
50
+ app.error ImportNotFound do
51
+ flash[:notice] = "The import you were looking for doesn't exist."
52
+ flash[:notice_class] = 'error'
53
+ redirect "/projects/#{@project.id}"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,43 @@
1
+ module Coupler
2
+ module Extensions
3
+ module Imports
4
+ def self.registered(app)
5
+ app.post "/projects/:project_id/imports/upload" do
6
+ @import = Models::Import.new(:data => params[:data], :project => @project)
7
+ erb :'imports/new'
8
+ end
9
+
10
+ app.post "/projects/:project_id/imports" do
11
+ @import = Models::Import.new(params[:import].merge(:project_id => @project.id))
12
+
13
+ if @import.save
14
+ @resource = Models::Resource.new(:import => @import)
15
+ if @resource.valid?
16
+ if @import.import!
17
+ @resource.save
18
+ redirect("/projects/#{@project.id}/resources/#{@resource.id}")
19
+ else
20
+ redirect("/projects/#{@project.id}/imports/#{@import.id}/edit")
21
+ end
22
+ end
23
+ end
24
+ erb(:'imports/new')
25
+ end
26
+
27
+ app.get "/projects/:project_id/imports/:id/edit" do
28
+ @import = Models::Import[:id => params[:id], :project_id => @project.id]
29
+ raise ImportNotFound unless @import
30
+ erb(:'imports/edit')
31
+ end
32
+
33
+ app.put "/projects/:project_id/imports/:id" do
34
+ @import = Models::Import[:id => params[:id], :project_id => @project.id]
35
+ raise ImportNotFound unless @import
36
+ @import.repair_duplicate_keys!(params[:delete])
37
+ @resource = Models::Resource.create(:import => @import)
38
+ redirect("/projects/#{@project.id}/resources/#{@resource.id}")
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end