spree 5.2.6 → 5.3.0.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9a62c4fb3de6c371219be83bc7f8ebad1ac882065628ac8ba04a976b8745cb7
4
- data.tar.gz: e288fdb3aed76a9c0db8b462a39a0f256d5c571dc0de06cee34755cdce56dfe0
3
+ metadata.gz: b7365c5dca80f3863fd5bb17ad8796efd121c0088673ab3557636a7effa305ac
4
+ data.tar.gz: 4c3b63afe40477ef8ea66fdd4da61741b8ac7d5cc52c60de8a0bf2e2112ff3c1
5
5
  SHA512:
6
- metadata.gz: 857e5ec80a0963ae48b52887170cbcea4aa23c633d37e0586db27e1727d0988d5f475191d371fcb44e540cefc044067c340ef955aaa6c7d8f97694f32cbb8f80
7
- data.tar.gz: 97d5fe7a29dd1c5a0d3bb99c2b9db5bc57ae39856f00eb1fd68a7620497a4570fa38f3f20826f6c5485e42f29a61ac55a124eed4d5c689d3a89b8f3ea0fd1b5b
6
+ metadata.gz: 801beabdfc207705ebd6001f40ed19664f202710b44fdb2ebd843bbb882b843674c0da4cf37c5547b99f4a24ff6d4f749fca72734311868ab35b45014bdae047
7
+ data.tar.gz: 2f538594a0fee8f04cbb2157a177a9605e5792beffdbb4374cea5a0e2df6f1ec84361be77e8a8dc8df88c514db1cb231093c6b50e6f9a88860cede6bc9776bcc
data/README.md CHANGED
@@ -40,7 +40,13 @@
40
40
 
41
41
  ## Getting Started
42
42
 
