Skip to content

Commit

Permalink
Merge fb92824 into 6e60d27
Browse files Browse the repository at this point in the history
  • Loading branch information
bricesanchez committed Oct 14, 2019
2 parents 6e60d27 + fb92824 commit 275e0cd
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 55 deletions.
17 changes: 10 additions & 7 deletions Gemfile
Expand Up @@ -9,6 +9,9 @@ path "./" do
gem "refinerycms-resources"
end

gem 'bootsnap', require: false
gem 'listen'

gem 'spring'
gem 'spring-commands-rspec'
gem 'selenium-webdriver', require: false
Expand All @@ -25,12 +28,12 @@ unless ENV['TRAVIS']
gem 'sqlite3', platform: :ruby
end

if !ENV['TRAVIS'] || ENV['DB'] == 'mysql'
group :mysql do
gem 'activerecord-jdbcmysql-adapter', '>= 1.3.0.rc1', platform: :jruby
gem 'mysql2', '~> 0.4', :platform => :ruby
end
end
# if !ENV['TRAVIS'] || ENV['DB'] == 'mysql'
# group :mysql do
# gem 'activerecord-jdbcmysql-adapter', '>= 1.3.0.rc1', platform: :jruby
# gem 'mysql2', '~> 0.4', :platform => :ruby
# end
# end

if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql'
group :postgres, :postgresql do
Expand All @@ -40,7 +43,7 @@ if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql'
end

group :development do
gem 'listen', '~> 3.0'
gem 'byebug'
end

group :test do
Expand Down
5 changes: 4 additions & 1 deletion core/app/assets/config/refinery_core_manifest.js
@@ -1,19 +1,22 @@
//= link_tree ../images

//= link refinery/application.js
//= link refinery/refinery.js
//= link refinery/sortable_list.js
//= link refinery/nestedsortables.js
//= link refinery/serializelist.js
//= link refinery/tree.js
//= link admin.js
//= link application.js
//= link modernizr-min.js

//= link refinery/refinery.css
//= link refinery/formatting.css
//= link refinery/site_bar.css
//= link refinery/theme.css

//= link application.css
//= link cropper.css
//= link cropper.js
//= link canvas-to-blob.js
//= link refinery/image_crop.js
//= link refinery/image_crop.js
6 changes: 5 additions & 1 deletion core/config/initializers/assets.rb
@@ -1 +1,5 @@
Rails.application.config.assets.precompile << 'refinery_core_manifest.js'
# frozen_string_literal: true

if Rails.application.config.respond_to?(:assets)
Rails.application.config.assets.precompile << 'refinery_core_manifest.js'
end
@@ -1,12 +1,26 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'
require 'refinerycms-core'

require 'bundler/setup'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups(assets: %w(development test)))

# If you have a Gemfile, require the default gems, the ones in the
# current environment and also include :assets gems if in development
# or test environments.
Bundler.require *Rails.groups(:assets)
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
config.autoloader = :classic

<%= application_definition %>
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.

if config.respond_to?(:assets)
config.assets.paths << File.expand_path('app/assets/javascripts', __dir__)
config.assets.paths << File.expand_path('app/assets/stylesheets', __dir__)
end
end
end
Expand Up @@ -2,5 +2,4 @@ require 'rubygems'
gemfile = File.expand_path("<%= gemfile_path %>", __FILE__)

ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
require 'bundler/setup'
2 changes: 1 addition & 1 deletion core/lib/refinery.rb
Expand Up @@ -141,7 +141,7 @@ def route_for_model(klass, options = {})

klass = klass.constantize if klass.respond_to?(:constantize)
active_name = ::ActiveModel::Name.new(
klass, (Refinery if klass.parents.include?(Refinery))
klass, (Refinery if klass.module_parents.include?(Refinery))
)

if options[:admin]
Expand Down
4 changes: 2 additions & 2 deletions core/lib/refinery/application_controller.rb
Expand Up @@ -31,8 +31,8 @@ def error_404(exception = nil)
# fallback to the default 404.html page.
file = Rails.root.join 'public', '404.html'
file = Refinery.roots('refinery/core').join('public', '404.html') unless file.exist?
render :file => file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''),
:layout => false, :status => 404, :formats => [:html]
render file: file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''),
layout: false, status: 404, format: :html
return false
end

