diff --git a/.gitignore b/.gitignore index be82d15a2f..0ced8f286b 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ pkg /.idea .byebug_history gemfiles/.bundle/ +.yardoc +/doc diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000000..77c591c8c3 --- /dev/null +++ b/.yardopts @@ -0,0 +1,13 @@ +- +CHANGELOG.md +docs/getting_started.md +docs/rails_api.md +docs/customizing_dashboards.md +docs/customizing_page_views.md +docs/customizing_attribute_partials.md +docs/adding_controllers_without_related_model.md +docs/adding_custom_field_types.md +docs/authentication.md +docs/authorization.md +CODE_OF_CONDUCT.md +LICENSE.md diff --git a/Appraisals b/Appraisals index 63730dc164..0121c3eda2 100644 --- a/Appraisals +++ b/Appraisals @@ -1,14 +1,3 @@ -appraise "rails42" do - gem "actionpack", "~> 4.2.0" - gem "actionview", "~> 4.2.0" - gem "activerecord", "~> 4.2.0" - gem "pg", "0.21.0" - - group :development, :test do - gem "rspec-rails" - end -end - appraise "rails50" do gem "actionpack", "~> 5.0.0" gem "actionview", "~> 5.0.0" diff --git a/Gemfile b/Gemfile index b0a7af82b0..9c2d805766 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,7 @@ group :development, :test do gem "factory_bot_rails" gem "i18n-tasks", "0.9.31" gem "pry-rails" + gem "yard" end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 6e9fecde64..6425a0e1c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,9 +2,9 @@ PATH remote: . specs: administrate (0.14.0) - actionpack (>= 4.2) - actionview (>= 4.2) - activerecord (>= 4.2) + actionpack (>= 5.0) + actionview (>= 5.0) + activerecord (>= 5.0) autoprefixer-rails (>= 6.0) datetime_picker_rails (~> 0.0.7) jquery-rails (>= 4.0) @@ -53,7 +53,7 @@ GEM rake thor (>= 0.14.0) ast (2.4.0) - autoprefixer-rails (9.8.6.1) + autoprefixer-rails (9.8.6.3) execjs awesome_print (1.8.0) builder (3.2.4) @@ -92,7 +92,7 @@ GEM railties (>= 5.0.0) faker (2.13.0) i18n (>= 1.6, < 2) - faraday (1.0.0) + faraday (1.0.1) multipart-post (>= 1.2, < 3) ffi (1.13.1) formulaic (0.4.1) @@ -212,7 +212,7 @@ GEM selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - sentry-raven (3.0.0) + sentry-raven (3.0.2) faraday (>= 1.0) shoulda-matchers (4.3.0) activesupport (>= 4.2.0) @@ -243,6 +243,7 @@ GEM hashdiff (>= 0.4.0, < 2.0.0) xpath (3.2.0) nokogiri (~> 1.8) + yard (0.9.25) zeitwerk (2.3.1) PLATFORMS @@ -281,6 +282,7 @@ DEPENDENCIES unicorn webmock xpath (= 3.2.0) + yard BUNDLED WITH 1.17.3 diff --git a/README.md b/README.md index bbc32024cc..4ae484b411 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,7 @@ To accomplish these goals, Administrate follows a few guiding principles: ## Getting Started -Administrate supports Rails from 4.2, up to 5.0 and beyond. We support Ruby -2.4 and up. +Administrate supports Rails 5.0 onwards. We support Ruby 2.4 and up. Add Administrate to your Gemfile and re-bundle: @@ -104,7 +103,7 @@ git repository, too. Please see [CONTRIBUTING.md](/CONTRIBUTING.md). -administrate was originally written by Grayson Wright and is now maintained by +administrate was originally written by Grace Youngblood and is now maintained by Nick Charlton. Many improvements and bugfixes were contributed by the [open source community](https://github.com/thoughtbot/administrate/graphs/contributors). diff --git a/administrate.gemspec b/administrate.gemspec index f9fb33630c..ffdec7ac77 100644 --- a/administrate.gemspec +++ b/administrate.gemspec @@ -14,9 +14,9 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib,docs}/**/*", "LICENSE", "Rakefile"] s.test_files = Dir["test/**/*"] - s.add_dependency "actionpack", ">= 4.2" - s.add_dependency "actionview", ">= 4.2" - s.add_dependency "activerecord", ">= 4.2" + s.add_dependency "actionpack", ">= 5.0" + s.add_dependency "actionview", ">= 5.0" + s.add_dependency "activerecord", ">= 5.0" s.add_dependency "autoprefixer-rails", ">= 6.0" s.add_dependency "datetime_picker_rails", "~> 0.0.7" diff --git a/app/views/fields/polymorphic/_show.html.erb b/app/views/fields/polymorphic/_show.html.erb index 42f1ff38a3..27a5645aee 100644 --- a/app/views/fields/polymorphic/_show.html.erb +++ b/app/views/fields/polymorphic/_show.html.erb @@ -17,7 +17,7 @@ By default, the relationship is rendered as a link to the associated object. %> <% if field.data %> - <% if valid_action?(:show, field.attribute) %> + <% if valid_action?(:show, field.data.class) %> <%= link_to( field.display_associated_resource, [namespace, field.data], diff --git a/docs/adding_controllers_without_related_model.md b/docs/adding_controllers_without_related_model.md index d5017a0a47..2f812890fa 100644 --- a/docs/adding_controllers_without_related_model.md +++ b/docs/adding_controllers_without_related_model.md @@ -1,3 +1,7 @@ +--- +title: Adding Controllers without a related Model +--- + # Adding Controllers without a related Model Sometimes you may want to add a custom controller that has no resource diff --git a/gemfiles/rails42.gemfile b/gemfiles/rails42.gemfile deleted file mode 100644 index ba33da99db..0000000000 --- a/gemfiles/rails42.gemfile +++ /dev/null @@ -1,49 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "administrate-field-image" -gem "autoprefixer-rails" -gem "faker" -gem "front_matter_parser" -gem "globalid" -gem "pg", "0.21.0" -gem "redcarpet" -gem "sentry-raven" -gem "unicorn" -gem "actionpack", "~> 4.2.0" -gem "actionview", "~> 4.2.0" -gem "activerecord", "~> 4.2.0" - -group :development, :test do - gem "appraisal" - gem "awesome_print" - gem "bundler-audit", require: false - gem "byebug" - gem "dotenv-rails" - gem "factory_bot_rails" - gem "i18n-tasks", "0.9.31" - gem "pry-rails" - gem "rspec-rails" -end - -group :test do - gem "ammeter" - gem "capybara", "3.33.0" - gem "database_cleaner" - gem "formulaic" - gem "launchy" - gem "pundit" - gem "selenium-webdriver" - gem "shoulda-matchers" - gem "timecop" - gem "webmock" - gem "xpath", "3.2.0" -end - -group :staging, :production do - gem "rack-timeout" - gem "uglifier" -end - -gemspec path: "../" diff --git a/gemfiles/rails50.gemfile b/gemfiles/rails50.gemfile index 7b0a44eb6a..1fe3600768 100644 --- a/gemfiles/rails50.gemfile +++ b/gemfiles/rails50.gemfile @@ -24,6 +24,7 @@ group :development, :test do gem "factory_bot_rails" gem "i18n-tasks", "0.9.31" gem "pry-rails" + gem "yard" gem "rspec-rails" end diff --git a/gemfiles/rails51.gemfile b/gemfiles/rails51.gemfile index 664ad8d91f..f853732b6e 100644 --- a/gemfiles/rails51.gemfile +++ b/gemfiles/rails51.gemfile @@ -24,6 +24,7 @@ group :development, :test do gem "factory_bot_rails" gem "i18n-tasks", "0.9.31" gem "pry-rails" + gem "yard" gem "rspec-rails" end diff --git a/gemfiles/rails52.gemfile b/gemfiles/rails52.gemfile index 8d5811cc59..5449a086b6 100644 --- a/gemfiles/rails52.gemfile +++ b/gemfiles/rails52.gemfile @@ -24,6 +24,7 @@ group :development, :test do gem "factory_bot_rails" gem "i18n-tasks", "0.9.31" gem "pry-rails" + gem "yard" gem "rspec-rails" end diff --git a/gemfiles/rails60.gemfile b/gemfiles/rails60.gemfile index 602878ef7b..1bf0ef1f3d 100644 --- a/gemfiles/rails60.gemfile +++ b/gemfiles/rails60.gemfile @@ -22,6 +22,7 @@ group :development, :test do gem "factory_bot_rails" gem "i18n-tasks", "0.9.31" gem "pry-rails" + gem "yard" gem "rspec-rails", "~> 4.0.0.beta2" end diff --git a/lib/generators/administrate/dashboard/templates/dashboard.rb.erb b/lib/generators/administrate/dashboard/templates/dashboard.rb.erb index 32c24547d8..7c0a65c0a9 100644 --- a/lib/generators/administrate/dashboard/templates/dashboard.rb.erb +++ b/lib/generators/administrate/dashboard/templates/dashboard.rb.erb @@ -21,7 +21,7 @@ class <%= class_name %>Dashboard < Administrate::BaseDashboard COLLECTION_ATTRIBUTES = %i[ <%= attributes.first(COLLECTION_ATTRIBUTE_LIMIT).map do |attr| - " #{attr}" + " #{attr}" end.join("\n") %> ].freeze @@ -31,7 +31,7 @@ class <%= class_name %>Dashboard < Administrate::BaseDashboard SHOW_PAGE_ATTRIBUTES = %i[ <%= attributes.map do |attr| - " #{attr}" + " #{attr}" end.join("\n") %> ].freeze @@ -42,7 +42,7 @@ class <%= class_name %>Dashboard < Administrate::BaseDashboard FORM_ATTRIBUTES = %i[ <%= form_attributes.map do |attr| - " #{attr}" + " #{attr}" end.join("\n") %> ].freeze diff --git a/spec/support/generator_spec_helpers.rb b/spec/support/generator_spec_helpers.rb index ec9f4e4c12..09bf175566 100644 --- a/spec/support/generator_spec_helpers.rb +++ b/spec/support/generator_spec_helpers.rb @@ -55,7 +55,7 @@ def copy_to_generator_root(destination, template) config.include GeneratorSpecHelpers config.before(:example, :generator) do - destination File.expand_path("../../../tmp", __FILE__) + destination File.expand_path("../../tmp/generator_tests_output", __dir__) prepare_destination end end