wor-paginate 0.1.2 → 0.1.3

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: c132c5ed81ed0fd7a10865503489da20b7e06c7c
4
- data.tar.gz: 5c0e32b0b192fe03e5db0ab25f0626add6d5d007
2
+ SHA256:
3
+ metadata.gz: c99e7bb3781f1c3e305dd123aaa3fad672787ac02eb6bf8073e52be5d5b08130
4
+ data.tar.gz: 8497655c0b8c3b909a5380efc4ab3fa9c17bc87546de590b575c7b18c378498e
5
5
  SHA512:
6
- metadata.gz: 4316e7c26ce31de56bcefae8633b4ccc6d475970e68df809abb741360eb71c81f17caa575a2cbc48ccff861212646e89f8f7f432c5ce10b3105d8f9ba56497c0
7
- data.tar.gz: 42aec48d35c8ecc52c5f23a50be685b8e88a78bc8218cbd681b420caaa220ac19f32d3e264365160af03879d6f7fc5963181f07ce6a42396c11de7d9fafb56dc
6
+ metadata.gz: 2fa5fc92aaa11e2a02861f1f73d4dc6f7978d9e9b8f59e00c46aac4ae2a8fd32951dd963a7d3b81bb7d31898a705ae6b45c884b150a2dca4de625d6c4e0d3892
7
+ data.tar.gz: 64500ef8fd9d06ab596d0fa40b5d75a1b3c7bcd2f6af505829f6120cdbe57c6663709a3dca1cd0f28e120a8c0a7266c11bfd43a3592b3fb49b4af18d170693f9
data/.gitignore CHANGED
@@ -13,6 +13,7 @@ spec/dummy/tmp/
13
13
  /spec/reports/
14
14
  /tmp/
15
15
  *.gem
16
+ Gemfile.lock
16
17
 
17
18
  # Created by https://www.gitignore.io/api/ruby,rubymine,rails,emacs,vim,sublimetext,osx,macos,linux,windows
18
19
 
@@ -3,13 +3,18 @@ rvm:
3
3
  - 2.2.2
4
4
  - 2.3.3
5
5
  - 2.4.0
6
+ - ruby-head
6
7
 
7
8
  install:
8
9
  - gem install bundler
10
+ - gem install danger --version '~> 5.0'
9
11
  - bundle install --retry=3
10
12
  - bundle exec rake db:migrate RAILS_ENV=test -f spec/dummy/Rakefile
11
13
 
14
+ before_script:
15
+ - danger
16
+
12
17
  script:
13
- - bundle exec rubocop --format simple
18
+ - bundle exec rubocop lib spec --format simple
14
19
  - bundle exec rspec
15
20
  - bundle exec codeclimate-test-reporter
@@ -1,2 +1,4 @@
1
+ ## Change log
1
2
 