Expand Down
1 change: 0 additions & 1 deletion core/lib/refinery/core.rb
Expand Up @@ -24,4 +24,3 @@ def root
require 'jquery-rails'
require 'jquery-ui-rails'
require 'sass-rails'
require 'coffee-rails'
2 changes: 1 addition & 1 deletion core/lib/refinery/crud.rb
Expand Up @@ -85,7 +85,7 @@ def edit
end
def update
if @#{singular_name}.update_attributes(#{singular_name}_params)
if @#{singular_name}.update(#{singular_name}_params)
flash.notice = t(
'refinery.crudify.updated',
:what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"
Expand Down
44 changes: 37 additions & 7 deletions core/lib/refinery/extension_generation.rb
Expand Up @@ -3,13 +3,43 @@ module ExtensionGeneration

def self.included(base)
base.class_eval do
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

class_option :namespace, :type => :string, :default => nil, :banner => 'NAMESPACE', :required => false
class_option :authors, :type => :array, :default => [], :banner => 'author author', :required => false, :desc => 'Indicates authors of this extension'
class_option :extension, :type => :string, :default => nil, :banner => 'ENGINE', :required => false
class_option :i18n, :type => :array, :default => [], :required => false, :banner => "field field", :desc => 'Indicates generated fields'
class_option :install, :type => :boolean, :default => false, :required => false, :banner => nil, :desc => 'Bundles and runs the generated generator, rake db:migrate, rake db:seed for you'
argument :attributes,
type: :array,
default: [],
banner: 'field:type field:type'

class_option :namespace,
type: :string,
default: '',
banner: 'NAMESPACE',
required: false

class_option :authors,
type: :array,
default: [],
banner: 'author author',
required: false,
desc: 'Indicates authors of this extension'

class_option :extension,
type: :string,
default: '',
banner: 'ENGINE',
required: false

class_option :i18n,
type: :array,
default: [],
required: false,
banner: 'field field',
desc: 'Indicates generated fields'

class_option :install,
type: :boolean,
default: false,
required: false,
banner: nil,
desc: 'Bundles and runs the generated generator, rake db:migrate, rake db:seed for you'

remove_class_option :skip_namespace
end
Expand Down
2 changes: 1 addition & 1 deletion core/lib/refinery/plugins.rb
Expand Up @@ -49,7 +49,7 @@ def first_url_in_menu
def update_positions(plugin_list)
plugins = plugin_list.map {|p| find_by_name(p) }.reject(&:blank?)
plugins.each_with_index do |plugin, index|
plugin.update_attributes(position: index)
plugin.update(position: index)
end
end

Expand Down
4 changes: 2 additions & 2 deletions core/lib/refinery/version.rb
@@ -1,8 +1,8 @@
module Refinery
class Version
@major = 4
@minor = 0
@tiny = 2
@minor = 1
@tiny = 0
@build = nil

class << self
Expand Down
6 changes: 3 additions & 3 deletions core/refinerycms-core.gemspec
Expand Up @@ -2,7 +2,7 @@
require File.expand_path('../../core/lib/refinery/version', __FILE__)

version = Refinery::Version.to_s
rails_version = ['>= 5.2.0', '< 6']
rails_version = ['>= 6.0.0', '< 7']

Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
Expand All @@ -22,13 +22,13 @@ Gem::Specification.new do |s|

s.required_ruby_version = Refinery::Version.required_ruby_version

s.add_dependency 'refinerycms-i18n', ['~> 5.0', '>= 5.0.0']
s.add_dependency 'refinerycms-i18n', ['~> 5.0', '>= 5.0.1']
s.add_dependency 'railties', rails_version
s.add_dependency 'activerecord', rails_version
s.add_dependency 'actionpack', rails_version
s.add_dependency 'truncate_html', '~> 0.9'
s.add_dependency 'will_paginate', '~> 3.1', '>= 3.1.0'
s.add_dependency 'sass-rails', '>= 4.0', '< 5.1'
s.add_dependency 'sass-rails', '>= 4.0', '< 7'
s.add_dependency 'font-awesome-sass', '>= 4.3.0', '< 5.0'
s.add_dependency 'coffee-rails', ['~> 4.0', '>= 4.0.0']
s.add_dependency 'jquery-rails', '~> 4.3', '>= 4.3.1'
Expand Down
2 changes: 1 addition & 1 deletion pages/app/controllers/refinery/admin/pages_controller.rb
Expand Up @@ -22,7 +22,7 @@ def children
end

def update
if @page.update_attributes(page_params)
if @page.update(page_params)
flash.notice = t('refinery.crudify.updated', what: "'#{@page.title}'")

if from_dialog?
Expand Down
2 changes: 1 addition & 1 deletion pages/app/models/refinery/page.rb
Expand Up @@ -205,7 +205,7 @@ def destroy

# If you want to destroy a page that is set to be not deletable this is the way to do it.
def destroy!
self.update_attributes(:menu_match => nil, :link_url => nil, :deletable => true)
self.update(:menu_match => nil, :link_url => nil, :deletable => true)

self.destroy
end
Expand Down
2 changes: 1 addition & 1 deletion pages/db/seeds.rb
Expand Up @@ -51,7 +51,7 @@
'about' => 'About'
}.each do |slug, title|
Refinery::Page.by_title(title).each do |page|
page.update_attributes slug: slug
page.update slug: slug
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions pages/lib/refinery/pages/configuration.rb
Expand Up @@ -31,11 +31,11 @@ module Pages

