Permalink
Browse files

turning into gem

  • Loading branch information...
1 parent 20e3f72 commit 5cc22930b2025698ebbb32bb67931ab2e25ddd8d @ryanb committed Feb 8, 2010
Showing with 32 additions and 13 deletions.
  1. +3 −0 CHANGELOG.rdoc
  2. +3 −5 README.rdoc
  3. +2 −1 Rakefile
  4. +24 −0 importex.gemspec
  5. +0 −1 lib/importex.rb
  6. +0 −6 lib/importex/ruby_additions.rb
View
@@ -0,0 +1,3 @@
+0.1.0 (Feb 8, 2010)
+
+* initial release
View
@@ -1,5 +1,7 @@
= Importex
+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]
+
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.
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
== Installation
-It is not yet available as a gem, but will be soon.
+You can install through a gem.
gem install importex
-In the meantime you'll have to include the lib files directly.
-
-Note: This relies on the parseexcel gem so you will need to have that installed as well.
-
== Usage
View
@@ -1,6 +1,5 @@
require 'rubygems'
require 'rake'
-require 'echoe'
require 'spec/rake/spectask'
spec_files = Rake::FileList["spec/**/*_spec.rb"]
@@ -10,3 +9,5 @@ Spec::Rake::SpecTask.new do |t|
t.spec_files = spec_files
t.spec_opts = ["-c"]
end
+
+task :default => :spec
View
@@ -0,0 +1,24 @@
+Gem::Specification.new do |s|
+ s.name = "importex"
+ s.summary = "Import an Excel document with Ruby."
+ 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."
+ s.homepage = "http://github.com/ryanb/importex"
+
+ s.version = "0.1.0"
+ s.date = "2010-02-08"
+
+ s.authors = ["Ryan Bates"]
+ s.email = "ryan@railscasts.com"
+
+ s.require_paths = ["lib"]
+ s.files = Dir["lib/**/*"] + Dir["spec/**/*"] + ["LICENSE", "README.rdoc", "Rakefile", "CHANGELOG.rdoc"]
+ s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "LICENSE"]
+
+ s.has_rdoc = true
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Importex", "--main", "README.rdoc"]
+
+ s.add_dependency("parseexcel", ">= 0.5.2")
+
+ s.rubygems_version = "1.3.4"
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2")
+end
View
@@ -1,4 +1,3 @@
-require 'rubygems'
require 'parseexcel'
require File.expand_path(File.dirname(__FILE__) + '/importex/base')
@@ -28,12 +28,6 @@ def self.importex_value(str)
end
end
-class Date
- def self.importex_value(str)
- !["", "f", "F", "n", "N", "0"].include?(str)
- end
-end
-
class Time
def self.importex_value(str)
Time.parse(str) unless str.blank?

0 comments on commit 5cc2293

Please sign in to comment.