Skip to content

Commit

Permalink
Merge pull request #5855 from sgara/add-webpacker-switch
Browse files Browse the repository at this point in the history
Add webpacker compatibility with config switch and installation generator
  • Loading branch information
javierjulio authored Mar 19, 2020
2 parents 5189ad2 + 8c5ed9d commit 733a0d0
Show file tree
Hide file tree
Showing 19 changed files with 630 additions and 15 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ jobs:
steps:
*test_app_steps

testapp60webpacker:
docker:
- image: circleci/ruby:2.6.5-node
user: root

environment:
BUNDLE_GEMFILE: gemfiles/rails_60_webpacker/Gemfile

steps:
*test_app_steps

lint_and_docs:
docker:
- image: circleci/ruby:2.6.5-node
Expand Down Expand Up @@ -305,6 +316,17 @@ jobs:
steps:
*test_steps

ruby26rails60webpacker:
docker:
- image: circleci/ruby:2.6.5-node-browsers
user: root

environment:
BUNDLE_GEMFILE: gemfiles/rails_60_webpacker/Gemfile

steps:
*test_steps

ruby27rails52:
docker:
- image: circleci/ruby:2.7.0-node-browsers
Expand Down Expand Up @@ -338,6 +360,17 @@ jobs:
steps:
*test_steps

ruby27rails60webpacker:
docker:
- image: circleci/ruby:2.7.0-node-browsers
user: root

environment:
BUNDLE_GEMFILE: gemfiles/rails_60_webpacker/Gemfile

steps:
*test_steps

jruby92rails52:
docker:
- image: circleci/jruby:9.2.11.0-node-browsers
Expand Down Expand Up @@ -394,6 +427,10 @@ workflows:
requires:
- setup_coverage

- testapp60webpacker:
requires:
- setup_coverage

- ruby24rails52:
requires:
- testapp52
Expand All @@ -418,6 +455,10 @@ workflows:
requires:
- testapp60turbolinks

- ruby26rails60webpacker:
requires:
- testapp60webpacker

- ruby27rails52:
requires:
- testapp52
Expand All @@ -430,6 +471,10 @@ workflows:
requires:
- testapp60turbolinks

- ruby27rails60webpacker:
requires:
- testapp60webpacker

- jruby92rails52:
requires:
- testapp52
Expand All @@ -445,6 +490,7 @@ workflows:
- testapp52
- testapp60
- testapp60turbolinks
- testapp60webpacker

- ruby24rails52

Expand All @@ -454,10 +500,12 @@ workflows:
- ruby26rails52
- ruby26rails60
- ruby26rails60turbolinks
- ruby26rails60webpacker

- ruby27rails52
- ruby27rails60
- ruby27rails60turbolinks
- ruby27rails60webpacker

- jruby92rails52
- jruby92rails60
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Enhancements

* Extend menu to allow for nested submenus. [#5994] by [@taralbass]
* Add Webpacker compatibility with opt-in config switch and installation generator. [#5855] by [@sgara]

## 2.6.1 [](https://github.com/activeadmin/activeadmin/compare/v2.6.0..v2.6.1)

Expand All @@ -17,7 +18,7 @@

## 2.6.0 [](https://github.com/activeadmin/activeadmin/compare/v2.5.0..v2.6.0)

### Enhacements
### Enhancements

* Display multiple flash messages in separate elements. [#5929] by [@mirelon]
* Make delete confirmation messages in French & Spanish gender-neutral. [#5946] by [@cprodhomme]
Expand Down Expand Up @@ -540,6 +541,7 @@ Please check [0-6-stable] for previous changes.
[#5548]: https://github.com/activeadmin/activeadmin/pull/5548
[#5842]: https://github.com/activeadmin/activeadmin/pull/5842
[#5854]: https://github.com/activeadmin/activeadmin/pull/5854
[#5855]: https://github.com/activeadmin/activeadmin/pull/5855
[#5874]: https://github.com/activeadmin/activeadmin/pull/5874
[#5877]: https://github.com/activeadmin/activeadmin/pull/5877
[#5886]: https://github.com/activeadmin/activeadmin/pull/5886
Expand Down
12 changes: 10 additions & 2 deletions app/views/layouts/active_admin_logged_out.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
<title><%= [@page_title, ActiveAdmin.application.site_title(self)].compact.join(" | ") %></title>

<% ActiveAdmin.application.stylesheets.each do |style, options| %>
<%= stylesheet_link_tag style, options %>
<% if ActiveAdmin.application.use_webpacker %>
<%= stylesheet_pack_tag style, options %>
<% else %>
<%= stylesheet_link_tag style, options %>
<% end %>
<% end %>
<% ActiveAdmin.application.javascripts.each do |path| %>
<%= javascript_include_tag path %>
<% if ActiveAdmin.application.use_webpacker %>
<%= javascript_pack_tag path %>
<% else %>
<%= javascript_include_tag path %>
<% end %>
<% end %>

<%= favicon_link_tag ActiveAdmin.application.favicon if ActiveAdmin.application.favicon %>
Expand Down
24 changes: 24 additions & 0 deletions docs/0-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ Draper::CollectionDecorator.send :delegate, :per_page_kaminari

If you're getting the error `wrong number of arguments (6 for 4..5)`, [read #2703].

## webpacker

For new apps starting with Rails 6.0, Webpacker has become the default asset generator. You can **opt-in to using Webpacker for ActiveAdmin assets** as well by updating your configuration to turn on the `use_webpacker` option, either at installation time or manually.

* at active_admin installation:

```sh
rails g active_admin:install --use_webpacker
```

* manually:

```ruby
ActiveAdmin.setup do |config|
config.use_webpacker = true
end
```

And run the generator to get default Active Admin assets:

```sh
rails g active_admin:webpacker
```

[CHANGELOG]: https://github.com/activeadmin/activeadmin/blob/master/CHANGELOG.md
[dashboard.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/dashboard.rb
[active_admin.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/active_admin.rb.erb
Expand Down
41 changes: 41 additions & 0 deletions gemfiles/rails_60_webpacker/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
source "https://rubygems.org"

group :development, :test do
gem 'rake'
gem 'pry' # Easily debug from your console with `binding.pry`
gem 'pry-byebug', platform: :mri # Step-by-step debugging

gem 'cancancan'
gem 'pundit'
gem 'jruby-openssl', '~> 0.10.1', platform: :jruby

gem 'draper', '~> 4.0'
gem "devise", "~> 4.7"

gem "rails", "~> 6.0.0", github: "rails/rails", branch: "6-0-stable", ref: "3ed7c5864ff4ac349848722fbf682a657eebddbf"
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0", platform: :jruby

gem "webpacker", "~> 4.0"

gem "formtastic", github: "justinfrench/formtastic"
end

group :test do
gem 'apparition'
gem 'capybara', '~> 3.14'
gem 'db-query-matchers', '0.10.0'

gem 'simplecov', '0.17.1', require: false # Test coverage generator. Go to /coverage/ after running tests
gem 'cucumber-rails', '~> 2.0', require: false
gem 'cucumber'
gem 'database_cleaner'
gem 'jasmine'
gem 'jasmine-core', '2.99.2' # last release with Ruby 2.2 support.
gem 'launchy'
gem 'parallel_tests', '~> 2.26'
gem 'rails-i18n' # Provides default i18n for many languages
gem 'rspec-rails'
gem "sqlite3", "~> 1.4", platform: :mri
end

gemspec path: "../.."
Loading

0 comments on commit 733a0d0

Please sign in to comment.