smart-period 1.0.5 → 1.0.11

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: b096210e00666949c390b7428c78c5ca1c972be5018006a560f849aa824ce81a
4
- data.tar.gz: d54a53c5969cf77037aaae6f61f21513db1eadb41d51f0e77adf530d721c7b56
3
+ metadata.gz: 5c500abb487503fbb580ad3b346853e287b113d5bbc16dc899fabe85e6dba81a
4
+ data.tar.gz: d5a17838abad1725ae67669b923f1da6d7b5e40cd2140bb4ad0a27f1295895f8
5
5
  SHA512:
6
- metadata.gz: 927134fe2799bac4d9e2ffeac01278a1dec4bd7047cc7fc081bba36744f4d3a0e167864db3bad7d0aa2bd5265876b1d7ff5224790b9710d88951652b94f66f9a
7
- data.tar.gz: cd3d458b4685fc9bcbbaa44d7189eb230007269ea84033ed6478ba71c6133c0cb29d6310ed7dd2a0dfd1dffa0227e2570dd17cecea34f270dfee2b55acd62581
6
+ metadata.gz: 7c497e495c3011c9ed626b23324c78e24b2b838f9745d918bd2c059272e367cc75add9fd4063c59ff55dfe5cba101b3afd3306fff722b874daa262e0d3e2b67c
7
+ data.tar.gz: 83214aeeb0dc8f65341567e7ecf4a02534387c1c4118d8d49bdf5d8aa92f7d8f2bdfb632f4b4dfb6ab9148dd058b8b7077ace8f7822b77f1ecd2ac805d119a2a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart-period (1.0.4)
4
+ smart-period (1.0.6)
5
5
  activesupport (>= 5, < 7)
6
6
  i18n (~> 1)
7
7
 
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # Smart-Period
1
+ # Smart-Period [![Gem Version](https://badge.fury.io/rb/smart-period.svg)](https://badge.fury.io/rb/smart-period) [![Code Climate](https://codeclimate.com/github/billaul/period.svg)](https://codeclimate.com/github/billaul/period) [![Inline docs](http://inch-ci.org/github/billaul/period.svg)](http://inch-ci.org/github/billaul/period)
2
2
 
