Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gem to latest solidus_dev_support #99

Merged
merged 3 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ jobs:
executor: solidusio_extensions/mysql
steps:
- solidusio_extensions/run-tests
lint-code:
executor: solidusio_extensions/sqlite-memory
steps:
- solidusio_extensions/lint-code

workflows:
"Run specs on supported Solidus versions":
jobs:
- run-specs-with-postgres
- run-specs-with-mysql
- lint-code

"Weekly run specs against master":
triggers:
- schedule:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ pkg
*.swp
spec/dummy
spec/examples.txt
/sandbox
.rvmrc
.ruby-version
.ruby-gemset
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
inherit_from: .rubocop_todo.yml

require:
- solidus_dev_support/rubocop
104 changes: 33 additions & 71 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-11-27 10:11:04 +0100 using RuboCop version 0.76.0.
# on 2020-09-11 09:54:47 UTC using RuboCop version 0.87.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/DuplicatedGem:
Exclude:
- 'Gemfile'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec,
Gemspec/RequiredRubyVersion:
Exclude:
- 'solidus_reviews.gemspec'

# Offense count: 1
Lint/AmbiguousOperator:
Exclude:
- 'lib/solidus_reviews/engine.rb'

# Offense count: 1
Lint/InterpolationCheck:
Exclude:
- 'spec/models/review_spec.rb'

# Offense count: 33
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 155
Lint/RedundantCopDisableDirective:
Exclude:
- 'lib/generators/solidus_reviews/install/install_generator.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
Expand All @@ -46,8 +21,8 @@ Naming/MemoizedInstanceVariableName:

# Offense count: 2
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os
Naming/UncommunicativeMethodParamName:
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
Naming/MethodParameterName:
Exclude:
- 'app/helpers/spree/reviews_helper.rb'

Expand All @@ -58,13 +33,13 @@ Naming/VariableNumber:
Exclude:
- 'spec/models/review_spec.rb'

# Offense count: 2
# Offense count: 3
RSpec/AnyInstance:
Exclude:
- 'spec/controllers/spree/admin/reviews_controller_spec.rb'
- 'spec/controllers/spree/reviews_controller_spec.rb'

# Offense count: 35
# Offense count: 37
# Configuration parameters: Prefixes.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand All @@ -79,14 +54,8 @@ RSpec/ContextWording:
- 'spec/models/review_spec.rb'
- 'spec/models/reviews_ability_spec.rb'

# Offense count: 2
RSpec/DescribeClass:
Exclude:
- 'spec/features/admin_spec.rb'
- 'spec/features/reviews_spec.rb'

# Offense count: 6
# Configuration parameters: CustomTransform, IgnoreMethods.
# Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
RSpec/FilePath:
Exclude:
- 'spec/helpers/review_helper_spec.rb'
Expand All @@ -96,7 +65,7 @@ RSpec/FilePath:
- 'spec/models/reviews_ability_spec.rb'
- 'spec/models/reviews_configuration_spec.rb'

# Offense count: 1
# Offense count: 12
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
Expand All @@ -108,21 +77,26 @@ RSpec/LetSetup:
- 'spec/controllers/spree/admin/feedback_reviews_controller_spec.rb'
- 'spec/models/product_spec.rb'

# Offense count: 3
# Offense count: 4
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 51
# Configuration parameters: AggregateFailuresByDefault.
# Offense count: 67
RSpec/MultipleExpectations:
Max: 8

# Offense count: 71
# Offense count: 3
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 7

# Offense count: 94
# Configuration parameters: IgnoreSharedExamples.
RSpec/NamedSubject:
Exclude:
- 'spec/controllers/spree/api/feedback_reviews_controller_spec.rb'
- 'spec/controllers/spree/api/reviews_controller_spec.rb'
- 'spec/models/reviews_configuration_spec.rb'

Expand All @@ -141,43 +115,22 @@ RSpec/VerifiedDoubles:
Exclude:
- 'spec/models/reviews_ability_spec.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/spree/review.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/InverseOf:
Exclude:
- 'app/models/spree/review.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
Rails/Output:
Exclude:
- 'lib/generators/solidus_reviews/install/install_generator.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- 'Rakefile'

# Offense count: 2
Rails/ReflectionClassName:
Exclude:
- 'app/models/spree/feedback_review.rb'
- 'app/models/spree/review.rb'

