spree_cli 5.3.0.rc2 → 5.3.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/README.md +177 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b60223cb0e1f940e26e62b146848802c5c2fc143d5e0d7fe85b53c438feef4e3
|
|
4
|
+
data.tar.gz: 0c4d4843744afc6a8fb84c30a63b4339ffb171b4d46d6a46ca7aceefcf7ba10d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6791bebe3544fa5fe81ee4f73997461415ccb5590e1df394028e9cac895e155f0fe37772a46bdc25e024f4eeb230da2350b61f48a005e1f23c05ad4f3217b60f
|
|
7
|
+
data.tar.gz: d771f82b6c72fc95b9e5c31c6b08a0100f878ea85194577b44253a63a5aa137e2d4658ca18592cf3f808dd9bc1087ffcb0e8f2909cc96eb4ec017552fd41e143
|
data/README.md
CHANGED
|
@@ -1,11 +1,182 @@
|
|
|
1
|
-
Spree CLI
|
|
2
|
-
===============
|
|
1
|
+
# Spree CLI
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/spree_cli)
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Spree CLI is a command-line tool for Spree Commerce developers, providing generators and utilities for creating Spree extensions and managing Spree projects.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
This gem is included in every Spree installation.
|
|
10
|
+
|
|
11
|
+
For global installation (to generate extensions outside of a Spree project):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gem install spree_cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
### Create New Extension
|
|
20
|
+
|
|
21
|
+
Generate a new Spree extension with all the necessary boilerplate:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
8
24
|
spree extension my_extension
|
|
9
25
|
```
|
|
10
26
|
|
|
11
|
-
This
|
|
27
|
+
This creates a new directory `spree_my_extension` with:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
spree_my_extension/
|
|
31
|
+
├── app/
|
|
32
|
+
│ ├── models/
|
|
33
|
+
│ ├── controllers/
|
|
34
|
+
│ └── views/
|
|
35
|
+
├── lib/
|
|
36
|
+
│ ├── spree_my_extension.rb
|
|
37
|
+
│ ├── spree_my_extension/
|
|
38
|
+
│ │ └── engine.rb
|
|
39
|
+
│ └── generators/
|
|
40
|
+
├── config/
|
|
41
|
+
│ ├── routes.rb
|
|
42
|
+
│ └── locales/
|
|
43
|
+
├── db/
|
|
44
|
+
│ └── migrate/
|
|
45
|
+
├── spec/
|
|
46
|
+
├── Gemfile
|
|
47
|
+
├── spree_my_extension.gemspec
|
|
48
|
+
├── README.md
|
|
49
|
+
└── LICENSE
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Extension Options
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Create extension with specific options
|
|
56
|
+
spree extension my_extension --path=/custom/path
|
|
57
|
+
|
|
58
|
+
# View help
|
|
59
|
+
spree help extension
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Extension Development
|
|
63
|
+
|
|
64
|
+
After creating an extension:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cd spree_my_extension
|
|
68
|
+
|
|
69
|
+
# Install dependencies
|
|
70
|
+
bundle install
|
|
71
|
+
|
|
72
|
+
# Create test application
|
|
73
|
+
bundle exec rake test_app
|
|
74
|
+
|
|
75
|
+
# Run tests
|
|
76
|
+
bundle exec rspec
|
|
77
|
+
|
|
78
|
+
# Build gem
|
|
79
|
+
gem build spree_my_extension.gemspec
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Extension Structure
|
|
83
|
+
|
|
84
|
+
Generated extensions follow Spree conventions:
|
|
85
|
+
|
|
86
|
+
```ruby
|
|
87
|
+
# lib/spree_my_extension/engine.rb
|
|
88
|
+
module SpreeMyExtension
|
|
89
|
+
class Engine < Rails::Engine
|
|
90
|
+
require 'spree/core'
|
|
91
|
+
isolate_namespace Spree
|
|
92
|
+
engine_name 'spree_my_extension'
|
|
93
|
+
|
|
94
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
|
95
|
+
|
|
96
|
+
initializer 'spree_my_extension.environment', before: :load_config_initializers do |_app|
|
|
97
|
+
SpreeMyExtension::Config = SpreeMyExtension::Configuration.new
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.activate
|
|
101
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
102
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
config.to_prepare(&method(:activate).to_proc)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Adding Models
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
# app/models/spree/my_model.rb
|
|
115
|
+
module Spree
|
|
116
|
+
class MyModel < Spree.base_class
|
|
117
|
+
# Model implementation
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Adding Controllers
|
|
123
|
+
|
|
124
|
+
```ruby
|
|
125
|
+
# app/controllers/spree/admin/my_models_controller.rb
|
|
126
|
+
module Spree
|
|
127
|
+
module Admin
|
|
128
|
+
class MyModelsController < ResourceController
|
|
129
|
+
# Controller implementation
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Adding Migrations
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cd spree_my_extension
|
|
139
|
+
bin/rails g migration CreateSpreeMyModels
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Publishing Extensions
|
|
143
|
+
|
|
144
|
+
1. Update version in `lib/spree_my_extension/version.rb`
|
|
145
|
+
2. Update `CHANGELOG.md`
|
|
146
|
+
3. Build and publish:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
gem build spree_my_extension.gemspec
|
|
150
|
+
gem push spree_my_extension-1.0.0.gem
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Usage
|
|
154
|
+
|
|
155
|
+
### In a Spree Application
|
|
156
|
+
|
|
157
|
+
Add your extension to the application's Gemfile:
|
|
158
|
+
|
|
159
|
+
```ruby
|
|
160
|
+
gem 'spree_my_extension', '~> 1.0'
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Run installation:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
bundle install
|
|
167
|
+
bin/rails g spree_my_extension:install
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Documentation
|
|
171
|
+
|
|
172
|
+
- [Extension Development Guide](https://docs.spreecommerce.org/developer/extending-spree/extensions)
|
|
173
|
+
- [Creating Extensions Tutorial](https://docs.spreecommerce.org/developer/tutorials/extensions)
|
|
174
|
+
- [Spree Extensions Directory](https://spreecommerce.org/extensions)
|
|
175
|
+
|
|
176
|
+
## Contributing
|
|
177
|
+
|
|
178
|
+
1. Fork the repository
|
|
179
|
+
2. Create a feature branch
|
|
180
|
+
3. Make your changes
|
|
181
|
+
4. Run tests
|
|
182
|
+
5. Submit a pull request
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.3.0
|
|
4
|
+
version: 5.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Mar
|
|
@@ -85,9 +85,9 @@ licenses:
|
|
|
85
85
|
- BSD-3-Clause
|
|
86
86
|
metadata:
|
|
87
87
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
88
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0
|
|
88
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0
|
|
89
89
|
documentation_uri: https://docs.spreecommerce.org/
|
|
90
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.3.0
|
|
90
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.3.0
|
|
91
91
|
rdoc_options: []
|
|
92
92
|
require_paths:
|
|
93
93
|
- lib
|