lucasalary 0.1.29 → 0.6.0

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
  SHA256:
3
- metadata.gz: 5f9a6cc60592a240edaa38b2fc9245efeefa74d16c2fff7abfdf8c2e9a7dbf4c
4
- data.tar.gz: e09af61bfa146de7625f5877951ab4dfeb7b76549c443be7f1d0245b6e1e37ac
3
+ metadata.gz: d28cd1e6534f228ea827a320c439f6e7a2ab67850ff0a169112ad3631ee822f3
4
+ data.tar.gz: 9333ee5fe244056cc45b0e8aaa188347be9c1e04137ca866550811dc0a4b7dcf
5
5
  SHA512:
6
- metadata.gz: a9068ec38591a0a8758498371497533b4c9d37303a3089b6441d4601bd88dc685fc338b1718a5fe549c2decaa89f8dc0534afc1b1144c99b7328ff25aa5a0166
7
- data.tar.gz: 2f15b61cd215c260aeda9c6df1c053129fd8b20ab3390564f2d23308eb0b576c7c4f6e8c7f693b5c6c57951e0a13fe8d697a44574ac93666c14e6971acf3299d
6
+ metadata.gz: f9fac7f7e67b4c07f2273ec4a2b04b4dab01a292ff180b6a9a1f66685cda874a8319c6758ceb48ec5e9b116935fba02c0e07c9fd03f143c8208e1550a2c32048
7
+ data.tar.gz: 4253f665b92b82f5851db0391e7e011c8218e543afc5d9a49498ffa3bdab35a41d3e6f2f2b0731fa7ab3c73c0f89d638567721bb5ad1b29a7b33bd3040871d52
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## LucaSalary 0.6.0
2
+
3
+ * BREAKING: monthly payment now passes calculation date to local modules.
4
+ * BREAKING: year total calculation now passes profiles to local modules.
5
+
6
+ ## LucaSalary 0.5.0
7
+
8
+ * `luca-salary` command now searches valid sub directory.
9
+
1
10
  ## LucaSalary 0.1.29
2
11
 
3
12
  * `luca-salary payment list` supports interactive `--explore` w/nushell.
data/exe/luca-salary CHANGED
@@ -1,6 +1,16 @@
1
1
  #!/usr/bin/ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ unless Dir.exist?('data') || ARGV[0] == 'new'
5
+ target = 'profiles'
6
+ Dir.glob('*').reject { |f| File.symlink?(f) }
7
+ .find { |f| File.directory?("#{f}/data/#{target}") }.tap do |d|
8
+ abort "No valid data directory, exit..." if d.nil?
9
+
10
+ Dir.chdir(d)
11
+ end
12
+ end
13
+
4
14
  require 'json'
5
15
  require 'optparse'
6
16
  require 'luca_salary'
@@ -25,12 +25,12 @@ module LucaSalary
25
25
  country = @driver.new(@pjdir, @config, @date)
26
26
  # TODO: handle retirement
27
27
  LucaSalary::Profile.all do |profile|
28
- current_profile = parse_current(profile)
28
+ current_profile = parse_current(Profile.find_secure(profile['id']))
29
29
  if self.class.search(@date.year, @date.month, @date.day, current_profile['id']).count > 0
30
30
  puts "payment record already exists: #{current_profile['id']}"
31
31
  return nil
32
32
  end
33
- h = country.calc_payment(current_profile)
33
+ h = country.calc_payment(current_profile, @date)
34
34
  h['profile_id'] = current_profile['id']
35
35
  self.class.create(h, date: @date, codes: Array(current_profile['id']))
36
36
  end
@@ -29,17 +29,17 @@ module LucaSalary
29
29
  payment, _count = accumulate(slips)
30
30
  payment['id'] = id
31
31
  date = Date.new(year, 12, 31)
32
- payment = local_convert(payment, date)
32
+ payment = local_convert(Profile.find_secure(id), payment, date)
33
33
  upsert(payment, basedir: "payments/total/#{year}#{LucaSupport::Code.encode_month(12)}")
34
34
  end
35
35
  end
36
36
 
37
- def self.local_convert(payment, date)
37
+ def self.local_convert(profile, payment, date)
38
38
  return payment if CONFIG['country'].nil?
39
39
 
40
40
  require "luca_salary/#{CONFIG['country'].downcase}"
41
41
  klass = Kernel.const_get("LucaSalary::#{CONFIG['country'].capitalize}")
42
- klass.year_total(payment, date)
42
+ klass.year_total(profile, payment, date)
43
43
  rescue NameError
44
44
  return payment
45
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaSalary
4
- VERSION = '0.1.29'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucasalary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucarecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.4
19
+ version: 0.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.4
26
+ version: 0.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +96,7 @@ metadata:
96
96
  homepage_uri: https://github.com/chumaltd/luca/tree/master/lucasalary
97
97
  source_code_uri: https://github.com/chumaltd/luca/tree/master/lucasalary
98
98
  changelog_uri: https://github.com/chumaltd/luca/tree/master/lucasalary/CHANGELOG.md
99
- post_install_message:
99
+ post_install_message:
100
100
  rdoc_options: []
101
101
  require_paths:
102
102
  - lib
@@ -104,15 +104,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
105
  - - ">="
106
106
  - !ruby/object:Gem::Version
107
- version: 2.6.0
107
+ version: 3.0.0
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.3.5
115
- signing_key:
114
+ rubygems_version: 3.4.10
115
+ signing_key:
116
116
  specification_version: 4
117
117
  summary: Salary calculation framework
118
118
  test_files: []