iconmap-rails 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffee894f6afcd5daa549857261eeeb4c663a25992edcc02bd59d442868153d80
4
- data.tar.gz: a28499b09beb0cf46259bbd7f16a78afadc5a0965c8529f6cc282cb74d94481f
3
+ metadata.gz: 5c61ce9e8224c055c3ab34e9be6ded6426502f32239eca9f0f791d97d4c4a9d2
4
+ data.tar.gz: 0f9799bc47f36f340b97dcd77820d28fc90bde120957fff908d169b9863e5554
5
5
  SHA512:
6
- metadata.gz: 1b5c60f56f2413639d944e46a6df23174842348399155c42ec64c2817174ee32cdd06b02dd818d1c5043c2886ca8782be22ea04f7dd4de09ebd1376fe9e76424
7
- data.tar.gz: a7d1717b47946064e9dd44fe7c2d9c2af513967a17dbe00109aa0add0a6b7b8917d19dab7b23a90c9b1547e7017a650f2050bb48f55fcc8be6f0a5ddd48a81fb
6
+ metadata.gz: 50de00b8417cafea43086a17b47d038b1e044c96360e755fb634aa7003d7a38aef73e2da9b87779699bcc348245a92e4d113ea3505107f66d9471428c497d027
7
+ data.tar.gz: 5f6c2a6aaf8868f6d2d5bcece89943d36a33160a97ba71afe90a05db78099f7d5f72888e7a3e2a71b5991c7df9774572004a446f42b37feb8117c732334fd105
data/README.md CHANGED
@@ -1,266 +1,292 @@
1
1
  # Iconmap for Rails
2
2
 
