surveyor 0.14.2 → 0.14.3

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.
data/README.md CHANGED
@@ -114,6 +114,10 @@ To work on the plugin code (for enhancements, and bug fixes, etc...) fork this g
114
114
 
115
115
  # Changes
116
116
 
117
+ 0.14.3
118
+
119
+ * remove manual numbering until it works. refactoring to use common methods.
120
+
117
121
  0.14.2
118
122
 
119
123
  * lowercase localization. feature instead of story in cucumber feature
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.2
1
+ 0.14.3
data/app/models/survey.rb CHANGED
@@ -29,7 +29,7 @@ class Survey < ActiveRecord::Base
29
29
  end
30
30
 
31
31
  def title=(value)
32
- self.access_code = Survey.to_normalized_string(value)
32
+ self.access_code = Surveyor::Common.to_normalized_string(value)
33
33
  super
34
34
  end
35
35
 
@@ -2,8 +2,6 @@
2
2
  - case renderer
3
3
  - when :label
4
4
  - div_for question, :class => "label #{question.css_class(response_set)}" do
5
- - if question.survey_section.survey.manual_numbering
6
- .number= question.number||'&nbsp;'
7
5
  %span.text= question.text
8
6
  %span.help= question.help_text
9
7
  - when :image
data/lib/surveyor.rb CHANGED
@@ -1,37 +1,3 @@
1
1
  require File.dirname(__FILE__) + '/surveyor/acts_as_response'
2
2
  module Surveyor
3
- RAND_CHARS = [('a'..'z'), ('A'..'Z'), (0..9)].map{|r| r.to_a}.flatten.to_s
4
-
5
- def self.make_tiny_code(len = 10)
6
- if RUBY_VERSION < "1.8.7"
7
- (1..len).to_a.map{|i| RAND_CHARS[rand(RAND_CHARS.size), 1] }.to_s
8
- else
9
- len.times.map{|i| RAND_CHARS[rand(RAND_CHARS.size), 1] }.to_s
10
- end
11
- end
12
-
13
- def self.to_normalized_string(text)
14
- words_to_omit = %w(a be but has have in is it of on or the to when)
15
- col_text = text.gsub(/(<[^>]*>)|\n|\t/s, ' ') # Remove html tags
16
- col_text.downcase! # Remove capitalization
17
- col_text.gsub!(/\"|\'/, '') # Remove potential problem characters
18
- col_text.gsub!(/\(.*?\)/,'') # Remove text inside parens
19
- col_text.gsub!(/\W/, ' ') # Remove all other non-word characters
20
- cols = (col_text.split(' ') - words_to_omit)
21
- (cols.size > 5 ? cols[-5..-1] : cols).join("_")
22
- end
23
- end
24
-
25
- # From http://guides.rubyonrails.org/plugins.html#controllers
26
- # Fix for:
27
- # ArgumentError in SurveyorController#edit
28
- # A copy of ApplicationController has been removed from the module tree but is still active!
29
- # Equivalent of using "unloadable" in SurveyorController (unloadable has been deprecated)
30
-
31
- %w{models controllers}.each do |dir|
32
- path = File.expand_path(File.join(File.dirname(__FILE__), '../app', dir))
33
- # $LOAD_PATH << path # already here
34
- # ActiveSupport::Dependencies.load_paths << path # already here too
35
- ActiveSupport::Dependencies.load_once_paths.delete(path)
36
- # [$LOAD_PATH, ActiveSupport::Dependencies.load_paths, ActiveSupport::Dependencies.load_once_paths].each{|x| Rails.logger.info x}
37
- end
3
+ end
@@ -28,7 +28,7 @@ module SurveyParser
28
28
  end
29
29
 
30
30
  def text_args(text = "Answer")
31
- {:text => text.to_s, :short_text => text, :data_export_identifier => Surveyor.to_normalized_string(text)}
31
+ {:text => text.to_s, :short_text => text, :data_export_identifier => Surveyor::Common.to_normalized_string(text)}
32
32
  end
33
33
  def hash_from(arg)
34
34
  arg.is_a?(Symbol) ? {:response_class => arg.to_s} : arg.is_a?(Hash) ? arg : {}
@@ -24,7 +24,7 @@ module SurveyParser
24
24
 
25
25
  def parse_args(args)
26
26
  text = args[0] || "Question"
27
- {:text => text, :short_text => text, :data_export_identifier => Surveyor.to_normalized_string(text)}.merge(args[1] || {})
27
+ {:text => text, :short_text => text, :data_export_identifier => Surveyor::Common.to_normalized_string(text)}.merge(args[1] || {})
28
28
  end
29
29
 
30
30
  def correct_answer=(a)
@@ -10,7 +10,7 @@ module SurveyParser
10
10
 
11
11
  def parse_args(args)
12
12
  title = args[0]
13
- {:title => title, :access_code => Surveyor.to_normalized_string(title)}.merge(args[1] || {})
13
+ {:title => title, :access_code => Surveyor::Common.to_normalized_string(title)}.merge(args[1] || {})
14
14
  end
15
15
 
16
16
  def find_question_by_reference(ref_id)
@@ -9,7 +9,7 @@ module SurveyParser
9
9
 
10
10
  def parse_args(args)
11
11
  title = args[0]
12
- {:title => title, :data_export_identifier => Surveyor.to_normalized_string(title)}.merge(args[1] || {})
12
+ {:title => title, :data_export_identifier => Surveyor::Common.to_normalized_string(title)}.merge(args[1] || {})
13
13
  end
14
14
 
15
15
  # Used to find questions for dependency linking
@@ -38,7 +38,7 @@ describe Surveyor do
38
38
  "you_would_say_your_health" ]