2
- ## Change log
3
+ ### V0.1.2
4
+ * [#56](https://github.com/Wolox/wor-paginate/pull/56): Added automatic each serializer - [@hdf1986](https://github.com/hdf1986).
@@ -0,0 +1,69 @@
1
+ # Sometimes it's a README fix, or something like that - which isn't relevant for
2
+ # including in a project's CHANGELOG for example
3
+ declared_trivial = github.pr_title.include? "#trivial"
4
+ gemfile_changed = git.deleted_files.include?('Gemfile')
5
+ gemfile_lock_changed = git.deleted_files.include?('Gemfile.lock')
6
+
7
+ # Make it more obvious that a PR is a work in progress and shouldn't be merged yet
8
+ warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
9
+
10
+ # Warn when there is a big PR with more than 500 lines
11
+ warn("Big PR. If it's possible try to reduce this into smaller PR's") if git.lines_of_code > 500
12
+
13
+ # Warn when a PR is clased as work in progress
14
+ warn "PR is classed as Work in Progress" if github.pr_title.include? "[WIP]"
15
+
16
+ # Don't let testing shortcuts get into master by accident
17
+ fail("fdescribe left in tests") if `grep -r fdescribe specs/ `.length > 1
18
+ fail("fit left in tests") if `grep -r fit specs/ `.length > 1
19
+
20
+ # Ensure there's a summary on the pull request description
21
+ fail "Please provide a summary in the Pull Request description" if github.pr_body.length < 5
22
+
23
+ # Ensures that the PR is mergeable
24
+ can_merge = github.pr_json["mergeable"]
25
+ fail("This PR cannot be merged yet. Please fix the conflicts with the base branch", sticky: false) unless can_merge
26
+
27
+ # It fails when TODO's are present
28
+ todoist.message = "Please fix all TODOS"
29
+ todoist.fail_for_todos
30
+
31
+ # Check for changes in the CHANGELOG.md if the pr isn't trivial
32
+ unless declared_trivial
33
+ [
34
+ 'CHANGELOG.md'
35
+ ].each do |file_who_needs_change|
36
+ fail("#{file_who_needs_change} needs to be changed") unless git.modified_files.include?(file_who_needs_change)
37
+ end
38
+ end
39
+ # Fails when an important file is deleted or renamed
40
+ [
41
+ 'wor-paginate-gemspec',
42
+ 'README.md',
43
+ 'CHANGELOG.md',
44
+ '.gitignore',
45
+ '.travis.yml',
46
+ '.rubocop.yml'
47
+ ].each do |protected_file|
48
+ fail("#{protected_file} file shouldn't be deleted or renamed") if git.deleted_files.include?(protected_file) || git.renamed_files.include?(protected_file)
49
+ end
50
+
51
+ # Fails when a dangerous file is uploaded
52
+ [
53
+ '.ruby-version',
54
+ 'Gemfile.lock',
55
+ ].each do |protected_file|
56
+ fail("#{protected_file} file shouldn't be added") if git.added_files.include?(protected_file)
57
+ end
58
+
59
+ # Removes placeholder line
60
+ # Danger::Changelog.configure do |config|
61
+ # config.placeholder_line = nil
62
+ # end
63
+
64
+ # Check that bundle install where ran
65
+ # if gemfile_changed && !gemfile_lock_changed
66
+ # message = 'Changes were made to Gemfile, but not to Gemfile.lock';
67
+ # idea = 'Perhaps you need to run `bundle install`?';
68
+ # warn(`${message} - <i>${idea}</i>`);
69
+ # end
data/Gemfile CHANGED
@@ -18,7 +18,7 @@ group :development, :test do
18
18
  gem 'bundler', '~> 1.13'
19
19
  gem 'byebug', '~> 9.0'
20
20
  gem 'codeclimate-test-reporter', '~> 1.0.0'
21
- gem 'database_cleaner', '~> 1.5.0'
21
+ gem 'database_cleaner', '~> 1.6.0'
22
22
  gem 'factory_girl_rails', '~> 4.7.0'
23
23
  gem 'faker', '~> 1.7.0'
24
24
  gem 'generator_spec', '~> 0.9.0'
@@ -33,3 +33,8 @@ group :development, :test do
33
33
  gem 'webmock', '~> 3.0.0'
34
34
  gem 'will_paginate', '~> 3.1.0'
35
35
  end
36
+
37
+ group :test do
38
+ gem 'danger'
39
+ gem 'danger-todoist'
40
+ end
@@ -32,8 +32,13 @@ module Wor
32
32
  end
33
33
 
34
34
  def serialized_content
35
- return paginated_content.as_json if serializer.blank?
36
- paginated_content.map { |item| serializer.new(item) }
35
+ return paginated_content.map { |item| serializer.new(item) } if serializer.present?
36
+
37
+ if defined? ActiveModelSerializers::SerializableResource
38
+ ActiveModelSerializers::SerializableResource.new(paginated_content).as_json
39
+ else
40
+ paginated_content.as_json
41
+ end
37
42
  end
38
43
 
39
44
  def serializer
@@ -1,5 +1,5 @@
1
1
  module Wor
2
2
  module Paginate
3
- VERSION = '0.1.2'.freeze
3
+ VERSION = '0.1.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wor-paginate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - hdf1986
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-06-18 00:00:00.000000000 Z
13
+ date: 2018-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -60,11 +60,10 @@ extra_rdoc_files: []
60
60
  files:
61
61
  - ".gitignore"
62
62
  - ".rubocop.yml"
63
- - ".ruby-version"
64
63
  - ".travis.yml"
65
64
  - CHANGELOG.md
65
+ - Dangerfile
66
66
  - Gemfile
67
- - Gemfile.lock
68
67
  - LICENSE.md
69
68
  - README.md
70
69
  - Rakefile
@@ -107,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  version: '0'
108
107
  requirements: []
109
108
  rubyforge_project:
110
- rubygems_version: 2.5.1
109
+ rubygems_version: 2.7.6
111
110
  signing_key:
112
111
  specification_version: 4
113
112
  summary: Simplified pagination for Rails API controllers
@@ -1 +0,0 @@
1
- 2.3.1