morph 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG +2 -0
  2. data/lib/morph.rb +11 -9
  3. data/morph.gemspec +1 -1
  4. metadata +3 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.3.1. only show fastercsv install message if Morph.from_csv() called
2
+
1
3
  v0.3.0. modifications for ruby 1.9.2 compatibility
2
4
 
3
5
  v0.2.9. added from_csv(); require fastercsv; added morph_attributes() class method
data/lib/morph.rb CHANGED
@@ -1,12 +1,5 @@
1
1
  if RUBY_VERSION >= "1.9"
2
2
  require 'csv'
3
- else
4
- begin
5
- require 'fastercsv'
6
- rescue LoadError
7
- puts "\nYou need to install the fastercsv gem to use Morph.from_csv with Ruby 1.8"
8
- puts " sudo gem install fastercsv\n"
9
- end
10
3
  end
11
4
  begin
12
5
  # require 'active_support'
@@ -25,7 +18,7 @@ rescue Exception => e
25
18
  end
26
19
 
27
20
  module Morph
28
- VERSION = "0.3.0"
21
+ VERSION = "0.3.1"
29
22
 
30
23
  class << self
31
24
  def generate_migrations object, options={}
@@ -38,7 +31,16 @@ module Morph
38
31
 
39
32
  def from_csv csv, class_name, namespace=Morph
40
33
  objects = []
41
- csv_utility = (RUBY_VERSION >= "1.9") ? CSV : FasterCSV
34
+ if !(RUBY_VERSION >= "1.9")
35
+ begin
36
+ require 'fastercsv'
37
+ rescue LoadError
38
+ puts "\nYou need to install the fastercsv gem to use Morph.from_csv() with Ruby 1.8"
39
+ puts " gem install fastercsv\n"
40
+ end
41
+ end
42
+
43
+ csv_utility = (RUBY_VERSION >= "1.9") ? CSV : 'FasterCSV'.constantize
42
44
  csv_utility.parse(csv, { :headers => true }) do |row|
43
45
  object = object_from_name class_name, namespace
44
46
  row.each do |key, value|
data/morph.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{morph}
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rob McKinnon"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rob McKinnon