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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85ccf7e1624063e814be80aa2e5ecb87e048bb7c
4
- data.tar.gz: f9403710ba4fb5626dc64e5b6d7c793997f89023
3
+ metadata.gz: 5371cbcfcbeded441d2c2e3e8f633c2fd868d183
4
+ data.tar.gz: 72304a021dfef130d32785f4d2bcd68989e0851e
5
5
  SHA512:
6
- metadata.gz: 5930dae09d51640c6cc5eaf729ff18559a0af71f518889933e557599fb7a7037eb7d996bb321cfcf00317e3042739e6c169d1f740cd4f4d214817453150e8d95
7
- data.tar.gz: '080ac5f3385d5a9543caefebc69f346159ab2b6a2666a52e58b16348c53cc4b678a31bf30a555e269bc01197e417e1c79b05f7e6482f0f765f9140f89b4d193a'
6
+ metadata.gz: 7dafa990dfe100980190e75609c3fdae56a2110f22c536a9fb408f26094b1f61093cb8c64c0d9ee31683f8cb5b68c5605c10afc96b72b2e065bef9cce8250a58
7
+ data.tar.gz: c168f8e4f414fc3457b9b42135a12f32ace970875ee97dc0c6d169446705c4224426f25e9c230cff8bb0f936f3a52dd9f26e38701afb68a1c540d76e4def15f2
data/.circleci/config.yml CHANGED
@@ -1,26 +1,36 @@
1
- version: 2.0
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
- backend-tests:
9
- <<: *defaults
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
- - run:
13
- name: Setup dependencies
14
- command: |
15
- bundle install --without production --path=${BUNDLE_PATH:-vendor/bundle}
16
- - run:
17
- name: Run backend tests
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 exec rake
20
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
20
21
 
21
- workflows:
22
- version: 2
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
- commit:
25
- jobs:
26
- - backend-tests
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
@@ -4,5 +4,3 @@ plugins:
4
4
  checks:
5
5
  Rubocop/Style/Documentation:
6
6
  enabled: false
7
- rubymotion:
8
- enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- business-period (0.0.1)
4
+ business-period (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 = 'lt'
37
- config.work_days = [1, 2, 3, 4, 5]
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
 
@@ -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: Darbininkų diena
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: Valstybės diena
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: Antroji Kalėdų diena
39
+ name: Šv. Kalėdų antroji diena
33
40
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BusinessPeriod
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  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.3
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-09-13 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec