nanakshahi 0.1.8 → 0.3

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
  SHA256:
3
- metadata.gz: b8bf32dd0f801fd9e4f465ba281842e52a79f1b256612b330464b2b775cb6b91
4
- data.tar.gz: 1ddc9d47468022bc6a6118458da69dc412546dc281d9103f3b222635d31eb945
3
+ metadata.gz: 6d6f1860020f496e46759bfbf773e907511eef5349cd1386fd305473bbfca0c2
4
+ data.tar.gz: 348c4f90184c307f2ba3d7eba2867dbdd089288285eb5fd2761f42a6be631096
5
5
  SHA512:
6
- metadata.gz: 5b40df13b0fbbc96f76c0727d42f6bfe6d1ea8247e65130162707517425ef554a060de418c6fab0a38b4a158f5513655a5f7229edda53a355dd61f857c8726cc
7
- data.tar.gz: 7ff41203d3d4dd9064c557be241ef4989e724a2b50879d605a5b37666e0c89330e9ed87eca964f3b32849218b7e05210dad52c6b3fc77fe4b648ca6ba14f85f7
6
+ metadata.gz: e9c95621d31dc09b969aa75a7d32e843094e13388e2ef66d8f790065621958abc0899456b26d62c2fae2f8ccaa4ab63a3bc93a7d3ca5f86cf72e80d101b12f7a
7
+ data.tar.gz: ec63fb3edd2a44f293943e2eb754872483282e2eee3a80dc67e2990528959f527ab77a94d6836d4ff4b9b090e72911110aa0a9c7f58a372731946748fae6e98b
@@ -0,0 +1,48 @@
1
+ name: Ruby Gem
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ minitest:
7
+ name: Run tests
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@master
12
+
13
+ - name: Set up Ruby 2.7.1
14
+ uses: actions/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7.x
17
+
18
+ - name: Run minitest
19
+ run: |
20
+ bundle install
21
+ bundle exec rake test
22
+
23
+ publish:
24
+ name: Publish
25
+ runs-on: ubuntu-latest
26
+
27
+ if: github.ref == 'refs/heads/master'
28
+
29
+ needs: minitest
30
+
31
+ steps:
32
+ - uses: actions/checkout@master
33
+
34
+ - name: Set up Ruby 2.7
35
+ uses: actions/setup-ruby@v1
36
+ with:
37
+ ruby-version: 2.7.x
38
+
39
+ - name: Publish to RubyGems
40
+ run: |
41
+ mkdir -p $HOME/.gem
42
+ touch $HOME/.gem/credentials
43
+ chmod 0600 $HOME/.gem/credentials
44
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
45
+ gem build *.gemspec
46
+ gem push *.gem
47
+ env:
48
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
data/CHANGELOG.md CHANGED
@@ -1,8 +1,34 @@
1
1
  # coding: UTF-8
2
+ === 0.3 / 2021-09-20
3
+
4
+ Features:
5
+
6
+ - Now supports Shahmukhi Script of Panjabi language via `to_shahmukhi` method
7
+
8
+ Bug fixes:
9
+ - Fixed a bug which returned incorrect `to_gregorian method`
10
+
11
+ === 0.2.0 / 2021-09-12
12
+
13
+ Bug fixes:
14
+
15
+ - Updated rake 13.0.6 (was 13.0.1)
16
+ - Updated minitest 5.14.4 (was 5.14.0)
17
+ - Updated i18n 1.8.10 (was 1.8.2)
18
+
19
+ === 0.1.9 / 2020-04-15
20
+
21
+ Bug fixes:
22
+
23
+ - Updated Rakefile to Version 13.0 - security fix
24
+ - Updated minitest to version to 15.4
25
+ - Updated i18n to version 1.8.2
26
+ - Updated bundler to version 2.1
27
+ - Added a new test for 1 Vaisakh
2
28
 
3
29
  === 0.1.8 / 2019-03-14
4
30
 
5
31
  Bug fixes:
6
32
 