class << self
def whitelist_elements
Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS.merge(config.add_whitelist_elements)
Loofah::HTML5::SafeList::ALLOWED_ELEMENTS.merge(config.add_whitelist_elements)
end

def whitelist_attributes
Loofah::HTML5::WhiteList::ALLOWED_ATTRIBUTES.merge(config.add_whitelist_attributes)
Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES.merge(config.add_whitelist_attributes)
end

def layout_template_whitelist
Expand Down
8 changes: 5 additions & 3 deletions pages/lib/refinery/pages/instance_methods.rb
@@ -1,14 +1,16 @@
# frozen_string_literal: true

module Refinery
module Pages
module InstanceMethods

def error_404(exception = nil)
if (@page = ::Refinery::Page.where(:menu_match => "^/404$").includes(:parts).first).present?
if (@page = ::Refinery::Page.where(menu_match: "^/404$").includes(:parts).first).present?
# render the application's custom 404 page with layout and meta.
if self.respond_to? :render_with_templates?, true
render_with_templates? @page, :status => 404
render_with_templates? @page, status: 404
else
render :template => '/refinery/pages/show', :formats => [:html], :status => 404
render template: '/refinery/pages/show', format: :html, status: 404
end
return false
else
Expand Down
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -39,6 +39,15 @@
config.include ActionView::TestCase::Behavior, :file_path => %r{spec/presenters}
config.infer_spec_type_from_file_location!

config.when_first_matching_example_defined(type: :feature) do
config.before :suite do
# Preload assets
# This should avoid capybara timeouts, and avoid counting asset compilation
# towards the timing of the first feature spec.
Rails.application.precompiled_assets
end
end

config.before(:each) do
::I18n.default_locale = I18n.locale = Mobility.locale = :en
end
Expand Down
3 changes: 0 additions & 3 deletions templates/refinery/demo.rb
Expand Up @@ -10,9 +10,6 @@
ERROR
end

if File.read("#{destination_root}/Gemfile") !~ /assets.+coffee-rails/m
gem "coffee-rails", :group => :assets
end

append_file 'Gemfile' do
"
Expand Down
4 changes: 0 additions & 4 deletions templates/refinery/edge.rb
Expand Up @@ -12,10 +12,6 @@
ERROR
end

if File.read("#{destination_root}/Gemfile") !~ /assets.+coffee-rails/m
gem "coffee-rails", :group => :assets
end

if ENV['REFINERY_PATH']
append_file 'Gemfile' do
"
Expand Down
4 changes: 0 additions & 4 deletions templates/refinery/installer.rb
Expand Up @@ -11,10 +11,6 @@
ERROR
end

if File.read("#{destination_root}/Gemfile") !~ /assets.+coffee-rails/m
gem "coffee-rails", :group => :assets
end

append_file 'Gemfile', <<-GEMFILE
# Refinery CMS
Expand Down
2 changes: 1 addition & 1 deletion testing/refinerycms-testing.gemspec
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n")

s.add_dependency 'refinerycms-core', version
s.add_dependency 'database_cleaner', '~> 1.6'
s.add_dependency 'database_cleaner', '>= 1.6'
s.add_dependency 'factory_bot_rails', '~> 4.8'
s.add_dependency 'rspec-rails', '~> 3.5'
s.add_dependency 'capybara', '>= 2.18'
Expand Down

0 comments on commit 275e0cd

Please sign in to comment.