Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
turning into gem
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Feb 8, 2010
1 parent 20e3f72 commit 5cc2293
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rdoc
@@ -0,0 +1,3 @@
0.1.0 (Feb 8, 2010)

* initial release
8 changes: 3 additions & 5 deletions README.rdoc
@@ -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.
Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion Rakefile
@@ -1,6 +1,5 @@
require 'rubygems'
require 'rake'
require 'echoe'
require 'spec/rake/spectask'

spec_files = Rake::FileList["spec/**/*_spec.rb"]
Expand All @@ -10,3 +9,5 @@ Spec::Rake::SpecTask.new do |t|
t.spec_files = spec_files
t.spec_opts = ["-c"]
end

task :default => :spec
24 changes: 24 additions & 0 deletions importex.gemspec
@@ -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
1 change: 0 additions & 1 deletion lib/importex.rb
@@ -1,4 +1,3 @@
require 'rubygems'
require 'parseexcel'

require File.expand_path(File.dirname(__FILE__) + '/importex/base')
Expand Down
6 changes: 0 additions & 6 deletions lib/importex/ruby_additions.rb
Expand Up @@ -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?
Expand Down

0 comments on commit 5cc2293

Please sign in to comment.