Skip to content

Commit

Permalink
Clarify AMS dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bf4 committed Aug 28, 2015
1 parent 39d6dab commit e7b4059
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
15 changes: 8 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in active_model_serializers.gemspec
gemspec

gem "minitest"
version = ENV['RAILS_VERSION'] || '4.2'

version = ENV["RAILS_VERSION"] || "4.2"

if version == "master"
gem "rails", github: "rails/rails"
if version == 'master'
gem 'rails', github: 'rails/rails'

# ugh https://github.com/rails/rails/issues/16063#issuecomment-48090125
gem "arel", github: "rails/arel"
gem 'arel', github: 'rails/arel'
else
gem "rails", "~> #{version}.0"
gem_version = "~> #{version}.0"
gem 'activemodel', gem_version
gem 'actionpack', gem_version
gem 'railties', gem_version
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
49 changes: 35 additions & 14 deletions active_model_serializers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,47 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'active_model/serializer/version'

Gem::Specification.new do |spec|
spec.name = "active_model_serializers"
spec.name = 'active_model_serializers'
spec.version = ActiveModel::Serializer::VERSION
spec.authors = ["Steve Klabnik"]
spec.email = ["[email protected]"]
spec.platform = Gem::Platform::RUBY
spec.authors = ['Steve Klabnik']
spec.email = ['[email protected]']
spec.summary = %q{Conventions-based JSON generation for Rails.}
spec.description = %q{ActiveModel::Serializers allows you to generate your JSON in an object-oriented and convention-driven manner.}
spec.homepage = "https://github.com/rails-api/active_model_serializers"
spec.license = "MIT"
spec.homepage = 'https://github.com/rails-api/active_model_serializers'
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_dependency "activemodel", ">= 4.0"
spec.required_ruby_version = '>= 1.9.3'

spec.add_development_dependency "rails", ">= 4.0"
spec.add_development_dependency "bundler", "~> 1.6"
spec.add_development_dependency "timecop", ">= 0.7"
spec.add_development_dependency "rake"
spec.add_development_dependency "kaminari"
spec.add_development_dependency "will_paginate"
rails_versions = '>= 4.0'
spec.add_runtime_dependency 'activemodel', rails_versions
# 'activesupport', rails_versions
# 'builder'

spec.add_runtime_dependency 'actionpack', rails_versions
# 'activesupport', rails_versions
# 'rack'
# 'rack-test', '~> 0.6.2'

spec.add_runtime_dependency 'railties', rails_versions
# 'activesupport', rails_versions
# 'actionpack', rails_versions
# 'rake', '>= 0.8.7'

# 'activesupport', rails_versions
# 'i18n,
# 'tzinfo'
# 'minitest'
# 'thread_safe'

# Soft dependency for pagination
spec.add_development_dependency 'kaminari'
spec.add_development_dependency 'will_paginate'

spec.add_development_dependency 'bundler', '~> 1.6'
spec.add_development_dependency 'timecop', '>= 0.7'
end
24 changes: 11 additions & 13 deletions lib/active_model_serializers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ def silence_warnings
end

end

require 'active_model'
require 'active_model/serializer/version'
require 'action_controller'

require 'active_model/serializer'
require 'active_model/serializable_resource'
require 'active_model/serializer/version'

begin
require 'active_model/serializer/railtie'
require 'action_controller'
require 'action_controller/serialization'

ActiveSupport.on_load(:action_controller) do
include ::ActionController::Serialization
ActionDispatch::Reloader.to_prepare do
ActiveModel::Serializer.serializers_cache.clear
end
require 'action_controller/serialization'
ActiveSupport.on_load(:action_controller) do
include ::ActionController::Serialization
ActionDispatch::Reloader.to_prepare do
ActiveModel::Serializer.serializers_cache.clear
end
rescue LoadError
# rails not installed, continuing
end

require 'active_model/serializer/railtie'

0 comments on commit e7b4059

Please sign in to comment.