surveyor 0.14.3 → 0.14.4

Sign up to get free protection for your applications and to get access to all the features.
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/rails generate surveyor:custom
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.3
1
+ 0.14.4
@@ -1,15 +1,15 @@
1
1
  class SurveySectionSweeper < ActionController::Caching::Sweeper
2
- observer SurveySection
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
- # Init hook code here
1
+ require 'surveyor'
data/lib/surveyor.rb CHANGED
@@ -1,3 +1,6 @@
1
- require File.dirname(__FILE__) + '/surveyor/acts_as_response'
2
- module Surveyor
3
- end
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}
@@ -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
- 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
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
- 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("_")
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.3"
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-24}
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: 33
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 14
9
- - 3
10
- version: 0.14.3
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-24 00:00:00 -05:00
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