39
39
 
40
40
  strings.each_with_index do |s, i|
41
- Surveyor.to_normalized_string(s).should == codes[i]
41
+ Surveyor::Common.to_normalized_string(s).should == codes[i]
42
42
  end
43
43
  end
44
44
  end
data/surveyor.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{surveyor}
8
- s.version = "0.14.2"
8
+ s.version = "0.14.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Chamberlain", "Mark Yoon"]
@@ -145,7 +145,6 @@ Gem::Specification.new do |s|
145
145
  "lib/surveyor.rb",
146
146
  "lib/surveyor/acts_as_response.rb",
147
147
  "lib/surveyor/common.rb",
148
- "lib/surveyor/config.rb",
149
148
  "lib/surveyor/surveyor_controller_methods.rb",
150
149
  "lib/tasks/surveyor_tasks.rake",
151
150
  "lib/xml_formatter.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surveyor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 14
9
- - 2
10
- version: 0.14.2
9
+ - 3
10
+ version: 0.14.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Chamberlain
@@ -186,7 +186,6 @@ files:
186
186
  - lib/surveyor.rb
187
187
  - lib/surveyor/acts_as_response.rb
188
188
  - lib/surveyor/common.rb
189
- - lib/surveyor/config.rb
190
189
  - lib/surveyor/surveyor_controller_methods.rb
191
190
  - lib/tasks/surveyor_tasks.rake
192
191
  - lib/xml_formatter.rb
@@ -1,45 +0,0 @@
1
- module Surveyor
2
- #
3
- # The Surveyor::Config object emulates a hash with simple bracket methods
4
- # which allow you to get and set values in the configuration table:
5
- #
6
- # Surveyor::Config['setting.name'] = 'value'
7
- # Surveyor::Config['setting.name'] #=> "value"
8
- #
9
- # Currently, there is not a way to edit configuration through the admin
10
- # system so it must be done manually. The console script is probably the
11
- # easiest way to this:
12
- #
13
- # % script/console production
14
- # Loading production environment.
15
- # >> Surveyor::Config['setting.name'] = 'value'
16
- # => "value"
17
- # >>
18
- #
19
- # Surveyor currently uses the following settings:
20
- #
21
- # defaults.title :: the title of the survey system
22
- # defaults.layout :: the layout used by the survey system
23
-
24
- class Config
25
- @@config_hash = {}
26
-
27
- class << self
28
- def [](key)
29
- @@config_hash[key]
30
- end
31
-
32
- def []=(key, value)
33
- @@config_hash[key] = value
34
- end
35
-
36
- def to_hash
37
- @@config_hash
38
- end
39
-
40
- def run
41
- yield self if block_given?
42
- end
43
- end
44
- end
45
- end