diff --git a/.travis.yml b/.travis.yml index 99957f1..395dbd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ before_install: - gem install bundler - bundle update --bundler rvm: - - 2.4 - 2.5 - 2.6 - 2.7 diff --git a/Gemfile b/Gemfile index 3dc13a4..d641641 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,11 @@ source 'https://rubygems.org' gemspec -gem 'ransack-mongoid', git: 'https://github.com/activerecord-hackery/ransack-mongoid' +# gem 'ransack-mongoid', git: 'https://github.com/activerecord-hackery/ransack-mongoid' +gem 'ransack-mongoid', github: 'jesusalc/ransack-mongoid', branch: 'rails-6-mongoid-7-ruby-2-7-0' gem 'rails', '>= 5.2', '< 6.1' +gem 'webpacker' gem 'devise' diff --git a/Gemfile.lock b/Gemfile.lock index 909e942..3b500b5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,14 +1,15 @@ GIT - remote: https://github.com/activerecord-hackery/ransack-mongoid - revision: bd1935293d2f285fa7cf33d2c5c90d981bf67338 + remote: https://github.com/jesusalc/ransack-mongoid.git + revision: b7f68881081731afdfaa010499d06adc93d17d71 + branch: rails-6-mongoid-7-ruby-2-7-0 specs: - ransack-mongoid (0.1.0) + ransack-mongoid (0.1.1) PATH remote: . specs: - activeadmin-mongoid (1.0.0) - activeadmin (>= 1.4.3) + activeadmin-mongoid (1.0.1) + activeadmin (>= 1.4.3, <= 2.6.0) jquery-rails kaminari-mongoid mongoid (>= 6.0, < 8.a) @@ -17,29 +18,42 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (5.2.3) - actionpack (= 5.2.3) + actioncable (6.0.2.1) + actionpack (= 6.0.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) + actionmailbox (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + mail (>= 2.7.1) + actionmailer (6.0.2.1) + actionpack (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) - rack (~> 2.0) + actionpack (6.0.2.1) + actionview (= 6.0.2.1) + activesupport (= 6.0.2.1) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.1) + actionpack (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + nokogiri (>= 1.8.5) + actionview (6.0.2.1) + activesupport (= 6.0.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) + rails-html-sanitizer (~> 1.1, >= 1.2.0) activeadmin (2.6.0) arbre (~> 1.2, >= 1.2.1) formtastic (~> 3.1) @@ -51,44 +65,44 @@ GEM ransack (~> 2.1, >= 2.1.1) sassc-rails (~> 2.1) sprockets (>= 3.0, < 4.1) - activejob (5.2.3) - activesupport (= 5.2.3) + activejob (6.0.2.1) + activesupport (= 6.0.2.1) globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) - arel (>= 9.0) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) + activemodel (6.0.2.1) + activesupport (= 6.0.2.1) + activerecord (6.0.2.1) + activemodel (= 6.0.2.1) + activesupport (= 6.0.2.1) + activestorage (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) marcel (~> 0.3.1) - activesupport (5.2.3) + activesupport (6.0.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) + zeitwerk (~> 2.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) arbre (1.2.1) activesupport (>= 3.0.0) - arel (9.0.0) bcrypt (3.1.13) bson (4.7.1) - builder (3.2.3) - capybara (3.12.0) + builder (3.2.4) + capybara (3.31.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.2) + regexp_parser (~> 1.5) xpath (~> 3.2) cliver (0.3.2) coderay (1.1.2) concurrent-ruby (1.1.5) - crass (1.0.5) + crass (1.0.6) devise (4.7.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -97,7 +111,7 @@ GEM warden (~> 1.2.3) diff-lcs (1.3) docile (1.3.1) - erubi (1.8.0) + erubi (1.9.0) ffi (1.12.1) formtastic (3.1.5) actionpack (>= 3.2.13) @@ -107,14 +121,14 @@ GEM has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) - i18n (1.6.0) + i18n (1.8.2) concurrent-ruby (~> 1.0) inherited_resources (1.11.0) actionpack (>= 5.0, < 6.1) has_scope (~> 0.6) railties (>= 5.0, < 6.1) responders (>= 2, < 4) - jquery-rails (4.3.3) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -122,25 +136,25 @@ GEM railties (>= 3.2.16) jslint (1.2.0) json - json (2.1.0) - kaminari (1.1.1) + json (2.3.0) + kaminari (1.2.0) activesupport (>= 4.1.0) - kaminari-actionview (= 1.1.1) - kaminari-activerecord (= 1.1.1) - kaminari-core (= 1.1.1) - kaminari-actionview (1.1.1) + kaminari-actionview (= 1.2.0) + kaminari-activerecord (= 1.2.0) + kaminari-core (= 1.2.0) + kaminari-actionview (1.2.0) actionview - kaminari-core (= 1.1.1) - kaminari-activerecord (1.1.1) + kaminari-core (= 1.2.0) + kaminari-activerecord (1.2.0) activerecord - kaminari-core (= 1.1.1) - kaminari-core (1.1.1) + kaminari-core (= 1.2.0) + kaminari-core (1.2.0) kaminari-mongoid (1.0.1) kaminari-core (~> 1.0) mongoid launchy (2.4.3) addressable (~> 2.3) - loofah (2.3.1) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -148,17 +162,17 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) - mimemagic (0.3.3) - mini_mime (1.0.1) + mimemagic (0.3.4) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) + minitest (5.14.0) mongo (2.11.3) bson (>= 4.4.2, < 5.0.0) mongoid (7.0.5) activemodel (>= 5.1, < 6.1) mongo (>= 2.5.1, < 3.0.0) - nio4r (2.3.1) - nokogiri (1.10.5) + nio4r (2.5.2) + nokogiri (1.10.7) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) poltergeist (1.18.1) @@ -170,46 +184,50 @@ GEM pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) - pry-rails (0.3.8) + pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (3.0.3) - rack (2.0.8) + public_suffix (4.0.3) + rack (2.1.2) + rack-proxy (0.6.5) + rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.3) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) + rails (6.0.2.1) + actioncable (= 6.0.2.1) + actionmailbox (= 6.0.2.1) + actionmailer (= 6.0.2.1) + actionpack (= 6.0.2.1) + actiontext (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) + activemodel (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) bundler (>= 1.3.0) - railties (= 5.2.3) + railties (= 6.0.2.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.2.0) - loofah (~> 2.2, >= 2.2.2) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.1) + actionpack (= 6.0.2.1) + activesupport (= 6.0.2.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rake (12.3.3) + thor (>= 0.20.3, < 2.0) + rake (13.0.1) ransack (2.3.2) activerecord (>= 5.2.1) activesupport (>= 5.2.1) i18n polyamorous (= 2.3.2) - regexp_parser (1.3.0) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) + regexp_parser (1.6.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) rspec-core (3.8.0) rspec-support (~> 3.8.0) rspec-expectations (3.8.2) @@ -242,25 +260,30 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sprockets (3.7.2) + sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) - tzinfo (1.2.5) + tzinfo (1.2.6) thread_safe (~> 0.1) warden (1.2.8) rack (>= 2.0.6) - websocket-driver (0.7.0) + webpacker (4.2.2) + activesupport (>= 4.2) + rack-proxy (>= 0.6.1) + railties (>= 4.2) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.4) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.2.2) PLATFORMS ruby @@ -279,6 +302,7 @@ DEPENDENCIES ransack-mongoid! rspec-rails (~> 3.6) simplecov + webpacker BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/activeadmin-mongoid.gemspec b/activeadmin-mongoid.gemspec index 4e49952..35c0c5f 100644 --- a/activeadmin-mongoid.gemspec +++ b/activeadmin-mongoid.gemspec @@ -4,27 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'active_admin/mongoid/version' Gem::Specification.new do |gem| - gem.authors = ['Elia Schito', 'Nic Boie', 'JD Guzman', 'Grzegorz Jakubiak'] - gem.email = ['elia@schito.me'] - gem.description = %q{ActiveAdmin hacks to support Mongoid (some ActiveAdmin features are disabled)} - gem.summary = %q{ActiveAdmin hacks to support Mongoid} - gem.homepage = '' + gem.authors = ['Jesus Alcaraz', 'Elia Schito', 'Nic Boie', 'JD Guzman', + 'Grzegorz Jakubiak'] + gem.email = %w(jesusalc@gmail.com elia@schito.me) + gem.description = 'ActiveAdmin hacks Mongoid (some features are disabled)' + gem.summary = 'ActiveAdmin hacks to support Mongoid' + gem.homepage = '' - gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - gem.files = `git ls-files`.split("\n") - gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - gem.name = 'activeadmin-mongoid' + gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } + gem.files = `git ls-files`.split("\n") + gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + gem.name = 'activeadmin-mongoid' gem.require_paths = ['lib'] - gem.version = ActiveAdmin::Mongoid::VERSION - gem.license = 'MIT' + gem.version = ActiveAdmin::Mongoid::VERSION + gem.license = 'MIT' - gem.required_ruby_version = '>= 2.4' + gem.required_ruby_version = '>= 2.5' - gem.add_runtime_dependency 'mongoid', '>= 6.0', '< 8.a' - gem.add_runtime_dependency 'activeadmin', '>= 1.4.3' + gem.add_runtime_dependency 'mongoid', '>= 6.0', '< 8.a' + gem.add_runtime_dependency 'activeadmin', '>= 1.4.3', '<= 3.6.0' gem.add_runtime_dependency 'kaminari-mongoid' gem.add_runtime_dependency 'jquery-rails' - gem.add_runtime_dependency 'sass-rails', ['>= 3.1.4'] + gem.add_runtime_dependency 'sass-rails', '>= 3.1.4' - gem.add_development_dependency 'rspec-rails', '~> 3.6' + gem.add_development_dependency 'rspec-rails', '~> 3.6' end diff --git a/lib/active_admin/mongoid/version.rb b/lib/active_admin/mongoid/version.rb index c67e774..7843a7d 100644 --- a/lib/active_admin/mongoid/version.rb +++ b/lib/active_admin/mongoid/version.rb @@ -1,5 +1,5 @@ module ActiveAdmin module Mongoid - VERSION = '1.0.0' + VERSION = '1.0.2'.freeze end end diff --git a/tasks/js.rake b/tasks/js.rake index e292d7f..72ee9db 100644 --- a/tasks/js.rake +++ b/tasks/js.rake @@ -1,29 +1,29 @@ namespace :js do - desc "Compile the JS for Rails apps without Asset Pipeline" + desc 'Compile the JS for Rails apps without Asset Pipeline' task :compile do require 'sprockets' require 'uglifier' require 'fileutils' - root_dir = File.expand_path(File.join("..", ".."), __FILE__) - js_dir = File.join(root_dir, "app", "assets", "javascripts", "active_admin") + root_dir = File.expand_path(File.join('..', '..'), __FILE__) + js_dir = File.join(root_dir, 'app', 'assets', 'javascripts', 'active_admin') generated_file = File.join(root_dir, 'lib', 'generators', 'active_admin', 'assets', 'templates', '3.0', 'active_admin.js') # The base.js file requires jquery. We don't need jquery to # compile the assets, however Sprockets will try to look it up # and raise an exception. Insteaad, we move the file out of the directory # then put it back after we compile. - base_js = File.join(js_dir, "base.js") - tmp_base_js = File.join(root_dir, "base.js") + base_js = File.join(js_dir, 'base.js') + tmp_base_js = File.join(root_dir, 'base.js') FileUtils.mv base_js, tmp_base_js env = Sprockets::Environment.new env.js_compressor = ::Uglifier.new env.append_path js_dir - File.open generated_file, "w+" do |f| - f << env["application"] + File.open generated_file, 'w+' do |f| + f << env['application'] end FileUtils.mv tmp_base_js, base_js diff --git a/tasks/test.rake b/tasks/test.rake index 0f6b5bc..e9fca92 100644 --- a/tasks/test.rake +++ b/tasks/test.rake @@ -1,39 +1,39 @@ -desc "Creates a test rails app for the specs to run against" +desc 'Creates a test rails app for the specs to run against' task :setup do require 'rails/version' - system("mkdir spec/rails") unless File.exists?("spec/rails") + system('mkdir spec/rails') unless File.exists?('spec/rails') system "bundle exec rails new spec/rails/rails-#{Rails::VERSION::STRING} -O -m spec/support/rails_template.rb" end # Run specs and cukes -desc "Run the full suite" -task :test => ['spec:unit', 'spec:integration'] +desc 'Run the full suite' +task test: %w(spec:unit spec:integration) namespace :test do def run_tests_against(*versions) - current_version = detect_rails_version if File.exists?("Gemfile.lock") + current_version = detect_rails_version if File.exists?('Gemfile.lock') versions.each do |version| puts puts "== Using Rails #{version}" cmd "./script/use_rails #{version}" - cmd "bundle exec rspec spec" - cmd "bundle exec cucumber features" - cmd "bundle exec cucumber -p class-reloading features" + cmd 'bundle exec rspec spec' + cmd 'bundle exec cucumber features' + cmd 'bundle exec cucumber -p class-reloading features' end cmd "./script/use_rails #{current_version}" if current_version end - desc "Run the full suite against the important versions of rails" + desc 'Run the full suite against the important versions of rails' task :major_supported_rails do - run_tests_against "3.0.12", "3.1.4", "3.2.3" + run_tests_against '3.0.12', '3.1.4', '3.2.3' end - desc "Alias for major_supported_rails" - task :all => :major_supported_rails + desc 'Alias for major_supported_rails' + task all: :major_supported_rails end @@ -43,14 +43,14 @@ RSpec::Core::RakeTask.new(:spec) namespace :spec do - desc "Run the unit specs" + desc 'Run the unit specs' RSpec::Core::RakeTask.new(:unit) do |t| - t.pattern = "spec/unit/**/*_spec.rb" + t.pattern = 'spec/unit/**/*_spec.rb' end - desc "Run the integration specs" + desc 'Run the integration specs' RSpec::Core::RakeTask.new(:integration) do |t| - t.pattern = "spec/integration/**/*_spec.rb" + t.pattern = 'spec/integration/**/*_spec.rb' end end diff --git a/test_app/app/assets/config/manifest.js b/test_app/app/assets/config/manifest.js new file mode 100644 index 0000000..5cc2c08 --- /dev/null +++ b/test_app/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css \ No newline at end of file diff --git a/test_app/config/environments/development.rb b/test_app/config/environments/development.rb index ae55b61..b865a2a 100644 --- a/test_app/config/environments/development.rb +++ b/test_app/config/environments/development.rb @@ -1,4 +1,5 @@ Rails.application.configure do + config.eager_load = false # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on diff --git a/test_app/config/environments/production.rb b/test_app/config/environments/production.rb index f569a7a..da0476b 100644 --- a/test_app/config/environments/production.rb +++ b/test_app/config/environments/production.rb @@ -1,4 +1,5 @@ Rails.application.configure do + config.eager_load = true # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests diff --git a/test_app/config/environments/test.rb b/test_app/config/environments/test.rb index 108339c..2aa70e8 100644 --- a/test_app/config/environments/test.rb +++ b/test_app/config/environments/test.rb @@ -1,4 +1,5 @@ Rails.application.configure do + config.eager_load = true # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's