Permalink
Browse files

Upgrade ActiveSupport Version

 * Use bundler for gem deployment (rake build)
 * Use bundler for dependency management
 * Remove deprecated write_inheritable_attribute, and class_inheritable_attribute
 * Use Rspec 2
 * Remove Jeweler and associated files (Manifest.txt, PostInstall.txt, VERSION)
 * Remove script directory
 * Remove tasks directory
 * Remove rspec.opts in favor of user's .rspec configs.
  • Loading branch information...
1 parent 4872500 commit 37cca7e5cd602f6b0ab926d626df67f5b45abd27 @jakeonrails jakeonrails committed Feb 11, 2012
Showing with 60 additions and 167 deletions.
  1. +6 −0 .gitignore
  2. +4 −0 Gemfile
  3. +6 −0 History.txt
  4. +0 −13 Manifest.txt
  5. +0 −7 PostInstall.txt
  6. +1 −23 Rakefile
  7. +0 −1 VERSION
  8. +21 −51 hash_mapper.gemspec
  9. +7 −4 lib/hash_mapper.rb
  10. +3 −0 lib/hash_mapper/version.rb
  11. +0 −10 script/console
  12. +0 −14 script/destroy
  13. +0 −14 script/generate
  14. +2 −2 spec/hash_mapper_spec.rb
  15. +0 −1 spec/spec.opts
  16. +10 −6 spec/spec_helper.rb
  17. +0 −21 tasks/rspec.rake
