summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-06-13 17:22:13 +0200
committerAlessandro Desantis <desa.alessandro@gmail.com>2020-06-13 17:29:14 +0200
commit5b1b4c685e6baa5c6fa52ef2da479205f2c6e632 (patch)
tree863dfc0ba12468d3f9c02a72001d336b51225ee7 /lib
parentf0e6a42a0229f42b3ad42fbd157c958696388e2e (diff)
Update to the latest solidus_dev_support
Diffstat (limited to 'lib')
-rw-r--r--lib/generators/solidus_subscriptions/install/install_generator.rb18
-rw-r--r--lib/solidus_subscriptions.rb11
-rw-r--r--lib/solidus_subscriptions/engine.rb21
-rw-r--r--lib/solidus_subscriptions/version.rb2
4 files changed, 31 insertions, 21 deletions
diff --git a/lib/generators/solidus_subscriptions/install/install_generator.rb b/lib/generators/solidus_subscriptions/install/install_generator.rb
index 7214153..ec380b1 100644
--- a/lib/generators/solidus_subscriptions/install/install_generator.rb
+++ b/lib/generators/solidus_subscriptions/install/install_generator.rb
@@ -1,28 +1,30 @@
+# frozen_string_literal: true
+
module SolidusSubscriptions
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :auto_run_migrations, type: :boolean, default: false
def add_javascripts
- append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_subscriptions\n"
- append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_subscriptions\n"
+ append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_subscriptions\n" # rubocop:disable Metrics/LineLength
+ append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_subscriptions\n" # rubocop:disable Metrics/LineLength
end
def add_stylesheets
- inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_subscriptions\n", before: /\*\//, verbose: true
- inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_subscriptions\n", before: /\*\//, verbose: true
+ inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_subscriptions\n", before: %r{\*/}, verbose: true # rubocop:disable Metrics/LineLength
+ inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_subscriptions\n", before: %r{\*/}, verbose: true # rubocop:disable Metrics/LineLength
end
def add_migrations
- run 'bundle exec rake railties:install:migrations FROM=solidus_subscriptions'
+ run 'bin/rails railties:install:migrations FROM=solidus_subscriptions'
end
def run_migrations
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Metrics/LineLength
if run_migrations
- run 'bundle exec rake db:migrate'
+ run 'bin/rails db:migrate'
else
- puts 'Skipping rake db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
+ puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
end
end
end
diff --git a/lib/solidus_subscriptions.rb b/lib/solidus_subscriptions.rb
index aa31ea5..69c7b7a 100644
--- a/lib/solidus_subscriptions.rb
+++ b/lib/solidus_subscriptions.rb
@@ -1,6 +1,11 @@
-require 'solidus'
+# frozen_string_literal: true
+
+require 'solidus_core'
require 'solidus_support'
-require 'solidus_subscriptions/ability'
-require 'solidus_subscriptions/engine'
+
require 'deface'
require 'state_machines'
+
+require 'solidus_subscriptions/ability'
+require 'solidus_subscriptions/version'
+require 'solidus_subscriptions/engine'
diff --git a/lib/solidus_subscriptions/engine.rb b/lib/solidus_subscriptions/engine.rb
index 822f9b2..7b9f336 100644
--- a/lib/solidus_subscriptions/engine.rb
+++ b/lib/solidus_subscriptions/engine.rb
@@ -1,11 +1,18 @@
+# frozen_string_literal: true
+
+require 'spree/core'
+
+require 'solidus_subscriptions'
+require 'solidus_subscriptions/permitted_attributes'
+require 'solidus_subscriptions/config'
+require 'solidus_subscriptions/processor'
+
module SolidusSubscriptions
class Engine < Rails::Engine
- require 'spree/core'
- require 'solidus_subscriptions/permitted_attributes'
- require 'solidus_subscriptions/config'
- require 'solidus_subscriptions/processor'
+ include SolidusSupport::EngineExtensions
isolate_namespace SolidusSubscriptions
+
engine_name 'solidus_subscriptions'
# use rspec for tests
@@ -13,8 +20,6 @@ module SolidusSubscriptions
g.test_framework :rspec
end
- config.autoload_paths << config.root.join('app', 'jobs')
-
initializer 'configure spree subcription permitted attributes', after: 'require subscription lib helpers' do
PermittedAttributes.update_spree_permiteed_attributes
end
@@ -40,10 +45,6 @@ module SolidusSubscriptions
end
def self.activate
- Dir.glob(File.join(File.dirname(__FILE__), '../../app/decorators/**/*.rb')) do |c|
- Rails.configuration.cache_classes ? require(c) : load(c)
- end
-
Spree::Ability.register_ability(SolidusSubscriptions::Ability)
end
diff --git a/lib/solidus_subscriptions/version.rb b/lib/solidus_subscriptions/version.rb
index 0b77f6d..20e95e7 100644
--- a/lib/solidus_subscriptions/version.rb
+++ b/lib/solidus_subscriptions/version.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module SolidusSubscriptions
VERSION = '0.0.1'
end