Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate ext with solidus_dev_support #60

Merged
merged 4 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
# Always take the latest version of the Orb, this allows us to
# Always take the latest version of the orb, this allows us to
# run specs against Solidus supported versions only without the need
# to change this configuration every time a Solidus version is released
# or goes EOL.
Expand Down
5 changes: 5 additions & 0 deletions .gem_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bump:
recurse: false
file: 'lib/solidus_static_content/version.rb'
message: Bump SolidusStaticContent to %{version}
branch: true
17 changes: 17 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
19 changes: 13 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
*.gem
\#*
*~
.#*
.DS_Store
nbproject
**.gem
.idea
.project
.sass-cache
coverage
Gemfile.lock
spec/dummy/
.rvmrc
tmp
coverage
.bundle
nbproject
pkg
*.swp
spec/dummy
spec/examples.txt
4 changes: 1 addition & 3 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
--colour
--format
progress
--color
14 changes: 14 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require:
- solidus_dev_support/rubocop

inherit_gem:
solidus_dev_support: .rubocop.yml

AllCops:
Exclude:
- spec/dummy/**/*
- vendor/**/*

Rails/SkipsModelValidations:
Exclude:
- db/migrate/**/*
24 changes: 21 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
source 'https://rubygems.org/'
# frozen_string_literal: true

gemspec
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
gem 'solidus', github: 'solidusio/solidus', branch: branch

gem "rails-controller-testing", group: :test
# Needed to help Bundler figure out how to resolve dependencies,
# otherwise it takes forever to resolve them.
# See https://github.com/bundler/bundler/issues/6677
gem 'rails', '>0.a'

# Provides basic authentication functionality for testing parts of your engine
gem 'solidus_auth_devise'

case ENV['DB']
when 'mysql'
gem 'mysql2'
when 'postgresql'
gem 'pg'
else
gem 'sqlite3'
end

gemspec
File renamed without changes.
31 changes: 4 additions & 27 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
require 'rake/clean'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'spree/testing_support/extension_rake'
# frozen_string_literal: true

test_app_path = 'spec/dummy'
require 'solidus_dev_support/rake_tasks'
SolidusDevSupport::RakeTasks.install

CLOBBER.include test_app_path

desc 'Generates a dummy app for testing'
directory test_app_path do
ENV['LIB_NAME'] = 'solidus_static_content'
Rake::Task['extension:test_app'].invoke

# We need to go back to the gem root since extension:test_app changes
# the working directory to be the dummy app.
cd __dir__
end

RSpec::Core::RakeTask.new(:specs, [] => FileList[test_app_path]) do |t|
# Ref: https://circleci.com/docs/2.0/configuration-reference/#store_test_results
if ENV['TEST_RESULTS_PATH']
t.rspec_opts =
"--format progress " \
"--format RspecJunitFormatter --out #{ENV['TEST_RESULTS_PATH']}"
end
end

task :default => :specs
task default: %w[extension:test_app extension:specs]

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/spree/backend/spree_static_content.css

This file was deleted.

11 changes: 11 additions & 0 deletions app/assets/stylesheets/spree/frontend/solidus_static_content.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Placeholder manifest file.
the installer will append this file to the app vendored assets here: 'vendor/assets/stylesheets/spree/frontend/all.css'
*/
/* Sidebar */
nav#pages .pages-root {
text-transform: uppercase;
border-bottom: 1px solid rgb(217, 217, 219);
margin-bottom: 5px;
font-size: 14px;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
/* Sidebar */
nav#pages .pages-root {
text-transform: uppercase;
border-bottom: 1px solid rgb(217, 217, 219);
margin-bottom: 5px;
font-size: 14px;
}
/* DEPRECATED: Delegate to the solidus namespaced file */
/* = require spree/frontend/solidus_static_content */
4 changes: 3 additions & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

require "bundler/setup"
require "solidus_static_content"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
$LOAD_PATH.unshift *Dir["#{__dir__}/../app/*"]
$LOAD_PATH.unshift(*Dir["#{__dir__}/../app/*"])

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
Expand Down
10 changes: 7 additions & 3 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env ruby

unless File.exist? 'spec/dummy/bin/rails'
system "bin/rake", "spec/dummy" or begin
# frozen_string_literal: true

app_root = 'spec/dummy'

unless File.exist? "#{app_root}/bin/rails"
system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
warn "Automatic creation of the dummy app failed"
exit 1
end
end

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

gem install bundler --conservative
bundle update
bin/rake clobber
bin/rake spec/dummy
bin/rails railties:install:migrations db:migrate db:seed
bundle exec rake extension:test_app
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Spree::Core::Engine.routes.draw do
namespace :admin do
resources :pages do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# frozen_string_literal: true

module SolidusStaticContent
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :auto_run_migrations, type: :boolean, default: false

def add_stylesheets
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_static_content\n", before: /\*\//, verbose: true
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_static_content\n", before: %r{\*/}, verbose: true
end

