surveyor 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +26 -0
- data/Gemfile +11 -0
- data/Gemfile.rails_version +13 -0
- data/README.md +40 -22
- data/Rakefile +92 -29
- data/app/helpers/survey_form_builder.rb +37 -0
- data/app/helpers/surveyor_helper.rb +9 -9
- data/app/views/partials/_answer.html.haml +1 -1
- data/app/views/partials/_question.html.haml +3 -3
- data/app/views/partials/_question_group.html.haml +2 -2
- data/app/views/partials/_section.html.haml +1 -1
- data/app/views/surveyor/edit.html.haml +11 -3
- data/app/views/surveyor/new.html.haml +8 -1
- data/ci-exec.sh +50 -0
- data/config/routes.rb +9 -13
- data/cucumber.yml +10 -0
- data/doc/question types.png +0 -0
- data/features/redcap_parser.feature +1 -1
- data/features/step_definitions/common_setps.rb +3 -0
- data/features/step_definitions/parser_steps.rb +8 -1
- data/features/step_definitions/surveyor_steps.rb +33 -9
- data/features/step_definitions/web_steps.rb +85 -165
- data/features/support/env.rb +40 -46
- data/features/support/paths.rb +4 -4
- data/features/support/selectors.rb +39 -0
- data/features/surveyor.feature +63 -13
- data/features/surveyor_dependencies.feature +289 -0
- data/features/surveyor_parser.feature +29 -20
- data/lib/formtastic/surveyor_builder.rb +9 -9
- data/lib/generators/surveyor/custom_generator.rb +17 -0
- data/lib/generators/surveyor/install_generator.rb +50 -0
- data/{generators/extend_surveyor/templates/extensions → lib/generators/surveyor/templates/app/controllers}/surveyor_controller.rb +0 -0
- data/{generators/extend_surveyor/templates/extensions → lib/generators/surveyor/templates/app/views/layouts}/surveyor_custom.html.erb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/config}/locales/surveyor_en.yml +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/config}/locales/surveyor_es.yml +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/config}/locales/surveyor_he.yml +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_api_ids.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_correct_answer_id_to_questions.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_default_value_to_answers.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_display_order_to_surveys.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_display_type_to_answers.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_index_to_response_sets.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_index_to_surveys.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_section_id_to_responses.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/add_unique_indicies.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_answers.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_dependencies.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_dependency_conditions.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_question_groups.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_questions.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_response_sets.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_responses.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_survey_sections.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_surveys.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_validation_conditions.rb +0 -0
- data/{generators/surveyor/templates → lib/generators/surveyor/templates/db}/migrate/create_validations.rb +0 -0
- data/{generators/surveyor/templates/assets/images → lib/generators/surveyor/templates/public/images/surveyor}/next.gif +0 -0
- data/{generators/surveyor/templates/assets/images → lib/generators/surveyor/templates/public/images/surveyor}/prev.gif +0 -0
- data/lib/generators/surveyor/templates/public/javascripts/surveyor/jquery.blockUI.js +499 -0
- data/{generators/surveyor/templates/assets/javascripts → lib/generators/surveyor/templates/public/javascripts/surveyor}/jquery.surveyor.js +47 -4
- data/{generators/surveyor/templates/assets/javascripts → lib/generators/surveyor/templates/public/javascripts/surveyor}/jquery.tools.min.js +0 -0
- data/{generators/surveyor/templates/assets → lib/generators/surveyor/templates/public}/stylesheets/sass/custom.sass +0 -0
- data/{generators/surveyor/templates/assets → lib/generators/surveyor/templates/public}/stylesheets/sass/surveyor.sass +2 -2
- data/{generators/surveyor/templates/assets/stylesheets → lib/generators/surveyor/templates/public/stylesheets/surveyor}/dateinput.css +0 -0
- data/{generators/surveyor/templates/assets/stylesheets → lib/generators/surveyor/templates/public/stylesheets/surveyor}/reset.css +0 -0
- data/{generators/surveyor/templates/assets/stylesheets → lib/generators/surveyor/templates/public/stylesheets/surveyor}/results.css +0 -0
- data/{generators/extend_surveyor/templates/EXTENDING_SURVEYOR → lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md} +0 -0
- data/{generators → lib/generators}/surveyor/templates/surveys/kitchen_sink_survey.rb +0 -0
- data/{generators → lib/generators}/surveyor/templates/surveys/quiz.rb +0 -0
- data/lib/surveyor.rb +7 -0
- data/lib/surveyor/engine.rb +12 -0
- data/lib/surveyor/models/answer_methods.rb +0 -1
- data/lib/surveyor/models/dependency_condition_methods.rb +1 -3
- data/lib/surveyor/models/question_methods.rb +0 -1
- data/lib/surveyor/models/response_methods.rb +2 -2
- data/lib/surveyor/models/response_set_methods.rb +30 -14
- data/lib/surveyor/models/survey_methods.rb +2 -1
- data/lib/surveyor/models/survey_section_methods.rb +1 -2
- data/lib/surveyor/parser.rb +9 -7
- data/lib/surveyor/redcap_parser.rb +10 -7
- data/lib/surveyor/surveyor_controller_methods.rb +45 -11
- data/lib/surveyor/version.rb +3 -0
- data/lib/tasks/surveyor_tasks.rake +2 -2
- data/rails/init.rb +0 -1
- data/spec/controllers/surveyor_controller_spec.rb +81 -35
- data/spec/helpers/surveyor_helper_spec.rb +7 -1
- data/spec/models/dependency_condition_spec.rb +76 -63
- data/spec/models/response_set_spec.rb +52 -47
- data/spec/models/response_spec.rb +19 -16
- data/spec/spec_helper.rb +21 -44
- data/surveyor.gemspec +25 -176
- metadata +302 -77
- data/CHANGELOG +0 -335
- data/VERSION +0 -1
- data/ci-env.sh +0 -29
- data/generators/extend_surveyor/extend_surveyor_generator.rb +0 -21
- data/generators/surveyor/surveyor_generator.rb +0 -69
- data/generators/surveyor/templates/README +0 -10
- data/generators/surveyor/templates/tasks/surveyor.rb +0 -4
- data/hudson.rakefile +0 -33
- data/init_testbed.rakefile +0 -55
- data/testbed/Gemfile +0 -13
data/hudson.rakefile
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
BUNDLER_VERSION="1.0.7"
|
2
|
-
import 'init_testbed.rakefile'
|
3
|
-
|
4
|
-
namespace :bundle do
|
5
|
-
task :ensure_bundler_available do
|
6
|
-
`gem list -i bundler -v '=#{BUNDLER_VERSION}'`
|
7
|
-
unless $? == 0
|
8
|
-
puts bordered_message("Installing bundler #{BUNDLER_VERSION}")
|
9
|
-
system("gem install bundler -v '=#{BUNDLER_VERSION}' --no-ri --no-rdoc")
|
10
|
-
unless $? == 0
|
11
|
-
fail bordered_message("Install failed.\nPlease fix the problem and try again or manually install bundler #{BUNDLER_VERSION}.")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def bordered_message(msg)
|
17
|
-
len = msg.split("\n").collect { |l| l.size }.max
|
18
|
-
['=' * len, msg, '=' * len].join("\n")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
namespace :ci do
|
22
|
-
task :generate_testbed_for_hudson => [:'testbed:remove', :'testbed:generate'] do
|
23
|
-
# Hudson
|
24
|
-
chdir("testbed") do
|
25
|
-
database_yml = File.read('config/database.yml') + "\n\nhudson:\n <<: *test\n"
|
26
|
-
File.open('config/database.yml', 'w'){|f| f.write database_yml}
|
27
|
-
sh "cp config/environments/cucumber.rb config/environments/hudson.rb"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
task :setup_testbed_for_hudson => [:'testbed:setup', :'testbed:migrate']
|
31
|
-
end
|
32
|
-
|
33
|
-
task :default => [:'bundle:ensure_bundler_available', :'ci:generate_testbed_for_hudson', :'ci:setup_testbed_for_hudson']
|
data/init_testbed.rakefile
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
desc "Set up a rails app for testing in the spec dir"
|
2
|
-
task :default => [:"testbed:generate", :"testbed:setup", :"testbed:migrate"]
|
3
|
-
|
4
|
-
namespace "testbed" do
|
5
|
-
# "testbed" is also hardcoded in the spec/spec_helper.rb features/support/env.rb and gitignore file. Change it there too...
|
6
|
-
|
7
|
-
"Generate rails, rspec, cucumber"
|
8
|
-
task :generate do
|
9
|
-
chdir("testbed") do
|
10
|
-
sh "bundle install"
|
11
|
-
sh "bundle exec rails ."
|
12
|
-
sh "bundle exec script/generate rspec"
|
13
|
-
sh "bundle exec script/generate cucumber --webrat"
|
14
|
-
sh "rm -rf spec features"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "Setup bundler, rspec, cucumber"
|
19
|
-
task :setup do
|
20
|
-
chdir("testbed") do
|
21
|
-
# Bundler
|
22
|
-
preinitializer_rb = "begin\n require \"rubygems\"\n require \"bundler\"\nrescue LoadError\n raise \"Could not load the bundler gem. Install it with `gem install bundler`.\"\nend\n\nif Gem::Version.new(Bundler::VERSION) <= Gem::Version.new(\"0.9.24\")\n raise RuntimeError, \"Your bundler version is too old for Rails 2.3.\" +\n \"Run `gem install bundler` to upgrade.\"\nend\n\nbegin\n # Set up load paths for all bundled gems\n ENV[\"BUNDLE_GEMFILE\"] = File.expand_path(\"../../Gemfile\", __FILE__)\n Bundler.setup\nrescue Bundler::GemNotFound\n raise RuntimeError, \"Bundler couldn't find some gems.\" +\n \"Did you run `bundle install`?\"\nend\n"
|
23
|
-
File.open('config/preinitializer.rb', 'w'){|f| f.write preinitializer_rb}
|
24
|
-
|
25
|
-
boot_rb = File.read('config/boot.rb').sub("# All that for this:", "class Rails::Boot\n def run\n load_initializer\n\n Rails::Initializer.class_eval do\n def load_gems\n @bundler_loaded ||= Bundler.require :default, Rails.env\n end\n end\n\n Rails::Initializer.run(:set_load_path)\n end\nend\n\n# All that for this:")
|
26
|
-
File.open('config/boot.rb', 'w'){|f| f.write boot_rb}
|
27
|
-
puts "NOTE: These files were created/modified as described here: http://gembundler.com/rails23.html"
|
28
|
-
|
29
|
-
# Rspec
|
30
|
-
rspec_rake = File.read('lib/tasks/rspec.rake').gsub('#{RAILS_ROOT}/spec/', '#{RAILS_ROOT}/../spec/').gsub("FileList['spec/", "FileList['../spec/").gsub("File.exist?('spec/","File.exist?('../spec/")
|
31
|
-
File.open('lib/tasks/rspec.rake', 'w'){|f| f.write rspec_rake}
|
32
|
-
|
33
|
-
# Cucumber
|
34
|
-
cucumber_rake = File.read('lib/tasks/cucumber.rake').sub("begin", "ENV['FEATURE'] ||= '../features'\n\nbegin")
|
35
|
-
File.open('lib/tasks/cucumber.rake', 'w'){|f| f.write cucumber_rake}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
desc "Generate, migrate testbed"
|
40
|
-
task :migrate do
|
41
|
-
sh "cp -R generators testbed/lib"
|
42
|
-
chdir("testbed") do
|
43
|
-
sh "bundle exec script/generate surveyor"
|
44
|
-
sh "bundle exec rake db:migrate db:test:prepare"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "Remove testbed app"
|
49
|
-
task :remove do
|
50
|
-
puts "Removing the test_app in the spec folder"
|
51
|
-
chdir("testbed") do
|
52
|
-
sh 'rm -rf Gemfile.lock README Rakefile app config db doc features lib log public script spec surveys test tmp vendor'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
data/testbed/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source :rubygems
|
2
|
-
|
3
|
-
gem 'rails', '2.3.10'
|
4
|
-
gem 'rspec', '~> 1.3'
|
5
|
-
gem 'rspec-rails', '1.3.3'
|
6
|
-
gem 'sqlite3-ruby', '1.2.5' # Using this version for ruby 1.8.7 compatibility reasons
|
7
|
-
gem 'webrat'
|
8
|
-
gem 'cucumber', '~>0.9'
|
9
|
-
gem 'cucumber-rails', '0.3.2'
|
10
|
-
gem 'database_cleaner'
|
11
|
-
gem 'factory_girl'
|
12
|
-
|
13
|
-
gem 'surveyor', :path => ".."
|