Skip to content

Commit

Permalink
Added pdfinvoice. Made unittests pass under Ruby 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Apr 11, 2016
1 parent f77fbab commit 0993465
Show file tree
Hide file tree
Showing 21 changed files with 86 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
coverage
pkg
.bundle
.ruby-version
Gemfile.lock
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -11,7 +11,6 @@ before_install:
script: bundle exec test/suite.rb

rvm:
- 1.9.3
- 2.1
- 2.2
- 2.3
Expand Down
7 changes: 6 additions & 1 deletion Gemfile
@@ -1,7 +1,12 @@
source 'https://rubygems.org'

gemspec

gem "pdf-writer",
:git => 'https://github.com/metaskills/pdf-writer.git'
# :ref => 'cb725fb333364621c342b3c62fb2e854c8716f6a'
# Exact specification is here, as we cannot declare a :git dependency in ydim.gemspec
gem "dbi", '0.4.5', :git => 'https://github.com/zdavatz/ruby-dbi'

group :debugger do
if RUBY_VERSION.match(/^1/)
gem 'pry-debugger'
Expand Down
1 change: 1 addition & 0 deletions History.txt
@@ -1,5 +1,6 @@
=== 1.0.1 / 16.03.2016

* Works only for Ruby version >= 2.1.0
* Replaced hoe by bundler/gem_tasks

=== 1.0.0 / 20.12.2010
Expand Down
53 changes: 53 additions & 0 deletions lib/pdfinvoice/config.rb
@@ -0,0 +1,53 @@
#!/usr/bin/env ruby
# Config -- pdfinvoice -- 28.07.2005 -- hwyss@ywesee.com

require 'rclconf'

module PdfInvoice
def PdfInvoice.config(argv=[])
default_dir = File.join(ENV['HOME'].to_s, '.pdfinvoice')
default_config_files = [
File.join(default_dir, 'config.yml'),
'/etc/pdfinvoice/config.yml',
]
defaults = {
'colors' => {
'items' => [0xFA, 0xFA, 0xFA],
'total' => [0xF0, 0xF0, 0xF0],
},
'config' => default_config_files,
'creditor_address' => '',
'creditor_email' => '',
'creditor_bank' => '',
'due_days' => '',
'font' => 'Helvetica',
'font_b' => 'Helvetica-Bold',
'formats' => {
'currency' => "%1.2f",
'total' => "%1.2f",
'date' => "%d.%m.%Y",
'invoice_number' => "<b>#%06i</b>",
'quantity' => '%1.1f',
},
'logo_path' => nil,
'logo_link' => nil,
'tax' => 0,
'texts' => {
'date' => 'Date',
'description' => 'Description',
'unit' => 'Unit',
'quantity' => 'Quantity',
'price' => 'Price',
'item_total' => 'Item Total',
'subtotal' => 'Subtotal',
'tax' => 'Tax',
'thanks' => nil,
'total' => 'Total',
},
'text_options' => {:spacing => 1.25},
}
config = RCLConf::RCLConf.new(ARGV, defaults)
config.load(config.config)
config
end
end
Binary file added lib/pdfinvoice/invoice.rb
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/ydim/mail.rb
Expand Up @@ -2,7 +2,7 @@
# Mail -- ydim -- 18.01.2006 -- hwyss@ywesee.com

require 'net/smtp'
require 'mail'
require 'rmail'
require 'ydim/smtp_tls'

module YDIM
Expand Down
Binary file added test/data/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions test/suite.rb
@@ -1,10 +1,12 @@
#!/usr/bin/env ruby
# TestSuite -- ydim -- 27.01.2005 -- hwyss@ywesee.com
require 'simplecov'

$: << File.dirname(File.expand_path(__FILE__))
SimpleCov.start

Dir.foreach(File.dirname(__FILE__)) { |file|
Dir.foreach(File.dirname(__FILE__)) do |file|
if /^test_.*\.rb$/o.match(file)
require file
require file
end
}
end
Empty file modified test/test_autoinvoicer.rb 100644 → 100755
Empty file.
Empty file modified test/test_currency_converter.rb 100644 → 100755
Empty file.
Empty file modified test/test_currency_updater.rb 100644 → 100755
Empty file.
Empty file modified test/test_debitor.rb 100644 → 100755
Empty file.
Empty file modified test/test_factory.rb 100644 → 100755
Empty file.
Empty file modified test/test_invoice.rb 100644 → 100755
Empty file.
Binary file modified test/test_item.rb 100644 → 100755
Binary file not shown.
2 changes: 1 addition & 1 deletion test/test_mail.rb 100644 → 100755
Expand Up @@ -5,7 +5,7 @@

require 'test/unit'
require 'ydim/mail'
require 'flexmock'
require 'flexmock/test_unit'

module YDIM
class TestMail < Test::Unit::TestCase
Expand Down
Binary file modified test/test_root_session.rb 100644 → 100755
Binary file not shown.
Empty file modified test/test_root_user.rb 100644 → 100755
Empty file.
3 changes: 1 addition & 2 deletions test/test_server.rb 100644 → 100755
@@ -1,8 +1,7 @@
#!/usr/bin/env ruby
# TestServer -- ydim -- 10.01.2006 -- hwyss@ywesee.com


$: << File.expand_path('../lib', File.dirname(__FILE__))
$: << File.expand_path('..', File.dirname(__FILE__))

require 'test/unit'
require 'test/stub/odba'
Expand Down
14 changes: 13 additions & 1 deletion ydim.gemspec
Expand Up @@ -17,12 +17,24 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "mail"
spec.add_dependency "rmail"
spec.add_dependency "odba"
spec.add_dependency "rclconf"
spec.add_dependency "needle"
spec.add_dependency "pdf-writer"
spec.add_dependency "rrba"
spec.add_dependency "hpricot"
spec.add_runtime_dependency 'deprecated', '= 2.0.1'

# Exact specification of dbi is in the Gemfile, as we cannot declare a :git dependency in ydim.gemspec
# we have some important patches here!!
spec.add_dependency "dbi", '0.4.5'
spec.add_development_dependency "bundler"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "rake"
spec.add_development_dependency "flexmock"
spec.add_development_dependency "test-unit"
spec.add_development_dependency "minitest"
spec.add_development_dependency "rspec"
end

0 comments on commit 0993465

Please sign in to comment.