View
@@ -0,0 +1,6 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
+.idea
+.rvmrc
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in hash_mapper.gemspec
+gemspec
View
@@ -1,3 +1,9 @@
+== 0.1.0 2012-02-10
+
+* 1 enhancement:
+ * Update version of activesupport
+ * Replace usage of deprecated activesupport methods
+
== 0.0.1 2009-01-29
* 1 major enhancement:
View
@@ -1,13 +0,0 @@
-History.txt
-Manifest.txt
-PostInstall.txt
-README.rdoc
-Rakefile
-lib/hash_mapper.rb
-script/console
-script/destroy
-script/generate
-spec/hash_mapper_spec.rb
-spec/spec.opts
-spec/spec_helper.rb
-tasks/rspec.rake
View
@@ -1,7 +0,0 @@
-
-For more information on hash_mapper, see http://hash_mapper.rubyforge.org
-
-NOTE: Change this information in PostInstall.txt
-You can also delete it if you don't want it.
-
-
View
@@ -1,23 +1 @@
-require 'rubygems'
-require File.dirname(__FILE__) + '/lib/hash_mapper'
-
-Dir['tasks/**/*.rake'].each { |t| load t }
-
-# TODO - want other tests/tasks run by default? Add them to the list
-task :default => [:spec]
-
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gemspec|
- gemspec.name = "hash_mapper"
- gemspec.summary = "Maps values from hashes with different structures and/or key names. Ideal for normalizing arbitrary data to be consumed by your applications, or to prepare your data for different display formats (ie. json)"
- gemspec.description = "Tiny module that allows you to easily adapt from one hash structure to another with a simple declarative DSL."
- gemspec.email = "ismaelct@gmail.com"
- gemspec.homepage = "http://github.com/ismasan/hash_mapper"
- gemspec.add_dependency('active_support', '>= 3.0.0.beta')
- gemspec.authors = ["Ismael Celis"]
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
-end
+require "bundler/gem_tasks"
View
@@ -1 +0,0 @@
-0.0.10
View
@@ -1,58 +1,28 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
+$:.push File.expand_path('../lib', __FILE__)
+require 'hash_mapper/version'
Gem::Specification.new do |s|
- s.name = %q{hash_mapper}
- s.version = "0.0.10"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Ismael Celis"]
- s.date = %q{2010-09-21}
+ s.name = %q{hash_mapper}
+ s.version = HashMapper::VERSION
+ s.authors = ['Ismael Celis']
s.description = %q{Tiny module that allows you to easily adapt from one hash structure to another with a simple declarative DSL.}
- s.email = %q{ismaelct@gmail.com}
- s.extra_rdoc_files = [
- "README.rdoc"
- ]
- s.files = [
- "History.txt",
- "Manifest.txt",
- "PostInstall.txt",
- "README.rdoc",
- "Rakefile",
- "VERSION",
- "hash_mapper.gemspec",
- "lib/hash_mapper.rb",
- "script/console",
- "script/destroy",
- "script/generate",
- "spec/hash_mapper_spec.rb",
- "spec/spec.opts",
- "spec/spec_helper.rb",
- "tasks/rspec.rake"
- ]
- s.homepage = %q{http://github.com/ismasan/hash_mapper}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{Maps values from hashes with different structures and/or key names. Ideal for normalizing arbitrary data to be consumed by your applications, or to prepare your data for different display formats (ie. json)}
- s.test_files = [
- "spec/hash_mapper_spec.rb",
- "spec/spec_helper.rb"
- ]
+ s.date = %q{2010-09-21}
+ s.email = %q{ismaelct@gmail.com}
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.extra_rdoc_files = ['README.rdoc']
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency("activesupport", "~> 3.0")
- else
- s.add_dependency("activesupport", "~> 3.0")
- end
- else
- s.add_dependency("activesupport", "~> 3.0")
- end
-end
+ s.files = `git ls-files`.split("\n")
+ s.homepage = %q{http://github.com/ismasan/hash_mapper}
+ s.rdoc_options = ['--charset=UTF-8']
+ s.require_paths = ['lib']
+ s.summary = %q{Maps input hashes to a normalized format}
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ['lib']
+ # specify any dependencies here; for example:
+ s.add_development_dependency 'rspec'
+ s.add_development_dependency 'rake'
+ s.add_runtime_dependency('activesupport', '~> 3.2')
+end
View
@@ -1,11 +1,13 @@
+require 'hash_mapper/version'
+
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
def require_active_support
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/object/duplicable'
- require 'active_support/core_ext/class/inheritable_attributes'
+ require 'active_support/core_ext/class/attribute'
end
begin
@@ -42,12 +44,13 @@ module HashMapper
#
def self.extended(base)
base.class_eval do
- write_inheritable_attribute :maps, []
- class_inheritable_accessor :maps
+ class_attribute :maps
+ self.maps = []
end
end
def map(from, to, using=nil, &filter)
+ self.maps = self.maps.dup
self.maps << Map.new(from, to, using)
to.filter = filter if block_given? # Useful if just one block given
end
@@ -97,7 +100,7 @@ def perform_hash_mapping(a_hash, meth)
before_filter = instance_eval "@before_#{meth}"
a_hash = before_filter.call(a_hash, output) if before_filter
# Do the mapping
- maps.each do |m|
+ self.maps.each do |m|
m.process_into(output, a_hash, meth)
end
# After filter
@@ -0,0 +1,3 @@
+module HashMapper
+ VERSION = "0.1.0"
+end
View
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-# File: script/console
-irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
-
-libs = " -r irb/completion"
-# Perhaps use a console_lib to store any extra methods I may want available in the cosole
-# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
-libs << " -r #{File.dirname(__FILE__) + '/../lib/hash_mapper.rb'}"
-puts "Loading hash_mapper gem"
-exec "#{irb} #{libs} --simple-prompt"
View
@@ -1,14 +0,0 @@
-#!/usr/bin/env ruby
-APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
-begin
- require 'rubigen'
-rescue LoadError
- require 'rubygems'
- require 'rubigen'
-end
-require 'rubigen/scripts/destroy'
-
-ARGV.shift if ['--help', '-h'].include?(ARGV[0])
-RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
-RubiGen::Scripts::Destroy.new.run(ARGV)
View
@@ -1,14 +0,0 @@
-#!/usr/bin/env ruby
-APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
-begin
- require 'rubigen'
-rescue LoadError
- require 'rubygems'
- require 'rubigen'
-end
-require 'rubigen/scripts/generate'
-
-ARGV.shift if ['--help', '-h'].include?(ARGV[0])
-RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
-RubiGen::Scripts::Generate.new.run(ARGV)
@@ -1,11 +1,11 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper.rb'
class OneLevel
extend HashMapper
map from('/name'), to('/nombre')
end
-describe 'mapping a hash wit one level' do
+describe 'mapping a hash with one level' do
before :each do
@from = {:name => 'ismael'}
View
@@ -1 +0,0 @@
---colour
View
@@ -1,9 +1,13 @@
-begin
- require 'spec'
-rescue LoadError
- require 'rubygems'
- gem 'rspec'
- require 'spec'
+# This file was generated by the `rspec --init` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# Require this file using `require "spec_helper.rb"` to ensure that it is only
+# loaded once.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ config.treat_symbols_as_metadata_keys_with_true_values = true
+ config.run_all_when_everything_filtered = true
+ config.filter_run :focus
end
$:.unshift(File.dirname(__FILE__) + '/../lib')
View
@@ -1,21 +0,0 @@
-begin
- require 'spec'
-rescue LoadError
- require 'rubygems'
- require 'spec'
-end
-begin
- require 'spec/rake/spectask'
-rescue LoadError
- puts <<-EOS
-To use rspec for testing you must install rspec gem:
- gem install rspec
-EOS
- exit(0)
-end
-
-desc "Run the specs under spec/models"
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = ['--options', "spec/spec.opts"]
- t.spec_files = FileList['spec/**/*_spec.rb']
-end

0 comments on commit 37cca7e

Please sign in to comment.