active_model_serializers 0.10.9 → 0.10.13

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.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -2
  3. data/README.md +18 -19
  4. data/lib/action_controller/serialization.rb +9 -1
  5. data/lib/active_model/serializer/collection_serializer.rb +11 -2
  6. data/lib/active_model/serializer/concerns/caching.rb +2 -1
  7. data/lib/active_model/serializer/fieldset.rb +1 -1
  8. data/lib/active_model/serializer/reflection.rb +4 -4
  9. data/lib/active_model/serializer/version.rb +1 -1
  10. data/lib/active_model/serializer.rb +13 -4
  11. data/lib/active_model_serializers/adapter/attributes.rb +21 -0
  12. data/lib/active_model_serializers/adapter/json_api/pagination_links.rb +5 -1
  13. data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +1 -1
  14. data/lib/active_model_serializers/model/caching.rb +26 -0
  15. metadata +20 -292
  16. data/.github/ISSUE_TEMPLATE.md +0 -29
  17. data/.github/PULL_REQUEST_TEMPLATE.md +0 -15
  18. data/.gitignore +0 -35
  19. data/.rubocop.yml +0 -109
  20. data/.simplecov +0 -110
  21. data/.travis.yml +0 -63
  22. data/CODE_OF_CONDUCT.md +0 -74
  23. data/CONTRIBUTING.md +0 -105
  24. data/Gemfile +0 -74
  25. data/Rakefile +0 -76
  26. data/active_model_serializers.gemspec +0 -64
  27. data/appveyor.yml +0 -28
  28. data/bin/bench +0 -171
  29. data/bin/bench_regression +0 -316
  30. data/bin/rubocop +0 -38
  31. data/bin/serve_benchmark +0 -39
  32. data/docs/README.md +0 -41
  33. data/docs/STYLE.md +0 -58
  34. data/docs/general/adapters.md +0 -269
  35. data/docs/general/caching.md +0 -58
  36. data/docs/general/configuration_options.md +0 -185
  37. data/docs/general/deserialization.md +0 -100
  38. data/docs/general/fields.md +0 -31
  39. data/docs/general/getting_started.md +0 -133
  40. data/docs/general/instrumentation.md +0 -40
  41. data/docs/general/key_transforms.md +0 -40
  42. data/docs/general/logging.md +0 -21
  43. data/docs/general/rendering.md +0 -293
  44. data/docs/general/serializers.md +0 -495
  45. data/docs/how-open-source-maintained.jpg +0 -0
  46. data/docs/howto/add_pagination_links.md +0 -138
  47. data/docs/howto/add_relationship_links.md +0 -140
  48. data/docs/howto/add_root_key.md +0 -62
  49. data/docs/howto/grape_integration.md +0 -42
  50. data/docs/howto/outside_controller_use.md +0 -66
  51. data/docs/howto/passing_arbitrary_options.md +0 -27
  52. data/docs/howto/serialize_poro.md +0 -73
  53. data/docs/howto/test.md +0 -154
  54. data/docs/howto/upgrade_from_0_8_to_0_10.md +0 -265
  55. data/docs/integrations/ember-and-json-api.md +0 -147
  56. data/docs/integrations/grape.md +0 -19
  57. data/docs/jsonapi/errors.md +0 -56
  58. data/docs/jsonapi/schema/schema.json +0 -366
  59. data/docs/jsonapi/schema.md +0 -151
  60. data/docs/rfcs/0000-namespace.md +0 -106
  61. data/docs/rfcs/template.md +0 -15
  62. data/test/action_controller/adapter_selector_test.rb +0 -64
  63. data/test/action_controller/explicit_serializer_test.rb +0 -137
  64. data/test/action_controller/json/include_test.rb +0 -248
  65. data/test/action_controller/json_api/deserialization_test.rb +0 -114
  66. data/test/action_controller/json_api/errors_test.rb +0 -42
  67. data/test/action_controller/json_api/fields_test.rb +0 -68
  68. data/test/action_controller/json_api/linked_test.rb +0 -204
  69. data/test/action_controller/json_api/pagination_test.rb +0 -126
  70. data/test/action_controller/json_api/transform_test.rb +0 -191
  71. data/test/action_controller/lookup_proc_test.rb +0 -51
  72. data/test/action_controller/namespace_lookup_test.rb +0 -234
  73. data/test/action_controller/serialization_scope_name_test.rb +0 -237
  74. data/test/action_controller/serialization_test.rb +0 -480
  75. data/test/active_model_serializers/adapter_for_test.rb +0 -210
  76. data/test/active_model_serializers/json_pointer_test.rb +0 -24
  77. data/test/active_model_serializers/logging_test.rb +0 -79
  78. data/test/active_model_serializers/model_test.rb +0 -144
  79. data/test/active_model_serializers/railtie_test_isolated.rb +0 -70
  80. data/test/active_model_serializers/register_jsonapi_renderer_test_isolated.rb +0 -163
  81. data/test/active_model_serializers/serialization_context_test_isolated.rb +0 -73
  82. data/test/active_model_serializers/test/schema_test.rb +0 -133
  83. data/test/active_model_serializers/test/serializer_test.rb +0 -64
  84. data/test/active_record_test.rb +0 -11
  85. data/test/adapter/attributes_test.rb +0 -42
  86. data/test/adapter/deprecation_test.rb +0 -102
  87. data/test/adapter/json/belongs_to_test.rb +0 -47
  88. data/test/adapter/json/collection_test.rb +0 -106
  89. data/test/adapter/json/has_many_test.rb +0 -55
  90. data/test/adapter/json/transform_test.rb +0 -95
  91. data/test/adapter/json_api/belongs_to_test.rb +0 -157
  92. data/test/adapter/json_api/collection_test.rb +0 -98
  93. data/test/adapter/json_api/errors_test.rb +0 -78
  94. data/test/adapter/json_api/fields_test.rb +0 -98
  95. data/test/adapter/json_api/has_many_explicit_serializer_test.rb +0 -98
  96. data/test/adapter/json_api/has_many_test.rb +0 -175
  97. data/test/adapter/json_api/has_one_test.rb +0 -82
  98. data/test/adapter/json_api/include_data_if_sideloaded_test.rb +0 -215
  99. data/test/adapter/json_api/json_api_test.rb +0 -35
  100. data/test/adapter/json_api/linked_test.rb +0 -415
  101. data/test/adapter/json_api/links_test.rb +0 -112
  102. data/test/adapter/json_api/pagination_links_test.rb +0 -208
  103. data/test/adapter/json_api/parse_test.rb +0 -139
  104. data/test/adapter/json_api/relationship_test.rb +0 -399
  105. data/test/adapter/json_api/resource_meta_test.rb +0 -102
  106. data/test/adapter/json_api/toplevel_jsonapi_test.rb +0 -84
  107. data/test/adapter/json_api/transform_test.rb +0 -514
  108. data/test/adapter/json_api/type_test.rb +0 -195
  109. data/test/adapter/json_test.rb +0 -48
  110. data/test/adapter/null_test.rb +0 -24
  111. data/test/adapter/polymorphic_test.rb +0 -220
  112. data/test/adapter_test.rb +0 -69
  113. data/test/array_serializer_test.rb +0 -24
  114. data/test/benchmark/app.rb +0 -67
  115. data/test/benchmark/benchmarking_support.rb +0 -69
  116. data/test/benchmark/bm_active_record.rb +0 -83
  117. data/test/benchmark/bm_adapter.rb +0 -40
  118. data/test/benchmark/bm_caching.rb +0 -121
  119. data/test/benchmark/bm_lookup_chain.rb +0 -85
  120. data/test/benchmark/bm_transform.rb +0 -47
  121. data/test/benchmark/config.ru +0 -3
  122. data/test/benchmark/controllers.rb +0 -85
  123. data/test/benchmark/fixtures.rb +0 -221
  124. data/test/cache_test.rb +0 -717
  125. data/test/collection_serializer_test.rb +0 -129
  126. data/test/fixtures/active_record.rb +0 -115
  127. data/test/fixtures/poro.rb +0 -227
  128. data/test/generators/scaffold_controller_generator_test.rb +0 -26
  129. data/test/generators/serializer_generator_test.rb +0 -77
  130. data/test/grape_test.rb +0 -198
  131. data/test/lint_test.rb +0 -51
  132. data/test/logger_test.rb +0 -22
  133. data/test/poro_test.rb +0 -11
  134. data/test/serializable_resource_test.rb +0 -81
  135. data/test/serializers/association_macros_test.rb +0 -39
  136. data/test/serializers/associations_test.rb +0 -520
  137. data/test/serializers/attribute_test.rb +0 -155
  138. data/test/serializers/attributes_test.rb +0 -54
  139. data/test/serializers/caching_configuration_test_isolated.rb +0 -172
  140. data/test/serializers/configuration_test.rb +0 -34
  141. data/test/serializers/fieldset_test.rb +0 -16
  142. data/test/serializers/meta_test.rb +0 -204
  143. data/test/serializers/options_test.rb +0 -34
  144. data/test/serializers/read_attribute_for_serialization_test.rb +0 -81
  145. data/test/serializers/reflection_test.rb +0 -481
  146. data/test/serializers/root_test.rb +0 -23
  147. data/test/serializers/serialization_test.rb +0 -57
  148. data/test/serializers/serializer_for_test.rb +0 -138
  149. data/test/serializers/serializer_for_with_namespace_test.rb +0 -90
  150. data/test/support/custom_schemas/active_model_serializers/test/schema_test/my/index.json +0 -6
  151. data/test/support/isolated_unit.rb +0 -86
  152. data/test/support/rails5_shims.rb +0 -55
  153. data/test/support/rails_app.rb +0 -40
  154. data/test/support/schemas/active_model_serializers/test/schema_test/my/index.json +0 -6
  155. data/test/support/schemas/active_model_serializers/test/schema_test/my/show.json +0 -6
  156. data/test/support/schemas/custom/show.json +0 -7
  157. data/test/support/schemas/hyper_schema.json +0 -93
  158. data/test/support/schemas/render_using_json_api.json +0 -43
  159. data/test/support/schemas/simple_json_pointers.json +0 -10
  160. data/test/support/serialization_testing.rb +0 -81
  161. data/test/test_helper.rb +0 -72
