business-period 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +30 -20
- data/.codeclimate.yml +0 -2
- data/Gemfile.lock +1 -1
- data/README.md +16 -4
- data/config/holidays/lt.yml +10 -3
- data/lib/business_period/days.rb +7 -0
- data/lib/business_period/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5371cbcfcbeded441d2c2e3e8f633c2fd868d183
|
|
4
|
+
data.tar.gz: 72304a021dfef130d32785f4d2bcd68989e0851e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7dafa990dfe100980190e75609c3fdae56a2110f22c536a9fb408f26094b1f61093cb8c64c0d9ee31683f8cb5b68c5605c10afc96b72b2e065bef9cce8250a58
|
|
7
|
+
data.tar.gz: c168f8e4f414fc3457b9b42135a12f32ace970875ee97dc0c6d169446705c4224426f25e9c230cff8bb0f936f3a52dd9f26e38701afb68a1c540d76e4def15f2
|
data/.circleci/config.yml
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
defaults: &defaults
|
|
3
|
-
working_directory: ~/business-period
|
|
4
|
-
docker:
|
|
5
|
-
- image: circleci/ruby:2.4.2-jessie-node-browsers
|
|
6
|
-
|
|
1
|
+
version: 2
|
|
7
2
|
jobs:
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
build:
|
|
4
|
+
docker:
|
|
5
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
|
6
|
+
|
|
7
|
+
working_directory: ~/business-period
|
|
8
|
+
|
|
10
9
|
steps:
|
|
11
10
|
- checkout
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
|
|
12
|
+
- restore_cache:
|
|
13
|
+
keys:
|
|
14
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
|
15
|
+
- v1-dependencies-
|
|
16
|
+
|
|
17
|
+
- run:
|
|
18
|
+
name: install dependencies
|
|
18
19
|
command: |
|
|
19
|
-
bundle
|
|
20
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
- save_cache:
|
|
23
|
+
paths:
|
|
24
|
+
- ./vendor/bundle
|
|
25
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
|
26
|
+
|
|
27
|
+
- run:
|
|
28
|
+
name: run tests
|
|
29
|
+
command: |
|
|
30
|
+
rake
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
32
|
+
- store_test_results:
|
|
33
|
+
path: /tmp/test-results
|
|
34
|
+
- store_artifacts:
|
|
35
|
+
path: /tmp/test-results
|
|
36
|
+
destination: test-results
|
data/.codeclimate.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ Or install it yourself as:
|
|
|
24
24
|
|
|
25
25
|
## Quickstart
|
|
26
26
|
|
|
27
|
+
There are two ways to initialize:
|
|
28
|
+
|
|
27
29
|
##### Add an initializer file:
|
|
28
30
|
|
|
29
31
|
```ruby
|
|
@@ -32,11 +34,22 @@ Or install it yourself as:
|
|
|
32
34
|
# set locale to get config file from config/holidays path
|
|
33
35
|
# set work_days to define which days of week are work days
|
|
34
36
|
|
|
37
|
+
locale = 'lt'
|
|
38
|
+
work_days = [1, 2, 3, 4, 5]
|
|
39
|
+
|
|
35
40
|
BusinessPeriod.configure do |config|
|
|
36
|
-
config.locale =
|
|
37
|
-
config.work_days =
|
|
41
|
+
config.locale = locale
|
|
42
|
+
config.work_days = work_days
|
|
38
43
|
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
##### Initialize through params:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
locale = 'lt'
|
|
50
|
+
work_days = [1, 2, 3, 4, 5]
|
|
39
51
|
|
|
52
|
+
BusinessPeriod::Days.new(locale, work_days)
|
|
40
53
|
```
|
|
41
54
|
|
|
42
55
|
## How it works
|
|
@@ -80,8 +93,7 @@ irb(main):003:0> BusinessPeriod::Days.call(period)
|
|
|
80
93
|
|
|
81
94
|
## Todo
|
|
82
95
|
- [ ] Add latvian config
|
|
83
|
-
- [ ] Add estonian config
|
|
84
|
-
- [ ] Calculate Easter holidays
|
|
96
|
+
- [ ] Add estonian config
|
|
85
97
|
|
|
86
98
|
## Development
|
|
87
99
|
|
data/config/holidays/lt.yml
CHANGED
|
@@ -8,15 +8,22 @@ months:
|
|
|
8
8
|
3:
|
|
9
9
|
- mday: 11
|
|
10
10
|
name: Nepriklausomybės atkūrimo diena
|
|
11
|
+
4:
|
|
12
|
+
- mday: 1
|
|
13
|
+
name: Velykos
|
|
14
|
+
- mday: 2
|
|
15
|
+
name: Velykų antroji diena
|
|
11
16
|
5:
|
|
12
17
|
- mday: 1
|
|
13
|
-
name:
|
|
18
|
+
name: Tarptautinė darbo diena / Motinos diena
|
|
14
19
|
6:
|
|
20
|
+
- mday: 3
|
|
21
|
+
name: Tėvo diena
|
|
15
22
|
- mday: 24
|
|
16
23
|
name: Joninės
|
|
17
24
|
7:
|
|
18
25
|
- mday: 6
|
|
19
|
-
name:
|
|
26
|
+
name: Karaliaus Mindaugo karūnavimo diena
|
|
20
27
|
8:
|
|
21
28
|
- mday: 15
|
|
22
29
|
name: Žolinė
|
|
@@ -29,5 +36,5 @@ months:
|
|
|
29
36
|
- mday: 25
|
|
30
37
|
name: Šv. Kalėdos
|
|
31
38
|
- mday: 26
|
|
32
|
-
name:
|
|
39
|
+
name: Šv. Kalėdų antroji diena
|
|
33
40
|
|
data/lib/business_period/days.rb
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module BusinessPeriod
|
|
4
4
|
class Days < Base
|
|
5
|
+
def initialize(locale = nil, work_days = nil)
|
|
6
|
+
BusinessPeriod.configure do |config|
|
|
7
|
+
config.locale = locale if locale
|
|
8
|
+
config.work_days = work_days if work_days
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
5
12
|
def self.call(plot)
|
|
6
13
|
new.perform(plot)
|
|
7
14
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: business-period
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- matas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|