Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

turning into gem

  • Loading branch information...
commit 5cc22930b2025698ebbb32bb67931ab2e25ddd8d 1 parent 20e3f72
Ryan Bates authored February 08, 2010
3  CHANGELOG.rdoc
Source Rendered
... ...
@@ -0,0 +1,3 @@
  1
+0.1.0 (Feb 8, 2010)
  2
+
  3
+* initial release
8  README.rdoc
Source Rendered
... ...
@@ -1,5 +1,7 @@
1 1
 = Importex
2 2
 
  3
+RDocs[http://rdoc.info/projects/ryanb/importex] | Metrics[http://getcaliper.com/caliper/project?repo=git%3A%2F%2Fgithub.com%2Fryanb%2Fimportex.git] | Tests[http://runcoderun.com/ryanb/importex]
  4
+
3 5
 This Ruby gem helps import an Excel document into a database or some other format. Just create a class defining the columns and pass in a path to an "xls" file. It will automatically format the columns into specified Ruby objects and raise errors on bad data.
4 6
 
5 7
 This is extracted from an internal set of administration scripts used for importing products into an e-commerce application. Rather than going through a web interface or directly into an SQL database, it is easiest to fill out an Excel spreadsheet with a row for each product, and filter that through a Ruby script.
@@ -9,14 +11,10 @@ Note: This library has some hacks and is not intended to be a full featured, pro
9 11
 
10 12
 == Installation
11 13
 
12  
-It is not yet available as a gem, but will be soon.
  14
+You can install through a gem.
13 15
 
14 16
   gem install importex
15 17
 
16  
-In the meantime you'll have to include the lib files directly.
17  
-
18  
-Note: This relies on the parseexcel gem so you will need to have that installed as well.
19  
-
20 18
 
21 19
 == Usage
22 20
 
3  Rakefile
... ...
@@ -1,6 +1,5 @@
1 1
 require 'rubygems'
2 2
 require 'rake'
3  
-require 'echoe'
4 3
 require 'spec/rake/spectask'
5 4
 
6 5
 spec_files = Rake::FileList["spec/**/*_spec.rb"]
@@ -10,3 +9,5 @@ Spec::Rake::SpecTask.new do |t|
10 9
   t.spec_files = spec_files
11 10
   t.spec_opts = ["-c"]
12 11
 end
  12
+
  13
+task :default => :spec
24  importex.gemspec
... ...
@@ -0,0 +1,24 @@
  1
+Gem::Specification.new do |s|
  2
+  s.name = "importex"
  3
+  s.summary = "Import an Excel document with Ruby."
  4
+  s.description = "Import an Excel document by creating a Ruby class and passing in an 'xls' file. It will automatically format the columns into specified Ruby objects and raise errors on bad data."
  5
+  s.homepage = "http://github.com/ryanb/importex"
  6
+  
  7
+  s.version = "0.1.0"
  8
+  s.date = "2010-02-08"
  9
+  
  10
+  s.authors = ["Ryan Bates"]
  11
+  s.email = "ryan@railscasts.com"
  12
+  
  13
+  s.require_paths = ["lib"]
  14
+  s.files = Dir["lib/**/*"] + Dir["spec/**/*"] + ["LICENSE", "README.rdoc", "Rakefile", "CHANGELOG.rdoc"]
  15
+  s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "LICENSE"]
  16
+  
  17
+  s.has_rdoc = true
  18
+  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Importex", "--main", "README.rdoc"]
  19
+  
  20
+  s.add_dependency("parseexcel", ">= 0.5.2")
  21
+  
  22
+  s.rubygems_version = "1.3.4"
  23
+  s.required_rubygems_version = Gem::Requirement.new(">= 1.2")
  24
+end
1  lib/importex.rb
... ...
@@ -1,4 +1,3 @@
1  
-require 'rubygems'
2 1
 require 'parseexcel'
3 2
 
4 3
 require File.expand_path(File.dirname(__FILE__) + '/importex/base')
6  lib/importex/ruby_additions.rb
@@ -28,12 +28,6 @@ def self.importex_value(str)
28 28
   end
29 29
 end
30 30
 
31  
-class Date
32  
-  def self.importex_value(str)
33  
-    !["", "f", "F", "n", "N", "0"].include?(str)
34  
-  end
35  
-end
36  
-
37 31
 class Time
38 32
   def self.importex_value(str)
39 33
     Time.parse(str) unless str.blank?

0 notes on commit 5cc2293

Please sign in to comment.
Something went wrong with that request. Please try again.