43
- Visit the [Quickstart Guide](https://spreecommerce.org/docs/developer/getting-started/quickstart) to set up Spree in 5 minutes.
43
+ Copy and paste the following command to your terminal to set up Spree in 5 minutes:
44
+
45
+ ```bash
46
+ bash -c "$(curl -fsSL https://spreecommerce.org/install)"
47
+ ```
48
+
49
+ If you prefer to install Spree manually, you can follow the [Quickstart Guide](https://spreecommerce.org/docs/developer/getting-started/quickstart).
44
50
 
45
51
  Make sure to check out [Spree 5 release announcement](https://github.com/spree/spree#spree-5-announcement--demo) and the latest [Spree 5.2 release](https://github.com/orgs/spree/discussions/13318), including:
46
52
  * [New Spree Installer CLI](https://spreecommerce.org/docs/developer/getting-started/quickstart) — spin up a project in seconds, with recommended defaults.
@@ -0,0 +1,175 @@
1
+ require 'rails/generators'
2
+ require 'highline/import'
3
+ require 'bundler'
4
+ require 'bundler/cli'
5
+ require 'active_support/core_ext/string/indent'
6
+ require 'spree/core'
7
+
8
+ module Spree
9
+ class InstallGenerator < Rails::Generators::Base
10
+ class_option :migrate, type: :boolean, default: true, banner: 'Run Spree migrations'
11
+ class_option :seed, type: :boolean, default: true, banner: 'load seed data (migrations must be run)'
12
+ class_option :sample, type: :boolean, default: false, banner: 'load sample data (migrations must be run)'
13
+ class_option :auto_accept, type: :boolean
14
+ class_option :user_class, type: :string
15
+ class_option :admin_user_class, type: :string
16
+ class_option :admin_email, type: :string
17
+ class_option :admin_password, type: :string
18
+ class_option :enforce_available_locales, type: :boolean, default: nil
19
+ class_option :authentication, type: :string, default: 'devise'
20
+
21
+ def self.source_paths
22
+ paths = superclass.source_paths
23
+ paths << File.expand_path('templates', __dir__)
24
+ paths.flatten
25
+ end
26
+
27
+ def prepare_options
28
+ @run_migrations = options[:migrate]
29
+ @load_seed_data = options[:seed]
30
+ @load_sample_data = options[:sample]
31
+ @authentication = options[:authentication]
32
+
33
+ unless @run_migrations
34
+ @load_seed_data = false
35
+ @load_sample_data = false
36
+ end
37
+ end
38
+
39
+ def add_files
40
+ template 'config/initializers/spree.rb', 'config/initializers/spree.rb'
41
+ end
42
+
43
+ def install_spree_cli
44
+ generate 'spree_cli:install'
45
+ end
46
+
47
+ def install_authentication
48
+ if @authentication == 'devise'
49
+ generate 'spree:authentication:devise'
50
+ elsif @authentication == 'dummy'
51
+ # this is for dummy / test app
52
+ end
53
+ end
54
+
55
+ def configure_application
56
+ application <<-APP.strip_heredoc.indent!(4)
57
+
58
+ config.to_prepare do
59
+ # Load application's model / class decorators
60
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
61
+ Rails.configuration.cache_classes ? require(c) : load(c)
62
+ end
63
+ end
64
+ APP
65
+
66
+ unless options[:enforce_available_locales].nil?
67
+ application <<-APP.strip_heredoc.indent!(4)
68
+ # Prevent this deprecation message: https://github.com/svenfuchs/i18n/commit/3b6e56e
69
+ I18n.enforce_available_locales = #{options[:enforce_available_locales]}
70
+ APP
71
+ end
72
+ end
73
+
74
+ def include_seed_data
75
+ append_file 'db/seeds.rb', <<-SEEDS.strip_heredoc
76
+
77
+ Spree::Core::Engine.load_seed if defined?(Spree::Core)
78
+ SEEDS
79
+ end
80
+
81
+ def install_migrations
82
+ say_status :copying, 'migrations'
83
+ silence_stream(STDOUT) do
84
+ silence_warnings { rake 'active_storage:install:migrations' }
85
+ silence_warnings { rake 'action_text:install:migrations' }
86
+ silence_warnings { rake 'spree:install:migrations' }
87
+ silence_warnings { rake 'spree_api:install:migrations' }
88
+ end
89
+ end
90
+
91
+ def run_migrations
92
+ if @run_migrations
93
+ say_status :running, 'migrations'
94
+ rake 'db:migrate'
95
+ else
96
+ say_status :skipping, "migrations (don't forget to run rake db:migrate)"
97
+ end
98
+ end
99
+
100
+ def populate_seed_data
101
+ if @load_seed_data
102
+ say_status :loading, 'seed data'
103
+ rake_options = []
104
+ rake_options << 'AUTO_ACCEPT=1' if options[:auto_accept]
105
+ rake_options << "ADMIN_EMAIL=#{options[:admin_email]}" if options[:admin_email]
106
+ rake_options << "ADMIN_PASSWORD=#{options[:admin_password]}" if options[:admin_password]
107
+
108
+ cmd = -> { rake("db:seed #{rake_options.join(' ')}") }
109
+ if options[:auto_accept] || (options[:admin_email] && options[:admin_password])
110
+ silence_warnings &cmd
111
+ else
112
+ cmd.call
113
+ end
114
+ else
115
+ say_status :skipping, 'seed data (you can always run bin/rails db:seed)'
116
+ end
117
+ end
118
+
119
+ def load_sample_data
120
+ return unless Spree::Core::Engine.sample_available?
121
+
122
+ if @load_sample_data
123
+ say_status :loading, 'sample data'
124
+ rake 'spree_sample:load'
125
+ else
126
+ say_status :skipping, 'sample data (you can always run rake spree_sample:load)'
127
+ end
128
+ end
129
+
130
+ def notify_about_routes
131
+ insert_into_file(File.join('config', 'routes.rb'),
132
+ after: "Rails.application.routes.draw do\n") do
133
+ <<-ROUTES.strip_heredoc.indent!(2)
134
+ # This line mounts Spree's routes at the root of your application.
135
+ # This means, any requests to URLs such as /products, will go to
136
+ # Spree::ProductsController.
137
+ # If you would like to change where this engine is mounted, simply change the
138
+ # :at option to something different.
139
+ #
140
+ # We ask that you don't use the :as option here, as Spree relies on it being
141
+ # the default of "spree".
142
+ mount Spree::Core::Engine, at: '/'
143
+ ROUTES
144
+ end
145
+
146
+ unless options[:quiet]
147
+ puts '*' * 50
148
+ puts "We added the following line to your application's config/routes.rb file:"
149
+ puts ' '
150
+ puts " mount Spree::Core::Engine, at: '/'"
151
+ end
152
+ end
153
+
154
+ def complete
155
+ unless options[:quiet]
156
+ puts '*' * 50
157
+ puts "Spree has been installed successfully. You're all ready to go!"
158
+ puts ' '
159
+ puts 'Enjoy!'
160
+ end
161
+ end
162
+
163
+ private
164
+
165
+ def silence_stream(stream)
166
+ old_stream = stream.dup
167
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
168
+ stream.sync = true
169
+ yield
170
+ ensure
171
+ stream.reopen(old_stream)
172
+ old_stream.close
173
+ end
174
+ end
175
+ end
@@ -0,0 +1,127 @@
1
+ # Configure Spree Preferences
2
+ #
3
+ # Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
4
+ # If you would like users to be able to update a setting with the Admin it should NOT be set here.
5
+ #
6
+ # Note: If a preference is set here it will be stored within the cache & database upon initialization.
7
+ # Just removing an entry from this initializer will not make the preference value go away.
8
+ # Instead you must either set a new value or remove entry, clear cache, and remove database entry.
9
+ #
10
+ # In order to initialize a setting do:
11
+ # config.setting_name = 'new value'
12
+ #
13
+ # More on configuring Spree preferences can be found at:
14
+ # https://docs.spreecommerce.org/developer/customization
15
+ Spree.config do |config|
16
+ # Example:
17
+ # Uncomment to stop tracking inventory levels in the application
18
+ # config.track_inventory_levels = false
19
+ end
20
+
21
+ # Background job queue names
22
+ # Spree.queues.default = :default
23
+ # Spree.queues.events = :default # Event subscribers (Spree::Events::SubscriberJob)
24
+ # Spree.queues.variants = :default
25
+ # Spree.queues.stock_location_stock_items = :default
26
+ # Spree.queues.coupon_codes = :default
27
+
28
+ # Use a CDN host for images, eg. Cloudfront
29
+ # This is used in the frontend to generate absolute URLs to images
30
+ # Default is nil and your application host will be used
31
+ # Spree.cdn_host = 'cdn.example.com'
32
+
33
+ # Multi-store setup
34
+ # You need to set a wildcard `root_domain` on the store to enable multi-store setup
35
+ # all new stores will be created in a subdomain of the root domain, eg. store1.lvh.me, store2.lvh.me, etc.
36
+ # Spree.root_domain = ENV.fetch('SPREE_ROOT_DOMAIN', 'lvh.me')
37
+
38
+ # Use a different service for storage (S3, google, etc)
39
+ # unless Rails.env.test?
40
+ # Spree.private_storage_service_name = :amazon_public # public assets, such as product images
41
+ # Spree.public_storage_service_name = :amazon_private # private assets, such as invoices, etc
42
+ # end
43
+
44
+ # Enable theme preview screenshots in admin dashboard
45
+ # Spree.screenshot_api_token = <Your Screenshot API token obtained from https://screenshotapi.net/>
46
+
47
+ # Configure Spree Dependencies
48
+ #
49
+ # Note: If a dependency is set here it will NOT be stored within the cache & database upon initialization.
50
+ # Just removing an entry from this initializer will make the dependency value go away.
51
+ #
52
+ # More on how to use Spree dependencies can be found at:
53
+ # https://docs.spreecommerce.org/customization/dependencies
54
+ Spree.dependencies do |dependencies|
55
+ # Example:
56
+ # Uncomment to change the default Service handling adding Items to Cart
57
+ # dependencies.cart_add_item_service = 'MyNewAwesomeService'
58
+ end
59
+
60
+ # Spree::Api::Dependencies.storefront_cart_serializer = 'MyRailsApp::CartSerializer'
61
+
62
+ # uncomment lines below to add your own custom business logic
63
+ # such as promotions, shipping methods, etc
64
+ Rails.application.config.after_initialize do
65
+ # Payment methods and shipping calculators
66
+ # Spree.payment_methods << Spree::PaymentMethods::VerySafeAndReliablePaymentMethod
67
+ # Spree.calculators.shipping_methods << Spree::ShippingMethods::SuperExpensiveNotVeryFastShipping
68
+ # Spree.calculators.tax_rates << Spree::TaxRates::FinanceTeamForcedMeToCodeThis
69
+
70
+ # Stock splitters and adjusters
71
+ # Spree.stock_splitters << Spree::Stock::Splitters::SecretLogicSplitter
72
+ # Spree.adjusters << Spree::Adjustable::Adjuster::TaxTheRich
73
+
74
+ # Custom promotions
75
+ # Spree.calculators.promotion_actions_create_adjustments << Spree::Calculators::PromotionActions::CreateAdjustments::AddDiscountForFriends
76
+ # Spree.calculators.promotion_actions_create_item_adjustments << Spree::Calculators::PromotionActions::CreateItemAdjustments::FinanceTeamForcedMeToCodeThis
77
+ # Spree.promotions.rules << Spree::Promotions::Rules::OnlyForVIPCustomers
78
+ # Spree.promotions.actions << Spree::Promotions::Actions::GiftWithPurchase
79
+
80
+ # Taxon rules
81
+ # Spree.taxon_rules << Spree::TaxonRules::ProductsWithColor
82
+
83
+ # Exports and reports
84
+ # Spree.export_types << Spree::Exports::Payments
85
+ # Spree.reports << Spree::Reports::MassivelyOvercomplexReportForCfo
86
+
87
+ # Page builder (themes, pages, sections, blocks)
88
+ # Spree.page_builder.themes << Spree::Themes::NewShinyTheme
89
+ # Spree.page_builder.theme_layout_sections << Spree::PageSections::SuperImportantCeoBio
90
+ # Spree.page_builder.pages << Spree::Pages::CustomLandingPage
91
+ # Spree.page_builder.page_sections << Spree::PageSections::ContactFormToGetInTouch
92
+ # Spree.page_builder.page_blocks << Spree::PageBlocks::BigRedButtonToCallSales
93
+
94
+ # Storefront partials
95
+ # Spree.storefront.partials.head << 'spree/shared/that_js_snippet_that_marketing_forced_me_to_include'
96
+
97
+ # Admin partials
98
+ # Spree.admin.partials.product_form << 'spree/admin/products/custom_section'
99
+
100
+ # Role-based permissions
101
+ # Configure which permission sets are assigned to each role
102
+ # More on permission sets: https://spreecommerce.org/docs/developer/customization/permissions
103
+ Spree.permissions.assign(:default, [Spree::PermissionSets::DefaultCustomer])
104
+ Spree.permissions.assign(:admin, [Spree::PermissionSets::SuperUser])
105
+
106
+ # Example: Create a custom role with specific permissions
107
+ # Spree.permissions.assign(:customer_service, [
108
+ # Spree::PermissionSets::DashboardDisplay,
109
+ # Spree::PermissionSets::OrderManagement,
110
+ # Spree::PermissionSets::UserDisplay
111
+ # ])
112
+ #
113
+ # Available permission sets:
114
+ # - Spree::PermissionSets::SuperUser (full admin access)
115
+ # - Spree::PermissionSets::DefaultCustomer (storefront access)
116
+ # - Spree::PermissionSets::DashboardDisplay (view admin dashboard)
117
+ # - Spree::PermissionSets::OrderDisplay / OrderManagement
118
+ # - Spree::PermissionSets::ProductDisplay / ProductManagement
119
+ # - Spree::PermissionSets::UserDisplay / UserManagement
120
+ # - Spree::PermissionSets::StockDisplay / StockManagement
121
+ # - Spree::PermissionSets::PromotionManagement
122
+ # - Spree::PermissionSets::ConfigurationManagement
123
+ # - Spree::PermissionSets::RoleManagement
124
+ end
125
+
126
+ Spree.user_class = <%= (options[:user_class].blank? ? 'Spree::LegacyUser' : options[:user_class]).inspect %>
127
+ Spree.admin_user_class = <%= (options[:admin_user_class].blank? ? (options[:user_class].blank? ? 'Spree::LegacyUser' : options[:user_class]) : options[:admin_user_class]).inspect %>
data/lib/spree.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require 'spree_core'
2
2
  require 'spree_api'
3
+ require 'spree_cli'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.6
4
+ version: 5.3.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 5.2.6
20
+ version: 5.3.0.rc1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 5.2.6
27
+ version: 5.3.0.rc1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: spree_api
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 5.2.6
34
+ version: 5.3.0.rc1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 5.2.6
41
+ version: 5.3.0.rc1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: spree_cli
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 5.2.6
48
+ version: 5.3.0.rc1
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 5.2.6
55
+ version: 5.3.0.rc1
56
56
  description: A complete open source e-commerce solution with multi-store, multi-currency
57
57
  and multi-language capabilities
58
58
  email: hello@spreecommerce.org
@@ -61,6 +61,8 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - README.md
64
+ - lib/generators/spree/install/install_generator.rb
65
+ - lib/generators/spree/install/templates/config/initializers/spree.rb
64
66
  - lib/spree.rb
65
67
  homepage: https://spreecommerce.org
66
68
  licenses:
@@ -68,9 +70,9 @@ licenses:
68
70
  - BSD-3-Clause
69
71
  metadata:
70
72
  bug_tracker_uri: https://github.com/spree/spree/issues
71
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.2.6
73
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0.rc1
72
74
  documentation_uri: https://docs.spreecommerce.org/
73
- source_code_uri: https://github.com/spree/spree/tree/v5.2.6
75
+ source_code_uri: https://github.com/spree/spree/tree/v5.3.0.rc1
74
76
  rdoc_options: []
75
77
  require_paths:
76
78
  - lib
@@ -78,7 +80,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
80
  requirements:
79
81
  - - ">="
80
82
  - !ruby/object:Gem::Version
81
- version: '3.0'
83
+ version: '3.2'
82
84
  required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  requirements:
84
86
  - - ">="