ydim 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b1782e254b067272dace3026d09867fc0fa28e0
4
- data.tar.gz: f6f3a6d7722421e514ff914f1fc08eafe51f9a6a
3
+ metadata.gz: 90a5c5b25b62f89e7ca1befcf28f5c1725ebbfc3
4
+ data.tar.gz: 7ab7b0eb7d81c20f1f94cb39cf5ed0914a5114de
5
5
  SHA512:
6
- metadata.gz: 4d11886add1de380f4cde6391682d47ab4f4d378ccd8a7744608ed2f85b0a6c79b5ff8108163f48615a59dcf405f1b722e3a0ca2fd65ba72ef7a72f958b0c9a8
7
- data.tar.gz: c721a36a9eb1560d0866eb3c9acc7b749885461f8a0aeebc477dda3fb61e11822050e7fe7b3cc0c89d0879672ee3d48fd3ec9be4605188605d505f6318326502
6
+ metadata.gz: 19aaa2dd84783ac4be344cf3a09fa1bef6c2ebe2aa706cf13fff41f1e5b9b45bcb04219520c9e51e49efdc2b6c196f007966f4558ce4cca8ff82f9d7a2ca52f0
7
+ data.tar.gz: 10dfc234b60cb74b21c2b2c3a69bddb0e3430ea31aebca051c8349411f40a234eec553d812b1b679887db95706c1f7f6309f5a6185d1df066aefa4d4d868be5f
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.3 / 10.05.2016
2
+
3
+ * Moved bin/ydim* to lib/ydim/ to make the executables work
4
+
1
5
  === 1.0.2 / 10.05.2016
2
6
 
3
7
  * Bumped version to 1.0.2, because we still had an unwanted dependency to dbi = 0.4.6
data/bin/ydimd CHANGED
@@ -12,6 +12,10 @@ require 'drb'
12
12
  require 'fileutils'
13
13
  require 'odba/connection_pool'
14
14
  require 'odba/drbwrapper'
15
+ require 'pg'
16
+ require 'dbi'
17
+ require 'dbi/version'
18
+ require 'dbd/Pg'
15
19
 
16
20
  $0 = __FILE__
17
21
 
