miti 1.0.0 → 1.0.1
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/CHANGELOG.md +5 -1
- data/README.md +3 -29
- data/docs/cli.md +45 -0
- data/docs/miti.md +33 -0
- data/lib/cli.rb +20 -2
- data/lib/miti/version.rb +1 -1
- data/miti.gemspec +10 -7
- metadata +30 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d035a5fe63185b818bc645ef7aabf2121ba16d9ca1728b095f259fd9dabacd68
|
4
|
+
data.tar.gz: 4d014ff0cf964d26ccbea9e06e8848296be479f699dace666ff3fedba0281358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8727ff45502749f7897688461127458ff6d19e047079108bc20111d26e9ee2d7d0ba97e2b7153cac80131a9cb09e218b9a67505f748e7a7a2433a3b85ba31c13
|
7
|
+
data.tar.gz: a7cacddd04ee8b2bd790edf5100bc1c6f55fb06343f7b2d6c119b5c39c12956a9f91499f4b6ae034d9c5938457318effdc2110921ee137d26729b055ac2f39d0
|
data/CHANGELOG.md
CHANGED
@@ -12,4 +12,8 @@
|
|
12
12
|
## [1.0.0] - 2023-06-27
|
13
13
|
- New release 1.0.0
|
14
14
|
- Integrate Miti CLI
|
15
|
-
- Miti CLI now accepts arguments for date conversion
|
15
|
+
- Miti CLI now accepts arguments for date conversion
|
16
|
+
|
17
|
+
## [1.0.1] - 2023-07-01
|
18
|
+
- add gem dependency thor
|
19
|
+
- Update documentation for CLI app usage and readme.md
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Miti
|
2
2
|
[](https://badge.fury.io/rb/miti)
|
3
3
|
|
4
|
-
|
4
|
+
Converts English Date to Miti *(Nepali date)* and vice-versa. Also Miti provides built in CLI app which has date conversion features.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -13,36 +13,10 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
13
13
|
|
14
14
|
$ gem install miti
|
15
15
|
## Usage
|
16
|
+
1. [Miti](docs/miti.md)
|
17
|
+
2. [Miti CLI](docs/cli.md)
|
16
18
|
|
17
|
-
A Miti::NepaliDate(nepali miti) object is created with Miti.to_bs, while Date(english date) object is created with Miti.to_ad
|
18
|
-
```ruby
|
19
|
-
require 'miti'
|
20
19
|
|
21
|
-
Miti.to_bs("2022/10/12") # args can also be sent as "2022-12-12"
|
22
|
-
#=> #<Miti::NepaliDate:0x00007fec31b93ac8 @barsa=2079, @gatey=26, @mahina=6>
|
23
|
-
|
24
|
-
Miti.to_bs("2022/10/12").descriptive
|
25
|
-
#=> "Asoj 26, 2079 Wednesday"
|
26
|
-
|
27
|
-
Miti.to_bs("2022/10/12").descriptive(nepali: true)
|
28
|
-
#=> "आश्विन 27, 2079 Thursday(बिहिबार)"
|
29
|
-
|
30
|
-
Miti.to_bs("2022/10/12").tarik
|
31
|
-
#=> #<Date: 2022-10-12 ((2459865j,0s,0n),+0s,2299161j)>
|
32
|
-
|
33
|
-
Miti.to_bs("2022/10/12").to_h
|
34
|
-
#=> {:barsa=>2079, :mahina=>6, :gatey=>26, :bar=>3, :tarik=>#<Date: 2022-10-12 ((2459865j,0s,0n),+0s,2299161j)>}
|
35
|
-
|
36
|
-
Miti.to_bs("2022/10/12").to_s
|
37
|
-
#=> "2079-06-26"
|
38
|
-
|
39
|
-
Miti.to_bs("2022/10/12").to_s(separator: "/") # separator can be [" ", "/"]
|
40
|
-
#=> "2079/06/26" when (separator: "/")
|
41
|
-
#=> "2079 06 26" when (separator: " ")
|
42
|
-
|
43
|
-
Miti.to_ad("2079/06/26")
|
44
|
-
#=> #<Date: 2022-10-12 ((2459865j,0s,0n),+0s,2299161j)>
|
45
|
-
```
|
46
20
|
## Development
|
47
21
|
|
48
22
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/docs/cli.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
## MITI CLI
|
3
|
+
Open your terminal or command prompt and run the `miti` command to access the available features.
|
4
|
+
|
5
|
+
$ miti
|
6
|
+
|
7
|
+
The MITI CLI app will display the available commands. To execute a specific command, type the command followed by any required arguments.
|
8
|
+
|
9
|
+
## Available Commands
|
10
|
+
|
11
|
+
#### ***(Note: All the date argument must be provided in YYYY/MM/DD OR YYYY-MM-DD format)***
|
12
|
+
|
13
|
+
### **today**
|
14
|
+
|
15
|
+
The `today` command displays current day's miti as well as date. To use the `today` command, run the following:
|
16
|
+
|
17
|
+
$ miti today
|
18
|
+
|
19
|
+
Output:
|
20
|
+
```ruby
|
21
|
+
[2080-03-13 BS] Ashadh 13, 2080 Wednesday
|
22
|
+
[2023-06-28 AD] June 28, 2023 Wednesday
|
23
|
+
|
24
|
+
```
|
25
|
+
### **to_bs**
|
26
|
+
The `to_bs` command converts an English date to the Miti (Nepali Date). Takes a argument ***ENGLISH DATE*** for conversion from English Date to Miti.
|
27
|
+
|
28
|
+
$ miti to_bs 2023-06-28
|
29
|
+
|
30
|
+
|
31
|
+
Output:
|
32
|
+
```ruby
|
33
|
+
[2080-03-13 BS] Ashadh 13, 2080 Wednesday
|
34
|
+
```
|
35
|
+
|
36
|
+
### **to_ad**
|
37
|
+
|
38
|
+
The `to_ad` command converts a Miti to the English date. Takes a argument ***NEPALI MITI*** for conversion from Miti to English Date.
|
39
|
+
|
40
|
+
$ miti to_ad 2080-03-13
|
41
|
+
|
42
|
+
Output:
|
43
|
+
```ruby
|
44
|
+
[2023-06-28 AD] June 28, 2023 Wednesday
|
45
|
+
```
|
data/docs/miti.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
A **Miti::NepaliDate** (nepali miti) object is created with **Miti.to_bs**, while **Date**(english date) object is created with **Miti.to_ad**
|
3
|
+
|
4
|
+
#### ***(Note: All the date argument must be provided in YYYY/MM/DD OR YYYY-MM-DD format)***
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
require 'miti'
|
8
|
+
|
9
|
+
Miti.to_bs("2022/10/12") # args can also be sent as "2022-12-12"
|
10
|
+
#=> #<Miti::NepaliDate:0x00007fec31b93ac8 @barsa=2079, @gatey=26, @mahina=6>
|
11
|
+
|
12
|
+
Miti.to_bs("2022/10/12").descriptive
|
13
|
+
#=> "Asoj 26, 2079 Wednesday"
|
14
|
+
|
15
|
+
Miti.to_bs("2022/10/12").descriptive(nepali: true)
|
16
|
+
#=> "आश्विन 27, 2079 Thursday(बिहिबार)"
|
17
|
+
|
18
|
+
Miti.to_bs("2022/10/12").tarik
|
19
|
+
#=> #<Date: 2022-10-12 ((2459865j,0s,0n),+0s,2299161j)>
|
20
|
+
|
21
|
+
Miti.to_bs("2022/10/12").to_h
|
22
|
+
#=> {:barsa=>2079, :mahina=>6, :gatey=>26, :bar=>3, :tarik=>#<Date: 2022-10-12 ((2459865j,0s,0n),+0s,2299161j)>}
|
23
|
+
|
24
|
+
Miti.to_bs("2022/10/12").to_s
|
25
|
+
#=> "2079-06-26"
|
26
|
+
|
27
|
+
Miti.to_bs("2022/10/12").to_s(separator: "/") # separator can be [" ", "/"]
|
28
|
+
#=> "2079/06/26" when (separator: "/")
|
29
|
+
#=> "2079 06 26" when (separator: " ")
|
30
|
+
|
31
|
+
Miti.to_ad("2079/06/26")
|
32
|
+
#=> #<Date: 2022-10-12 ((2459865j,0s,0n),+0s,2299161j)>
|
33
|
+
```
|
data/lib/cli.rb
CHANGED
@@ -23,7 +23,16 @@ module Miti
|
|
23
23
|
@shell.say("#{formatted_miti}\n#{formatted_date}", :green)
|
24
24
|
end
|
25
25
|
|
26
|
-
desc "
|
26
|
+
desc "to_bs ENGLISH_DATE", "converts ENGLISH_DATE to Nepali Miti"
|
27
|
+
long_desc <<-DESC
|
28
|
+
Converts english date to nepali miti.
|
29
|
+
The `to_bs` command takes a argument <ENGLISH_DATE>, argument must be in YYYY/MM/DD or YYYY-MM-DD format
|
30
|
+
|
31
|
+
Example: $ miti to_bs 2023-06-28
|
32
|
+
|
33
|
+
Output: [2080-03-13 BS] Ashadh 13, 2080 Wednesday
|
34
|
+
DESC
|
35
|
+
|
27
36
|
def to_bs(english_date)
|
28
37
|
converted_nepali_miti = Miti.to_bs(english_date)
|
29
38
|
output_txt = "[#{converted_nepali_miti} BS] #{converted_nepali_miti.descriptive}"
|
@@ -34,7 +43,16 @@ module Miti
|
|
34
43
|
@shell.say(output_txt, @output_color)
|
35
44
|
end
|
36
45
|
|
37
|
-
desc "
|
46
|
+
desc "to_ad NEPALI_MITI", "converts NEPALI_MITI to English Date"
|
47
|
+
long_desc <<-DESC
|
48
|
+
Converts nepali miti.
|
49
|
+
The `to_ad` command takes a argument <NEPALI_MITI>, argument must be in YYYY/MM/DD or YYYY-MM-DD format
|
50
|
+
|
51
|
+
Example: $ miti to_ad 2080-03-13
|
52
|
+
|
53
|
+
Output: [2023-06-28 AD] June 28, 2023 Wednesday
|
54
|
+
DESC
|
55
|
+
|
38
56
|
def to_ad(nepali_date)
|
39
57
|
converted_english_date = Miti.to_ad(nepali_date)
|
40
58
|
output_txt = "[#{converted_english_date} AD] #{converted_english_date.strftime("%B %d, %Y %A")}"
|
data/lib/miti/version.rb
CHANGED
data/miti.gemspec
CHANGED
@@ -12,24 +12,27 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = "https://github.com/xkshitizx/miti"
|
13
13
|
spec.required_ruby_version = ">= 2.6.0"
|
14
14
|
|
15
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
16
|
-
|
17
|
-
spec.metadata["homepage_uri"] = "https://github.com/xkshitizx/miti"
|
18
|
-
spec.metadata["source_code_uri"] = "https://github.com/xkshitizx/miti"
|
19
|
-
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
20
|
-
spec.metadata = { "rubygems_mfa_required" => "true" }
|
21
15
|
# Specify which files should be added to the gem when it is released.
|
22
16
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
17
|
spec.files = Dir["README.md", "LICENSE",
|
24
18
|
"CHANGELOG.md", "lib/**/*.rb",
|
25
|
-
"lib/**/*.rake",
|
19
|
+
"lib/**/*.rake", "docs/*.md",
|
26
20
|
"miti.gemspec", ".github/*.md",
|
27
21
|
"Gemfile", "Rakefile"]
|
22
|
+
spec.metadata = {
|
23
|
+
# "allowed_push_host" = "TODO: Set to your gem server 'https://example.com'",
|
24
|
+
"bug_tracker_uri" => "https://github.com/xkshitizx/miti/issues",
|
25
|
+
"changelog_uri" => "https://github.com/xkshitizx/miti/blob/main/CHANGELOG.md",
|
26
|
+
"homepage_uri" => "https://github.com/xkshitizx/miti",
|
27
|
+
"source_code_uri" => "https://github.com/xkshitizx/miti/tree/v#{Miti::VERSION}",
|
28
|
+
"rubygems_mfa_required" => "true"
|
29
|
+
}
|
28
30
|
spec.bindir = "exe"
|
29
31
|
spec.executables = ["miti"]
|
30
32
|
spec.require_paths = ["lib"]
|
31
33
|
spec.license = "MIT"
|
32
34
|
|
35
|
+
spec.add_dependency "thor", "~> 1.2", ">= 1.2.2"
|
33
36
|
# Uncomment to register a new dependency of your gem
|
34
37
|
# For more information and examples about making a new gem, check out our
|
35
38
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xkshitizx
|
@@ -9,8 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
13
|
-
dependencies:
|
12
|
+
date: 2023-07-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.2'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.2
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.2'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.2
|
14
34
|
description: Convert English date(AD) to Nepali date(BS) and vice-versa.
|
15
35
|
email:
|
16
36
|
- kshitizlama03@gmail.com
|
@@ -25,6 +45,8 @@ files:
|
|
25
45
|
- LICENSE
|
26
46
|
- README.md
|
27
47
|
- Rakefile
|
48
|
+
- docs/cli.md
|
49
|
+
- docs/miti.md
|
28
50
|
- exe/miti
|
29
51
|
- lib/cli.rb
|
30
52
|
- lib/miti.rb
|
@@ -38,6 +60,10 @@ homepage: https://github.com/xkshitizx/miti
|
|
38
60
|
licenses:
|
39
61
|
- MIT
|
40
62
|
metadata:
|
63
|
+
bug_tracker_uri: https://github.com/xkshitizx/miti/issues
|
64
|
+
changelog_uri: https://github.com/xkshitizx/miti/blob/main/CHANGELOG.md
|
65
|
+
homepage_uri: https://github.com/xkshitizx/miti
|
66
|
+
source_code_uri: https://github.com/xkshitizx/miti/tree/v1.0.1
|
41
67
|
rubygems_mfa_required: 'true'
|
42
68
|
post_install_message:
|
43
69
|
rdoc_options: []
|
@@ -54,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
80
|
- !ruby/object:Gem::Version
|
55
81
|
version: '0'
|
56
82
|
requirements: []
|
57
|
-
rubygems_version: 3.3.
|
83
|
+
rubygems_version: 3.3.26
|
58
84
|
signing_key:
|
59
85
|
specification_version: 4
|
60
86
|
summary: Date converter BS to AD and vice-versa.
|