This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from nebulab/mm/dev-support
Make extension compliant to solidus_dev_support
- Loading branch information
Showing
25 changed files
with
270 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
issues=false | ||
exclude-labels=infrastructure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
app/assets/stylesheets/spree/backend/solidus_paypal_braintree.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
Placeholder manifest file. | ||
the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/backend/all.css' | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# frozen_string_literal: true | ||
|
||
app_root = 'spec/dummy' | ||
|
||
unless File.exist? "#{app_root}/bin/rails" | ||
system "bin/rake", app_root or begin | ||
warn "Automatic creation of the dummy app failed" | ||
exit 1 | ||
end | ||
if %w[g generate].include? ARGV.first | ||
exec "#{__dir__}/rails-engine", *ARGV | ||
else | ||
exec "#{__dir__}/rails-sandbox", *ARGV | ||
end | ||
|
||
Dir.chdir app_root | ||
exec 'bin/rails', *ARGV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_paypal_braintree/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env ruby | ||
|
||
app_root = 'sandbox' | ||
|
||
unless File.exist? "#{app_root}/bin/rails" | ||
warn 'Creating the sandbox app...' | ||
Dir.chdir "#{__dir__}/.." do | ||
system "#{__dir__}/sandbox" or begin | ||
warn 'Automatic creation of the sandbox app failed' | ||
exit 1 | ||
end | ||
end | ||
end | ||
|
||
Dir.chdir app_root | ||
exec 'bin/rails', *ARGV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
if [ ! -z $DEBUG ] | ||
then | ||
set -x | ||
fi | ||
|
||
case "$DB" in | ||
postgres|postgresql) | ||
RAILSDB="postgresql" | ||
;; | ||
mysql) | ||
RAILSDB="mysql" | ||
;; | ||
sqlite3|sqlite) | ||
RAILSDB="sqlite3" | ||
;; | ||
'') | ||
echo "~~> Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter" | ||
RAILSDB="sqlite3" | ||
;; | ||
*) | ||
echo "Invalid value specified for the Solidus sandbox: DB=\"$DB\"." | ||
echo "Please use 'postgres', 'mysql', or 'sqlite' instead." | ||
exit 1 | ||
;; | ||
esac | ||
echo "~~> Using $RAILSDB as the database engine" | ||
|
||
if [ -n $SOLIDUS_BRANCH ] | ||
then | ||
BRANCH=$SOLIDUS_BRANCH | ||
else | ||
echo "~~> Use 'export SOLIDUS_BRANCH=[master|v3.2|...]' to control the Solidus branch" | ||
BRANCH="master" | ||
fi | ||
echo "~~> Using branch $BRANCH of solidus" | ||
|
||
if [ -z $SOLIDUS_FRONTEND ] | ||
then | ||
echo "~~> Use 'export SOLIDUS_FRONTEND=[solidus_frontend|solidus_starter_frontend]' to control the Solidus frontend" | ||
SOLIDUS_FRONTEND="solidus_frontend" | ||
fi | ||
echo "~~> Using branch $SOLIDUS_FRONTEND as the solidus frontend" | ||
|
||
extension_name="solidus_paypal_braintree" | ||
|
||
# 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 '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 solidus:install \ | ||
--auto-accept \ | ||
--user_class=Spree::User \ | ||
--enforce_available_locales=true \ | ||
--with-authentication=true \ | ||
--payment-method=none \ | ||
--frontend=${SOLIDUS_FRONTEND} \ | ||
$@ | ||
|
||
unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations | ||
unbundled bundle exec rails generate ${extension_name}:install --auto-run-migrations | ||
|
||
echo | ||
echo "🚀 Sandbox app successfully created for $extension_name!" | ||
echo "🧪 This app is intended for test purposes." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ set -vx | |
|
||
gem install bundler --conservative | ||
bundle update | ||
bundle exec rake clobber | ||
bin/rake clobber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
lib/generators/solidus_paypal_braintree/install/templates/initializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
SolidusPaypalBraintree.configure do |config| | ||
# TODO: Remember to change this with the actual preferences you have implemented! | ||
# config.sample_preference = 'sample_value' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.