# Offense count: 5
# Configuration parameters: Blacklist, Whitelist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
# Configuration parameters: ForbiddenMethods, AllowedMethods.
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
Rails/SkipsModelValidations:
Exclude:
- 'app/controllers/spree/admin/reviews_controller.rb'
Expand Down Expand Up @@ -208,14 +161,23 @@ Style/ClassVars:
- 'app/decorators/helpers/solidus_reviews/spree/api/api_helpers_decorator.rb'

# Offense count: 1
# Configuration parameters: .
# Configuration parameters: EnforcedStyle.
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: unannotated
Exclude:
- 'app/decorators/models/solidus_reviews/spree/product_decorator.rb'

# Offense count: 3
# Offense count: 5
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'app/controllers/spree/admin/reviews_controller.rb'
- 'lib/controllers/spree/api/feedback_reviews_controller.rb'
- 'lib/controllers/spree/api/reviews_controller.rb'

# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 150
47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Add the following to your `Gemfile` to install from git:
```ruby
gem 'solidus_reviews', github: 'solidusio-contrib/solidus_reviews'
```

Now bundle up with:

```console
Expand All @@ -25,7 +26,6 @@ Next, run the rake task that copies the necessary migrations and assets to your
$ rails g solidus_reviews:install
```


And finish with a migrate:

```console
Expand Down Expand Up @@ -58,12 +58,49 @@ your `spec_helper.rb`:
require 'solidus_reviews/factories'
```

## Testing
### Testing the extension

First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy

app if it does not exist, then it will run specs. The dummy app can be regenerated by using
`bin/rake extension:test_app`.

```shell
bin/rake
```

Just run the following to automatically build a dummy app if necessary and run the tests:
To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run

```shell
$ bundle exec rake
bundle exec rubocop
```

### Running the sandbox

To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for

the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
`sandbox/bin/rails`.

Here's an example:

```
$ bin/rails server
=> Booting Puma
=> Rails 6.0.2.1 application starting in development
* Listening on tcp://127.0.0.1:3000
Use Ctrl-C to stop
```

### Updating the changelog

Before and after releases the changelog should be updated to reflect the up-to-date status of
the project:
```shell

bin/rake changelog
git add CHANGELOG.md
git commit -m "Update the changelog"
```

## Contributing
Expand All @@ -72,5 +109,5 @@ Bug reports and pull requests are welcome on GitHub at <https://github.com/solid

## License

Copyright (c) 2009-2019 [Solidus](https://github.com/solidusio) and [contributors](https://github.com/solidusio-contrib/solidus_reviews/graphs/contributors),
Copyright (c) 2009-2020 [Solidus](https://github.com/solidusio) and [contributors](https://github.com/solidusio-contrib/solidus_reviews/graphs/contributors),
released under the [New BSD License](https://github.com/solidusio-contrib/solidus_reviews/blob/master/LICENSE.md).
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
require 'solidus_dev_support/rake_tasks'
SolidusDevSupport::RakeTasks.install

task default: %w[extension:test_app extension:specs]

Bundler::GemHelper.install_tasks
task default: 'extension:specs'
4 changes: 4 additions & 0 deletions app/assets/stylesheets/spree/frontend/solidus_reviews.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
Placeholder manifest file.
the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/frontend/all.css'
*/
2 changes: 1 addition & 1 deletion app/helpers/spree/reviews_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Spree::ReviewsHelper
def star(the_class)
content_tag(:span, " &#10030; ".html_safe, class: the_class)
tag.span(" &#10030; ".html_safe, class: the_class)
end

def mk_stars(m)
Expand Down
16 changes: 4 additions & 12 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

app_root = 'spec/dummy'

unless File.exist? "#{app_root}/bin/rails"
system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
warn "Automatic creation of the dummy app failed"
exit 1
end
if %w[g generate].include? ARGV.first
exec "#{__dir__}/rails-engine", *ARGV
else
exec "#{__dir__}/rails-sandbox", *ARGV
end

Dir.chdir app_root
exec 'bin/rails', *ARGV
13 changes: 13 additions & 0 deletions bin/rails-engine
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
ENGINE_PATH = File.expand_path('../lib/solidus_reviews/engine', __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'
16 changes: 16 additions & 0 deletions bin/rails-sandbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby

app_root = 'sandbox'

unless File.exist? "#{app_root}/bin/rails"
warn 'Creating the sandbox app...'
Dir.chdir "#{__dir__}/.." do
system "#{__dir__}/sandbox" or begin
warn 'Automatic creation of the sandbox app failed'
exit 1
end
end
end

Dir.chdir app_root
exec 'bin/rails', *ARGV
7 changes: 7 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rake", "rake")
Loading