diff --git a/Gemfile b/Gemfile index 286ad7f..6461499 100644 --- a/Gemfile +++ b/Gemfile @@ -6,4 +6,13 @@ gemspec gem 'spring-commands-rspec', group: :development gem 'spring-commands-teaspoon', group: :development -gem 'rails', '5.2.6' +if ENV['PAGEFLOW_DEPENDENCIES'] == 'experimental' + git 'https://github.com/codevise/pageflow', branch: 'edge', glob: '**/*.gemspec' do + gem 'pageflow' + gem 'pageflow-support' + end + + gem 'pageflow-external-links', git: 'https://github.com/codevise/pageflow-external-links' +else + gem 'rails', '5.2.6' +end diff --git a/bin/rspec b/bin/rspec index 91cf232..03365b6 100755 --- a/bin/rspec +++ b/bin/rspec @@ -4,7 +4,7 @@ ENV['RAILS_ENV'] ||= 'test' dummy_root = File.expand_path("../spec/dummy/rails-4.1.9", File.dirname(__FILE__)) begin - load File.expand_path("../spring", __FILE__) if File.exists?(dummy_root) + load File.expand_path("../spring", __FILE__) if File.exist?(dummy_root) rescue LoadError end require 'bundler/setup' diff --git a/lib/pageflow-linkmap-page.rb b/lib/pageflow-linkmap-page.rb index 803bb3a..ba299ce 100644 --- a/lib/pageflow-linkmap-page.rb +++ b/lib/pageflow-linkmap-page.rb @@ -1,4 +1,5 @@ require 'pageflow/linkmap_page/engine' +require 'pageflow/linkmap_page/version' module Pageflow module LinkmapPage diff --git a/lib/pageflow/linkmap_page/engine.rb b/lib/pageflow/linkmap_page/engine.rb index 2cbcb7b..f3a1b19 100644 --- a/lib/pageflow/linkmap_page/engine.rb +++ b/lib/pageflow/linkmap_page/engine.rb @@ -1,13 +1,36 @@ require 'pageflow-external-links' +require 'paperclip' + +require 'pageflow/linkmap_page/paperclip_processors/colors' +require 'pageflow/linkmap_page/paperclip_processors/color_mask' +require 'pageflow/linkmap_page/paperclip_processors/invoke_callback' +require 'pageflow/linkmap_page/paperclip_processors/image_dimensions' module Pageflow module LinkmapPage class Engine < Rails::Engine isolate_namespace Pageflow::LinkmapPage - config.autoload_paths << File.join(config.root, 'lib') config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s] + if Rails.respond_to?(:autoloaders) + lib = root.join('lib') + + config.autoload_paths << lib + config.eager_load_paths << lib + + initializer 'pageflow_linkmap_page.autoloading' do + Rails.autoloaders.main.ignore( + lib.join('generators'), + lib.join('pageflow-linkmap-page.rb'), + lib.join('pageflow/linkmap_page/paperclip_processors'), + lib.join('pageflow/linkmap_page/version.rb') + ) + end + else + config.autoload_paths << File.join(config.root, 'lib') + end + initializer 'pageflow_linkmap_page.paperclip' do Paperclip.configure do |config| config.register_processor(:pageflow_linkmap_page_image_colors, diff --git a/pageflow-linkmap-page.gemspec b/pageflow-linkmap-page.gemspec index b7cd54f..6a27b61 100644 --- a/pageflow-linkmap-page.gemspec +++ b/pageflow-linkmap-page.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] - spec.required_ruby_version = '~> 2.1' + spec.required_ruby_version = '>= 2.1' spec.add_runtime_dependency 'pageflow', ['>= 15.7', '< 17'] spec.add_runtime_dependency 'pageflow-external-links', '~> 2.x' @@ -24,10 +24,15 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', ['>= 1.0', '< 3'] spec.add_development_dependency 'pageflow-support', ['>= 15.0', '< 17'] spec.add_development_dependency 'rake', '~> 12.0' - spec.add_development_dependency 'rspec-rails', '~> 3.7' spec.add_development_dependency 'factory_bot_rails', '~> 4.8' spec.add_development_dependency 'sqlite3', '~> 1.3' + if ENV['PAGEFLOW_DEPENDENCIES'] == 'experimental' + spec.add_development_dependency 'rspec-rails', '~> 6.0' + else + spec.add_development_dependency 'rspec-rails', '~> 3.7' + end + # Browser like integration testing spec.add_development_dependency 'capybara', '~> 2.13'