Skip to content

Commit

Permalink
Remove safe_yaml.
Browse files Browse the repository at this point in the history
I don't think it's really this gem's job, but besides that, I was getting a failure
when starting zeus, so I just made it optional.

This one a fork of v0.6.7 with a commit on top of it:

https://github.com/swipesense/rails_admin/commits/0.6.7-eager_loading

Here's the stacktrace:

$ zeus rake

     ~/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych/parser.rb:33:in `<class:Parser>': superclass mismatch for class Mark (TypeError)
from ~/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych/parser.rb:32:in `<module:Psych>'
from ~/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych/parser.rb:1:in `<top (required)>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:7:in `<top (required)>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/safe_yaml-1.0.4/lib/safe_yaml/psych_handler.rb:1:in `<top (required)>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/safe_yaml-1.0.4/lib/safe_yaml/load.rb:130:in `<module:SafeYAML>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/safe_yaml-1.0.4/lib/safe_yaml/load.rb:26:in `<top (required)>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/safe_yaml-1.0.4/lib/safe_yaml.rb:1:in `<top (required)>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/bundler/gems/rails_admin-975bb5075824/lib/rails_admin/engine.rb:10:in `<top (required)>'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from ~/projects/rails_server/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from ~/projects/rails_server/bundle/ruby/2.2.0/bundler/gems/rails_admin-975bb5075824/lib/rails_admin.rb:1:in `<top (required)>'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from ~/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus/rails.rb:97:in `default_bundle'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus.rb:200:in `run_action'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus.rb:74:in `block (2 levels) in boot_steps'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus/load_tracking.rb:7:in `features_loaded_by'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus.rb:73:in `block in boot_steps'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus.rb:56:in `catch'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus.rb:56:in `boot_steps'
from ~/.rvm/gems/ruby-2.2.2/gems/zeus-0.15.4/lib/zeus.rb:48:in `go'
from -e:1:in `<main>'
  • Loading branch information
bf4 authored and Benjamin Fleischer committed Oct 21, 2015
1 parent 60c277b commit e78eaf3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rails_admin/config/fields/types/serialized.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Serialized < RailsAdmin::Config::Fields::Types::Text
end

def parse_value(value)
value.present? ? (SafeYAML.load(value) || nil) : nil
value.present? ? (RailsAdmin::SafeYAML.load(value) || nil) : nil
end

def parse_input(params)
Expand Down
21 changes: 20 additions & 1 deletion lib/rails_admin/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,28 @@
require 'rails'
require 'rails_admin'
require 'remotipart'
require 'safe_yaml/load'
require 'yaml'

module RailsAdmin
# Backwards-compatible RailsAdmin::SafeYAML when SafeYAML isn't available
begin
require 'safe_yaml/load'
rescue LoadError
if YAML.respond_to?(:safe_load)
SafeYAML = Module.new do
def self.load(yaml)
YAML.safe_load(yaml)
end
end
else
warn "Safe-loading of YAML is not available. Please install 'safe_yaml' or install Psych 2.0+"
SafeYAML = Module.new do
def self.load(yaml)
YAML.load(yaml)
end
end
end
end
class Engine < Rails::Engine
isolate_namespace RailsAdmin

Expand Down
1 change: 0 additions & 1 deletion rails_admin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
spec.add_dependency 'rack-pjax', '~> 0.7'
spec.add_dependency 'rails', '~> 4.0'
spec.add_dependency 'remotipart', '~> 1.0'
spec.add_dependency 'safe_yaml', '~> 1.0'
spec.add_dependency 'sass-rails', ['>= 4.0', '< 6']
spec.add_development_dependency 'bundler', '~> 1.0'
spec.authors = ['Erik Michaels-Ober', 'Bogdan Gaza', 'Petteri Kaapa', 'Benoit Benezech', 'Mitsuhiro Shibuya']
Expand Down

0 comments on commit e78eaf3

Please sign in to comment.