datewari 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bf4bf4a79564aa3543d05ee1aa60a4f615726538
4
- data.tar.gz: 89a58b9db6d661931f619365e3911c98b7b8b89d
2
+ SHA256:
3
+ metadata.gz: d4757bf96a70bad10143eb9c2b790b73d684c0053cd820ade449095cc185f53c
4
+ data.tar.gz: a5c23c968a696c0dd6a9217d4b7b3c1a8c0d68559019cd0370122ea8a4689417
5
5
  SHA512:
6
- metadata.gz: f4d2f499c621733fc876670d13116dea294f0c041e67267c93ac55744c7b904b10c63aa906719c7737b543dc7deb675c07c154bbb2428fb5c65b2bb0937efbb4
7
- data.tar.gz: 90c4156ec06c15657e2099e4f835e68045e0ec162ffeb6168624a45504c97a081c2cdbc35a8a5b17788f7bdc5f592461bee932a400883b617d76ed8517a916aa
6
+ metadata.gz: 4be75ff27c66c363c231bed355e1942e7abc82f48619fdd1e12685af9e35b6c7f48d34980f2ce2d46b980a65ae525428865e0e326ac4d95a8e6c7665e3bbc5eb
7
+ data.tar.gz: b4361ed839a63ee21015281b68a6af0a8ac075a907e885d2378a11d3a21e156ec96cc05e925fa92b1ceb9e25a24395f96b9317c3c4db9f59d016b01cf457ceba
@@ -0,0 +1,75 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-20.04
8
+ services:
9
+ postgres:
10
+ image: postgis/postgis:10-2.5
11
+ env:
12
+ POSTGRES_USER: postgres
13
+ POSTGRES_PASSWORD: postgres
14
+ ports:
15
+ - 5432:5432
16
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
17
+ mysql:
18
+ image: mysql:5.7
19
+ env:
20
+ MYSQL_ALLOW_EMPTY_PASSWORD: yes
21
+ ports:
22
+ - 3306:3306
23
+ options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ ruby: [2.4, 2.5, 2.6, 2.7, '3.0', 3.1]
28
+ gemfile: ['rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70']
29
+ database: ['mysql', 'postgresql', 'postgis']
30
+ exclude:
31
+ - ruby: 2.4
32
+ gemfile: rails60
33
+ - ruby: 2.4
34
+ gemfile: rails61
35
+ - ruby: 2.4
36
+ gemfile: rails70
37
+ - ruby: 2.5
38
+ gemfile: rails70
39
+ - ruby: 2.6
40
+ gemfile: rails70
41
+ - ruby: 3.0
42
+ gemfile: rails50
43
+ - ruby: 3.0
44
+ gemfile: rails51
45
+ - ruby: 3.0
46
+ gemfile: rails52
47
+ - ruby: 3.1
48
+ gemfile: rails50
49
+ - ruby: 3.1
50
+ gemfile: rails51
51
+ - ruby: 3.1
52
+ gemfile: rails52
53
+
54
+ name: ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}, ${{ matrix.database }}
55
+
56
+ env:
57
+ DATABASE: ${{ matrix.database }}
58
+ POSTGRES_USER: postgres
59
+ POSTGRES_PASSWORD: postgres
60
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
61
+
62
+ steps:
63
+ - uses: actions/checkout@v2
64
+ - uses: ruby/setup-ruby@v1
65
+ with:
66
+ ruby-version: ${{ matrix.ruby }}
67
+ bundler-cache: true
68
+ - name: Prepare test
69
+ run: |
70
+ cd spec/dummy
71
+ BUNDLE_GEMFILE=../../${{ env.BUNDLE_GEMFILE }} RAILS_ENV=test bundle exec rake db:create db:migrate db:seed
72
+ cd ../..
73
+ - name: Run test
74
+ run: |
75
+ bundle exec rspec
data/.gitignore CHANGED
@@ -1,12 +1,9 @@
1
1
  .bundle/
