Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
- 2.5.0
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ source "https://rubygems.org"

gemspec

gem "rdoc"
gem 'rdoc', '~> 5.1'

group :test do
gem 'sqlite3'
end
gem 'sqlite3', '1.3.13'
end
193 changes: 110 additions & 83 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,101 +1,128 @@
PATH
remote: .
specs:
survey (0.1)
rails (>= 3.2.6, < 5)
railties (>= 3.2.6, < 5)
survey (1.0.0)
rails (~> 5.0.7)
railties (~> 5.0.7)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.2)
actionpack (= 4.0.2)
mail (~> 2.5.4)
actionpack (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
actioncable (5.0.7.2)
actionpack (= 5.0.7.2)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7.2)
actionview (= 5.0.7.2)
activesupport (= 5.0.7.2)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7.2)
activesupport (= 5.0.7.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
activerecord (4.0.2)
activemodel (= 4.0.2)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.2)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.1)
atomic (1.1.14)
builder (3.1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7.2)
activesupport (= 5.0.7.2)
globalid (>= 0.3.6)
activemodel (5.0.7.2)
activesupport (= 5.0.7.2)
activerecord (5.0.7.2)
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (7.1.4)
builder (3.2.4)
concurrent-ruby (1.1.6)
crass (1.0.6)
erubis (2.7.0)
faker (1.1.2)
i18n (~> 0.5)
hike (1.2.3)
i18n (0.6.9)
json (1.7.6)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
mime-types (1.25.1)
minitest (4.7.5)
mocha (0.13.2)
metaclass (~> 0.0.1)
multi_json (1.8.2)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
faker (1.9.6)
i18n (>= 0.7)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (1.0.0)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.0)
mocha (1.11.2)
nio4r (2.5.2)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
rack (2.2.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.0.2)
actionmailer (= 4.0.2)
actionpack (= 4.0.2)
activerecord (= 4.0.2)
activesupport (= 4.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
rails (5.0.7.2)
actioncable (= 5.0.7.2)
actionmailer (= 5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
activemodel (= 5.0.7.2)
activerecord (= 5.0.7.2)
activesupport (= 5.0.7.2)
bundler (>= 1.3.0)
railties (= 5.0.7.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.0.7.2)
actionpack (= 5.0.7.2)
activesupport (= 5.0.7.2)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.7)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
rake (13.0.1)
rdoc (5.1.0)
sprockets (4.0.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
thor (1.0.1)
thread_safe (0.3.6)
tzinfo (1.2.6)
thread_safe (~> 0.1)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)

PLATFORMS
ruby

DEPENDENCIES
faker
mocha
rake
rdoc
sqlite3
faker (~> 1.8, >= 1.8.7)
mocha (~> 1.11)
rake (~> 13.0, >= 13.0.1)
rdoc (~> 5.1)
sqlite3 (= 1.3.13)
survey!

BUNDLED WITH
2.1.4
2 changes: 1 addition & 1 deletion lib/generators/templates/attempts_plain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def normalize_data!(hash)
end

def attempt_params
rails4? ? params_whitelist : params[:survey_attempt]
params_whitelist
end

def params_whitelist
Expand Down
3 changes: 1 addition & 2 deletions lib/generators/templates/survey_plain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ def load_survey
end

def survey_params
rails4? ? params_whitelist : params[:survey_survey]
params_whitelist
end

def params_whitelist
params.require(:survey_survey).permit(Survey::Survey::AccessibleAttributes)
end

end
12 changes: 1 addition & 11 deletions lib/survey.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
module ::Kernel
def rails4?
return defined?(Rails) && Rails::VERSION::MAJOR == 4
end

def in_rails_3(&block)
yield if block_given? unless rails4?
end
end

require 'survey/engine'
require 'survey/version'
require 'survey/active_record'

ActiveRecord::Base.send(:include, Survey::ActiveRecord)
ActiveRecord::Base.send(:include, Survey::ActiveRecord)
11 changes: 1 addition & 10 deletions lib/survey/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,9 @@ def has_surveys
end
end


def acceptable_attributes(*args)

self.const_set('AccessibleAttributes', args + [:id, :_destroy])

in_rails_3 do
if defined?(self.respond_to?(:attr_accessible))
attr_accessible(*self.const_get('AccessibleAttributes').map { |k| k.is_a?(Hash) ? k.keys.first : k })
end
end

end
end
end
end
end
4 changes: 2 additions & 2 deletions lib/survey/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Survey
VERSION = "0.1"
end
VERSION = "1.0.0"
end
19 changes: 12 additions & 7 deletions survey.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ require "survey/version"
Gem::Specification.new do |s|
s.name = "survey"
s.version = Survey::VERSION
s.authors = %Q{Runtime Revolution}

s.summary = %Q{Survey is a user oriented tool that brings surveys into Rails applications.}
s.description = %Q{A rails gem to enable surveys in your application as easy as possible}
s.files = Dir["{app,lib,config}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.md"]
s.authors = %Q{Runtime Revolution}
s.homepage = 'https://github.com/runtimerevolution/survey'
s.license = 'MIT'
s.required_ruby_version = Gem::Requirement.new('>= 2.5.0')

s.files = Dir["{app,lib,config}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.md"]
s.require_paths = %w(lib)

s.add_dependency("rails", [">= 3.2.6", "< 5"])
s.add_dependency("railties", ">= 3.2.6", "< 5")
s.add_development_dependency("mocha")
s.add_development_dependency("faker")
s.add_development_dependency("rake")
s.add_dependency("rails", ["~> 5.0.7"])
s.add_dependency("railties", "~> 5.0.7")
s.add_development_dependency("mocha", ['~> 1.11'])
s.add_development_dependency("faker", ['~> 1.8', '>= 1.8.7'])
s.add_development_dependency("rake", ['~> 13.0', '>= 13.0.1'])
end
22 changes: 9 additions & 13 deletions test/dummy/Gemfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
source 'https://rubygems.org'
ruby "1.9.3"
ruby "2.5.0"

gem 'rails', '3.2.16'
gem 'rails', '5.0.7'
gem 'therubyracer'
gem 'execjs'

gem 'sqlite3', '1.3.13'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'

group :development, :test do
gem 'pry-rails'
gem 'faker'
gem 'jquery-rails'
gem 'faker', '~> 1.8', '>= 1.8.7'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
end

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'sass-rails', '~> 5.0', '>= 5.0.7'
gem 'coffee-rails', '~> 4.2', '>= 4.2.2'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'


Loading