my_age 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/lib/my_age/cli.rb +2 -2
- data/lib/my_age/version.rb +1 -1
- data/my_age.gemspec +6 -4
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 492f7c70dfd61156d3f1a550c5b0bf06f2361f8a
|
4
|
+
data.tar.gz: 760dc167e872eb052b582c92c1b42d67769ad53b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6bd761b63baaef480ca4a017615cf7c98aab548edc216ee2a0623366e89ad62e41c4b0d07b60945d96bc91580314fb6c4dbb4221ecab624a5e043ca94bdd006
|
7
|
+
data.tar.gz: 84d4494a3e8f76b4abce25017be4650ebbe6202b5323d766feb45c8af13c6d6fb88ac9ef4f0c013bb36898e275fa4f80e16a32d49a48e5757ccedf67e0dc9977
|
data/README.md
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# MyAge
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/my_age`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
@@ -51,7 +47,19 @@ end
|
|
51
47
|
##everything else is the same
|
52
48
|
```
|
53
49
|
|
50
|
+
## CLI
|
51
|
+
|
52
|
+
```
|
53
|
+
$ my_age is -d 1981-08-01 -a 1985-08-01
|
54
|
+
$ #=> 4
|
54
55
|
|
56
|
+
$ my_age is -d 1981-01-08
|
57
|
+
$ #=> age as of today
|
58
|
+
|
59
|
+
$ my_age is -d 1981-01-03 -a tomorrow
|
60
|
+
$ #=> age as of tomorrow
|
61
|
+
|
62
|
+
```
|
55
63
|
|
56
64
|
## Development
|
57
65
|
|
data/lib/my_age/cli.rb
CHANGED
@@ -8,10 +8,10 @@ module MyAge
|
|
8
8
|
|
9
9
|
desc "is AGE", "-d date_of_birth -a as_of_date, Dates are in yyyy-mm-dd format"
|
10
10
|
method_option :dob, aliases: "d", desc: "date of birth in yyyy-mm-dd", required: true
|
11
|
-
method_option :as_of, aliases: "a", desc: "as of date in yyyy-mm-dd", required:
|
11
|
+
method_option :as_of, aliases: "a", desc: "as of date in yyyy-mm-dd", required: false
|
12
12
|
def is
|
13
13
|
self.dob = DateTime.strptime(options[:dob], "%Y-%m-%d")
|
14
|
-
date = DateTime.strptime(options[:as_of], "%Y-%m-%d")
|
14
|
+
date = options[:as_of].present? ? DateTime.strptime(options[:as_of], "%Y-%m-%d") : Date.today
|
15
15
|
puts self.age(date)
|
16
16
|
end
|
17
17
|
|
data/lib/my_age/version.rb
CHANGED
data/my_age.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["zorro.ej@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Calculate my age.}
|
13
|
-
spec.description = %q{Default calendr: Gregorian. Though would like to expand to other calendars too}
|
13
|
+
spec.description = %q{a simple module to be mixed in to provide an age method. Also provide a CLI. Default calendr: Gregorian. Though would like to expand to other calendars too}
|
14
14
|
spec.homepage = "https://github.com/ej2015/my_age.git"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -20,13 +20,15 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.required_ruby_version = ">=2.3.0"
|
23
25
|
|
24
26
|
spec.add_dependency "activesupport", ">= 4.2"
|
25
|
-
spec.add_dependency "thor"
|
27
|
+
spec.add_dependency "thor", "~>0.20.0"
|
26
28
|
spec.add_development_dependency "bundler", "~> 1.13"
|
27
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
31
|
spec.add_development_dependency "pry", "~>0.11"
|
30
|
-
spec.add_development_dependency "cucumber"
|
31
|
-
spec.add_development_dependency "aruba"
|
32
|
+
spec.add_development_dependency "cucumber", "~>3.1.0"
|
33
|
+
spec.add_development_dependency "aruba", "~>0.14.0"
|
32
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_age
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgar
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.20.0
|
34
34
|
type: :runtime
|
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:
|
40
|
+
version: 0.20.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,31 +98,32 @@ dependencies:
|
|
98
98
|
name: cucumber
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 3.1.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 3.1.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: aruba
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.14.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
125
|
-
description: '
|
124
|
+
version: 0.14.0
|
125
|
+
description: 'a simple module to be mixed in to provide an age method. Also provide
|
126
|
+
a CLI. Default calendr: Gregorian. Though would like to expand to other calendars
|
126
127
|
too'
|
127
128
|
email:
|
128
129
|
- zorro.ej@gmail.com
|
@@ -158,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
159
|
requirements:
|
159
160
|
- - ">="
|
160
161
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
162
|
+
version: 2.3.0
|
162
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
164
|
requirements:
|
164
165
|
- - ">="
|