ows-queries 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 47025aa36fab4e5475048c6bc0c3b1102ec6ba88612354268fe54e2bc5f7fa4d
4
+ data.tar.gz: '01482bada274d380e2ac651b31eb39e81014a50b8a78f83d8c2071ce8b45e60a'
5
+ SHA512:
6
+ metadata.gz: 06b602cce20c640c429eb2257af33ce025a3f76d802837ca483017b945eb375cb95158b5ca1ef11706ec2729680118c1999005ba53a0bf2aaeeb392a06b94ff3
7
+ data.tar.gz: 7986b22c8ba33bc5e61906d5bb4d6bbe4c42dbbdd45bfcff01f207e268c903d05d55838afa010549b1edabec362bbfd131ebba2b792653590a5abf411c522dde
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --force-color
4
+ --order rand
data/.rubocop.yml ADDED
@@ -0,0 +1,24 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
4
+ - rubocop-rake
5
+
6
+ Documentation:
7
+ Enabled: false
8
+
9
+ Style/EmptyMethod:
10
+ Enabled: false
11
+
12
+ Style/SymbolArray:
13
+ Enabled: false
14
+
15
+ Style/WordArray:
16
+ Enabled: false
17
+
18
+ AllCops:
19
+ NewCops: enable
20
+ TargetRubyVersion: 2.7
21
+ Exclude:
22
+ - bin/**/*
23
+ - vendor/**/*
24
+ - lib/generators/ows/query/*/templates/**/*.rb
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.4
data/CHANGES ADDED
@@ -0,0 +1,15 @@
1
+ Version 0.1.2:
2
+ - Remove gem kaminari
3
+
4
+ Version 0.1.1:
5
+ - Adiciona metodo empty_relation
6
+ - Adiciona gem kaminari
7
+
8
+ Version 0.1.0
9
+ - Cria build da gem
10
+ - Remove arquivos de template do check do rubocop
11
+ - Adiciona comando dos geradores na documentação
12
+ - Implementa geradores de classes query
13
+ - Implementar classe application query
14
+ - Cria gem application query
15
+
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ group :development, :test do
8
+ # https://github.com/rubocop-hq/rubocop#quickstart
9
+ gem 'rubocop', '~> 1.22', '>= 1.22.3'
10
+ # https://github.com/backus/rubocop-rspec
11
+ gem 'rubocop-rspec', '~> 2.6'
12
+ # https://github.com/rubocop-hq/rubocop-performance/#usage
13
+ gem 'rubocop-performance', '~> 1.12'
14
+ # https://github.com/rubocop/rubocop-rake#usage
15
+ gem 'rubocop-rake', '~> 0.6.0'
16
+ # https://github.com/rspec/rspec#install
17
+ gem 'rspec', '~> 3.10'
18
+ # https://github.com/pry/pry#installation
19
+ gem 'pry', '~> 0.14.1'
20
+ # https://github.com/presidentbeef/brakeman
21
+ gem 'brakeman', '~> 5.1', '>= 5.1.2', require: false
22
+ # https://github.com/rails/rails/tree/master/activesupport#download-and-installation
23
+ gem 'activesupport', '~> 6.1', '>= 6.1.4.1'
24
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,126 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ows-queries (0.1.5)
5
+ kaminari
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionview (6.1.4.1)
11
+ activesupport (= 6.1.4.1)
12
+ builder (~> 3.1)
13
+ erubi (~> 1.4)
14
+ rails-dom-testing (~> 2.0)
15
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
16
+ activemodel (6.1.4.1)
17
+ activesupport (= 6.1.4.1)
18
+ activerecord (6.1.4.1)
19
+ activemodel (= 6.1.4.1)
20
+ activesupport (= 6.1.4.1)
21
+ activesupport (6.1.4.1)
22
+ concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ i18n (>= 1.6, < 2)
24
+ minitest (>= 5.1)
25
+ tzinfo (~> 2.0)
26
+ zeitwerk (~> 2.3)
27
+ ast (2.4.2)
28
+ brakeman (5.1.2)
29
+ builder (3.2.4)
30
+ coderay (1.1.3)
31
+ concurrent-ruby (1.1.9)
32
+ crass (1.0.6)
33
+ diff-lcs (1.4.4)
34
+ erubi (1.10.0)
35
+ i18n (1.8.11)
36
+ concurrent-ruby (~> 1.0)
37
+ kaminari (1.2.1)
38
+ activesupport (>= 4.1.0)
39
+ kaminari-actionview (= 1.2.1)
40
+ kaminari-activerecord (= 1.2.1)
41
+ kaminari-core (= 1.2.1)
42
+ kaminari-actionview (1.2.1)
43
+ actionview
44
+ kaminari-core (= 1.2.1)
45
+ kaminari-activerecord (1.2.1)
46
+ activerecord
47
+ kaminari-core (= 1.2.1)
48
+ kaminari-core (1.2.1)
49
+ loofah (2.12.0)
50
+ crass (~> 1.0.2)
51
+ nokogiri (>= 1.5.9)
52
+ method_source (1.0.0)
53
+ minitest (5.14.4)
54
+ nokogiri (1.12.5-x86_64-darwin)
55
+ racc (~> 1.4)
56
+ parallel (1.21.0)
57
+ parser (3.0.2.0)
58
+ ast (~> 2.4.1)
59
+ pry (0.14.1)
60
+ coderay (~> 1.1)
61
+ method_source (~> 1.0)
62
+ racc (1.6.0)
63
+ rails-dom-testing (2.0.3)
64
+ activesupport (>= 4.2.0)
65
+ nokogiri (>= 1.6)
66
+ rails-html-sanitizer (1.4.2)
67
+ loofah (~> 2.3)
68
+ rainbow (3.0.0)
69
+ rake (13.0.6)
70
+ regexp_parser (2.1.1)
71
+ rexml (3.2.5)
72
+ rspec (3.10.0)
73
+ rspec-core (~> 3.10.0)
74
+ rspec-expectations (~> 3.10.0)
75
+ rspec-mocks (~> 3.10.0)
76
+ rspec-core (3.10.1)
77
+ rspec-support (~> 3.10.0)
78
+ rspec-expectations (3.10.1)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.10.0)
81
+ rspec-mocks (3.10.2)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.10.0)
84
+ rspec-support (3.10.3)
85
+ rubocop (1.22.3)
86
+ parallel (~> 1.10)
87
+ parser (>= 3.0.0.0)
88
+ rainbow (>= 2.2.2, < 4.0)
89
+ regexp_parser (>= 1.8, < 3.0)
90
+ rexml
91
+ rubocop-ast (>= 1.12.0, < 2.0)
92
+ ruby-progressbar (~> 1.7)
93
+ unicode-display_width (>= 1.4.0, < 3.0)
94
+ rubocop-ast (1.13.0)
95
+ parser (>= 3.0.1.1)
96
+ rubocop-performance (1.12.0)
97
+ rubocop (>= 1.7.0, < 2.0)
98
+ rubocop-ast (>= 0.4.0)
99
+ rubocop-rake (0.6.0)
100
+ rubocop (~> 1.0)
101
+ rubocop-rspec (2.6.0)
102
+ rubocop (~> 1.19)
103
+ ruby-progressbar (1.11.0)
104
+ tzinfo (2.0.4)
105
+ concurrent-ruby (~> 1.0)
106
+ unicode-display_width (2.1.0)
107
+ zeitwerk (2.5.1)
108
+
109
+ PLATFORMS
110
+ x86_64-darwin-20
111
+
112
+ DEPENDENCIES
113
+ activesupport (~> 6.1, >= 6.1.4.1)
114
+ brakeman (~> 5.1, >= 5.1.2)
115
+ bundler (~> 2.0)
116
+ ows-queries!
117
+ pry (~> 0.14.1)
118
+ rake (~> 13.0)
119
+ rspec (~> 3.10)
120
+ rubocop (~> 1.22, >= 1.22.3)
121
+ rubocop-performance (~> 1.12)
122
+ rubocop-rake (~> 0.6.0)
123
+ rubocop-rspec (~> 2.6)
124
+
125
+ BUNDLED WITH
126
+ 2.2.28
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # OWS::Queries
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'ows-queries', '~> 0.1.5'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ ```bash
14
+ bundle install
15
+ ```
16
+
17
+ Or install it yourself as:
18
+
19
+ ```bash
20
+ gem install ows-queries
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ You can use a Rails generator to create `ApplicationQuery`:
26
+
27
+ ```bash
28
+ rails g ows:query:install
29
+ ```
30
+
31
+ And you can use a Rails generator to create query classes:
32
+
33
+
34
+ ```bash
35
+ rails g ows:query:create UsersByEmail User
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and merge requests are welcome on GitLab at https://gitlab.com/[USERNAME]/ows-queries.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
data/bin/brakeman ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'brakeman' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("brakeman", "brakeman")
data/bin/bundle ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1 || ">= 0.a"
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||= begin
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version || "#{Gem::Requirement.default}.a"
67
+ end
68
+ end
69
+
70
+ def load_bundler!
71
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
72
+
73
+ # must dup string for RG < 1.8 compatibility
74
+ activate_bundler(bundler_version.dup)
75
+ end
76
+
77
+ def activate_bundler(bundler_version)
78
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
+ bundler_version = "< 2"
80
+ end
81
+ gem_error = activation_error_handling do
82
+ gem "bundler", bundler_version
83
+ end
84
+ return if gem_error.nil?
85
+ require_error = activation_error_handling do
86
+ require "bundler/version"
87
+ end
88
+ return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
+ warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90
+ exit 42
91
+ end
92
+
93
+ def activation_error_handling
94
+ yield
95
+ nil
96
+ rescue StandardError, LoadError => e
97
+ e
98
+ end
99
+ end
100
+
101
+ m.load_bundler!
102
+
103
+ if m.invoked_as_script?
104
+ load Gem.bin_path("bundler", "bundle")
105
+ end
data/bin/ci ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo -e "\e[1;36m$ bin/brakeman --force-scan \e[0m"
6
+ bin/brakeman --force-scan
7
+
8
+ echo -e "\e[1;36m$ bin/rubocop \e[0m"
9
+ bin/rubocop
10
+
11
+ echo -e "\e[1;36m$ bin/rspec \e[0m"
12
+ bin/rspec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ows/queries"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails g interage:query:create UsersByPerson User
6
+
7
+ This will create:
8
+ /app/queries/users_by_person_query.rb
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ows
4
+ module Query
5
+ module Generators
6
+ class CreateGenerator < Rails::Generators::NamedBase
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ desc 'Generates a query.'
10
+
11
+ def initialize(args, *_options)
12
+ super
13
+
14
+ @query_name = args[0].camelize
15
+ @model_name = args[1].camelize
16
+ end
17
+
18
+ def create_query
19
+ create_file Rails.root.join("app/queries/#{file_name}_query.rb"),
20
+ sample_file.gsub('{{QUERY_NAME}}', query_name)
21
+ .gsub('{{MODEL_NAME}}', model_name)
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :query_name, :model_name
27
+
28
+ def sample_file
29
+ File.read(File.expand_path('templates/sample_query.rb', __dir__))
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class {{QUERY_NAME}}Query < ApplicationQuery
4
+ def initialize
5
+ @relation = {{MODEL_NAME}}.order(created_at: :desc)
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails g interage:query:install
6
+
7
+ This will create:
8
+ /app/queries/application_query.rb
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ows
4
+ module Query
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('templates', __dir__)
7
+
8
+ desc 'Generates a application query.'
9
+
10
+ def create_application_query
11
+ copy_file 'application_query.rb', application_query_path
12
+ end
13
+
14
+ private
15
+
16
+ def application_query_path
17
+ Rails.root.join('app/queries/application_query.rb')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationQuery < ::OWS::ApplicationQuery
4
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OWS
4
+ class ApplicationQuery
5
+ DEFAULT_PER_PAGE = 50
6
+
7
+ delegate :first, :last, :find, :find_by, :find_by!, :pluck, :count, :limit,
8
+ :any?, :exists?, to: :relation
9
+
10
+ def initialize
11
+ init_relation
12
+ end
13
+
14
+ def init_relation
15
+ raise NotImplementedError, 'subclass did not define #init_relation'
16
+ end
17
+
18
+ def all
19
+ includes.relation
20
+ end
21
+
22
+ def distinct
23
+ @relation = relation.distinct
24
+
25
+ self
26
+ end
27
+
28
+ def build(attributes = {})
29
+ all.new(attributes)
30
+ end
31
+
32
+ def paginate(page = 1)
33
+ all.page(page).per(current_per_page)
34
+ end
35
+
36
+ def search_ilike_for(colums, term)
37
+ return self unless term
38
+
39
+ params = { t: "%#{term.to_s.downcase}%" }
40
+ colums = colums.map { |colum| "unaccent(#{colum}) ILIKE unaccent(:t)" }
41
+ @relation = relation.where(colums.join(' OR '), params)
42
+
43
+ self
44
+ end
45
+
46
+ def between_dates(column, start_date, finish_date = nil)
47
+ start_date = Date.current if start_date.blank?
48
+ finish_date = start_date if finish_date.blank?
49
+ range_date =
50
+ start_date.to_date.beginning_of_day..finish_date.to_date.end_of_day
51
+
52
+ @relation = relation.where(column => range_date)
53
+
54
+ self
55
+ end
56
+
57
+ def by_id(id)
58
+ @relation = relation.where(id: id) if id.present?
59
+
60
+ self
61
+ end
62
+
63
+ def includes
64
+ self
65
+ end
66
+
67
+ def decorate
68
+ @relation = ActiveDecorator::Decorator.instance.decorate(relation)
69
+
70
+ self
71
+ end
72
+
73
+ protected
74
+
75
+ attr_accessor :relation
76
+
77
+ def empty_relation
78
+ @relation = relation.none
79
+
80
+ self
81
+ end
82
+
83
+ def current_per_page
84
+ DEFAULT_PER_PAGE
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OWS
4
+ module Queries
5
+ VERSION = '0.1.5'
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ows/queries/version'
4
+ require 'active_support/core_ext/module'
5
+
6
+ require 'kaminari'
7
+
8
+ module OWS
9
+ module Queries
10
+ class Error < StandardError
11
+ end
12
+ end
13
+
14
+ autoload :ApplicationQuery, 'ows/application_query'
15
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'ows/queries/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'ows-queries'
9
+ spec.version = OWS::Queries::VERSION
10
+ spec.authors = ['Walmir Neto']
11
+ spec.email = ['owalmirneto@gmail.com']
12
+
13
+ spec.summary = 'Application Query for OWS'
14
+ spec.description = 'Classes to encapsulate queries'
15
+ spec.homepage = 'https://github.com/ows-apps/queries'
16
+ spec.licenses = ['MIT']
17
+
18
+ spec.required_ruby_version = '>= 2.7'
19
+
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
+
23
+ spec.metadata['homepage_uri'] = spec.homepage
24
+ spec.metadata['source_code_uri'] = spec.homepage
25
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGES"
26
+ else
27
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
28
+ 'public gem pushes.'
29
+ end
30
+
31
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
32
+ `git ls-files -z`.split("\x0").reject do |file|
33
+ file.match(%r{^(test|spec|features)/}) || file.split('.').last == 'gem'
34
+ end
35
+ end
36
+ spec.bindir = 'exe'
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ['lib']
39
+
40
+ spec.add_development_dependency 'bundler', '~> 2.0'
41
+ spec.add_development_dependency 'rake', '~> 13.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.0'
43
+
44
+ spec.add_dependency 'kaminari', '>= 0'
45
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ows-queries
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Walmir Neto
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '13.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: kaminari
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Classes to encapsulate queries
70
+ email:
71
+ - owalmirneto@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".editorconfig"
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".rubocop.yml"
80
+ - ".ruby-version"
81
+ - CHANGES
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ - README.md
85
+ - Rakefile
86
+ - VERSION
87
+ - bin/brakeman
88
+ - bin/bundle
89
+ - bin/ci
90
+ - bin/console
91
+ - bin/rspec
92
+ - bin/rubocop
93
+ - bin/setup
94
+ - lib/generators/ows/query/create/USAGE
95
+ - lib/generators/ows/query/create/create_generator.rb
96
+ - lib/generators/ows/query/create/templates/sample_query.rb
97
+ - lib/generators/ows/query/install/USAGE
98
+ - lib/generators/ows/query/install/install_generator.rb
99
+ - lib/generators/ows/query/install/templates/application_query.rb
100
+ - lib/ows/application_query.rb
101
+ - lib/ows/queries.rb
102
+ - lib/ows/queries/version.rb
103
+ - ows-queries.gemspec
104
+ homepage: https://github.com/ows-apps/queries
105
+ licenses:
106
+ - MIT
107
+ metadata:
108
+ allowed_push_host: https://rubygems.org
109
+ homepage_uri: https://github.com/ows-apps/queries
110
+ source_code_uri: https://github.com/ows-apps/queries
111
+ changelog_uri: https://github.com/ows-apps/queries/blob/master/CHANGES
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '2.7'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubygems_version: 3.2.28
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Application Query for OWS
131
+ test_files: []