coupler 0.0.4-java → 0.0.6-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -8
- data/Gemfile.lock +43 -24
- data/VERSION +1 -1
- data/coupler.gemspec +27 -31
- data/features/wizard.feature +2 -1
- data/lib/coupler.rb +2 -2
- data/lib/coupler/base.rb +4 -0
- data/lib/coupler/extensions/connections.rb +2 -12
- data/lib/coupler/extensions/jobs.rb +4 -2
- data/lib/coupler/extensions/projects.rb +1 -1
- data/lib/coupler/helpers.rb +9 -1
- data/lib/coupler/models.rb +8 -0
- data/lib/coupler/models/comparison.rb +5 -4
- data/lib/coupler/models/connection.rb +10 -1
- data/lib/coupler/models/import.rb +3 -7
- data/lib/coupler/models/transformer.rb +1 -1
- data/lib/coupler/runner.rb +1 -1
- data/lib/coupler/scheduler.rb +1 -1
- data/tasks/test.rake +8 -0
- data/test/functional/test_base.rb +17 -0
- data/test/functional/test_connections.rb +81 -0
- data/test/functional/test_imports.rb +76 -0
- data/test/{integration/extensions → functional}/test_jobs.rb +21 -12
- data/test/functional/test_matchers.rb +108 -0
- data/test/functional/test_projects.rb +67 -0
- data/test/functional/test_resources.rb +126 -0
- data/test/{integration/extensions → functional}/test_results.rb +20 -29
- data/test/functional/test_scenarios.rb +92 -0
- data/test/functional/test_transformations.rb +106 -0
- data/test/functional/test_transformers.rb +68 -0
- data/test/helper.rb +30 -20
- data/test/integration/test_transformation.rb +6 -1
- data/test/unit/models/test_common_model.rb +2 -2
- data/test/unit/models/test_comparison.rb +8 -8
- data/test/unit/models/test_connection.rb +2 -2
- data/test/unit/models/test_field.rb +2 -2
- data/test/unit/models/test_import.rb +9 -4
- data/test/unit/models/test_job.rb +2 -2
- data/test/unit/models/test_matcher.rb +2 -2
- data/test/unit/models/test_project.rb +2 -2
- data/test/unit/models/test_resource.rb +2 -2
- data/test/unit/models/test_result.rb +2 -2
- data/test/unit/models/test_scenario.rb +2 -2
- data/test/unit/models/test_transformation.rb +2 -2
- data/test/unit/models/test_transformer.rb +12 -2
- data/test/unit/test_base.rb +1 -14
- data/test/unit/test_data_uploader.rb +1 -1
- data/test/unit/test_database.rb +1 -1
- data/test/unit/test_helpers.rb +2 -2
- data/test/unit/test_import_buffer.rb +40 -38
- data/test/unit/test_logger.rb +1 -1
- data/test/unit/test_models.rb +1 -1
- data/test/unit/test_runner.rb +1 -1
- data/test/unit/test_scheduler.rb +1 -1
- data/webroot/public/css/style.css +7 -5
- data/webroot/public/js/jquery.dataTables.min.js +130 -574
- data/webroot/views/connections/new.erb +41 -3
- data/webroot/views/imports/new.erb +2 -0
- data/webroot/views/jobs/list.erb +25 -21
- data/webroot/views/projects/index.erb +23 -15
- data/webroot/views/resources/list.erb +1 -2
- data/webroot/views/resources/new.erb +2 -2
- data/webroot/views/resources/show.erb +5 -2
- data/webroot/views/scenarios/new.erb +1 -1
- data/webroot/views/transformations/new.erb +1 -1
- metadata +30 -44
- data/lib/coupler/config.rb +0 -128
- data/test/coupler/models/test_import.rb +0 -221
- data/test/factories.rb +0 -91
- data/test/integration/extensions/test_connections.rb +0 -80
- data/test/integration/extensions/test_imports.rb +0 -94
- data/test/integration/extensions/test_matchers.rb +0 -134
- data/test/integration/extensions/test_projects.rb +0 -82
- data/test/integration/extensions/test_resources.rb +0 -150
- data/test/integration/extensions/test_scenarios.rb +0 -88
- data/test/integration/extensions/test_transformations.rb +0 -113
- data/test/integration/extensions/test_transformers.rb +0 -80
- data/vendor/h2-1.3.154.jar +0 -0
data/Gemfile
CHANGED
@@ -1,26 +1,25 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
gem 'sinatra'
|
3
3
|
gem 'sequel'
|
4
|
-
gem 'rack-flash'
|
4
|
+
gem 'rack-flash', :require => 'rack/flash'
|
5
5
|
gem 'json'
|
6
6
|
gem 'fastercsv'
|
7
|
-
gem 'carrierwave'
|
7
|
+
gem 'carrierwave-sequel', :require => 'carrierwave/sequel'
|
8
8
|
gem 'mongrel'
|
9
|
-
gem 'jdbc-mysql'
|
9
|
+
gem 'jdbc-mysql', :require => 'jdbc/mysql'
|
10
|
+
gem 'jdbc-h2', :require => 'jdbc/h2'
|
10
11
|
|
11
12
|
group :development do
|
12
13
|
gem 'rake'
|
13
14
|
gem 'jeweler'
|
14
15
|
gem 'forgery', :require => false
|
15
16
|
gem 'test-unit', '2.2.0', :require => 'test/unit'
|
16
|
-
gem 'mocha'
|
17
|
-
gem 'rack-test', :require => 'rack/test'
|
17
|
+
gem 'mocha', :require => false
|
18
18
|
gem 'nokogiri'
|
19
19
|
gem 'timecop'
|
20
|
-
gem 'factory_girl'
|
21
20
|
gem 'git'
|
22
21
|
gem 'thor'
|
23
|
-
gem 'rake'
|
24
22
|
gem 'table_maker'
|
25
|
-
gem '
|
23
|
+
gem 'capybara'
|
24
|
+
gem 'jruby-openssl'
|
26
25
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,56 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.0.
|
5
|
-
|
4
|
+
activesupport (3.0.9)
|
5
|
+
bouncy-castle-java (1.5.0146.1)
|
6
|
+
capybara (1.0.0)
|
7
|
+
mime-types (>= 1.16)
|
8
|
+
nokogiri (>= 1.3.3)
|
9
|
+
rack (>= 1.0.0)
|
10
|
+
rack-test (>= 0.5.4)
|
11
|
+
selenium-webdriver (~> 0.2.0)
|
12
|
+
xpath (~> 0.1.4)
|
13
|
+
carrierwave (0.5.6)
|
6
14
|
activesupport (~> 3.0)
|
7
|
-
|
8
|
-
|
15
|
+
carrierwave-sequel (0.1.0)
|
16
|
+
carrierwave
|
17
|
+
sequel
|
18
|
+
childprocess (0.1.9)
|
19
|
+
ffi (~> 1.0.6)
|
9
20
|
fastercsv (1.5.4)
|
10
|
-
|
21
|
+
ffi (1.0.9-java)
|
22
|
+
forgery (0.3.10)
|
11
23
|
nokogiri (~> 1.4)
|
12
24
|
gem_plugin (0.2.3)
|
13
25
|
git (1.2.5)
|
26
|
+
jdbc-h2 (1.3.154)
|
14
27
|
jdbc-mysql (5.1.13)
|
15
|
-
jeweler (1.6.
|
16
|
-
bundler (~> 1.0
|
28
|
+
jeweler (1.6.4)
|
29
|
+
bundler (~> 1.0)
|
17
30
|
git (>= 1.2.5)
|
18
31
|
rake
|
19
|
-
|
32
|
+
jruby-openssl (0.7.4)
|
33
|
+
bouncy-castle-java
|
34
|
+
json (1.5.3-java)
|
35
|
+
json_pure (1.5.3)
|
36
|
+
mime-types (1.16)
|
20
37
|
mocha (0.9.12)
|
21
38
|
mongrel (1.1.5-java)
|
22
39
|
gem_plugin (>= 0.2.3)
|
23
|
-
nokogiri (1.
|
24
|
-
|
25
|
-
rack (1.2
|
26
|
-
rack-flash (0.1.1)
|
40
|
+
nokogiri (1.5.0-java)
|
41
|
+
rack (1.3.0)
|
42
|
+
rack-flash (0.1.2)
|
27
43
|
rack
|
28
44
|
rack-test (0.6.0)
|
29
45
|
rack (>= 1.0)
|
30
|
-
rake (0.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
46
|
+
rake (0.9.2)
|
47
|
+
rubyzip (0.9.4)
|
48
|
+
selenium-webdriver (0.2.2)
|
49
|
+
childprocess (>= 0.1.9)
|
50
|
+
ffi (>= 1.0.7)
|
51
|
+
json_pure
|
52
|
+
rubyzip
|
53
|
+
sequel (3.25.0)
|
36
54
|
sinatra (1.2.6)
|
37
55
|
rack (~> 1.1)
|
38
56
|
tilt (>= 1.2.2, < 2.0)
|
@@ -40,29 +58,30 @@ GEM
|
|
40
58
|
sequel
|
41
59
|
test-unit (2.2.0)
|
42
60
|
thor (0.14.6)
|
43
|
-
tilt (1.3)
|
61
|
+
tilt (1.3.2)
|
44
62
|
timecop (0.3.5)
|
45
|
-
|
63
|
+
xpath (0.1.4)
|
64
|
+
nokogiri (~> 1.3)
|
46
65
|
|
47
66
|
PLATFORMS
|
48
67
|
java
|
49
68
|
|
50
69
|
DEPENDENCIES
|
51
|
-
|
52
|
-
|
70
|
+
capybara
|
71
|
+
carrierwave-sequel
|
53
72
|
fastercsv
|
54
73
|
forgery
|
55
74
|
git
|
75
|
+
jdbc-h2
|
56
76
|
jdbc-mysql
|
57
77
|
jeweler
|
78
|
+
jruby-openssl
|
58
79
|
json
|
59
80
|
mocha
|
60
81
|
mongrel
|
61
82
|
nokogiri
|
62
83
|
rack-flash
|
63
|
-
rack-test
|
64
84
|
rake
|
65
|
-
ruby-debug
|
66
85
|
sequel
|
67
86
|
sinatra
|
68
87
|
table_maker
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/coupler.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{coupler}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
s.platform = %q{java}
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Jeremy Stephens"]
|
13
|
-
s.date = %q{2011-
|
13
|
+
s.date = %q{2011-07-12}
|
14
14
|
s.default_executable = %q{coupler}
|
15
15
|
s.description = %q{Coupler is a (JRuby) desktop application designed to link datasets together}
|
16
16
|
s.email = %q{jeremy.f.stephens@vanderbilt.edu}
|
@@ -58,6 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
"db/migrate/020_rename_import_columns.rb",
|
59
59
|
"db/migrate/021_add_fields_to_connections.rb",
|
60
60
|
"db/migrate/022_remove_database_name_from_resources.rb",
|
61
|
+
"db/migrate/023_add_import_jobs.rb",
|
61
62
|
"features/connections.feature",
|
62
63
|
"features/matchers.feature",
|
63
64
|
"features/projects.feature",
|
@@ -77,7 +78,6 @@ Gem::Specification.new do |s|
|
|
77
78
|
"gfx/icon.svg",
|
78
79
|
"lib/coupler.rb",
|
79
80
|
"lib/coupler/base.rb",
|
80
|
-
"lib/coupler/config.rb",
|
81
81
|
"lib/coupler/data_uploader.rb",
|
82
82
|
"lib/coupler/database.rb",
|
83
83
|
"lib/coupler/extensions.rb",
|
@@ -129,23 +129,22 @@ Gem::Specification.new do |s|
|
|
129
129
|
"tasks/vendor.rake",
|
130
130
|
"test/README.txt",
|
131
131
|
"test/config.yml",
|
132
|
-
"test/coupler/models/test_import.rb",
|
133
|
-
"test/factories.rb",
|
134
132
|
"test/fixtures/duplicate-keys.csv",
|
135
133
|
"test/fixtures/no-headers.csv",
|
136
134
|
"test/fixtures/people.csv",
|
137
135
|
"test/fixtures/varying-row-size.csv",
|
136
|
+
"test/functional/test_base.rb",
|
137
|
+
"test/functional/test_connections.rb",
|
138
|
+
"test/functional/test_imports.rb",
|
139
|
+
"test/functional/test_jobs.rb",
|
140
|
+
"test/functional/test_matchers.rb",
|
141
|
+
"test/functional/test_projects.rb",
|
142
|
+
"test/functional/test_resources.rb",
|
143
|
+
"test/functional/test_results.rb",
|
144
|
+
"test/functional/test_scenarios.rb",
|
145
|
+
"test/functional/test_transformations.rb",
|
146
|
+
"test/functional/test_transformers.rb",
|
138
147
|
"test/helper.rb",
|
139
|
-
"test/integration/extensions/test_connections.rb",
|
140
|
-
"test/integration/extensions/test_imports.rb",
|
141
|
-
"test/integration/extensions/test_jobs.rb",
|
142
|
-
"test/integration/extensions/test_matchers.rb",
|
143
|
-
"test/integration/extensions/test_projects.rb",
|
144
|
-
"test/integration/extensions/test_resources.rb",
|
145
|
-
"test/integration/extensions/test_results.rb",
|
146
|
-
"test/integration/extensions/test_scenarios.rb",
|
147
|
-
"test/integration/extensions/test_transformations.rb",
|
148
|
-
"test/integration/extensions/test_transformers.rb",
|
149
148
|
"test/integration/test_field.rb",
|
150
149
|
"test/integration/test_import.rb",
|
151
150
|
"test/integration/test_running_scenarios.rb",
|
@@ -169,12 +168,12 @@ Gem::Specification.new do |s|
|
|
169
168
|
"test/unit/test_data_uploader.rb",
|
170
169
|
"test/unit/test_database.rb",
|
171
170
|
"test/unit/test_helpers.rb",
|
171
|
+
"test/unit/test_import_buffer.rb",
|
172
172
|
"test/unit/test_logger.rb",
|
173
173
|
"test/unit/test_models.rb",
|
174
174
|
"test/unit/test_runner.rb",
|
175
175
|
"test/unit/test_scheduler.rb",
|
176
176
|
"uploads/.gitignore",
|
177
|
-
"vendor/h2-1.3.154.jar",
|
178
177
|
"webroot/public/css/960.css",
|
179
178
|
"webroot/public/css/dataTables.css",
|
180
179
|
"webroot/public/css/jquery-ui.css",
|
@@ -293,46 +292,44 @@ Gem::Specification.new do |s|
|
|
293
292
|
s.add_runtime_dependency(%q<rack-flash>, [">= 0"])
|
294
293
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
295
294
|
s.add_runtime_dependency(%q<fastercsv>, [">= 0"])
|
296
|
-
s.add_runtime_dependency(%q<carrierwave>, [">= 0"])
|
295
|
+
s.add_runtime_dependency(%q<carrierwave-sequel>, [">= 0"])
|
297
296
|
s.add_runtime_dependency(%q<mongrel>, [">= 0"])
|
298
297
|
s.add_runtime_dependency(%q<jdbc-mysql>, [">= 0"])
|
298
|
+
s.add_runtime_dependency(%q<jdbc-h2>, [">= 0"])
|
299
299
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
300
300
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
301
301
|
s.add_development_dependency(%q<forgery>, [">= 0"])
|
302
302
|
s.add_development_dependency(%q<test-unit>, ["= 2.2.0"])
|
303
303
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
304
|
-
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
305
304
|
s.add_development_dependency(%q<nokogiri>, [">= 0"])
|
306
305
|
s.add_development_dependency(%q<timecop>, [">= 0"])
|
307
|
-
s.add_development_dependency(%q<factory_girl>, [">= 0"])
|
308
306
|
s.add_development_dependency(%q<git>, [">= 0"])
|
309
307
|
s.add_development_dependency(%q<thor>, [">= 0"])
|
310
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
311
308
|
s.add_development_dependency(%q<table_maker>, [">= 0"])
|
312
|
-
s.add_development_dependency(%q<
|
309
|
+
s.add_development_dependency(%q<capybara>, [">= 0"])
|
310
|
+
s.add_development_dependency(%q<jruby-openssl>, [">= 0"])
|
313
311
|
else
|
314
312
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
315
313
|
s.add_dependency(%q<sequel>, [">= 0"])
|
316
314
|
s.add_dependency(%q<rack-flash>, [">= 0"])
|
317
315
|
s.add_dependency(%q<json>, [">= 0"])
|
318
316
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
319
|
-
s.add_dependency(%q<carrierwave>, [">= 0"])
|
317
|
+
s.add_dependency(%q<carrierwave-sequel>, [">= 0"])
|
320
318
|
s.add_dependency(%q<mongrel>, [">= 0"])
|
321
319
|
s.add_dependency(%q<jdbc-mysql>, [">= 0"])
|
320
|
+
s.add_dependency(%q<jdbc-h2>, [">= 0"])
|
322
321
|
s.add_dependency(%q<rake>, [">= 0"])
|
323
322
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
324
323
|
s.add_dependency(%q<forgery>, [">= 0"])
|
325
324
|
s.add_dependency(%q<test-unit>, ["= 2.2.0"])
|
326
325
|
s.add_dependency(%q<mocha>, [">= 0"])
|
327
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
328
326
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
329
327
|
s.add_dependency(%q<timecop>, [">= 0"])
|
330
|
-
s.add_dependency(%q<factory_girl>, [">= 0"])
|
331
328
|
s.add_dependency(%q<git>, [">= 0"])
|
332
329
|
s.add_dependency(%q<thor>, [">= 0"])
|
333
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
334
330
|
s.add_dependency(%q<table_maker>, [">= 0"])
|
335
|
-
s.add_dependency(%q<
|
331
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
332
|
+
s.add_dependency(%q<jruby-openssl>, [">= 0"])
|
336
333
|
end
|
337
334
|
else
|
338
335
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
@@ -340,23 +337,22 @@ Gem::Specification.new do |s|
|
|
340
337
|
s.add_dependency(%q<rack-flash>, [">= 0"])
|
341
338
|
s.add_dependency(%q<json>, [">= 0"])
|
342
339
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
343
|
-
s.add_dependency(%q<carrierwave>, [">= 0"])
|
340
|
+
s.add_dependency(%q<carrierwave-sequel>, [">= 0"])
|
344
341
|
s.add_dependency(%q<mongrel>, [">= 0"])
|
345
342
|
s.add_dependency(%q<jdbc-mysql>, [">= 0"])
|
343
|
+
s.add_dependency(%q<jdbc-h2>, [">= 0"])
|
346
344
|
s.add_dependency(%q<rake>, [">= 0"])
|
347
345
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
348
346
|
s.add_dependency(%q<forgery>, [">= 0"])
|
349
347
|
s.add_dependency(%q<test-unit>, ["= 2.2.0"])
|
350
348
|
s.add_dependency(%q<mocha>, [">= 0"])
|
351
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
352
349
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
353
350
|
s.add_dependency(%q<timecop>, [">= 0"])
|
354
|
-
s.add_dependency(%q<factory_girl>, [">= 0"])
|
355
351
|
s.add_dependency(%q<git>, [">= 0"])
|
356
352
|
s.add_dependency(%q<thor>, [">= 0"])
|
357
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
358
353
|
s.add_dependency(%q<table_maker>, [">= 0"])
|
359
|
-
s.add_dependency(%q<
|
354
|
+
s.add_dependency(%q<capybara>, [">= 0"])
|
355
|
+
s.add_dependency(%q<jruby-openssl>, [">= 0"])
|
360
356
|
end
|
361
357
|
end
|
362
358
|
|
data/features/wizard.feature
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Feature: running Coupler for the first time
|
2
2
|
|
3
|
-
Scenario:
|
3
|
+
Scenario: with a database resource
|
4
4
|
When I go to the front page
|
5
5
|
And I click the "create a project" link
|
6
6
|
And I fill in the form:
|
@@ -8,3 +8,4 @@ Feature: running Coupler for the first time
|
|
8
8
|
| Description | This is my first project |
|
9
9
|
And I click the "Submit" button
|
10
10
|
And I click the "add a resource" link
|
11
|
+
And I click the
|
data/lib/coupler.rb
CHANGED
@@ -18,10 +18,10 @@ require 'sequel'
|
|
18
18
|
require 'sequel/extensions/migration'
|
19
19
|
require 'json'
|
20
20
|
require 'fastercsv'
|
21
|
-
require 'carrierwave'
|
21
|
+
require 'carrierwave/sequel'
|
22
22
|
require 'mongrel'
|
23
23
|
#require 'jdbc/mysql' # Sequel should load this when it needs to.
|
24
|
-
require
|
24
|
+
#require 'jdbc/h2' # Sequel should load this when it needs to.
|
25
25
|
|
26
26
|
require File.dirname(__FILE__) + "/coupler/logger"
|
27
27
|
require File.dirname(__FILE__) + "/coupler/database"
|
data/lib/coupler/base.rb
CHANGED
@@ -24,18 +24,8 @@ module Coupler
|
|
24
24
|
@connection = Connection.new(params[:connection])
|
25
25
|
|
26
26
|
if @connection.save
|
27
|
-
|
28
|
-
|
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
|
27
|
+
flash[:notice] = "Connection was successfully created."
|
28
|
+
redirect "/connections"
|
39
29
|
else
|
40
30
|
erb 'connections/new'.to_sym
|
41
31
|
end
|
@@ -8,12 +8,14 @@ module Coupler
|
|
8
8
|
end
|
9
9
|
|
10
10
|
app.get "/jobs/count" do
|
11
|
-
|
11
|
+
content_type :json
|
12
|
+
[200, [Models::Job.filter(:completed_at => nil).count.to_json]]
|
12
13
|
end
|
13
14
|
|
14
15
|
app.get "/jobs/:id/progress" do
|
16
|
+
content_type :text
|
15
17
|
@job = Models::Job[:id => params[:id]]
|
16
|
-
{ :completed => @job.completed, :total => @job.total }.to_json
|
18
|
+
[200, [{ :completed => @job.completed, :total => @job.total }.to_json]]
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/coupler/helpers.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Coupler
|
2
2
|
module Helpers
|
3
3
|
def error_messages_for(object)
|
4
|
-
return "" if object.errors.empty?
|
4
|
+
return "" if object.nil? || object.errors.empty?
|
5
5
|
|
6
6
|
retval = "<div class='errors'><h3>Errors detected:</h3><ul>"
|
7
7
|
object.errors.each do |(attr, messages)|
|
@@ -117,5 +117,13 @@ module Coupler
|
|
117
117
|
def cycle(even, odd)
|
118
118
|
(@_cycle = !@_cycle) ? even : odd
|
119
119
|
end
|
120
|
+
|
121
|
+
def field_type(resource, field)
|
122
|
+
result = field.final_type
|
123
|
+
if !resource.import_id
|
124
|
+
result += " (#{field.final_db_type})"
|
125
|
+
end
|
126
|
+
result
|
127
|
+
end
|
120
128
|
end
|
121
129
|
end
|
data/lib/coupler/models.rb
CHANGED
@@ -12,6 +12,14 @@ module Coupler
|
|
12
12
|
:Transformation, :Scenario, :Matcher, :Job, :Result, :Comparison,
|
13
13
|
:Import
|
14
14
|
]
|
15
|
+
|
16
|
+
def self.load_all
|
17
|
+
Database.instance
|
18
|
+
NAMES.each do |name|
|
19
|
+
require File.dirname(__FILE__) + "/models/#{name.to_s.downcase}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
15
23
|
def self.const_missing(name)
|
16
24
|
name = name.to_sym
|
17
25
|
if NAMES.include?(name)
|
@@ -31,9 +31,10 @@ module Coupler
|
|
31
31
|
field = lhs_rhs_value(name)
|
32
32
|
result = field.name
|
33
33
|
resource_name = field.resource.name
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
# FIXME: revisit this!
|
35
|
+
#if self[:"#{name}_which"]
|
36
|
+
#resource_name += %{<span class="sup">#{self[:"#{name}_which"]}</span>}
|
37
|
+
#end
|
37
38
|
result += " (#{resource_name})"
|
38
39
|
else
|
39
40
|
lhs_rhs_value(name).inspect
|
@@ -147,7 +148,7 @@ module Coupler
|
|
147
148
|
validates_includes [1, 2], :rhs_which if rhs_type == 'field'
|
148
149
|
|
149
150
|
if lhs_type == 'field' && rhs_type == 'field' && (lhs_field = lhs_value) && (rhs_field = rhs_value)
|
150
|
-
if lhs_field[:
|
151
|
+
if lhs_field[:final_type] != rhs_field[:final_type]
|
151
152
|
errors.add(:base, "Comparing fields of different types is currently disallowed.")
|
152
153
|
end
|
153
154
|
if lhs_which != rhs_which && operator != 'equals'
|