data/.simplecov DELETED
@@ -1,110 +0,0 @@
1
- # https://github.com/colszowka/simplecov#using-simplecov-for-centralized-config
2
- # see https://github.com/colszowka/simplecov/blob/master/lib/simplecov/defaults.rb
3
- # vim: set ft=ruby
4
-
5
- ## DEFINE VARIABLES
6
- @minimum_coverage = ENV.fetch('COVERAGE_MINIMUM') {
7
- case (defined?(RUBY_ENGINE) && RUBY_ENGINE) || "ruby"
8
- when 'jruby', 'rbx'
9
- 96.0
10
- else
11
- 98.1
12
- end
13
- }.to_f.round(2)
14
- # rubocop:disable Style/DoubleNegation
15
- ENV['FULL_BUILD'] ||= ENV['CI']
16
- @running_ci = !!(ENV['FULL_BUILD'] =~ /\Atrue\z/i)
17
- @generate_report = @running_ci || !!(ENV['COVERAGE'] =~ /\Atrue\z/i)
18
- @output = STDOUT
19
- # rubocop:enable Style/DoubleNegation
20
-
21
- ## CONFIGURE SIMPLECOV
22
-
23
- SimpleCov.profiles.define 'app' do
24
- coverage_dir 'coverage'
25
- load_profile 'test_frameworks'
26
-
27
- add_group 'Libraries', 'lib'
28
-
29
- add_group 'Long files' do |src_file|
30
- src_file.lines.count > 100
31
- end
32
- class MaxLinesFilter < SimpleCov::Filter
33
- def matches?(source_file)
34
- source_file.lines.count < filter_argument
35
- end
36
- end
37
- add_group 'Short files', MaxLinesFilter.new(5)
38
-
39
- # Exclude these paths from analysis
40
- add_filter '/config/'
41
- add_filter '/db/'
42
- add_filter 'tasks'
43
- add_filter '/.bundle/'
44
- end
45
-
46
- ## START TRACKING COVERAGE (before activating SimpleCov)
47
- require 'coverage'
48
- Coverage.start
49
-
50
- ## ADD SOME CUSTOM REPORTING AT EXIT
51
- SimpleCov.at_exit do
52
- next if $! and not ($!.kind_of? SystemExit and $!.success?)
53
-
54
- header = "#{'*' * 20} SimpleCov Results #{'*' * 20}"
55
- results = SimpleCov.result.format!.join("\n")
56
- exit_message = <<-EOF
57
-
58
- #{header}
59
- {{RESULTS}}
60
- {{FAILURE_MESSAGE}}
61
-
62
- #{'*' * header.size}
63
- EOF
64
- percent = Float(SimpleCov.result.covered_percent)
65
- if percent < @minimum_coverage
66
- failure_message = <<-EOF
67
- Spec coverage was not high enough: #{percent.round(2)}% is < #{@minimum_coverage}%
68
- EOF
69
- exit_message.sub!('{{RESULTS}}', results).sub!('{{FAILURE_MESSAGE}}', failure_message)
70
- @output.puts exit_message
71
- abort(failure_message) if @generate_report
72
- elsif @running_ci
73
- exit_message.sub!('{{RESULTS}}', results).sub!('{{FAILURE_MESSAGE}}', <<-EOF)
74
- Nice job! Spec coverage (#{percent.round(2)}%) is still at or above #{@minimum_coverage}%
75
- EOF
76
- @output.puts exit_message
77
- end
78
- end
79
-
80
- ## CAPTURE CONFIG IN CLOSURE 'AppCoverage.start'
81
- ## to defer running until test/test_helper.rb is loaded.
82
- # rubocop:disable Style/MultilineBlockChain
83
- AppCoverage = Class.new do
84
- def initialize(&block)
85
- @block = block
86
- end
87
-
88
- def start
89
- @block.call
90
- end
91
- end.new do
92
- SimpleCov.start 'app'
93
- if @generate_report
94
- if @running_ci
95
- require 'codeclimate-test-reporter'
96
- @output.puts '[COVERAGE] Running with SimpleCov Simple Formatter and CodeClimate Test Reporter'
97
- formatters = [
98
- SimpleCov::Formatter::SimpleFormatter,
99
- CodeClimate::TestReporter::Formatter
100
- ]
101
- else
102
- @output.puts '[COVERAGE] Running with SimpleCov HTML Formatter'
103
- formatters = [SimpleCov::Formatter::HTMLFormatter]
104
- end
105
- else
106
- formatters = []
107
- end
108
- SimpleCov.formatters = formatters
109
- end
110
- # rubocop:enable Style/MultilineBlockChain
data/.travis.yml DELETED
@@ -1,63 +0,0 @@
1
- language: ruby
2
- sudo: false
3
-
4
- cache:
5
- directories:
6
- - vendor/bundle
7
-
8
- before_install:
9
- - "travis_retry gem update --system 2.7.8"
10
- - "travis_retry gem install bundler -v '1.17.3'"
11
- install: BUNDLER_VERSION=1.17.3 bundle install --path=vendor/bundle --retry=3 --jobs=3
12
-
13
- script:
14
- - bundle exec rake ci
15
- after_success:
16
- - codeclimate-test-reporter
17
-
18
- env:
19
- matrix:
20
- - "RAILS_VERSION=4.1"
21
- - "RAILS_VERSION=4.2"
22
- - "RAILS_VERSION=5.0"
23
- - "RAILS_VERSION=5.1"
24
- - "RAILS_VERSION=5.2"
25
- - "RAILS_VERSION=master"
26
-
27
- rvm:
28
- - 2.1.10
29
- - 2.2.8
30
- - 2.3.5
31
- - 2.4.2
32
- - 2.5.3
33
- - ruby-head
34
-
35
- branches:
36
- only:
37
- - 0-10-stable
38
-
39
- matrix:
40
- include:
41
- - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=4.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
42
- - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=4.2 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
43
- - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
44
- # See JRuby currently failing on Rails 5+ https://github.com/jruby/activerecord-jdbc-adapter/issues/708
45
- # - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.0 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
46
- # - { rvm: jruby-head, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
47
- exclude:
48
- - { rvm: 2.1.10, env: RAILS_VERSION=master }
49
- - { rvm: 2.2.8, env: RAILS_VERSION=master }
50
- - { rvm: 2.3.5, env: RAILS_VERSION=master }
51
- - { rvm: 2.4.2, env: RAILS_VERSION=master }
52
- - { rvm: 2.1.10, env: RAILS_VERSION=5.0 }
53
- - { rvm: 2.1.10, env: RAILS_VERSION=5.1 }
54
- - { rvm: 2.1.10, env: RAILS_VERSION=5.2 }
55
- - { rvm: 2.4.2, env: RAILS_VERSION=4.1 }
56
- - { rvm: 2.5.3, env: RAILS_VERSION=4.1 }
57
- - { rvm: ruby-head, env: RAILS_VERSION=4.1 }
58
- allow_failures:
59
- - rvm: ruby-head
60
- - rvm: jruby-head
61
- # See JRuby currently failing on Rails 5+ https://github.com/jruby/activerecord-jdbc-adapter/issues/708
62
- - { rvm: jruby-9.1.13.0, jdk: oraclejdk8, env: "RAILS_VERSION=5.1 JRUBY_OPTS='--dev -J-Xmx1024M --debug'" }
63
- fast_finish: true
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting one of the owners listed at https://rubygems.org/gems/active_model_serializers. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md DELETED
@@ -1,105 +0,0 @@
1
- ## Have an issue?
2
-
3
- Before opening an issue, try the following:
4
-
5
- ##### Consult the documentation
6
-
7
- See if your issue can be resolved by information in the documentation.
8
-
9
- - [0.10 (master) Documentation](https://github.com/rails-api/active_model_serializers/tree/master/docs)
10
- - [![API Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/rails-api/active_model_serializers/v0.10.0)
11
- - [Guides](docs)
12
- - [0.9 (0-9-stable) Documentation](https://github.com/rails-api/active_model_serializers/tree/0-9-stable)
13
- - [0.8 (0-8-stable) Documentation](https://github.com/rails-api/active_model_serializers/tree/0-8-stable)
14
-
15
- ##### Check for an existing issue
16
-
17
- Take a look at the issues to see if a similar one has already been created. If
18
- one exists, please add any additional information that might expedite
19
- resolution.
20
-
21
- #### Open an issue
22
-
23
- If the documentation wasn't able to help resolve the issue and no issue already
24
- exists, please open a new issue with the following in mind:
25
-
26
- - Please make sure only to include one issue per report. If you encounter
27
- multiple, unrelated issues, please report them as such.
28
- - Be detailed. Provide backtraces and example code when possible. Provide
29
- information about your environment. e.g., Ruby version, rails version, etc.
30
- - Own your issue. Actively participate in the discussion and help drive the
31
- issue to closure.
32
- - If you resolve your own issue, please share the details on the issue and close
33
- it out. Others might have the same issue and sharing solutions is helpful.
34
-
35
- ## Contributing
36
-
37
- Contributing can be done in many ways and is not exclusive to code. If you have
38
- thoughts on a particular issue or feature, we encourage you to open new issues
39
- for discussion or add your comments to existing ones.
40
-
41
- #### Pull requests
42
-
43
- We also gladly welcome pull requests. When preparing to work on pull request,
44
- please adhere to these standards:
45
-
46
- - Base work on the master branch unless fixing an issue with
47
- [0.9-stable](https://github.com/rails-api/active_model_serializers/tree/0-9-stable)
48
- or
49
- [0.8-stable](https://github.com/rails-api/active_model_serializers/tree/0-8-stable)
50
- - Squash your commits and regularly rebase off master.
51
- - Provide a description of the changes contained in the pull request.
52
- - Note any specific areas that should be reviewed.
53
- - Include tests.
54
- - The test suite must pass on [supported Ruby versions](.travis.yml)
55
- - Include updates to the [documentation](https://github.com/rails-api/active_model_serializers/tree/master/docs)
56
- where applicable.
57
- - Update the
58
- [CHANGELOG](https://github.com/rails-api/active_model_serializers/blob/master/CHANGELOG.md)
59
- to the appropriate sections with a brief description of the changes.
60
- - Do not change the VERSION file.
61
-
62
- #### Running tests
63
-
64
- Run all tests
65
-
66
- `$ rake test`
67
-
68
- Run a single test suite
69
-
70
- `$ rake test TEST=path/to/test.rb`
71
-
72
- Run a single test
73
-
74
- `$ rake test TEST=path/to/test.rb TESTOPTS="--name=test_something"`
75
-
76
- Run tests against different Rails versions by setting the RAILS_VERSION variable
77
- and bundling gems. (save this script somewhere executable and run from top of AMS repository)
78
-
79
- ```bash
80
- #!/usr/bin/env bash
81
-
82
- rcommand='puts YAML.load_file("./.travis.yml")["env"]["matrix"].join(" ").gsub("RAILS_VERSION=", "")'
83
- versions=$(ruby -ryaml -e "$rcommand")
84
-
85
- for version in ${versions[@]}; do
86
- export RAILS_VERSION="$version"
87
- rm -f Gemfile.lock
88
- bundle check || bundle --local || bundle
89
- bundle exec rake test
90
- if [ "$?" -eq 0 ]; then
91
- # green in ANSI
92
- echo -e "\033[32m **** Tests passed against Rails ${RAILS_VERSION} **** \033[0m"
93
- else
94
- # red in ANSI
95
- echo -e "\033[31m **** Tests failed against Rails ${RAILS_VERSION} **** \033[0m"
96
- read -p '[Enter] any key to continue, [q] to quit...' prompt
97
- if [ "$prompt" = 'q' ]; then
98
- unset RAILS_VERSION
99
- exit 1
100
- fi
101
- fi
102
- unset RAILS_VERSION
103
- done
104
- ```
105
-
data/Gemfile DELETED
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
- #
5
- # Add a Gemfile.local to locally bundle gems outside of version control
6
- local_gemfile = File.join(File.expand_path('..', __FILE__), 'Gemfile.local')
7
- eval_gemfile local_gemfile if File.readable?(local_gemfile)
8
-
9
- # Specify your gem's dependencies in active_model_serializers.gemspec
10
- gemspec
11
-
12
- version = ENV['RAILS_VERSION'] || '4.2'
13
-
14
- if version == 'master'
15
- gem 'rack', github: 'rack/rack'
16
- gem 'arel', github: 'rails/arel'
17
- gem 'rails', github: 'rails/rails'
18
- git 'https://github.com/rails/rails.git' do
19
- gem 'railties'
20
- gem 'activesupport'
21
- gem 'activemodel'
22
- gem 'actionpack'
23
- gem 'activerecord', group: :test
24
- # Rails 5
25
- gem 'actionview'
26
- end
27
- else
28
- gem_version = "~> #{version}.0"
29
- gem 'rails', gem_version
30
- gem 'railties', gem_version
31
- gem 'activesupport', gem_version
32
- gem 'activemodel', gem_version
33
- gem 'actionpack', gem_version
34
- gem 'activerecord', gem_version, group: :test
35
- end
36
-
37
- # https://github.com/bundler/bundler/blob/89a8778c19269561926cea172acdcda241d26d23/lib/bundler/dependency.rb#L30-L54
38
- @windows_platforms = [:mswin, :mingw, :x64_mingw]
39
-
40
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
41
- gem 'tzinfo-data', platforms: (@windows_platforms + [:jruby])
42
-
43
- if ENV['CI']
44
- if RUBY_VERSION < '2.4'
45
- # Windows: An error occurred while installing nokogiri (1.8.0)
46
- gem 'nokogiri', '< 1.7', platforms: @windows_platforms
47
- end
48
- end
49
-
50
- group :bench do
51
- # https://github.com/rails-api/active_model_serializers/commit/cb4459580a6f4f37f629bf3185a5224c8624ca76
52
- gem 'benchmark-ips', '>= 2.7.2', require: false, group: :development
53
- end
54
-
55
- group :test do
56
- gem 'sqlite3', '~> 1.3.13', platform: (@windows_platforms + [:ruby])
57
- platforms :jruby do
58
- if version == 'master' || version >= '5'
59
- gem 'activerecord-jdbcsqlite3-adapter', '~> 50'
60
- else
61
- gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3.0'
62
- end
63
- end
64
- gem 'codeclimate-test-reporter', require: false
65
- gem 'm', '~> 1.5'
66
- gem 'pry', '>= 0.10'
67
- gem 'byebug', '~> 8.2' if RUBY_VERSION < '2.2'
68
- gem 'pry-byebug', platform: :ruby
69
- end
70
-
71
- group :development, :test do
72
- gem 'rubocop', '~> 0.40.0', require: false
73
- gem 'yard', require: false
74
- end
data/Rakefile DELETED
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- begin
4
- require 'bundler/setup'
5
- rescue LoadError
6
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
- end
8
- begin
9
- require 'simplecov'
10
- rescue LoadError # rubocop:disable Lint/HandleExceptions
11
- end
12
- import('lib/tasks/rubocop.rake')
13
-
14
- Bundler::GemHelper.install_tasks
15
-
16
- require 'yard'
17
-
18
- namespace :yard do
19
- YARD::Rake::YardocTask.new(:doc) do |t|
20
- t.stats_options = ['--list-undoc']
21
- end
22
-
23
- desc 'start a gem server'
24
- task :server do
25
- sh 'bundle exec yard server --gems'
26
- end
27
-
28
- desc 'use Graphviz to generate dot graph'
29
- task :graph do
30
- output_file = 'doc/erd.dot'
31
- sh "bundle exec yard graph --protected --full --dependencies > #{output_file}"
32
- puts 'open doc/erd.dot if you have graphviz installed'
33
- end
34
- end
35
-
36
- require 'rake/testtask'
37
-
38
- Rake::TestTask.new(:test) do |t|
39
- t.libs << 'lib'
40
- t.libs << 'test'
41
- t.pattern = 'test/**/*_test.rb'
42
- t.ruby_opts = ['-r./test/test_helper.rb']
43
- t.ruby_opts << ' -w' unless ENV['NO_WARN'] == 'true'
44
- t.verbose = true
45
- end
46
-
47
- desc 'Run isolated tests'
48
- task isolated: ['test:isolated']
49
- namespace :test do
50
- task :isolated do
51
- desc 'Run isolated tests for Railtie'
52
- require 'shellwords'
53
- dir = File.dirname(__FILE__)
54
- dir = Shellwords.shellescape(dir)
55
- isolated_test_files = FileList['test/**/*_test_isolated.rb']
56
- # https://github.com/rails/rails/blob/3d590add45/railties/lib/rails/generators/app_base.rb#L345-L363
57
- _bundle_command = Gem.bin_path('bundler', 'bundle')
58
- require 'bundler'
59
- Bundler.with_clean_env do
60
- isolated_test_files.all? do |test_file|
61
- command = "-w -I#{dir}/lib -I#{dir}/test #{Shellwords.shellescape(test_file)}"
62
- full_command = %("#{Gem.ruby}" #{command})
63
- system(full_command)
64
- end or fail 'Failures' # rubocop:disable Style/AndOr
65
- end
66
- end
67
- end
68
-
69
- if ENV['RAILS_VERSION'].to_s > '4.0' && RUBY_ENGINE == 'ruby'
70
- task default: [:isolated, :test, :rubocop]
71
- else
72
- task default: [:test, :rubocop]
73
- end
74
-
75
- desc 'CI test task'
76
- task ci: [:default]
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
- # coding: utf-8
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'active_model/serializer/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'active_model_serializers'
9
- spec.version = ActiveModel::Serializer::VERSION
10
- spec.platform = Gem::Platform::RUBY
11
- spec.authors = ['Steve Klabnik']
12
- spec.email = ['steve@steveklabnik.com']
13
- spec.summary = 'Conventions-based JSON generation for Rails.'
14
- spec.description = 'ActiveModel::Serializers allows you to generate your JSON in an object-oriented and convention-driven manner.'
15
- spec.homepage = 'https://github.com/rails-api/active_model_serializers'
16
- spec.license = 'MIT'
17
-
18
- spec.files = `git ls-files -z`.split("\x0")
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ['lib']
21
- spec.executables = []
22
-
23
- spec.required_ruby_version = '>= 2.1'
24
-
25
- rails_versions = ['>= 4.1', '< 6']
26
- spec.add_runtime_dependency 'activemodel', rails_versions
27
- # 'activesupport', rails_versions
28
- # 'builder'
29
-
30
- spec.add_runtime_dependency 'actionpack', rails_versions
31
- # 'activesupport', rails_versions
32
- # 'rack'
33
- # 'rack-test', '~> 0.6.2'
34
-
35
- spec.add_development_dependency 'railties', rails_versions
36
- # 'activesupport', rails_versions
37
- # 'actionpack', rails_versions
38
- # 'rake', '>= 0.8.7'
39
-
40
- # 'activesupport', rails_versions
41
- # 'i18n,
42
- # 'tzinfo'
43
- spec.add_development_dependency 'minitest', ['~> 5.0', '< 5.11']
44
- # 'thread_safe'
45
-
46
- spec.add_runtime_dependency 'jsonapi-renderer', ['>= 0.1.1.beta1', '< 0.3']
47
- spec.add_runtime_dependency 'case_transform', '>= 0.2'
48
-
49
- spec.add_development_dependency 'activerecord', rails_versions
50
- # arel
51
- # activesupport
52
- # activemodel
53
-
54
- # Soft dependency for pagination
55
- spec.add_development_dependency 'kaminari', ' ~> 0.16.3'
56
- spec.add_development_dependency 'will_paginate', '~> 3.0', '>= 3.0.7'
57
-
58
- spec.add_development_dependency 'bundler', '~> 1.6'
59
- spec.add_development_dependency 'simplecov', '~> 0.11'
60
- spec.add_development_dependency 'timecop', '~> 0.7'
61
- spec.add_development_dependency 'grape', ['>= 0.13', '< 0.19.1']
62
- spec.add_development_dependency 'json_schema'
63
- spec.add_development_dependency 'rake', ['>= 10.0', '< 12.0']
64
- end
data/appveyor.yml DELETED
@@ -1,28 +0,0 @@
1
- version: 1.0.{build}-{branch}
2
-
3
- skip_tags: true
4
-
5
- environment:
6
- JRUBY_OPTS: "--dev -J-Xmx1024M --debug"
7
- matrix:
8
- - ruby_version: "Ruby23"
9
- - ruby_version: "Ruby23-x64"
10
-
11
- cache:
12
- - vendor/bundle
13
-
14
- install:
15
- - SET PATH=C:\%ruby_version%\bin;%PATH%
16
- - bundle env
17
- - bundle check || bundle install --path=vendor/bundle --retry=3 --jobs=3
18
- - bundle clean --force
19
-
20
- before_test:
21
- - ruby -v
22
- - gem -v
23
- - bundle -v
24
-
25
- test_script:
26
- - bundle exec rake ci
27
-
28
- build: off