spree_extension 0.1.0 → 1.0.0
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 +4 -4
- data/LICENSE.md +18 -23
- data/README.md +44 -0
- data/Rakefile +9 -0
- data/bin/spree-extension +2 -0
- data/lib/generators/spree_extension/install/install_generator.rb +25 -0
- data/lib/generators/spree_extension/install/templates/bin/spree-extension +10 -0
- data/lib/spree_extension/extension.rb +80 -0
- data/lib/spree_extension/templates/extension/.gem_release.yml +3 -0
- data/lib/spree_extension/templates/extension/.github/.dependabot.yml +11 -0
- data/lib/spree_extension/templates/extension/.github/workflows/tests.yml +107 -0
- data/lib/spree_extension/templates/extension/.rubocop.yml +24 -0
- data/lib/spree_extension/templates/extension/CONTRIBUTING.md +57 -0
- data/lib/spree_extension/templates/extension/Gemfile +21 -0
- data/lib/spree_extension/templates/extension/LICENSE.md +9 -0
- data/lib/spree_extension/templates/extension/README.md +59 -0
- data/lib/spree_extension/templates/extension/Rakefile +21 -0
- data/lib/spree_extension/templates/extension/app/.gitkeep +0 -0
- data/lib/spree_extension/templates/extension/app/assets/config/%file_name%_manifest.js.tt +5 -0
- data/lib/spree_extension/templates/extension/app/assets/images/.keep +0 -0
- data/lib/spree_extension/templates/extension/app/javascript/%file_name%/application.js.tt +16 -0
- data/lib/spree_extension/templates/extension/app/javascript/%file_name%/controllers/%file_name%_controller.js.tt +7 -0
- data/lib/spree_extension/templates/extension/app/jobs/%file_name%/base_job.rb.tt +5 -0
- data/lib/spree_extension/templates/extension/bin/importmap +9 -0
- data/lib/spree_extension/templates/extension/bin/rails.tt +8 -0
- data/lib/spree_extension/templates/extension/config/i18n-tasks.yml +172 -0
- data/lib/spree_extension/templates/extension/config/importmap.rb.tt +6 -0
- data/lib/spree_extension/templates/extension/config/initializers/spree.rb.tt +23 -0
- data/lib/spree_extension/templates/extension/config/locales/en.yml.tt +7 -0
- data/lib/spree_extension/templates/extension/config/routes.rb +3 -0
- data/lib/spree_extension/templates/extension/extension.gemspec +26 -0
- data/lib/spree_extension/templates/extension/gitignore +23 -0
- data/lib/spree_extension/templates/extension/lib/%file_name%/configuration.rb.tt +13 -0
- data/lib/spree_extension/templates/extension/lib/%file_name%/engine.rb.tt +39 -0
- data/lib/spree_extension/templates/extension/lib/%file_name%/factories.rb.tt +6 -0
- data/lib/spree_extension/templates/extension/lib/%file_name%/version.rb.tt +7 -0
- data/lib/spree_extension/templates/extension/lib/%file_name%.rb.tt +12 -0
- data/lib/spree_extension/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +20 -0
- data/lib/spree_extension/templates/extension/rspec +3 -0
- data/lib/spree_extension/templates/extension/spec/.rubocop.yml +9 -0
- data/lib/spree_extension/templates/extension/spec/i18n_spec.rb +27 -0
- data/lib/spree_extension/templates/extension/spec/spec_helper.rb.tt +22 -0
- data/lib/spree_extension/templates/extension/spec/zeitwerk_spec.rb +9 -0
- data/lib/spree_extension.rb +11 -3
- metadata +63 -39
- data/.gitignore +0 -50
- data/Gemfile +0 -1
- data/lib/spree_extension/components_checker.rb +0 -25
- data/lib/spree_extension/migration.rb +0 -13
- data/lib/spree_extension/service_module.rb +0 -103
- data/spree_extension.gemspec +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67c781fe4a3f36f4bd053578c281d5bc99e4e5960f4ea43cccede5d45ccfb149
|
|
4
|
+
data.tar.gz: 12f93c0da0c64f95fb8489d8e5c30478148596fcd38ef2ad20b4da7b774f097e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63f2739a80d323367f976c9366b319b159db9feb48b7b2e233a2d2c83a98c5f31e37002b662ab5e79c9207cfae7a85e0c2c56357c127bbe51a4da3b796d60df4
|
|
7
|
+
data.tar.gz: 8d68d1f4038ec9a1d2b721407e40e82bb6b14d2ca1a27ed7ba1883965fb14da844c12a2f88d364f35b83c307357933e5094565c6e044584f36dda9d74efbd419
|
data/LICENSE.md
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
All rights reserved.
|
|
1
|
+
MIT License
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
are permitted provided that the following conditions are met:
|
|
3
|
+
Copyright (c) 2017-present Vendo Connect Inc.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
endorse or promote products derived from this software without specific
|
|
14
|
-
prior written permission.
|
|
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:
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Spree Extension
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/rb/spree_extension)
|
|
4
|
+
|
|
5
|
+
CLI tool for generating and managing Spree Commerce extensions.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install spree_extension
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Create a new extension
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
spree-extension create my_extension
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This creates a `spree_my_extension` directory with a complete extension scaffold including engine setup, tests, CI configuration, and more.
|
|
22
|
+
|
|
23
|
+
### Check version
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
spree-extension version
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## After generating
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd spree_my_extension
|
|
33
|
+
bundle install
|
|
34
|
+
bundle exec rake test_app
|
|
35
|
+
bundle exec rspec
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
For more information on developing Spree extensions, see the [Spree Developer Documentation](https://docs.spreecommerce.org/developer).
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
Spree Extension is released under the [MIT License](LICENSE.md).
|
data/Rakefile
ADDED
data/bin/spree-extension
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module SpreeExtension
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
|
7
|
+
|
|
8
|
+
desc 'Installs Spree Extension CLI binstub into your application'
|
|
9
|
+
|
|
10
|
+
def create_binstub
|
|
11
|
+
template 'bin/spree-extension', 'bin/spree-extension'
|
|
12
|
+
chmod 'bin/spree-extension', 0o755
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def show_post_install_message
|
|
16
|
+
say_status :installed, 'bin/spree-extension'
|
|
17
|
+
say ''
|
|
18
|
+
say 'You can now run Spree Extension commands using:'
|
|
19
|
+
say ' bin/spree-extension version'
|
|
20
|
+
say ' bin/spree-extension create my_extension'
|
|
21
|
+
say ''
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by the `bin/rails g spree_extension:install` command.
|
|
6
|
+
# It loads your application's bundled version of spree_extension.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'bundler/setup'
|
|
10
|
+
require 'spree_extension'
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
require 'active_support/core_ext/string/inflections'
|
|
2
|
+
|
|
3
|
+
module SpreeExtension
|
|
4
|
+
class Extension < Thor::Group
|
|
5
|
+
include Thor::Actions
|
|
6
|
+
|
|
7
|
+
desc 'builds a spree extension'
|
|
8
|
+
argument :file_name, type: :string, desc: 'rails app_path', default: 'sample_extension'
|
|
9
|
+
|
|
10
|
+
source_root File.expand_path('templates/extension', __dir__)
|
|
11
|
+
|
|
12
|
+
def generate
|
|
13
|
+
use_prefix 'spree_'
|
|
14
|
+
|
|
15
|
+
empty_directory file_name
|
|
16
|
+
|
|
17
|
+
directory 'app', "#{file_name}/app"
|
|
18
|
+
directory 'lib', "#{file_name}/lib"
|
|
19
|
+
directory 'bin', "#{file_name}/bin"
|
|
20
|
+
directory 'spec', "#{file_name}/spec"
|
|
21
|
+
|
|
22
|
+
empty_directory "#{file_name}/app/models/#{file_name}"
|
|
23
|
+
empty_directory "#{file_name}/app/views/spree"
|
|
24
|
+
empty_directory "#{file_name}/app/controllers/spree/admin"
|
|
25
|
+
empty_directory "#{file_name}/app/controllers/#{file_name}"
|
|
26
|
+
empty_directory "#{file_name}/app/services/#{file_name}"
|
|
27
|
+
empty_directory "#{file_name}/app/serializers/spree/api/v3"
|
|
28
|
+
empty_directory "#{file_name}/app/serializers/spree/api/v3/admin"
|
|
29
|
+
empty_directory "#{file_name}/vendor/javascript"
|
|
30
|
+
empty_directory "#{file_name}/vendor/stylesheets"
|
|
31
|
+
|
|
32
|
+
chmod "#{file_name}/bin/rails", 0o755
|
|
33
|
+
chmod "#{file_name}/bin/importmap", 0o755
|
|
34
|
+
|
|
35
|
+
template 'extension.gemspec', "#{file_name}/#{file_name}.gemspec"
|
|
36
|
+
template 'Gemfile', "#{file_name}/Gemfile"
|
|
37
|
+
template 'gitignore', "#{file_name}/.gitignore"
|
|
38
|
+
template 'LICENSE.md', "#{file_name}/LICENSE.md"
|
|
39
|
+
template 'Rakefile', "#{file_name}/Rakefile"
|
|
40
|
+
template 'README.md', "#{file_name}/README.md"
|
|
41
|
+
template 'config/routes.rb', "#{file_name}/config/routes.rb"
|
|
42
|
+
template 'config/locales/en.yml', "#{file_name}/config/locales/en.yml"
|
|
43
|
+
template 'config/initializers/spree.rb', "#{file_name}/config/initializers/spree.rb"
|
|
44
|
+
template 'config/importmap.rb', "#{file_name}/config/importmap.rb"
|
|
45
|
+
|
|
46
|
+
template 'rspec', "#{file_name}/.rspec"
|
|
47
|
+
template '.github/workflows/tests.yml', "#{file_name}/.github/workflows/tests.yml"
|
|
48
|
+
template '.github/.dependabot.yml', "#{file_name}/.github/.dependabot.yml"
|
|
49
|
+
template '.rubocop.yml', "#{file_name}/.rubocop.yml"
|
|
50
|
+
template '.gem_release.yml', "#{file_name}/.gem_release.yml"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def final_banner
|
|
54
|
+
say %{
|
|
55
|
+
#{'*' * 80}
|
|
56
|
+
|
|
57
|
+
Congrats, Your Spree #{human_name} extension has been generated 🚀
|
|
58
|
+
|
|
59
|
+
Next steps:
|
|
60
|
+
* Read Spree Developer Documentation at: https://docs.spreecommerce.org/developer
|
|
61
|
+
|
|
62
|
+
#{'*' * 80}
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
no_tasks do
|
|
67
|
+
def class_name
|
|
68
|
+
Thor::Util.camel_case file_name
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def human_name
|
|
72
|
+
file_name.to_s.gsub('spree_', '').humanize
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def use_prefix(prefix)
|
|
76
|
+
@file_name = prefix + Thor::Util.snake_case(file_name) unless file_name =~ /^#{prefix}/
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "bundler" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
test-postgres:
|
|
17
|
+
name: "PostgreSQL"
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
services:
|
|
20
|
+
postgres:
|
|
21
|
+
image: postgres:16
|
|
22
|
+
env:
|
|
23
|
+
POSTGRES_USER: postgres
|
|
24
|
+
POSTGRES_PASSWORD: postgres
|
|
25
|
+
ports:
|
|
26
|
+
- 5432:5432
|
|
27
|
+
options: >-
|
|
28
|
+
--health-cmd pg_isready
|
|
29
|
+
--health-interval 10s
|
|
30
|
+
--health-timeout 5s
|
|
31
|
+
--health-retries 5
|
|
32
|
+
env:
|
|
33
|
+
DB: postgres
|
|
34
|
+
DB_HOST: localhost
|
|
35
|
+
DB_USERNAME: postgres
|
|
36
|
+
DB_PASSWORD: postgres
|
|
37
|
+
BUNDLE_JOBS: 4
|
|
38
|
+
BUNDLE_RETRY: 3
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- uses: ruby/setup-ruby@v1
|
|
43
|
+
with:
|
|
44
|
+
ruby-version: '4.0'
|
|
45
|
+
bundler-cache: true
|
|
46
|
+
|
|
47
|
+
- name: Install libvips
|
|
48
|
+
run: sudo apt-get update && sudo apt-get install -y libvips-dev
|
|
49
|
+
|
|
50
|
+
- name: Create test app
|
|
51
|
+
run: bundle exec rake test_app
|
|
52
|
+
|
|
53
|
+
- name: Run tests
|
|
54
|
+
run: bundle exec rspec --format documentation
|
|
55
|
+
|
|
56
|
+
test-mysql:
|
|
57
|
+
name: "MySQL"
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
services:
|
|
60
|
+
mysql:
|
|
61
|
+
image: mysql:8.0
|
|
62
|
+
env:
|
|
63
|
+
MYSQL_ROOT_PASSWORD: password
|
|
64
|
+
ports:
|
|
65
|
+
- 3306:3306
|
|
66
|
+
options: >-
|
|
67
|
+
--health-cmd="mysqladmin ping"
|
|
68
|
+
--health-interval 10s
|
|
69
|
+
--health-timeout 5s
|
|
70
|
+
--health-retries 5
|
|
71
|
+
env:
|
|
72
|
+
DB: mysql
|
|
73
|
+
DB_HOST: 127.0.0.1
|
|
74
|
+
DB_USERNAME: root
|
|
75
|
+
DB_PASSWORD: password
|
|
76
|
+
BUNDLE_JOBS: 4
|
|
77
|
+
BUNDLE_RETRY: 3
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/checkout@v4
|
|
80
|
+
|
|
81
|
+
- uses: ruby/setup-ruby@v1
|
|
82
|
+
with:
|
|
83
|
+
ruby-version: '4.0'
|
|
84
|
+
bundler-cache: true
|
|
85
|
+
|
|
86
|
+
- name: Install libvips
|
|
87
|
+
run: sudo apt-get update && sudo apt-get install -y libvips-dev
|
|
88
|
+
|
|
89
|
+
- name: Create test app
|
|
90
|
+
run: bundle exec rake test_app
|
|
91
|
+
|
|
92
|
+
- name: Run tests
|
|
93
|
+
run: bundle exec rspec --format documentation
|
|
94
|
+
|
|
95
|
+
brakeman:
|
|
96
|
+
name: Brakeman
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
steps:
|
|
99
|
+
- uses: actions/checkout@v4
|
|
100
|
+
|
|
101
|
+
- uses: ruby/setup-ruby@v1
|
|
102
|
+
with:
|
|
103
|
+
ruby-version: '4.0'
|
|
104
|
+
bundler-cache: true
|
|
105
|
+
|
|
106
|
+
- name: Run Brakeman
|
|
107
|
+
run: bundle exec brakeman --exit-on-warn --exit-on-error
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rails
|
|
3
|
+
|
|
4
|
+
AllCops:
|
|
5
|
+
DisplayCopNames: true
|
|
6
|
+
TargetRubyVersion: 3.3
|
|
7
|
+
Include:
|
|
8
|
+
- '**/Gemfile'
|
|
9
|
+
- '**/Rakefile'
|
|
10
|
+
- '**/Appraisals'
|
|
11
|
+
Exclude:
|
|
12
|
+
- 'spec/dummy/**/*'
|
|
13
|
+
- 'lib/generators/**/*'
|
|
14
|
+
|
|
15
|
+
Layout/LineLength:
|
|
16
|
+
Max: 150
|
|
17
|
+
|
|
18
|
+
# DISABLED
|
|
19
|
+
|
|
20
|
+
Style/Documentation:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
Style/FrozenStringLiteralComment:
|
|
24
|
+
Enabled: false
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# How to contribute
|
|
2
|
+
|
|
3
|
+
Third-party patches are essential to any great open source project. We want
|
|
4
|
+
to keep it as easy as possible to contribute changes that get things working
|
|
5
|
+
in your environment. There are a few guidelines that we need contributors to
|
|
6
|
+
follow so that we can have a chance of keeping on top of things.
|
|
7
|
+
|
|
8
|
+
## Getting Started
|
|
9
|
+
|
|
10
|
+
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
|
11
|
+
* Submit a ticket for your issue, assuming one does not already exist.
|
|
12
|
+
* Clearly describe the issue including steps to reproduce when it is a bug.
|
|
13
|
+
* Make sure you fill in the earliest version that you know has the issue.
|
|
14
|
+
* Fork the repository on GitHub
|
|
15
|
+
|
|
16
|
+
## Making Changes
|
|
17
|
+
|
|
18
|
+
* Create a topic branch from where you want to base your work.
|
|
19
|
+
* This is usually the master branch.
|
|
20
|
+
* Only target release branches if you are certain your fix must be on that
|
|
21
|
+
branch.
|
|
22
|
+
* To quickly create a topic branch based on master; `git branch
|
|
23
|
+
fix/master/my_contribution master` then checkout the new branch with `git
|
|
24
|
+
checkout fix/master/my_contribution`. Please avoid working directly on the
|
|
25
|
+
`master` branch.
|
|
26
|
+
* Make commits of logical units.
|
|
27
|
+
* Check for unnecessary whitespace with `git diff --check` before committing.
|
|
28
|
+
* Make sure your commit messages are in the proper format.
|
|
29
|
+
|
|
30
|
+
````
|
|
31
|
+
(#99999) Make the example in CONTRIBUTING imperative and concrete
|
|
32
|
+
|
|
33
|
+
Without this patch applied the example commit message in the CONTRIBUTING
|
|
34
|
+
document is not a concrete example. This is a problem because the
|
|
35
|
+
contributor is left to imagine what the commit message should look like
|
|
36
|
+
based on a description rather than an example. This patch fixes the
|
|
37
|
+
problem by making the example concrete and imperative.
|
|
38
|
+
|
|
39
|
+
The first line is a real life imperative statement with a ticket number
|
|
40
|
+
from our issue tracker. The body describes the behavior without the patch,
|
|
41
|
+
why this is a problem, and how the patch fixes the problem when applied.
|
|
42
|
+
````
|
|
43
|
+
|
|
44
|
+
* Make sure you have added the necessary tests for your changes.
|
|
45
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
|
46
|
+
|
|
47
|
+
## Submitting Changes
|
|
48
|
+
|
|
49
|
+
* Push your changes to a topic branch in your fork of the repository.
|
|
50
|
+
* Submit a pull request to the extensions repository.
|
|
51
|
+
* Update any Github issues to mark that you have submitted code and are ready for it to be reviewed.
|
|
52
|
+
* Include a link to the pull request in the ticket
|
|
53
|
+
|
|
54
|
+
# Additional Resources
|
|
55
|
+
|
|
56
|
+
* [General GitHub documentation](http://help.github.com/)
|
|
57
|
+
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
git_source(:github) do |repo_name|
|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
|
5
|
+
"https://github.com/#{repo_name}.git"
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
gem 'rails-controller-testing'
|
|
9
|
+
|
|
10
|
+
spree_opts = { github: 'spree/spree', branch: 'main' }
|
|
11
|
+
gem 'spree', spree_opts
|
|
12
|
+
gem 'spree_admin', spree_opts
|
|
13
|
+
|
|
14
|
+
gem 'mysql2' if ENV['DB'] == 'mysql' || ENV['CI']
|
|
15
|
+
gem 'pg' if ENV['DB'] == 'postgres' || ENV['CI']
|
|
16
|
+
|
|
17
|
+
gem 'sqlite3', '>= 2.0'
|
|
18
|
+
|
|
19
|
+
gem 'propshaft'
|
|
20
|
+
|
|
21
|
+
gemspec
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) <%= Time.now.year %> [name of plugin creator]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Spree <%= human_name %>
|
|
2
|
+
|
|
3
|
+
This is a <%= human_name %> extension for [Spree Commerce](https://spreecommerce.org), an open source e-commerce platform built with Ruby on Rails.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Add this extension to your Gemfile with this line:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
bundle add <%= file_name %>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Run the install generator
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
bundle exec rails g <%= file_name %>:install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Restart your server
|
|
20
|
+
|
|
21
|
+
If your server was running, restart it so that it can find the assets properly.
|
|
22
|
+
|
|
23
|
+
## Developing
|
|
24
|
+
|
|
25
|
+
1. Create a dummy app
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bundle update
|
|
29
|
+
bundle exec rake test_app
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. Add your new code
|
|
33
|
+
3. Run tests
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bundle exec rspec
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
When testing your applications integration with this extension you may use it's factories.
|
|
40
|
+
Simply add this require statement to your spec_helper:
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
require '<%= file_name %>/factories'
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Releasing a new version
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
bundle exec gem bump -p -t
|
|
50
|
+
bundle exec gem release
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For more options please see [gem-release README](https://github.com/svenfuchs/gem-release)
|
|
54
|
+
|
|
55
|
+
## Contributing
|
|
56
|
+
|
|
57
|
+
If you'd like to contribute, please take a look at the
|
|
58
|
+
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
|
59
|
+
pull request.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'bundler'
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
3
|
+
|
|
4
|
+
require 'rspec/core/rake_task'
|
|
5
|
+
require 'spree/testing_support/extension_rake'
|
|
6
|
+
|
|
7
|
+
RSpec::Core::RakeTask.new
|
|
8
|
+
|
|
9
|
+
task :default do
|
|
10
|
+
if Dir['spec/dummy'].empty?
|
|
11
|
+
Rake::Task[:test_app].invoke
|
|
12
|
+
Dir.chdir('../../')
|
|
13
|
+
end
|
|
14
|
+
Rake::Task[:spec].invoke
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc 'Generates a dummy app for testing'
|
|
18
|
+
task :test_app do
|
|
19
|
+
ENV['LIB_NAME'] = '<%=file_name%>'
|
|
20
|
+
Rake::Task['extension:test_app'].invoke
|
|
21
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '@hotwired/turbo-rails'
|
|
2
|
+
import { Application } from '@hotwired/stimulus'
|
|
3
|
+
|
|
4
|
+
let application
|
|
5
|
+
|
|
6
|
+
if (typeof window.Stimulus === "undefined") {
|
|
7
|
+
application = Application.start()
|
|
8
|
+
application.debug = false
|
|
9
|
+
window.Stimulus = application
|
|
10
|
+
} else {
|
|
11
|
+
application = window.Stimulus
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
import <%= class_name %>Controller from '<%= file_name %>/controllers/<%= file_name %>_controller'
|
|
15
|
+
|
|
16
|
+
application.register('<%= file_name %>', <%= class_name %>Controller)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" from the root of your extension
|
|
3
|
+
|
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/<%= file_name -%>/engine', __FILE__)
|
|
6
|
+
|
|
7
|
+
require 'rails/all'
|
|
8
|
+
require 'rails/engine/commands'
|