3
- Smart-Period aims to simplify Time-range manipulation
3
+ ⚠️ This gem will no longer receive any updates
4
+ ⚠️ If you want to access to new awesome features, like endless-period support :hushed:
5
+ ⚠️ Take a look to his successor [ActivePeriod](https://github.com/billaul/active_period) 🥳
6
+
7
+ Smart-Period aims to simplify Time-range manipulation.
4
8
 
5
9
  ## Installation
6
10
 
@@ -16,11 +20,11 @@ And then execute:
16
20
 
17
21
  Or install it yourself as:
18
22
 
19
- $ gem install period
23
+ $ gem install smart-period
20
24
 
21
25
  ## Usage
22
26
 
23
- **Smart-Period** was designed to simplify time-range manipulation, specialy with rails (~> 5) and user input
27
+ **Smart-Period** was designed to simplify time-range manipulation, specialy with rails and user input
24
28
 
25
29
  **Warning** :
26
30
  - A time-range take place between two date and it's different from an abstract duration of time
@@ -29,14 +33,20 @@ Or install it yourself as:
29
33
 
30
34
  ## Quick view (TL;DR)
31
35
  ``` ruby
36
+ require 'period'
37
+
32
38
  # Get all user created today
33
39
  User.where(created_at: Period.today)
40
+
34
41
  # Get how many weeks there is from the beginning of time ?
35
42
  Period.new('01/01/1970'..Time.now).weeks.count
43
+
36
44
  # Is Trump still in charge ?
37
45
  Time.now.in? Period.new('20/01/2017'...'20/01/2021')
46
+
38
47
  # Get the week of an arbitrary date
39
48
  Period.week('24/04/1990')
49
+
40
50
  # Write a date for me (I18n supported)
41
51
  Period.new('20/01/2017'...'20/01/2021').to_s
42
52
  => "From the 20 January 2017 to the 19 January 2021 included"
@@ -179,7 +189,7 @@ In a Controller, use the error handling to validate the date for you
179
189
  ```ruby
180
190
  class BookController < ApplicationController
181
191
  def between # match via GET and POST
182
- # Default value for the range in GET context
192
+ # Default value for first display
183
193
  params[:from] ||= 1.month.ago
184
194
  params[:to] ||= Time.now
185
195
 
@@ -188,7 +198,7 @@ class BookController < ApplicationController
188
198
  @books = Book.where(published: Period.new(params[:from]..params[:to]))
189
199
  rescue ArgumentError => e
190
200
  # Period will handle mis-formatted date and incoherent period
191
- # I18n is support for errors messages
201
+ # I18n is supported for errors messages
192
202
  flash[:alert] = e.message
193
203
  end
194
204
  end
@@ -255,11 +265,6 @@ No issues will be addressed outside GitHub
255
265
 
256
266
  * Myself (https://github.com/billaul)
257
267
 
258
- [![Gem Version](https://fury-badge.herokuapp.com/rb/smart-period.png)](http://badge.fury.io/rb/smart-period)
259
- [![Code Climate](https://codeclimate.com/github/billaul/period.png)](https://codeclimate.com/github/billaul/period)
260
- [![Inline docs](http://inch-ci.org/github/billaul/period.png)](http://inch-ci.org/github/billaul/period)
261
-
262
-
263
268
  ## License
264
269
 
265
270
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
File without changes
File without changes
data/lib/period.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  require_relative 'period/version.rb'
2
2
  require 'active_support/all'
3
3
  require 'i18n'
4
- require_relative 'numeric.rb'
5
4
 
5
+ I18n.load_path << File.expand_path("../config/locales/en.yml", __dir__)
6
+ I18n.load_path << File.expand_path("../config/locales/fr.yml", __dir__)
7
+
8
+ require_relative 'numeric.rb'
6
9
  require_relative 'period/free_period.rb'
7
10
  require_relative 'period/day.rb'
8
11
  require_relative 'period/week.rb'
@@ -5,9 +5,6 @@ require_relative 'has_many/months.rb'
5
5
  require_relative 'has_many/quarters.rb'
6
6
  require_relative 'has_many/years.rb'
7
7
 
8
- I18n.load_path << 'locales/fr.yml'
9
- I18n.load_path << 'locales/en.yml'
10
-
11
8
  class Period::FreePeriod < Range
12
9
  include Comparable
13
10
 
@@ -1,5 +1,5 @@
1
1
  module Period
2
2
 
3
- VERSION = '1.0.5'.freeze
3
+ VERSION = '1.0.11'.freeze
4
4
 
5
5
  end
data/period.gemspec CHANGED
@@ -6,13 +6,27 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'smart-period'
7
7
  spec.version = Period::VERSION
8
8
  spec.authors = ['billau_l']
9
- spec.email = ['billau_l@modulotech.fr']
10
9
 
11
- spec.summary = 'Manage time ranges without brain damage.'
10
+ spec.summary = <<~eos
11
+ Manage time ranges without brain damage
12
+
13
+ DISCONTINUED DEVELOPMENT WARNING
14
+ The SmartPeriod gem will no longer receive any updates
15
+ If you want to access to new awesome features, like endless-period
16
+ Take a look to his successor ActivePeriod
17
+ eos
12
18
  # spec.description = "Period.new('01/01/2020'..Time.now)"
13
19
  spec.homepage = "https://github.com/billaul/period"
14
20
  spec.license = 'MIT'
15
21
 
22
+ spec.post_install_message = <<~eos
23
+ +-| DISCONTINUED DEVELOPMENT WARNING |--------------------------------+
24
+ | The SmartPeriod gem will no longer receive any updates |
25
+ | If you want to access to new awesome features, like endless-period |
26
+ | Take a look to his successor ActivePeriod |
27
+ +---------------------------------------------------------------------+
28
+ eos
29
+
16
30
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
31
  # to allow pushing to a single host or delete this section to allow pushing to any host.
18
32
  if spec.respond_to?(:metadata)
@@ -35,9 +49,9 @@ Gem::Specification.new do |spec|
35
49
  end
36
50
  spec.bindir = 'exe'
37
51
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = %w[lib locals]
52
+ spec.require_paths = %w[lib config]
39
53
 
40
- spec.required_ruby_version = '> 2.5'
54
+ spec.required_ruby_version = '>= 2.5'
41
55
  spec.add_runtime_dependency 'activesupport', '>= 5', '< 7'
42
56
  spec.add_runtime_dependency 'i18n', '~> 1'
43
57
  spec.add_development_dependency 'bundler', '~> 2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart-period
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - billau_l
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-26 00:00:00.000000000 Z
11
+ date: 2021-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -74,7 +74,6 @@ dependencies:
74
74
  version: '10.0'
75
75
  description:
76
76
  email:
77
- - billau_l@modulotech.fr
78
77
  executables: []
79
78
  extensions: []
80
79
  extra_rdoc_files: []
@@ -87,6 +86,8 @@ files:
87
86
  - Rakefile
88
87
  - bin/console
89
88
  - bin/setup
89
+ - config/locales/en.yml
90
+ - config/locales/fr.yml
90
91
  - lib/.DS_Store
91
92
  - lib/numeric.rb
92
93
  - lib/period.rb
@@ -109,8 +110,6 @@ files:
109
110
  - lib/period/version.rb
110
111
  - lib/period/week.rb
111
112
  - lib/period/year.rb
112
- - locales/en.yml
113
- - locales/fr.yml
114
113
  - period.gemspec
115
114
  homepage: https://github.com/billaul/period
116
115
  licenses:
@@ -120,14 +119,19 @@ metadata:
120
119
  homepage_uri: https://github.com/billaul/period
121
120
  documentation_uri: https://github.com/billaul/period
122
121
  source_code_uri: https://github.com/billaul/period
123
- post_install_message:
122
+ post_install_message: |
123
+ +-| DISCONTINUED DEVELOPMENT WARNING |--------------------------------+
124
+ | The SmartPeriod gem will no longer receive any updates |
125
+ | If you want to access to new awesome features, like endless-period |
126
+ | Take a look to his successor ActivePeriod |
127
+ +---------------------------------------------------------------------+
124
128
  rdoc_options: []
125
129
  require_paths:
126
130
  - lib
127
- - locals
131
+ - config
128
132
  required_ruby_version: !ruby/object:Gem::Requirement
129
133
  requirements:
130
- - - ">"
134
+ - - ">="
131
135
  - !ruby/object:Gem::Version
132
136
  version: '2.5'
133
137
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -139,5 +143,7 @@ requirements: []
139
143
  rubygems_version: 3.1.2
140
144
  signing_key:
141
145
  specification_version: 4
142
- summary: Manage time ranges without brain damage.
146
+ summary: Manage time ranges without brain damage DISCONTINUED DEVELOPMENT WARNING
147
+ The SmartPeriod gem will no longer receive any updates If you want to access to
148
+ new awesome features, like endless-period Take a look to his successor ActivePeriod
143
149
  test_files: []