Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Update gem to the latest version of solidus_dev_support
Browse files Browse the repository at this point in the history
  • Loading branch information
aldesantis committed May 22, 2020
1 parent 27ae4ba commit 2140c2b
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 79 deletions.
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
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ end
gemspec

# Use a local Gemfile to include development dependencies that might not be
# relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
send :eval_gemfile, 'Gemfile-local' if File.exist? 'Gemfile-local'
# relevant for the project or for other contributors, e.g. pry-byebug.
#
# We use `send` instead of calling `eval_gemfile` to work around an issue with
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
1 change: 0 additions & 1 deletion app/assets/javascripts/admin/solidus_product_feed.js

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
1 change: 0 additions & 1 deletion app/assets/javascripts/store/solidus_product_feed.js

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/admin/solidus_product_feed.css

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
3 changes: 0 additions & 3 deletions app/assets/stylesheets/store/solidus_product_feed.css

This file was deleted.

7 changes: 0 additions & 7 deletions app/overrides/rss_link.rb

This file was deleted.

13 changes: 13 additions & 0 deletions bin/r
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_product_feed/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'
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")
84 changes: 84 additions & 0 deletions bin/sandbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash

set -e

case "$DB" in
postgres|postgresql)
RAILSDB="postgresql"
;;
mysql)
RAILSDB="mysql"
;;
sqlite|'')
RAILSDB="sqlite3"
;;
*)
echo "Invalid DB specified: $DB"
exit 1
;;
esac

if [ ! -z $SOLIDUS_BRANCH ]
then
BRANCH=$SOLIDUS_BRANCH
else
BRANCH="master"
fi

extension_name="solidus_product_feed"

# Stay away from the bundler env of the containing extension.
function unbundled {
ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
}

rm -rf ./sandbox
unbundled bundle exec rails new sandbox --database="$RAILSDB" \
--skip-bundle \
--skip-git \
--skip-keeps \
--skip-rc \
--skip-spring \
--skip-test \
--skip-javascript

if [ ! -d "sandbox" ]; then
echo 'sandbox rails application failed'
exit 1
fi

cd ./sandbox
cat <<RUBY >> Gemfile
gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
gem 'solidus_auth_devise', '>= 2.1.0'
gem 'rails-i18n'
gem 'solidus_i18n'
gem '$extension_name', path: '..'
group :test, :development do
platforms :mri do
gem 'pry-byebug'
end
end
RUBY

unbundled bundle install --gemfile Gemfile

unbundled bundle exec rake db:drop db:create

unbundled bundle exec rails generate spree:install \
--auto-accept \
--user_class=Spree::User \
--enforce_available_locales=true \
--with-authentication=false \
$@

unbundled bundle exec rails generate solidus:auth:install

echo
echo "🚀 Sandbox app successfully created for $extension_name!"
echo "🚀 Using $RAILSDB and Solidus $BRANCH"
echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
echo "🚀 This app is intended for test purposes."
18 changes: 18 additions & 0 deletions bin/sandbox_rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

app_root = 'sandbox'

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

Dir.chdir app_root
exec 'bin/rails', *ARGV
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -vx

gem install bundler --conservative
bundle update
bundle exec rake clobber
bin/rake clobber
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.

en:
hello: Hello world
17 changes: 4 additions & 13 deletions lib/generators/solidus_product_feed/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,16 @@ 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/backend/all.js',
"//= require spree/backend/solidus_product_feed\n"
)
end

def add_migrations
run 'bundle exec rake railties:install:migrations FROM=solidus_product_feed'
run 'bin/rails railties:install:migrations FROM=solidus_product_feed'
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
Expand Down
2 changes: 0 additions & 2 deletions lib/solidus_product_feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
require 'solidus_product_feed/version'
require 'solidus_product_feed/engine'

require 'deface'

module SolidusProductFeed
class << self
attr_writer :title, :link, :description, :language, :feed_product_class
Expand Down
9 changes: 1 addition & 8 deletions lib/solidus_product_feed/engine.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spree/core'
require 'solidus_product_feed'

module SolidusProductFeed
class Engine < Rails::Engine
Expand All @@ -14,13 +15,5 @@ class Engine < Rails::Engine
config.generators do |g|
g.test_framework :rspec
end

def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator.rb')) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end

config.to_prepare(&method(:activate).to_proc)
end
end
69 changes: 33 additions & 36 deletions solidus_product_feed.gemspec
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
# frozen_string_literal: true

$:.push File.expand_path('lib', __dir__)
require 'solidus_product_feed/version'

Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'solidus_product_feed'
s.version = SolidusProductFeed::VERSION
s.summary = 'Spree extension that provides an RSS feed for products'
s.description = 'A Spree extension that provides an RSS feed for products, with Google Shopper extensions' # rubocop:disable Metrics/LineLength

s.required_ruby_version = '~> 2.4'

s.author = 'Joshua Nussbaum'
s.email = 'joshnuss@gmail.com'
s.homepage = 'https://github.com/solidusio-contrib/solidus_product_feed'
s.license = 'BSD-3-Clause'

s.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
s.test_files = Dir['spec/**/*']
s.bindir = "exe"
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
s.require_paths = ["lib"]

if s.respond_to?(:metadata)
s.metadata["homepage_uri"] = s.homepage if s.homepage
s.metadata["source_code_uri"] = s.homepage if s.homepage
end

s.add_runtime_dependency 'deface'
s.add_runtime_dependency 'solidus_backend', [">= 1.0", "< 3"]
s.add_runtime_dependency 'solidus_core', ['>= 1.0', '< 3']
s.add_runtime_dependency 'solidus_support', '~> 0.5'

s.add_development_dependency 'solidus_dev_support'
require_relative 'lib/solidus_product_feed/version'

Gem::Specification.new do |spec|
spec.name = 'solidus_product_feed'
spec.version = SolidusProductFeed::VERSION
spec.authors = ['Joshua Nussbaum']
spec.email = 'joshnuss@gmail.com'

spec.summary = 'Solidus extension that provides an RSS feed for products.'
spec.description = 'A Solidus extension that provides an RSS feed for products, with support for Google Merchant Feed.'
spec.homepage = 'https://github.com/solidusio-contrib/solidus_product_feed'
spec.license = 'BSD-3-Clause'

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_product_feed'
spec.metadata['changelog_uri'] = ''

spec.required_ruby_version = Gem::Requirement.new('~> 2.5')

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }

spec.files = files.grep_v(%r{^(test|spec|features)/})
spec.test_files = files.grep(%r{^(test|spec|features)/})
spec.bindir = "exe"
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
spec.add_dependency 'solidus_support', '~> 0.5'

spec.add_development_dependency 'solidus_dev_support'
end
7 changes: 5 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# frozen_string_literal: true

# Configure Rails Environment
ENV['RAILS_ENV'] ||= 'test'
ENV['RAILS_ENV'] = 'test'

# Run Coverage report
require 'solidus_dev_support/rspec/coverage'

require File.expand_path('dummy/config/environment.rb', __dir__)
require File.expand_path('dummy/config/environment.rb', __dir__).tap { |file|
# Create the dummy app if it's still missing.
system 'bin/rake extension:test_app' unless File.exist? file
}

# Requires factories and other useful helpers defined in spree_core.
require 'solidus_dev_support/rspec/feature_helper'
Expand Down

0 comments on commit 2140c2b

Please sign in to comment.