2
- .yardoc
3
2
  .project
4
3
  Gemfile.lock
5
- _yardoc/
6
4
  coverage/
7
- doc/
5
+ gemfiles/*.lock
8
6
  pkg/
9
- spec/reports/
10
7
  spec/dummy/config/database.yml
11
8
  spec/dummy/db/schema.rb
12
9
  spec/dummy/db/*.sqlite3
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # CHANGELOG
2
+
3
+ ## 1.1.0
4
+
5
+ * Drop support for ruby 2.3.
6
+
7
+ ## 1.0.3
8
+
9
+ * Support postgis adapter.
10
+
11
+ ## 1.0.2
12
+
13
+ * Support ruby 2.5 and rails 5.2.
14
+
15
+ ## 1.0.1
16
+
17
+ * Remove constant from included module.
18
+
19
+ ## 1.0.0
20
+
21
+ * First release.
data/Gemfile CHANGED
@@ -1,7 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "rails", "~> 5.1.0"
4
- gem "mysql2", "~> 0.4.4"
5
- gem "pg", "~> 0.18"
6
-
7
3
  gemspec
data/README.md CHANGED
@@ -4,7 +4,7 @@ An ActiveRecord extension to build date oriented pagination links such as monthl
4
4
 
5
5
  ## Dependencies
6
6
 
7
- * ruby 2.3+
7
+ * ruby 2.4+
8
8
  * rails 5.0+ (activerecord, activesupport, actionview)
9
9
 
10
10
  Following ActiveRecord adapters are supported:
data/datewari.gemspec CHANGED
@@ -24,9 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rails", ">= 5.0"
25
25
  spec.add_development_dependency "mysql2"
26
26
  spec.add_development_dependency "pg"
27
+ spec.add_development_dependency "activerecord-postgis-adapter"
27
28
  spec.add_development_dependency "rspec-rails"
28
- spec.add_development_dependency "rails-controller-testing"
29
29
  spec.add_development_dependency "simplecov"
30
- spec.add_development_dependency "pry-rails"
31
- spec.add_development_dependency "pry-byebug"
32
30
  end
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "rails", "~> 5.0.0"
4
- gem "mysql2", "~> 0.4.4"
4
+ gem "mysql2", "~> 0.5.0"
5
5
  gem "pg", "~> 0.18"
6
+ gem "activerecord-postgis-adapter", "~> 4.1"
6
7
 
7
8
  gemspec path: "../"
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem "rails", "~> 5.1.0"
4
- gem "mysql2", "~> 0.4.4"
4
+ gem "mysql2", "~> 0.5.0"
5
5
  gem "pg", "~> 0.18"
6
+ gem "activerecord-postgis-adapter", "~> 5.1"
6
7
 
7
8
  gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 5.2.0"
4
+
5
+ gemspec path: "../"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 6.0.0"
4
+ gem "psych", "~> 3.3.0"
5
+
6
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 6.1.0"
4
+
5
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails", "~> 7.0.1"
4
+
5
+ gemspec path: "../"
@@ -3,12 +3,10 @@ require_relative 'helper/parts_builder'
3
3
 
4
4
  module Datewari
5
5
  module Helper
6
- I18N_KEY = 'date_paginate'
7
-
8
6
  def date_paginate(rel, config = {})
9
7
  [:previous_label, :next_label, :page_gap, :link_separator,
10
8
  :yearly_format, :monthly_format, :weekly_format, :daily_format].each do |key|
11
- config[key] ||= I18n.t("#{I18N_KEY}.#{key}").html_safe
9
+ config[key] ||= I18n.t("date_paginate.#{key}").html_safe
12
10
  end
13
11
 
14
12
  config[:page_links] = true unless config.key?(:page_links)
@@ -23,7 +21,7 @@ module Datewari
23
21
 
24
22
  def date_page_entries_info(rel)
25
23
  paginator = rel.paginator
26
- i18n_key = "#{I18N_KEY}.page_entries_info"
24
+ i18n_key = "date_paginate.page_entries_info"
27
25
 
28
26
  content_tag :div, class: 'pageEntryInfo' do
29
27
  case paginator.pages.size
@@ -16,7 +16,7 @@ module Datewari
16
16
 
17
17
  def paginate(start_date, end_date)
18
18
  @rel.where("#{quoted_column} BETWEEN ? AND ?", start_date, end_date)
19
- .order("#{quoted_column} #{@order.to_s.upcase}")
19
+ .order(Arel.sql("#{quoted_column} #{@order.to_s.upcase}"))
20
20
  end
21
21
 
22
22
  def total_entries
@@ -59,8 +59,8 @@ module Datewari
59
59
  @rel.limit(nil)
60
60
  .offset(nil)
61
61
  .group(date_sql)
62
- .reorder("#{date_sql} #{@order}")
63
- .pluck(date_sql)
62
+ .reorder(Arel.sql("#{date_sql} #{@order}"))
63
+ .pluck(Arel.sql(date_sql))
64
64
  end
65
65
  end
66
66
  end
@@ -26,7 +26,7 @@ module Datewari
26
26
  @scope = options[:scope].to_sym
27
27
 
28
28
  @query = case rel.klass.connection.adapter_name
29
- when 'PostgreSQL'
29
+ when 'PostgreSQL', 'PostGIS'
30
30
  require_relative 'paginator/postgresql'
31
31
  Postgresql.new(rel, column, order, options)
32
32
  when 'Mysql2'
@@ -1,3 +1,3 @@
1
1
  module Datewari
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datewari
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rspec-rails
98
+ name: activerecord-postgis-adapter
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rails-controller-testing
112
+ name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -136,34 +136,6 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: pry-rails
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: pry-byebug
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
139
  description: An ActiveRecord extension to build date oriented pagination links such
168
140
  as monthly pages and weekly pages
169
141
  email:
@@ -172,9 +144,10 @@ executables: []
172
144
  extensions: []
173
145
  extra_rdoc_files: []
174
146
  files:
147
+ - ".github/workflows/ci.yml"
175
148
  - ".gitignore"
176
149
  - ".rspec"
177
- - ".travis.yml"
150
+ - CHANGELOG.md
178
151
  - CODE_OF_CONDUCT.md
179
152
  - Gemfile
180
153
  - LICENSE
@@ -183,6 +156,10 @@ files:
183
156
  - datewari.gemspec
184
157
  - gemfiles/rails50.gemfile
185
158
  - gemfiles/rails51.gemfile
159
+ - gemfiles/rails52.gemfile
160
+ - gemfiles/rails60.gemfile
161
+ - gemfiles/rails61.gemfile
162
+ - gemfiles/rails70.gemfile
186
163
  - lib/datewari.rb
187
164
  - lib/datewari/helper.rb
188
165
  - lib/datewari/helper/link_renderer.rb
@@ -214,8 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
191
  - !ruby/object:Gem::Version
215
192
  version: '0'
216
193
  requirements: []
217
- rubyforge_project:
218
- rubygems_version: 2.5.2.2
194
+ rubygems_version: 3.1.2
219
195
  signing_key:
220
196
  specification_version: 4
221
197
  summary: An ActiveRecord extension to build date oriented pagination links
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3
4
- - 2.4
5
- services:
6
- - mysql
7
- - postgresql
8
- addons:
9
- postgresql: "9.5"
10
- env:
11
- - DATABASE=mysql
12
- - DATABASE=postgresql
13
- gemfile:
14
- - gemfiles/rails50.gemfile
15
- - gemfiles/rails51.gemfile
16
- before_script:
17
- - cd spec/dummy
18
- - bundle exec rake db:create db:migrate db:seed RAILS_ENV=test
19
- - cd ../..
20
- script: bundle exec rspec