7
- * Fixed to_s method that failed because of unavailability of locales.
8
- * Added a CHANGELOG.md to the gem code to keep track of changes over time.
33
+ - Fixed to_s method that failed because of unavailability of locales.
34
+ - Added a CHANGELOG.md to the gem code to keep track of changes over time.
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanakshahi (0.1.1)
5
- i18n (~> 1.1, >= 1.1.4)
4
+ nanakshahi (0.2.0)
5
+ i18n (~> 1.8, >= 1.8.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- concurrent-ruby (1.1.4)
11
- i18n (1.5.1)
10
+ concurrent-ruby (1.1.9)
11
+ i18n (1.8.10)
12
12
  concurrent-ruby (~> 1.0)
13
- minitest (5.11.3)
14
- rake (10.5.0)
13
+ minitest (5.14.4)
14
+ rake (13.0.6)
15
15
 
16
16
  PLATFORMS
17
17
  ruby
18
18
 
19
19
  DEPENDENCIES
20
- bundler (~> 1.17)
21
- minitest (~> 5.0)
20
+ bundler (~> 2.1)
21
+ minitest (~> 5.14)
22
22
  nanakshahi!
23
- rake (~> 10.0)
23
+ rake (~> 13.0)
24
24
 
25
25
  BUNDLED WITH
26
- 1.17.2
26
+ 2.2.22
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # ਨਾਨਕਸ਼ਾਹੀ (Nanakshahi)
1
+ ਨਾਨਕਸ਼ਾਹੀ (Nanakshahi)[![Gem Version](https://badge.fury.io/rb/nanakshahi.svg)](https://badge.fury.io/rb/nanakshahi) ![Build Status](https://github.com/akaltakht/nanakshahi/actions/workflows/gempush.yml/badge.svg)
2
+ ========
2
3
 
3
4
  ਨਾਨਕਸ਼ਾਹੀ ਇੱਕ ਰੂਬੀ ਪਰੋਗਰਾਮਿੰਗ ਭਾਸ਼ਾ ਚ ਲਿਖਿਆ ਗਿਆ gem ਹੈ ਜੋ ਕਿ [ਪਾਲ ਸਿੰਘ ਪੁਰੇਵਾਲ](http://purewal.biz/) ਦੁਆਰਾ ਲਿਖੇ ਗਏ [ਮੂਲ ਨਾਨਕਸ਼ਾਹੀ ਕਲੰਡਰ](http://www.purewal.biz/Gurbani_and_Nanakshahi_Calendar.pdf) ਤੇ ਅਧਾਰਿਤ ਹੈ।
4
5
 
5
- ਇਹ ਆਮ/ਗਰਿਗੋਰੀਅਨ ਕਲੰਡਰ ਦੀਆਂ ਤਰੀਕਾਂ ਤੋਂ ਨਾਨਕਸ਼ਾਹੀ ਤੇ ਵਾਪਸ ਬਦਲਣ ਦੇ ਤਰੀਕੇ ਮੁਹੱੲੀਆ ਕਰਵਾਉਂਦਾ ਹੈ। ਤੁਸੀਂ ਇਸ ਨੂੰ ਕਿਸੇ ਵੀ ਰੂਬੀ ਪਰੋਗਰਾਮ ਵਿੱਚ ਨਾਨਕਸ਼ਾਹੀ ਤਰੀਕਾਂ ਵਰਤਣ ਲੲੀ ਵਰਤ ਸਕਦੇ ਹੋ।
6
+ ਇਹ ਆਮ/ਗਰਿਗੋਰੀਅਨ ਕਲੰਡਰ ਦੀਆਂ ਤਰੀਕਾਂ ਤੋਂ ਨਾਨਕਸ਼ਾਹੀ ਤੇ ਵਾਪਸ ਬਦਲਣ ਦੇ ਤਰੀਕੇ ਮੁਹੱਈਆ ਕਰਵਾਉਂਦਾ ਹੈ। ਤੁਸੀਂ ਇਸ ਨੂੰ ਕਿਸੇ ਵੀ ਰੂਬੀ ਪਰੋਗਰਾਮ ਵਿੱਚ ਨਾਨਕਸ਼ਾਹੀ ਤਰੀਕਾਂ ਵਰਤਣ ਲਈ ਵਰਤ ਸਕਦੇ ਹੋ।
6
7
 
7
8
  Nanakshahi is a ruby gem for Nanakshahi Calendar based on the [original work](http://www.purewal.biz/Gurbani_and_Nanakshahi_Calendar.pdf) by [Pal Singh Purewal](http://purewal.biz/).
8
9
 
@@ -96,7 +97,7 @@ For a complete list of all the methods, check out [the documentation](https://ww
96
97
 
97
98
  ## Contributing
98
99
 
99
- Bug reports and pull requests are welcome on GitHub at https://github.com/punjab/nanakshahi.
100
+ Bug reports and pull requests are welcome on GitHub at https://github.com/akaltakht/nanakshahi.
100
101
 
101
102
  ## License
102
103
 
@@ -0,0 +1,34 @@
1
+ pa_PK:
2
+ nanakshahi_months:
3
+ -
4
+ - چیت
5
+ - وساکھ
6
+ - جیٹھ
7
+ - ہاڑھ
8
+ - ساؤݨ
9
+ - بھادوں
10
+ - اسو
11
+ - کتک
12
+ - مگھر
13
+ - پوہ
14
+ - ماگھ
15
+ - پھگݨ
16
+ digits:
17
+ - ۰
18
+ - ۱
19
+ - ۲
20
+ - ۳
21
+ - ۴
22
+ - ۵
23
+ - ۶
24
+ - ۷
25
+ - ۸
26
+ - ۹
27
+ day_names:
28
+ - سوم وار
29
+ - منگل
30
+ - بدھ
31
+ - جمعرات
32
+ - شکروار
33
+ - سن
34
+ - اتوار
@@ -1,3 +1,3 @@
1
1
  class Nanakshahi
2
- VERSION = "0.1.8"
2
+ VERSION = "0.3"
3
3
  end
data/lib/nanakshahi.rb CHANGED
@@ -15,7 +15,7 @@ require "nanakshahi/gurpurab"
15
15
  # @attr_reader [Integer] day Day part of Nanakshahi date object
16
16
  class Nanakshahi
17
17
  I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
18
- I18n.available_locales = [:en, :pa]
18
+ I18n.available_locales = [:en, :pa, :pa_PK]
19
19
  include Comparable
20
20
  extend Utils
21
21
  extend Grid
@@ -42,15 +42,7 @@ class Nanakshahi
42
42
  #
43
43
  # @return [Date] Converts nanakshahi into corresponding gregorian# as Date object
44
44
  def to_gregorian
45
- last_nmonth_of_gyear = 10 # ਪੋਹ
46
- last_nday_of_gyear = 18 # ੧੮
47
-
48
- if month <= last_nmonth_of_gyear && day <= last_nday_of_gyear
49
- gyear = year + 1468
50
- else
51
- gyear = year + 1469
52
- end
53
-
45
+ gyear = year + 1468
54
46
  nanakshahi_months = self.class.date_grid(gyear)
55
47
  nanakshahi_months[month - 1][day - 1]
56
48
  end
@@ -71,6 +63,14 @@ class Nanakshahi
71
63
  "#{panjabi_numerals(day)} #{I18n.t(:nanakshahi_months, locale: :pa)[month]}, #{panjabi_numerals(year_zero_correction(year))} #{era}"
72
64
  end
73
65
 
66
+ # Shahmukhi String representation of Nanakshahi object
67
+ #
68
+ # @return [String] Shahmukhi String representation of Nanakshahi
69
+ def to_shahmukhi
70
+ era = year < 1 ? :دھندکال : :نانکشاھی
71
+ "#{shahmukhi_numerals(day)} #{I18n.t(:nanakshahi_months, locale: :pa_PK)[month]} #{shahmukhi_numerals(year_zero_correction(year))} #{era} "
72
+ end
73
+
74
74
  # Checks Nanakshahi leap year
75
75
  #
76
76
  # @return [Boolean] True if Nanakshahi year's Phagun has 31 days
@@ -157,4 +157,13 @@ class Nanakshahi
157
157
  def panjabi_numerals(number)
158
158
  number.to_s.chars.map { |digit| I18n.t(:digits, locale: :pa)[digit.to_i] }.join
159
159
  end
160
+
161
+ # Converts english numerals to Shahmukhi
162
+ #
163
+ # @param [Integer] number A numeric usually date
164
+ # @return [String] Shahmukhi representation of date
165
+ # @private
166
+ def shahmukhi_numerals(number)
167
+ number.to_s.chars.map { |digit| I18n.t(:digits, locale: :pa_PK)[digit.to_i] }.join
168
+ end
160
169
  end
data/nanakshahi.gemspec CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.17"
27
- spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_development_dependency "minitest", "~> 5.0"
29
- spec.add_runtime_dependency "i18n", "~> 1.5", ">= 1.5.1"
26
+ spec.add_development_dependency "bundler", "~> 2.1"
27
+ spec.add_development_dependency "rake", "~> 13.0"
28
+ spec.add_development_dependency "minitest", "~> 5.14"
29
+ spec.add_runtime_dependency "i18n", "~> 1.8", ">= 1.8.1"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanakshahi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvinder Singh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-15 00:00:00.000000000 Z
11
+ date: 2021-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,62 +16,62 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: '2.1'
20
20
  type: :development
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: '1.17'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.0'
47
+ version: '5.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.0'
54
+ version: '5.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: i18n
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.5'
61
+ version: '1.8'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 1.5.1
64
+ version: 1.8.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: '1.5'
71
+ version: '1.8'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.5.1
74
+ version: 1.8.1
75
75
  description: Implementation of original nanakshahi calendar developed by Pal Singh
76
76
  Purewal
77
77
  email:
@@ -80,6 +80,7 @@ executables: []
80
80
  extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
+ - ".github/workflows/gempush.yml"
83
84
  - ".gitignore"
84
85
  - ".gitlab-ci.yml"
85
86
  - ".travis.yml"
@@ -93,6 +94,7 @@ files:
93
94
  - bin/setup
94
95
  - config/locales/en.yml
95
96
  - config/locales/pa.yml
97
+ - config/locales/pa_PK.yml
96
98
  - lib/nanakshahi.rb
97
99
  - lib/nanakshahi/date.rb
98
100
  - lib/nanakshahi/grid.rb
@@ -119,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
121
  - !ruby/object:Gem::Version
120
122
  version: '0'
121
123
  requirements: []
122
- rubygems_version: 3.0.3
124
+ rubygems_version: 3.1.6
123
125
  signing_key:
124
126
  specification_version: 4
125
127
  summary: Nanakshahi calendar by Pal Singh Purewal