3
- Like [Importmap Rails](https://github.com/rails/importmap-rails), but for Icons.
3
+ Manage SVG icons from npm packages by vendoring them locally and serving them through the Rails asset pipeline.
4
4
 
5
- ## Installation
5
+ Iconmap for Rails downloads individual SVG files from npm packages via the [jsdelivr CDN](https://www.jsdelivr.com) and stores them in your Rails application. Icons are referenced by their npm package path and served as static files through Sprockets or Propshaft.
6
6
 
7
- Iconmap for Rails is automatically included in Rails 7+ for new applications, but you can also install it manually in existing applications:
7
+ ## Installation
8
8
 
9
9
  1. Run `./bin/bundle add iconmap-rails`
10
10
  2. Run `./bin/rails iconmap:install`
11
11
 
12
- You can pin those libraries manually by relying on the compiled versions included in Rails like this:
12
+ This creates:
13
13
 
14
- ```ruby
15
- pin "@rails/actioncable", to: "actioncable.esm.js"
16
- pin "@rails/activestorage", to: "activestorage.esm.js"
17
- pin "@rails/actiontext", to: "actiontext.esm.js"
18
- pin "trix"
19
- ```
14
+ - `config/iconmap.rb` — your icon map configuration
15
+ - `vendor/icons/` where vendored SVG files are stored
16
+ - `bin/iconmap` CLI for managing icons
20
17
 
21
- ## How do iconmaps work?
18
+ Tip: the `bin/iconmap` binstub is safe to commit to your app. Run it from the project root (for example `./bin/iconmap pin ...`).
22
19
 
23
- At their core, iconmaps are essentially a string substitution for what are referred to as "bare module specifiers". A "bare module specifier" looks like this: `import React from "react"`. This is not compatible with the ES Module loader spec. Instead, to be ESM compatible, you must provide 1 of the 3 following types of specifiers:
20
+ ## How it works
24
21
 
25
- - Absolute path:
26
- ```js
27
- import React from "/Users/DHH/projects/basecamp/node_modules/react"
28
- ```
22
+ Iconmap uses a simple pin-based system to vendor single SVG files from npm packages.
29
23
 
30
- - Relative path:
31
- ```js
32
- import React from "./node_modules/react"
33
- ```
24
+ 1. Pin an icon (examples below). The CLI parses the package name, optional version, and icon path, then:
25
+ - Resolves the package version via the jsdelivr data API when no explicit version is given
26
+ - Downloads the SVG from `https://cdn.jsdelivr.net/npm/<package>@<version>/<path>`
27
+ - Writes the file to `vendor/icons/` using a flat filename derived from the package/path (slashes replaced with `--`)
28
+ - Appends or updates a `pin` line in `config/iconmap.rb` with the resolved version comment
34
29
 
35
- - HTTP path:
36
- ```js
37
- import React from "https://ga.jspm.io/npm:react@17.0.1/index.js"
38
- ```
39
-
40
- Iconmap-rails provides a clean API for mapping "bare module specifiers" like `"react"`
41
- to 1 of the 3 viable ways of loading ES Module javascript packages.
30
+ 2. Serve icons: `vendor/icons/` is added to the Rails asset paths so vendored SVGs are available via the normal Rails asset helpers.
42
31
 
43
- For example:
32
+ Pin syntax examples (CLI usage shown below):
44
33
 
45
- ```rb
46
- # config/iconmap.rb
47
- pin "react", to: "https://ga.jspm.io/npm:react@17.0.2/index.js"
34
+ ```bash
35
+ ./bin/iconmap pin @fortawesome/fontawesome-free/svgs/brands/github.svg
36
+ ./bin/iconmap pin @fortawesome/fontawesome-free@6.7.0/svgs/brands/github.svg
37
+ ./bin/iconmap pin some-package/icons/logo.svg
48
38
  ```
49
39
 
50
- means "everytime you see `import React from "react"`
51
- change it to `import React from "https://ga.jspm.io/npm:react@17.0.2/index.js"`"
40
+ In `config/iconmap.rb` a pin looks like:
52
41
 
53
- ```js
54
- import React from "react"
55
- // => import React from "https://ga.jspm.io/npm:react@17.0.2/index.js"
42
+ ```ruby
43
+ pin '@fortawesome/fontawesome-free/svgs/brands/github.svg' # @6.7.2
56
44
  ```
57
45
 
58
- ## Usage
46
+ The downloaded filename mirrors the pin but with path separators replaced by `--`, for example:
47
+ `@fortawesome--fontawesome-free--svgs--brands--github.svg` in `vendor/icons/`.
59
48
 
60
- The icon map is setup through `Rails.application.iconmap` via the configuration in `config/iconmap.rb`. This file is automatically reloaded in development upon changes, but note that you must restart the server if you remove pins and need them gone from the rendered iconmap or list of preloads.
49
+ Notes:
50
+ - Scoped package names (those starting with `@`) are preserved in the filename and mapping.
51
+ - If jsdelivr fails to resolve a package version the CLI will leave the pin without a version comment and print a helpful error.
61
52
 
62
- It makes sense to use logical names that match the package names used by npm, such that if you later want to start transpiling or bundling your code, you won't have to change any module imports.
53
+ ## Usage
63
54
 
64
- ### Local modules
55
+ All commands are run via the `bin/iconmap` binstub that `iconmap:install` creates.
65
56
 
66
- If you want to import local js module files from `app/javascript/src` or other sub-folders of `app/javascript` (such as `channels`), you must pin these to be able to import them. You can use `pin_all_from` to pick all files in a specific folder, so you don't have to `pin` each module individually.
57
+ ### Pinning icons
67
58
 
68
- ```rb
69
- # config/iconmap.rb
70
- pin_all_from 'app/javascript/src', under: 'src', to: 'src'
71
- ```
59
+ Pin a single icon from an npm package:
72
60
 
73
- The `:to` parameter is only required if you want to change the destination logical import name. If you drop the :to option, you must place the :under option directly after the first parameter.
61
+ ```bash
62
+ ./bin/iconmap pin @fortawesome/fontawesome-free/svgs/brands/github.svg
63
+ ```
74
64
 
75
- Allows you to:
65
+ Pin a specific version:
76
66
 
77
- ```js
78
- // app/javascript/application.js
79
- import { ExampleFunction } from 'src/example_function'
67
+ ```bash
68
+ ./bin/iconmap pin @fortawesome/fontawesome-free@6.7.0/svgs/brands/github.svg
80
69
  ```
81
- Which imports the function from `app/javascript/src/example_function.js`.
82
-
83
- Note: Sprockets used to serve assets (albeit without filename digests) it couldn't find from the `app/javascripts` folder with logical relative paths, meaning pinning local files wasn't needed. Propshaft doesn't have this fallback, so when you use Propshaft you have to pin your local modules.
84
70
 
85
- ## Using npm packages via JavaScript CDNs
71
+ Pin multiple icons at once:
86
72
 
87
- Iconmap for Rails downloads and vendors your npm package dependencies via JavaScript CDNs that provide pre-compiled distribution versions.
73
+ ```bash
74
+ ./bin/iconmap pin \
75
+ @fortawesome/fontawesome-free/svgs/brands/github.svg \
76
+ @fortawesome/fontawesome-free/svgs/solid/heart.svg
77
+ ```
88
78
 
89
- You can use the `./bin/iconmap` command that's added as part of the install to pin, unpin, or update npm packages in your import map. This command uses an API from [JSPM.org](https://jspm.org) to resolve your package dependencies efficiently, and then add the pins to your `config/iconmap.rb` file. It can resolve these dependencies from JSPM itself, but also from other CDNs, like [unpkg.com](https://unpkg.com) and [jsdelivr.com](https://www.jsdelivr.com).
79
+ After pinning, you will see lines like this in `config/iconmap.rb`:
90
80
 
91
- ```bash
92
- ./bin/iconmap pin react
93
- Pinning "react" to vendor/react.js via download from https://ga.jspm.io/npm:react@17.0.2/index.js
94
- Pinning "object-assign" to vendor/object-assign.js via download from https://ga.jspm.io/npm:object-assign@4.1.1/index.js
81
+ ```ruby
82
+ pin '@fortawesome/fontawesome-free/svgs/brands/github.svg' # @6.7.2
83
+ pin '@fortawesome/fontawesome-free/svgs/solid/heart.svg' # @6.7.2
95
84
  ```
96
85
 
97
- This will produce pins in your `config/iconmap.rb` like so:
86
+ Referencing vendored icons in Rails views:
98
87
 
99
88
  ```ruby
100
- pin "react" # https://ga.jspm.io/npm:react@17.0.2/index.js
101
- pin "object-assign" # https://ga.jspm.io/npm:object-assign@4.1.1/index.js
89
+ # use asset_path or image_tag with the vendored filename
90
+ image_tag asset_path('@fortawesome--fontawesome-free--svgs--brands--github.svg')
102
91
  ```
103
92
 
104
- The packages are downloaded to `vendor/icons`, which you can check into your source control, and they'll be available through your application's own asset pipeline serving.
93
+ Because `vendor/icons` is added to the app's asset paths the vendored SVGs are available to `asset_path`, `image_tag`, `stylesheet_link_tag`, etc.
94
+
95
+ Real example — Font Awesome GitHub brand icon
105
96
 
106
- If you later wish to remove a downloaded pin:
97
+ 1. Pin the latest Font Awesome GitHub brand SVG:
107
98
 
108
99
  ```bash
109
- ./bin/iconmap unpin react
110
- Unpinning and removing "react"
111
- Unpinning and removing "object-assign"
100
+ ./bin/iconmap pin @fortawesome/fontawesome-free/svgs/brands/github.svg
112
101
  ```
113
102
 
114
- ## Preloading pinned modules
103
+ 2. Or pin a specific version (example uses 6.7.0):
115
104
 
116
- To avoid the waterfall effect where the browser has to load one file after another before it can get to the deepest nested import, iconmap-rails uses [modulepreload links](https://developers.google.com/web/updates/2017/12/modulepreload) by default. If you don't want to preload a dependency, because you want to load it on-demand for efficiency, append `preload: false` to the pin.
105
+ ```bash
106
+ ./bin/iconmap pin @fortawesome/fontawesome-free@6.7.0/svgs/brands/github.svg
107
+ ```
117
108
 
118
- Example:
109
+ The vendored file will be written to `vendor/icons/` with a flattened name, for example:
119
110
 
120
- ```ruby
121
- # config/iconmap.rb
122
- pin "@github/hotkey", to: "@github--hotkey.js" # file lives in vendor/icons/@github--hotkey.js
123
- pin "md5", preload: false # file lives in vendor/javascript/md5.js
111
+ ```
112
+ @fortawesome--fontawesome-free--svgs--brands--github.svg
113
+ ```
124
114
 
125
- # app/views/layouts/application.html.erb
126
- <%= javascript_iconmap_tags %>
115
+ Because `vendor/icons` is added to the Rails asset paths you can reference the file from views. For inline SVG rendering, we recommend using the `inline_svg` gem (https://github.com/jamesmartin/inline_svg). Example ERB:
127
116
 
128
- # will include the following link before the iconmap is setup:
129
- <link rel="modulepreload" href="/assets/javascript/@github--hotkey.js">
130
- ...
117
+ ```erb
118
+ <%= inline_svg_tag '@fortawesome--fontawesome-free--svgs--brands--github.svg', class: 'icon' %>
131
119
  ```
132
120
 
133
- You can also specify which entry points to preload a particular dependency in by providing `preload:` a string or array of strings.
134
-
135
- Example:
121
+ Or using asset helpers directly:
136
122
 
137
123
  ```ruby
138
- # config/iconmap.rb
139
- pin "@github/hotkey", to: "@github--hotkey.js", preload: 'application'
140
- pin "md5", preload: ['application', 'alternate']
124
+ image_tag asset_path('@fortawesome--fontawesome-free--svgs--brands--github.svg'), alt: 'GitHub'
125
+ ```
141
126
 
142
- # app/views/layouts/application.html.erb
143
- <%= javascript_iconmap_tags 'alternate' %>
127
+ ### Unpinning icons
144
128
 
145
- # will include the following link before the iconmap is setup:
146
- <link rel="modulepreload" href="/assets/javascript/md5.js">
147
- ...
129
+ Remove an icon and its vendored file:
130
+
131
+ ```bash
132
+ ./bin/iconmap unpin @fortawesome/fontawesome-free/svgs/brands/github.svg
148
133
  ```
149
134
 
135
+ This removes the matching `pin` line from `config/iconmap.rb` and deletes the vendored SVG file from `vendor/icons/`.
150
136
 
137
+ ### Checking for outdated icons
151
138
 
152
- ## Composing import maps
139
+ Check jsdelivr for newer versions of the npm packages behind your pinned icons:
153
140
 
154
- By default, Rails loads import map definition from the application's `config/iconmap.rb` to the `Iconmap::Map` object available at `Rails.application.iconmap`.
141
+ ```bash
142
+ ./bin/iconmap outdated
143
+ ```
155
144
 
156
- You can combine multiple import maps by adding paths to additional import map configs to `Rails.application.config.iconmap.paths`. For example, appending import maps defined in Rails engines:
145
+ Example output:
157
146
 
158
- ```ruby
159
- # my_engine/lib/my_engine/engine.rb
147
+ ```
148
+ | Icon | Current | Latest |
149
+ |------------------------------------------------------|---------|--------|
150
+ | @fortawesome/fontawesome-free/svgs/brands/github.svg | 6.7.0 | 6.7.2 |
151
+ 1 outdated icon found
152
+ ```
160
153
 
161
- module MyEngine
162
- class Engine < ::Rails::Engine
163
- # ...
164
- initializer "my-engine.iconmap", before: "iconmap" do |app|
165
- app.config.iconmap.paths << Engine.root.join("config/iconmap.rb")
166
- # ...
167
- end
168
- end
169
- end
154
+ If jsdelivr fails to resolve a version for a package, the table will show an error message in the `Latest` column.
155
+
156
+ ### Updating outdated icons
157
+
158
+ Re-download icons from packages that have newer versions available and update your pins:
159
+
160
+ ```bash
161
+ ./bin/iconmap update
170
162
  ```
171
163
 
172
- And pinning JavaScript modules from the engine:
164
+ For each outdated icon, this command:
173
165
 
174
- ```ruby
175
- # my_engine/config/iconmap.rb
166
+ - Downloads the SVG for the latest version
167
+ - Replaces the vendored file in `vendor/icons/`
168
+ - Updates the `# @<version>` comment in `config/iconmap.rb`
169
+
170
+ ### Re-downloading all icons
171
+
172
+ Re-download every pinned icon from jsdelivr, regardless of version:
176
173
 
177
- pin_all_from File.expand_path("../app/assets/javascripts", __dir__)
174
+ ```bash
175
+ ./bin/iconmap pristine
178
176
  ```
179
177
 
178
+ This is useful after checking out a new branch, restoring from backup, or when vendored files may be corrupted.
180
179
 
181
- ## Selectively importing modules
180
+ If you commit the vendored files to your repository you will not need to run `pristine` after a fresh checkout; run it only when files are missing or you suspect corruption.
182
181
 
183
- You can selectively import your javascript modules on specific pages.
182
+ ### Security audit
184
183
 
185
- Create your javascript in `app/javascript`:
184
+ Check the npm registry for known security vulnerabilities in your pinned packages:
186
185
 
187
- ```js
188
- // /app/javascript/checkout.js
189
- // some checkout specific js
186
+ ```bash
187
+ ./bin/iconmap audit
190
188
  ```
191
189
 
192
- Pin your js file:
190
+ Example output:
193
191
 
194
- ```rb
195
- # config/iconmap.rb
196
- # ... other pins...
197
- pin "checkout", preload: false
192
+ ```
193
+ | Package | Severity | Vulnerable versions | Vulnerability |
194
+ |----------------|----------|---------------------|----------------------|
195
+ | some-package | high | < 2.0.0 | Remote code execution|
196
+ 1 vulnerability found: 1 high
198
197
  ```
199
198
 
200
- Import your module on the specific page. Note: you'll likely want to use a `content_for` block on the specifc page/partial, then yield it in your layout.
199
+ The command exits with status 1 when vulnerabilities are found.
201
200
 
202
- ```erb
203
- <% content_for :head do %>
204
- <%= javascript_import_module_tag "checkout" %>
205
- <% end %>
201
+ ### Listing pinned packages
202
+
203
+ Display all pinned icons with their resolved versions:
204
+
205
+ ```bash
206
+ ./bin/iconmap packages
206
207
  ```
207
208
 
208
- **Important**: The `javascript_import_module_tag` should come after your `javascript_iconmap_tags`
209
+ Example output:
209
210
 
210
- ```erb
211
- <%= javascript_iconmap_tags %>
212
- <%= yield(:head) %>
211
+ ```
212
+ @fortawesome/fontawesome-free 6.7.2 @fortawesome/fontawesome-free/svgs/brands/github.svg
213
+ @fortawesome/fontawesome-free 6.7.2 @fortawesome/fontawesome-free/svgs/solid/heart.svg
213
214
  ```
214
215
 
216
+ ## Configuration
215
217
 
216
- ## Include a digest of the import map in your ETag
218
+ ### config/iconmap.rb
217
219
 
218
- If you're using [ETags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) generated by Rails helpers like `stale?` or `fresh_when`, you need to include the digest of the import map into this calculation. Otherwise your application will return [304](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304) cache responses even when your JavaScript assets have changed. You can avoid this using the `stale_when_iconmap_changes` method:
220
+ The icon map file uses `pin` directives to define vendored icons:
219
221
 
220
222
  ```ruby
221
- class ApplicationController < ActionController::Base
222
- stale_when_iconmap_changes
223
- end
223
+ # config/iconmap.rb
224
+
225
+ # Pin icons by running ./bin/iconmap
226
+
227
+ # Pin with version comment (automatically added by iconmap)
228
+
229
+ # Pin without version comment (version will be resolved dynamically)
224
230
  ```
225
231
 
226
- This will add the digest of the iconmap to the etag calculation when the request format is HTML.
232
+ Iconmap does not currently support additional pin options (like `preload:` or `to:`) every pin represents a single SVG at a specific version.
233
+
234
+ If you need to combine multiple maps (for engines or shared gems) see the "Composing icon maps" section below.
235
+
236
+ ### Cache sweeping
227
237
 
238
+ In development and test environments Iconmap can automatically clear its internal caches when files change.
228
239
 
229
- ## Sweeping the cache in development and test
240
+ The engine configures:
230
241
 
231
- Generating the import map json and modulepreloads may require resolving hundreds of assets. This can take a while, so these operations are cached, but in development and test, we watch for changes to both `config/iconmap.rb` and files in `app/javascript` to clear this cache. This feature can be controlled in an environment configuration file via the boolean `config.iconmap.sweep_cache`.
242
+ - `config.iconmap.paths` list of iconmap config files (by default just `config/iconmap.rb`)
243
+ - `config.iconmap.sweep_cache` — whether to set up file watching (defaults to `Rails.env.local?`)
244
+ - `config.iconmap.cache_sweepers` — extra directories to watch in addition to `vendor/icons`
232
245
 
233
- If you're pinning local files from outside of `app/javascript`, you'll need to add them to the cache sweeper configuration or restart your development server upon changes to those external files. For example, here's how you can do it for Rails engine:
246
+ Behavior:
247
+
248
+ - An asset watcher clears the map cache when vendored SVGs in `vendor/icons` change (the watcher observes `*.svg`).
249
+ - A dedicated `Iconmap::Reloader` watches the `config.iconmap.paths` (for example `config/iconmap.rb`) and automatically re-draws the map when pin files change — this avoids needing to restart the Rails server after editing pins in development.
250
+
251
+ To opt out of automatic reloading set `config.iconmap.sweep_cache = false` in your environment config.
252
+
253
+ ## Composing icon maps
254
+
255
+ By default, Rails loads the icon map from `config/iconmap.rb` into `Rails.application.iconmap`.
256
+
257
+ You can combine multiple icon maps by adding paths to `Rails.application.config.iconmap.paths`, for example from a Rails engine:
234
258
 
235
259
  ```ruby
236
260
  # my_engine/lib/my_engine/engine.rb
237
-
238
261
  module MyEngine
239
262
  class Engine < ::Rails::Engine
240
- # ...
241
- initializer "my-engine.iconmap", before: "iconmap" do |app|
242
- # ...
243
- app.config.iconmap.cache_sweepers << Engine.root.join("app/assets/icons")
263
+ initializer 'my-engine.iconmap', before: 'iconmap' do |app|
264
+ app.config.iconmap.paths << Engine.root.join('config/iconmap.rb')
244
265
  end
245
266
  end
246
267
  end
247
268
  ```
248
269
 
249
- ## Checking for outdated or vulnerable packages
270
+ The engine's `config/iconmap.rb` can then declare its own pins that will be merged into the main application's icon map.
250
271
 
251
- Iconmap for Rails provides two commands to check your pinned packages:
252
- - `./bin/iconmap outdated` checks the NPM registry for new versions
253
- - `./bin/iconmap audit` checks the NPM registry for known security issues
272
+ ## Rails integration
254
273
 
255
- ## Supporting legacy browsers such as Safari on iOS 15
274
+ Iconmap for Rails integrates via a Rails engine (`Iconmap::Engine`) that:
256
275
 
257
- If you want to support [legacy browsers that do not support import maps](https://caniuse.com/import-maps) such as [iOS 15.8.1 released on 22 Jan 2024](https://support.apple.com/en-us/HT201222), insert [`es-module-shims`](https://github.com/guybedford/es-module-shims) before `javascript_iconmap_tags` as below.
276
+ 1. **Defines `Rails.application.iconmap`** as an `Iconmap::Map` instance.
277
+ 2. **Loads pin definitions** from all paths in `config.iconmap.paths` (by default `config/iconmap.rb`).
278
+ 3. **Adds `vendor/icons` to the asset pipeline** so your SVGs are served like any other asset.
279
+ 4. **Optionally sets up a cache sweeper** in development and test that watches icon files and clears the map cache when they change.
258
280
 
259
- ```erb
260
- <script async src="https://ga.jspm.io/npm:es-module-shims@1.8.2/dist/es-module-shims.js" data-turbo-track="reload"></script>
261
- <%= javascript_iconmap_tags %>
281
+ ### Accessing the icon map
282
+
283
+ ```ruby
284
+ iconmap = Rails.application.iconmap
285
+ iconmap.packages #=> hash of pin name -> MappedFile
262
286
  ```
263
287
 
288
+ The `Iconmap::Map` API is intentionally small and internal – most applications should interact with icons via the CLI and asset helpers, not by manipulating the map directly.
289
+
264
290
  ## License
265
291
 
266
292
  Iconmap for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,13 +1,15 @@
1
- require "bundler/setup"
1
+ # frozen_string_literal: true
2
2
 
3
- APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
- load "rails/tasks/engine.rake"
3
+ require 'bundler/setup'
5
4
 
6
- load "rails/tasks/statistics.rake"
5
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
6
+ load 'rails/tasks/engine.rake'
7
7
 
8
- require "bundler/gem_tasks"
8
+ load 'rails/tasks/statistics.rake'
9
9
 
10
- require "rake/testtask"
10
+ require 'bundler/gem_tasks'
11
+
12
+ require 'rake/testtask'
11
13
 
12
14
  Rake::TestTask.new(:test) do |t|
13
15
  t.libs << 'test'