surveyor 0.14.3 → 0.14.4
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 +7 -1
- data/VERSION +1 -1
- data/app/models/survey_section_sweeper.rb +5 -5
- data/init.rb +1 -1
- data/lib/surveyor.rb +6 -3
- data/lib/surveyor/common.rb +21 -16
- data/surveyor.gemspec +2 -3
- metadata +4 -5
- data/lib/xml_formatter.rb +0 -12
data/README.md
CHANGED
@@ -100,7 +100,7 @@ DSL question maps to the resulting rendered view of the question.
|
|
100
100
|
|
101
101
|
Surveyor's controller, models, and views may be customized via classes in your app/models, app/helpers and app/controllers directories. To generate a sample custom controller and layout, run:
|
102
102
|
|
103
|
-
script/
|
103
|
+
script/generate extend_surveyor
|
104
104
|
|
105
105
|
and check out surveys/README\_FOR\_CUSTOM\_SURVEYOR.md
|
106
106
|
|
@@ -114,6 +114,12 @@ 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.4
|
118
|
+
|
119
|
+
* explicity require surveyor models and helper. update sweeper syntax. closes #77
|
120
|
+
* cleanup and requires
|
121
|
+
* fixing instructions for extending surveyor. closes #76
|
122
|
+
|
117
123
|
0.14.3
|
118
124
|
|
119
125
|
* remove manual numbering until it works. refactoring to use common methods.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.4
|
@@ -1,15 +1,15 @@
|
|
1
1
|
class SurveySectionSweeper < ActionController::Caching::Sweeper
|
2
|
-
|
3
|
-
|
2
|
+
observe :survey_section
|
3
|
+
|
4
4
|
def after_save(section)
|
5
5
|
expire_cache(section)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def after_destroy(section)
|
9
9
|
expire_cache(section)
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def expire_cache(section)
|
13
13
|
expire_fregment "section_#{section.id}"
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
data/init.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require 'surveyor'
|
data/lib/surveyor.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
1
|
+
require 'surveyor/common'
|
2
|
+
require 'surveyor/acts_as_response'
|
3
|
+
|
4
|
+
|
5
|
+
Dir.glob(File.join(File.dirname(__FILE__),'..','app','models','*.rb')).each{|f| require f}
|
6
|
+
Dir.glob(File.join(File.dirname(__FILE__),'..','app','helpers','*.rb')).each{|f| require f}
|
data/lib/surveyor/common.rb
CHANGED
@@ -1,24 +1,29 @@
|
|
1
1
|
module Surveyor
|
2
2
|
class Common
|
3
3
|
RAND_CHARS = [('a'..'z'), ('A'..'Z'), (0..9)].map{|r| r.to_a}.flatten.to_s
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def make_tiny_code(len = 10)
|
7
|
+
if RUBY_VERSION < "1.8.7"
|
8
|
+
(1..len).to_a.map{|i| RAND_CHARS[rand(RAND_CHARS.size), 1] }.to_s
|
9
|
+
else
|
10
|
+
len.times.map{|i| RAND_CHARS[rand(RAND_CHARS.size), 1] }.to_s
|
11
|
+
end
|
10
12
|
end
|
11
|
-
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
def to_normalized_string(text)
|
15
|
+
words_to_omit = %w(a be but has have in is it of on or the to when)
|
16
|
+
col_text = text.gsub(/(<[^>]*>)|\n|\t/s, ' ') # Remove html tags
|
17
|
+
col_text.downcase! # Remove capitalization
|
18
|
+
col_text.gsub!(/\"|\'/, '') # Remove potential problem characters
|
19
|
+
col_text.gsub!(/\(.*?\)/,'') # Remove text inside parens
|
20
|
+
col_text.gsub!(/\W/, ' ') # Remove all other non-word characters
|
21
|
+
cols = (col_text.split(' ') - words_to_omit)
|
22
|
+
(cols.size > 5 ? cols[-5..-1] : cols).join("_")
|
23
|
+
end
|
24
|
+
|
25
|
+
alias :normalize :to_normalized_string
|
26
|
+
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
data/surveyor.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{surveyor}
|
8
|
-
s.version = "0.14.
|
8
|
+
s.version = "0.14.4"
|
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"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-31}
|
13
13
|
s.email = %q{yoon@northwestern.edu}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.md"
|
@@ -147,7 +147,6 @@ Gem::Specification.new do |s|
|
|
147
147
|
"lib/surveyor/common.rb",
|
148
148
|
"lib/surveyor/surveyor_controller_methods.rb",
|
149
149
|
"lib/tasks/surveyor_tasks.rake",
|
150
|
-
"lib/xml_formatter.rb",
|
151
150
|
"rails/init.rb",
|
152
151
|
"script/surveyor/answer.rb",
|
153
152
|
"script/surveyor/base.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:
|
4
|
+
hash: 47
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 14
|
9
|
-
-
|
10
|
-
version: 0.14.
|
9
|
+
- 4
|
10
|
+
version: 0.14.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Chamberlain
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-08-
|
19
|
+
date: 2010-08-31 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -188,7 +188,6 @@ files:
|
|
188
188
|
- lib/surveyor/common.rb
|
189
189
|
- lib/surveyor/surveyor_controller_methods.rb
|
190
190
|
- lib/tasks/surveyor_tasks.rake
|
191
|
-
- lib/xml_formatter.rb
|
192
191
|
- rails/init.rb
|
193
192
|
- script/surveyor/answer.rb
|
194
193
|
- script/surveyor/base.rb
|
data/lib/xml_formatter.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module XmlFormatter
|
2
|
-
def to_xml(options = {})
|
3
|
-
options[:indent] ||= 2
|
4
|
-
xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
|
5
|
-
xml.instruct! unless options[:skip_instruct]
|
6
|
-
xml.tag!(self.class.name.downcase.to_sym, self.attributes) do
|
7
|
-
self.class.reflect_on_all_associations.to_a.each do |assoc|
|
8
|
-
xml.tag!(assoc.name)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|