Skip to content
Snippets Groups Projects
Commit b6449c96 authored by Immanuel Häussermann's avatar Immanuel Häussermann
Browse files

rename gem to excelsieur

parent e8ddf4f1
No related branches found
No related tags found
No related merge requests found
Pipeline #28539 passed
......@@ -4,5 +4,5 @@ source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# Specify your gem's dependencies in excelsior.gemspec
# Specify your gem's dependencies in excelsieur.gemspec
gemspec
PATH
remote: .
specs:
excelsior (0.1.0)
excelsieur (0.1.0)
activerecord (>= 4.0.0)
rails (>= 4.0.0)
simple_xlsx_reader (~> 1.0.2)
......@@ -142,7 +142,7 @@ PLATFORMS
DEPENDENCIES
bundler (~> 1.16)
excelsior!
excelsieur!
minitest (~> 5.0)
rake (~> 10.0)
rubocop (~> 0.56.0)
......
<img src="docs/excelsior-logo.png" width="480">
<img src="docs/excelsieur-logo.png" width="480">
---
......@@ -9,7 +9,7 @@ A straightforward way to import data from an excel sheet into your ruby app.
Add this line to your application's Gemfile:
```ruby
gem 'excelsior'
gem 'excelsieur'
```
And then execute:
......@@ -18,14 +18,14 @@ And then execute:
Or install it yourself as:
$ gem install excelsior
$ gem install excelsieur
## How to use it
Create a class which declares how columns from an excel sheet map to your ruby object model by extending from the `Excelsior::Importer` class:
Create a class which declares how columns from an excel sheet map to your ruby object model by extending from the `Excelsieur::Importer` class:
```ruby
class UserImporter < Excelsior::Importer
class UserImporter < Excelsieur::Importer
# declare the source file
source "static/ftp/users.xlsx"
......@@ -55,7 +55,7 @@ import = UserImport.new
import.run
import.errors[:model]
# => [#<struct Excelsior::Error row=3, errors=["First name can't be blank"]>]
# => [#<struct Excelsieur::Error row=3, errors=["First name can't be blank"]>]
```
### Report
......@@ -68,7 +68,7 @@ import = UserImport.new
import.run
import.report
# => #<struct Excelsior::Report inserted=2, failed=1>
# => #<struct Excelsieur::Report inserted=2, failed=1>
import.total
# => 3
......@@ -79,7 +79,7 @@ import.total
When setting `transaction true` no record is inserted if any one of them has an error.
```ruby
class UserImporter < Excelsior::Importer
class UserImporter < Excelsieur::Importer
# declare the source file
source "static/ftp/users.xlsx"
......@@ -141,7 +141,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/manufaktor/excelsior.
Bug reports and pull requests are welcome on GitHub at https://github.com/panter/excelsieur.
## License
......
......@@ -2,7 +2,7 @@
# frozen_string_literal: true
require 'bundler/setup'
require 'excelsior'
require 'excelsieur'
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
......
docs/excelsieur-logo.png

35.9 KiB

docs/excelsior-logo.png

37.1 KiB

......@@ -2,18 +2,18 @@
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'excelsior/version'
require 'excelsieur/version'
Gem::Specification.new do |spec|
spec.name = 'excelsior'
spec.version = Excelsior::VERSION
spec.name = 'excelsieur'
spec.version = Excelsieur::VERSION
spec.authors = ['Immanuel Häussermann', 'Alexis Reigel']
spec.email = ['hai@panter.ch', 'lex@panter.ch']
spec.summary = 'Helps you import data from an excel sheet'
spec.description = 'Provides a concise DSL to map, validate and import data ' \
'from an excel sheet into your ruby app'
spec.homepage = 'https://git.panter.ch/open-source/excelsior'
spec.homepage = 'https://git.panter.ch/open-source/excelsieur'
spec.license = 'MIT'
spec.files = `git ls-files -z`.split("\x0").reject do |f|
......
# frozen_string_literal: true
require 'excelsior/version'
require 'excelsieur/version'
module Excelsior
module Excelsieur
end
# frozen_string_literal: true
module Excelsior
module Excelsieur
Error = Struct.new(:row, :errors)
end
......@@ -3,13 +3,13 @@
require 'simple_xlsx_reader'
require 'rails'
require 'active_record'
require 'excelsior/source'
require 'excelsior/mapping'
require 'excelsior/error'
require 'excelsior/report'
require 'excelsior/transaction'
require 'excelsieur/source'
require 'excelsieur/mapping'
require 'excelsieur/error'
require 'excelsieur/report'
require 'excelsieur/transaction'
module Excelsior
module Excelsieur
class Import
include Source
include Mapping
......
# frozen_string_literal: true
module Excelsior
module Excelsieur
module Mapping
def self.included(host_class)
host_class.extend ClassMethods
......
# frozen_string_literal: true
module Excelsior
module Excelsieur
Report = Struct.new(:inserted, :failed) do
def initialize(*args)
super(*args)
......
# frozen_string_literal: true
module Excelsior
module Excelsieur
module Source
def self.included(host_class)
host_class.extend ClassMethods
......
# frozen_string_literal: true
module Excelsior
module Excelsieur
module Transaction
def self.included(host_class)
host_class.extend ClassMethods
......
# frozen_string_literal: true
module Excelsior
module Excelsieur
VERSION = '0.1.0'
end
# frozen_string_literal: true
require 'test_helper'
require 'excelsior/import'
require 'excelsieur/import'
class User < ActiveRecord::Base
validates :first_name, presence: true
end
describe Excelsior do
describe Excelsieur do
before do
Object.send(:remove_const, :UserImport) if Object.constants.include?(:UserImport)
class UserImport < Excelsior::Import
class UserImport < Excelsieur::Import
source 'test/files/complete.xlsx'
map 'Vorname', to: :first_name
......@@ -23,7 +23,7 @@ describe Excelsior do
end
it 'has a version number' do
refute_nil ::Excelsior::VERSION
refute_nil ::Excelsieur::VERSION
end
describe 'source' do
......@@ -50,7 +50,7 @@ describe Excelsior do
before do
Object.send(:remove_const, :UserImport) if Object.constants.include?(:UserImport)
class UserImport < Excelsior::Import
class UserImport < Excelsieur::Import
source 'test/files/complete.xlsx'
transaction true
......@@ -159,7 +159,7 @@ describe Excelsior do
it 'returns the model validation errors' do
import = UserImport.new('test/files/missing-first-name.xlsx').tap(&:run)
assert import.errors[:model].any?
assert_equal import.errors[:model], [Excelsior::Error.new(3, ["First name can't be blank"])]
assert_equal import.errors[:model], [Excelsieur::Error.new(3, ["First name can't be blank"])]
end
end
......
# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'excelsior'
require 'excelsieur'
require 'active_record'
require 'minitest/autorun'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment