solidus_dev_support 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +35 -0
  3. data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  4. data/.github/stale.yml +17 -0
  5. data/.gitignore +12 -0
  6. data/.rspec +3 -0
  7. data/.rubocop-https---relaxed-ruby-style-rubocop-yml +174 -0
  8. data/.rubocop.yml +2 -0
  9. data/CHANGELOG.md +39 -0
  10. data/Gemfile +8 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +154 -0
  13. data/Rakefile +8 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/exe/solidus +52 -0
  17. data/lib/solidus_dev_support.rb +15 -0
  18. data/lib/solidus_dev_support/extension.rb +50 -0
  19. data/lib/solidus_dev_support/rake_tasks.rb +61 -0
  20. data/lib/solidus_dev_support/rspec/coverage.rb +22 -0
  21. data/lib/solidus_dev_support/rspec/feature_helper.rb +39 -0
  22. data/lib/solidus_dev_support/rspec/rails_helper.rb +60 -0
  23. data/lib/solidus_dev_support/rspec/spec_helper.rb +25 -0
  24. data/lib/solidus_dev_support/rubocop.rb +16 -0
  25. data/lib/solidus_dev_support/rubocop/config.yml +201 -0
  26. data/lib/solidus_dev_support/templates/extension/.circleci/config.yml +35 -0
  27. data/lib/solidus_dev_support/templates/extension/.github/stale.yml +17 -0
  28. data/lib/solidus_dev_support/templates/extension/CONTRIBUTING.md +57 -0
  29. data/lib/solidus_dev_support/templates/extension/Gemfile +25 -0
  30. data/lib/solidus_dev_support/templates/extension/LICENSE +26 -0
  31. data/lib/solidus_dev_support/templates/extension/README.md +48 -0
  32. data/lib/solidus_dev_support/templates/extension/Rakefile +32 -0
  33. data/lib/solidus_dev_support/templates/extension/app/assets/javascripts/spree/backend/%file_name%.js +2 -0
  34. data/lib/solidus_dev_support/templates/extension/app/assets/javascripts/spree/frontend/%file_name%.js +2 -0
  35. data/lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/backend/%file_name%.css +4 -0
  36. data/lib/solidus_dev_support/templates/extension/app/assets/stylesheets/spree/frontend/%file_name%.css +4 -0
  37. data/lib/solidus_dev_support/templates/extension/bin/rails.tt +7 -0
  38. data/lib/solidus_dev_support/templates/extension/config/locales/en.yml +5 -0
  39. data/lib/solidus_dev_support/templates/extension/config/routes.rb +5 -0
  40. data/lib/solidus_dev_support/templates/extension/extension.gemspec.erb +23 -0
  41. data/lib/solidus_dev_support/templates/extension/gem_release.yml.tt +5 -0
  42. data/lib/solidus_dev_support/templates/extension/gitignore +15 -0
  43. data/lib/solidus_dev_support/templates/extension/lib/%file_name%.rb.tt +4 -0
  44. data/lib/solidus_dev_support/templates/extension/lib/%file_name%/engine.rb.tt +22 -0
  45. data/lib/solidus_dev_support/templates/extension/lib/%file_name%/factories.rb.tt +4 -0
  46. data/lib/solidus_dev_support/templates/extension/lib/%file_name%/version.rb.tt +5 -0
  47. data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +32 -0
  48. data/lib/solidus_dev_support/templates/extension/rspec +1 -0
  49. data/lib/solidus_dev_support/templates/extension/rubocop.yml +15 -0
  50. data/lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt +24 -0
  51. data/lib/solidus_dev_support/testing_support/preferences.rb +45 -0
  52. data/lib/solidus_dev_support/version.rb +5 -0
  53. data/solidus_dev_support.gemspec +50 -0
  54. metadata +384 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 32f68913bee63209a6d6dd22002a39bc228b5413205487c5437cf17a98446e48
4
+ data.tar.gz: 27f0f341b2d37ddfd9795a151eed63bd1a5396b01d8e5ff779643d7a54833d74
5
+ SHA512:
6
+ metadata.gz: e4ed196776b2f7d34fb2e50e08db666e6d3252008892236e237da41505b14f93bff81057249bc923dcd3b346323cc163d41284f50c3e18123c8882b6083d9770
7
+ data.tar.gz: ca477403957a8e3a4535dd951b52b186ef6e287cd115cb752d043050bad10db6a886b6ae905ba9958e149bf2cbaf8e2dbb11506fb59aaefe9fc7be8479fa089d
@@ -0,0 +1,35 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ # Always take the latest version of the orb, this allows us to
5
+ # run specs against Solidus supported versions only without the need
6
+ # to change this configuration every time a Solidus version is released
7
+ # or goes EOL.
8
+ solidusio_extensions: solidusio/extensions@volatile
9
+
10
+ jobs:
11
+ run-specs-with-postgres:
12
+ executor: solidusio_extensions/postgres
13
+ steps:
14
+ - solidusio_extensions/run-tests
15
+ run-specs-with-mysql:
16
+ executor: solidusio_extensions/mysql
17
+ steps:
18
+ - solidusio_extensions/run-tests
19
+
20
+ workflows:
21
+ "Run specs on supported Solidus versions":
22
+ jobs:
23
+ - run-specs-with-postgres
24
+ - run-specs-with-mysql
25
+ "Weekly run specs against master":
26
+ triggers:
27
+ - schedule:
28
+ cron: "0 0 * * 4" # every Thursday
29
+ filters:
30
+ branches:
31
+ only:
32
+ - master
33
+ jobs:
34
+ - run-specs-with-postgres
35
+ - run-specs-with-mysql
@@ -0,0 +1,11 @@
1
+ Fixes #XXX.
2
+
3
+ ## Summary
4
+
5
+ <!-- Describe what you have changed in this PR. -->
6
+
7
+ ## Checklist
8
+
9
+ - [ ] I have structured the commits for clarity and conciseness.
10
+ - [ ] I have added relevant automated tests for this change.
11
+ - [ ] I have added an entry to the changelog for this change.
data/.github/stale.yml ADDED
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,174 @@
1
+ # Relaxed.Ruby.Style
2
+ ## Version 2.4
3
+
4
+ Style/Alias:
5
+ Enabled: false
6
+ StyleGuide: https://relaxed.ruby.style/#stylealias
7
+
8
+ Style/AsciiComments:
9
+ Enabled: false
10
+ StyleGuide: https://relaxed.ruby.style/#styleasciicomments
11
+
12
+ Style/BeginBlock:
13
+ Enabled: false
14
+ StyleGuide: https://relaxed.ruby.style/#stylebeginblock
15
+
16
+ Style/BlockDelimiters:
17
+ Enabled: false
18
+ StyleGuide: https://relaxed.ruby.style/#styleblockdelimiters
19
+
20
+ Style/CommentAnnotation:
21
+ Enabled: false
22
+ StyleGuide: https://relaxed.ruby.style/#stylecommentannotation
23
+
24
+ Style/Documentation:
25
+ Enabled: false
26
+ StyleGuide: https://relaxed.ruby.style/#styledocumentation
27
+
28
+ Layout/DotPosition:
29
+ Enabled: false
30
+ StyleGuide: https://relaxed.ruby.style/#layoutdotposition
31
+
32
+ Style/DoubleNegation:
33
+ Enabled: false
34
+ StyleGuide: https://relaxed.ruby.style/#styledoublenegation
35
+
36
+ Style/EndBlock:
37
+ Enabled: false
38
+ StyleGuide: https://relaxed.ruby.style/#styleendblock
39
+
40
+ Style/FormatString:
41
+ Enabled: false
42
+ StyleGuide: https://relaxed.ruby.style/#styleformatstring
43
+
44
+ Style/IfUnlessModifier:
45
+ Enabled: false
46
+ StyleGuide: https://relaxed.ruby.style/#styleifunlessmodifier
47
+
48
+ Style/Lambda:
49
+ Enabled: false
50
+ StyleGuide: https://relaxed.ruby.style/#stylelambda
51
+
52
+ Style/ModuleFunction:
53
+ Enabled: false
54
+ StyleGuide: https://relaxed.ruby.style/#stylemodulefunction
55
+
56
+ Style/MultilineBlockChain:
57
+ Enabled: false
58
+ StyleGuide: https://relaxed.ruby.style/#stylemultilineblockchain
59
+
60
+ Style/NegatedIf:
61
+ Enabled: false
62
+ StyleGuide: https://relaxed.ruby.style/#stylenegatedif
63
+
64
+ Style/NegatedWhile:
65
+ Enabled: false
66
+ StyleGuide: https://relaxed.ruby.style/#stylenegatedwhile
67
+
68
+ Style/NumericPredicate:
69
+ Enabled: false
70
+ StyleGuide: https://relaxed.ruby.style/#stylenumericpredicate
71
+
72
+ Style/ParallelAssignment:
73
+ Enabled: false
74
+ StyleGuide: https://relaxed.ruby.style/#styleparallelassignment
75
+
76
+ Style/PercentLiteralDelimiters:
77
+ Enabled: false
78
+ StyleGuide: https://relaxed.ruby.style/#stylepercentliteraldelimiters
79
+
80
+ Style/PerlBackrefs:
81
+ Enabled: false
82
+ StyleGuide: https://relaxed.ruby.style/#styleperlbackrefs
83
+
84
+ Style/Semicolon:
85
+ Enabled: false
86
+ StyleGuide: https://relaxed.ruby.style/#stylesemicolon
87
+
88
+ Style/SignalException:
89
+ Enabled: false
90
+ StyleGuide: https://relaxed.ruby.style/#stylesignalexception
91
+
92
+ Style/SingleLineBlockParams:
93
+ Enabled: false
94
+ StyleGuide: https://relaxed.ruby.style/#stylesinglelineblockparams
95
+
96
+ Style/SingleLineMethods:
97
+ Enabled: false
98
+ StyleGuide: https://relaxed.ruby.style/#stylesinglelinemethods
99
+
100
+ Layout/SpaceBeforeBlockBraces:
101
+ Enabled: false
102
+ StyleGuide: https://relaxed.ruby.style/#layoutspacebeforeblockbraces
103
+
104
+ Layout/SpaceInsideParens:
105
+ Enabled: false
106
+ StyleGuide: https://relaxed.ruby.style/#layoutspaceinsideparens
107
+
108
+ Style/SpecialGlobalVars:
109
+ Enabled: false
110
+ StyleGuide: https://relaxed.ruby.style/#stylespecialglobalvars
111
+
112
+ Style/StringLiterals:
113
+ Enabled: false
114
+ StyleGuide: https://relaxed.ruby.style/#stylestringliterals
115
+
116
+ Style/TrailingCommaInArguments:
117
+ Enabled: false
118
+ StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarguments
119
+
120
+ Style/TrailingCommaInArrayLiteral:
121
+ Enabled: false
122
+ StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarrayliteral
123
+
124
+ Style/TrailingCommaInHashLiteral:
125
+ Enabled: false
126
+ StyleGuide: https://relaxed.ruby.style/#styletrailingcommainhashliteral
127
+
128
+ Style/SymbolArray:
129
+ Enabled: false
130
+ StyleGuide: http://relaxed.ruby.style/#stylesymbolarray
131
+
132
+ Style/WhileUntilModifier:
133
+ Enabled: false
134
+ StyleGuide: https://relaxed.ruby.style/#stylewhileuntilmodifier
135
+
136
+ Style/WordArray:
137
+ Enabled: false
138
+ StyleGuide: https://relaxed.ruby.style/#stylewordarray
139
+
140
+ Lint/AmbiguousRegexpLiteral:
141
+ Enabled: false
142
+ StyleGuide: https://relaxed.ruby.style/#lintambiguousregexpliteral
143
+
144
+ Lint/AssignmentInCondition:
145
+ Enabled: false
146
+ StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
147
+
148
+ Metrics/AbcSize:
149
+ Enabled: false
150
+
151
+ Metrics/BlockNesting:
152
+ Enabled: false
153
+
154
+ Metrics/ClassLength:
155
+ Enabled: false
156
+
157
+ Metrics/ModuleLength:
158
+ Enabled: false
159
+
160
+ Metrics/CyclomaticComplexity:
161
+ Enabled: false
162
+
163
+ Metrics/LineLength:
164
+ Enabled: false
165
+
166
+ Metrics/MethodLength:
167
+ Enabled: false
168
+
169
+ Metrics/ParameterLists:
170
+ Enabled: false
171
+
172
+ Metrics/PerceivedComplexity:
173
+ Enabled: false
174
+
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - https://relaxed.ruby.style/rubocop.yml
data/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
6
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Adopted [Apparition](https://github.com/twalpole/apparition) as the deafult JS driver for Capybara
13
+ - Fixed window size to 1920x1080px in feature specs
14
+ - Added [Stale](https://github.com/apps/stale) to automatically mark GitHub issues as stale
15
+
16
+ ### Changed
17
+
18
+ - Disabled all `Metrics` cops except for `LineLength`
19
+ - Set `Layout/AlignArguments` cop to `with_fixed_indentation`
20
+ - Disabled `Layout/MultilineOperationIndentation` cop
21
+ - Renamed the project to SolidusDevSupport (was SolidusExtensionDevTools)
22
+
23
+ ### Fixed
24
+
25
+ - Fixed Chrome not starting in headless mode
26
+
27
+ ## [0.1.1] - 2019-11-11
28
+
29
+ ### Fixed
30
+
31
+ - Fixed `rails_helper` not working due to `SolidusDevSupport` not being available
32
+
33
+ ## [0.1.0] - 2019-11-11
34
+
35
+ Initial release.
36
+
37
+ [Unreleased]: https://github.com/solidusio-contrib/solidus_dev_support/compare/v0.1.1...HEAD
38
+ [0.1.1]: https://github.com/solidusio-contrib/solidus_dev_support/compare/v0.1.0...v0.1.1
39
+ [0.1.0]: https://github.com/solidusio-contrib/solidus_dev_support/releases/tag/v0.1.0
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in solidus_dev_support.gemspec
8
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Nebulab Srls
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # solidus_dev_support
2
+
3
+ This is a collection of tools for developing Solidus extensions.
4
+
5
+ ## Installation
6
+
7
+ Add this gem as a development dependency of your extension:
8
+
9
+ ```ruby
10
+ spec.add_development_dependency 'solidus_dev_support'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```console
16
+ $ bundle
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### RSpec helpers
22
+
23
+ This gem provides some useful helpers for RSpec to setup an extension's test environment easily.
24
+
25
+ Add this to your extension's `spec/spec_helper.rb`:
26
+
27
+ ```ruby
28
+ require 'solidus_dev_support/rspec/feature_helper'
29
+ ```
30
+
31
+ This helper loads configuration needed to run extension feature specs correctly, setting up Capybara
32
+ and configuring a Rails test application to precompile assets before the first feature spec.
33
+
34
+ `feature_helper` builds on top of `rails_helper`, which you can also use a standalone helper if you
35
+ want:
36
+
37
+ ```ruby
38
+ require 'solidus_dev_support/rspec/rails_helper'
39
+ ```
40
+
41
+ This will include the Rails and Solidus-related RSpec configuration, such as authorization helpers,
42
+ Solidus factories, URL helpers, and other helpers to easily work with Solidus.
43
+
44
+ `rails_helper`, in turn, builds on top of `spec_helper`, which is responsible for setting up a
45
+ basic RSpec environment:
46
+
47
+ ```ruby
48
+ require 'solidus_dev_support/rspec/spec_helper'
49
+ ```
50
+
51
+ ### Code coverage
52
+
53
+ The gem also includes a SimpleCov configuration that will send your test coverage information
54
+ directly to Codecov.io. Simply add this at the top of your `spec/spec_helper.rb`:
55
+
56
+ ```ruby
57
+ require 'solidus_dev_support/rspec/coverage'
58
+ ```
59
+
60
+ **Note: Make sure to add this at the VERY TOP of your spec_helper, otherwise you'll get skewed
61
+ coverage reports!**
62
+
63
+ If your extension is in a public repo and being tested on Travis or CircleCI, there's nothing else
64
+ you need to do! If your setup is more complex, look at the
65
+ [SimpleCov](https://github.com/colszowka/simplecov)
66
+ and [codecov-ruby](https://github.com/codecov/codecov-ruby) docs.
67
+
68
+ ### RuboCop configuration
69
+
70
+ solidus_dev_support includes a default [RuboCop](https://github.com/rubocop-hq/rubocop)
71
+ configuration for Solidus extensions. Currently, this is based on
72
+ [Relaxed Ruby Style](https://relaxed.ruby.style) with a few customizations, but in the future we
73
+ plan to provide custom cops to ensure your extension follows established Solidus best practices.
74
+
75
+ We strongly recommend including the RuboCop configuration in your extension. All you have to do is
76
+ add this to your `.rubocop.yml`:
77
+
78
+ ```yaml
79
+ require:
80
+ - solidus_dev_support/rubocop
81
+ ```
82
+
83
+ You can now run RuboCop with:
84
+
85
+ ```console
86
+ $ bundle exec rubocop
87
+ ```
88
+
89
+ ### Changelog generator
90
+
91
+ Generating a changelog for your extension is possible by running this command:
92
+
93
+ ```console
94
+ $ CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»" bundle exec github_changelog_generator github_username/github_project
95
+ ```
96
+
97
+ This generates a `CHANGELOG.md`, with pretty Markdown formatting.
98
+
99
+ For further instructions please read the [GitHub Changelog Generator documentation](https://github.com/github-changelog-generator/github-changelog-generator#usage).
100
+
101
+ ### Release management
102
+
103
+ By installing solidus_dev_support, you also get
104
+ [`gem release`](https://github.com/svenfuchs/gem-release), which you can use to automatically manage
105
+ releases for your gem.
106
+
107
+ For instance, you can run the following to release a new minor version:
108
+
109
+ ```console
110
+ gem bump --version minor --tag --release
111
+ ```
112
+
113
+ The above command will:
114
+
115
+ * bump the gem version to the next minor;
116
+ * commit the change and push it to `upstream/master`;
117
+ * create a Git tag;
118
+ * push the tag to the `upstream` remote;
119
+ * release the new version on RubyGems.
120
+
121
+ You can refer to
122
+ [`gem release`'s documentation](https://github.com/svenfuchs/gem-release/blob/master/README.md) for
123
+ further configuration and usage instructions.
124
+
125
+ ### Rake tasks
126
+
127
+ Put this in your `Rakefile`:
128
+
129
+ ```rb
130
+ require 'solidus_dev_support/rake_tasks'
131
+ SolidusDevSupport::RakeTasks.install
132
+
133
+ task default: 'extension:specs'
134
+ ```
135
+
136
+ ## Development
137
+
138
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run
139
+ the tests. You can also run `bin/console` for an interactive prompt that will allow you to
140
+ experiment.
141
+
142
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new
143
+ version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
144
+ will create a git tag for the version, push git commits and tags, and push the `.gem` file to
145
+ [rubygems.org](https://rubygems.org).
146
+
147
+ ## Contributing
148
+
149
+ Bug reports and pull requests are welcome on GitHub at https://github.com/solidusio/solidus_dev_support.
150
+
151
+ ## License
152
+
153
+ The gem is available as open source under the terms of the
154
+ [MIT License](https://opensource.org/licenses/MIT).