def add_migrations
run 'bundle exec rake railties:install:migrations FROM=solidus_static_content'
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]'))
if run_migrations
run 'bundle exec rake db:migrate'
else
puts 'Skipping rake db:migrate, don\'t forget to run it!'
puts 'Skipping rake db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_static_content/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusStaticContent
VERSION = '1.0.0'
end
78 changes: 30 additions & 48 deletions solidus_static_content.gemspec
Original file line number Diff line number Diff line change
@@ -1,56 +1,38 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
$:.push File.expand_path('lib', __dir__)
require 'solidus_static_content/version'

Gem::Specification.new do |spec|
spec.name = "solidus_static_content"
spec.version = SolidusStaticContent::VERSION
spec.authors = ["Peter Berkenbosch", "Roman Smirnov"]
spec.email = "peter@pero-ict.nl"

spec.summary = %q{Extension to manage the static pages for your Solidus store.}
spec.description = %q{Manage the static pages of your Solidus store or replace existing pages with a static version}
spec.homepage = "https://github.com/solidusio-contrib/solidus_static_content#readme"
spec.license = "BSD-3"

if spec.respond_to?(:metadata)
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "https://github.com/solidusio-contrib/solidus_static_content/releases"
Gem::Specification.new do |s|
s.name = 'solidus_static_content'
s.version = SolidusStaticContent::VERSION
s.summary = %q{Extension to manage the static pages for your Solidus store.}
s.description = %q{Manage the static pages of your Solidus store or replace existing pages with a static version}
s.license = 'BSD-3-Clause'

s.author = ["Peter Berkenbosch", "Roman Smirnov"]
s.email = 'peter@pero-ict.nl'
s.homepage = 'https://github.com/solidusio-contrib/solidus_static_content#readme'

if s.respond_to?(:metadata)
s.metadata["homepage_uri"] = s.homepage if s.homepage
s.metadata["source_code_uri"] = s.homepage if s.homepage
s.metadata["changelog_uri"] = 'https://github.com/solidusio-contrib/solidus_static_content/releases'
end

# 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.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
s.required_ruby_version = '~> 2.4'

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

spec.add_dependency 'solidus', ['>= 2.3', '< 3']
spec.add_dependency 'solidus_support'
spec.add_dependency 'deface', '~> 1.0'

spec.add_development_dependency 'apparition'
spec.add_development_dependency 'capybara', '~> 3.12'
spec.add_development_dependency 'capybara-screenshot'
spec.add_development_dependency 'database_cleaner', '~> 1.5'
spec.add_development_dependency 'factory_bot', '~> 5.1'
spec.add_development_dependency 'ffaker'
spec.add_development_dependency 'mysql2', '~> 0.5.2'
spec.add_development_dependency 'pg', '~> 1.1'
spec.add_development_dependency 'poltergeist', '~> 1.10'
spec.add_development_dependency 'pry-rails'
spec.add_development_dependency 'puma'
spec.add_development_dependency 'rails-controller-testing'
spec.add_development_dependency 'rspec-rails', '~> 4.0.0.beta2'
spec.add_development_dependency 'rspec_junit_formatter'
spec.add_development_dependency 'selenium-webdriver'
spec.add_development_dependency 'simplecov', '~> 0.12'
spec.add_development_dependency 'solidus_auth_devise'
spec.add_development_dependency 'sprockets', '< 4'
spec.add_development_dependency 'sqlite3'
spec.add_development_dependency 'solidus_dev_support'
s.test_files = Dir['spec/**/*']
s.bindir = "exe"
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
s.add_dependency 'solidus_support', '~> 0.4.0'
s.add_dependency 'deface', '~> 1.0'

s.add_development_dependency 'solidus_dev_support'
end
4 changes: 1 addition & 3 deletions spec/features/spree/admin/pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@

scenario 'can be deleted' do
within_row(1) do
click_icon :trash
accept_confirm { click_icon :trash }
end

page.driver.browser.switch_to.alert.accept unless Capybara.javascript_driver == :poltergeist

expect(page).not_to have_text static_page.title
end
end
Expand Down
27 changes: 15 additions & 12 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# frozen_string_literal: true

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

require File.expand_path("../dummy/config/environment.rb", __FILE__)
# Run Coverage report
require 'solidus_dev_support/rspec/coverage'

require "rspec/rails"
require File.expand_path('dummy/config/environment.rb', __dir__)

Dir[File.join(File.dirname(__FILE__), "/support/**/*.rb")].each { |file| require file }
# Requires factories and other useful helpers defined in spree_core.
require 'solidus_dev_support/rspec/feature_helper'

require "factory_bot"
require "spree_static_content/factories"
require "spree/testing_support/controller_requests"
require "solidus_support/extension/feature_helper"
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }

# Requires factories defined in lib/solidus_static_content/factories.rb
require 'solidus_static_content/factories'

RSpec.configure do |config|
config.include Spree::TestingSupport::ControllerRequests, type: :controller
config.infer_spec_type_from_file_location!
config.use_transactional_fixtures = false
end

# A fix for https://github.com/rspec/rspec-rails/issues/1897
Capybara.server = :puma, { Silent: true }