jpie 2.1.4 → 2.1.5

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: 23a1e7f0dd69ee73d5a8f684ac39005fca7081222517086e5f708ffd8ca7815b
4
- data.tar.gz: c2ae85e3db1522db8891a6ec0cba3956af94993e1658bdbe0e2a517af9954740
3
+ metadata.gz: e03bce6fffc1ed66774e89f660afda17460b6d837b07f549b8c17698d252dccd
4
+ data.tar.gz: 7a8ea2397e9ebfab913bfd7a4e13cab637b4e7fcc7829e7e16e37da019c5fd3e
5
5
  SHA512:
6
- metadata.gz: 2fa70259c383d4f694f0071384f3b9a8f6f46e3b26765644bbaa45045c4be86454ba9a934b1ec79f9571f1846ae54cdd3b61ec439ba9c000155ee74feaeef1f8
7
- data.tar.gz: 3b00c7a05a52bc30b81109a09e95c65cdd6602facba9e8c92b0011ca3a6b3cc0eecb4da2b15704a5d2df03325b70f3aed474988034cefdd7111089815eab8e39
6
+ metadata.gz: 27dc32299a441b790c9ae4f3890ad5f12f492d5a2027f1f4a0929923a79cbbaf1b1d78746e29d033c2ee85e4d9bf5c1dae24051d2f447eff5bea50a2a36c28b9
7
+ data.tar.gz: 7fc2d6613e25d73ec7abaafc7dfe5066c9a7a4b79ea0ffc326964f114a3203909382ee68a62ee507617302309ad7517eb01f92ef4e28f2facd208e9cda769dad
data/bin/release ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ VERSION_FILE = File.expand_path("../../lib/json_api/version.rb", __FILE__)
5
+
6
+ bump_type = ARGV[0]
7
+
8
+ unless %w[major minor patch].include?(bump_type)
9
+ abort "Usage: bin/release [major|minor|patch]"
10
+ end
11
+
12
+ content = File.read(VERSION_FILE)
13
+ current = content.match(/VERSION\s*=\s*["'](.+?)["']/)[1]
14
+ parts = current.split(".").map(&:to_i)
15
+
16
+ new_version = case bump_type
17
+ when "major" then [parts[0] + 1, 0, 0]
18
+ when "minor" then [parts[0], parts[1] + 1, 0]
19
+ when "patch" then [parts[0], parts[1], parts[2] + 1]
20
+ end.join(".")
21
+
22
+ File.write(VERSION_FILE, content.gsub(/VERSION\s*=\s*["'].+?["']/, %(VERSION = "#{new_version}")))
23
+
24
+ puts "Bumped #{current} → #{new_version}"
25
+
26
+ system("git add #{VERSION_FILE}")
27
+ system(%(git commit -m "Bump version to #{new_version}"))
28
+
29
+ print "OTP code: "
30
+ ENV["GEM_HOST_OTP_CODE"] = $stdin.gets.strip
31
+
32
+ exec("rake release")
@@ -117,10 +117,8 @@ module JSONAPI
117
117
  end
118
118
  end
119
119
 
120
- def valid_sort_fields_for_resource(resource_class, model_class)
121
- model_columns = model_class.column_names.map(&:to_sym)
122
- resource_sortable_fields = resource_class.permitted_sortable_fields.map(&:to_sym)
123
- (model_columns + resource_sortable_fields).uniq.map(&:to_s)
120
+ def valid_sort_fields_for_resource(resource_class)
121
+ resource_class.permitted_sortable_fields.map(&:to_s)
124
122
  end
125
123
  end
126
124
  end
@@ -92,7 +92,7 @@ module JSONAPI
92
92
 
93
93
  def validate_sort_fields_for_association(sorts, association)
94
94
  resource_class = ResourceLoader.find_for_model(association.klass)
95
- valid_fields = valid_sort_fields_for_resource(resource_class, association.klass)
95
+ valid_fields = valid_sort_fields_for_resource(resource_class)
96
96
  invalid_fields = invalid_sort_fields_for_columns(sorts, valid_fields)
97
97
  return if invalid_fields.empty?
98
98
 
@@ -17,7 +17,7 @@ module JSONAPI
17
17
  sorts = parse_sort_param
18
18
  return if sorts.empty?
19
19
 
20
- valid = valid_sort_fields_for_resource(@resource_class, model_class)
20
+ valid = valid_sort_fields_for_resource(@resource_class)
21
21
  invalid = invalid_sort_fields_for_columns(sorts, valid)
22
22
  render_sort_errors(invalid) if invalid.any?
23
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONAPI
4
- VERSION = "2.1.4"
4
+ VERSION = "2.1.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpie
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Kampp
@@ -103,6 +103,7 @@ files:
103
103
  - README.md
104
104
  - Rakefile
105
105
  - bin/console
106
+ - bin/release
106
107
  - bin/setup
107
108
  - jpie.gemspec
108
109
  - lib/jpie.rb