data/lib/ydim/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YDIM
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+ # ypdmd -- ydim -- 09.11.2005 -- hwyss@ywesee.com
3
+
4
+ require 'yaml'
5
+ require 'syck'
6
+ require 'pg'
7
+ require 'dbi'
8
+ puts "YAML is now #{YAML} in #{__FILE__} at #{__LINE__}"
9
+
10
+ require 'ydim/server'
11
+ require 'ydim/odba'
12
+ require 'rclconf'
13
+ require 'odba/connection_pool'
14
+ require 'irb'
15
+
16
+ module YDIM
17
+ class Server
18
+ attr_reader :serv
19
+ end
20
+ end
21
+
22
+ ydim_default_dir = File.join(ENV['HOME'], '.ydim')
23
+ default_config_files = [
24
+ File.join(ydim_default_dir, 'ydimd.yml'),
25
+ '/etc/ydim/ydimd.yml',
26
+ ]
27
+ defaults = {
28
+ 'autoinvoice_hour' => nil,
29
+ 'config' => default_config_files,
30
+ 'conf_dir' => File.join(ydim_default_dir, 'conf'),
31
+ 'currencies' => ['CHF', 'EUR', 'USD'],
32
+ 'currency_update_hour' => nil,
33
+ 'data_dir' => File.join(ydim_default_dir, 'data'),
34
+ 'server_url' => 'druby://localhost:12375',
35
+ 'db_driver_url' => 'DBI:pg:ydim',
36
+ 'db_user' => 'ydim',
37
+ 'db_auth' => '',
38
+ 'invoice_number_start' => 10000,
39
+ 'log_level' => 'INFO',
40
+ 'log_file' => STDOUT,
41
+ 'mail_sender' => '',
42
+ 'mail_recipients' => [],
43
+ 'root_name' => 'Root',
44
+ 'root_email' => '',
45
+ 'root_key' => 'root_dsa',
46
+ 'smtp_from' => '',
47
+ 'smtp_server' => 'localhost',
48
+ 'vat_rate' => 8.0,
49
+ }
50
+ config = RCLConf::RCLConf.new(ARGV, defaults)
51
+ config.load(config.config)
52
+
53
+ ODBA.storage.dbi = ODBA::ConnectionPool.new(config.db_driver_url,
54
+ config.db_user, config.db_auth)
55
+
56
+ logger = Logger.new($stdout)
57
+ logger.level = Logger.const_get(config.log_level)
58
+ $server = YDIM::Server.new(config, logger)
59
+ $needle = $server.serv
60
+
61
+ IRB.start
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ input = if(File.exist?(ARGV.first.to_s))
4
+ File.read(ARGV.unshift)
5
+ else
6
+ STDIN.read
7
+ end
8
+
9
+ require 'yaml'
10
+ require 'syck'
11
+ puts "YAML is now #{YAML} in #{__FILE__} at #{__LINE__}"
12
+ data = YAML.load(input) || exit(-1)
13
+
14
+ require 'openssl'
15
+ require 'rrba/error'
16
+ require 'ydim/config'
17
+ require 'ydim/client'
18
+
19
+ config = YDIM::Client::CONFIG
20
+ server = DRb::DRbObject.new(nil, config.server_url)
21
+ client = YDIM::Client.new(config)
22
+ key = OpenSSL::PKey::DSA.new(File.read(config.private_key))
23
+
24
+ DRb.start_service
25
+
26
+ client.login(server, key)
27
+ invoice = client.create_invoice(data['debitor'])
28
+ invoice.currency = data['currency'] || config.currency
29
+ invoice.description = data['description'] || config.invoice_description
30
+ invoice.payment_period = data['payment_period'] || config.payment_period
31
+ invoice.date = Date.today
32
+ client.add_items(invoice.unique_id, data['items'])
33
+ client.send_invoice(invoice.unique_id)
34
+ client.logout
data/lib/ydim/ydimd ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby231
2
+ # ypdmd -- ydim -- 12.01.2005 -- hwyss@ywesee.com
3
+
4
+ require 'yaml'
5
+ require 'syck'
6
+
7
+ require 'ydim/server'
8
+ require 'ydim/odba'
9
+ require 'logger'
10
+ require 'rclconf'
11
+ require 'drb'
12
+ require 'fileutils'
13
+ require 'odba/connection_pool'
14
+ require 'odba/drbwrapper'
15
+ require 'pg'
16
+ require 'dbi'
17
+ require 'dbi/version'
18
+ require 'dbd/Pg'
19
+
20
+ $0 = __FILE__
21
+
22
+ config = YDIM::Server.config
23
+
24
+ ODBA.storage.dbi = ODBA::ConnectionPool.new(config.db_driver_url,
25
+ config.db_user, config.db_auth, :client_encoding => 'LATIN1')
26
+ ODBA.cache.setup
27
+
28
+ DRb.install_id_conv ODBA::DRbIdConv.new
29
+
30
+ log_file = config.log_file
31
+ if(log_file.is_a?(String))
32
+ FileUtils.mkdir_p(File.dirname(log_file))
33
+ log_file = File.open(log_file, 'a')
34
+ at_exit { log_file.close }
35
+ end
36
+ logger = Logger.new(log_file)
37
+ logger.level = Logger.const_get(config.log_level)
38
+
39
+ server = YDIM::Server.new(config, logger)
40
+ server.extend(DRbUndumped)
41
+
42
+ if(config.detach)
43
+ pidfile = '/var/run/ydimd.pid'
44
+ File.open(pidfile, 'w') { |fh| fh.puts $$ }
45
+ at_exit { File.unlink(pidfile) }
46
+ Process.fork and exit!(0)
47
+ end
48
+
49
+ begin
50
+ url = config.server_url
51
+ url.untaint
52
+ DRb.start_service(url, server)
53
+ $SAFE = 1
54
+ logger.info('start') {
55
+ sprintf("starting ydim-server on %s", config.server_url) }
56
+ DRb.thread.join
57
+ rescue Exception => error
58
+ logger.error('fatal') { error }
59
+ raise
60
+ end
61
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ydim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz, Niklaus Giger
@@ -304,6 +304,9 @@ files:
304
304
  - lib/ydim/smtp_tls.rb
305
305
  - lib/ydim/util.rb
306
306
  - lib/ydim/version.rb
307
+ - lib/ydim/ydim-edit
308
+ - lib/ydim/ydim-inject
309
+ - lib/ydim/ydimd
307
310
  - readme.md
308
311
  - set_initial_ydim_db.sql
309
312
  - test/data/config.yml